develop&-nr up-to-date as of 30.7.19

This commit is contained in:
yilmazt
2019-07-30 22:01:48 +02:00
96 changed files with 4420 additions and 466 deletions
+4
View File
@@ -25,4 +25,8 @@ MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_del
MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_enb_delete_tunnel_resp_t, Gtpv1uDeleteTunnelResp)
MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_ind_t, Gtpv1uTunnelDataInd)
MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_req_t, Gtpv1uTunnelDataReq)
MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_req_t,Gtpv1uDataForwardingReq)
MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_ind_t,Gtpv1uDataForwardingInd)
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq)
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd)
MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv1uS1Req)
+67
View File
@@ -33,10 +33,33 @@
#define GTPV1U_ENB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDeleteTunnelResp
#define GTPV1U_ENB_TUNNEL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataInd
#define GTPV1U_ENB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataReq
#define GTPV1U_ENB_DATA_FORWARDING_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingReq
#define GTPV1U_ENB_DATA_FORWARDING_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingInd
#define GTPV1U_ENB_END_MARKER_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uEndMarkerReq
#define GTPV1U_ENB_END_MARKER_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uEndMarkerInd
#define GTPV1U_ENB_S1_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uS1Req
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
typedef struct gtpv1u_enb_create_x2u_tunnel_req_s {
rnti_t rnti;
int num_tunnels;
teid_t tenb_X2u_teid[GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier
ebi_t eps_bearer_id[GTPV1U_MAX_BEARERS_PER_UE];
transport_layer_addr_t enb_addr[GTPV1U_MAX_BEARERS_PER_UE];
} gtpv1u_enb_create_x2u_tunnel_req_t;
typedef struct gtpv1u_enb_create_x2u_tunnel_resp_s {
uint8_t status; ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0)
rnti_t rnti;
int num_tunnels;
teid_t enb_X2u_teid[GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier
ebi_t eps_bearer_id[GTPV1U_MAX_BEARERS_PER_UE];
transport_layer_addr_t enb_addr;
} gtpv1u_enb_create_x2u_tunnel_resp_t;
typedef struct gtpv1u_enb_create_tunnel_req_s {
rnti_t rnti;
int num_tunnels;
@@ -99,6 +122,50 @@ typedef struct gtpv1u_enb_tunnel_data_req_s {
rb_id_t rab_id;
} gtpv1u_enb_tunnel_data_req_t;
typedef struct gtpv1u_enb_data_forwarding_req_s {
uint8_t *buffer;
uint32_t length;
uint32_t offset; ///< start of message offset in buffer
rnti_t rnti;
rb_id_t rab_id;
} gtpv1u_enb_data_forwarding_req_t;
typedef struct gtpv1u_enb_data_forwarding_ind_s {
uint32_t frame;
uint8_t enb_flag;
uint32_t rb_id;
uint32_t muip;
uint32_t confirmp;
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint16_t rnti;
uint8_t module_id;
uint8_t eNB_index;
} gtpv1u_enb_data_forwarding_ind_t;
typedef struct gtpv1u_enb_end_marker_req_s {
uint8_t *buffer;
uint32_t length;
uint32_t offset; ///< start of message offset in buffer
rnti_t rnti;
rb_id_t rab_id;
} gtpv1u_enb_end_marker_req_t;
typedef struct gtpv1u_enb_end_marker_ind_s {
uint32_t frame;
uint8_t enb_flag;
uint32_t rb_id;
uint32_t muip;
uint32_t confirmp;
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint16_t rnti;
uint8_t module_id;
uint8_t eNB_index;
} gtpv1u_enb_end_marker_ind_t;
typedef struct {
in_addr_t enb_ip_address_for_S1u_S12_S4_up;
tcp_udp_port_t enb_port_for_S1u_S12_S4_up;
+2
View File
@@ -107,6 +107,8 @@ typedef struct x2ap_register_enb_req_s {
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
uint32_t subframeAssignment[MAX_NUM_CCs];
uint32_t specialSubframe[MAX_NUM_CCs];
int num_cc;
/* To be considered for TDD */
+3 -1
View File
@@ -157,7 +157,7 @@ void RCconfig_L1(void) {
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
//mac_top_init_eNB();
mac_top_init_eNB();
configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd,
RC.eNB[j][0]->eth_params_n .remote_portd);
} else { // other midhaul
@@ -2505,6 +2505,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
X2AP_REGISTER_ENB_REQ (msg_p).frame_type[J] = FDD;
} else if (strcmp(ccparams_lte.frame_type, "TDD") == 0) {
X2AP_REGISTER_ENB_REQ (msg_p).frame_type[J] = TDD;
X2AP_REGISTER_ENB_REQ (msg_p).subframeAssignment[J] = ccparams_lte.tdd_config;
X2AP_REGISTER_ENB_REQ (msg_p).specialSubframe[J] = ccparams_lte.tdd_config_s;
} else {
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n",
+48 -51
View File
@@ -1,4 +1,3 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -27,7 +26,6 @@
* \version 0.1
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#include "COMMON/platform_types.h"
@@ -81,56 +79,55 @@ typedef struct band_info_s {
} band_info_t;
static const eutra_bandentry_t eutra_bandtable[] = {
{1, 19200, 19800, 21100, 21700, 0 },
{2, 18500, 19100, 19300, 19900, 6000 },
{3, 17100, 17850, 18050, 18800, 12000},
{4, 17100, 17550, 21100, 21550, 19500},
{5, 8240, 8490, 8690, 8940, 24000},
{6, 8300, 8400, 8750, 8850, 26500},
{7, 25000, 25700, 26200, 26900, 27500},
{8, 8800, 9150, 9250, 9600, 34500},
{9, 17499, 17849, 18449, 18799, 38000},
{10, 17100, 17700, 21100, 21700, 41500},
{11, 14279, 14529, 14759, 15009, 47500},
{12, 6980, 7160, 7280, 7460, 50100},
{13, 7770, 7870, 7460, 7560, 51800},
{14, 7880, 7980, 7580, 7680, 52800},
{17, 7040, 7160, 7340, 7460, 57300},
{18, 8150, 9650, 8600, 10100, 58500},
{19, 8300, 8450, 8750, 8900, 60000},
{20, 8320, 8620, 7910, 8210, 61500},
{21, 14479, 14629, 14959, 15109, 64500},
{22, 34100, 34900, 35100, 35900, 66000},
{23, 20000, 20200, 21800, 22000, 75000},
{24, 16126, 16605, 15250, 15590, 77000},
{25, 18500, 19150, 19300, 19950, 80400},
{26, 8140, 8490, 8590, 8940, 86900},
{27, 8070, 8240, 8520, 8690, 90400},
{28, 7030, 7580, 7580, 8130, 92100},
{29, 0, 0, 7170, 7280, 96600},
{30, 23050, 23250, 23500, 23600, 97700},
{31, 45250, 34900, 46250, 35900, 98700},
{32, 0, 0, 14520, 14960, 99200},
{33, 19000, 19200, 19000, 19200, 36000},
{34, 20100, 20250, 20100, 20250, 36200},
{35, 18500, 19100, 18500, 19100, 36350},
{36, 19300, 19900, 19300, 19900, 36950},
{37, 19100, 19300, 19100, 19300, 37550},
{38, 25700, 26200, 25700, 26300, 37750},
{39, 18800, 19200, 18800, 19200, 38250},
{40, 23000, 24000, 23000, 24000, 38650},
{41, 24960, 26900, 24960, 26900, 39650},
{42, 34000, 36000, 34000, 36000, 41590},
{43, 36000, 38000, 36000, 38000, 43590},
{44, 7030, 8030, 7030, 8030, 45590},
{45, 14470, 14670, 14470, 14670, 46590},
{46, 51500, 59250, 51500, 59250, 46790},
{65, 19200, 20100, 21100, 22000, 65536},
{66, 17100, 18000, 21100, 22000, 66436},
{67, 0, 0, 7380, 7580, 67336},
{68, 6980, 7280, 7530, 7830, 67536}
{1, 19200, 19800, 21100, 21700, 0 },
{2, 18500, 19100, 19300, 19900, 6000 },
{3, 17100, 17850, 18050, 18800, 12000 },
{4, 17100, 17550, 21100, 21550, 19500 },
{5, 8240, 8490, 8690, 8940, 24000 },
{6, 8300, 8400, 8750, 8850, 26500 },
{7, 25000, 25700, 26200, 26900, 27500 },
{8, 8800, 9150, 9250, 9600, 34500 },
{9, 17499, 17849, 18449, 18799, 38000 },
{10, 17100, 17700, 21100, 21700, 41500 },
{11, 14279, 14529, 14759, 15009, 47500 },
{12, 6980, 7160, 7280, 7460, 50100 },
{13, 7770, 7870, 7460, 7560, 51800 },
{14, 7880, 7980, 7580, 7680, 52800 },
{17, 7040, 7160, 7340, 7460, 57300 },
{18, 8150, 9650, 8600, 10100, 58500 },
{19, 8300, 8450, 8750, 8900, 60000 },
{20, 8320, 8620, 7910, 8210, 61500 },
{21, 14479, 14629, 14959, 15109, 64500 },
{22, 34100, 34900, 35100, 35900, 66000 },
{23, 20000, 20200, 21800, 22000, 75000 },
{24, 16126, 16605, 15250, 15590, 77000 },
{25, 18500, 19150, 19300, 19950, 80400 },
{26, 8140, 8490, 8590, 8940, 86900 },
{27, 8070, 8240, 8520, 8690, 90400 },
{28, 7030, 7580, 7580, 8130, 92100 },
{29, 0, 0, 7170, 7280, 96600 },
{30, 23050, 23250, 23500, 23600, 97700 },
{31, 45250, 34900, 46250, 35900, 98700 },
{32, 0, 0, 14520, 14960, 99200 },
{33, 19000, 19200, 19000, 19200, 360000},
{34, 20100, 20250, 20100, 20250, 362000},
{35, 18500, 19100, 18500, 19100, 363500},
{36, 19300, 19900, 19300, 19900, 369500},
{37, 19100, 19300, 19100, 19300, 375500},
{38, 25700, 26200, 25700, 26300, 377500},
{39, 18800, 19200, 18800, 19200, 382500},
{40, 23000, 24000, 23000, 24000, 386500},
{41, 24960, 26900, 24960, 26900, 396500},
{42, 34000, 36000, 34000, 36000, 415900},
{43, 36000, 38000, 36000, 38000, 435900},
{44, 7030, 8030, 7030, 8030, 455900},
{45, 14470, 14670, 14470, 14670, 465900},
{46, 51500, 59250, 51500, 59250, 467900},
{65, 19200, 20100, 21100, 22000, 655360},
{66, 17100, 18000, 21100, 22000, 664360},
{67, 0, 0, 7380, 7580, 67336 },
{68, 6980, 7280, 7530, 7830, 67536 }
};
+4 -4
View File
@@ -600,10 +600,10 @@ typedef struct {
uint32_t rbs_used_retx_rx;
/// total rb used for a new uplink transmission
uint32_t total_rbs_used_rx;
/// normalized rx power
int32_t normalized_rx_power;
/// target rx power
int32_t target_rx_power;
/// snr
int32_t snr;
/// target snr
int32_t target_snr;
/// num rx pdu
uint32_t num_pdu_rx[NB_RB_MAX];
+13 -3
View File
@@ -128,9 +128,11 @@ void schedule_SRS(module_id_t module_idP,
continue;
}
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
"physicalConfigDedicated is null for UE %d\n",
UE_id);
if(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated == NULL) {
LOG_E(MAC,"physicalConfigDedicated is null for UE %d\n",UE_id);
printf("physicalConfigDedicated is null for UE %d\n",UE_id);
return;
}
/* CDRX condition on Active Time and SRS type-0 report (36.321 5.7) */
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
@@ -464,6 +466,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
DL_req[CC_id].dl_config_request_body.number_dci++;
DL_req[CC_id].dl_config_request_body.number_pdu++;
DL_req[CC_id].dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
LOG_D(MAC,
"UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",
UE_id, rnti,
@@ -508,6 +511,13 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1;
}
} // ul_failure_timer>0
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
if((U_PLANE_INACTIVITY_VALUE != 0) && (UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE * 10))){
LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}// time > 60s
}
void
+8 -3
View File
@@ -868,8 +868,10 @@ generate_Msg4(module_id_t module_idP,
ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = ra->rnti;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[ra->rach_resource_type - 1];
@@ -957,9 +959,12 @@ generate_Msg4(module_id_t module_idP,
1, // tpc, none
getRIV(N_RB_DL, first_rb, 4), // resource_block_coding
ra->msg4_mcs, // mcs
1, // ndi
1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid],
0, // rv
0); // vrb_flag
UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid] = 1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid];
LOG_D(MAC,
"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
frameP, subframeP, dl_req_body->number_pdu,
@@ -1049,7 +1054,7 @@ generate_Msg4(module_id_t module_idP,
mac->TX_req[CC_idP].sfn_sf =
fill_nfapi_tx_req(&mac->TX_req[CC_idP].tx_request_body,
(frameP * 10) + subframeP,
rrc_sdu_length,
rrc_sdu_length+offset,
mac->pdu_index[CC_idP],
mac->UE_list.
DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]);
@@ -1194,7 +1199,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
1, // tpc, none
getRIV(N_RB_DL, first_rb, 4), // resource_block_coding
ra->msg4_mcs, // mcs
1, // ndi
UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid],
round & 3, // rv
0); // vrb_flag
+2
View File
@@ -1158,6 +1158,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
LOG_D(MAC, "Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP, subframeP);
dl_req->number_dci++;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0,
sizeof(nfapi_dl_config_request_pdu_t));
@@ -1188,6 +1189,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
// Rel10 fields
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+34 -31
View File
@@ -489,7 +489,7 @@ schedule_ue_spec(module_id_t module_idP,
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list = &eNB->UE_list;
int continue_flag = 0;
int32_t normalized_rx_power, target_rx_power;
int32_t snr, target_snr;
int tpc = 1;
UE_sched_ctrl_t *ue_sched_ctrl;
int mcs;
@@ -718,9 +718,12 @@ schedule_ue_spec(module_id_t module_idP,
eNB_UE_stats->harq_pid = harq_pid;
eNB_UE_stats->harq_round = round_DL;
if (eNB_UE_stats->rrc_status < RRC_RECONFIGURED) {
ue_sched_ctrl->uplane_inactivity_timer = 0;
}
if (eNB_UE_stats->rrc_status < RRC_CONNECTED) {
LOG_D(MAC, "UE %d is not in RRC_CONNECTED\n",
UE_id);
LOG_D(MAC, "UE %d is not in RRC_CONNECTED\n", UE_id);
continue;
}
@@ -734,7 +737,7 @@ schedule_ue_spec(module_id_t module_idP,
eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
*/
if (NFAPI_MODE != NFAPI_MONOLITHIC) {
eNB_UE_stats->dlsch_mcs1 = 10; // cqi_to_mcs[ue_sched_ctrl->dl_cqi[CC_id]];
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctrl->dl_cqi[CC_id]];
} else { // this operation is also done in the preprocessor
eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,
eNB->slice_info.dl[slice_idxP].maxmcs); // cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
@@ -1007,9 +1010,11 @@ schedule_ue_spec(module_id_t module_idP,
, 0
#endif
);
pthread_mutex_lock(&rrc_release_freelist);
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) {
while(pthread_mutex_trylock(&rrc_release_freelist)){
/* spin... */
}
uint16_t release_total = 0;
for (release_num = 0, release_ctrl = &rrc_release_info.RRC_release_ctrl[0];
@@ -1056,9 +1061,9 @@ schedule_ue_spec(module_id_t module_idP,
if(release_total >= rrc_release_info.num_UEs)
break;
}
pthread_mutex_unlock(&rrc_release_freelist);
}
pthread_mutex_unlock(&rrc_release_freelist);
for (ra_ii = 0, ra = &eNB->common_channels[CC_id].ra[0]; ra_ii < NB_RA_PROC_MAX; ra_ii++, ra++) {
if ((ra->rnti == rnti) && (ra->state == MSGCRNTI)) {
@@ -1478,11 +1483,11 @@ schedule_ue_spec(module_id_t module_idP,
}
// do PUCCH power control
// this is the normalized RX power
// this is the snr
// unit is not dBm, it's special from nfapi
// converting to dBm: ToDo: Noise power hard coded to 30
normalized_rx_power = (((5 * ue_sched_ctrl->pucch1_snr[CC_id]) - 640) / 10) + 30;
target_rx_power= (eNB->puCch10xSnr / 10) + 30;
// converting to dBm
snr = (5 * ue_sched_ctrl->pucch1_snr[CC_id] - 640) / 10;
target_snr = eNB->puCch10xSnr / 10;
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = ue_template->pucch_tpc_tx_frame * 10 + ue_template->pucch_tpc_tx_subframe;
@@ -1494,22 +1499,22 @@ schedule_ue_spec(module_id_t module_idP,
ue_template->pucch_tpc_tx_frame = frameP;
ue_template->pucch_tpc_tx_subframe = subframeP;
if (normalized_rx_power > (target_rx_power + 4)) {
if (snr > target_snr + 4) {
tpc = 0; //-1
} else if (normalized_rx_power < (target_rx_power - 4)) {
} else if (snr < target_snr - 4) {
tpc = 2; //+1
} else {
tpc = 1; //0
}
LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d\n",
module_idP,
frameP,
subframeP,
harq_pid,
tpc,
normalized_rx_power,
target_rx_power);
snr,
target_snr);
} // Po_PUCCH has been updated
else {
tpc = 1; //0
@@ -1890,8 +1895,8 @@ schedule_ue_spec_br(module_id_t module_idP,
int round_DL = 0;
int ta_update = 0;
int32_t tpc = 1;
int32_t normalized_rx_power = 0;
int32_t target_rx_power = 0;
int32_t snr = 0;
int32_t target_snr = 0;
uint16_t TBS = 0;
uint16_t j = 0;
uint16_t sdu_lengths[NB_RB_MAX];
@@ -2369,10 +2374,10 @@ schedule_ue_spec_br(module_id_t module_idP,
T_INT(harq_pid),
T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS));
/* Do PUCCH power control */
/* This is the normalized RX power */
/* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
normalized_rx_power = (5 * ue_sched_ctl->pucch1_snr[CC_id]-640) / 10 + 30;
target_rx_power = mac->puCch10xSnr / 10 + 30;
/* This is the snr */
/* unit is not dBm, it's special from nfapi, convert to dBm */
snr = (5 * ue_sched_ctl->pucch1_snr[CC_id] - 640) / 10;
target_snr = mac->puCch10xSnr / 10;
/* This assumes accumulated tpc */
/* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */
int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
@@ -2385,22 +2390,22 @@ schedule_ue_spec_br(module_id_t module_idP,
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP;
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP;
if (normalized_rx_power > (target_rx_power + 4)) {
if (snr > target_snr + 4) {
tpc = 0; //-1
} else if (normalized_rx_power<(target_rx_power - 4)) {
} else if (snr < target_snr - 4) {
tpc = 2; //+1
} else {
tpc = 1; //0
}
LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d\n",
module_idP,
frameP,
subframeP,
harq_pid,
tpc,
normalized_rx_power,
target_rx_power);
snr,
target_snr);
} else { // Po_PUCCH has been updated
tpc = 1; // 0
}
@@ -3085,11 +3090,9 @@ schedule_PCH(module_id_t module_idP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(n_rb_dl,
first_rb,
4);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(n_rb_dl, first_rb, 4);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
#endif
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
+72 -41
View File
@@ -585,6 +585,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
// uint16_t r1=0;
uint8_t CC_id;
UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
int N_RB_DL;
UE_sched_ctrl_t *ue_sched_ctl;
// int rrc_status = RRC_IDLE;
COMMON_channels_t *cc;
@@ -600,6 +601,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
#endif
memset(rballoc_sub[0],0,(MAX_NUM_CCs)*(N_RBG_MAX)*sizeof(unsigned char));
memset(min_rb_unit,0,sizeof(min_rb_unit));
memset(MIMO_mode_indicator[0], 0, MAX_NUM_CCs*N_RBG_MAX*sizeof(unsigned char));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (mbsfn_flag[CC_id] > 0) // If this CC is allocated for MBSFN skip it here
@@ -640,7 +642,18 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
average_rbs_per_user[CC_id] = 0;
cc = &RC.mac[Mod_id]->common_channels[CC_id];
// Get total available RBS count and total UE count
temp_total_rbs_count = RC.mac[Mod_id]->eNB_stats[CC_id].available_prbs;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
temp_total_rbs_count = 0;
for(uint8_t rbg_i = 0;rbg_i < N_RBG[CC_id];rbg_i++ ){
if(rballoc_sub[CC_id][rbg_i] == 0){
if((rbg_i == N_RBG[CC_id] -1) &&
((N_RB_DL == 25) || (N_RB_DL == 50))){
temp_total_rbs_count += (min_rb_unit[CC_id] -1);
}else{
temp_total_rbs_count += min_rb_unit[CC_id];
}
}
}
temp_total_ue_count = dlsch_ue_select[CC_id].ue_num;
for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) {
@@ -825,7 +838,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list = &eNB->UE_list;
// int continue_flag = 0;
int32_t normalized_rx_power, target_rx_power;
int32_t snr, target_snr;
int32_t tpc = 1;
static int32_t tpc_accumulated = 0;
UE_sched_ctrl_t *ue_sched_ctl;
@@ -1001,6 +1014,10 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
if (UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status < RRC_RECONFIGURED) {
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}
if (UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status <
RRC_CONNECTED)
continue;
@@ -1013,7 +1030,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
*/
if (NFAPI_MODE != NFAPI_MONOLITHIC) {
eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
} else {
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
}
@@ -1287,9 +1304,11 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
,0, 0
#endif
);
pthread_mutex_lock(&rrc_release_freelist);
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) {
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){
while(pthread_mutex_trylock(&rrc_release_freelist)) {
/* spin... */
}
uint16_t release_total = 0;
for(uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) {
@@ -1326,9 +1345,9 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
if(release_total >= rrc_release_info.num_UEs)
break;
}
pthread_mutex_unlock(&rrc_release_freelist);
}
pthread_mutex_unlock(&rrc_release_freelist);
RA_t *ra = &eNB->common_channels[CC_id].ra[0];
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) {
@@ -1720,11 +1739,11 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
}
// do PUCCH power control
// this is the normalized RX power
// this is the snr
eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
/* Unit is not dBm, it's special from nfapi */
normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30;//(+eNB->measurements.n0_power_dB[0])
target_rx_power= eNB->puCch10xSnr/10 + 30;//(+eNB->measurements.n0_power_dB[0])
snr = (5 * ue_sched_ctl->pucch1_snr[CC_id] - 640) / 10;
target_snr = eNB->puCch10xSnr / 10;
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
@@ -1736,19 +1755,19 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP;
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP;
if (normalized_rx_power>(target_rx_power+4)) {
if (snr > target_snr + 4) {
tpc = 0; //-1
tpc_accumulated--;
} else if (normalized_rx_power<(target_rx_power-4)) {
} else if (snr < target_snr - 4) {
tpc = 2; //+1
tpc_accumulated++;
} else {
tpc = 1; //0
}
LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,frameP, subframeP,harq_pid,tpc,
tpc_accumulated,normalized_rx_power,target_rx_power);
tpc_accumulated,snr,target_snr);
} // Po_PUCCH has been updated
else {
tpc = 1; //0
@@ -1763,6 +1782,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP,CC_id),ue_sched_ctl->dl_cqi[CC_id],format1);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
@@ -1972,7 +1992,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
uint8_t cc_id_flag[MAX_NUM_CCs];
uint8_t harq_pid = 0,round = 0;
UE_list_t *UE_list= &eNB->UE_list;
uint8_t aggregation = 2;
uint8_t aggregation;
int format_flag;
nfapi_hi_dci0_request_body_t *HI_DCI0_req;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
@@ -2031,7 +2051,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
if ( round > 0 ) {
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
format_flag = 2;
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0);
if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
cc_id_flag[CC_id] = 1;
continue;
@@ -2110,7 +2130,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
format_flag = 2;
rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]);
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[first_ue_id[CC_id][temp]].dl_cqi[CC_id],format0);
if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
cc_id_flag[CC_id] = 1;
break;
@@ -2182,7 +2202,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED)) ) {
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
format_flag = 2;
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0);
if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
cc_id_flag[CC_id] = 1;
continue;
@@ -2235,7 +2255,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
format_flag = 2;
rnti = UE_RNTI(module_idP,ul_inactivity_id[CC_id][temp]);
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[ul_inactivity_id[CC_id][temp]].dl_cqi[CC_id],format0);
if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) {
cc_id_flag[CC_id] = 1;
continue;
@@ -2402,8 +2422,8 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id])) &&
((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) {
rb_table_index++;
tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3;
tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0);
tbs = get_TBS_UL(mcs,rb_table[rb_table_index]);
tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0);
}
if ( rb_table[rb_table_index]<3 ) {
@@ -2434,12 +2454,20 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs;
}
} else {
// assigne RBS( 3 RBs)
first_rb[CC_id] = first_rb[CC_id] + 3;
UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = 3;
UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 2;
UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
}
if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED){
// assigne RBS( 6 RBs)
first_rb[CC_id] = first_rb[CC_id] + 6;
UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = 6;
UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 5;
UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
}else{
// assigne RBS( 3 RBs)
first_rb[CC_id] = first_rb[CC_id] + 3;
UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = 3;
UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 2;
UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
}
}
} else if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE ) {
// assigne RBS( 3 RBs)
first_rb[CC_id] = first_rb[CC_id] + 3;
@@ -2609,7 +2637,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
unsigned char sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) {
int16_t UE_id;
uint8_t aggregation = 2;
uint8_t aggregation;
uint16_t first_rb[MAX_NUM_CCs];
uint8_t ULSCH_first_end;
rnti_t rnti = -1;
@@ -2618,8 +2646,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
uint8_t status = 0;
uint8_t rb_table_index = -1;
uint32_t cqi_req,cshift,ndi,tpc;
int32_t normalized_rx_power;
int32_t target_rx_power=-90;
int32_t snr;
int32_t target_snr=0;
static int32_t tpc_accumulated=0;
int CC_id,ulsch_ue_num;
int N_RB_UL;
@@ -2738,6 +2766,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
harq_pid = subframe2harqpid(cc,sched_frame,sched_subframeP);
rnti = UE_RNTI(CC_id,UE_id);
aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0);
LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n",
module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL);
int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes;
@@ -2757,12 +2786,12 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
if (cc->tdd_Config) {
switch (cc->tdd_Config->subframeAssignment) {
case 1:
if( subframeP == 1 || subframeP == 6 ) cqi_req=0;
if( sched_subframeP == 1 || sched_subframeP == 6 ) cqi_req=0;
break;
case 3:
if( subframeP == 1 ) cqi_req=0;
if( sched_subframeP == 1 ) cqi_req=0;
break;
@@ -2782,8 +2811,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
//power control
//compute the expected ULSCH RX power (for the stats)
// this is the normalized RX power and this should be constant (regardless of mcs
normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30; //(+eNB->measurements.n0_power_dB[0])
target_rx_power= eNB->puSch10xSnr/10 + 30; //(+eNB->measurements.n0_power_dB[0])
snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10;
target_snr = eNB->puSch10xSnr / 10;
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe;
@@ -2793,10 +2822,10 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_template->pusch_tpc_tx_frame=frameP;
UE_template->pusch_tpc_tx_subframe=subframeP;
if (normalized_rx_power>(target_rx_power+4)) {
if (snr > target_snr + 4) {
tpc = 0; //-1
tpc_accumulated--;
} else if (normalized_rx_power<(target_rx_power-4)) {
} else if (snr < target_snr - 4) {
tpc = 2; //+1
tpc_accumulated++;
} else {
@@ -2807,9 +2836,9 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
}
if (tpc!=1) {
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,frameP,subframeP,harq_pid,tpc,
tpc_accumulated,normalized_rx_power,target_rx_power);
tpc_accumulated,snr,target_snr);
}
// new transmission
@@ -2822,8 +2851,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_sched_ctrl->cqi_req_timer);
ndi = 1-UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid]=ndi;
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul;
UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
@@ -2872,6 +2901,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
memset((void *)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu);
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
@@ -2998,8 +3028,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb), T_INT(ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb),
T_INT(round));
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
uint8_t mcs_rv = 0;
if(rvidx_tab[round&3]==1) {
@@ -3029,6 +3059,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
memset((void *)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu);
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
+6 -6
View File
@@ -199,8 +199,8 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
uint8_t mcs = 20;
uint8_t harq_pid = 0;
uint32_t cqi_req = 0,cshift,ndi,tpc = 1;
int32_t normalized_rx_power;
int32_t target_rx_power= 178;
int32_t snr;
int32_t target_snr = 10; /* TODO: target_rx_power was 178, what to put? is it meaningful? */
int CC_id = 0;
int nb_rb = 24;
int N_RB_UL;
@@ -258,15 +258,15 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
//power control
//compute the expected ULSCH RX power (for the stats)
// this is the normalized RX power and this should be constant (regardless of mcs
normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30;
// this is the snr and this should be constant (regardless of mcs)
snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10;
// new transmission
ndi = 1-UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid]=ndi;
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = mcs;
UE_template->mcs_UL[harq_pid] = mcs;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = mcs;
@@ -2193,8 +2193,8 @@ add_new_ue(module_id_t mod_idP,
UE_list->UE_sched_ctrl[UE_id].ta_update = 31;
for (j = 0; j < 8; j++) {
UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = (j == 0) ? 1 : 0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0
UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j == harq_pidP) ? 0 : 1; // 1st transmission is with Msg3;
UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = 0;
UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = 0;
UE_list->UE_sched_ctrl[UE_id].round[cc_idP][j] = 8;
UE_list->UE_sched_ctrl[UE_id].round_UL[cc_idP][j] = 0;
}
@@ -2319,9 +2319,10 @@ rrc_mac_remove_ue(module_id_t mod_idP,
rntiP);
}
pthread_mutex_lock(&rrc_release_freelist);
if (rrc_release_info.num_UEs > 0) {
if(rrc_release_info.num_UEs > 0){
while(pthread_mutex_trylock(&rrc_release_freelist)) {
/* spin... */
}
uint16_t release_total = 0;
for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) {
@@ -2341,6 +2342,7 @@ rrc_mac_remove_ue(module_id_t mod_idP,
break;
}
}
pthread_mutex_unlock(&rrc_release_freelist);
}
pthread_mutex_unlock(&rrc_release_freelist);
+35 -28
View File
@@ -460,7 +460,7 @@ rx_sdu(const module_id_t enb_mod_idP,
if (RA_id != -1) {
RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]);
mac_rrc_data_ind(enb_mod_idP,
int8_t ret = mac_rrc_data_ind(enb_mod_idP,
CC_idP,
frameP, subframeP,
UE_id,
@@ -474,6 +474,7 @@ rx_sdu(const module_id_t enb_mod_idP,
#endif
);
/* Received a new rnti */
if (ret == 0) {
ra->state = MSGCRNTI;
LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Received rnti(Msg4)\n",
enb_mod_idP,
@@ -502,6 +503,9 @@ rx_sdu(const module_id_t enb_mod_idP,
}
UE_template_ptr->ul_SR = 1;
UE_scheduling_control->crnti_reconfigurationcomplete_flag = 1;
} else {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
}
// break;
}
}
@@ -797,6 +801,10 @@ rx_sdu(const module_id_t enb_mod_idP,
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status);
UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1;
UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i];
if (mac_eNB_get_rrc_status(enb_mod_idP, current_rnti) < RRC_RECONFIGURED) {
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}
}
break;
@@ -1329,8 +1337,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
uint32_t cshift = 0;
uint32_t ndi = 0;
uint32_t tpc = 0;
int32_t normalized_rx_power = 0;
int32_t target_rx_power = 0;
int32_t snr = 0;
int32_t target_snr = 0;
int32_t framex10psubframe = 0;
static int32_t tpc_accumulated = 0;
int sched_frame = 0;
@@ -1555,13 +1563,12 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* Power control */
/*
* Compute the expected ULSCH RX power (for the stats)
* This is the normalized RX power and this should be constant (regardless of mcs)
* Compute the expected ULSCH RX snr (for the stats)
* This is the normalized RX snr and this should be constant (regardless of mcs)
* Is not in dBm, unit from nfapi, converting to dBm
* ToDo: Noise power hard coded to 30
*/
normalized_rx_power = ((5 * UE_sched_ctrl_ptr->pusch_snr[CC_id] - 640) / 10) + 30;
target_rx_power = (mac->puSch10xSnr / 10) + 30;
snr = (5 * UE_sched_ctrl_ptr->pusch_snr[CC_id] - 640) / 10;
target_snr = mac->puSch10xSnr / 10;
/*
* This assumes accumulated tpc
@@ -1575,10 +1582,10 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_template_ptr->pusch_tpc_tx_frame = frameP;
UE_template_ptr->pusch_tpc_tx_subframe = subframeP;
if (normalized_rx_power > (target_rx_power + 4)) {
if (snr > target_snr + 4) {
tpc = 0; // -1
tpc_accumulated--;
} else if (normalized_rx_power < (target_rx_power - 4)) {
} else if (snr < target_snr - 4) {
tpc = 2; // +1
tpc_accumulated++;
} else {
@@ -1589,21 +1596,21 @@ schedule_ulsch_rnti(module_id_t module_idP,
}
if (tpc != 1) {
LOG_D(MAC, "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
LOG_D(MAC, "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,
frameP,
subframeP,
harq_pid,
tpc,
tpc_accumulated,
normalized_rx_power,
target_rx_power);
snr,
target_snr);
}
ndi = 1 - UE_template_ptr->oldNDI_UL[harq_pid]; // NDI: new data indicator
UE_template_ptr->oldNDI_UL[harq_pid] = ndi;
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_template_ptr->mcs_UL[harq_pid] = cmin(UE_template_ptr->pre_assigned_mcs_ul, sli->ul[slice_idx].maxmcs);
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1= UE_template_ptr->mcs_UL[harq_pid];
@@ -1941,8 +1948,8 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
uint8_t status = 0;
uint32_t cshift = 0;
uint32_t ndi = 0;
int32_t normalized_rx_power = 0;
int32_t target_rx_power = -90;
int32_t snr = 0;
int32_t target_snr = 0;
int n = 0;
int CC_id = 0;
int N_RB_UL = 0;
@@ -2050,10 +2057,10 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_template->ul_SR = 0;
status = mac_eNB_get_rrc_status(module_idP,rnti);
cqi_req = 0;
/* Power control: compute the expected ULSCH RX power (for the stats) */
/* This is the normalized RX power and this should be constant (regardless of mcs) */
normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
target_rx_power = 178;
/* Power control: compute the expected ULSCH RX snr (for the stats) */
/* This is the normalized snr and this should be constant (regardless of mcs) */
snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10;
target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */
/* This assumes accumulated tpc */
/* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */
int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe;
@@ -2063,10 +2070,10 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_template->pusch_tpc_tx_frame = frameP;
UE_template->pusch_tpc_tx_subframe = subframeP;
if (normalized_rx_power > (target_rx_power + 4)) {
if (snr > target_snr + 4) {
tpc = 0; //-1
UE_sched_ctrl->tpc_accumulated[CC_id]--;
} else if (normalized_rx_power < (target_rx_power - 4)) {
} else if (snr < target_snr - 4) {
tpc = 2; //+1
UE_sched_ctrl->tpc_accumulated[CC_id]++;
} else {
@@ -2077,15 +2084,15 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
}
if (tpc != 1) {
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,
frameP,
subframeP,
harq_pid,
tpc,
UE_sched_ctrl->tpc_accumulated[CC_id],
normalized_rx_power,
target_rx_power);
snr,
target_snr);
}
/* New transmission */
@@ -2094,8 +2101,8 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
UE_template->oldNDI_UL[harq_pid] = ndi;
UE_template->mcs_UL[harq_pid] = 4;
UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], 6);
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = 4;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid];
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += 6;
+7 -5
View File
@@ -169,7 +169,7 @@
#define MAX_NUM_SLICES 10
#define U_PLANE_INACTIVITY_VALUE 6000
#define U_PLANE_INACTIVITY_VALUE 0 /* defined 10ms order (zero means infinity) */
/*
* eNB part
@@ -754,10 +754,10 @@ typedef struct {
uint32_t rbs_used_retx_rx;
/// total rb used for a new uplink transmission
uint32_t total_rbs_used_rx;
/// normalized rx power
int32_t normalized_rx_power;
/// target rx power
int32_t target_rx_power;
/// snr
int32_t snr;
/// target snr
int32_t target_snr;
/// num rx pdu
uint32_t num_pdu_rx[NB_RB_MAX];
@@ -1438,6 +1438,8 @@ typedef struct eNB_MAC_INST_s {
tx_request_pdu[NFAPI_CC_MAX][MAX_NUM_TX_REQUEST_PDU];
/// NFAPI DL PDU structure
nfapi_tx_request_t TX_req[NFAPI_CC_MAX];
/// NFAPI UE_release_req structure
nfapi_ue_release_request_t UE_release_req;
/// UL handle
uint32_t ul_handle;
UE_list_t UE_list;
@@ -806,6 +806,7 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
rlc_sn_t sn = rlc_pP->vt_a;
rlc_sn_t sn_end = rlc_pP->vt_s;
mem_block_t* pdu_p = NULL;
mem_block_t* mb_p = NULL;
rlc_am_tx_data_pdu_management_t* tx_data_pdu_management;
//Assertion(eNB)_PRAN_DesignDocument_annex No.769
if((rlc_pP->retrans_num_pdus <= 0) || (rlc_pP->vt_a == rlc_pP->vt_s))
@@ -884,6 +885,18 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
tx_data_pdu_management->retx_count_next,
sn);
mb_p = rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE].mem_block;
if(mb_p != NULL){
free_mem_block(mb_p, __func__);
tx_data_pdu_management->mem_block = NULL;
tx_data_pdu_management->flags.retransmit = 0;
tx_data_pdu_management->flags.ack = 1;
tx_data_pdu_management->flags.transmitted = 0;
rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_management->retx_payload_size;
tx_data_pdu_management->retx_payload_size = 0;
tx_data_pdu_management->num_holes = 0;
rlc_pP->retrans_num_pdus --;
}
}
}
else if (rlc_pP->nb_bytes_requested_by_mac >= 5)
@@ -938,6 +951,18 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
tx_data_pdu_management->retx_count_next,
sn);
mb_p = rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE].mem_block;
if(mb_p != NULL){
free_mem_block(mb_p, __func__);
tx_data_pdu_management->mem_block = NULL;
tx_data_pdu_management->flags.retransmit = 0;
tx_data_pdu_management->flags.ack = 1;
tx_data_pdu_management->flags.transmitted = 0;
rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_management->retx_payload_size;
tx_data_pdu_management->retx_payload_size = 0;
tx_data_pdu_management->num_holes = 0;
rlc_pP->retrans_num_pdus --;
}
}
}
@@ -938,7 +938,7 @@ rlc_am_rx_check_all_byte_segments(
rlc_am_pdu_info_t *pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
mem_block_t *cursor_p = NULL;
mem_block_t *first_cursor_p = NULL;
rlc_sn_t sn = pdu_info_p->sn;
rlc_usn_t sn = pdu_info_p->sn;
sdu_size_t next_waited_so;
sdu_size_t last_end_so;
@@ -969,6 +969,9 @@ rlc_am_rx_check_all_byte_segments(
// the so field of the first PDU should be 0
//cursor_p = list.head;
//we start from the first stored PDU segment of this SN
if(cursor_p->data == NULL){
return;
}
pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
// if the first segment does not have SO = 0 then no need to continue
@@ -985,6 +988,9 @@ rlc_am_rx_check_all_byte_segments(
while (cursor_p->next != NULL) {
//msg("rlc_am_rx_check_all_byte_segments(%d) @4\n",sn);
cursor_p = cursor_p->next;
if(cursor_p->data == NULL){
return;
}
pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
if (pdu_info_p->sn == sn) {
@@ -358,8 +358,6 @@ void rlc_am_segment_10 (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size);
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size;
@@ -397,8 +395,6 @@ void rlc_am_segment_10 (
continue_fill_pdu_with_sdu = 0;
pdu_remaining_size = 0;
} else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -416,6 +412,8 @@ void rlc_am_segment_10 (
// reduce the size of the PDU
continue_fill_pdu_with_sdu = 0;
fi_last_byte_pdu_is_last_byte_sdu = 1;
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
} else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+3 -3
View File
@@ -176,13 +176,13 @@ int dump_eNB_l2_stats(char *buffer, int length) {
UE_list->eNB_UE_stats[CC_id][UE_id].total_overhead_bytes,
UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes
);
len += sprintf(&buffer[len],"[MAC] UE %d (ULSCH), Status %s, Failute timer %d, RNTI %x : rx power (normalized %d, target %d), MCS (pre %d, post %d), RB (rx %d, retx %d, total %d), Current TBS %d \n",
len += sprintf(&buffer[len],"[MAC] UE %d (ULSCH), Status %s, Failute timer %d, RNTI %x : snr (%d, target %d), MCS (pre %d, post %d), RB (rx %d, retx %d, total %d), Current TBS %d \n",
UE_id,
map_int_to_str(rrc_status_names, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status),
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer,
UE_list->eNB_UE_stats[CC_id][UE_id].crnti,
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power,
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power,
UE_list->eNB_UE_stats[CC_id][UE_id].snr,
UE_list->eNB_UE_stats[CC_id][UE_id].target_snr,
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1,
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2,
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_rx,
+147 -18
View File
@@ -17,10 +17,34 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint16_t sf_ahead;
extern UL_RCC_IND_t UL_RCC_INFO;
uint16_t frame_cnt=0;
void handle_rach(UL_IND_t *UL_info) {
int i;
if(NFAPI_MODE == NFAPI_MODE_VNF){
for(uint8_t j = 0;j < NUM_NFPAI_SUBFRAME;j++){
if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_RCC_INFO.rach_ind[j].sfn_sf));
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf),
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0
#endif
);
free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list);
UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0;
UL_RCC_INFO.rach_ind[j].header.message_id = 0;
}
}
}else{
if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
@@ -37,6 +61,7 @@ void handle_rach(UL_IND_t *UL_info) {
#endif
);
}
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
@@ -72,6 +97,22 @@ void handle_sr(UL_IND_t *UL_info) {
if (UL_info->sr_ind.sr_indication_body.number_of_srs>0) {
oai_nfapi_sr_indication(&UL_info->sr_ind);
}
} else if(NFAPI_MODE == NFAPI_MODE_VNF){
for(uint8_t j = 0;j < NUM_NFPAI_SUBFRAME;j++){
if(UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs > 0){
for (i=0;i<UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs;i++){
SR_indication(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.sr_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.sr_ind[j].sfn_sf),
UL_RCC_INFO.sr_ind[j].sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti,
UL_RCC_INFO.sr_ind[j].sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);
}
free(UL_RCC_INFO.sr_ind[j].sr_indication_body.sr_pdu_list);
UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs=0;
UL_RCC_INFO.sr_ind[j].header.message_id = 0;
}
}
} else {
for (i=0; i<UL_info->sr_ind.sr_indication_body.number_of_srs; i++)
SR_indication(UL_info->module_id,
@@ -89,27 +130,46 @@ void handle_cqi(UL_IND_t *UL_info) {
int i;
if (NFAPI_MODE==NFAPI_MODE_PNF) {
if (UL_info->cqi_ind.number_of_cqis>0) {
LOG_D(PHY,"UL_info->cqi_ind.number_of_cqis:%d\n", UL_info->cqi_ind.number_of_cqis);
nfapi_cqi_indication_t ind;
ind.header.message_id = NFAPI_RX_CQI_INDICATION;
ind.sfn_sf = UL_info->frame<<4 | UL_info->subframe;
ind.cqi_indication_body = UL_info->cqi_ind;
oai_nfapi_cqi_indication(&ind);
UL_info->cqi_ind.number_of_cqis=0;
if (UL_info->cqi_ind.cqi_indication_body.number_of_cqis>0) {
LOG_D(PHY,"UL_info->cqi_ind.number_of_cqis:%d\n", UL_info->cqi_ind.cqi_indication_body.number_of_cqis);
UL_info->cqi_ind.header.message_id = NFAPI_RX_CQI_INDICATION;
UL_info->cqi_ind.sfn_sf = UL_info->frame<<4 | UL_info->subframe;
oai_nfapi_cqi_indication(&UL_info->cqi_ind);
UL_info->cqi_ind.cqi_indication_body.number_of_cqis=0;
}
} else if (NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t j = 0;j < NUM_NFPAI_SUBFRAME;j++){
if(UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis > 0){
for (i=0;i<UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis;i++){
cqi_indication(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.cqi_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.cqi_ind[j].sfn_sf),
UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti,
&UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_pdu_list[i].cqi_indication_rel9,
UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_raw_pdu_list[i].pdu,
&UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_pdu_list[i].ul_cqi_information);
}
free(UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_pdu_list);
free(UL_RCC_INFO.cqi_ind[j].cqi_indication_body.cqi_raw_pdu_list);
UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis=0;
UL_RCC_INFO.cqi_ind[j].header.message_id = 0;
}
}
} else {
for (i=0; i<UL_info->cqi_ind.number_of_cqis; i++)
for (i=0;i<UL_info->cqi_ind.cqi_indication_body.number_of_cqis;i++)
cqi_indication(UL_info->module_id,
UL_info->CC_id,
UL_info->frame,
UL_info->subframe,
UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti,
&UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
&UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
NFAPI_SFNSF2SFN(UL_info->cqi_ind.sfn_sf),
NFAPI_SFNSF2SF(UL_info->cqi_ind.sfn_sf),
UL_info->cqi_ind.cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti,
&UL_info->cqi_ind.cqi_indication_body.cqi_pdu_list[i].cqi_indication_rel9,
UL_info->cqi_ind.cqi_indication_body.cqi_raw_pdu_list[i].pdu,
&UL_info->cqi_ind.cqi_indication_body.cqi_pdu_list[i].ul_cqi_information);
UL_info->cqi_ind.number_of_cqis=0;
UL_info->cqi_ind.cqi_indication_body.number_of_cqis=0;
}
}
@@ -123,7 +183,22 @@ void handle_harq(UL_IND_t *UL_info) {
}
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
}else if(NFAPI_MODE == NFAPI_MODE_VNF){
for(uint8_t j = 0;j < NUM_NFPAI_SUBFRAME;j++){
if(UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs > 0){
for (int i=0;i<UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs;i++){
harq_indication(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.harq_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.harq_ind[j].sfn_sf),
&UL_RCC_INFO.harq_ind[j].harq_indication_body.harq_pdu_list[i]);
}
free(UL_RCC_INFO.harq_ind[j].harq_indication_body.harq_pdu_list);
UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs=0;
UL_RCC_INFO.harq_ind[j].header.message_id = 0;
}
}
} else {
for (int i=0; i < UL_info->harq_ind.harq_indication_body.number_of_harqs; i++)
harq_indication(UL_info->module_id,
@@ -151,6 +226,56 @@ void handle_ulsch(UL_IND_t *UL_info) {
oai_nfapi_rx_ind(&UL_info->rx_ind);
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
}
} else if(NFAPI_MODE == NFAPI_MODE_VNF){
for(uint8_t k = 0;k < NUM_NFPAI_SUBFRAME;k++){
if((UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus>0) && (UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs>0)){
for (i=0;i<UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus;i++) {
for (j=0;j<UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs;j++) {
// find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n",
j,UL_RCC_INFO.crc_ind[k].crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i,UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti);
if (UL_RCC_INFO.crc_ind[k].crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti == UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) {
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n",
j, UL_RCC_INFO.crc_ind[k].crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
if (UL_RCC_INFO.crc_ind[k].crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.rx_ind[k].sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_RCC_INFO.rx_ind[k].sfn_sf), //UL_info->subframe,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
(uint8_t *)NULL,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
else {
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.rx_ind[k].sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_RCC_INFO.rx_ind[k].sfn_sf), //UL_info->subframe,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].data,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
if(UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].data != NULL){
free(UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list[i].data);
}
break;
} //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti == UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti)
} // for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++)
} // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
free(UL_RCC_INFO.crc_ind[k].crc_indication_body.crc_pdu_list);
free(UL_RCC_INFO.rx_ind[k].rx_indication_body.rx_pdu_list);
UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs = 0;
UL_RCC_INFO.crc_ind[k].header.message_id =0;
UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus = 0;
UL_RCC_INFO.rx_ind[k].header.message_id = 0;
}
}
} else {
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) {
for (i=0; i<UL_info->rx_ind.rx_indication_body.number_of_pdus; i++) {
@@ -574,11 +699,11 @@ void UL_indication(UL_IND_t *UL_info) {
Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
IF_Module_t *ifi = if_inst[module_id];
eNB_MAC_INST *mac = RC.mac[module_id];
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n",
UL_info->frame,UL_info->subframe,
module_id,CC_id,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis,
UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.cqi_indication_body.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
if(UL_info->frame==1023&&UL_info->subframe==6) { // dl scheduling (0,0)
frame_cnt= (frame_cnt + 1)%7; // to prevent frame_cnt get too big
@@ -604,6 +729,7 @@ void UL_indication(UL_IND_t *UL_info) {
handle_sr(UL_info);
handle_cqi(UL_info);
handle_harq(UL_info);
// clear HI prior to handling ULSCH
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_id], UL_info->subframe);
@@ -634,6 +760,9 @@ void UL_indication(UL_IND_t *UL_info) {
sched_info->UL_req = NULL;
sched_info->TX_req = &mac->TX_req[CC_id];
pthread_mutex_lock(&lock_ue_freelist);
sched_info->UE_release_req = &mac->UE_release_req;
pthread_mutex_unlock(&lock_ue_freelist);
#ifdef DUMP_FAPI
dump_dl(sched_info);
#endif
+23 -1
View File
@@ -71,7 +71,7 @@ typedef struct{
nfapi_sr_indication_t sr_ind;
/// CQI indication list
nfapi_cqi_indication_body_t cqi_ind;
nfapi_cqi_indication_t cqi_ind;
/// RACH indication list
nfapi_rach_indication_t rach_ind;
@@ -90,7 +90,27 @@ typedef struct{
} UL_IND_t;
// Downlink subframe P7
#define NUM_NFPAI_SUBFRAME 5
typedef struct{
/// harq indication list
nfapi_harq_indication_t harq_ind[NUM_NFPAI_SUBFRAME];
/// crc indication list
nfapi_crc_indication_t crc_ind[NUM_NFPAI_SUBFRAME];
/// SR indication list
nfapi_sr_indication_t sr_ind[NUM_NFPAI_SUBFRAME];
/// CQI indication list
nfapi_cqi_indication_t cqi_ind[NUM_NFPAI_SUBFRAME];
/// RACH indication list
nfapi_rach_indication_t rach_ind[NUM_NFPAI_SUBFRAME];
/// RX indication
nfapi_rx_indication_t rx_ind[NUM_NFPAI_SUBFRAME];
} UL_RCC_IND_t;
typedef struct{
/// Module ID
@@ -109,6 +129,8 @@ typedef struct{
nfapi_hi_dci0_request_t *HI_DCI0_req;
/// Pointers to DL SDUs
nfapi_tx_request_t *TX_req;
/// Pointers to ue_release
nfapi_ue_release_request_t *UE_release_req;
}Sched_Rsp_t;
typedef struct {
+3 -3
View File
@@ -236,8 +236,8 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock(&fill_ul_mutex.cqi_mutex);
nfapi_cqi_indication_pdu_t *pdu = &UL_INFO->cqi_ind.cqi_pdu_list[UL_INFO->cqi_ind.number_of_cqis];
nfapi_cqi_indication_raw_pdu_t *raw_pdu = &UL_INFO->cqi_ind.cqi_raw_pdu_list[UL_INFO->cqi_ind.number_of_cqis];
nfapi_cqi_indication_pdu_t *pdu = &UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis];
nfapi_cqi_indication_raw_pdu_t *raw_pdu = &UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis];
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti;
@@ -263,7 +263,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
UL_INFO->cqi_ind.number_of_cqis++;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++;
// change for mutiple UE's simulation.
//pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex);
+8 -6
View File
@@ -310,10 +310,13 @@ mac_rrc_data_ind(
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP);
if(ue_context_p) {
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,
ue_context_p,
0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
if (ue_context_p->ue_context.Status != RRC_RECONFIGURED) {
LOG_E(RRC,"[eNB %d] Received C-RNTI ,but UE %x status(%d) not RRC_RECONFIGURED\n",module_idP,rntiP,ue_context_p->ue_context.Status);
return (-1);
} else {
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,ue_context_p,0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
}
}
}
@@ -363,8 +366,7 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
flexran_agent_get_rrc_xface(Mod_instP)->flexran_agent_notify_ue_state_change(Mod_instP,
rntiP, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
rrc_mac_remove_ue(Mod_instP,rntiP);
//rrc_mac_remove_ue(Mod_instP,rntiP);
}
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
+1
View File
@@ -4071,6 +4071,7 @@ do_RRCConnectionReestablishment(
LTE_DL_CCCH_Message_t dl_ccch_msg;
LTE_RRCConnectionReestablishment_t *rrcConnectionReestablishment = NULL;
int i = 0;
ue_context_pP->ue_context.reestablishment_xid = Transaction_id;
LTE_SRB_ToAddModList_t **SRB_configList2 = NULL;
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[Transaction_id];
+22
View File
@@ -348,11 +348,24 @@ typedef enum HO_STATE_e {
HO_COMPLETE, // initiated by the target eNB
HO_REQUEST,
HO_ACK,
HO_FORWARDING,
HO_CONFIGURED,
HO_END_MARKER,
HO_FORWARDING_COMPLETE,
HO_RELEASE,
HO_CANCEL
} HO_STATE_t;
typedef enum DATA_FORWARDING_STATE_e {
FORWARDING_EMPTY=0,
FORWARDING_NO_EMPTY
} DATA_FORWARDING_STATE_t;
typedef enum DATA_ENDMARK_STATE_e {
ENDMARK_EMPTY=0,
ENDMARK_NO_EMPTY
} DATA_ENDMARK_STATE_t;
typedef enum SL_TRIGGER_e {
SL_RECEIVE_COMMUNICATION=0,
SL_TRANSMIT_RELAY_ONE_TO_ONE,
@@ -477,6 +490,9 @@ typedef struct HANDOVER_INFO_s {
uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */
int size; /* size of above message in bytes */
int x2_id; /* X2AP UE ID in the target eNB */
uint32_t x2u_teid;
DATA_FORWARDING_STATE_t forwarding_state;
DATA_ENDMARK_STATE_t endmark_state;
} HANDOVER_INFO;
typedef struct PER_EVENT_s {
@@ -693,6 +709,12 @@ typedef struct eNB_RRC_UE_s {
uint32_t enb_gtp_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
/* Total number of e_rab already setup in the list */
uint8_t nb_x2u_e_rabs;
// LG: For GTPV1 TUNNELS(X2U)
uint32_t enb_gtp_x2u_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t enb_gtp_x2u_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_x2u_ebi[S1AP_MAX_E_RAB];
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
uint32_t ue_release_timer_thres;
+353 -26
View File
@@ -1114,6 +1114,8 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) {
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag;
free_list->num_UEs++;
eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti;
eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++;
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
pthread_mutex_unlock(&lock_ue_freelist);
}
@@ -1158,28 +1160,32 @@ void release_UE_in_freeList(module_id_t mod_id) {
for (i=0; i<MAX_MOBILES_PER_ENB; i++) {
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti);
clean_eNb_ulsch(ulsch);
}
if(eNB_PHY->uci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
}
}
for (i=0; i<MAX_MOBILES_PER_ENB; i++) {
dlsch = eNB_PHY->dlsch[i][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)) {
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
LOG_I(RRC, "clean_eNb_dlsch dlsch[%d] UE %x \n", i, rnti);
clean_eNb_dlsch(dlsch);
}
}
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti);
clean_eNb_ulsch(ulsch);
}
for (i=0; i<NUMBER_OF_UCI_VARS_MAX; i++) {
if(eNB_PHY->uci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
}
}
if (flexran_agent_get_rrc_xface(mod_id)) {
flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change(
@@ -1241,6 +1247,34 @@ void release_UE_in_freeList(module_id_t mod_id) {
}
}
int rrc_eNB_previous_SRB2(rrc_eNB_ue_context_t* ue_context_pP)
{
struct LTE_SRB_ToAddMod *SRB2_config = NULL;
uint8_t i;
LTE_SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList;
LTE_SRB_ToAddModList_t** SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[ue_context_pP->ue_context.reestablishment_xid];
if (*SRB_configList2 != NULL) {
if((*SRB_configList2)->list.count!=0){
LOG_D(RRC, "rrc_eNB_previous_SRB2 SRB_configList2(%p) count is %d\n SRB_configList2->list.array[0] addr is %p",
SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]);
}
for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) {
if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){
SRB2_config = (*SRB_configList2)->list.array[i];
break;
}
}
}else{
LOG_E(RRC, "rrc_eNB_previous_SRB2 SRB_configList2 NULL\n");
}
if (SRB2_config != NULL) {
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
}else{
LOG_E(RRC, "rrc_eNB_previous_SRB2 SRB2_config NULL\n");
}
return 0;
}
//-----------------------------------------------------------------------------
/*
* Process the rrc connection setup complete message from UE (SRB1 Active)
@@ -1556,10 +1590,6 @@ rrc_eNB_generate_RRCConnectionReestablishment(
rnti);
}
/* Activate release timer, if RRCComplete not received after 100 frames, remove UE */
ue_context_pP->ue_context.ue_reestablishment_timer = 1;
/* Remove UE after 100 frames after LTE_RRCConnectionReestablishmentReject is triggered */
ue_context_pP->ue_context.ue_reestablishment_timer_thres = 1000;
}
//-----------------------------------------------------------------------------
@@ -1606,6 +1636,8 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
LTE_C_RNTI_t *cba_RNTI = NULL;
int measurements_enabled;
uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);
int ret = 0;
ue_context_pP->ue_context.Status = RRC_CONNECTED;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED
ue_context_pP->ue_context.reestablishment_xid = next_xid;
@@ -1711,10 +1743,36 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above
create_tunnel_req.num_tunnels = j;
gtpv1u_update_s1u_tunnel(
ret = gtpv1u_update_s1u_tunnel(
ctxt_pP->instance,
&create_tunnel_req,
reestablish_rnti);
if ( ret != 0 ) {
LOG_E(RRC,"gtpv1u_update_s1u_tunnel failed,start to release UE %x\n",reestablish_rnti);
// update s1u tunnel failed,reset rnti?
if (eNB_ue_s1ap_id > 0) {
h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p);
if (h_rc == HASH_TABLE_OK ) {
rrc_ue_s1ap_ids_p->ue_rnti = reestablish_rnti;
}
}
if (ue_initial_id != 0) {
h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p);
if (h_rc == HASH_TABLE_OK ) {
rrc_ue_s1ap_ids_p->ue_rnti = reestablish_rnti;
}
}
ue_context_pP->ue_context.ue_release_timer_s1 = 1;
ue_context_pP->ue_context.ue_release_timer_thres_s1 = 100;
ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ul_failure_timer = 20000; // set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ
rrc_eNB_free_UE(ctxt_pP->module_id,ue_context_pP);
ue_context_pP->ue_context.ul_failure_timer = 0;
put_UE_in_freelist(ctxt_pP->module_id, ctxt_pP->rnti, 0);
return;
}
} /* EPC_MODE_ENABLED */
/* Update RNTI in ue_context */
@@ -2236,8 +2294,9 @@ rrc_eNB_generate_RRCConnectionRelease(
ue_context_pP->ue_context.rnti,
rrc_eNB_mui,
size);
pthread_mutex_lock(&rrc_release_freelist);
while (pthread_mutex_trylock(&rrc_release_freelist)) {
/* spin... */
}
for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) {
if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) {
if (ue_context_pP->ue_context.ue_release_timer_s1 > 0) {
@@ -4060,8 +4119,40 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = (LTE_Q_OffsetRange_t *) CALLOC(1,sizeof(LTE_Q_OffsetRange_t));
*(MeasObj->measObject.choice.measObjectEUTRA.offsetFreq) = ue_context_pP->ue_context.measurement_info->offsetFreq; // Default is 15 or 0dB
//<<<<<<< HEAD
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
if (rrc_inst->carrier[0].sib1->tdd_Config!=NULL) {
MeasObj->measObject.choice.measObjectEUTRA.ext1 = CALLOC(1, sizeof(struct LTE_MeasObjectEUTRA__ext1));
MeasObj->measObject.choice.measObjectEUTRA.ext1->measCycleSCell_r10 = NULL;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10 = CALLOC(1, sizeof(struct LTE_MeasSubframePatternConfigNeigh_r10));
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->present=LTE_MeasSubframePatternConfigNeigh_r10_PR_setup;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.present=LTE_MeasSubframePattern_r10_PR_subframePatternTDD_r10;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.present=LTE_MeasSubframePattern_r10__subframePatternTDD_r10_PR_subframeConfig1_5_r10;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf=CALLOC(3, sizeof(uint8_t));
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.size=3;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.bits_unused=4;
switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) {
case 1: //subframe 0,4,5,9
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[0]=0x8C;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[1]=0x63;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[2]=0x10;
break;
default: //subframe 0 , 5
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[0]=0x84;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[1]=0x21;
MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[2]=0x00;
break;
}
}
MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
(LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
//=======
// MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = (LTE_Q_OffsetRange_t *) CALLOC(1,sizeof(LTE_Q_OffsetRange_t));
// *(MeasObj->measObject.choice.measObjectEUTRA.offsetFreq) = ue_context_pP->ue_context.measurement_info->offsetFreq; // Default is 15 or 0dB
//>>>>>>> origin/OAI_develop
if (RC.rrc[ctxt_pP->module_id]->num_neigh_cells > 0) {
MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
@@ -4557,7 +4648,9 @@ rrc_eNB_process_MeasurementReport(
/* HO info struct may not be needed anymore */
ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
ue_context_pP->ue_context.Status = RRC_HO_EXECUTION;
ue_context_pP->ue_context.handover_info->state = HO_REQUEST;
/* HO Preparation message */
msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ);
rrc_eNB_generate_HandoverPreparationInformation(
@@ -4685,8 +4778,8 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
RB_INSERT(rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head, ue_context_target_p);
LOG_D(RRC, "eNB %d: Created new UE context uid %u\n", mod_id, ue_context_target_p->local_uid);
ue_context_target_p->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info)));
ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION;
ue_context_target_p->ue_context.handover_info->state = HO_ACK;
//ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION;
//ue_context_target_p->ue_context.handover_info->state = HO_ACK;
ue_context_target_p->ue_context.handover_info->x2_id = m->x2_id;
ue_context_target_p->ue_context.handover_info->assoc_id = m->target_assoc_id;
memset (ue_context_target_p->ue_context.nh, 0, 32);
@@ -4760,6 +4853,10 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
ue_context_target_p->ue_context.e_rab[i].param.e_rab_id,
ue_context_target_p->ue_context.e_rab[i].param.gtp_teid);
}
rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ(mod_id, ue_context_target_p);
ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION;
ue_context_target_p->ue_context.handover_info->state = HO_ACK;
}
void rrc_eNB_process_handoverCommand(
@@ -4975,7 +5072,8 @@ check_handovers(
if (ue_context_p->ue_context.handover_info->state == HO_ACK) {
MessageDef *msg;
// Configure target
ue_context_p->ue_context.handover_info->state = HO_CONFIGURED;
ue_context_p->ue_context.handover_info->state = HO_FORWARDING;
msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ_ACK);
rrc_eNB_generate_HO_RRCConnectionReconfiguration(ctxt_pP, ue_context_p, X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer,
&X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer_size);
@@ -4988,13 +5086,162 @@ check_handovers(
X2AP_HANDOVER_REQ_ACK(msg).nb_e_rabs_tobesetup = ue_context_p->ue_context.setup_e_rabs;
for (int i=0; i<ue_context_p->ue_context.setup_e_rabs; i++) {
/* set gtpv teid info */
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].e_rab_id = ue_context_p->ue_context.e_rab[i].param.e_rab_id;
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].gtp_teid = ue_context_p->ue_context.enb_gtp_x2u_teid[i];
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr = ue_context_p->ue_context.enb_gtp_x2u_addrs[i];
}
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
LOG_I(RRC, "RRC Sends X2 HO ACK to the source eNB at frame %d and subframe %d \n", ctxt_pP->frame,ctxt_pP->subframe);
}
}
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED
&& ue_context_p->ue_context.handover_info != NULL &&
ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_NO_EMPTY ) {
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
int result;
protocol_ctxt_t ctxt;
do {
// Checks if a message has been sent to PDCP sub-task
itti_poll_msg (TASK_DATA_FORWARDING, &msg_p);
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case GTPV1U_ENB_DATA_FORWARDING_IND:
PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).module_id,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).enb_flag,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rnti,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).frame,
0,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).eNB_index);
LOG_D(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
PROTOCOL_CTXT_ARGS(&ctxt),
ITTI_MSG_NAME (msg_p),
ITTI_MSG_ORIGIN_NAME(msg_p),
ITTI_MSG_INSTANCE (msg_p),
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).mode);
LOG_I(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %d \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
result = pdcp_data_req (&ctxt,
SRB_FLAG_NO,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).sdu_size,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).sdu_p,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).mode
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, NULL, NULL
#endif
);
if (result != TRUE){
LOG_E(RRC, "target enb send data forwarding buffer to PDCP request failed!\n");
}else{
LOG_D(RRC, "target enb send data forwarding buffer to PDCP!\n");
}
// Message buffer has been processed, free it now.
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).sdu_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
break;
default:
LOG_E(RRC, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
} while(msg_p != NULL);
ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_EMPTY;
}
if( ue_context_p->ue_context.Status == RRC_RECONFIGURED &&
ue_context_p->ue_context.handover_info != NULL &&
ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_EMPTY &&
ue_context_p->ue_context.handover_info->endmark_state == ENDMARK_NO_EMPTY &&
ue_context_p->ue_context.handover_info->state == HO_END_MARKER ){
MessageDef *msg_p;
int result;
protocol_ctxt_t ctxt;
do {
// Checks if a message has been sent to PDCP sub-task
itti_poll_msg (TASK_END_MARKER, &msg_p);
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case GTPV1U_ENB_END_MARKER_IND:
PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt,
GTPV1U_ENB_END_MARKER_IND (msg_p).module_id,
GTPV1U_ENB_END_MARKER_IND (msg_p).enb_flag,
GTPV1U_ENB_END_MARKER_IND (msg_p).rnti,
GTPV1U_ENB_END_MARKER_IND (msg_p).frame,
0,
GTPV1U_ENB_END_MARKER_IND (msg_p).eNB_index);
LOG_I(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
PROTOCOL_CTXT_ARGS(&ctxt),
ITTI_MSG_NAME (msg_p),
ITTI_MSG_ORIGIN_NAME(msg_p),
ITTI_MSG_INSTANCE (msg_p),
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp,
GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).mode);
LOG_D(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %d \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
result = pdcp_data_req (&ctxt,
SRB_FLAG_NO,
GTPV1U_ENB_END_MARKER_IND (msg_p).rb_id,
GTPV1U_ENB_END_MARKER_IND (msg_p).muip,
GTPV1U_ENB_END_MARKER_IND (msg_p).confirmp,
GTPV1U_ENB_END_MARKER_IND (msg_p).sdu_size,
GTPV1U_ENB_END_MARKER_IND (msg_p).sdu_p,
GTPV1U_ENB_END_MARKER_IND (msg_p).mode
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, NULL, NULL
#endif
);
if (result != TRUE){
LOG_E(RRC, "target enb send spgw buffer to PDCP request failed!\n");
}else{
LOG_D(RRC, "target enb send spgw buffer to PDCP!\n");
}
// Message buffer has been processed, free it now.
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), GTPV1U_ENB_END_MARKER_IND (msg_p).sdu_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
break;
default:
LOG_E(RRC, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
} while(msg_p != NULL);
ue_context_p->ue_context.handover_info->endmark_state = ENDMARK_EMPTY;
ue_context_p->ue_context.handover_info->state = HO_FORWARDING_COMPLETE;
#endif
}
}
}
@@ -7006,15 +7253,51 @@ rrc_eNB_decode_ccch(
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
break;
}
if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) &&
(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)){
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the c-rnti UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000;
rrc_eNB_previous_SRB2(ue_context_p);
ue_context_p->ue_context.ue_reestablishment_timer = 0;
}
//previous rnti
rnti_t previous_rnti = 0;
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (reestablish_rnti_map[i][1] == c_rnti) {
previous_rnti = reestablish_rnti_map[i][0];
break;
}
}
if(previous_rnti != 0){
UE_id = find_UE_id(ctxt_pP->module_id, previous_rnti);
if(UE_id == -1){
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE_id(MAC) previous rnti %x, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),previous_rnti);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
break;
}
if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) &&
(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)) {
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the Previous UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
}
rrc_eNB_previous_SRB2(ue_context_p);
ue_context_p->ue_context.ue_reestablishment_timer = 0;
}
}
//c-plane not end
if((ue_context_p->ue_context.Status != RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == LTE_ReestablishmentCause_spare1)) {
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest (UE %x c-plane is not end), let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
break;
}
if(ue_context_p->ue_context.ue_reestablishment_timer > 0) {
LOG_E(RRC,
@@ -7557,6 +7840,9 @@ rrc_eNB_decode_dcch(
dedicated_DRB = 3;
RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0;
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
if(ue_context_p->ue_context.handover_info){
ue_context_p->ue_context.handover_info->state = HO_CONFIGURED;
}
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_HO_EXECUTION (xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
@@ -7635,6 +7921,7 @@ rrc_eNB_decode_dcch(
}
} else if(dedicated_DRB == 0) {
if(ue_context_p->ue_context.reestablishment_cause == LTE_ReestablishmentCause_spare1) {
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
ue_context_p);
} else {
@@ -7729,7 +8016,7 @@ rrc_eNB_decode_dcch(
}
RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
ue_context_p->ue_context.reestablishment_xid = -1;
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present ==
LTE_RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) {
@@ -8540,7 +8827,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
instance = ITTI_MSG_INSTANCE(msg_p);
/* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */
if (ITTI_MSG_ID(msg_p) != RRC_SUBFRAME_PROCESS)
LOG_I(RRC,"Received message %s\n",msg_name_p);
LOG_D(RRC,"Received message %s\n",msg_name_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
@@ -8679,6 +8966,9 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
case X2AP_HANDOVER_REQ_ACK: {
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
x2ap_handover_req_ack_t *x2ap_handover_req_ack = NULL;
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], X2AP_HANDOVER_REQ_ACK(msg_p).rnti);
if (ue_context_p == NULL) {
/* is it possible? */
@@ -8690,7 +8980,44 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
DevAssert(ue_context_p != NULL);
if (ue_context_p->ue_context.handover_info->state != HO_REQUEST) abort();
hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, ue_context_p->ue_context.rnti, (void**)&gtpv1u_ue_data_p);
/* set target enb gtp teid */
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
LOG_E(RRC, "X2AP_HANDOVER_REQ_ACK func(), hashtable_get failed: while getting ue rnti %x in hashtable ue_mapping\n", ue_context_p->ue_context.rnti);
} else {
uint8_t nb_e_rabs_tobesetup = 0;
ebi_t eps_bearer_id = 0;
int ip_offset = 0;
in_addr_t in_addr;
x2ap_handover_req_ack = &X2AP_HANDOVER_REQ_ACK(msg_p);
nb_e_rabs_tobesetup = x2ap_handover_req_ack->nb_e_rabs_tobesetup;
ue_context_p->ue_context.nb_x2u_e_rabs = nb_e_rabs_tobesetup;
for(int i=0; i< nb_e_rabs_tobesetup; i++){
ip_offset = 0;
eps_bearer_id = x2ap_handover_req_ack->e_rabs_tobesetup[i].e_rab_id;
ue_context_p->ue_context.enb_gtp_x2u_ebi[i] = eps_bearer_id;
ue_context_p->ue_context.enb_gtp_x2u_teid[i] = x2ap_handover_req_ack->e_rabs_tobesetup[i].gtp_teid;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_teNB = x2ap_handover_req_ack->e_rabs_tobesetup[i].gtp_teid;
if ((x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.length == 4) ||
(x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.length == 20)) {
in_addr = *((in_addr_t*)x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.buffer);
ip_offset = 4;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr = in_addr;
ue_context_p->ue_context.enb_gtp_x2u_addrs[i] = x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr;
}
if ((x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.length == 16) ||
(x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.length == 20)) {
memcpy(gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].tenb_ip6_addr.s6_addr,
&x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.buffer[ip_offset],
16);
}
}
}
rrc_eNB_process_handoverCommand(instance, ue_context_p, &X2AP_HANDOVER_REQ_ACK(msg_p));
ue_context_p->ue_context.handover_info->state = HO_PREPARE;
break;
+89
View File
@@ -27,14 +27,19 @@
* \email: lionel.gauthier@eurecom.fr
*/
//#if defined(ENABLE_USE_MME)
# include "rrc_defs.h"
# include "rrc_extern.h"
# include "RRC/LTE/MESSAGES/asn1_msg.h"
# include "rrc_eNB_GTPV1U.h"
# include "rrc_eNB_UE_context.h"
# include "msc.h"
//# if defined(ENABLE_ITTI)
# include "asn1_conversions.h"
# include "intertask_interface.h"
//#endif
# include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
@@ -88,6 +93,88 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
}
}
//------------------------------------------------------------------------------
boolean_t
gtpv_data_req(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t* const buffer_pP,
const pdcp_transmission_mode_t modeP,
uint32_t task_id
)
//------------------------------------------------------------------------------
{
if(sdu_sizeP == 0)
{
LOG_I(GTPU,"gtpv_data_req sdu_sizeP == 0");
return FALSE;
}
LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %d", ctxt_pP->rnti, sdu_sizeP, rb_idP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
if(task_id == TASK_DATA_FORWARDING){
LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n");
message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (TASK_GTPV1_U, GTPV1U_ENB_DATA_FORWARDING_IND);
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti;
GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}else if(task_id == TASK_END_MARKER){
LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n");
message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (TASK_GTPV1_U, GTPV1U_ENB_END_MARKER_IND);
GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame;
GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag;
GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP;
GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP;
GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP;
GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP;
GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer;
GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP;
GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id;
GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti;
GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
}
#endif
return TRUE;
}
//#endif
void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
module_id_t enb_mod_idP,
const rrc_eNB_ue_context_t* const ue_context_pP
@@ -112,3 +199,5 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
}
itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg);
}
+12
View File
@@ -53,4 +53,16 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
const rrc_eNB_ue_context_t* const ue_context_pP
);
boolean_t
gtpv_data_req(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t* const buffer_pP,
const pdcp_transmission_mode_t modeP,
uint32_t task_id
);
#endif /* RRC_ENB_GTPV1U_H_ */
+102 -2
View File
@@ -256,6 +256,15 @@ rrc_eNB_S1AP_get_ue_ids(
}
if (ue_desc_p != NULL) {
struct s1ap_eNB_ue_context_s *s1ap_ue_context_p = NULL;
if ((s1ap_ue_context_p = RB_REMOVE(s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head, ue_desc_p)) != NULL) {
LOG_E(RRC, "Removed UE context eNB_ue_s1ap_id %u\n", s1ap_ue_context_p->eNB_ue_s1ap_id);
s1ap_eNB_free_ue_context(s1ap_ue_context_p);
} else {
LOG_E(RRC, "Removing UE context eNB_ue_s1ap_id %u: did not find context\n",ue_desc_p->eNB_ue_s1ap_id);
}
return NULL; //skip the operation below to avoid loop
result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id);
if (ue_desc_p->ue_initial_id != UE_INITIAL_ID_INVALID) {
result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id);
@@ -934,6 +943,8 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
gtpv1u_enb_create_tunnel_req_t create_tunnel_req;
gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp;
uint8_t inde_list[NB_RB_MAX - 3]= {0};
int ret;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
protocol_ctxt_t ctxt;
ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id;
@@ -975,10 +986,23 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above
// create_tunnel_req.num_tunnels = i;
gtpv1u_create_s1u_tunnel(
ret = gtpv1u_create_s1u_tunnel(
instance,
&create_tunnel_req,
&create_tunnel_resp);
if ( ret != 0 ) {
LOG_E(RRC,"rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ : gtpv1u_create_s1u_tunnel failed,start to release UE %x\n",ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ue_release_timer_s1 = 1;
ue_context_p->ue_context.ue_release_timer_thres_s1 = 100;
ue_context_p->ue_context.ue_release_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
ue_context_p->ue_context.ul_failure_timer = 20000; // set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ
rrc_eNB_free_UE(ctxt.module_id,ue_context_p);
ue_context_p->ue_context.ul_failure_timer = 0;
return (0);
}
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
@@ -1251,6 +1275,8 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
protocol_ctxt_t ctxt;
uint8_t e_rab_done;
int ret = 0;
ue_initial_id = S1AP_E_RAB_SETUP_REQ (msg_p).ue_initial_id;
eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id;
ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id);
@@ -1313,10 +1339,22 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above
create_tunnel_req.num_tunnels = e_rab_done;
// NN: not sure if we should create a new tunnel: need to check teid, etc.
gtpv1u_create_s1u_tunnel(
ret = gtpv1u_create_s1u_tunnel(
instance,
&create_tunnel_req,
&create_tunnel_resp);
if ( ret != 0 ) {
LOG_E(RRC,"rrc_eNB_process_S1AP_E_RAB_SETUP_REQ : gtpv1u_create_s1u_tunnel failed,start to release UE %x\n",ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ue_release_timer_s1 = 1;
ue_context_p->ue_context.ue_release_timer_thres_s1 = 100;
ue_context_p->ue_context.ue_release_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
ue_context_p->ue_context.ul_failure_timer = 20000; // set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ
rrc_eNB_free_UE(ctxt.module_id,ue_context_p);
ue_context_p->ue_context.ul_failure_timer = 0;
return (0);
}
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
@@ -2039,6 +2077,68 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
return 0;
}
int rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ(instance_t instance, rrc_eNB_ue_context_t* const ue_context_target_p) {
gtpv1u_enb_create_x2u_tunnel_req_t create_tunnel_req;
gtpv1u_enb_create_x2u_tunnel_resp_t create_tunnel_resp;
uint8_t e_rab_done;
uint8_t inde_list[NB_RB_MAX - 3]= {0};
if (ue_context_target_p == NULL) {
return (-1);
} else {
/* Save e RAB information for later */
{
LOG_I(RRC, "[eNB %d] rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ: rnti %u nb_of_e_rabs %d\n",
instance, ue_context_target_p->ue_context.rnti, ue_context_target_p->ue_context.nb_of_e_rabs);
int i;
memset(&create_tunnel_req, 0, sizeof(create_tunnel_req));
uint8_t nb_e_rabs_tosetup = ue_context_target_p->ue_context.nb_of_e_rabs;
e_rab_done = 0;
for (i = 0;i < nb_e_rabs_tosetup; i++) {
if(ue_context_target_p->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE)
continue;
create_tunnel_req.eps_bearer_id[e_rab_done] = ue_context_target_p->ue_context.e_rab[i].param.e_rab_id;
LOG_I(RRC,"x2 tunnel setup: local index %d UE id %x, eps id %d \n",
i,
ue_context_target_p->ue_context.rnti,
create_tunnel_req.eps_bearer_id[i] );
inde_list[i] = e_rab_done;
e_rab_done++;
}
create_tunnel_req.rnti = ue_context_target_p->ue_context.rnti; // warning put zero above
create_tunnel_req.num_tunnels = e_rab_done;
// NN: not sure if we should create a new tunnel: need to check teid, etc.
gtpv1u_create_x2u_tunnel(
instance,
&create_tunnel_req,
&create_tunnel_resp);
ue_context_target_p->ue_context.nb_x2u_e_rabs = create_tunnel_resp.num_tunnels;
for (i = 0; i < create_tunnel_resp.num_tunnels; i++) {
ue_context_target_p->ue_context.enb_gtp_x2u_teid[inde_list[i]] = create_tunnel_resp.enb_X2u_teid[i];
ue_context_target_p->ue_context.enb_gtp_x2u_addrs[inde_list[i]] = create_tunnel_resp.enb_addr;
ue_context_target_p->ue_context.enb_gtp_x2u_ebi[inde_list[i]] = create_tunnel_resp.eps_bearer_id[i];
LOG_I(RRC, "rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ tunnel (%u, %u) bearer UE context index %u, msg index %u, eps bearer id %u, gtp addr len %d \n",
create_tunnel_resp.enb_X2u_teid[i],
ue_context_target_p->ue_context.enb_gtp_x2u_teid[inde_list[i]],
inde_list[i],
i,
create_tunnel_resp.eps_bearer_id[i],
create_tunnel_resp.enb_addr.length);
}
}
return (0);
}
}
int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p,
const char *msg_name,
instance_t instance)
+1
View File
@@ -278,6 +278,7 @@ int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t *const ctxt_p
int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP);
int rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ(instance_t instance, rrc_eNB_ue_context_t* const ue_context_target_p);
int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, const char *msg_name, instance_t instance);
int rrc_eNB_send_X2AP_UE_CONTEXT_RELEASE(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP);
+2
View File
@@ -173,6 +173,8 @@ typedef struct x2ap_eNB_instance_s {
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
uint32_t subframeAssignment[MAX_NUM_CCs];
uint32_t specialSubframe[MAX_NUM_CCs];
int num_cc;
net_ip_address_t target_enb_x2_ip_address[X2AP_MAX_NB_ENB_IP_ADDRESS];
+193 -2
View File
@@ -144,7 +144,92 @@ int x2ap_eNB_generate_x2_setup_request(
}
}
else {
AssertFatal(0,"X2Setuprequest not supported for TDD!");
servedCellMember->servedCellInfo.eUTRA_Mode_Info.present = X2AP_EUTRA_Mode_Info_PR_tDD;
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.eARFCN = instance_p->fdd_earfcn_DL[i];
switch (instance_p->subframeAssignment[i]) {
case 0:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa0;
break;
case 1:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa1;
break;
case 2:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa2;
break;
case 3:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa3;
break;
case 4:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa4;
break;
case 5:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa5;
break;
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa6;
break;
default:
AssertFatal(0,"Failed: Check value for subframeAssignment");
break;
}
switch (instance_p->specialSubframe[i]) {
case 0:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp0;
break;
case 1:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp1;
break;
case 2:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp2;
break;
case 3:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp3;
break;
case 4:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp4;
break;
case 5:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp5;
break;
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp6;
break;
case 7:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp7;
break;
case 8:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp8;
break;
default:
AssertFatal(0,"Failed: Check value for subframeAssignment");
break;
}
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.cyclicPrefixDL=X2AP_CyclicPrefixDL_normal;
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.cyclicPrefixUL=X2AP_CyclicPrefixUL_normal;
switch (instance_p->N_RB_DL[i]) {
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw6;
break;
case 15:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw15;
break;
case 25:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw25;
break;
case 50:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw50;
break;
case 75:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw75;
break;
case 100:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw100;
break;
default:
AssertFatal(0,"Failed: Check value for N_RB_DL/N_RB_UL");
break;
}
}
}
ASN_SEQUENCE_ADD(&ie->value.choice.ServedCells.list, servedCellMember);
@@ -279,7 +364,92 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
}
}
else {
AssertFatal(0,"X2Setupresponse not supported for TDD!");
servedCellMember->servedCellInfo.eUTRA_Mode_Info.present = X2AP_EUTRA_Mode_Info_PR_tDD;
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.eARFCN = instance_p->fdd_earfcn_DL[i];
switch (instance_p->subframeAssignment[i]) {
case 0:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa0;
break;
case 1:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa1;
break;
case 2:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa2;
break;
case 3:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa3;
break;
case 4:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa4;
break;
case 5:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa5;
break;
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.subframeAssignment = X2AP_SubframeAssignment_sa6;
break;
default:
AssertFatal(0,"Failed: Check value for subframeAssignment");
break;
}
switch (instance_p->specialSubframe[i]) {
case 0:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp0;
break;
case 1:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp1;
break;
case 2:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp2;
break;
case 3:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp3;
break;
case 4:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp4;
break;
case 5:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp5;
break;
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp6;
break;
case 7:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp7;
break;
case 8:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.specialSubframePatterns = X2AP_SpecialSubframePatterns_ssp8;
break;
default:
AssertFatal(0,"Failed: Check value for subframeAssignment");
break;
}
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.cyclicPrefixDL=X2AP_CyclicPrefixDL_normal;
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.specialSubframe_Info.cyclicPrefixUL=X2AP_CyclicPrefixUL_normal;
switch (instance_p->N_RB_DL[i]) {
case 6:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw6;
break;
case 15:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw15;
break;
case 25:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw25;
break;
case 50:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw50;
break;
case 75:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw75;
break;
case 100:
servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.tDD.transmission_Bandwidth = X2AP_Transmission_Bandwidth_bw100;
break;
default:
AssertFatal(0,"Failed: Check value for N_RB_DL/N_RB_UL");
break;
}
}
}
ASN_SEQUENCE_ADD(&ie->value.choice.ServedCells.list, servedCellMember);
@@ -627,6 +797,27 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p,
e_RABs_Admitted_Item = &e_RABS_Admitted_ItemIEs->value.choice.E_RABs_Admitted_Item;
{
e_RABs_Admitted_Item->e_RAB_ID = x2ap_handover_req_ack->e_rabs_tobesetup[i].e_rab_id;
e_RABs_Admitted_Item->uL_GTP_TunnelEndpoint = NULL;
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint = (X2AP_GTPtunnelEndpoint_t *)calloc(1, sizeof(*e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint));
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size = (uint8_t)x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.length;
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.bits_unused = 0;
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf =
calloc(1, e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size);
memcpy (e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf,
x2ap_handover_req_ack->e_rabs_tobesetup[i].eNB_addr.buffer,
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size);
X2AP_DEBUG("X2 handover response target ip addr. length %lu bits_unused %d buf %d.%d.%d.%d\n",
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size,
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.bits_unused,
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf[0],
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf[1],
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf[2],
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf[3]);
INT32_TO_OCTET_STRING(x2ap_handover_req_ack->e_rabs_tobesetup[i].gtp_teid, &e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->gTP_TEID);
}
ASN_SEQUENCE_ADD(&ie->value.choice.E_RABs_Admitted_List.list, e_RABS_Admitted_ItemIEs);
}
+52
View File
@@ -749,6 +749,8 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
{
X2AP_HandoverRequestAcknowledge_t *x2HandoverRequestAck;
X2AP_HandoverRequestAcknowledge_IEs_t *ie;
X2AP_E_RABs_Admitted_ItemIEs_t *e_RABS_Admitted_ItemIEs;
X2AP_E_RABs_Admitted_Item_t *e_RABs_Admitted_Item;
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_eNB_data;
@@ -816,6 +818,56 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
X2AP_HANDOVER_REQ_ACK(msg).rnti = rnti;
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck,
X2AP_ProtocolIE_ID_id_E_RABs_Admitted_List, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n", __FILE__, __LINE__);
return -1;
}else{
if (ie->value.choice.E_RABs_Admitted_List.list.count > 0) {
uint8_t nb_e_rabs_tobesetup;
nb_e_rabs_tobesetup = ie->value.choice.E_RABs_Admitted_List.list.count;
X2AP_HANDOVER_REQ_ACK(msg).nb_e_rabs_tobesetup = nb_e_rabs_tobesetup;
for (int i=0; i<nb_e_rabs_tobesetup; i++) {
e_RABS_Admitted_ItemIEs = (X2AP_E_RABs_Admitted_ItemIEs_t *) ie->value.choice.E_RABs_Admitted_List.list.array[i];
e_RABs_Admitted_Item = &e_RABS_Admitted_ItemIEs->value.choice.E_RABs_Admitted_Item;
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].e_rab_id = e_RABs_Admitted_Item->e_RAB_ID ;
X2AP_ERROR("x2u tunnel: index %d e_rab_id %d\n", i, X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].e_rab_id);
if(e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint == NULL){
X2AP_DEBUG("%s %d: X2AP_E_RABs_Admitted_Item_t->dL_GTP_TunnelEndpoint is a NULL pointer \n", __FILE__, __LINE__);
continue;
}
memcpy(X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.buffer,
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.buf,
e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size);
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.length = e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->transportLayerAddress.size;
OCTET_STRING_TO_INT32(&e_RABs_Admitted_Item->dL_GTP_TunnelEndpoint->gTP_TEID,
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].gtp_teid);
X2AP_DEBUG("x2u tunnel: index %d target enb ip %d.%d.%d.%d length %d gtp teid %u\n",
i,
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.buffer[0],
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.buffer[1],
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.buffer[2],
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.buffer[3],
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].eNB_addr.length,
X2AP_HANDOVER_REQ_ACK(msg).e_rabs_tobesetup[i].gtp_teid);
}
}
}
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck,
X2AP_ProtocolIE_ID_id_TargeteNBtoSource_eNBTransparentContainer, true);