Commit 1c540818 authored by francescomani's avatar francescomani

purge unnecessary maybeRNTI from PDCP

parent cfc18220
......@@ -266,7 +266,7 @@ static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
{
nr_pdcp_ue_t *ue;
nr_pdcp_entity_t *rb;
ue_id_t rntiMaybeUEid = ctxt_pP->rntiMaybeUEid;
ue_id_t UEid = ctxt_pP->rntiMaybeUEid;
if (ctxt_pP->module_id != 0 ||
//ctxt_pP->enb_flag != 1 ||
......@@ -278,10 +278,10 @@ static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
}
if (ctxt_pP->enb_flag)
T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rntiMaybeUEid), T_INT(rb_id), T_INT(sdu_buffer_size));
T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(UEid), T_INT(rb_id), T_INT(sdu_buffer_size));
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, UEid);
rb = nr_pdcp_get_rb(ue, rb_id, srb_flagP);
if (rb != NULL) {
......@@ -417,7 +417,7 @@ static void *enb_tun_read_thread(void *_)
char rx_buf[NL_MAX_PAYLOAD];
int len;
protocol_ctxt_t ctxt;
ue_id_t rntiMaybeUEid;
ue_id_t UEid;
int rb_id = 1;
pthread_setname_np( pthread_self(),"enb_tun_read");
......@@ -432,7 +432,7 @@ static void *enb_tun_read_thread(void *_)
LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len);
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
const bool has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &rntiMaybeUEid);
const bool has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &UEid);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
if (!has_ue) continue;
......@@ -444,13 +444,26 @@ static void *enb_tun_read_thread(void *_)
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rntiMaybeUEid = rntiMaybeUEid;
ctxt.rntiMaybeUEid = UEid;
uint8_t qfi = 7;
bool rqi = 0;
int pdusession_id = 10;
sdap_data_req(&ctxt, rntiMaybeUEid, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, qfi, rqi, pdusession_id);
sdap_data_req(&ctxt,
UEid,
SRB_FLAG_NO,
rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
len,
(unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA,
NULL,
NULL,
qfi,
rqi,
pdusession_id);
}
return NULL;
......@@ -462,7 +475,7 @@ static void *ue_tun_read_thread(void *_)
char rx_buf[NL_MAX_PAYLOAD];
int len;
protocol_ctxt_t ctxt;
ue_id_t rntiMaybeUEid;
ue_id_t UEid;
int has_ue;
int rb_id = 1;
......@@ -477,7 +490,7 @@ static void *ue_tun_read_thread(void *_)
LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len);
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &rntiMaybeUEid);
has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &UEid);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
if (!has_ue) continue;
......@@ -489,13 +502,26 @@ static void *ue_tun_read_thread(void *_)
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rntiMaybeUEid = rntiMaybeUEid;
ctxt.rntiMaybeUEid = UEid;
bool dc = SDAP_HDR_UL_DATA_PDU;
extern uint8_t nas_qfi;
extern uint8_t nas_pduid;
sdap_data_req(&ctxt, rntiMaybeUEid, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, nas_qfi, dc, nas_pduid);
sdap_data_req(&ctxt,
UEid,
SRB_FLAG_NO,
rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
len,
(unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA,
NULL,
NULL,
nas_qfi,
dc,
nas_pduid);
}
return NULL;
......@@ -639,10 +665,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int i;
if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) {
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid);
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->ue_id);
// in NoS1 mode: the SDAP should write() packets to an FD (TUN interface),
// so below, set is_gnb == 0 to do that
sdap_data_ind(entity->rb_id, 0, entity->has_sdap_rx, entity->pdusession_id, ue->rntiMaybeUEid, buf, size);
sdap_data_ind(entity->rb_id, 0, entity->has_sdap_rx, entity->pdusession_id, ue->ue_id, buf, size);
}
else{
for (i = 0; i < MAX_DRBS_PER_UE; i++) {
......@@ -652,13 +678,19 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
}
}
LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid);
LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->ue_id);
exit(1);
rb_found:
{
LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size);
sdap_data_ind(rb_id, ue->drb[rb_id - 1]->is_gnb, ue->drb[rb_id - 1]->has_sdap_rx, ue->drb[rb_id - 1]->pdusession_id, ue->rntiMaybeUEid, buf, size);
sdap_data_ind(rb_id,
ue->drb[rb_id - 1]->is_gnb,
ue->drb[rb_id - 1]->has_sdap_rx,
ue->drb[rb_id - 1]->pdusession_id,
ue->ue_id,
buf,
size);
}
}
}
......@@ -722,7 +754,7 @@ static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity,
}
}
LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid);
LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->ue_id);
exit(1);
srb_found:
......@@ -730,10 +762,10 @@ srb_found:
MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_GNB, 0, F1AP_UL_RRC_MESSAGE);
AssertFatal(message_p != NULL, "OUT OF MEMORY\n");
f1ap_ul_rrc_message_t *ul_rrc = &F1AP_UL_RRC_MESSAGE(message_p);
ul_rrc->gNB_CU_ue_id = ue->rntiMaybeUEid;
ul_rrc->gNB_CU_ue_id = ue->ue_id;
/* look up the correct secondary UE ID to provide complete information to
* RRC, the RLC-PDCP interface does not transport this information */
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue->rntiMaybeUEid);
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue->ue_id);
ul_rrc->gNB_DU_ue_id = ue_data.secondary_ue;
ul_rrc->srb_id = srb_id;
ul_rrc->rrc_container = malloc(size);
......@@ -750,7 +782,7 @@ srb_found:
NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id;
NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p;
NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size;
ue_id_t ue_id = ue->rntiMaybeUEid;
ue_id_t ue_id = ue->ue_id;
itti_send_msg_to_task(TASK_RRC_NRUE, ue_id, message_p);
}
}
......@@ -900,18 +932,23 @@ void add_drb(int is_gnb,
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kRRCint)
void nr_pdcp_add_srbs(eNB_flag_t enb_flag,
ue_id_t UEid,
NR_SRB_ToAddModList_t *const srb2add_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kRRCint)
{
if (srb2add_list != NULL) {
for (int i = 0; i < srb2add_list->list.count; i++) {
add_srb(enb_flag, rntiMaybeUEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint);
add_srb(enb_flag, UEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint);
}
} else
LOG_W(PDCP, "nr_pdcp_add_srbs() with void list\n");
}
void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
ue_id_t rntiMaybeUEid,
ue_id_t UEid,
NR_DRB_ToAddModList_t *const drb2add_list,
const uint8_t security_modeP,
uint8_t *const kUPenc,
......@@ -920,7 +957,7 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
if (drb2add_list != NULL) {
for (int i = 0; i < drb2add_list->list.count; i++) {
add_drb(enb_flag,
rntiMaybeUEid,
UEid,
drb2add_list->list.array[i],
security_modeP & 0x0f,
(security_modeP >> 4) & 0x0f,
......
......@@ -47,22 +47,20 @@ bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
const uint32_t *const dstID);
void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
ue_id_t rntiMaybeUEid,
ue_id_t UEid,
NR_DRB_ToAddModList_t *const drb2add_list,
const uint8_t security_modeP,
uint8_t *const kUPenc,
uint8_t *const kUPint);
void add_drb(int is_gnb,
ue_id_t rntiMaybeUEid,
ue_id_t UEid,
struct NR_DRB_ToAddMod *s,
int ciphering_algorithm,
int integrity_algorithm,
unsigned char *ciphering_key,
unsigned char *integrity_key);
void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
void nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id, int rb_id, bool srb_flag);
......@@ -75,7 +73,7 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id);
void add_srb(int is_gnb,
ue_id_t rntiMaybeUEid,
ue_id_t UEid,
struct NR_SRB_ToAddMod *s,
int ciphering_algorithm,
int integrity_algorithm,
......
......@@ -82,17 +82,17 @@ void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *_m)
}
/* must be called with lock acquired */
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid)
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t UEid)
{
/* TODO: optimze */
nr_pdcp_ue_manager_internal_t *m = _m;
int i;
for (i = 0; i < m->ue_count; i++)
if (m->ue_list[i]->rntiMaybeUEid == rntiMaybeUEid)
if (m->ue_list[i]->ue_id == UEid)
return m->ue_list[i];
LOG_D(PDCP, "%s:%d:%s: new UE ID/RNTI 0x%" PRIx64 "\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid);
LOG_D(PDCP, "%s:%d:%s: new UE ID/RNTI 0x%" PRIx64 "\n", __FILE__, __LINE__, __FUNCTION__, UEid);
m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count);
......@@ -106,13 +106,13 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybe
exit(1);
}
m->ue_list[m->ue_count - 1]->rntiMaybeUEid = rntiMaybeUEid;
m->ue_list[m->ue_count - 1]->ue_id = UEid;
return m->ue_list[m->ue_count-1];
}
/* must be called with lock acquired */
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid)
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t UEid)
{
nr_pdcp_ue_manager_internal_t *m = _m;
nr_pdcp_ue_t *ue;
......@@ -120,11 +120,11 @@ void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid)
int j;
for (i = 0; i < m->ue_count; i++)
if (m->ue_list[i]->rntiMaybeUEid == rntiMaybeUEid)
if (m->ue_list[i]->ue_id == UEid)
break;
if (i == m->ue_count) {
LOG_D(PDCP, "%s:%d:%s: warning: UE ID/RNTI 0x%" PRIx64 " not found\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid);
LOG_D(PDCP, "%s:%d:%s: warning: UE ID/RNTI 0x%" PRIx64 " not found\n", __FILE__, __LINE__, __FUNCTION__, UEid);
return;
}
......@@ -213,6 +213,6 @@ bool nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager_t *_m, ue_id_t *ret)
nr_pdcp_ue_manager_internal_t *m = _m;
if (m->ue_count == 0)
return false;
*ret = m->ue_list[0]->rntiMaybeUEid;
*ret = m->ue_list[0]->ue_id;
return true;
}
......@@ -29,7 +29,7 @@
typedef void nr_pdcp_ue_manager_t;
typedef struct nr_pdcp_ue_t {
ue_id_t rntiMaybeUEid;
ue_id_t ue_id;
nr_pdcp_entity_t *srb[3];
nr_pdcp_entity_t *drb[MAX_DRBS_PER_UE];
} nr_pdcp_ue_t;
......@@ -45,8 +45,8 @@ int nr_pdcp_manager_get_enb_flag(nr_pdcp_ue_manager_t *m);
void nr_pdcp_manager_lock(nr_pdcp_ue_manager_t *m);
void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *m);
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t rntiMaybeUEid);
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t rntiMaybeUEid);
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t UEid);
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t UEid);
nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m);
int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m);
......
......@@ -143,7 +143,12 @@ void ue_cxt_mod_direct(MessageDef *msg,
void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p,
e1ap_bearer_setup_resp_t *e1ap_resp);
void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kUPint);
void nr_pdcp_add_srbs(eNB_flag_t enb_flag,
ue_id_t UEid,
NR_SRB_ToAddModList_t *const srb2add_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kUPint);
void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
ue_id_t rntiMaybeUEid,
......
......@@ -205,7 +205,6 @@ typedef struct rrcPerNB {
} rrcPerNB_t;
typedef struct NR_UE_RRC_INST_s {
instance_t ue_id;
rrcPerNB_t perNB[NB_CNX_UE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment