Commit 8f7b041d authored by cig's avatar cig

Cleanup of hardcoded C-RNTI

- Giving C-RNTI as an input to DRB preconfiguration
- Set C-RNTI from UE configuration for higher layer function calls
parent 33bab5ba
......@@ -416,12 +416,10 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
//printf(">>> nr_ue_pdcch_procedures ended\n");
#endif
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_slot_rx==1
//Hardcoded rnti value
if(IS_SOFTMODEM_NOS1){
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_slot_rx, 0);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
pdcp_run(&ctxt);
}
}
......
......@@ -33,6 +33,7 @@
*
**************************************************************************/
#include "executables/softmodem-common.h"
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/defs_nr_UE.h"
#include <openair1/SCHED/sched_common.h>
......@@ -228,13 +229,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
int pucch_resource_indicator = MAX_PUCCH_RESOURCE_INDICATOR;
int n_HARQ_ACK;
uint16_t crnti=0x1234;
int dmrs_scrambling_id=0,data_scrambling_id=0;
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
NR_PUCCH_Resource_t *pucch_resource;
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
uint16_t crnti = mac->crnti;
/* update current context */
......
......@@ -60,7 +60,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
LOG_I(RLC, "Problem at RLC initiation \n");
}
pdcp_layer_init();
nr_DRB_preconfiguration();
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
}
// Allocate memory for ul_config_request in the mac instance. This is now a pointer and will
......
......@@ -4939,7 +4939,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) {
mac_rlc_data_ind(module_idP,
0x1234,
mac->crnti,
gNB_index,
frameP,
ENB_FLAG_NO,
......@@ -5151,6 +5151,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
uint16_t sdu_length_total = 0;
//unsigned short post_padding = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
0, lcid_buffer_occupancy_new = 0;
......@@ -5163,19 +5164,12 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
#endif
//NR_UE_MAC_INST_t *nr_ue_mac_inst = get_mac_inst(0);
// Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization
for (lcid = UL_SCH_LCID_SRB1;
lcid < NR_MAX_NUM_LCID; lcid++) {
lcid_buffer_occupancy_old =
//TODO: Replace static value with CRNTI
mac_rlc_get_buffer_occupancy_ind(module_idP,
0x1234, eNB_index, frameP, //nr_ue_mac_inst->crnti
subframe, ENB_FLAG_NO,
lcid);
lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid);
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
if(lcid_buffer_occupancy_new){
......@@ -5191,17 +5185,17 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
//TODO: Replace static value with CRNTI
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
0x1234, eNB_index, //nr_ue_mac_inst->crnti
mac->crnti,
eNB_index,
frameP,
ENB_FLAG_NO,
MBMS_FLAG_NO,
lcid,
buflen_remain,
(char *)&ulsch_sdus[sdu_length_total],0,
0
);
0);
AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
lcid, sdu_lengths[num_sdus], buflen_remain);
......@@ -5217,14 +5211,13 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
}
/* Get updated BO after multiplexing this PDU */
//TODO: Replace static value with CRNTI
lcid_buffer_occupancy_new =
mac_rlc_get_buffer_occupancy_ind(module_idP,
0x1234, //nr_ue_mac_inst->crnti
eNB_index, frameP,
subframe, ENB_FLAG_NO,
lcid);
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,
mac->crnti,
eNB_index,
frameP,
subframe,
ENB_FLAG_NO,
lcid);
buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
}
......@@ -5240,7 +5233,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
sdu_lengths, // sdu length
sdu_lcids, // sdu lcid
0, // power_headroom
0, // crnti
mac->crnti, // crnti
0, // truncated_bsr
0, // short_bsr
0, // long_bsr
......
......@@ -217,33 +217,18 @@ void nr_process_mac_pdu(
log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
#endif
if(IS_SOFTMODEM_NOS1){
mac_rlc_data_ind(module_idP,
0x1234,
module_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pdu_ptr + mac_subheader_len),
mac_sdu_len,
1,
NULL);
}
else{
mac_rlc_data_ind(module_idP,
rnti,
module_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pdu_ptr + mac_subheader_len),
mac_sdu_len,
1,
NULL);
}
mac_rlc_data_ind(module_idP,
rnti,
module_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pdu_ptr + mac_subheader_len),
mac_sdu_len,
1,
NULL);
break;
......
......@@ -95,7 +95,7 @@ void mac_top_init_gNB(void)
pdcp_layer_init();
if(IS_SOFTMODEM_NOS1)
nr_DRB_preconfiguration();
nr_DRB_preconfiguration(0x1234);
rrc_init_nr_global_param();
......
......@@ -19,6 +19,8 @@
* contact@openairinterface.org
*/
#include <stdint.h>
#ifndef _NR_PDCP_ENTITY_H_
#define _NR_PDCP_ENTITY_H_
......@@ -60,6 +62,6 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am(
char *buf, int size, int sdu_id),
void *deliver_pdu_data);
void nr_DRB_preconfiguration(void);
void nr_DRB_preconfiguration(uint16_t crnti);
#endif /* _NR_PDCP_ENTITY_H_ */
......@@ -715,7 +715,7 @@ boolean_t rrc_pdcp_config_asn1_req(
return 0;
}
void nr_DRB_preconfiguration(void)
void nr_DRB_preconfiguration(uint16_t crnti)
{
NR_RadioBearerConfig_t *rbconfig = NULL;
......@@ -824,10 +824,10 @@ void nr_DRB_preconfiguration(void)
ASN_SEQUENCE_ADD(&Rlc_Bearer_ToAdd_list->list, RLC_BearerConfig);
if (ENB_NAS_USE_TUN){
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, 0x1234, 0, 0,0);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, crnti, 0, 0, 0);
}
else{
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, crnti, 0, 0,0);
}
nr_rrc_pdcp_config_asn1_req(
......
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