Merge remote-tracking branch 'origin/fix-nrsoftmodem-stop' into integration_2022_wk33
This commit is contained in:
@@ -489,23 +489,21 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
scc);
|
||||
LOG_D(NR_MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
|
||||
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
|
||||
usleep(100 * 1000);
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
}
|
||||
if (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) {
|
||||
// fake that the gNB is configured in nFAPI mode, which would normally be
|
||||
// done in a NR_PHY_config_req, but in this mode, there is no PHY
|
||||
RC.gNB[Mod_idP]->configured = 1;
|
||||
} else {
|
||||
NR_PHY_Config_t phycfg = {
|
||||
.Mod_id = Mod_idP,
|
||||
.CC_id = 0,
|
||||
.cfg = &RC.nrmac[Mod_idP]->config[0]
|
||||
};
|
||||
DevAssert(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg);
|
||||
}
|
||||
|
||||
RC.nrmac[Mod_idP]->minRXTXTIMEpdsch = minRXTXTIMEpdsch;
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
phycfg.Mod_id = Mod_idP;
|
||||
phycfg.CC_id = 0;
|
||||
phycfg.cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
|
||||
if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg);
|
||||
|
||||
find_SSB_and_RO_available(Mod_idP);
|
||||
|
||||
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||
|
||||
@@ -613,6 +613,14 @@ void pf_dl(module_id_t module_id,
|
||||
return;
|
||||
|
||||
} else {
|
||||
/* skip this UE if there are no free HARQ processes. This can happen e.g.
|
||||
* if the UE disconnected in L2sim, in which case the gNB is not notified
|
||||
* (this can be considered a design flaw) */
|
||||
if (sched_ctrl->available_dl_harq.head < 0) {
|
||||
LOG_D(NR_MAC, "RNTI %04x has no free DL HARQ process, skipping\n", UE->rnti);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check DL buffer and skip this UE if no bytes and no TA necessary */
|
||||
if (sched_ctrl->num_total_bytes == 0 && frame != (sched_ctrl->ta_frame + 10) % 1024)
|
||||
continue;
|
||||
|
||||
@@ -916,21 +916,26 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
|
||||
handle_dl_harq(UE, pid, harq_value == 0 && harq_confidence == 0, RC.nrmac[mod_id]->dl_bler.harq_round_max);
|
||||
if (harq_confidence == 1) UE->mac_stats.pucch0_DTX++;
|
||||
}
|
||||
|
||||
// tpc (power control) only if we received AckNack
|
||||
if (uci_01->harq->harq_confidence_level==0)
|
||||
sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30);
|
||||
else
|
||||
sched_ctrl->tpc1 = 3;
|
||||
sched_ctrl->pucch_snrx10 = uci_01->ul_cqi * 5 - 640;
|
||||
|
||||
free(uci_01->harq->harq_list);
|
||||
free(uci_01->harq);
|
||||
}
|
||||
|
||||
// check scheduling request result, confidence_level == 0 is good
|
||||
if (uci_01->pduBitmap & 0x1 && uci_01->sr->sr_indication && uci_01->sr->sr_confidence_level == 0 && uci_01->ul_cqi >= 148) {
|
||||
// SR detected with SNR >= 10dB
|
||||
sched_ctrl->SR |= true;
|
||||
LOG_D(NR_MAC, "SR UE %04x ul_cqi %d\n", uci_01->rnti, uci_01->ul_cqi);
|
||||
}
|
||||
|
||||
// tpc (power control) only if we received AckNack or positive SR. For a
|
||||
// negative SR, the UE won't have sent anything, and the SNR is not valid
|
||||
if (((uci_01->pduBitmap >> 1) & 0x1) ) {
|
||||
if ((uci_01->harq) && (uci_01->harq->harq_confidence_level==0)) sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30);
|
||||
else sched_ctrl->tpc1 = 3;
|
||||
sched_ctrl->pucch_snrx10 = uci_01->ul_cqi * 5 - 640;
|
||||
if (uci_01->pduBitmap & 0x1) {
|
||||
if (uci_01->sr->sr_indication && uci_01->sr->sr_confidence_level == 0 && uci_01->ul_cqi >= 148) {
|
||||
// SR detected with SNR >= 10dB
|
||||
sched_ctrl->SR |= true;
|
||||
LOG_D(NR_MAC, "SR UE %04x ul_cqi %d\n", uci_01->rnti, uci_01->ul_cqi);
|
||||
}
|
||||
free(uci_01->sr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,6 +962,11 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
// 30);
|
||||
//sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640;
|
||||
|
||||
// TODO: handle SR
|
||||
if (uci_234->pduBitmap & 0x1) {
|
||||
free(uci_234->sr.sr_payload);
|
||||
}
|
||||
|
||||
if ((uci_234->pduBitmap >> 1) & 0x01) {
|
||||
// iterate over received harq bits
|
||||
for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) {
|
||||
@@ -969,15 +979,18 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
handle_dl_harq(UE, pid, uci_234->harq.harq_crc != 1 && acknack, RC.nrmac[mod_id]->dl_bler.harq_round_max);
|
||||
}
|
||||
free(uci_234->harq.harq_payload);
|
||||
}
|
||||
if ((uci_234->pduBitmap >> 2) & 0x01) {
|
||||
//API to parse the csi report and store it into sched_ctrl
|
||||
extract_pucch_csi_report(csi_MeasConfig, uci_234, frame, slot, UE, RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon);
|
||||
//TCI handling function
|
||||
tci_handling(UE,frame, slot);
|
||||
free(uci_234->csi_part1.csi_part1_payload);
|
||||
}
|
||||
if ((uci_234->pduBitmap >> 3) & 0x01) {
|
||||
//@TODO:Handle CSI Report 2
|
||||
// nothing to free (yet)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1085,6 +1085,15 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* skip this UE if there are no free HARQ processes. This can happen e.g.
|
||||
* if the UE disconnected in L2sim, in which case the gNB is not notified
|
||||
* (this can be considered a design flaw) */
|
||||
if (sched_ctrl->available_ul_harq.head < 0) {
|
||||
LOG_D(NR_MAC, "RNTI %04x has no free UL HARQ process, skipping\n", UE->rnti);
|
||||
continue;
|
||||
}
|
||||
|
||||
const int B = max(0, sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes);
|
||||
/* preprocessor computed sched_frame/sched_slot */
|
||||
const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity);
|
||||
|
||||
@@ -134,7 +134,7 @@ notifiedFIFO_t pdcp_sdu_list;
|
||||
pdcp_enb_t pdcp_enb[MAX_NUM_CCs];
|
||||
|
||||
|
||||
extern volatile int oai_exit;
|
||||
extern int oai_exit;
|
||||
|
||||
pthread_t pdcp_stats_thread_desc;
|
||||
|
||||
|
||||
@@ -265,23 +265,8 @@ static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind
|
||||
}
|
||||
if (uci_ind && uci_ind->num_ucis > 0)
|
||||
{
|
||||
for (int i = 0; i < uci_ind->num_ucis; i++) {
|
||||
switch (uci_ind->uci_list[i].pdu_type) {
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
|
||||
if (uci_ind->uci_list[i].pucch_pdu_format_0_1.harq) {
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
|
||||
}
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.sr);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
|
||||
free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* PUCCH fields (HARQ, SR) are freed in handle_nr_uci_pucch_0_1() and
|
||||
* handle_nr_uci_pucch_2_3_4() */
|
||||
free_and_zero(uci_ind->uci_list);
|
||||
free_and_zero(uci_ind);
|
||||
}
|
||||
|
||||
@@ -197,18 +197,20 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
|
||||
}
|
||||
|
||||
// Pushing SDAP SDU to GTP-U Layer
|
||||
MessageDef *message_p;
|
||||
uint8_t *gtpu_buffer_p;
|
||||
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, size + GTPU_HEADER_OVERHEAD_MAX - offset);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf+offset, size-offset);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0 , GTPV1U_GNB_TUNNEL_DATA_REQ);
|
||||
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB,
|
||||
0,
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ,
|
||||
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(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size-offset;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = rnti;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = pdusession_id;
|
||||
gtpv1u_gnb_tunnel_data_req_t *req = >PV1U_GNB_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->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);
|
||||
} else { //nrUE
|
||||
|
||||
Reference in New Issue
Block a user