changes in gtpu interface for testing, small changes in L1 for PUSCH signal/noise measurements. SRB2 interfaces.
This commit is contained in:
@@ -490,8 +490,12 @@ typedef struct {
|
||||
int32_t **ul_ch_magb1[8][8];
|
||||
/// measured RX power based on DRS
|
||||
int ulsch_power[8];
|
||||
/// total signal over antennas
|
||||
int ulsch_power_tot;
|
||||
/// measured RX noise power
|
||||
int ulsch_noise_power[8];
|
||||
/// total noise over antennas
|
||||
int ulsch_noise_power_tot;
|
||||
/// \brief llr values.
|
||||
/// - first index: ? [0..1179743] (hard coded)
|
||||
int16_t *llr;
|
||||
|
||||
@@ -382,10 +382,12 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
|
||||
LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
|
||||
|
||||
// estimate UL_CQI for MAC (from antenna port 0 only)
|
||||
int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[0]);
|
||||
// estimate UL_CQI for MAC
|
||||
|
||||
LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0])/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[0])/10.0);
|
||||
int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) -
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot);
|
||||
|
||||
LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0);
|
||||
|
||||
if (SNRtimes10 < -640) cqi=0;
|
||||
else if (SNRtimes10 > 635) cqi=255;
|
||||
@@ -657,22 +659,25 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1);
|
||||
start_meas(&gNB->rx_pusch_stats);
|
||||
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||
}
|
||||
int ulsch_power=0,ulsch_noise_power=0;
|
||||
start_meas(&gNB->rx_pusch_stats);
|
||||
for (uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||
}
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot=0;
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot=0;
|
||||
for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++) {
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx]/=num_dmrs;
|
||||
ulsch_power += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx];
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx];
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]/=num_dmrs;
|
||||
ulsch_noise_power += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
|
||||
}
|
||||
if (dB_fixed_x10(ulsch_power) < dB_fixed_x10(ulsch_noise_power) + gNB->pusch_thres) {
|
||||
if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
|
||||
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
|
||||
|
||||
LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
||||
dB_fixed_x10(ulsch_power),dB_fixed_x10(ulsch_noise_power),gNB->pusch_thres);
|
||||
LOG_I(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
||||
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
|
||||
gNB->pusch_vars[ULSCH_id]->DTX=1;
|
||||
stats->DTX++;
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
|
||||
#define CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10 "pusch_TargetSNRx10"
|
||||
#define CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10 "pucch_TargetSNRx10"
|
||||
|
||||
#define CONFIG_STRING_MACRLC_PUCCHFAILURETHRES "pucch_FailureThres"
|
||||
#define CONFIG_STRING_MACRLC_PUSCHFAILURETHRES "pusch_FailureThres"
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* MacRLC configuration parameters */
|
||||
@@ -83,6 +84,8 @@
|
||||
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:150, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUCCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUSCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \
|
||||
}
|
||||
#define MACRLC_CC_IDX 0
|
||||
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
|
||||
@@ -103,5 +106,7 @@
|
||||
#define MACRLC_REMOTE_S_PORTD_IDX 16
|
||||
#define MACRLC_PUSCHTARGETSNRX10_IDX 17
|
||||
#define MACRLC_PUCCHTARGETSNRX10_IDX 18
|
||||
#define MACRLC_PUCCHFAILURETHRES_IDX 19
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 20
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -675,7 +675,9 @@ void RCconfig_nr_macrlc() {
|
||||
RC.nb_nr_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
|
||||
RC.nrmac[j]->pusch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHTARGETSNRX10_IDX].iptr);
|
||||
RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr);
|
||||
|
||||
RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
|
||||
RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
|
||||
|
||||
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
|
||||
// check number of instances is same as RRC/PDCP
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#define HALFWORD 16
|
||||
#define WORD 32
|
||||
//#define SIZE_OF_POINTER sizeof (void *)
|
||||
static boolean_t loop_dcch_dtch = TRUE;
|
||||
static int loop_dcch_dtch = DL_SCH_LCID_DTCH;
|
||||
// Compute and write all MAC CEs and subheaders, and return number of written
|
||||
// bytes
|
||||
int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
@@ -343,8 +343,14 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
sched_ctrl->num_total_bytes = 0;
|
||||
loop_dcch_dtch = BOOL_NOT(loop_dcch_dtch);
|
||||
const int lcid = loop_dcch_dtch?DL_SCH_LCID_DTCH:DL_SCH_LCID_DCCH;
|
||||
if (loop_dcch_dtch == DL_SCH_LCID_DCCH1)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DTCH;
|
||||
else if (loop_dcch_dtch == DL_SCH_LCID_DTCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH;
|
||||
else if (loop_dcch_dtch == DL_SCH_LCID_DCCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH1;
|
||||
|
||||
const int lcid = loop_dcch_dtch;
|
||||
// const int lcid = DL_SCH_LCID_DTCH;
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
|
||||
@@ -364,12 +370,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
slot,
|
||||
lcid,
|
||||
sched_ctrl->num_total_bytes);
|
||||
|
||||
if (sched_ctrl->num_total_bytes == 0
|
||||
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
|
||||
return;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
LOG_I(NR_MAC,
|
||||
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
__func__,
|
||||
frame,
|
||||
@@ -1059,7 +1064,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
/* next, get RLC data */
|
||||
|
||||
// const int lcid = DL_SCH_LCID_DTCH;
|
||||
const int lcid = loop_dcch_dtch?DL_SCH_LCID_DTCH:DL_SCH_LCID_DCCH;
|
||||
const int lcid = loop_dcch_dtch;
|
||||
int dlsch_total_bytes = 0;
|
||||
if (sched_ctrl->num_total_bytes > 0) {
|
||||
tbs_size_t len = 0;
|
||||
@@ -1086,12 +1091,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
0,
|
||||
0);
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d RNTI %04x: %d bytes from DTCH %d (ndata %d, remaining size %d)\n",
|
||||
LOG_I(NR_MAC,
|
||||
"%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n",
|
||||
frame,
|
||||
slot,
|
||||
rnti,
|
||||
len,
|
||||
lcid < 4 ? "DCCH" : "DTCH",
|
||||
lcid,
|
||||
ndata,
|
||||
size);
|
||||
|
||||
@@ -1726,6 +1726,9 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
sched_ctrl->ta_update = 31;
|
||||
sched_ctrl->ta_apply = false;
|
||||
sched_ctrl->ul_rssi = 0;
|
||||
sched_ctrl->pucch_consecutive_dtx_cnt = 0;
|
||||
sched_ctrl->pusch_consecutive_dtx_cnt = 0;
|
||||
sched_ctrl->ul_failure = 0;
|
||||
/* set illegal time domain allocation to force recomputation of all fields */
|
||||
sched_ctrl->pusch_save.time_domain_allocation = -1;
|
||||
const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL;
|
||||
|
||||
@@ -227,6 +227,7 @@ void nr_process_mac_pdu(
|
||||
break;
|
||||
|
||||
case UL_SCH_LCID_SRB1:
|
||||
case UL_SCH_LCID_SRB2:
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
@@ -249,9 +250,6 @@ void nr_process_mac_pdu(
|
||||
1,
|
||||
NULL);
|
||||
break;
|
||||
case UL_SCH_LCID_SRB2:
|
||||
// todo
|
||||
break;
|
||||
case UL_SCH_LCID_SRB3:
|
||||
// todo
|
||||
break;
|
||||
@@ -307,7 +305,7 @@ void nr_process_mac_pdu(
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
|
||||
LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
|
||||
int UE_id = find_nr_UE_id(module_idP, rnti);
|
||||
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
@@ -423,7 +421,6 @@ void handle_nr_ul_harq(module_id_t mod_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When data are received on PHY and transmitted to MAC
|
||||
*/
|
||||
@@ -443,7 +440,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
const int current_rnti = rntiP;
|
||||
const int UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
|
||||
const int target_snrx10 = gNB_mac->pusch_target_snrx10;
|
||||
|
||||
const int pusch_failure_thres = gNB_mac->pusch_failure_thres;
|
||||
if (UE_id != -1) {
|
||||
NR_UE_sched_ctrl_t *UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const int8_t harq_pid = UE_scheduling_control->feedback_ul_harq.head;
|
||||
@@ -493,6 +490,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (sduP != NULL){
|
||||
LOG_D(NR_MAC, "Received PDU at MAC gNB \n");
|
||||
|
||||
UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt = 0;
|
||||
const uint32_t tb_size = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.tb_size;
|
||||
UE_scheduling_control->sched_ul_bytes -= tb_size;
|
||||
if (UE_scheduling_control->sched_ul_bytes < 0)
|
||||
@@ -509,9 +507,15 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (UE_scheduling_control->sched_ul_bytes < 0)
|
||||
UE_scheduling_control->sched_ul_bytes = 0;
|
||||
}
|
||||
if (ul_cqi < 128) UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++;
|
||||
if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) {
|
||||
LOG_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n");
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure = 1;
|
||||
}
|
||||
}
|
||||
} else if(sduP) {
|
||||
|
||||
|
||||
bool no_sig = true;
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
if(sduP[k]!=0) {
|
||||
@@ -537,7 +541,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
continue;
|
||||
|
||||
if(no_sig) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
} else {
|
||||
@@ -550,48 +554,48 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
current_rnti);
|
||||
|
||||
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x\n", i, ra->state,ra->rnti,current_rnti);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
int UE_id=-1;
|
||||
int UE_id=-1;
|
||||
|
||||
UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup);
|
||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||
UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup);
|
||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||
|
||||
// re-initialize ta update variables after RA procedure completion
|
||||
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||
// re-initialize ta update variables after RA procedure completion
|
||||
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
"reset RA state information for RA-RNTI %04x/index %d\n",
|
||||
ra->rnti,
|
||||
i);
|
||||
LOG_I(NR_MAC,
|
||||
"reset RA state information for RA-RNTI %04x/index %d\n",
|
||||
ra->rnti,
|
||||
i);
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||
gnb_mod_idP,
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ra->rnti);
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||
gnb_mod_idP,
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ra->rnti);
|
||||
|
||||
if(ra->cfra) {
|
||||
if (ra->cfra) {
|
||||
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP);
|
||||
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
||||
}
|
||||
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP);
|
||||
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
||||
}
|
||||
|
||||
// UE Contention Resolution Identity
|
||||
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4
|
||||
@@ -607,7 +611,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -616,7 +619,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (ra->state != WAIT_Msg3)
|
||||
continue;
|
||||
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (state is not WAIT_Msg3)\n", i, ra->state);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
}
|
||||
|
||||
@@ -524,6 +524,9 @@ typedef struct {
|
||||
uint8_t tpc1;
|
||||
uint16_t ul_rssi;
|
||||
uint8_t current_harq_pid;
|
||||
int pusch_consecutive_dtx_cnt;
|
||||
int pucch_consecutive_dtx_cnt;
|
||||
int ul_failure;
|
||||
struct CSI_Report CSI_report[MAX_CSI_REPORTS];
|
||||
/// information about every HARQ process
|
||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||
@@ -614,6 +617,10 @@ typedef struct gNB_MAC_INST_s {
|
||||
int pusch_target_snrx10;
|
||||
/// Pucch target SNR
|
||||
int pucch_target_snrx10;
|
||||
/// PUCCH Failure threshold (compared to consecutive PUCCH DTX)
|
||||
int pucch_failure_thres;
|
||||
/// PUSCH Failure threshold (compared to consecutive PUSCH DTX)
|
||||
int pusch_failure_thres;
|
||||
/// Subcarrier Offset
|
||||
int ssb_SubcarrierOffset;
|
||||
/// Common cell resources
|
||||
|
||||
@@ -333,7 +333,7 @@ void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity)
|
||||
|
||||
nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
nr_pdcp_entity_type_t type,
|
||||
int is_gnb, int rb_id,
|
||||
int is_gnb, int rb_id, int pdusession_id,
|
||||
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
|
||||
char *buf, int size),
|
||||
void *deliver_sdu_data,
|
||||
@@ -372,6 +372,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
ret->deliver_pdu_data = deliver_pdu_data;
|
||||
|
||||
ret->rb_id = rb_id;
|
||||
ret->pdusession_id = pdusession_id;
|
||||
ret->sn_size = sn_size;
|
||||
ret->t_reordering = t_reordering;
|
||||
ret->discard_timer = discard_timer;
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef struct nr_pdcp_entity_t {
|
||||
|
||||
/* configuration variables */
|
||||
int rb_id;
|
||||
|
||||
int pdusession_id;
|
||||
int sn_size; /* SN size, in bits */
|
||||
int t_reordering; /* unit: ms */
|
||||
int discard_timer; /* unit: ms */
|
||||
@@ -113,7 +113,7 @@ typedef struct nr_pdcp_entity_t {
|
||||
|
||||
nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
nr_pdcp_entity_type_t type,
|
||||
int is_gnb, int rb_id,
|
||||
int is_gnb, int rb_id, int pdusession_id,
|
||||
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
|
||||
char *buf, int size),
|
||||
void *deliver_sdu_data,
|
||||
|
||||
@@ -482,13 +482,13 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
size + GTPU_HEADER_OVERHEAD_MAX);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = entity->pdusession_id;
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
|
||||
//printf("\n");
|
||||
@@ -532,7 +532,7 @@ rb_found:
|
||||
memblock = get_free_mem_block(size, __FUNCTION__);
|
||||
memcpy(memblock->data, buf, size);
|
||||
|
||||
LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size);
|
||||
LOG_I(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
|
||||
//printf("\n");
|
||||
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL);
|
||||
@@ -754,7 +754,7 @@ static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s)
|
||||
LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
} else {
|
||||
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
|
||||
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, 0,
|
||||
deliver_sdu_srb, ue, deliver_pdu_srb, ue,
|
||||
12, t_Reordering, -1,
|
||||
0, 0,
|
||||
@@ -780,7 +780,21 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
int sn_size_ul = decode_sn_size_ul(*s->pdcp_Config->drb->pdcp_SN_SizeUL);
|
||||
int sn_size_dl = decode_sn_size_dl(*s->pdcp_Config->drb->pdcp_SN_SizeDL);
|
||||
int discard_timer = decode_discard_timer(*s->pdcp_Config->drb->discardTimer);
|
||||
|
||||
if ((!s->cnAssociation) || s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_NOTHING) {
|
||||
LOG_E(PDCP,"%s:%d:%s: fatal, cnAssociation is missing or present is NR_DRB_ToAddMod__cnAssociation_PR_NOTHING\n",__FILE__,__LINE__,__FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int pdusession_id;
|
||||
if (s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity)
|
||||
pdusession_id = s->cnAssociation->choice.eps_BearerIdentity;
|
||||
else {
|
||||
if (!s->cnAssociation->choice.sdap_Config) {
|
||||
LOG_E(PDCP,"%s:%d:%s: fatal, sdap_Config is null",__FILE__,__LINE__,__FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session;
|
||||
}
|
||||
/* TODO(?): accept different UL and DL SN sizes? */
|
||||
if (sn_size_ul != sn_size_dl) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal, bad SN sizes, must be same. ul=%d, dl=%d\n",
|
||||
@@ -800,7 +814,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
} else {
|
||||
pdcp_drb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, drb_id,
|
||||
pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,
|
||||
deliver_sdu_drb, ue, deliver_pdu_drb, ue,
|
||||
sn_size_dl, t_reordering, discard_timer,
|
||||
ciphering_algorithm, integrity_algorithm,
|
||||
|
||||
@@ -448,7 +448,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
|
||||
exit(1);
|
||||
|
||||
rb_found:
|
||||
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d",
|
||||
LOG_I(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size);
|
||||
|
||||
memblock = get_free_mem_block(size, __func__);
|
||||
@@ -765,7 +765,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
|
||||
/* TODO: accept other values? */
|
||||
if (logical_channel_group != 1) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
switch (r->present) {
|
||||
|
||||
@@ -1081,7 +1081,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
SpCellConfig->spCellConfigDedicated->tag_Id=0;
|
||||
}
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig) {
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup) {
|
||||
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
|
||||
NR_RLC_Config_t *rlc_Config = NULL;
|
||||
@@ -1116,7 +1116,24 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig) {
|
||||
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
|
||||
//}
|
||||
rlc_BearerConfig->rlc_Config = rlc_Config;
|
||||
|
||||
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = 3;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5;
|
||||
logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
//}
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
/*DRB Configuration*/
|
||||
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
@@ -1141,25 +1158,24 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig) {
|
||||
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t4;
|
||||
//}
|
||||
rlc_BearerConfig->rlc_Config = rlc_Config;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = 13;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100;
|
||||
logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 1;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
|
||||
|
||||
//if (0) {
|
||||
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = 3;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5;
|
||||
logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
//}
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig);
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup);
|
||||
|
||||
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
|
||||
@@ -691,6 +691,7 @@ rrc_gNB_process_RRCSetupComplete(
|
||||
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
||||
ue_context_pP->ue_context.Srb1.Active = 1;
|
||||
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1;
|
||||
ue_context_pP->ue_context.Status = NR_RRC_CONNECTED;
|
||||
|
||||
if (AMF_MODE_ENABLED) {
|
||||
@@ -962,7 +963,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
|
||||
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
|
||||
sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id;
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present;
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent;
|
||||
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present;
|
||||
sdap_config->defaultDRB = TRUE;
|
||||
sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
|
||||
@@ -1052,7 +1053,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
|
||||
memset(buffer, 0, RRC_BUF_SIZE);
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
fill_mastercellGroupConfig(cellGroupConfig);
|
||||
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup);
|
||||
size = do_RRCReconfiguration(ctxt_pP, buffer,
|
||||
xid,
|
||||
*SRB_configList2,
|
||||
@@ -1297,6 +1298,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
for (int i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
|
||||
if (SRB_configList->list.array[i]->srb_Identity == 1) {
|
||||
ue_context_pP->ue_context.Srb1.Active = 1;
|
||||
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1;
|
||||
} else if (SRB_configList->list.array[i]->srb_Identity == 2) {
|
||||
ue_context_pP->ue_context.Srb2.Active = 1;
|
||||
ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2;
|
||||
|
||||
@@ -810,7 +810,7 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS(
|
||||
/* Transfer data to PDCP */
|
||||
nr_rrc_data_req (
|
||||
&ctxt,
|
||||
DCCH, // ue_context_p->ue_context.Srb2.Srb_info.Srb_id,
|
||||
ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id,
|
||||
(*rrc_gNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
@@ -840,7 +840,7 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS(
|
||||
/* Transfer data to PDCP */
|
||||
nr_rrc_data_req (
|
||||
&ctxt,
|
||||
DCCH,
|
||||
ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id,
|
||||
(*rrc_gNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
|
||||
#undef GTP_DUMP_SOCKET
|
||||
|
||||
#undef GTPV1U_BEARER_OFFSET
|
||||
#define GTPV1U_BEARER_OFFSET 1
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LOG_GTPU 1
|
||||
/*--------------------------------------------------------------------------*
|
||||
* P R I V A T E F U N C T I O N S *
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user