Commit 1208ae0d authored by Cedric Roux's avatar Cedric Roux Committed by Sakthivel Velumani

replace rnti by ue_id in pdcp

some sdap and gtp files had to be touched, the work is not finished in there

some changes in nr_pdcp_oai_api.c simply assume ue_id is indeed rnti
(will functions in this file be used by cu-up?)
parent e67d1c88
......@@ -33,6 +33,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
}
bool sdap_data_req(protocol_ctxt_t *ctxt_p,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
const rb_id_t rb_id,
const mui_t mui,
......
......@@ -404,8 +404,9 @@ static void *enb_tun_read_thread(void *_)
extern int nas_sock_fd[];
char rx_buf[NL_MAX_PAYLOAD];
int len;
int rnti;
protocol_ctxt_t ctxt;
ue_id_t ue_id;
int has_ue;
int rb_id = 1;
pthread_setname_np( pthread_self(),"enb_tun_read");
......@@ -420,10 +421,10 @@ 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);
rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager);
has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &ue_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
if (rnti == -1) continue;
if (!has_ue) continue;
ctxt.module_id = 0;
ctxt.enb_flag = 1;
......@@ -432,14 +433,13 @@ static void *enb_tun_read_thread(void *_)
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rnti = rnti;
ctxt.rnti = 0;
uint8_t qfi = 7;
bool rqi = 0;
int pdusession_id = 10;
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
sdap_data_req(&ctxt, ue_id, 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);
}
......@@ -452,8 +452,9 @@ static void *ue_tun_read_thread(void *_)
extern int nas_sock_fd[];
char rx_buf[NL_MAX_PAYLOAD];
int len;
int rnti;
protocol_ctxt_t ctxt;
ue_id_t ue_id;
int has_ue;
int rb_id = 1;
pthread_setname_np( pthread_self(),"ue_tun_read");
......@@ -467,10 +468,10 @@ 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);
rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager);
has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &ue_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
if (rnti == -1) continue;
if (!has_ue) continue;
ctxt.module_id = 0;
ctxt.enb_flag = 0;
......@@ -479,14 +480,13 @@ static void *ue_tun_read_thread(void *_)
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rnti = rnti;
ctxt.rnti = 0;
bool dc = SDAP_HDR_UL_DATA_PDU;
extern uint8_t nas_qfi;
extern uint8_t nas_pduid;
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
sdap_data_req(&ctxt, ue_id, 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);
}
......@@ -619,13 +619,13 @@ 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 rnti: %d\n", size, ue->rnti);
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE rnti: %d\n", size, (int)ue->ue_id);
sdap_data_ind(entity->rb_id,
entity->is_gnb,
entity->has_sdap,
entity->has_sdapULheader,
entity->pdusession_id,
ue->rnti,
ue->ue_id,
buf,
size);
}
......@@ -638,7 +638,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
}
LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
__FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id);
exit(1);
rb_found:
......@@ -649,7 +649,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
ue->drb[rb_id-1]->has_sdap,
ue->drb[rb_id-1]->has_sdapULheader,
ue->drb[rb_id-1]->pdusession_id,
ue->rnti,
ue->ue_id,
buf,
size);
}
......@@ -673,7 +673,7 @@ static void deliver_pdu_drb(void *_ue, nr_pdcp_entity_t *entity,
}
LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
__FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id);
exit(1);
rb_found:
......@@ -685,7 +685,7 @@ rb_found:
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rnti = ue->rnti;
ctxt.rnti = ue->ue_id;
if (RC.nrrrc != NULL && NODE_IS_CU(RC.nrrrc[0]->node_type)) {
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0,
GTPV1U_GNB_TUNNEL_DATA_REQ,
......@@ -700,7 +700,7 @@ rb_found:
req->buffer = gtpu_buffer_p;
req->length = size;
req->offset = GTPU_HEADER_OVERHEAD_MAX;
req->rnti = ue->rnti;
req->rnti = ue->ue_id;
req->pdusession_id = rb_id;
LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n",
__func__, rb_id, size);
......@@ -732,7 +732,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 %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
__FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id);
exit(1);
srb_found:
......@@ -740,7 +740,7 @@ 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->rnti = ue->rnti;
ul_rrc->rnti = ue->ue_id;
ul_rrc->srb_id = srb_id;
ul_rrc->rrc_container = malloc(size);
AssertFatal(ul_rrc->rrc_container != NULL, "OUT OF MEMORY\n");
......@@ -756,7 +756,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;
NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rnti;
NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->ue_id;
itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p);
}
}
......@@ -778,7 +778,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity,
}
LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
__FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id);
exit(1);
srb_found:
......@@ -796,7 +796,7 @@ srb_found:
ctxt.eNB_index = 0;
ctxt.brOption = 0;
ctxt.rnti = ue->rnti;
ctxt.rnti = ue->ue_id;
memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size);
......@@ -811,7 +811,7 @@ srb_found:
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->rnti;
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->ue_id;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
......
......@@ -24,6 +24,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "LOG/log.h"
......@@ -75,17 +76,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, int rnti)
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t ue_id)
{
/* 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]->rnti == rnti)
if (m->ue_list[i]->ue_id == ue_id)
return m->ue_list[i];
LOG_D(PDCP, "%s:%d:%s: new UE 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
LOG_D(PDCP, "%s:%d:%s: new UE 0x%"PRIx64"\n", __FILE__, __LINE__, __FUNCTION__, ue_id);
m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count);
......@@ -99,13 +100,13 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti)
exit(1);
}
m->ue_list[m->ue_count-1]->rnti = rnti;
m->ue_list[m->ue_count-1]->ue_id = ue_id;
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, int rnti)
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t ue_id)
{
nr_pdcp_ue_manager_internal_t *m = _m;
nr_pdcp_ue_t *ue;
......@@ -113,13 +114,13 @@ void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, int rnti)
int j;
for (i = 0; i < m->ue_count; i++)
if (m->ue_list[i]->rnti == rnti)
if (m->ue_list[i]->ue_id == ue_id)
break;
if (i == m->ue_count) {
LOG_D(PDCP, "%s:%d:%s: warning: ue %d not found\n",
LOG_D(PDCP, "%s:%d:%s: warning: ue 0x%"PRIx64" not found\n",
__FILE__, __LINE__, __FUNCTION__,
rnti);
ue_id);
return;
}
......@@ -203,10 +204,11 @@ int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m)
return m->ue_count;
}
int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *_m)
int 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 -1;
return m->ue_list[0]->rnti;
return 0;
*ret = m->ue_list[0]->ue_id;
return 1;
}
......@@ -24,10 +24,12 @@
#include "nr_pdcp_entity.h"
#include "platform_types.h"
typedef void nr_pdcp_ue_manager_t;
typedef struct nr_pdcp_ue_t {
int rnti;
ue_id_t ue_id;
nr_pdcp_entity_t *srb[3];
nr_pdcp_entity_t *drb[5];
} nr_pdcp_ue_t;
......@@ -43,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, int rnti);
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, int rnti);
nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t ue_id);
void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t ue_id);
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);
......@@ -62,7 +64,7 @@ void nr_pdcp_ue_add_drb_pdcp_entity(nr_pdcp_ue_t *ue, int drb_id,
/* hacks */
/***********************************************************************/
/* returns -1 if no UE */
int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *m);
/* returns 0 if no UE, 1 otherwise */
int nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager_t *m, ue_id_t *ret);
#endif /* _NR_PDCP_UE_MANAGER_H_ */
......@@ -25,6 +25,7 @@ uint8_t nas_qfi;
uint8_t nas_pduid;
bool sdap_data_req(protocol_ctxt_t *ctxt_p,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
const rb_id_t rb_id,
const mui_t mui,
......@@ -38,10 +39,10 @@ bool sdap_data_req(protocol_ctxt_t *ctxt_p,
const bool rqi,
const int pdusession_id) {
nr_sdap_entity_t *sdap_entity;
sdap_entity = nr_sdap_get_entity(ctxt_p->rnti, pdusession_id);
sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id);
if(sdap_entity == NULL) {
LOG_E(SDAP, "%s:%d:%s: Entity not found with ue rnti: %x and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ctxt_p->rnti, pdusession_id);
LOG_E(SDAP, "%s:%d:%s: Entity not found with ue: 0x%"PRIx64" and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ue_id, pdusession_id);
return 0;
}
......@@ -66,11 +67,11 @@ void sdap_data_ind(rb_id_t pdcp_entity,
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti,
ue_id_t ue_id,
char *buf,
int size) {
nr_sdap_entity_t *sdap_entity;
sdap_entity = nr_sdap_get_entity(rnti, pdusession_id);
sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id);
if(sdap_entity == NULL) {
LOG_E(SDAP, "%s:%d:%s: Entity not found\n", __FILE__, __LINE__, __FUNCTION__);
......@@ -83,7 +84,7 @@ void sdap_data_ind(rb_id_t pdcp_entity,
has_sdap,
has_sdapULheader,
pdusession_id,
rnti,
ue_id,
buf,
size);
}
......
......@@ -33,6 +33,7 @@
* Uplink - nrUE
*/
bool sdap_data_req(protocol_ctxt_t *ctxt_p,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
const rb_id_t rb_id,
const mui_t mui,
......@@ -57,7 +58,7 @@ void sdap_data_ind(rb_id_t pdcp_entity,
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti,
ue_id_t ue_id,
char *buf,
int size
);
......
......@@ -171,7 +171,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
int has_sdap,
int has_sdapHeader,
int pdusession_id,
int rnti,
ue_id_t ue_id,
char *buf,
int size) {
/* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */
......@@ -203,13 +203,13 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
sizeof(gtpv1u_gnb_tunnel_data_req_t)
+ size + GTPU_HEADER_OVERHEAD_MAX - offset);
AssertFatal(message_p != NULL, "OUT OF MEMORY");
gtpv1u_gnb_tunnel_data_req_t *req = &GTPV1U_GNB_TUNNEL_DATA_REQ(message_p);
gtpv1u_gnb_tunnel_data_req_t *req = &GTPV1U_TUNNEL_DATA_REQ(message_p);
uint8_t *gtpu_buffer_p = (uint8_t *) (req + 1);
memcpy(gtpu_buffer_p + GTPU_HEADER_OVERHEAD_MAX, buf + offset, size - offset);
req->buffer = gtpu_buffer_p;
req->length = size - offset;
req->offset = GTPU_HEADER_OVERHEAD_MAX;
req->rnti = rnti;
req->rnti = ur_id;
req->pdusession_id = pdusession_id;
LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
......@@ -245,7 +245,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
if(!entity->qfi2drb_table[sdap_hdr->QFI].drb_id && entity->default_drb){
nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI);
rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, sdap_hdr->QFI);
entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
}
/*
......@@ -261,7 +261,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
has_sdapHeader ){
nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI);
rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, sdap_hdr->QFI);
entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
}
/*
......
......@@ -104,7 +104,7 @@ typedef struct nr_sdap_entity_s {
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti,
ue_id_t ue_id,
char *buf,
int size);
......
......@@ -20,6 +20,7 @@ typedef bool (*gtpCallback)(protocol_ctxt_t *ctxt_pP,
const uint32_t *destinationL2Id);
typedef bool (*gtpCallbackSDAP)(protocol_ctxt_t *ctxt_pP,
const ue_id_t ue_id,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
......
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