Commit 4f5b7fcb authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix-msg2-gnb' into integration_2024_w14

parents 171d9950 e3747ab5
...@@ -85,7 +85,7 @@ gNBs = ...@@ -85,7 +85,7 @@ gNBs =
powerRampingStep = 1; powerRampingStep = 1;
#ra_ReponseWindow #ra_ReponseWindow
#1,2,4,8,10,20,40,80 #1,2,4,8,10,20,40,80
ra_ResponseWindow = 4; ra_ResponseWindow = 5;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
......
...@@ -88,7 +88,7 @@ gNBs = ...@@ -88,7 +88,7 @@ gNBs =
powerRampingStep = 1; powerRampingStep = 1;
#ra_ReponseWindow #ra_ReponseWindow
#1,2,4,8,10,20,40,80 #1,2,4,8,10,20,40,80
ra_ResponseWindow = 4; ra_ResponseWindow = 5;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
......
...@@ -82,7 +82,7 @@ gNBs = ...@@ -82,7 +82,7 @@ gNBs =
powerRampingStep = 1; powerRampingStep = 1;
#ra_ReponseWindow #ra_ReponseWindow
#1,2,4,8,10,20,40,80 #1,2,4,8,10,20,40,80
ra_ResponseWindow = 4; ra_ResponseWindow = 5;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
......
...@@ -209,10 +209,6 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) ...@@ -209,10 +209,6 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
.rach_ind = *rach_ind, .rach_ind = *rach_ind,
}; };
send_nsa_standalone_msg(&UL_INFO, rach_ind->header.message_id); send_nsa_standalone_msg(&UL_INFO, rach_ind->header.message_id);
for (int i = 0; i < rach_ind->number_of_pdus; i++)
{
free_and_zero(rach_ind->pdu_list[i].preamble_list);
}
free_and_zero(rach_ind->pdu_list); free_and_zero(rach_ind->pdu_list);
free_and_zero(rach_ind); free_and_zero(rach_ind);
} }
......
...@@ -397,9 +397,6 @@ int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind) ...@@ -397,9 +397,6 @@ int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
rach_ind->pdu_list[i].avg_rssi = ind->pdu_list[i].avg_rssi; rach_ind->pdu_list[i].avg_rssi = ind->pdu_list[i].avg_rssi;
rach_ind->pdu_list[i].avg_snr = ind->pdu_list[i].avg_snr; rach_ind->pdu_list[i].avg_snr = ind->pdu_list[i].avg_snr;
rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble; rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble;
rach_ind->pdu_list[i].preamble_list = CALLOC(ind->pdu_list[i].num_preamble, sizeof(nfapi_nr_prach_indication_preamble_t));
AssertFatal(rach_ind->pdu_list[i].preamble_list != NULL,
"Memory not allocated for rach_ind->pdu_list[i].preamble_list in phy_nr_rach_indication.");
for (int j = 0; j < ind->pdu_list[i].num_preamble; j++) { for (int j = 0; j < ind->pdu_list[i].num_preamble; j++) {
rach_ind->pdu_list[i].preamble_list[j].preamble_index = ind->pdu_list[i].preamble_list[j].preamble_index; rach_ind->pdu_list[i].preamble_list[j].preamble_index = ind->pdu_list[i].preamble_list[j].preamble_index;
rach_ind->pdu_list[i].preamble_list[j].timing_advance = ind->pdu_list[i].preamble_list[j].timing_advance; rach_ind->pdu_list[i].preamble_list[j].timing_advance = ind->pdu_list[i].preamble_list[j].timing_advance;
......
...@@ -731,7 +731,6 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind) ...@@ -731,7 +731,6 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble; rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble;
rach_ind->pdu_list[i].freq_index = ind->pdu_list[i].freq_index; rach_ind->pdu_list[i].freq_index = ind->pdu_list[i].freq_index;
rach_ind->pdu_list[i].symbol_index = ind->pdu_list[i].symbol_index; rach_ind->pdu_list[i].symbol_index = ind->pdu_list[i].symbol_index;
rach_ind->pdu_list[i].preamble_list = CALLOC(ind->pdu_list[i].num_preamble, sizeof(nfapi_nr_prach_indication_preamble_t));
AssertFatal(rach_ind->pdu_list[i].preamble_list != NULL, "Memory not allocated for rach_ind->pdu_list[i].preamble_list in phy_nr_rach_indication."); AssertFatal(rach_ind->pdu_list[i].preamble_list != NULL, "Memory not allocated for rach_ind->pdu_list[i].preamble_list in phy_nr_rach_indication.");
for (int j = 0; j < ind->number_of_pdus; j++) for (int j = 0; j < ind->number_of_pdus; j++)
{ {
...@@ -742,10 +741,6 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind) ...@@ -742,10 +741,6 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
if (!put_queue(&gnb_rach_ind_queue, rach_ind)) if (!put_queue(&gnb_rach_ind_queue, rach_ind))
{ {
LOG_E(NR_MAC, "Put_queue failed for rach_ind\n"); LOG_E(NR_MAC, "Put_queue failed for rach_ind\n");
for (int i = 0; i < ind->number_of_pdus; i++)
{
free(rach_ind->pdu_list[i].preamble_list);
}
free(rach_ind->pdu_list); free(rach_ind->pdu_list);
free(rach_ind); free(rach_ind);
} }
......
...@@ -1759,7 +1759,7 @@ typedef struct{ ...@@ -1759,7 +1759,7 @@ typedef struct{
uint8_t avg_rssi; uint8_t avg_rssi;
uint8_t avg_snr; uint8_t avg_snr;
uint8_t num_preamble; uint8_t num_preamble;
nfapi_nr_prach_indication_preamble_t* preamble_list; nfapi_nr_prach_indication_preamble_t preamble_list[64];
}nfapi_nr_prach_indication_pdu_t; }nfapi_nr_prach_indication_pdu_t;
......
...@@ -6302,14 +6302,11 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t *v ...@@ -6302,14 +6302,11 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t *v
return 0; return 0;
} }
if (value->num_preamble > 0) { for (int i = 0; i < value->num_preamble; i++) {
value->preamble_list = nfapi_p7_allocate(sizeof(*value->preamble_list) * value->num_preamble, config); nfapi_nr_prach_indication_preamble_t *preamble = &(value->preamble_list[i]);
for (int i = 0; i < value->num_preamble; i++) { if (!(pull8(ppReadPackedMsg, &preamble->preamble_index, end) && pull16(ppReadPackedMsg, &preamble->timing_advance, end)
nfapi_nr_prach_indication_preamble_t *preamble = &(value->preamble_list[i]); && pull32(ppReadPackedMsg, &preamble->preamble_pwr, end))) {
if (!(pull8(ppReadPackedMsg, &preamble->preamble_index, end) && pull16(ppReadPackedMsg, &preamble->timing_advance, end) return 0;
&& pull32(ppReadPackedMsg, &preamble->preamble_pwr, end))) {
return 0;
}
} }
} }
return 1; return 1;
......
...@@ -531,7 +531,6 @@ typedef struct { ...@@ -531,7 +531,6 @@ typedef struct {
#define MAX_NUM_NR_RX_RACH_PDUS 4 #define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
#define MAX_UL_PDUS_PER_SLOT 8 #define MAX_UL_PDUS_PER_SLOT 8
#define MAX_NUM_NR_SRS_PDUS 8 #define MAX_NUM_NR_SRS_PDUS 8
// the current RRC resource allocation is that each UE gets its // the current RRC resource allocation is that each UE gets its
...@@ -573,8 +572,6 @@ typedef struct PHY_VARS_gNB_s { ...@@ -573,8 +572,6 @@ typedef struct PHY_VARS_gNB_s {
nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS]; nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS];
/// NFAPI PRACH information /// NFAPI PRACH information
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS]; nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
/// NFAPI PRACH information
nfapi_nr_prach_indication_preamble_t preamble_list[MAX_NUM_NR_RX_PRACH_PREAMBLES];
nfapi_nr_ul_tti_request_t UL_tti_req; nfapi_nr_ul_tti_request_t UL_tti_req;
nfapi_nr_uci_indication_t uci_indication; nfapi_nr_uci_indication_t uci_indication;
......
...@@ -152,38 +152,43 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -152,38 +152,43 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
gNB->prach_energy_counter); gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) {
LOG_I(NR_PHY,
LOG_I(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", "[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol "
gNB->Mod_id, "%u freq index %u\n",
frame, frame,
slot, slot,
max_preamble[0], max_preamble[0],
max_preamble_energy[0]/10, max_preamble_energy[0] / 10,
max_preamble_energy[0]%10, max_preamble_energy[0] % 10,
gNB->measurements.prach_I0,gNB->prach_thres, gNB->measurements.prach_I0,
max_preamble_delay[0], gNB->prach_thres,
prachStartSymbol, max_preamble_delay[0],
prach_pdu->num_ra); prachStartSymbol,
prach_pdu->num_ra);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot),
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0])); T(T_ENB_PHY_INITIATE_RA_PROCEDURE,
T_INT(gNB->Mod_id),
T_INT(frame),
gNB->UL_INFO.rach_ind.number_of_pdus += 1; T_INT(slot),
T_INT(max_preamble[0]),
gNB->prach_pdu_indication_list[pdu_index].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value; T_INT(max_preamble_energy[0]),
gNB->prach_pdu_indication_list[pdu_index].symbol_index = prachStartSymbol; T_INT(max_preamble_delay[0]));
gNB->prach_pdu_indication_list[pdu_index].slot_index = slot;
gNB->prach_pdu_indication_list[pdu_index].freq_index = prach_pdu->num_ra; gNB->UL_INFO.rach_ind.number_of_pdus += 1;
gNB->prach_pdu_indication_list[pdu_index].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254;
gNB->prach_pdu_indication_list[pdu_index].avg_snr = 0xff; // invalid for now nfapi_nr_prach_indication_pdu_t *ind = &gNB->prach_pdu_indication_list[pdu_index];
ind->phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
gNB->prach_pdu_indication_list[pdu_index].num_preamble = 1; ind->symbol_index = prachStartSymbol;
gNB->prach_pdu_indication_list[pdu_index].preamble_list = gNB->preamble_list; ind->slot_index = slot;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_index = max_preamble[0]; ind->freq_index = prach_pdu->num_ra;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].timing_advance = max_preamble_delay[0]; ind->avg_rssi = (max_preamble_energy[0] < 631) ? (128 + (max_preamble_energy[0] / 5)) : 254;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; ind->avg_snr = 0xff; // invalid for now
pdu_index++;
ind->num_preamble = 1;
ind->preamble_list[0].preamble_index = max_preamble[0];
ind->preamble_list[0].timing_advance = max_preamble_delay[0];
ind->preamble_list[0].preamble_pwr = 0xffffffff;
pdu_index++;
} }
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
......
...@@ -125,16 +125,14 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response ...@@ -125,16 +125,14 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra;
rach_ind->pdu_list[pdu_index].avg_rssi = 128; rach_ind->pdu_list[pdu_index].avg_rssi = 128;
rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now
rach_ind->pdu_list[pdu_index].num_preamble = 1;
const int num_p = rach_ind->pdu_list[pdu_index].num_preamble; const int num_p = rach_ind->pdu_list[pdu_index].num_preamble;
rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t)); AssertFatal(num_p == 1, "can handle only one preamble in preamble_list\n");
rach_ind->pdu_list[pdu_index].num_preamble = 1;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = prach_pdu->ra_PreambleIndex; rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = prach_pdu->ra_PreambleIndex;
rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0; rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
if (!put_queue(&nr_rach_ind_queue, rach_ind)) { if (!put_queue(&nr_rach_ind_queue, rach_ind)) {
for (int pdu_index = 0; pdu_index < rach_ind->number_of_pdus; pdu_index++)
free(rach_ind->pdu_list[pdu_index].preamble_list);
free(rach_ind->pdu_list); free(rach_ind->pdu_list);
free(rach_ind); free(rach_ind);
} }
......
...@@ -1676,77 +1676,6 @@ void set_monitoring_periodicity_offset(NR_SearchSpace_t *ss, ...@@ -1676,77 +1676,6 @@ void set_monitoring_periodicity_offset(NR_SearchSpace_t *ss,
} }
void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss,
uint16_t *slot_period,
uint16_t *offset) {
switch(ss->monitoringSlotPeriodicityAndOffset->present) {
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
*slot_period = 1;
*offset = 0;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
*slot_period = 2;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
*slot_period = 4;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl4;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
*slot_period = 5;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl5;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
*slot_period = 8;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl8;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
*slot_period = 10;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl10;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
*slot_period = 16;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl16;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
*slot_period = 20;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl20;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
*slot_period = 40;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl40;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
*slot_period = 80;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl80;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
*slot_period = 160;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl160;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
*slot_period = 320;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl320;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
*slot_period = 640;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl640;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
*slot_period = 1280;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl1280;
break;
case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
*slot_period = 2560;
*offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2560;
break;
default:
AssertFatal(1==0,"Invalid monitoring slot periodicity and offset value\n");
break;
}
}
int get_nr_prach_occasion_info_from_index(uint8_t index, int get_nr_prach_occasion_info_from_index(uint8_t index,
uint32_t pointa, uint32_t pointa,
uint8_t mu, uint8_t mu,
......
...@@ -133,10 +133,6 @@ void find_aggregation_candidates(uint8_t *aggregation_level, ...@@ -133,10 +133,6 @@ void find_aggregation_candidates(uint8_t *aggregation_level,
const NR_SearchSpace_t *ss, const NR_SearchSpace_t *ss,
int maxL); int maxL);
void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss,
uint16_t *slot_period,
uint16_t *offset);
int get_nr_prach_info_from_index(uint8_t index, int get_nr_prach_info_from_index(uint8_t index,
int frame, int frame,
int slot, int slot,
......
...@@ -3795,6 +3795,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d ...@@ -3795,6 +3795,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
uint8_t preamble_index = ra->ra_PreambleIndex; uint8_t preamble_index = ra->ra_PreambleIndex;
uint16_t rnti = mac->ra.ra_rnti;
LOG_D(NR_MAC, "[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", frame, slot, mac->ue_id, preamble_index); LOG_D(NR_MAC, "[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", frame, slot, mac->ue_id, preamble_index);
...@@ -3802,11 +3803,11 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d ...@@ -3802,11 +3803,11 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
n_subheaders++; n_subheaders++;
if (rarh->T == 1) { if (rarh->T == 1) {
n_subPDUs++; n_subPDUs++;
LOG_I(NR_MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mac->ue_id); LOG_I(NR_MAC, "[UE %d][RAPROC][RA-RNTI %04x] Got RAPID RAR subPDU\n", mac->ue_id, rnti);
} else { } else {
ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI]; ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI];
ra->RA_BI_found = 1; ra->RA_BI_found = 1;
LOG_I(NR_MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d ms\n", mac->ue_id, ra->RA_backoff_indicator); LOG_I(NR_MAC, "[UE %d][RAPROC][RA-RNTI %04x] Got BI RAR subPDU %d ms\n", mac->ue_id, ra->RA_backoff_indicator, rnti);
if ( ((NR_RA_HEADER_BI *)rarh)->E == 1) { if ( ((NR_RA_HEADER_BI *)rarh)->E == 1) {
rarh += sizeof(NR_RA_HEADER_BI); rarh += sizeof(NR_RA_HEADER_BI);
continue; continue;
......
...@@ -654,11 +654,14 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant ...@@ -654,11 +654,14 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
if (periods_per_frame < 0) AssertFatal(periods_per_frame > 0, "TDD configuration cannot be configured\n");
LOG_E(NR_MAC, "TDD configuration can not be done\n"); if (frequency_range == FR2) {
else { LOG_I(NR_MAC, "Configuring TDD beam association to default\n");
LOG_I(NR_MAC, "TDD has been properly configurated\n"); nrmac->tdd_beam_association = malloc16(periods_per_frame * sizeof(int16_t));
nrmac->tdd_beam_association = (int16_t *)malloc16(periods_per_frame * sizeof(int16_t)); for (int i = 0; i < periods_per_frame; ++i)
nrmac->tdd_beam_association[i] = -1; /* default: beams not configured */
} else {
nrmac->tdd_beam_association = NULL; /* default: no beams */
} }
} }
......
...@@ -2071,20 +2071,6 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP) ...@@ -2071,20 +2071,6 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
return NULL; return NULL;
} }
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
{
NR_RA_t *ra = RC.nrmac[mod_idP]->common_channels[CC_idP].ra;
for (int RA_id = 0; RA_id < NR_NB_RA_PROC_MAX; RA_id++) {
LOG_D(NR_MAC, "Checking RA_id %d for %x : state %s\n", RA_id, rntiP, nrra_text[ra[RA_id].ra_state]);
if (ra[RA_id].ra_state != nrRA_gNB_IDLE && ra[RA_id].rnti == rntiP)
return RA_id;
}
return -1;
}
int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH n) int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH n)
{ {
switch (n) { switch (n) {
......
...@@ -717,7 +717,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -717,7 +717,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
if (no_sig) { if (no_sig) {
LOG_D(NR_MAC, "Random Access %i failed at state %s (no signal)\n", i, nrra_text[ra->ra_state]); LOG_D(NR_MAC, "Random Access %i failed at state %s (no signal)\n", i, nrra_text[ra->ra_state]);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
continue; continue;
} }
...@@ -732,7 +732,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -732,7 +732,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
nrra_text[ra->ra_state], nrra_text[ra->ra_state],
ra->rnti, ra->rnti,
current_rnti); current_rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
} }
continue; continue;
...@@ -747,7 +747,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -747,7 +747,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
ra->rnti, ra->rnti,
current_rnti); current_rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
return; return;
} }
...@@ -778,7 +778,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -778,7 +778,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
nr_mac_reset_ul_failure(UE_scheduling_control); nr_mac_reset_ul_failure(UE_scheduling_control);
reset_dl_harq_list(UE_scheduling_control); reset_dl_harq_list(UE_scheduling_control);
reset_ul_harq_list(UE_scheduling_control); reset_ul_harq_list(UE_scheduling_control);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
process_CellGroup(ra->CellGroup, UE); process_CellGroup(ra->CellGroup, UE);
} else { } else {
...@@ -809,7 +809,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -809,7 +809,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
// solution may be implemented // solution may be implemented
LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg3 to have UE come back with new RA attempt\n", ra->rnti); LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg3 to have UE come back with new RA attempt\n", ra->rnti);
mac_remove_nr_ue(RC.nrmac[gnb_mod_idP], ra->rnti); mac_remove_nr_ue(RC.nrmac[gnb_mod_idP], ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
return; return;
} }
...@@ -859,13 +859,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -859,13 +859,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
// for CFRA (NSA) do not schedule retransmission of msg3 // for CFRA (NSA) do not schedule retransmission of msg3
if (ra->cfra) { if (ra->cfra) {
LOG_D(NR_MAC, "Random Access %i failed at state %s (NSA msg3 reception failed)\n", i, nrra_text[ra->ra_state]); LOG_D(NR_MAC, "Random Access %i failed at state %s (NSA msg3 reception failed)\n", i, nrra_text[ra->ra_state]);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
return; return;
} }
if (ra->msg3_round >= gNB_mac->ul_bler.harq_round_max - 1) { if (ra->msg3_round >= gNB_mac->ul_bler.harq_round_max - 1) {
LOG_W(NR_MAC, "Random Access %i failed at state %s (Reached msg3 max harq rounds)\n", i, nrra_text[ra->ra_state]); LOG_W(NR_MAC, "Random Access %i failed at state %s (Reached msg3 max harq rounds)\n", i, nrra_text[ra->ra_state]);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(ra);
return; return;
} }
......
...@@ -115,7 +115,7 @@ void nr_schedule_RA(module_id_t module_idP, ...@@ -115,7 +115,7 @@ void nr_schedule_RA(module_id_t module_idP,
void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP,
uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset); uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset);
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra); void nr_clear_ra_proc(NR_RA_t *ra);
int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only);
...@@ -302,8 +302,6 @@ void remove_front_nr_list(NR_list_t *listP); ...@@ -302,8 +302,6 @@ void remove_front_nr_list(NR_list_t *listP);
NR_UE_info_t * find_nr_UE(NR_UEs_t* UEs, rnti_t rntiP); NR_UE_info_t * find_nr_UE(NR_UEs_t* UEs, rnti_t rntiP);
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
void configure_UE_BWP(gNB_MAC_INST *nr_mac, void configure_UE_BWP(gNB_MAC_INST *nr_mac,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
NR_UE_sched_ctrl_t *sched_ctrl, NR_UE_sched_ctrl_t *sched_ctrl,
......
...@@ -612,7 +612,7 @@ void ue_context_modification_refuse(const f1ap_ue_context_modif_refuse_t *refuse ...@@ -612,7 +612,7 @@ void ue_context_modification_refuse(const f1ap_ue_context_modif_refuse_t *refuse
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i]; NR_RA_t *ra = &cc->ra[i];
if (ra->rnti == UE->rnti) if (ra->rnti == UE->rnti)
nr_clear_ra_proc(0, CC_id, 0 /* frame */, ra); nr_clear_ra_proc(ra);
} }
NR_SCHED_UNLOCK(&mac->sched_lock); NR_SCHED_UNLOCK(&mac->sched_lock);
......
...@@ -164,8 +164,14 @@ typedef struct { ...@@ -164,8 +164,14 @@ typedef struct {
RA_gNB_state_t ra_state; RA_gNB_state_t ra_state;
/// CORESET0 configured flag /// CORESET0 configured flag
int coreset0_configured; int coreset0_configured;
/// Frame where preamble was received
int preamble_frame;
/// Slot where preamble was received /// Slot where preamble was received
uint8_t preamble_slot; uint8_t preamble_slot;
/// Received preamble_index
uint8_t preamble_index;
/// Timing offset indicated by PHY
int16_t timing_offset;
/// Subframe where Msg2 is to be sent /// Subframe where Msg2 is to be sent
uint8_t Msg2_slot; uint8_t Msg2_slot;
/// Frame where Msg2 is to be sent /// Frame where Msg2 is to be sent
...@@ -182,14 +188,8 @@ typedef struct { ...@@ -182,14 +188,8 @@ typedef struct {
rnti_t rnti; rnti_t rnti;
/// RA RNTI allocated from received PRACH /// RA RNTI allocated from received PRACH
uint16_t RA_rnti; uint16_t RA_rnti;
/// Received preamble_index
uint8_t preamble_index;
/// Received UE Contention Resolution Identifier /// Received UE Contention Resolution Identifier
uint8_t cont_res_id[6]; uint8_t cont_res_id[6];
/// Timing offset indicated by PHY
int16_t timing_offset;
/// Timeout for RRC connection
int16_t RRC_timer;
/// Msg3 first RB /// Msg3 first RB
int msg3_first_rb; int msg3_first_rb;
/// Msg3 number of RB /// Msg3 number of RB
......
...@@ -80,7 +80,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) ...@@ -80,7 +80,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n", LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot); UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot);
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) { for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
UL_info->rach_ind.number_of_pdus--;
AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble == 1, "More than 1 preamble not supported\n"); AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble == 1, "More than 1 preamble not supported\n");
nr_initiate_ra_proc(UL_info->module_id, nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
...@@ -256,10 +255,6 @@ static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind ...@@ -256,10 +255,6 @@ static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind
nfapi_nr_crc_indication_t *crc_ind) { nfapi_nr_crc_indication_t *crc_ind) {
if (rach_ind && rach_ind->number_of_pdus > 0) if (rach_ind && rach_ind->number_of_pdus > 0)
{ {
for(int i = 0; i < rach_ind->number_of_pdus; i++)
{
free_and_zero(rach_ind->pdu_list[i].preamble_list);
}
free_and_zero(rach_ind->pdu_list); free_and_zero(rach_ind->pdu_list);
free_and_zero(rach_ind); free_and_zero(rach_ind);
} }
......
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