Merge remote-tracking branch 'origin/develop' into NR_RRC_harmonization_after_BWP
This commit is contained in:
@@ -46,6 +46,8 @@ MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc
|
||||
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req )
|
||||
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_req)
|
||||
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_resp)
|
||||
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_modification_req)
|
||||
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_modification_resp)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
#define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message
|
||||
#define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message
|
||||
#define F1AP_UE_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_req
|
||||
#define F1AP_UE_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_resp
|
||||
#define F1AP_UE_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_resp
|
||||
#define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp
|
||||
#define F1AP_UE_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_req
|
||||
#define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp
|
||||
#define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail
|
||||
|
||||
#define F1AP_DL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_dl_rrc_message
|
||||
#define F1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req
|
||||
#define F1AP_UE_CONTEXT_RELEASE_CMD(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req
|
||||
#define F1AP_UE_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_req
|
||||
|
||||
/* Length of the transport layer address string
|
||||
* 160 bits / 8 bits by char.
|
||||
@@ -345,6 +345,35 @@ typedef struct f1ap_rb_failed_to_be_setup_s {
|
||||
long rb_id;
|
||||
} f1ap_rb_failed_to_be_setup_t;
|
||||
|
||||
typedef struct cu_to_du_rrc_information_s {
|
||||
uint8_t * cG_ConfigInfo;
|
||||
uint32_t cG_ConfigInfo_length;
|
||||
uint8_t * uE_CapabilityRAT_ContainerList;
|
||||
uint32_t uE_CapabilityRAT_ContainerList_length;
|
||||
uint8_t * measConfig;
|
||||
uint32_t measConfig_length;
|
||||
}cu_to_du_rrc_information_t;
|
||||
|
||||
typedef struct du_to_du_rrc_information_s {
|
||||
uint8_t * cellGroupConfig;
|
||||
uint8_t cellGroupConfig_length;
|
||||
uint8_t * measGapConfig;
|
||||
uint8_t measGapConfig_length;
|
||||
uint8_t * requestedP_MaxFR1;
|
||||
uint8_t requestedP_MaxFR1_length;
|
||||
}du_to_cu_rrc_information_t;
|
||||
|
||||
typedef enum QoS_information_e {
|
||||
NG_RAN_QoS = 0,
|
||||
EUTRAN_QoS = 1,
|
||||
} QoS_information_t;
|
||||
|
||||
typedef enum ReconfigurationCompl_e {
|
||||
RRCreconf_info_not_present = 0,
|
||||
RRCreconf_failure = 1,
|
||||
RRCreconf_success = 2,
|
||||
} ReconfigurationCompl_t;
|
||||
|
||||
typedef struct f1ap_ue_context_setup_s {
|
||||
uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti
|
||||
uint32_t gNB_DU_ue_id;
|
||||
@@ -357,40 +386,27 @@ typedef struct f1ap_ue_context_setup_s {
|
||||
uint8_t servCellIndex;
|
||||
uint8_t *cellULConfigured;
|
||||
uint32_t servCellId;
|
||||
uint8_t *cu_to_du_rrc_information;
|
||||
cu_to_du_rrc_information_t *cu_to_du_rrc_information;
|
||||
uint8_t cu_to_du_rrc_information_length;
|
||||
uint8_t *du_to_cu_rrc_information;
|
||||
uint8_t du_to_cu_rrc_information_length;
|
||||
f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req
|
||||
uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req
|
||||
//uint8_t *du_to_cu_rrc_information;
|
||||
du_to_cu_rrc_information_t *du_to_cu_rrc_information;
|
||||
uint32_t du_to_cu_rrc_information_length;
|
||||
f1ap_drb_to_be_setup_t *drbs_to_be_setup;
|
||||
uint8_t drbs_to_be_setup_length;
|
||||
f1ap_drb_to_be_setup_t *drbs_to_be_modified;
|
||||
uint8_t drbs_to_be_modified_length;
|
||||
QoS_information_t QoS_information_type;
|
||||
uint8_t drbs_failed_to_be_setup_length;
|
||||
f1ap_rb_failed_to_be_setup_t *drbs_failed_to_be_setup;
|
||||
f1ap_srb_to_be_setup_t *srbs_to_be_setup;
|
||||
uint8_t srbs_to_be_setup_length;
|
||||
uint8_t srbs_failed_to_be_setup_length;
|
||||
f1ap_rb_failed_to_be_setup_t *srbs_failed_to_be_setup;
|
||||
s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req;
|
||||
// coniatner for the rrc_eNB_generate_SecurityModeCommand message
|
||||
ReconfigurationCompl_t ReconfigComplOutcome;
|
||||
uint8_t *rrc_container;
|
||||
int rrc_container_length;
|
||||
} f1ap_ue_context_setup_t;
|
||||
|
||||
typedef struct f1ap_ue_context_setup_resp_s {
|
||||
uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti
|
||||
uint32_t gNB_DU_ue_id;
|
||||
uint16_t rnti;
|
||||
uint8_t du_to_cu_rrc_information[1024 /*Arbitrarily big enough*/];
|
||||
uint32_t du_to_cu_rrc_information_length;
|
||||
f1ap_drb_to_be_setup_t *drbs_setup; // BK: need to replace by s1ap_initial_context_setup_req
|
||||
uint8_t drbs_setup_length; // BK: need to replace by s1ap_initial_context_setup_req
|
||||
f1ap_srb_to_be_setup_t *srbs_setup;
|
||||
uint8_t srbs_setup_length;
|
||||
uint8_t srbs_failed_to_be_setup_length;
|
||||
f1ap_rb_failed_to_be_setup_t *srbs_failed_to_be_setup;
|
||||
uint8_t drbs_failed_to_be_setup_length;
|
||||
f1ap_rb_failed_to_be_setup_t *drbs_failed_to_be_setup;
|
||||
} f1ap_ue_context_setup_resp_t;
|
||||
|
||||
typedef enum F1ap_Cause_e {
|
||||
F1AP_CAUSE_NOTHING, /* No components present */
|
||||
F1AP_CAUSE_RADIO_NETWORK,
|
||||
|
||||
@@ -27,4 +27,5 @@ MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end
|
||||
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd)
|
||||
MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq)
|
||||
|
||||
MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq)
|
||||
MESSAGE_DEF(GTPV1U_DU_BUFFER_REPORT_REQ, MESSAGE_PRIORITY_MED, gtpv1u_DU_buffer_report_req_t, NRGtpv1uBufferReportReq)
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq
|
||||
|
||||
#define GTPV1U_DU_BUFFER_REPORT_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uBufferReportReq
|
||||
|
||||
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
|
||||
|
||||
typedef struct gtpv1u_enb_create_x2u_tunnel_req_s {
|
||||
@@ -213,4 +215,10 @@ typedef struct gtpv1u_gnb_tunnel_data_req_s {
|
||||
pdusessionid_t pdusession_id;
|
||||
} gtpv1u_gnb_tunnel_data_req_t;
|
||||
|
||||
typedef struct gtpv1u_DU_buffer_report_req_s {
|
||||
uint32_t buffer_availability;
|
||||
rnti_t rnti;
|
||||
pdusessionid_t pdusession_id;
|
||||
} gtpv1u_DU_buffer_report_req_t;
|
||||
|
||||
#endif /* GTPV1_U_MESSAGES_TYPES_H_ */
|
||||
|
||||
@@ -167,7 +167,7 @@ typedef struct RadioResourceConfig_s {
|
||||
long ue_TransmissionMode;
|
||||
long ue_multiple_max;
|
||||
//SIB2 BR Options
|
||||
long *preambleTransMax_CE_r13;
|
||||
long preambleTransMax_CE_r13;
|
||||
BOOLEAN_t prach_ConfigCommon_v1310;
|
||||
BOOLEAN_t *mpdcch_startSF_CSS_RA_r13;
|
||||
long mpdcch_startSF_CSS_RA_r13_val;
|
||||
@@ -417,7 +417,6 @@ typedef struct NRRrcConfigurationReq_s {
|
||||
uint8_t num_plmn;
|
||||
NR_ServingCellConfigCommon_t *scc;
|
||||
NR_ServingCellConfig_t *scd;
|
||||
int ssb_SubcarrierOffset;
|
||||
int sib1_tda;
|
||||
rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts;
|
||||
int pusch_AntennaPorts;
|
||||
|
||||
@@ -681,6 +681,58 @@ void fill_eMTC_configuration(MessageDef *msg_p, ccparams_eMTC_t *eMTCconfig, in
|
||||
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n",
|
||||
config_fname, cell_idx,eMTCconfig->ccparams.rach_maxHARQ_Msg3Tx);
|
||||
|
||||
switch (eMTCconfig->preambleTransMax_CE_r13) {
|
||||
case 3:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n4;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n5;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n6;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n7;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n8;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n10;
|
||||
break;
|
||||
|
||||
case 20:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n20;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n50;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n100;
|
||||
break;
|
||||
|
||||
case 200:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].preambleTransMax_CE_r13= LTE_PreambleTransMax_n200;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal (0,
|
||||
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleTransMax_CE_r13 choice: 3,4,5,6,7,8,10,20,50,100,200!\n",
|
||||
config_fname, cell_idx,eMTCconfig->preambleTransMax_CE_r13);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (eMTCconfig->ccparams.pcch_defaultPagingCycle) {
|
||||
case 32:
|
||||
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig_BR[cc_idx].pcch_defaultPagingCycle= LTE_PCCH_Config__defaultPagingCycle_rf32;
|
||||
|
||||
@@ -147,7 +147,7 @@ typedef struct ccparams_eMTC_s {
|
||||
int interval_DLHoppingConfigCommonModeA_r13_val;
|
||||
int interval_DLHoppingConfigCommonModeB_r13_val;
|
||||
int mpdcch_pdsch_HoppingOffset_r13;
|
||||
char *preambleTransMax_CE_r13;
|
||||
int preambleTransMax_CE_r13;
|
||||
int prach_HoppingOffset_r13;
|
||||
int schedulingInfoSIB1_BR_r13;
|
||||
int64_t fdd_DownlinkOrTddSubframeBitmapBR_val_r13;
|
||||
@@ -253,7 +253,7 @@ typedef struct ccparams_eMTC_s {
|
||||
{ENB_CONFIG_STRING_INTERVAL_DL_HOPPING_CONFIG_COMMON_MODE_B_R13, NULL, 0, strptr:&eMTCconfig->interval_DLHoppingConfigCommonModeB_r13, defstrval:"interval-FDD-r13", TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_INTERVAL_DL_HOPPING_CONFIG_COMMON_MODE_B_R13_VAL, NULL, 0, iptr:&eMTCconfig->interval_DLHoppingConfigCommonModeB_r13_val, defintval:0, TYPE_UINT, 0}, \
|
||||
{ENB_CONFIG_STRING_MPDCCH_PDSCH_HOPPING_OFFSET_R13, NULL, 0, iptr:&eMTCconfig->mpdcch_pdsch_HoppingOffset_r13, defintval:1, TYPE_UINT, 0}, \
|
||||
{ENB_CONFIG_STRING_PREAMBLE_TRANSMAX_CE_R13, NULL, 0, strptr:&eMTCconfig->preambleTransMax_CE_r13, defstrval:"n10", TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_PREAMBLE_TRANSMAX_CE_R13, NULL, 0, iptr:&eMTCconfig->preambleTransMax_CE_r13, defintval:10, TYPE_UINT, 0}, \
|
||||
{ENB_CONFIG_STRING_PUCCH_NUM_REPETITION_CE_MSG4_LEVEL0, NULL, 0, strptr:&eMTCconfig->pucch_NumRepetitionCE_Msg4_Level0_r13, defstrval:"n1", TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_PUCCH_NUM_REPETITION_CE_MSG4_LEVEL1, NULL, 0, strptr:&eMTCconfig->pucch_NumRepetitionCE_Msg4_Level1_r13, defstrval:"", TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_PUCCH_NUM_REPETITION_CE_MSG4_LEVEL2, NULL, 0, strptr:&eMTCconfig->pucch_NumRepetitionCE_Msg4_Level2_r13, defstrval:"", TYPE_STRING, 0}, \
|
||||
|
||||
@@ -180,6 +180,12 @@ void *F1AP_CU_task(void *arg) {
|
||||
&F1AP_UE_CONTEXT_SETUP_REQ(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_MODIFICATION_REQ:
|
||||
LOG_I(F1AP, "CU Task received F1AP_UE_CONTEXT_MODIFICATION_REQ\n");
|
||||
CU_send_UE_CONTEXT_MODIFICATION_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UE_CONTEXT_MODIFICATION_REQ(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc
|
||||
LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n");
|
||||
CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -72,7 +72,8 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
|
||||
/*
|
||||
* UE Context Modification (gNB-CU initiated)
|
||||
*/
|
||||
int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance);
|
||||
int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance,
|
||||
f1ap_ue_context_setup_t *f1ap_ue_context_modification_req);
|
||||
int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
|
||||
@@ -78,6 +78,10 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) {
|
||||
case F1AP_ProcedureCode_id_UEContextSetup:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_UEContextModification:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextModification\n", __func__);
|
||||
break;
|
||||
|
||||
// case F1AP_ProcedureCode_id_InitialContextSetup:
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
@@ -123,6 +127,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) {
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_UEContextModification:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextModification\n", __func__);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)pdu->choice.successfulOutcome->procedureCode);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define ENB_NAME "Eurecom ENB"
|
||||
#define ENB_NAME_FORMAT (ENB_NAME" %u")
|
||||
|
||||
#define F1AP_PORT_NUMBER (30923)
|
||||
#define F1AP_PORT_NUMBER (38472)
|
||||
#define F1AP_SCTP_PPID (62)
|
||||
|
||||
#endif /* F1AP_DEFAULT_VALUES_H_ */
|
||||
|
||||
@@ -172,7 +172,20 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity);
|
||||
// // /* - CHOICE NR-MODE-Info */
|
||||
F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info;
|
||||
F1AP_ProtocolExtensionContainer_154P34_t *p_154P34=calloc(1,sizeof(* p_154P34));
|
||||
servedPLMN_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P34;
|
||||
asn1cSequenceAdd(p_154P34->list, F1AP_ServedPLMNs_ItemExtIEs_t , served_plmns_itemExtIEs);
|
||||
served_plmns_itemExtIEs->criticality = F1AP_Criticality_ignore;
|
||||
served_plmns_itemExtIEs->id = F1AP_ProtocolIE_ID_id_TAISliceSupportList;
|
||||
served_plmns_itemExtIEs->extensionValue.present = F1AP_ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
|
||||
F1AP_SliceSupportList_t *slice_support_list = &served_plmns_itemExtIEs->extensionValue.choice.SliceSupportList;
|
||||
|
||||
asn1cSequenceAdd(slice_support_list->list, F1AP_SliceSupportItem_t, SliceSupport_item);
|
||||
INT8_TO_OCTET_STRING(1,&SliceSupport_item->sNSSAI.sST);
|
||||
asn1cCalloc(SliceSupport_item->sNSSAI.sD, tmp);
|
||||
INT24_TO_OCTET_STRING(10203,tmp);
|
||||
//INT24_TO_OCTET_STRING(1,tmp);
|
||||
|
||||
if (f1ap_req(false, instance)->fdd_flag) { // FDD
|
||||
nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD;
|
||||
asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info);
|
||||
|
||||
@@ -810,6 +810,13 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
|
||||
sdu2P,
|
||||
sdu2_lenP);
|
||||
}
|
||||
/* mandatory */
|
||||
/* c6. Transaction ID (integer value) */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie6);
|
||||
ie6->id = F1AP_ProtocolIE_ID_id_TransactionID;
|
||||
ie6->criticality = F1AP_Criticality_ignore;
|
||||
ie6->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID;
|
||||
ie6->value.choice.TransactionID = F1AP_get_next_transaction_identifier(f1ap_req(false, instanceP)->gNB_DU_id, f1ap_req(false, instanceP)->gNB_DU_id);
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
|
||||
@@ -126,7 +126,7 @@ void *F1AP_DU_task(void *arg) {
|
||||
LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n");
|
||||
f1ap_setup_req_t *msgSetup=&F1AP_SETUP_REQ(msg);
|
||||
createF1inst(false, myInstance, msgSetup);
|
||||
getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address,
|
||||
getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, //"172.21.6.9", //"172.21.10.9",//"172.21.9.5", //msgSetup->CU_f1_ip_address.ipv4_address, //"192.168.18.91"
|
||||
msgSetup->CUport,
|
||||
msgSetup->DU_f1_ip_address.ipv4_address,
|
||||
msgSetup->DUport);
|
||||
@@ -175,7 +175,7 @@ void *F1AP_DU_task(void *arg) {
|
||||
break;
|
||||
|
||||
case F1AP_UL_RRC_MESSAGE: // to rrc
|
||||
LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
|
||||
LOG_D(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
DU_send_UL_NR_RRC_MESSAGE_TRANSFER(myInstance,
|
||||
@@ -191,6 +191,11 @@ void *F1AP_DU_task(void *arg) {
|
||||
DU_send_UE_CONTEXT_SETUP_RESPONSE(myInstance, &F1AP_UE_CONTEXT_SETUP_RESP(msg));
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_MODIFICATION_RESP:
|
||||
LOG_I(F1AP, "DU task received itti message from RRC for F1AP_UE_CONTEXT_MODIFICATION_RESP message generation \n");
|
||||
DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(myInstance, &F1AP_UE_CONTEXT_MODIFICATION_RESP(msg));
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC
|
||||
LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n");
|
||||
DU_send_UE_CONTEXT_RELEASE_REQUEST(myInstance,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -74,7 +74,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu);
|
||||
int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance);
|
||||
int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *resp);
|
||||
int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance);
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "f1ap_common.h"
|
||||
#include "f1ap_encoder.h"
|
||||
|
||||
int asn1_encoder_xer_print = 1;
|
||||
int asn1_encoder_xer_print = 0;
|
||||
|
||||
int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) {
|
||||
ssize_t encoded;
|
||||
|
||||
@@ -50,7 +50,7 @@ f1ap_message_processing_t f1ap_messages_processing[][3] = {
|
||||
{ DU_handle_gNB_CU_CONFIGURATION_UPDATE, CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE, CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE }, /* gNBCUConfigurationUpdate */
|
||||
{ DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */
|
||||
{ DU_handle_UE_CONTEXT_RELEASE_COMMAND, CU_handle_UE_CONTEXT_RELEASE_COMPLETE, 0 }, /* UEContextRelease */
|
||||
{ 0, 0, 0 }, /* UEContextModification */
|
||||
{ DU_handle_UE_CONTEXT_MODIFICATION_REQUEST, CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE, 0 }, /* UEContextModification */
|
||||
{ 0, 0, 0 }, /* UEContextModificationRequired */
|
||||
{ 0, 0, 0 }, /* UEMobilityCommand */
|
||||
{ CU_handle_UE_CONTEXT_RELEASE_REQUEST, 0, 0 }, /* UEContextReleaseRequest */
|
||||
|
||||
@@ -32,7 +32,7 @@ void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffe
|
||||
sctp_data_req->buffer = buffer;
|
||||
sctp_data_req->buffer_length = buffer_length;
|
||||
sctp_data_req->stream = stream;
|
||||
LOG_I(F1AP, "Sending ITTI message to SCTP Task\n");
|
||||
LOG_D(F1AP, "Sending ITTI message to SCTP Task\n");
|
||||
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#define CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD "pucch0_dtx_threshold"
|
||||
#define CONFIG_STRING_L1_PRACH_DTX_THRESHOLD "prach_dtx_threshold"
|
||||
#define CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD "pusch_dtx_threshold"
|
||||
#define CONFIG_STRING_L1_MAX_LDPC_ITERATIONS "max_ldpc_iterations"
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* L1 configuration parameters */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
@@ -69,7 +70,8 @@
|
||||
{CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR, NULL, 0, uptr:NULL, defuintval:8, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:150, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \
|
||||
{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, uptr:NULL, defintval:5, TYPE_UINT, 0}, \
|
||||
}
|
||||
#define L1_CC_IDX 0
|
||||
#define L1_TRANSPORT_N_PREFERENCE_IDX 1
|
||||
@@ -85,6 +87,7 @@
|
||||
#define L1_PUCCH0_DTX_THRESHOLD 11
|
||||
#define L1_PRACH_DTX_THRESHOLD 12
|
||||
#define L1_PUSCH_DTX_THRESHOLD 13
|
||||
#define L1_MAX_LDPC_ITERATIONS 14
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -62,12 +62,15 @@
|
||||
#define CONFIG_STRING_MACRLC_PUSCHFAILURETHRES "pusch_FailureThres"
|
||||
#define CONFIG_STRING_MACRLC_DL_BLER_TARGET_UPPER "dl_bler_target_upper"
|
||||
#define CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER "dl_bler_target_lower"
|
||||
#define CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD "dl_rd2_bler_threshold"
|
||||
#define CONFIG_STRING_MACRLC_DL_MAX_MCS "dl_max_mcs"
|
||||
#define CONFIG_STRING_MACRLC_UL_BLER_TARGET_UPPER "ul_bler_target_upper"
|
||||
#define CONFIG_STRING_MACRLC_UL_BLER_TARGET_LOWER "ul_bler_target_lower"
|
||||
#define CONFIG_STRING_MACRLC_UL_MAX_MCS "ul_max_mcs"
|
||||
#define CONFIG_STRING_MACRLC_HARQ_ROUND_MAX "harq_round_max"
|
||||
#define CONFIG_STRING_MACRLC_MIN_GRANT_PRB "min_grant_prb"
|
||||
#define CONFIG_STRING_MACRLC_MIN_GRANT_MCS "min_grant_mcs"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* MacRLC configuration parameters */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
@@ -97,8 +100,10 @@
|
||||
{CONFIG_STRING_MACRLC_PUSCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_BLER_TARGET_UPPER, "Upper threshold of BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.15, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER, "Lower threshold of BLER to increase DL MCS", 0, dblptr:NULL, defdblval:0.05, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD, "Threshold of RD2/RETX2 BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.01, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_MAX_MCS, "Maximum DL MCS that should be used", 0, u8ptr:NULL, defintval:28, TYPE_UINT8, 0}, \
|
||||
{CONFIG_STRING_MACRLC_UL_BLER_TARGET_UPPER, "Upper threshold of BLER to decrease UL MCS", 0, dblptr:NULL, defdblval:0.15, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_UL_BLER_TARGET_LOWER, "Lower threshold of BLER to increase UL MCS", 0, dblptr:NULL, defdblval:0.05, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_UL_MAX_MCS, "Maximum UL MCS that should be used", 0, u8ptr:NULL, defintval:9, TYPE_UINT8, 0}, \
|
||||
{CONFIG_STRING_MACRLC_HARQ_ROUND_MAX, "Maximum number of HARQ rounds", 0, u8ptr:NULL, defintval:4, TYPE_UINT8, 0}, \
|
||||
{CONFIG_STRING_MACRLC_MIN_GRANT_PRB, "Minimal Periodic ULSCH Grant PRBs", 0, u8ptr:NULL, defintval:5, TYPE_UINT8, 0}, \
|
||||
{CONFIG_STRING_MACRLC_MIN_GRANT_MCS, "Minimal Periodic ULSCH Grant MCS", 0, u8ptr:NULL, defintval:9, TYPE_UINT8, 0} \
|
||||
@@ -127,10 +132,13 @@
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 21
|
||||
#define MACRLC_DL_BLER_TARGET_UPPER_IDX 22
|
||||
#define MACRLC_DL_BLER_TARGET_LOWER_IDX 23
|
||||
#define MACRLC_DL_RD2_BLER_THRESHOLD_IDX 24
|
||||
#define MACRLC_DL_MAX_MCS_IDX 25
|
||||
#define MACRLC_HARQ_ROUND_MAX_IDX 26
|
||||
#define MACRLC_MIN_GRANT_PRB_IDX 27
|
||||
#define MACRLC_MIN_GRANT_MCS_IDX 28
|
||||
#define MACRLC_DL_MAX_MCS_IDX 24
|
||||
#define MACRLC_UL_BLER_TARGET_UPPER_IDX 25
|
||||
#define MACRLC_UL_BLER_TARGET_LOWER_IDX 26
|
||||
#define MACRLC_UL_MAX_MCS_IDX 27
|
||||
#define MACRLC_HARQ_ROUND_MAX_IDX 28
|
||||
#define MACRLC_MIN_GRANT_PRB_IDX 29
|
||||
#define MACRLC_MIN_GRANT_MCS_IDX 30
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -213,15 +213,20 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R
|
||||
// *scc->n_TimingAdvanceOffset=NR_ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
|
||||
*scc->ssb_periodicityServingCell=NR_ServingCellConfigCommon__ssb_periodicityServingCell_ms20;
|
||||
scc->dmrs_TypeA_Position=NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2;
|
||||
*scc->ssbSubcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=641032;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=78;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=640000;
|
||||
*scc->ssbSubcarrierSpacing=mu_dl;
|
||||
if (mu_dl == 0) {
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=520432;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=38;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=520000;
|
||||
} else {
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=641032;
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=78;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=640000;
|
||||
}
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=mu_dl;
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_DL;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth=13036;
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth=275*(N_RB_DL-1);
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing=mu_dl;//NR_SubcarrierSpacing_kHz30;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=12;
|
||||
*scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero=0;
|
||||
@@ -235,13 +240,13 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R
|
||||
timedomainresourceallocation1->startSymbolAndLength=57;
|
||||
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
|
||||
timedomainresourceallocation1);
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]=78;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]=mu_ul?78:38;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA=-1;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=mu_ul;
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_UL;
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->p_Max=20;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth=13036;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth=275*(N_RB_UL-1);
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing=mu_ul;//NR_SubcarrierSpacing_kHz30;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex=98;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM=NR_RACH_ConfigGeneric__msg1_FDM_one;
|
||||
@@ -277,8 +282,11 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal=-90;
|
||||
scc->ssb_PositionsInBurst->present=NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
|
||||
*ssb_bitmap=0xff;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing=NR_SubcarrierSpacing_kHz30;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing=mu_dl;
|
||||
if (mu_dl == 0)
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms10;
|
||||
else
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots=7;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols=6;
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots=2;
|
||||
@@ -722,6 +730,7 @@ void RCconfig_NR_L1(void) {
|
||||
RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr);
|
||||
RC.gNB[j]->num_ulprbbl = num_prbbl;
|
||||
RC.gNB[j]->ap_N1 = N1;
|
||||
RC.gNB[j]->ap_N2 = N2;
|
||||
@@ -876,10 +885,14 @@ void RCconfig_nr_macrlc() {
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
RC.nrmac[j]->ulsch_max_frame_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_FRAME_INACTIVITY].uptr);
|
||||
RC.nrmac[j]->dl_bler_target_upper = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_UPPER_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_bler_target_lower = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_LOWER_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_rd2_bler_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_RD2_BLER_THRESHOLD_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_MAX_MCS_IDX].u8ptr);
|
||||
NR_bler_options_t *dl_bler_options = &RC.nrmac[j]->dl_bler;
|
||||
dl_bler_options->upper = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_UPPER_IDX].dblptr);
|
||||
dl_bler_options->lower = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_LOWER_IDX].dblptr);
|
||||
dl_bler_options->max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_MAX_MCS_IDX].u8ptr);
|
||||
NR_bler_options_t *ul_bler_options = &RC.nrmac[j]->ul_bler;
|
||||
ul_bler_options->upper = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_BLER_TARGET_UPPER_IDX].dblptr);
|
||||
ul_bler_options->lower = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_BLER_TARGET_LOWER_IDX].dblptr);
|
||||
ul_bler_options->max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_MAX_MCS_IDX].u8ptr);
|
||||
RC.nrmac[j]->harq_round_max = *(MacRLC_ParamList.paramarray[j][MACRLC_HARQ_ROUND_MAX_IDX].u8ptr);
|
||||
RC.nrmac[j]->min_grant_prb = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_PRB_IDX].u8ptr);
|
||||
RC.nrmac[j]->min_grant_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_MCS_IDX].u8ptr);
|
||||
@@ -1225,8 +1238,6 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
(NRRRC_CONFIGURATION_REQ (msg_p).mnc_digit_length[l] == 3),"BAD MNC DIGIT LENGTH %d",
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).mnc_digit_length[l]);
|
||||
}
|
||||
LOG_I(GNB_APP,"SSB SCO %d\n",*GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr);
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = *GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr;
|
||||
LOG_I(GNB_APP,"pdsch_AntennaPorts N1 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr);
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts.N1 = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
|
||||
LOG_I(GNB_APP,"pdsch_AntennaPorts N2 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr);
|
||||
@@ -1947,9 +1958,38 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
|
||||
f1Setup->measurement_timing_information[k] = "0";
|
||||
f1Setup->ranac[k] = 0;
|
||||
f1Setup->mib[k] = rrc->carrier.MIB;
|
||||
f1Setup->sib1[k] = rrc->carrier.SIB1;
|
||||
f1Setup->mib_length[k] = rrc->carrier.sizeof_MIB;
|
||||
f1Setup->sib1_length[k] = rrc->carrier.sizeof_SIB1;
|
||||
|
||||
NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
|
||||
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
(void **)&bcch_message,
|
||||
(const void *)rrc->carrier.SIB1,
|
||||
rrc->carrier.sizeof_SIB1);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
LOG_E(RRC,"SIB1 decode error\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, bcch_message, 1 );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||
f1Setup->sib1[k] = calloc(1,rrc->carrier.sizeof_SIB1);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1,
|
||||
NULL,
|
||||
(void *)bcch_SIB1,
|
||||
f1Setup->sib1[k],
|
||||
NR_MAX_SIB_LENGTH/8);
|
||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
|
||||
//if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
LOG_I(NR_RRC, "SIB1 container to be integrated in F1 Setup request:\n");
|
||||
xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 );
|
||||
//}
|
||||
f1Setup->sib1_length[k] = (enc_rval.encoded+7)/8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2111,7 +2151,6 @@ void configure_gnb_du_mac(int inst) {
|
||||
// LOG_I(GNB_APP,"Configuring MAC/L1 %d, carrier->sib2 %p\n", inst, &carrier->sib2->radioResourceConfigCommon);
|
||||
LOG_I(GNB_APP,"Configuring gNB DU MAC/L1 %d \n", inst);
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
|
||||
@@ -113,7 +113,6 @@ typedef enum {
|
||||
#define GNB_CONFIG_STRING_REMOTE_S_PORTC "remote_s_portc"
|
||||
#define GNB_CONFIG_STRING_LOCAL_S_PORTD "local_s_portd"
|
||||
#define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd"
|
||||
#define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset"
|
||||
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1 "pdsch_AntennaPorts_N1"
|
||||
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2 "pdsch_AntennaPorts_N2"
|
||||
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP "pdsch_AntennaPorts_XP"
|
||||
@@ -149,7 +148,6 @@ typedef enum {
|
||||
{GNB_CONFIG_STRING_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1, "horiz. log. antenna ports", 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2, "vert. log. antenna ports", 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP, "XP log. antenna ports", 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
|
||||
@@ -179,20 +177,19 @@ typedef enum {
|
||||
#define GNB_REMOTE_S_PORTC_IDX 11
|
||||
#define GNB_LOCAL_S_PORTD_IDX 12
|
||||
#define GNB_REMOTE_S_PORTD_IDX 13
|
||||
#define GNB_SSB_SUBCARRIEROFFSET_IDX 14
|
||||
#define GNB_PDSCH_ANTENNAPORTS_N1_IDX 15
|
||||
#define GNB_PDSCH_ANTENNAPORTS_N2_IDX 16
|
||||
#define GNB_PDSCH_ANTENNAPORTS_XP_IDX 17
|
||||
#define GNB_PUSCH_ANTENNAPORTS_IDX 18
|
||||
#define GNB_SIB1_TDA_IDX 19
|
||||
#define GNB_DO_CSIRS_IDX 20
|
||||
#define GNB_DO_SRS_IDX 21
|
||||
#define GNB_NRCELLID_IDX 22
|
||||
#define GNB_MINRXTXTIME_IDX 23
|
||||
#define GNB_ULPRBBLACKLIST_IDX 24
|
||||
#define GNB_UMONDEFAULTDRB_IDX 25
|
||||
#define GNB_FORCE256QAMOFF_IDX 26
|
||||
#define GNB_ENABLE_SDAP_IDX 27
|
||||
#define GNB_PDSCH_ANTENNAPORTS_N1_IDX 14
|
||||
#define GNB_PDSCH_ANTENNAPORTS_N2_IDX 15
|
||||
#define GNB_PDSCH_ANTENNAPORTS_XP_IDX 16
|
||||
#define GNB_PUSCH_ANTENNAPORTS_IDX 17
|
||||
#define GNB_SIB1_TDA_IDX 18
|
||||
#define GNB_DO_CSIRS_IDX 19
|
||||
#define GNB_DO_SRS_IDX 20
|
||||
#define GNB_NRCELLID_IDX 21
|
||||
#define GNB_MINRXTXTIME_IDX 22
|
||||
#define GNB_ULPRBBLACKLIST_IDX 23
|
||||
#define GNB_UMONDEFAULTDRB_IDX 24
|
||||
#define GNB_FORCE256QAMOFF_IDX 25
|
||||
#define GNB_ENABLE_SDAP_IDX 26
|
||||
|
||||
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
|
||||
#define GNBPARAMS_CHECK { \
|
||||
|
||||
@@ -49,16 +49,15 @@ uint32_t nr_compute_tbs(uint16_t Qm,
|
||||
uint16_t nbp_re, nb_re;
|
||||
uint32_t nr_tbs=0;
|
||||
uint32_t Ninfo, Np_info, C;
|
||||
uint8_t n, scale;
|
||||
uint8_t n;
|
||||
|
||||
LOG_D(NR_MAC, "In %s: nb_symb_sch %d, nb_dmrs_prb %d, nb_rb %d, nb_rb_oh %d, tb_scaling %d Nl %d\n", __FUNCTION__, nb_symb_sch, nb_dmrs_prb, nb_rb, nb_rb_oh, tb_scaling, Nl);
|
||||
|
||||
nbp_re = NR_NB_SC_PER_RB * nb_symb_sch - nb_dmrs_prb - nb_rb_oh;
|
||||
nb_re = min(156, nbp_re) * nb_rb;
|
||||
scale = (R>1024)?11:10;
|
||||
// Intermediate number of information bits
|
||||
Ninfo = ((nb_re * R * Qm * Nl)>>scale)>>tb_scaling;
|
||||
|
||||
// R is tabulated as 10 times the actual code rate
|
||||
Ninfo = ((nb_re * R * Qm * Nl / 10)>>10)>>tb_scaling;
|
||||
|
||||
if (Ninfo <=3824) {
|
||||
n = max(3, floor(log2(Ninfo)) - 6);
|
||||
@@ -73,7 +72,7 @@ uint32_t nr_compute_tbs(uint16_t Qm,
|
||||
n = log2(Ninfo-24)-5;
|
||||
Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1<<n)))<<n);
|
||||
|
||||
if (R <= 256) {
|
||||
if (R <= 2560) {
|
||||
C = CEILIDIV((Np_info+24),3816);
|
||||
nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
|
||||
} else {
|
||||
|
||||
@@ -63,11 +63,6 @@
|
||||
#define CCCH_PAYLOAD_SIZE_MAX 512
|
||||
#define RAR_PAYLOAD_SIZE_MAX 128
|
||||
|
||||
typedef enum frequency_range_e {
|
||||
FR1 = 0,
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
#define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */
|
||||
#define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
|
||||
#define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
|
||||
|
||||
@@ -1686,7 +1686,7 @@ int get_nr_prach_info_from_index(uint8_t index,
|
||||
}
|
||||
if ( (s_map>>subframe)&0x01 ) {
|
||||
*N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe
|
||||
if (mu == 1) {
|
||||
if (mu == 1 && index >= 67) {
|
||||
if ( (*N_RA_slot <= 1) && (slot%2 == 0) )
|
||||
return 0; // no prach in even slots @ 30kHz for 1 prach per subframe
|
||||
}
|
||||
@@ -2095,17 +2095,15 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS*dmrs_length - N_PRB_oh;
|
||||
LOG_D(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
|
||||
|
||||
uint16_t R;
|
||||
uint32_t TBS=0;
|
||||
uint8_t table_idx, Qm;
|
||||
|
||||
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
|
||||
uint8_t ss_type = params_rel15.search_space_type;
|
||||
uint8_t dci_format = params_rel15.dci_format;
|
||||
get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/
|
||||
table_idx = 0;
|
||||
R = nr_get_code_rate_dl(Imcs, table_idx);
|
||||
Qm = nr_get_Qm_dl(Imcs, table_idx);
|
||||
uint8_t table_idx = 0;
|
||||
uint16_t R = nr_get_code_rate_dl(Imcs, table_idx);
|
||||
uint8_t Qm = nr_get_Qm_dl(Imcs, table_idx);
|
||||
|
||||
TBS = nr_compute_tbs(Qm,
|
||||
R,
|
||||
@@ -2126,25 +2124,25 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
TBS, N_PRB_DMRS, N_sh_symb, N_PRB_oh, R, Qm, table_idx,N_RE_prime*pdsch_rel15->rbSize*pdsch_rel15->NrOfCodewords );
|
||||
}
|
||||
|
||||
// the following tables contain 10 times the value reported in 214 (in line with SCF specification and to avoid fractional values)
|
||||
//Table 5.1.3.1-1 of 38.214
|
||||
uint16_t Table_51311[29][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
|
||||
{4,658},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
|
||||
uint16_t Table_51311[29][2] = {{2,1200},{2,1570},{2,1930},{2,2510},{2,3080},{2,3790},{2,4490},{2,5260},{2,6020},{2,6790},{4,3400},{4,3780},{4,4340},{4,4900},{4,5530},{4,6160},
|
||||
{4,6580},{6,4380},{6,4660},{6,5170},{6,5670},{6,6160},{6,6660},{6,7190},{6,7720},{6,8220},{6,8730}, {6,9100}, {6,9480}};
|
||||
|
||||
//Table 5.1.3.1-2 of 38.214
|
||||
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
|
||||
uint16_t Table_51312[28][2] = {{2,120},{2,193},{2,308},{2,449},{2,602},{4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{6,466},{6,517},{6,567},{6,616},{6,666},
|
||||
{6,719},{6,772},{6,822},{6,873},{8,1365},{8,711},{8,754},{8,797},{8,841},{8,885},{8,1833},{8,948}};
|
||||
uint16_t Table_51312[28][2] = {{2,1200},{2,1930},{2,3080},{2,4490},{2,6020},{4,3780},{4,4340},{4,4900},{4,5530},{4,6160},{4,6580},{6,4660},{6,5170},{6,5670},{6,6160},{6,6660},
|
||||
{6,7190},{6,7720},{6,8220},{6,8730},{8,6825},{8,7110},{8,7540},{8,7970},{8,8410},{8,8850},{8,9165},{8,9480}};
|
||||
|
||||
//Table 5.1.3.1-3 of 38.214
|
||||
uint16_t Table_51313[29][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{4,340},
|
||||
{4,378},{4,434},{4,490},{4,553},{4,616},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666}, {6,719}, {6,772}};
|
||||
uint16_t Table_51313[29][2] = {{2,300},{2,400},{2,500},{2,640},{2,780},{2,990},{2,1200},{2,1570},{2,1930},{2,2510},{2,3080},{2,3790},{2,4490},{2,5260},{2,6020},{4,3400},
|
||||
{4,3780},{4,4340},{4,4900},{4,5530},{4,6160},{6,4380},{6,4660},{6,5170},{6,5670},{6,6160},{6,6660},{6,7190},{6,7720}};
|
||||
|
||||
uint16_t Table_61411[28][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
|
||||
{4,658},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
|
||||
|
||||
uint16_t Table_61412[28][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},
|
||||
{4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{4,699},{4,772},{6,567},{6,616},{6,666}, {6,772}};
|
||||
uint16_t Table_61411[28][2] = {{2,1200},{2,1570},{2,1930},{2,2510},{2,3080},{2,3790},{2,4490},{2,5260},{2,6020},{2,6790},{4,3400},{4,3780},{4,4340},{4,4900},{4,5530},{4,6160},
|
||||
{4,6580},{6,4660},{6,5170},{6,5670},{6,6160},{6,6660},{6,7190},{6,7720},{6,8220},{6,8730},{6,9100},{6,9480}};
|
||||
|
||||
uint16_t Table_61412[28][2] = {{2,300},{2,400},{2,500},{2,640},{2,780},{2,990},{2,1200},{2,1570},{2,1930},{2,2510},{2,3080},{2,3790},{2,4490},{2,5260},{2,6020},{2,6790},
|
||||
{4,3780},{4,4340},{4,4900},{4,5530},{4,6160},{4,6580},{4,6990},{4,7720},{6,5670},{6,6160},{6,6660},{6,7720}};
|
||||
|
||||
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
|
||||
@@ -3500,6 +3498,22 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti) {
|
||||
|
||||
if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common)
|
||||
return 0;
|
||||
|
||||
const int cid = *ss->controlResourceSetId%3;
|
||||
const uint32_t A[3] = {39827, 39829, 39839};
|
||||
const uint32_t D = 65537;
|
||||
uint32_t Y;
|
||||
|
||||
Y = (A[cid] * rnti) % D;
|
||||
for (int s = 0; s < slot; s++)
|
||||
Y = (A[cid] * Y) % D;
|
||||
|
||||
return Y;
|
||||
}
|
||||
|
||||
void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||
frame_t frameP,
|
||||
@@ -3940,25 +3954,17 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *ty
|
||||
if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL)
|
||||
ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
|
||||
uint32_t duration,periodicity,offset;
|
||||
uint16_t symbols,max_agg;
|
||||
|
||||
AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n");
|
||||
|
||||
max_agg = (type0_PDCCH_CSS_config->num_symbols*type0_PDCCH_CSS_config->num_rbs)/6;
|
||||
|
||||
symbols = (1-(1<<type0_PDCCH_CSS_config->num_symbols))<<type0_PDCCH_CSS_config->first_symbol_index;
|
||||
duration = type0_PDCCH_CSS_config->search_space_duration;
|
||||
periodicity = type0_PDCCH_CSS_config->search_space_frame_period;
|
||||
if (type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1)
|
||||
offset = type0_PDCCH_CSS_config->n_0;
|
||||
else
|
||||
offset = type0_PDCCH_CSS_config->n_c;
|
||||
const uint32_t periodicity = type0_PDCCH_CSS_config->search_space_frame_period;
|
||||
const uint32_t offset = type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1
|
||||
? type0_PDCCH_CSS_config->n_0 : type0_PDCCH_CSS_config->n_c;
|
||||
|
||||
ss0->searchSpaceId = 0;
|
||||
*ss0->controlResourceSetId = 0;
|
||||
ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset));
|
||||
set_monitoring_periodicity_offset(ss0,periodicity,offset);
|
||||
const uint32_t duration = type0_PDCCH_CSS_config->search_space_duration;
|
||||
if (duration==1)
|
||||
ss0->duration = NULL;
|
||||
else{
|
||||
@@ -3966,6 +3972,7 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *ty
|
||||
*ss0->duration = duration;
|
||||
}
|
||||
|
||||
const uint16_t symbols = SL_to_bitmap(type0_PDCCH_CSS_config->first_symbol_index, type0_PDCCH_CSS_config->num_symbols);
|
||||
ss0->monitoringSymbolsWithinSlot->size = 2;
|
||||
ss0->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||
ss0->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||
@@ -3975,6 +3982,7 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *ty
|
||||
ss0->monitoringSymbolsWithinSlot->buf[0] |= ((symbols>>i)&0x01)<<(7-i);
|
||||
}
|
||||
|
||||
const uint16_t max_agg = (type0_PDCCH_CSS_config->num_symbols*type0_PDCCH_CSS_config->num_rbs)/6;
|
||||
// max values are set according to TS38.213 Section 10.1 Table 10.1-1
|
||||
ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "nr_mac.h"
|
||||
#include "openair1/PHY/impl_defs_nr.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||
|
||||
@@ -121,6 +124,23 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr
|
||||
uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table);
|
||||
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
|
||||
|
||||
uint32_t nr_compute_tbs(uint16_t Qm,
|
||||
uint16_t R,
|
||||
uint16_t nb_rb,
|
||||
uint16_t nb_symb_sch,
|
||||
uint16_t nb_dmrs_prb,
|
||||
uint16_t nb_rb_oh,
|
||||
uint8_t tb_scaling,
|
||||
uint8_t Nl);
|
||||
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for uplink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset);
|
||||
|
||||
int get_bw_tbslbrm(NR_BWP_t *genericParameters,
|
||||
|
||||
@@ -343,7 +343,9 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10;
|
||||
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
|
||||
cfg->ssb_table.ssb_subcarrier_offset = mac->ssb_subcarrier_offset;
|
||||
|
||||
// NSA -> take ssb offset from SCS
|
||||
cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
|
||||
@@ -558,7 +558,6 @@ typedef struct ssb_list_info {
|
||||
} ssb_list_info_t;
|
||||
|
||||
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id);
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -243,10 +243,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
uint16_t *crnti,
|
||||
NR_BSR_SHORT *truncated_bsr,
|
||||
NR_BSR_SHORT *short_bsr,
|
||||
NR_BSR_LONG *long_bsr
|
||||
);
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
NR_BSR_LONG *long_bsr);
|
||||
|
||||
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id);
|
||||
|
||||
@@ -269,7 +266,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
uint64_t *dci_pdu,
|
||||
dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon);
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(const NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon);
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *choose_dl_tda_list(NR_PDSCH_Config_t *pdsch_Config,NR_PDSCH_ConfigCommon_t *pdsch_ConfigCommon);
|
||||
|
||||
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
@@ -448,7 +445,7 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
||||
uint16_t riv);
|
||||
|
||||
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id);
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, int slot, int rnti);
|
||||
|
||||
void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac);
|
||||
|
||||
|
||||
Executable → Regular
+1
@@ -24,3 +24,4 @@
|
||||
*/
|
||||
long nr_get_Pcmax(module_id_t mod_id);
|
||||
/** @}*/
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@
|
||||
|
||||
//#define DEBUG_DCI
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15,
|
||||
int slot, int rnti) {
|
||||
|
||||
LOG_D(NR_MAC,"Filling search candidates for DCI\n");
|
||||
|
||||
@@ -57,6 +59,9 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
||||
uint8_t number_of_candidates=0;
|
||||
rel15->number_of_candidates=0;
|
||||
int i=0;
|
||||
uint32_t Y = 0;
|
||||
if (slot >= 0)
|
||||
Y = get_Y(ss, slot, rnti);
|
||||
for (int maxL=16;maxL>0;maxL>>=1) {
|
||||
find_aggregation_candidates(&aggregation,
|
||||
&number_of_candidates,
|
||||
@@ -65,8 +70,17 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
||||
if (number_of_candidates>0) {
|
||||
LOG_D(NR_MAC,"L %d, number of candidates %d, aggregation %d\n",maxL,number_of_candidates,aggregation);
|
||||
rel15->number_of_candidates += number_of_candidates;
|
||||
int N_cce_sym = 0; // nb of rbs of coreset per symbol
|
||||
for (int i=0;i<6;i++) {
|
||||
for (int t=0;t<8;t++) {
|
||||
N_cce_sym+=((rel15->coreset.frequency_domain_resource[i]>>t)&1);
|
||||
}
|
||||
}
|
||||
int N_cces = N_cce_sym*rel15->coreset.duration;
|
||||
for (int j=0; j<number_of_candidates; i++,j++) {
|
||||
rel15->CCE[i] = j*aggregation;
|
||||
int first_cce = aggregation * (( Y + CEILIDIV((j*N_cces),(aggregation*number_of_candidates)) + 0 ) % CEILIDIV(N_cces,aggregation));
|
||||
LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, number_of_candidates, first_cce, aggregation, N_cces, Y);
|
||||
rel15->CCE[i] = first_cce;
|
||||
rel15->L[i] = aggregation;
|
||||
}
|
||||
}
|
||||
@@ -305,14 +319,14 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
} else {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||
}
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
fill_dci_search_candidates(ss, rel15, -1, -1);
|
||||
break;
|
||||
case WAIT_CONTENTION_RESOLUTION:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
fill_dci_search_candidates(ss, rel15, -1, -1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -384,7 +398,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
|
||||
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
fill_dci_search_candidates(ss, rel15, slot, mac->crnti);
|
||||
|
||||
//#ifdef DEBUG_DCI
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
|
||||
@@ -420,19 +434,4 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
|
||||
AssertFatal(1==0,"Handle DCI searching when CellGroup without dedicated BWP\n");
|
||||
}
|
||||
// Search space 0, CORESET ID 0
|
||||
if (!get_softmodem_params()->nsa) {
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
if(ss0) {
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac,
|
||||
rel15,
|
||||
dl_config,
|
||||
((frame%2==mac->type0_PDCCH_CSS_config.sfn_c)&&(slot==mac->type0_PDCCH_CSS_config.n_0)) ? NR_RNTI_SI : NR_RNTI_C,
|
||||
-1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ NR_PDSCH_TimeDomainResourceAllocationList_t *choose_dl_tda_list(NR_PDSCH_Config_
|
||||
return(pdsch_TimeDomainAllocationList);
|
||||
}
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon) {
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *choose_ul_tda_list(const NR_PUSCH_Config_t *pusch_Config,NR_PUSCH_ConfigCommon_t *pusch_ConfigCommon) {
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList=NULL;
|
||||
|
||||
@@ -579,7 +579,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
if(pusch_config_pdu != NULL){
|
||||
if (pusch_TimeDomainAllocationList && use_default==false) {
|
||||
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
||||
LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
||||
LOG_E(NR_MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
||||
time_domain_ind, pusch_TimeDomainAllocationList->list.count);
|
||||
pusch_config_pdu->start_symbol_index=0;
|
||||
pusch_config_pdu->nr_of_symbols=0;
|
||||
@@ -937,6 +937,23 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
return -1;
|
||||
}
|
||||
|
||||
dlsch_config_pdu_1_0->qamModOrder = nr_get_Qm_dl(dlsch_config_pdu_1_0->mcs, dlsch_config_pdu_1_0->mcs_table);
|
||||
int R = nr_get_code_rate_dl(dlsch_config_pdu_1_0->mcs, dlsch_config_pdu_1_0->mcs_table);
|
||||
dlsch_config_pdu_1_0->targetCodeRate = R;
|
||||
if (dlsch_config_pdu_1_0->targetCodeRate == 0 || dlsch_config_pdu_1_0->qamModOrder == 0) {
|
||||
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
|
||||
int nb_re_dmrs = ((dlsch_config_pdu_1_0->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) ? 6:4)*dlsch_config_pdu_1_0->n_dmrs_cdm_groups;
|
||||
dlsch_config_pdu_1_0->TBS = nr_compute_tbs(dlsch_config_pdu_1_0->qamModOrder,
|
||||
R,
|
||||
dlsch_config_pdu_1_0->number_rbs,
|
||||
dlsch_config_pdu_1_0->number_symbols,
|
||||
nb_re_dmrs*get_num_dmrs(dlsch_config_pdu_1_0->dlDmrsSymbPos),
|
||||
nb_rb_oh, 0, 1);
|
||||
|
||||
int bw_tbslbrm;
|
||||
if (mac->scc || mac->scc_SIB || mac->cg) {
|
||||
NR_BWP_t genericParameters = mac->scc ? mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters :
|
||||
@@ -1354,6 +1371,25 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
/* TODO same calculation for MCS table as done in UL */
|
||||
dlsch_config_pdu_1_1->mcs_table = (pdsch_Config->mcs_Table) ? (*pdsch_Config->mcs_Table + 1) : 0;
|
||||
dlsch_config_pdu_1_1->qamModOrder = nr_get_Qm_dl(dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table);
|
||||
int R = nr_get_code_rate_dl(dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table);
|
||||
dlsch_config_pdu_1_1->targetCodeRate = R;
|
||||
if (dlsch_config_pdu_1_1->targetCodeRate == 0 || dlsch_config_pdu_1_1->qamModOrder == 0) {
|
||||
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
|
||||
return -1;
|
||||
}
|
||||
uint8_t Nl = 0;
|
||||
for (int i = 0; i < 12; i++) { // max 12 ports
|
||||
if ((dlsch_config_pdu_1_1->dmrs_ports>>i)&0x01) Nl += 1;
|
||||
}
|
||||
int nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
|
||||
int nb_re_dmrs = ((dmrs_type == NULL) ? 6:4)*dlsch_config_pdu_1_1->n_dmrs_cdm_groups;
|
||||
dlsch_config_pdu_1_1->TBS = nr_compute_tbs(dlsch_config_pdu_1_1->qamModOrder,
|
||||
R,
|
||||
dlsch_config_pdu_1_1->number_rbs,
|
||||
dlsch_config_pdu_1_1->number_symbols,
|
||||
nb_re_dmrs*get_num_dmrs(dlsch_config_pdu_1_1->dlDmrsSymbPos),
|
||||
nb_rb_oh, 0, Nl);
|
||||
|
||||
// TBS_LBRM according to section 5.4.2.1 of 38.212
|
||||
long *maxMIMO_Layers = mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers;
|
||||
@@ -2529,7 +2565,8 @@ uint8_t nr_get_csi_payload(NR_UE_MAC_INST_t *mac,
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI:
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI:
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI:
|
||||
AssertFatal(1==0,"Measurement report based on CSI-RS not availalble\n");
|
||||
LOG_E(NR_MAC,"Measurement report based on CSI-RS not available\n");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Invalid CSI report quantity type %d\n",csi_reportconfig->reportQuantity.present);
|
||||
}
|
||||
|
||||
@@ -697,8 +697,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(ubwpc->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_config_pdu->bwp_size = n_RB_ULBWP;
|
||||
|
||||
AssertFatal(ubwpd->pusch_Config != NULL,"pusch_Config shouldn't be null\n");
|
||||
NR_PUSCH_Config_t *pusch_Config = ubwpd->pusch_Config->choice.setup;
|
||||
const NR_PUSCH_Config_t *pusch_Config = ubwpd? ubwpd->pusch_Config->choice.setup : NULL;
|
||||
|
||||
// Basic sanity check for MCS value to check for a false or erroneous DCI
|
||||
if (dci->mcs > 28) {
|
||||
@@ -776,10 +775,10 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->dfts_ofdm.low_papr_group_number);
|
||||
}
|
||||
else {
|
||||
if (pusch_config_pdu->scid == 0 &&
|
||||
if (pusch_config_pdu->scid == 0 && NR_DMRS_ulconfig &&
|
||||
NR_DMRS_ulconfig->transformPrecodingDisabled->scramblingID0)
|
||||
pusch_config_pdu->ul_dmrs_scrambling_id = *NR_DMRS_ulconfig->transformPrecodingDisabled->scramblingID0;
|
||||
if (pusch_config_pdu->scid == 1 &&
|
||||
if (pusch_config_pdu->scid == 1 && NR_DMRS_ulconfig &&
|
||||
NR_DMRS_ulconfig->transformPrecodingDisabled->scramblingID1)
|
||||
pusch_config_pdu->ul_dmrs_scrambling_id = *NR_DMRS_ulconfig->transformPrecodingDisabled->scramblingID1;
|
||||
}
|
||||
@@ -840,12 +839,14 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
mappingtype, add_pos, dmrslength,
|
||||
pusch_config_pdu->start_symbol_index,
|
||||
mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position);
|
||||
if (mac->ULbwp[ul_bwp_id-1] && (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled)) {
|
||||
if (*dci_format != NR_UL_DCI_FORMAT_0_1)
|
||||
|
||||
if (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
if (*dci_format != NR_UL_DCI_FORMAT_0_1) {
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
}
|
||||
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled))
|
||||
}
|
||||
} else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled)) {
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
}
|
||||
|
||||
// Num PRB Overhead from PUSCH-ServingCellConfig
|
||||
if (mac->cg &&
|
||||
@@ -891,7 +892,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
rnti_types[rnti_type]);
|
||||
|
||||
pusch_config_pdu->ul_dmrs_symb_pos = l_prime_mask;
|
||||
pusch_config_pdu->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
|
||||
uint16_t R = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
|
||||
pusch_config_pdu->target_code_rate = R;
|
||||
pusch_config_pdu->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
|
||||
|
||||
if (pusch_config_pdu->target_code_rate == 0 || pusch_config_pdu->qam_mod_order == 0) {
|
||||
@@ -910,14 +912,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
// Compute TBS
|
||||
pusch_config_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_config_pdu->qam_mod_order,
|
||||
pusch_config_pdu->target_code_rate,
|
||||
R,
|
||||
pusch_config_pdu->rb_size,
|
||||
pusch_config_pdu->nr_of_symbols,
|
||||
nb_dmrs_re_per_rb*number_dmrs_symbols,
|
||||
N_PRB_oh,
|
||||
0, // TBR to verify tb scaling
|
||||
pusch_config_pdu->nrOfLayers)/8;
|
||||
|
||||
pusch_config_pdu->nrOfLayers)>>3;
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1072,9 +1073,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
|
||||
if(mac->cg != NULL){ // we have a cg
|
||||
|
||||
nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
|
||||
nr_schedule_csi_for_im(mac, rx_frame, rx_slot);
|
||||
|
||||
dcireq.module_id = mod_id;
|
||||
dcireq.gNB_index = gNB_index;
|
||||
dcireq.cc_id = cc_id;
|
||||
@@ -1084,10 +1082,14 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
||||
mac->dl_config_request = dcireq.dl_config_req;
|
||||
|
||||
nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
|
||||
nr_schedule_csi_for_im(mac, rx_frame, rx_slot);
|
||||
dcireq.dl_config_req = mac->dl_config_request;
|
||||
|
||||
fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
LOG_D(NR_MAC,"1# scheduled_response transmitted, %d, %d\n", rx_frame, rx_slot);
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
else {
|
||||
// this is for Msg2/Msg4
|
||||
@@ -1098,7 +1100,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
if (mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION)
|
||||
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_0; // msg3 retransmission
|
||||
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , mac->ra.ss->searchSpaceId);
|
||||
fill_dci_search_candidates(mac->ra.ss, rel15);
|
||||
fill_dci_search_candidates(mac->ra.ss, rel15, -1 , -1);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data);
|
||||
@@ -2395,9 +2397,17 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
NR_CSI_IM_Resource_t *imcsi;
|
||||
int period, offset;
|
||||
NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
|
||||
int mu = mac->DLbwp[dl_bwp_id-1] ?
|
||||
mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
|
||||
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
if(dl_bwp_id > 0 && mac->DLbwp[dl_bwp_id-1]) {
|
||||
genericParameters = &mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters;
|
||||
} else {
|
||||
genericParameters = &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
|
||||
}
|
||||
|
||||
int mu = genericParameters->subcarrierSpacing;
|
||||
uint16_t bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
uint16_t bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
for (int id = 0; id < csi_measconfig->csi_IM_ResourceToAddModList->list.count; id++){
|
||||
imcsi = csi_measconfig->csi_IM_ResourceToAddModList->list.array[id];
|
||||
@@ -2405,11 +2415,8 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
if((frame*nr_slots_per_frame[mu]+slot-offset)%period != 0)
|
||||
continue;
|
||||
fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csiim_config_pdu.csiim_config_rel15;
|
||||
const NR_BWP_Downlink_t *dlbwp = mac->DLbwp[dl_bwp_id-1];
|
||||
const int locationAndBandwidth = dlbwp != NULL ? dlbwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth;
|
||||
csiim_config_pdu->bwp_size = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE);
|
||||
csiim_config_pdu->bwp_start = NRRIV2PRBOFFSET(locationAndBandwidth, MAX_BWP_SIZE);
|
||||
csiim_config_pdu->bwp_size = bwp_size;
|
||||
csiim_config_pdu->bwp_start = bwp_start;
|
||||
csiim_config_pdu->subcarrier_spacing = mu;
|
||||
csiim_config_pdu->start_rb = imcsi->freqBand->startingRB;
|
||||
csiim_config_pdu->nr_of_rbs = imcsi->freqBand->nrofRBs;
|
||||
@@ -2431,7 +2438,7 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
AssertFatal(1==0, "Invalid CSI-IM pattern\n");
|
||||
}
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_CSI_IM;
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
dl_config->number_pdus += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2455,9 +2462,17 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
NR_NZP_CSI_RS_Resource_t *nzpcsi;
|
||||
int period, offset;
|
||||
NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
|
||||
int mu = mac->DLbwp[dl_bwp_id-1] ?
|
||||
mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
|
||||
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
if(dl_bwp_id > 0 && mac->DLbwp[dl_bwp_id-1]) {
|
||||
genericParameters = &mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters;
|
||||
} else {
|
||||
genericParameters = &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
|
||||
}
|
||||
|
||||
int mu = genericParameters->subcarrierSpacing;
|
||||
uint16_t bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
uint16_t bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
|
||||
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
|
||||
@@ -2466,17 +2481,23 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
continue;
|
||||
LOG_D(MAC,"Scheduling reception of CSI-RS in frame %d slot %d\n",frame,slot);
|
||||
fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csirs_config_pdu.csirs_config_rel15;
|
||||
|
||||
NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
|
||||
|
||||
const NR_BWP_Downlink_t *dlbwp = mac->DLbwp[dl_bwp_id-1];
|
||||
const int locationAndBandwidth = dlbwp != NULL ? dlbwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth;
|
||||
csirs_config_pdu->bwp_size = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE);
|
||||
csirs_config_pdu->bwp_start = NRRIV2PRBOFFSET(locationAndBandwidth, MAX_BWP_SIZE);
|
||||
csirs_config_pdu->subcarrier_spacing = mu;
|
||||
csirs_config_pdu->start_rb = resourceMapping.freqBand.startingRB;
|
||||
csirs_config_pdu->nr_of_rbs = resourceMapping.freqBand.nrofRBs;
|
||||
csirs_config_pdu->cyclic_prefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0;
|
||||
|
||||
// According to last paragraph of TS 38.214 5.2.2.3.1
|
||||
if (resourceMapping.freqBand.startingRB < bwp_start) {
|
||||
csirs_config_pdu->start_rb = bwp_start;
|
||||
} else {
|
||||
csirs_config_pdu->start_rb = resourceMapping.freqBand.startingRB;
|
||||
}
|
||||
if (resourceMapping.freqBand.nrofRBs > (bwp_start + bwp_size - csirs_config_pdu->start_rb)) {
|
||||
csirs_config_pdu->nr_of_rbs = bwp_start + bwp_size - csirs_config_pdu->start_rb;
|
||||
} else {
|
||||
csirs_config_pdu->nr_of_rbs = resourceMapping.freqBand.nrofRBs;
|
||||
}
|
||||
AssertFatal(csirs_config_pdu->nr_of_rbs >= 24, "CSI-RS has %d RBs, but the minimum is 24\n", csirs_config_pdu->nr_of_rbs);
|
||||
|
||||
csirs_config_pdu->csi_type = 1; // NZP-CSI-RS
|
||||
csirs_config_pdu->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain;
|
||||
if (resourceMapping.firstOFDMSymbolInTimeDomain2)
|
||||
@@ -2487,6 +2508,11 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
&& (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs))
|
||||
csirs_config_pdu->freq_density--;
|
||||
csirs_config_pdu->scramb_id = nzpcsi->scramblingID;
|
||||
csirs_config_pdu->power_control_offset = nzpcsi->powerControlOffset + 8;
|
||||
if (nzpcsi->powerControlOffsetSS)
|
||||
csirs_config_pdu->power_control_offset_ss = *nzpcsi->powerControlOffsetSS;
|
||||
else
|
||||
csirs_config_pdu->power_control_offset_ss = 1; // 0 dB
|
||||
switch(resourceMapping.frequencyDomainAllocation.present){
|
||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1:
|
||||
csirs_config_pdu->row = 1;
|
||||
@@ -2567,7 +2593,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||
AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n");
|
||||
}
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_CSI_RS;
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
dl_config->number_pdus += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2764,7 +2790,7 @@ void nr_ue_sib1_scheduler(module_id_t module_idP,
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1);
|
||||
fill_dci_search_candidates(mac->search_space_zero, rel15);
|
||||
fill_dci_search_candidates(mac->search_space_zero, rel15, -1, -1);
|
||||
|
||||
if(mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern == 1){
|
||||
// same frame as ssb
|
||||
|
||||
@@ -160,7 +160,7 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sche
|
||||
|
||||
}
|
||||
|
||||
void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
void config_common(int Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc;
|
||||
@@ -341,26 +341,22 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
uint16_t sco = absolute_diff%(12*scs_scaling);
|
||||
// values of subcarrier offset larger than the limit only indicates CORESET for Type0-PDCCH CSS set is not present
|
||||
int ssb_SubcarrierOffset_limit = 0;
|
||||
int offset_scaling = 0; //15kHz
|
||||
if(frequency_range == FR1) {
|
||||
ssb_SubcarrierOffset_limit = 24;
|
||||
if (ssb_SubcarrierOffset<ssb_SubcarrierOffset_limit)
|
||||
offset_scaling = cfg->ssb_config.scs_common.value;
|
||||
} else
|
||||
ssb_SubcarrierOffset_limit = 12;
|
||||
if (ssb_SubcarrierOffset<ssb_SubcarrierOffset_limit)
|
||||
AssertFatal(sco==(scs_scaling * ssb_SubcarrierOffset),
|
||||
"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset);
|
||||
|
||||
RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = absolute_diff%(12*scs_scaling);
|
||||
int sco = 31; // no SIB1
|
||||
if(get_softmodem_params()->sa) {
|
||||
sco = RC.nrmac[Mod_idP]->ssb_SubcarrierOffset;
|
||||
if(frequency_range == FR1)
|
||||
sco <<= cfg->ssb_config.scs_common.value; // 38.211 section 7.4.3.1 in FR1 it is expresses in terms of 15kHz SCS
|
||||
}
|
||||
|
||||
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
|
||||
cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell;
|
||||
cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset<<offset_scaling;
|
||||
cfg->ssb_table.ssb_subcarrier_offset.value = sco;
|
||||
cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
@@ -455,24 +451,21 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_S
|
||||
if (rrc_reconfiguration_delay == 0) {
|
||||
return -1;
|
||||
}
|
||||
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
|
||||
if (UE_id < 0) {
|
||||
|
||||
NR_UE_info_t *UE_info = find_nr_UE(&RC.nrmac[Mod_idP]->UE_info,rnti);
|
||||
if (!UE_info) {
|
||||
LOG_W(NR_MAC, "Could not find UE for RNTI 0x%04x\n", rnti);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const uint16_t sf_ahead = 6/(0x01<<subcarrierSpacing) + ((6%(0x01<<subcarrierSpacing))>0);
|
||||
const uint16_t sl_ahead = sf_ahead * (0x01<<subcarrierSpacing);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl;
|
||||
const uint16_t sl_ahead = RC.nrmac[Mod_idP]->if_inst->sl_ahead;
|
||||
sched_ctrl->rrc_processing_timer = (rrc_reconfiguration_delay<<subcarrierSpacing) + sl_ahead;
|
||||
LOG_I(NR_MAC, "Activating RRC processing timer for UE %d with %d ms\n", UE_id, rrc_reconfiguration_delay);
|
||||
LOG_I(NR_MAC, "Activating RRC processing timer for UE %04x with %d ms\n", UE_info->rnti, rrc_reconfiguration_delay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
int sib1_tda,
|
||||
@@ -487,19 +480,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
if (scc != NULL ) {
|
||||
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
|
||||
|
||||
/* dimension UL_tti_req_ahead for number of slots in frame */
|
||||
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
RC.nrmac[Mod_idP]->UL_tti_req_ahead[0] = calloc(n, sizeof(nfapi_nr_ul_tti_request_t));
|
||||
AssertFatal(RC.nrmac[Mod_idP]->UL_tti_req_ahead[0],
|
||||
"could not allocate memory for RC.nrmac[]->UL_tti_req_ahead[]\n");
|
||||
/* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler
|
||||
* consider that scheduler runs sl_ahead: the first sl_ahead slots are
|
||||
* already "in the past" and thus we put frame 1 instead of 0! */
|
||||
for (int i = 0; i < n; ++i) {
|
||||
nfapi_nr_ul_tti_request_t *req = &RC.nrmac[Mod_idP]->UL_tti_req_ahead[0][i];
|
||||
req->SFN = i < (RC.nrmac[Mod_idP]->if_inst->sl_ahead-1);
|
||||
req->Slot = i;
|
||||
}
|
||||
RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL =
|
||||
calloc(n * MAX_BWP_SIZE, sizeof(uint16_t));
|
||||
AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL,
|
||||
@@ -510,7 +491,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP;
|
||||
RC.nrmac[Mod_idP]->xp_pdsch_antenna_ports = pdsch_AntennaPorts.XP;
|
||||
config_common(Mod_idP,
|
||||
ssb_SubcarrierOffset,
|
||||
num_pdsch_antenna_ports,
|
||||
pusch_AntennaPorts,
|
||||
scc);
|
||||
@@ -524,7 +504,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
}
|
||||
}
|
||||
RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = ssb_SubcarrierOffset;
|
||||
RC.nrmac[Mod_idP]->minRXTXTIMEpdsch = minRXTXTIMEpdsch;
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
@@ -551,9 +530,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].frame_type == FDD,"Dynamic TDD not handled yet\n");
|
||||
|
||||
for (int slot = 0; slot < n; ++slot) {
|
||||
if (RC.nrmac[Mod_idP]->common_channels[0].frame_type == FDD ||
|
||||
(slot != 0))
|
||||
RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dl_slots) << (slot % 64);
|
||||
RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dl_slots) << (slot % 64);
|
||||
RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64);
|
||||
|
||||
LOG_I(NR_MAC, "In %s: slot %d DL %d UL %d\n",
|
||||
@@ -591,37 +568,15 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
|
||||
if (CellGroup) {
|
||||
|
||||
if (get_softmodem_params()->sa) {
|
||||
calculate_preferred_dl_tda(Mod_idP, NULL);
|
||||
}
|
||||
|
||||
const NR_ServingCellConfig_t *servingCellConfig = NULL;
|
||||
if(CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) {
|
||||
servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated;
|
||||
const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList;
|
||||
if(bwpList) {
|
||||
AssertFatal(bwpList->list.count > 0, "downlinkBWP_ToAddModList has no BWPs!\n");
|
||||
for (int i = 0; i < bwpList->list.count; ++i) {
|
||||
const NR_BWP_Downlink_t *bwp = bwpList->list.array[i];
|
||||
calculate_preferred_dl_tda(Mod_idP, bwp);
|
||||
}
|
||||
}
|
||||
|
||||
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList;
|
||||
if(ubwpList) {
|
||||
AssertFatal(ubwpList->list.count > 0, "uplinkBWP_ToAddModList no BWPs!\n");
|
||||
for (int i = 0; i < ubwpList->list.count; ++i) {
|
||||
const NR_BWP_Uplink_t *ubwp = ubwpList->list.array[i];
|
||||
calculate_preferred_ul_tda(Mod_idP, ubwp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
if (add_ue == 1 && get_softmodem_params()->phy_test) {
|
||||
const int UE_id = add_new_nr_ue(Mod_idP, rnti, CellGroup);
|
||||
LOG_I(NR_MAC,"Added new UE_id %d/%x with initial CellGroup\n",UE_id,rnti);
|
||||
process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
|
||||
NR_UE_info_t* UE = add_new_nr_ue(RC.nrmac[Mod_idP], rnti, CellGroup);
|
||||
if (UE) {
|
||||
LOG_I(NR_MAC,"Added new UE %x with initial CellGroup\n", rnti);
|
||||
} else {
|
||||
LOG_E(NR_MAC,"Error adding UE %04x\n", rnti);
|
||||
return -1;
|
||||
}
|
||||
process_CellGroup(CellGroup,&UE->UE_sched_ctrl);
|
||||
} else if (add_ue == 1 && !get_softmodem_params()->phy_test) {
|
||||
const int CC_id = 0;
|
||||
NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id];
|
||||
@@ -667,49 +622,30 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
ra->msg3_dcch_dtch = false;
|
||||
LOG_I(NR_MAC,"Added new RA process for UE RNTI %04x with initial CellGroup\n", rnti);
|
||||
} else { // CellGroup has been updated
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon;
|
||||
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
|
||||
int target_ss;
|
||||
UE_info->CellGroup[UE_id] = CellGroup;
|
||||
LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti);
|
||||
process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
|
||||
if (get_softmodem_params()->sa) {
|
||||
// add all available DL HARQ processes for this UE in SA
|
||||
create_dl_harq_list(sched_ctrl, pdsch);
|
||||
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[Mod_idP]->UE_info, rnti);
|
||||
if (!UE) {
|
||||
LOG_E(NR_MAC, "Can't find UE %04x\n", rnti);
|
||||
return -1;
|
||||
}
|
||||
// update coreset/searchspace
|
||||
void *bwpd = NULL;
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
target_ss = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
if ((sched_ctrl->active_bwp)) {
|
||||
target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
bwpd = (void*)sched_ctrl->active_bwp->bwp_Dedicated;
|
||||
genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters;
|
||||
|
||||
/* copy CellGroup by calling asn1c encode
|
||||
this is a temporary hack to avoid the gNB having
|
||||
a pointer to RRC CellGroup structure
|
||||
(otherwise it would be applied to early)
|
||||
TODO remove once we have a proper implementation */
|
||||
UE->enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *) CellGroup,
|
||||
UE->cg_buf,
|
||||
32768);
|
||||
|
||||
if (UE->enc_rval.encoded == -1) {
|
||||
LOG_E(NR_MAC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
UE->enc_rval.failed_type->name, UE->enc_rval.encoded);
|
||||
exit(1);
|
||||
}
|
||||
else if (CellGroup->spCellConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
(CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) {
|
||||
target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP;
|
||||
genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
}
|
||||
sched_ctrl->search_space = get_searchspace(sib1 ? sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, scc, bwpd, target_ss);
|
||||
sched_ctrl->coreset = get_coreset(Mod_idP, scc, bwpd, sched_ctrl->search_space, target_ss);
|
||||
sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[Mod_idP],
|
||||
sched_ctrl->search_space,
|
||||
sched_ctrl->coreset,
|
||||
scc,
|
||||
genericParameters,
|
||||
RC.nrmac[Mod_idP]->type0_PDCCH_CSS_config);
|
||||
sched_ctrl->maxL = 2;
|
||||
if (CellGroup->spCellConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup
|
||||
)
|
||||
compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP);
|
||||
|
||||
process_CellGroup(CellGroup,&UE->UE_sched_ctrl);
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -68,6 +68,8 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
NR_ServingCellConfigCommon_t *scc = gNB->common_channels->ServingCellConfigCommon;
|
||||
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
|
||||
UL_tti_req_ahead_initialization(gNB, scc, num_slots, CC_idP);
|
||||
|
||||
nfapi_nr_dl_tti_request_t *DL_req = &gNB->DL_req[0];
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t **pdcch = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t **)gNB->pdcch_pdu_idx[CC_idP];
|
||||
nfapi_nr_ul_tti_request_t *future_ul_tti_req =
|
||||
@@ -104,167 +106,6 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
TX_req[CC_idP].Number_of_PDUs = 0;
|
||||
|
||||
}
|
||||
/*
|
||||
void check_nr_ul_failure(module_id_t module_idP,
|
||||
int CC_id,
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP) {
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
||||
nfapi_nr_dl_dci_request_t *DL_req = &RC.nrmac[module_idP]->DL_req[0];
|
||||
uint16_t rnti = UE_RNTI(module_idP, UE_id);
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
|
||||
// check uplink failure
|
||||
if ((UE_info->UE_sched_ctrl[UE_id].ul_failure_timer > 0) &&
|
||||
(UE_info->UE_sched_ctrl[UE_id].ul_out_of_sync == 0)) {
|
||||
LOG_I(MAC, "UE %d rnti %x: UL Failure timer %d \n", UE_id, rnti,
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure_timer);
|
||||
if (UE_info->UE_sched_ctrl[UE_id].ra_pdcch_order_sent == 0) {
|
||||
UE_info->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 1;
|
||||
|
||||
// add a format 1A dci for this UE to request an RA procedure (only one UE per subframe)
|
||||
nfapi_nr_dl_dci_request_pdu_t *dl_config_pdu = &DL_req[CC_id].dl_tti_request_body.dl_config_pdu_list[DL_req[CC_id].dl_tti_request_body.number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_dci_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_DCI_REQUEST_DCI_DL_PDU_REL8_TAG;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP, CC_id),
|
||||
UE_info->UE_sched_ctrl[UE_id].
|
||||
dl_cqi[CC_id], format1A);
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
|
||||
|
||||
AssertFatal((cc[CC_id].mib->message.dl_Bandwidth >= 0) && (cc[CC_id].mib->message.dl_Bandwidth < 6),
|
||||
"illegal dl_Bandwidth %d\n",
|
||||
(int) cc[CC_id].mib->message.dl_Bandwidth);
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = nr_pdcch_order_table[cc[CC_id].mib->message.dl_Bandwidth];
|
||||
DL_req[CC_id].dl_tti_request_body.number_dci++;
|
||||
DL_req[CC_id].dl_tti_request_body.number_pdu++;
|
||||
DL_req[CC_id].dl_tti_request_body.tl.tag = NFAPI_DL_TTI_REQUEST_BODY_TAG;
|
||||
LOG_I(MAC,
|
||||
"UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",
|
||||
UE_id, rnti,
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure_timer,
|
||||
dl_config_pdu->dci_dl_pdu.
|
||||
dci_dl_pdu_rel8.resource_block_coding);
|
||||
} else { // ra_pdcch_sent==1
|
||||
LOG_I(MAC,
|
||||
"UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",
|
||||
UE_id, rnti,
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure_timer);
|
||||
if ((UE_info->UE_sched_ctrl[UE_id].ul_failure_timer % 40) == 0) UE_info->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 0; // resend every 4 frames
|
||||
}
|
||||
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure_timer++;
|
||||
// check threshold
|
||||
if (UE_info->UE_sched_ctrl[UE_id].ul_failure_timer > 20000) {
|
||||
// inform RRC of failure and clear timer
|
||||
LOG_I(MAC,
|
||||
"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
|
||||
UE_id, rnti);
|
||||
mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_out_of_sync = 1;
|
||||
|
||||
//Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
|
||||
if (rrc_agent_registered[module_idP]) {
|
||||
LOG_W(MAC, "notify flexran Agent of UE state change\n");
|
||||
agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
|
||||
rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
|
||||
}
|
||||
}
|
||||
} // ul_failure_timer>0
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
{
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_UE_info_t *UE_info = &gNB->UE_info;
|
||||
nfapi_ul_config_request_body_t *ul_req;
|
||||
int CC_id, UE_id;
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon;
|
||||
struct SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated;
|
||||
uint8_t TSFC;
|
||||
uint16_t deltaTSFC; // bitmap
|
||||
uint8_t srs_SubframeConfig;
|
||||
|
||||
// table for TSFC (Period) and deltaSFC (offset)
|
||||
const uint16_t deltaTSFCTabType1[15][2] = { {1, 1}, {1, 2}, {2, 2}, {1, 5}, {2, 5}, {4, 5}, {8, 5}, {3, 5}, {12, 5}, {1, 10}, {2, 10}, {4, 10}, {8, 10}, {351, 10}, {383, 10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD
|
||||
const uint16_t deltaTSFCTabType2[14][2] = { {2, 5}, {6, 5}, {10, 5}, {18, 5}, {14, 5}, {22, 5}, {26, 5}, {30, 5}, {70, 10}, {74, 10}, {194, 10}, {326, 10}, {586, 10}, {210, 10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD
|
||||
|
||||
uint16_t srsPeriodicity, srsOffset;
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
soundingRS_UL_ConfigCommon = &cc[CC_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon;
|
||||
// check if SRS is enabled in this frame/subframe
|
||||
if (soundingRS_UL_ConfigCommon) {
|
||||
srs_SubframeConfig = soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
|
||||
if (cc[CC_id].tdd_Config == NULL) { // FDD
|
||||
deltaTSFC = deltaTSFCTabType1[srs_SubframeConfig][0];
|
||||
TSFC = deltaTSFCTabType1[srs_SubframeConfig][1];
|
||||
} else { // TDD
|
||||
deltaTSFC = deltaTSFCTabType2[srs_SubframeConfig][0];
|
||||
TSFC = deltaTSFCTabType2[srs_SubframeConfig][1];
|
||||
}
|
||||
// Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC
|
||||
uint16_t tmp = (subframeP % TSFC);
|
||||
|
||||
if ((1 << tmp) & deltaTSFC) {
|
||||
// This is an SRS subframe, loop over UEs
|
||||
for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) {
|
||||
if (!RC.nrmac[module_idP]->UE_info.active[UE_id]) continue;
|
||||
ul_req = &RC.nrmac[module_idP]->UL_req[CC_id].ul_config_request_body;
|
||||
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
|
||||
if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
|
||||
|
||||
AssertFatal(UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
|
||||
"physicalConfigDedicated is null for UE %d\n",
|
||||
UE_id);
|
||||
|
||||
if ((soundingRS_UL_ConfigDedicated = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) {
|
||||
if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
get_srs_pos(&cc[CC_id],
|
||||
soundingRS_UL_ConfigDedicated->choice.
|
||||
setup.srs_ConfigIndex,
|
||||
&srsPeriodicity, &srsOffset);
|
||||
if (((10 * frameP + subframeP) % srsPeriodicity) == srsOffset) {
|
||||
// Program SRS
|
||||
ul_req->srs_present = 1;
|
||||
nfapi_ul_config_request_pdu_t * ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
|
||||
memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
|
||||
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
|
||||
ul_config_pdu->pdu_size = 2 + (uint8_t) (2 + sizeof(nfapi_ul_config_srs_pdu));
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.size = (uint8_t)sizeof(nfapi_ul_config_srs_pdu);
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.rnti = UE_info->UE_template[CC_id][UE_id].rnti;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_bandwidth = soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.frequency_domain_position = soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth = soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.transmission_comb = soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.i_srs = soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
|
||||
ul_config_pdu->srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; // ul_config_pdu->srs_pdu.srs_pdu_rel10.antenna_port = ;//
|
||||
// ul_config_pdu->srs_pdu.srs_pdu_rel13.number_of_combs = ;//
|
||||
RC.nrmac[module_idP]->UL_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
|
||||
RC.nrmac[module_idP]->UL_req[CC_id].header.message_id = NFAPI_UL_CONFIG_REQUEST;
|
||||
ul_req->number_of_pdus++;
|
||||
} // if (((10*frameP+subframeP) % srsPeriodicity) == srsOffset)
|
||||
} // if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup)
|
||||
} // if ((soundingRS_UL_ConfigDedicated = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL)
|
||||
} // for (UE_id ...
|
||||
} // if((1<<tmp) & deltaTSFC)
|
||||
|
||||
} // SRS config
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) {
|
||||
if (slot>=64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed)
|
||||
@@ -278,8 +119,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
protocol_ctxt_t ctxt={0};
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
|
||||
|
||||
char stats_output[16384];
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
@@ -307,8 +146,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAX_NUM_CORESET; i++)
|
||||
RC.nrmac[module_idP]->pdcch_cand[i] = 0;
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
//mbsfn_status[CC_id] = 0;
|
||||
|
||||
@@ -341,9 +178,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
|
||||
if ((slot == 0) && (frame & 127) == 0) {
|
||||
stats_output[0]='\0';
|
||||
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384,true);
|
||||
LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output);
|
||||
char stats_output[16384];
|
||||
stats_output[0] = '\0';
|
||||
dump_mac_stats(RC.nrmac[module_idP], stats_output, sizeof(stats_output), true);
|
||||
LOG_I(NR_MAC, "Frame.Slot %d.%d\n%s\n", frame, slot, stats_output);
|
||||
}
|
||||
|
||||
nr_mac_update_timers(module_idP, frame, slot);
|
||||
@@ -372,7 +210,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
schedule_nr_prach(module_idP, f, s);
|
||||
}
|
||||
|
||||
|
||||
// Schedule CSI-RS transmission
|
||||
nr_csirs_scheduling(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]);
|
||||
|
||||
@@ -398,10 +235,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
nr_schedule_ue_spec(module_idP, frame, slot);
|
||||
stop_meas(&gNB->schedule_dlsch);
|
||||
|
||||
nr_schedule_pucch(module_idP, frame, slot);
|
||||
nr_schedule_pucch(RC.nrmac[module_idP], frame, slot);
|
||||
|
||||
// This schedule SR after PUCCH for multiplexing
|
||||
nr_sr_reporting(module_idP, frame, slot);
|
||||
nr_sr_reporting(RC.nrmac[module_idP], frame, slot);
|
||||
|
||||
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
|
||||
|
||||
@@ -465,27 +465,24 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
|
||||
|
||||
int FR = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257 ? nr_FR2 : nr_FR1;
|
||||
|
||||
uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu];
|
||||
*msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot
|
||||
*msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024;
|
||||
uint8_t start_next_period = rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot;
|
||||
int eff_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot
|
||||
// we can't schedule msg2 before sl_ahead since prach
|
||||
int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu];
|
||||
while ((eff_slot-rach_slot)<=sl_ahead) {
|
||||
*msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu];
|
||||
*msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024;
|
||||
eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu];
|
||||
eff_slot += tdd_period_slot;
|
||||
}
|
||||
if (FR==nr_FR2) {
|
||||
int num_tdd_period = *msg2_slot/tdd_period_slot;
|
||||
int num_tdd_period = (eff_slot%nr_slots_per_frame[mu])/tdd_period_slot;
|
||||
while((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=beam_index)) {
|
||||
*msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu];
|
||||
*msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024;
|
||||
num_tdd_period = *msg2_slot/tdd_period_slot;
|
||||
eff_slot += tdd_period_slot;
|
||||
num_tdd_period = (eff_slot % nr_slots_per_frame[mu])/tdd_period_slot;
|
||||
}
|
||||
if(tdd_beam_association[num_tdd_period] == -1)
|
||||
tdd_beam_association[num_tdd_period] = beam_index;
|
||||
}
|
||||
|
||||
*msg2_frame=(rach_frame + eff_slot/nr_slots_per_frame[mu])%1024;
|
||||
*msg2_slot=eff_slot%nr_slots_per_frame[mu];
|
||||
// go to previous slot if the current scheduled slot is beyond the response window
|
||||
// and if the slot is not among the PDCCH monitored ones (38.213 10.1)
|
||||
while (*msg2_frame > frame_limit
|
||||
@@ -540,164 +537,164 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
}
|
||||
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
|
||||
NR_RA_t *ra = &cc->ra[i];
|
||||
pr_found = 0;
|
||||
const int UE_id = find_nr_UE_id(module_idP, ra->rnti);
|
||||
if (UE_id != -1) {
|
||||
if (ra->state != RA_IDLE)
|
||||
continue;
|
||||
|
||||
pr_found = 0;
|
||||
|
||||
for(int j = 0; j < ra->preambles.num_preambles; j++) {
|
||||
//check if the preamble received correspond to one of the listed or configured preambles
|
||||
if (preamble_index == ra->preambles.preamble_list[j]) {
|
||||
if (ra->rnti == 0 && get_softmodem_params()->nsa)
|
||||
continue;
|
||||
pr_found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ra->state == RA_IDLE) {
|
||||
for(int j = 0; j < ra->preambles.num_preambles; j++) {
|
||||
//check if the preamble received correspond to one of the listed or configured preambles
|
||||
if (preamble_index == ra->preambles.preamble_list[j]) {
|
||||
if (ra->rnti == 0 && get_softmodem_params()->nsa)
|
||||
continue;
|
||||
pr_found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pr_found == 0) {
|
||||
continue;
|
||||
if (pr_found == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t ra_rnti;
|
||||
|
||||
// ra_rnti from 5.1.3 in 38.321
|
||||
// FK: in case of long PRACH the phone seems to expect the subframe number instead of the slot number here.
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present
|
||||
== NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839)
|
||||
ra_rnti = 1 + symbol + (9 /*slotP*/ * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8);
|
||||
else
|
||||
ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8);
|
||||
|
||||
// This should be handled differently when we use the initialBWP for RA
|
||||
ra->dl_bwp_id = 0;//TODO
|
||||
ra->ul_bwp_id = 0;
|
||||
NR_BWP_Downlink_t *bwp=NULL;
|
||||
if (ra->CellGroup && ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig->spCellConfigDedicated) {
|
||||
if (ra->CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
|
||||
ra->dl_bwp_id = *ra->CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id;
|
||||
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->dl_bwp_id - 1];
|
||||
}
|
||||
if (ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)
|
||||
ra->ul_bwp_id = *ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id;
|
||||
}
|
||||
|
||||
uint16_t ra_rnti;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
|
||||
|
||||
// ra_rnti from 5.1.3 in 38.321
|
||||
// FK: in case of long PRACH the phone seems to expect the subframe number instead of the slot number here.
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present
|
||||
== NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839)
|
||||
ra_rnti = 1 + symbol + (9 /*slotP*/ * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8);
|
||||
else
|
||||
ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8);
|
||||
LOG_D(NR_MAC,
|
||||
"[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
slotP,
|
||||
preamble_index);
|
||||
|
||||
// This should be handled differently when we use the initialBWP for RA
|
||||
ra->dl_bwp_id = 0;//TODO
|
||||
ra->ul_bwp_id = 0;
|
||||
NR_BWP_Downlink_t *bwp=NULL;
|
||||
if (ra->CellGroup && ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig->spCellConfigDedicated) {
|
||||
if (ra->CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
|
||||
ra->dl_bwp_id = *ra->CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id;
|
||||
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->dl_bwp_id - 1];
|
||||
}
|
||||
if (ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)
|
||||
ra->ul_bwp_id = *ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id;
|
||||
}
|
||||
uint8_t beam_index = ssb_index_from_prach(module_idP, frameP, slotP, preamble_index, freq_index, symbol);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n",
|
||||
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
|
||||
if (ra->cfra) {
|
||||
// if the preamble received correspond to one of the listed
|
||||
if (!(preamble_index == ra->preambles.preamble_list[beam_index])) {
|
||||
LOG_E(
|
||||
NR_MAC,
|
||||
"[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
slotP,
|
||||
preamble_index);
|
||||
|
||||
uint8_t beam_index = ssb_index_from_prach(module_idP, frameP, slotP, preamble_index, freq_index, symbol);
|
||||
|
||||
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
|
||||
if (ra->cfra) {
|
||||
// if the preamble received correspond to one of the listed
|
||||
if (!(preamble_index == ra->preambles.preamble_list[beam_index])) {
|
||||
LOG_E(
|
||||
NR_MAC,
|
||||
"[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
|
||||
module_idP,
|
||||
preamble_index);
|
||||
continue; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
||||
}
|
||||
continue; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
||||
}
|
||||
LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP);
|
||||
ra->state = Msg2;
|
||||
ra->timing_offset = timing_offset;
|
||||
ra->preamble_slot = slotP;
|
||||
|
||||
NR_SearchSpaceId_t ra_SearchSpace = 0;
|
||||
struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = NULL;
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
if(bwp) {
|
||||
commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
|
||||
ra_SearchSpace = *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
|
||||
genericParameters = &bwp->bwp_Common->genericParameters;
|
||||
} else {
|
||||
commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
|
||||
ra_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
|
||||
genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
}
|
||||
AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n");
|
||||
|
||||
// Common SearchSpace list
|
||||
for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
|
||||
ss = commonSearchSpaceList->list.array[i];
|
||||
if (ss->searchSpaceId == ra_SearchSpace)
|
||||
ra->ra_ss = ss;
|
||||
}
|
||||
|
||||
AssertFatal(ra->ra_ss!=NULL,"SearchSpace cannot be null for RA\n");
|
||||
|
||||
ra->coreset = get_coreset(module_idP, scc, bwp, ra->ra_ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
ra->sched_pdcch = set_pdcch_structure(nr_mac,
|
||||
ra->ra_ss,
|
||||
ra->coreset,
|
||||
scc,
|
||||
genericParameters,
|
||||
&nr_mac->type0_PDCCH_CSS_config[ra->beam_id]);
|
||||
|
||||
// retrieving ra pdcch monitoring period and offset
|
||||
find_monitoring_periodicity_offset_common(ra->ra_ss, &monitoring_slot_period, &monitoring_offset);
|
||||
|
||||
nr_schedule_msg2(frameP,
|
||||
slotP,
|
||||
&msg2_frame,
|
||||
&msg2_slot,
|
||||
scc,
|
||||
frame_type,
|
||||
monitoring_slot_period,
|
||||
monitoring_offset,
|
||||
beam_index,
|
||||
cc->num_active_ssb,
|
||||
nr_mac->tdd_beam_association,
|
||||
nr_mac->if_inst->sl_ahead);
|
||||
|
||||
ra->Msg2_frame = msg2_frame;
|
||||
ra->Msg2_slot = msg2_slot;
|
||||
|
||||
LOG_D(NR_MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP);
|
||||
|
||||
int loop = 0;
|
||||
if (ra->rnti == 0) { // This condition allows for the usage of a preconfigured rnti for the CFRA
|
||||
do {
|
||||
ra->rnti = (taus() % 65518) + 1;
|
||||
loop++;
|
||||
} while (loop != 100
|
||||
&& !((find_nr_UE_id(module_idP, ra->rnti) == -1) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1)
|
||||
&& ra->rnti >= 1 && ra->rnti <= 65519));
|
||||
if (loop == 100) {
|
||||
LOG_E(NR_MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
ra->RA_rnti = ra_rnti;
|
||||
ra->preamble_index = preamble_index;
|
||||
ra->beam_id = beam_index;
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB "
|
||||
"index %u RA index %d\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
ra->Msg2_frame,
|
||||
ra->Msg2_slot,
|
||||
ra->RA_rnti,
|
||||
cc->ssb_index[beam_index],
|
||||
i);
|
||||
|
||||
return;
|
||||
}
|
||||
LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP);
|
||||
ra->state = Msg2;
|
||||
ra->timing_offset = timing_offset;
|
||||
ra->preamble_slot = slotP;
|
||||
|
||||
NR_SearchSpaceId_t ra_SearchSpace = 0;
|
||||
struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = NULL;
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
if(bwp) {
|
||||
commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
|
||||
ra_SearchSpace = *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
|
||||
genericParameters = &bwp->bwp_Common->genericParameters;
|
||||
} else {
|
||||
commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
|
||||
ra_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
|
||||
genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
}
|
||||
AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n");
|
||||
|
||||
// Common SearchSpace list
|
||||
for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
|
||||
ss = commonSearchSpaceList->list.array[i];
|
||||
if (ss->searchSpaceId == ra_SearchSpace)
|
||||
ra->ra_ss = ss;
|
||||
}
|
||||
|
||||
AssertFatal(ra->ra_ss!=NULL,"SearchSpace cannot be null for RA\n");
|
||||
|
||||
ra->coreset = get_coreset(nr_mac, scc, bwp, ra->ra_ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
ra->sched_pdcch = set_pdcch_structure(nr_mac,
|
||||
ra->ra_ss,
|
||||
ra->coreset,
|
||||
scc,
|
||||
genericParameters,
|
||||
&nr_mac->type0_PDCCH_CSS_config[ra->beam_id]);
|
||||
|
||||
// retrieving ra pdcch monitoring period and offset
|
||||
find_monitoring_periodicity_offset_common(ra->ra_ss, &monitoring_slot_period, &monitoring_offset);
|
||||
|
||||
nr_schedule_msg2(frameP,
|
||||
slotP,
|
||||
&msg2_frame,
|
||||
&msg2_slot,
|
||||
scc,
|
||||
frame_type,
|
||||
monitoring_slot_period,
|
||||
monitoring_offset,
|
||||
beam_index,
|
||||
cc->num_active_ssb,
|
||||
nr_mac->tdd_beam_association,
|
||||
nr_mac->if_inst->sl_ahead);
|
||||
|
||||
ra->Msg2_frame = msg2_frame;
|
||||
ra->Msg2_slot = msg2_slot;
|
||||
|
||||
LOG_D(NR_MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP);
|
||||
|
||||
int loop = 0;
|
||||
if (ra->rnti == 0) { // This condition allows for the usage of a preconfigured rnti for the CFRA
|
||||
do {
|
||||
ra->rnti = (taus() % 65518) + 1;
|
||||
loop++;
|
||||
} while (loop != 100
|
||||
&& !((find_nr_UE(&nr_mac->UE_info, ra->rnti) == NULL) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1)
|
||||
&& ra->rnti >= 1 && ra->rnti <= 65519));
|
||||
if (loop == 100) {
|
||||
LOG_E(NR_MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
ra->RA_rnti = ra_rnti;
|
||||
ra->preamble_index = preamble_index;
|
||||
ra->beam_id = beam_index;
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB, new rnti %04x "
|
||||
"index %u RA index %d\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
ra->Msg2_frame,
|
||||
ra->Msg2_slot,
|
||||
ra->RA_rnti,
|
||||
ra->rnti,
|
||||
cc->ssb_index[beam_index],
|
||||
i);
|
||||
|
||||
return;
|
||||
}
|
||||
LOG_E(NR_MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index);
|
||||
|
||||
@@ -787,8 +784,9 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
|
||||
uint16_t *vrb_map_UL = &RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
|
||||
int BWPStart = nr_mac->type0_PDCCH_CSS_config[ra->beam_id].cset_start_rb;
|
||||
int BWPSize = nr_mac->type0_PDCCH_CSS_config[ra->beam_id].num_rbs;
|
||||
const int BWPSize = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const int BWPStart = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
int rbStart = 0;
|
||||
for (int i = 0; (i < ra->msg3_nb_rb) && (rbStart <= (BWPSize - ra->msg3_nb_rb)); i++) {
|
||||
if (vrb_map_UL[rbStart + BWPStart + i]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols)) {
|
||||
@@ -1109,10 +1107,11 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
int TBS = 0;
|
||||
while(TBS<7) { // TBS for msg3 is 7 bytes (except for RRCResumeRequest1 currently not implemented)
|
||||
mcsindex++;
|
||||
pusch_pdu->target_code_rate = nr_get_code_rate_ul(mcsindex,pusch_pdu->mcs_table);
|
||||
int R = nr_get_code_rate_ul(mcsindex,pusch_pdu->mcs_table);
|
||||
pusch_pdu->target_code_rate = R;
|
||||
pusch_pdu->qam_mod_order = nr_get_Qm_ul(mcsindex,pusch_pdu->mcs_table);
|
||||
TBS = nr_compute_tbs(pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->target_code_rate,
|
||||
R,
|
||||
pusch_pdu->rb_size,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
num_dmrs_symb*12, // nb dmrs set for no data in dmrs symbol
|
||||
@@ -1200,20 +1199,13 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
nr_fill_rar(module_idP, ra, RAR_pdu, pusch_pdu);
|
||||
}
|
||||
|
||||
void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra)
|
||||
{
|
||||
void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra) {
|
||||
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
|
||||
|
||||
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
|
||||
|
||||
//TODO time domain assignment for msg2 needs to be improved
|
||||
uint8_t time_domain_assignment;
|
||||
if(cc->frame_type == TDD)
|
||||
time_domain_assignment = 1;
|
||||
else
|
||||
time_domain_assignment = 0;
|
||||
int mcsIndex = -1; // initialization value
|
||||
int rbStart = 0;
|
||||
int rbSize = 8;
|
||||
@@ -1253,6 +1245,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
}
|
||||
|
||||
// Calculate number of symbols
|
||||
int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP);
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
@@ -1331,7 +1324,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_req->nPDUs+=1;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
LOG_D(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n",
|
||||
LOG_A(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n",
|
||||
module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state,pdcch_pdu_rel15->CoreSetType);
|
||||
|
||||
// SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control
|
||||
@@ -1392,7 +1385,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype, 1);
|
||||
mappingtype,
|
||||
1);
|
||||
|
||||
uint8_t tb_scaling = 0;
|
||||
int R, Qm;
|
||||
@@ -1525,7 +1519,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
}
|
||||
|
||||
ra->state = WAIT_Msg3;
|
||||
LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
|
||||
LOG_W(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: rnti %04x RA state %d\n", module_idP, frameP, slotP, ra->rnti, ra->state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1568,9 +1562,14 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
ra->rnti = ra->crnti;
|
||||
}
|
||||
|
||||
int UE_id = find_nr_UE_id(module_idP, ra->rnti);
|
||||
NR_UE_info_t *UE_info = &nr_mac->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_info_t * UE = find_nr_UE(&nr_mac->UE_info, ra->rnti);
|
||||
if (!UE) {
|
||||
LOG_E(NR_MAC,"want to generate Msg4, but rnti %04x not in the table\n", ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_I(NR_MAC,"Generate msg4, rnti: %04x\n", ra->rnti);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
NR_BWP_t *genericParameters = bwp ? & bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
@@ -1603,7 +1602,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
// Remove UE associated to TC-RNTI
|
||||
if(harq->round==0 && ra->msg3_dcch_dtch) {
|
||||
mac_remove_nr_ue(module_idP, tc_rnti);
|
||||
mac_remove_nr_ue(nr_mac, tc_rnti);
|
||||
}
|
||||
|
||||
// get CCEindex, needed also for PUCCH and then later for PDCCH
|
||||
@@ -1634,7 +1633,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
LOG_D(NR_MAC,"[RAPROC] Msg4 r_pucch %d (CCEIndex %d, nb_of_candidates %d, delta_PRI %d)\n", r_pucch, CCEIndex, nr_of_candidates, delta_PRI);
|
||||
|
||||
int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP, r_pucch, 1);
|
||||
int alloc = nr_acknack_scheduling(module_idP, UE, frameP, slotP, r_pucch, 1);
|
||||
AssertFatal(alloc>=0,"Couldn't find a pucch allocation for ack nack (msg4)\n");
|
||||
NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[alloc];
|
||||
harq->feedback_slot = pucch->ul_slot;
|
||||
@@ -1684,7 +1683,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype, 1);
|
||||
mappingtype,
|
||||
1);
|
||||
|
||||
uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos);
|
||||
|
||||
@@ -1785,7 +1785,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_req->nPDUs+=1;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
LOG_D(NR_MAC, "[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state);
|
||||
LOG_A(NR_MAC, "[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state);
|
||||
|
||||
// SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control
|
||||
// information to data and is reset every slot.
|
||||
@@ -1799,7 +1799,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = genericParameters->subcarrierSpacing;
|
||||
pdsch_pdu_rel15->CyclicPrefix = 0;
|
||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx);
|
||||
int R = nr_get_code_rate_dl(mcsIndex,mcsTableIdx);
|
||||
pdsch_pdu_rel15->targetCodeRate[0] = R;
|
||||
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
||||
pdsch_pdu_rel15->mcsIndex[0] = mcsIndex;
|
||||
pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx;
|
||||
@@ -1949,10 +1950,10 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
if(ra->msg3_dcch_dtch) {
|
||||
// If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful upon transmission of PDCCH
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CBRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
LOG_A(NR_MAC, "(ue rnti 0x%04x) CBRA procedure succeeded!\n", ra->rnti);
|
||||
nr_clear_ra_proc(module_idP, CC_id, frameP, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
UE_info->Msg4_ACKed[UE_id] = true;
|
||||
UE->Msg3_dcch_dtch = true;
|
||||
UE->Msg4_ACKed = true;
|
||||
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
harq->feedback_slot = -1;
|
||||
@@ -1960,6 +1961,24 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
add_tail_nr_list(&sched_ctrl->available_dl_harq, current_harq_pid);
|
||||
harq->round = 0;
|
||||
harq->ndi ^= 1;
|
||||
|
||||
// Pause scheduling according to:
|
||||
// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
|
||||
const NR_COMMON_channels_t *common_channels = &RC.nrmac[module_idP]->common_channels[0];
|
||||
const NR_SIB1_t *sib1 = common_channels->sib1 ? common_channels->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL;
|
||||
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp,
|
||||
common_channels->ServingCellConfigCommon,
|
||||
sib1);
|
||||
uint32_t delay_ms = servingCellConfig && servingCellConfig->downlinkBWP_ToAddModList ?
|
||||
NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS;
|
||||
|
||||
sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing);
|
||||
LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frameP, slotP, UE->rnti, delay_ms);
|
||||
|
||||
// Reset uplink failure flags/counters/timers at MAC so gNB will resume again scheduling resources for this UE
|
||||
UE->UE_sched_ctrl.pusch_consecutive_dtx_cnt = 0;
|
||||
UE->UE_sched_ctrl.ul_failure = 0;
|
||||
} else {
|
||||
ra->state = WAIT_Msg4_ACK;
|
||||
LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
|
||||
@@ -1969,28 +1988,27 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra) {
|
||||
|
||||
int UE_id = find_nr_UE_id(module_id, ra->rnti);
|
||||
NR_UE_info_t * UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, ra->rnti);
|
||||
const int current_harq_pid = ra->harq_pid;
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
|
||||
LOG_D(NR_MAC, "ue %d, rnti 0x%04x, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
|
||||
LOG_D(NR_MAC, "ue rnti 0x%04x, harq is waiting %d, round %d, frame %d %d, harq id %d\n", ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
|
||||
|
||||
if (harq->is_waiting == 0) {
|
||||
if (harq->round == 0) {
|
||||
if (stats->dlsch_errors == 0) {
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
UE_info->active[UE_id] = true;
|
||||
UE_info->Msg4_ACKed[UE_id] = true;
|
||||
|
||||
if (stats->dl.errors == 0) {
|
||||
LOG_A(NR_MAC, "(UE RNTI 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", ra->rnti);
|
||||
UE->Msg4_ACKed = true;
|
||||
|
||||
// Pause scheduling according to:
|
||||
// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
|
||||
const NR_COMMON_channels_t *common_channels = &RC.nrmac[module_id]->common_channels[0];
|
||||
const NR_SIB1_t *sib1 = common_channels->sib1 ? common_channels->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
const NR_ServingCellConfig_t *servingCellConfig = UE_info->CellGroup[UE_id] ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated : NULL;
|
||||
const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL;
|
||||
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp,
|
||||
common_channels->ServingCellConfigCommon,
|
||||
sib1);
|
||||
@@ -1998,9 +2016,9 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS;
|
||||
|
||||
sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing);
|
||||
LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %d with %d ms\n", frame, slot, UE_id, delay_ms);
|
||||
LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frame, slot, UE->rnti, delay_ms);
|
||||
} else {
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti);
|
||||
LOG_I(NR_MAC, "(ue rnti 0x%04x) RA Procedure failed at Msg4!\n", ra->rnti);
|
||||
}
|
||||
|
||||
nr_clear_ra_proc(module_id, CC_id, frame, ra);
|
||||
@@ -2008,7 +2026,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
|
||||
}
|
||||
} else {
|
||||
LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) Received Nack of RA-Msg4. Preparing retransmission!\n", UE_id, ra->rnti);
|
||||
LOG_I(NR_MAC, "(UE %04x) Received Nack of RA-Msg4. Preparing retransmission!\n", ra->rnti);
|
||||
ra->Msg4_frame = (frame + 1) % 1024;
|
||||
ra->Msg4_slot = 1;
|
||||
ra->state = Msg4;
|
||||
|
||||
@@ -53,105 +53,21 @@
|
||||
#define WORD 32
|
||||
//#define SIZE_OF_POINTER sizeof (void *)
|
||||
|
||||
void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp) {
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||
const int bwp_id = bwp ? bwp->bwp_Id : 0;
|
||||
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot) {
|
||||
|
||||
if (nrmac->preferred_dl_tda[bwp_id])
|
||||
return;
|
||||
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||
AssertFatal(tdd || nrmac->common_channels->frame_type == FDD, "Dynamic TDD not handled yet\n");
|
||||
|
||||
/* there is a mixed slot only when in TDD */
|
||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
|
||||
frame_type_t frame_type = nrmac->common_channels->frame_type;
|
||||
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
const NR_TDD_UL_DL_Pattern_t *tdd =
|
||||
scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||
int symb_dlMixed = 0;
|
||||
int nr_mix_slots = 0;
|
||||
int nr_slots_period = n;
|
||||
// Use special TDA in case of CSI-RS
|
||||
if(nrmac->UE_info.sched_csirs)
|
||||
return 1;
|
||||
|
||||
if (tdd) {
|
||||
symb_dlMixed = (1 << tdd->nrofDownlinkSymbols) - 1;
|
||||
nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0;
|
||||
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
|
||||
} else
|
||||
// if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration
|
||||
AssertFatal(nrmac->common_channels->frame_type == FDD,"Dynamic TDD not handled yet\n");
|
||||
|
||||
int target_ss;
|
||||
|
||||
if (bwp) {
|
||||
target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
} else {
|
||||
target_ss = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
}
|
||||
|
||||
const NR_SIB1_t *sib1 = nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
NR_SearchSpace_t *search_space = get_searchspace(sib1,
|
||||
scc,
|
||||
bwp ? bwp->bwp_Dedicated : NULL,
|
||||
target_ss);
|
||||
|
||||
NR_ControlResourceSet_t *coreset = get_coreset(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, search_space, target_ss);
|
||||
// get coreset symbol "map"
|
||||
const uint16_t symb_coreset = (1 << coreset->duration) - 1;
|
||||
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = get_pdsch_TimeDomainAllocationList(bwp,
|
||||
scc,
|
||||
sib1);
|
||||
AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n");
|
||||
|
||||
/* check that TDA index 0 fits into DL and does not overlap CORESET */
|
||||
const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_DL = tdaList->list.array[0];
|
||||
AssertFatal(!tdaP_DL->k0 || *tdaP_DL->k0 == 0,
|
||||
"TimeDomainAllocation at index 1: non-null k0 (%ld) is not supported by the scheduler\n",
|
||||
*tdaP_DL->k0);
|
||||
int start, len;
|
||||
SLIV2SL(tdaP_DL->startSymbolAndLength, &start, &len);
|
||||
const uint16_t symb_tda = ((1 << len) - 1) << start;
|
||||
// check whether coreset and TDA overlap: then we cannot use it. Note that
|
||||
// here we assume that the coreset is scheduled every slot (which it
|
||||
// currently is) and starting at symbol 0
|
||||
AssertFatal((symb_coreset & symb_tda) == 0, "TDA index 0 for DL overlaps with CORESET\n");
|
||||
/* check that TDA index 1 fits into DL part of mixed slot, if it exists */
|
||||
int tdaMi = -1;
|
||||
|
||||
if (frame_type == TDD && tdaList->list.count > 1) {
|
||||
const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1];
|
||||
AssertFatal(!tdaP_Mi->k0 || *tdaP_Mi->k0 == 0,
|
||||
"TimeDomainAllocation at index 1: non-null k0 (%ld) is not supported by the scheduler\n",
|
||||
*tdaP_Mi->k0);
|
||||
int start, len;
|
||||
SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len);
|
||||
const uint16_t symb_tda = ((1 << len) - 1) << start;
|
||||
|
||||
// check whether coreset and TDA overlap: then, we cannot use it. Also,
|
||||
// check whether TDA is entirely within mixed slot DL. Note that
|
||||
// here we assume that the coreset is scheduled every slot (which it
|
||||
// currently is)
|
||||
if ((symb_coreset & symb_tda) == 0 && (symb_dlMixed & symb_tda) == symb_tda) {
|
||||
tdaMi = 1;
|
||||
} else {
|
||||
LOG_E(MAC,
|
||||
"TDA index 1 DL overlaps with CORESET or is not entirely in mixed slot (symb_coreset %x symb_dlMixed %x symb_tda %x), won't schedule DL mixed slot\n",
|
||||
symb_coreset,
|
||||
symb_dlMixed,
|
||||
symb_tda);
|
||||
}
|
||||
}
|
||||
|
||||
nrmac->preferred_dl_tda[bwp_id] = malloc(n * sizeof(*nrmac->preferred_dl_tda[bwp_id]));
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
nrmac->preferred_dl_tda[bwp_id][i] = -1;
|
||||
|
||||
if (frame_type == FDD || i % nr_slots_period < tdd->nrofDownlinkSlots)
|
||||
nrmac->preferred_dl_tda[bwp_id][i] = 0;
|
||||
else if (nr_mix_slots && i % nr_slots_period == tdd->nrofDownlinkSlots)
|
||||
nrmac->preferred_dl_tda[bwp_id][i] = tdaMi;
|
||||
|
||||
LOG_D(MAC, "slot %d preferred_dl_tda %d\n", i, nrmac->preferred_dl_tda[bwp_id][i]);
|
||||
if (tdd && tdd->nrofDownlinkSymbols > 1) { // if there is a mixed slot where we can transmit DL
|
||||
const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + 1;
|
||||
if ((slot%nr_slots_period) == tdd->nrofDownlinkSlots)
|
||||
return 2;
|
||||
}
|
||||
return 0; // if FDD or not mixed slot in TDD, for now use default TDA (TODO handle CSI-RS slots)
|
||||
}
|
||||
|
||||
// Compute and write all MAC CEs and subheaders, and return number of written
|
||||
@@ -397,88 +313,12 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
return offset;
|
||||
}
|
||||
|
||||
#define BLER_UPDATE_FRAME 10
|
||||
#define BLER_FILTER 0.9f
|
||||
int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id, int mcs_table) {
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[mod_id];
|
||||
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
int max_allowed_mcs = (mcs_table == 1) ? 27 : 28;
|
||||
int max_mcs = nrmac->dl_max_mcs;
|
||||
|
||||
if (nrmac->dl_max_mcs>max_allowed_mcs)
|
||||
max_mcs = max_allowed_mcs;
|
||||
|
||||
NR_DL_bler_stats_t *bler_stats = &nrmac->UE_info.UE_sched_ctrl[UE_id].dl_bler_stats;
|
||||
|
||||
/* first call: everything is zero. Initialize to sensible default */
|
||||
if (bler_stats->last_frame_slot == 0 && bler_stats->mcs == 0) {
|
||||
bler_stats->last_frame_slot = frame * n + slot;
|
||||
bler_stats->mcs = 9;
|
||||
bler_stats->bler = (nrmac->dl_bler_target_lower + nrmac->dl_bler_target_upper) / 2;
|
||||
bler_stats->rd2_bler = nrmac->dl_rd2_bler_threshold;
|
||||
}
|
||||
|
||||
const int now = frame * n + slot;
|
||||
int diff = now - bler_stats->last_frame_slot;
|
||||
|
||||
if (diff < 0) // wrap around
|
||||
diff += 1024 * n;
|
||||
|
||||
const uint8_t old_mcs = bler_stats->mcs;
|
||||
const NR_mac_stats_t *stats = &nrmac->UE_info.mac_stats[UE_id];
|
||||
|
||||
// TODO put back this condition when relevant
|
||||
/*const int dret3x = stats->dlsch_rounds[3] - bler_stats->dlsch_rounds[3];
|
||||
if (dret3x > 0) {
|
||||
if there is a third retransmission, decrease MCS for stabilization and
|
||||
restart averaging window to stabilize transmission
|
||||
bler_stats->last_frame_slot = now;
|
||||
bler_stats->mcs = max(9, bler_stats->mcs - 1);
|
||||
memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds));
|
||||
LOG_D(MAC, "%4d.%2d: %d retx in 3rd round, setting MCS to %d and restarting window\n", frame, slot, dret3x, bler_stats->mcs);
|
||||
return bler_stats->mcs;
|
||||
}*/
|
||||
if (diff < BLER_UPDATE_FRAME * n)
|
||||
return old_mcs; // no update
|
||||
|
||||
// last update is longer than x frames ago
|
||||
const int dtx = (int)(stats->dlsch_rounds[0] - bler_stats->dlsch_rounds[0]);
|
||||
const int dretx = (int)(stats->dlsch_rounds[1] - bler_stats->dlsch_rounds[1]);
|
||||
const int dretx2 = (int)(stats->dlsch_rounds[2] - bler_stats->dlsch_rounds[2]);
|
||||
const float bler_window = dtx > 0 ? (float) dretx / dtx : bler_stats->bler;
|
||||
const float rd2_bler_wnd = dtx > 0 ? (float) dretx2 / dtx : bler_stats->rd2_bler;
|
||||
bler_stats->bler = BLER_FILTER * bler_stats->bler + (1 - BLER_FILTER) * bler_window;
|
||||
bler_stats->rd2_bler = BLER_FILTER / 4 * bler_stats->rd2_bler + (1 - BLER_FILTER / 4) * rd2_bler_wnd;
|
||||
int new_mcs = old_mcs;
|
||||
|
||||
// TODO put back this condition when relevant
|
||||
/* first ensure that number of 2nd retx is below threshold. If this is the
|
||||
* case, use 1st retx to adjust faster
|
||||
if (bler_stats->rd2_bler > nrmac->dl_rd2_bler_threshold && old_mcs > 6) {
|
||||
new_mcs -= 2;
|
||||
} else if (bler_stats->rd2_bler < nrmac->dl_rd2_bler_threshold) {*/
|
||||
if (bler_stats->bler < nrmac->dl_bler_target_lower && old_mcs < max_mcs && dtx > 9)
|
||||
new_mcs += 1;
|
||||
else if (bler_stats->bler > nrmac->dl_bler_target_upper && old_mcs > 6)
|
||||
new_mcs -= 1;
|
||||
|
||||
// else we are within threshold boundaries
|
||||
bler_stats->last_frame_slot = now;
|
||||
bler_stats->mcs = new_mcs;
|
||||
memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds));
|
||||
LOG_D(MAC, "%4d.%2d MCS %d -> %d (dtx %d, dretx %d, BLER wnd %.3f avg %.6f, dretx2 %d, RD2 BLER wnd %.3f avg %.6f)\n",
|
||||
frame, slot, old_mcs, new_mcs, dtx, dretx, bler_window, bler_stats->bler, dretx2, rd2_bler_wnd, bler_stats->rd2_bler);
|
||||
return new_mcs;
|
||||
}
|
||||
|
||||
void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot) {
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
UE_iterator(RC.nrmac[module_id]->UE_info.list, UE) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
sched_ctrl->num_total_bytes = 0;
|
||||
sched_ctrl->dl_pdus_total = 0;
|
||||
|
||||
@@ -486,13 +326,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
// Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH
|
||||
for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) {
|
||||
const int lcid = sched_ctrl->dl_lc_ids[i];
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
LOG_D(NR_MAC, "In %s: UE %d/%x: LCID %d\n", __FUNCTION__, UE_id, rnti, lcid);
|
||||
|
||||
const uint16_t rnti = UE->rnti;
|
||||
LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid);
|
||||
if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
start_meas(&RC.nrmac[module_id]->rlc_status_ind);
|
||||
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
|
||||
rnti,
|
||||
@@ -518,7 +356,7 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
slot,
|
||||
lcid < 4 ? "DCCH":"DTCH",
|
||||
lcid,
|
||||
UE_id,
|
||||
UE->rnti,
|
||||
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
||||
sched_ctrl->num_total_bytes,
|
||||
sched_ctrl->dl_pdus_total,
|
||||
@@ -532,15 +370,14 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
sub_frame_t slot,
|
||||
uint16_t *rballoc_mask,
|
||||
int *n_rb_sched,
|
||||
int UE_id,
|
||||
NR_UE_info_t *UE,
|
||||
int current_harq_pid) {
|
||||
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
|
||||
const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels->ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &nr_mac->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch;
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
NR_CellGroupConfig_t *cg = UE->CellGroup;
|
||||
|
||||
NR_BWP_DownlinkDedicated_t *bwpd =
|
||||
cg &&
|
||||
@@ -566,7 +403,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
int rbStart = 0; // start wrt BWPstart
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
int rbSize = 0;
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
@@ -580,7 +417,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
rbStart++;
|
||||
|
||||
if (rbStart >= bwpSize) {
|
||||
LOG_D(NR_MAC, "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_D(NR_MAC, "cannot allocate retransmission for RNTI %04x: no resources\n", UE->rnti);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -652,8 +489,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
}
|
||||
|
||||
/* Find a free CCE */
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
|
||||
|
||||
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti);
|
||||
uint8_t nr_of_candidates;
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
@@ -675,8 +512,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
Y);
|
||||
|
||||
if (CCEIndex<0) {
|
||||
LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n",
|
||||
frame, slot, UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission RNTI %04x\n",
|
||||
frame, slot, UE->rnti);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -684,15 +521,13 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
|
||||
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE, frame, slot, r_pucch, 0);
|
||||
if (alloc<0) {
|
||||
LOG_D(MAC,
|
||||
"could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
UE_id,
|
||||
UE_info->rnti[UE_id],
|
||||
"could not find PUCCH for UE %04x@%d.%d\n",
|
||||
UE->rnti,
|
||||
frame,
|
||||
slot);
|
||||
RC.nrmac[module_id]->pdcch_cand[cid]--;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -715,47 +550,54 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
return true;
|
||||
}
|
||||
|
||||
float thr_ue[MAX_MOBILES_PER_GNB];
|
||||
uint32_t pf_tbs[3][29]; // pre-computed, approximate TBS values for PF coefficient
|
||||
typedef struct UEsched_s {
|
||||
float coef;
|
||||
NR_UE_info_t * UE;
|
||||
} UEsched_t;
|
||||
|
||||
static int comparator(const void *p, const void *q) {
|
||||
return ((UEsched_t*)p)->coef < ((UEsched_t*)q)->coef;
|
||||
}
|
||||
|
||||
void pf_dl(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot,
|
||||
NR_list_t *UE_list,
|
||||
NR_UE_info_t **UE_list,
|
||||
int max_num_ue,
|
||||
int n_rb_sched,
|
||||
uint16_t *rballoc_mask) {
|
||||
gNB_MAC_INST *mac = RC.nrmac[module_id];
|
||||
NR_UE_info_t *UE_info = &mac->UE_info;
|
||||
NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon;
|
||||
float coeff_ue[MAX_MOBILES_PER_GNB];
|
||||
// UEs that could be scheduled
|
||||
int ue_array[MAX_MOBILES_PER_GNB];
|
||||
int layers[MAX_MOBILES_PER_GNB];
|
||||
NR_list_t UE_sched = { .head = -1, .next = ue_array, .tail = -1, .len = MAX_MOBILES_PER_GNB };
|
||||
UEsched_t UE_sched[MAX_MOBILES_PER_GNB] = {0};
|
||||
int remainUEs = max_num_ue;
|
||||
int curUE = 0;
|
||||
|
||||
/* Loop UE_info->list to check retransmission */
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
if (UE_info->Msg4_ACKed[UE_id] != true) continue;
|
||||
UE_iterator(UE_list, UE) {
|
||||
if (UE->Msg4_ACKed != true)
|
||||
continue;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
|
||||
|
||||
const NR_mac_dir_stats_t *stats = &UE->mac_stats.dl;
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
|
||||
sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
|
||||
layers[UE_id] = ps->nrOfLayers; // initialization of layers to the previous value in the strcuture
|
||||
UE->layers = ps->nrOfLayers; // initialization of layers to the previous value in the structure
|
||||
/* Calculate Throughput */
|
||||
const float a = 0.0005f; // corresponds to 200ms window
|
||||
const uint32_t b = UE_info->mac_stats[UE_id].dlsch_current_bytes;
|
||||
thr_ue[UE_id] = (1 - a) * thr_ue[UE_id] + a * b;
|
||||
const uint32_t b = UE->mac_stats.dl.current_bytes;
|
||||
UE->dl_thr_ue = (1 - a) * UE->dl_thr_ue + a * b;
|
||||
|
||||
/* retransmission */
|
||||
if (sched_pdsch->dl_harq_pid >= 0) {
|
||||
/* Allocate retransmission */
|
||||
bool r = allocate_dl_retransmission(module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid);
|
||||
bool r = allocate_dl_retransmission(module_id, frame, slot, rballoc_mask, &n_rb_sched, UE, sched_pdsch->dl_harq_pid);
|
||||
|
||||
if (!r) {
|
||||
LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot);
|
||||
@@ -763,18 +605,24 @@ void pf_dl(module_id_t module_id,
|
||||
}
|
||||
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
max_num_ue--;
|
||||
remainUEs--;
|
||||
|
||||
// we have filled all with mandatory retransmissions
|
||||
// no need to schedule new transmissions
|
||||
if (remainUEs == 0)
|
||||
return;
|
||||
|
||||
if (max_num_ue < 0) return;
|
||||
} else {
|
||||
/* 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;
|
||||
|
||||
/* Calculate coeff */
|
||||
set_dl_mcs(sched_pdsch,sched_ctrl,&mac->dl_max_mcs,ps->mcsTableIdx);
|
||||
sched_pdsch->mcs = get_mcs_from_bler(module_id, /* CC_id = */ 0, frame, slot, UE_id, ps->mcsTableIdx);
|
||||
layers[UE_id] = set_dl_nrOfLayers(sched_ctrl);
|
||||
const NR_bler_options_t *bo = &mac->dl_bler;
|
||||
const int max_mcs_table = ps->mcsTableIdx == 1 ? 27 : 28;
|
||||
const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table);
|
||||
sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame);
|
||||
UE->layers = set_dl_nrOfLayers(sched_ctrl);
|
||||
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
uint32_t tbs = nr_compute_tbs(Qm,
|
||||
@@ -784,40 +632,26 @@ void pf_dl(module_id_t module_id,
|
||||
0, /* N_PRB_DMRS * N_DMRS_SLOT */
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
layers[UE_id]) >> 3;
|
||||
coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id];
|
||||
LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
|
||||
b, UE_id, thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]);
|
||||
UE->layers) >> 3;
|
||||
float coeff_ue = (float) tbs / UE->dl_thr_ue;
|
||||
LOG_D(NR_MAC,"UE %04x b %d, thr_ue %f, tbs %d, coeff_ue %f\n",
|
||||
UE->rnti, b, UE->dl_thr_ue, tbs, coeff_ue);
|
||||
/* Create UE_sched list for UEs eligible for new transmission*/
|
||||
add_tail_nr_list(&UE_sched, UE_id);
|
||||
UE_sched[curUE].coef=coeff_ue;
|
||||
UE_sched[curUE].UE=UE;
|
||||
curUE++;
|
||||
}
|
||||
}
|
||||
|
||||
qsort(UE_sched, sizeof(*UE_sched), sizeofArray(UE_sched), comparator);
|
||||
UEsched_t *iterator = UE_sched;
|
||||
|
||||
const int min_rbSize = 5;
|
||||
|
||||
/* Loop UE_sched to find max coeff and allocate transmission */
|
||||
while (max_num_ue > 0 && n_rb_sched >= min_rbSize && UE_sched.head >= 0) {
|
||||
/* Find max coeff from UE_sched*/
|
||||
int *max = &UE_sched.head; /* assume head is max */
|
||||
int *p = &UE_sched.next[*max];
|
||||
|
||||
while (*p >= 0) {
|
||||
/* if the current one has larger coeff, save for later */
|
||||
if (coeff_ue[*p] > coeff_ue[*max])
|
||||
max = p;
|
||||
|
||||
p = &UE_sched.next[*p];
|
||||
}
|
||||
|
||||
/* remove the max one: do not use remove_nr_list() it goes through the
|
||||
* whole list every time. Note that UE_sched.tail might not be set
|
||||
* correctly anymore */
|
||||
const int UE_id = *max;
|
||||
p = &UE_sched.next[*max];
|
||||
*max = UE_sched.next[*max];
|
||||
*p = -1;
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
while (remainUEs> 0 && n_rb_sched >= min_rbSize && iterator->UE != NULL) {
|
||||
|
||||
NR_CellGroupConfig_t *cg = iterator->UE->CellGroup;
|
||||
|
||||
NR_BWP_DownlinkDedicated_t *bwpd =
|
||||
cg &&
|
||||
@@ -832,26 +666,32 @@ void pf_dl(module_id_t module_id,
|
||||
cg->spCellConfig->spCellConfigDedicated->uplinkConfig ?
|
||||
cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &iterator->UE->UE_sched_ctrl;
|
||||
const uint16_t rnti = iterator->UE->rnti;
|
||||
const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ?
|
||||
RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 :
|
||||
NULL;
|
||||
|
||||
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp,
|
||||
RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon,
|
||||
sib1);
|
||||
|
||||
const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId;
|
||||
const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const int coresetid = (sched_ctrl->active_bwp||bwpd) ?
|
||||
sched_ctrl->coreset->controlResourceSetId :
|
||||
RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId;
|
||||
const uint16_t bwpSize = coresetid == 0 ?
|
||||
RC.nrmac[module_id]->cset0_bwp_size :
|
||||
NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = 0; // start wrt BWPstart
|
||||
|
||||
if (sched_ctrl->available_dl_harq.head < 0) {
|
||||
LOG_D(MAC, "UE %d RNTI %04x has no free HARQ process, skipping\n", UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_D(MAC, "RNTI %04x has no free HARQ process, skipping\n", iterator->UE->rnti);
|
||||
iterator++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find a free CCE */
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
|
||||
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, iterator->UE->rnti);
|
||||
uint8_t nr_of_candidates;
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
@@ -873,7 +713,8 @@ void pf_dl(module_id_t module_id,
|
||||
Y);
|
||||
|
||||
if (CCEIndex<0) {
|
||||
LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti);
|
||||
LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI RNTI %04x\n", frame, slot, rnti);
|
||||
iterator++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -881,48 +722,39 @@ void pf_dl(module_id_t module_id,
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
|
||||
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0);
|
||||
const int alloc = nr_acknack_scheduling(module_id, iterator->UE, frame, slot, r_pucch, 0);
|
||||
|
||||
if (alloc<0) {
|
||||
LOG_D(NR_MAC,
|
||||
"could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
UE_id,
|
||||
"could not find PUCCH for %04x@%d.%d\n",
|
||||
rnti,
|
||||
frame,
|
||||
slot);
|
||||
mac->pdcch_cand[cid]--;
|
||||
iterator++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE
|
||||
* and PUCCH */
|
||||
max_num_ue--;
|
||||
AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue);
|
||||
sched_ctrl->cce_index = CCEIndex;
|
||||
fill_pdcch_vrb_map(mac,
|
||||
/* CC_id = */ 0,
|
||||
&sched_ctrl->sched_pdcch,
|
||||
CCEIndex,
|
||||
sched_ctrl->aggregation_level);
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
max_num_ue--;
|
||||
|
||||
if (max_num_ue < 0) return;
|
||||
|
||||
/* MCS has been set above */
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
|
||||
if (ps->nrOfLayers != layers[UE_id] || ps->time_domain_allocation != tda) {
|
||||
if (ps->nrOfLayers != iterator->UE->layers || ps->time_domain_allocation != tda ) {
|
||||
nr_set_pdsch_semi_static(sib1,
|
||||
scc,
|
||||
UE_info->CellGroup[UE_id],
|
||||
iterator->UE->CellGroup,
|
||||
sched_ctrl->active_bwp,
|
||||
bwpd,
|
||||
tda,
|
||||
layers[UE_id],
|
||||
iterator->UE->layers,
|
||||
sched_ctrl,
|
||||
ps);
|
||||
}
|
||||
@@ -967,27 +799,25 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
|
||||
rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap;
|
||||
|
||||
remainUEs--;
|
||||
iterator++;
|
||||
}
|
||||
}
|
||||
|
||||
void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) {
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
|
||||
if (UE_info->num_UEs == 0)
|
||||
if (UE_info->list[0] == NULL)
|
||||
return;
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
|
||||
const int CC_id = 0;
|
||||
/* Get bwpSize and TDAfrom the first UE */
|
||||
/* This is temporary and it assumes all UEs have the same BWP and TDA*/
|
||||
int UE_id = UE_info->list.head;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const int bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
|
||||
if (!RC.nrmac[module_id]->preferred_dl_tda[bwp_id])
|
||||
return;
|
||||
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[bwp_id][slot];
|
||||
NR_UE_info_t *UE=UE_info->list[0];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_bwp ?
|
||||
sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
|
||||
@@ -1002,10 +832,10 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
sib1);
|
||||
|
||||
NR_BWP_DownlinkDedicated_t *bwpd =
|
||||
UE_info->CellGroup[UE_id] &&
|
||||
UE_info->CellGroup[UE_id]->spCellConfig &&
|
||||
UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated ?
|
||||
UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL;
|
||||
UE->CellGroup &&
|
||||
UE->CellGroup->spCellConfig &&
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated ?
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL;
|
||||
|
||||
const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId;
|
||||
|
||||
@@ -1034,7 +864,7 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
pf_dl(module_id,
|
||||
frame,
|
||||
slot,
|
||||
&UE_info->list,
|
||||
UE_info->list,
|
||||
MAX_MOBILES_PER_GNB,
|
||||
n_rb_sched,
|
||||
rballoc_mask);
|
||||
@@ -1081,18 +911,17 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
gNB_mac->pre_processor_dl(module_id, frame, slot);
|
||||
const int CC_id = 0;
|
||||
NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
|
||||
NR_UEs_t *UE_info = &gNB_mac->UE_info;
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
||||
NR_list_t *UE_list = &UE_info->list;
|
||||
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
UE_iterator(UE_info->list, UE) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
|
||||
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
UE->mac_stats.dl.current_bytes = 0;
|
||||
NR_CellGroupConfig_t *cg = UE->CellGroup;
|
||||
|
||||
NR_BWP_DownlinkDedicated_t *bwpd =
|
||||
cg &&
|
||||
@@ -1106,13 +935,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
* If we add the CE, ta_apply will be reset */
|
||||
if (frame == (sched_ctrl->ta_frame + 10) % 1024) {
|
||||
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
|
||||
LOG_D(NR_MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot);
|
||||
LOG_D(NR_MAC, "[UE %04x][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE->rnti, frame, slot);
|
||||
}
|
||||
|
||||
if (sched_pdsch->rbSize <= 0)
|
||||
continue;
|
||||
|
||||
const rnti_t rnti = UE_info->rnti[UE_id];
|
||||
const rnti_t rnti = UE->rnti;
|
||||
/* pre-computed PDSCH values that only change if time domain
|
||||
* allocation/DMRS parameters change. Updated in the preprocessor through
|
||||
* nr_set_pdsch_semi_static() */
|
||||
@@ -1128,8 +957,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
/* PP has not selected a specific HARQ Process, get a new one */
|
||||
current_harq_pid = sched_ctrl->available_dl_harq.head;
|
||||
AssertFatal(current_harq_pid >= 0,
|
||||
"no free HARQ process available for UE %d\n",
|
||||
UE_id);
|
||||
"no free HARQ process available for UE %04x\n",
|
||||
UE->rnti);
|
||||
remove_front_nr_list(&sched_ctrl->available_dl_harq);
|
||||
sched_pdsch->dl_harq_pid = current_harq_pid;
|
||||
} else {
|
||||
@@ -1149,12 +978,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->feedback_frame = pucch->frame;
|
||||
harq->feedback_slot = pucch->ul_slot;
|
||||
harq->is_waiting = true;
|
||||
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
|
||||
UE->mac_stats.dl.rounds[harq->round]++;
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
|
||||
"%4d.%2d [DLSCH/PDSCH/PUCCH] RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
|
||||
frame,
|
||||
slot,
|
||||
UE_id,
|
||||
rnti,
|
||||
sched_ctrl->aggregation_level,
|
||||
sched_pdsch->rbStart,
|
||||
@@ -1197,7 +1025,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
dl_req->nPDUs += 1;
|
||||
pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %d, bwp %d, cs %d\n",UE_id,bwp_id,coresetid);
|
||||
LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %04x, bwp %d, cs %d\n", UE->rnti, bwp_id, coresetid);
|
||||
NR_ControlResourceSet_t *coreset = (bwp||bwpd)? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset;
|
||||
nr_configure_pdcch(pdcch_pdu, coreset, genericParameters, &sched_ctrl->sched_pdcch);
|
||||
gNB_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu;
|
||||
@@ -1229,6 +1057,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0;
|
||||
// Codeword information
|
||||
pdsch_pdu->NrOfCodewords = 1;
|
||||
//number of information bits per 1024 coded bits expressed in 0.1 bit units
|
||||
pdsch_pdu->targetCodeRate[0] = R;
|
||||
pdsch_pdu->qamModOrder[0] = Qm;
|
||||
pdsch_pdu->mcsIndex[0] = sched_pdsch->mcs;
|
||||
@@ -1258,8 +1087,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->NrOfSymbols = ps->nrOfSymbols;
|
||||
// Precoding
|
||||
if (sched_ctrl->set_pmi) {
|
||||
int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id;
|
||||
nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][report_id];
|
||||
const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id;
|
||||
nr_csi_report_t *csi_report = &UE->csi_report_template[report_id];
|
||||
pdsch_pdu->precodingAndBeamforming.prg_size = pdsch_pdu->rbSize;
|
||||
pdsch_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = set_pm_index(sched_ctrl,
|
||||
nrOfLayers,
|
||||
@@ -1400,17 +1229,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
* from RLC or encode MAC CEs. The TX_req structure is filled below
|
||||
* or copy data to FAPI structures */
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%2d DL retransmission UE %d/RNTI %04x HARQ PID %d round %d NDI %d\n",
|
||||
"%d.%2d DL retransmission RNTI %04x HARQ PID %d round %d NDI %d\n",
|
||||
frame,
|
||||
slot,
|
||||
UE_id,
|
||||
rnti,
|
||||
current_harq_pid,
|
||||
harq->round,
|
||||
harq->ndi);
|
||||
AssertFatal(harq->sched_pdsch.tb_size == TBS,
|
||||
"UE %d mismatch between scheduled TBS and buffered TB for HARQ PID %d\n",
|
||||
UE_id,
|
||||
"UE %04x mismatch between scheduled TBS and buffered TB for HARQ PID %d\n",
|
||||
UE->rnti,
|
||||
current_harq_pid);
|
||||
T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
|
||||
T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS));
|
||||
@@ -1447,7 +1275,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
/* limit requested number of bytes to what preprocessor specified, or
|
||||
* such that TBS is full */
|
||||
const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
||||
bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG));
|
||||
bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG));
|
||||
tbs_size_t len = mac_rlc_data_req(module_id,
|
||||
rnti,
|
||||
module_id,
|
||||
@@ -1482,7 +1310,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
lcid_bytes += len;
|
||||
}
|
||||
|
||||
UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += lcid_bytes;
|
||||
UE->mac_stats.dl.lc_bytes[lcid] += lcid_bytes;
|
||||
}
|
||||
} else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) {
|
||||
/* we will need the large header, phy-test typically allocates all
|
||||
@@ -1520,8 +1348,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
buf=bufEnd;
|
||||
}
|
||||
|
||||
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
|
||||
UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS;
|
||||
UE->mac_stats.dl.total_bytes += TBS;
|
||||
UE->mac_stats.dl.current_bytes = TBS;
|
||||
/* save retransmission information */
|
||||
harq->sched_pdsch = *sched_pdsch;
|
||||
/* save which time allocation has been used, to be used on
|
||||
@@ -1533,10 +1361,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
sched_ctrl->ta_apply = false;
|
||||
sched_ctrl->ta_frame = frame;
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%2d UE %d TA scheduled, resetting TA frame\n",
|
||||
"%d.%2d UE %04x TA scheduled, resetting TA frame\n",
|
||||
frame,
|
||||
slot,
|
||||
UE_id);
|
||||
UE->rnti);
|
||||
}
|
||||
|
||||
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
|
||||
|
||||
@@ -69,7 +69,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
nfapi_nr_pdu_t *TX_req;
|
||||
|
||||
uint16_t rnti = 0x1234;
|
||||
|
||||
// int time_domain_assignment,k0;
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon;
|
||||
@@ -152,8 +151,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
NrOfSymbols = NrOfSymbols_tmp;
|
||||
StartSymbolIndex = StartSymbolIndex_tmp;
|
||||
mappingtype = mappingtype_tmp;
|
||||
// k0 = *scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
|
||||
// time_domain_assignment = i;
|
||||
}
|
||||
}
|
||||
AssertFatal(StartSymbolIndex>=0,"StartSymbolIndex is negative\n");
|
||||
@@ -163,80 +160,9 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
scc->dmrs_TypeA_Position,
|
||||
NrOfSymbols,
|
||||
StartSymbolIndex,
|
||||
mappingtype, 1);
|
||||
mappingtype,
|
||||
1);
|
||||
|
||||
/*
|
||||
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
|
||||
nr_configure_css_dci_initial(pdcch_pdu_rel15,
|
||||
scs,
|
||||
scs,
|
||||
FR,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
sfn_sf, slotP,
|
||||
slots_per_frame,
|
||||
dlBWP_carrier_bandwidth);
|
||||
|
||||
|
||||
pdu_rel15->frequency_domain_assignment = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
dlBWP_carrier_bandwidth);
|
||||
pdu_rel15->time_domain_assignment = time_domain_assignment;
|
||||
|
||||
pdu_rel15->vrb_to_prb_mapping = 1;
|
||||
pdu_rel15->mcs = 9;
|
||||
pdu_rel15->tb_scaling = 1;
|
||||
|
||||
pdu_rel15->ra_preamble_index = 25;
|
||||
pdu_rel15->format_indicator = 1;
|
||||
pdu_rel15->ndi = 1;
|
||||
pdu_rel15->rv = 0;
|
||||
pdu_rel15->harq_pid = 0;
|
||||
pdu_rel15->dai = 2;
|
||||
pdu_rel15->tpc = 2;
|
||||
pdu_rel15->pucch_resource_indicator = 7;
|
||||
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
|
||||
|
||||
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
pdu_rel15->frequency_domain_assignment,
|
||||
pdu_rel15->time_domain_assignment,
|
||||
pdu_rel15->vrb_to_prb_mapping,
|
||||
pdu_rel15->mcs,
|
||||
pdu_rel15->tb_scaling,
|
||||
pdu_rel15->ndi,
|
||||
pdu_rel15->rv);
|
||||
|
||||
params_rel15->rnti = rnti;
|
||||
params_rel15->rnti_type = NFAPI_NR_RNTI_C;
|
||||
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
|
||||
//params_rel15->aggregation_level = 1;
|
||||
LOG_D(MAC, "DCI type 1 params: rnti %x, rnti_type %d, dci_format %d\n \
|
||||
coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \
|
||||
ss params : nb_ss_sets_per_slot %d, first symb %d, nb_slots %d, sfn_mod2 %d, first slot %d\n",
|
||||
params_rel15->rnti,
|
||||
params_rel15->rnti_type,
|
||||
params_rel15->dci_format,
|
||||
params_rel15->mux_pattern,
|
||||
params_rel15->n_rb,
|
||||
params_rel15->n_symb,
|
||||
params_rel15->rb_offset,
|
||||
params_rel15->nb_ss_sets_per_slot,
|
||||
params_rel15->first_symbol,
|
||||
params_rel15->nb_slots,
|
||||
params_rel15->sfn_mod2,
|
||||
params_rel15->first_slot);
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, dl_tti_dci_pdu->dci_dl_pdu,0);
|
||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d\n",
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->StartSymbolIndex,
|
||||
pdsch_pdu_rel15->NrOfSymbols,
|
||||
pdsch_pdu_rel15->nrOfLayers,
|
||||
pdsch_pdu_rel15->NrOfCodewords,
|
||||
pdsch_pdu_rel15->mcsIndex[0]);
|
||||
*/
|
||||
|
||||
nr_mac->DL_req[CC_id].dl_tti_request_body.nPDUs+=2;
|
||||
|
||||
TX_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
|
||||
@@ -266,20 +192,16 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
{
|
||||
if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot))
|
||||
return;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_UE_info_t *UE = RC.nrmac[module_id]->UE_info.list[0];
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
|
||||
const int UE_id = 0;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
const int CC_id = 0;
|
||||
AssertFatal(UE_info->active[UE_id],
|
||||
"%s(): expected UE %d to be active\n",
|
||||
__func__,
|
||||
UE_id);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
|
||||
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
ps->nrOfLayers = target_dl_Nl;
|
||||
if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl)
|
||||
nr_set_pdsch_semi_static(NULL, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps);
|
||||
nr_set_pdsch_semi_static(NULL, scc, UE->CellGroup, sched_ctrl->active_bwp, NULL, tda, target_dl_Nl,sched_ctrl , ps);
|
||||
|
||||
/* find largest unallocated chunk */
|
||||
const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
@@ -315,7 +237,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
sched_ctrl->dl_lc_num = 1;
|
||||
const int lcid = DL_SCH_LCID_DTCH;
|
||||
sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid;
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
const uint16_t rnti = UE->rnti;
|
||||
/* update sched_ctrl->num_total_bytes so that postprocessor schedules data,
|
||||
* if available */
|
||||
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
|
||||
@@ -341,8 +263,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
|
||||
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti);
|
||||
|
||||
int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id],
|
||||
CC_id,
|
||||
@@ -353,21 +274,19 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
Y);
|
||||
|
||||
AssertFatal(CCEIndex >= 0,
|
||||
"%s(): could not find CCE for UE %d\n",
|
||||
"%s(): could not find CCE for UE %04x\n",
|
||||
__func__,
|
||||
UE_id);
|
||||
UE->rnti);
|
||||
|
||||
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, NULL, CCEIndex);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE, frame, slot, r_pucch, 0);
|
||||
if (alloc < 0) {
|
||||
LOG_D(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
"%s(): could not find PUCCH for UE %04x@%d.%d\n",
|
||||
__func__,
|
||||
UE_id,
|
||||
rnti,
|
||||
frame,
|
||||
slot);
|
||||
RC.nrmac[module_id]->pdcch_cand[cid]--;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -389,6 +308,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
sched_pdsch->rbSize = rbSize;
|
||||
|
||||
sched_pdsch->mcs = target_dl_mcs;
|
||||
sched_ctrl->dl_bler_stats.mcs = target_dl_mcs; /* for logging output */
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
|
||||
@@ -421,32 +341,36 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
NR_UE_info_t *UE_info = &nr_mac->UE_info;
|
||||
NR_UE_info_t *UE = nr_mac->UE_info.list[0];
|
||||
|
||||
AssertFatal(UE_info->num_UEs <= 1,
|
||||
"%s() cannot handle more than one UE, but found %d\n",
|
||||
__func__,
|
||||
UE_info->num_UEs);
|
||||
if (UE_info->num_UEs == 0)
|
||||
AssertFatal(nr_mac->UE_info.list[1] == NULL,
|
||||
"cannot handle more than one UE\n");
|
||||
if (UE == NULL)
|
||||
return false;
|
||||
|
||||
const int UE_id = 0;
|
||||
const int CC_id = 0;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
const int tda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1;
|
||||
if (tda < 0)
|
||||
return false;
|
||||
const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList =
|
||||
sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
const int temp_tda = get_ul_tda(nr_mac, scc, slot);
|
||||
if (temp_tda < 0)
|
||||
return false;
|
||||
AssertFatal(temp_tda < tdaList->list.count,
|
||||
"time domain assignment %d >= %d\n",
|
||||
temp_tda,
|
||||
tdaList->list.count);
|
||||
int K2 = get_K2(scc,NULL,sched_ctrl->active_ubwp, temp_tda, mu);
|
||||
const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]);
|
||||
const int sched_slot = (slot + K2) % nr_slots_per_frame[mu];
|
||||
const int tda = get_ul_tda(nr_mac, scc, sched_slot);
|
||||
if (tda < 0)
|
||||
return false;
|
||||
AssertFatal(tda < tdaList->list.count,
|
||||
"time domain assignment %d >= %d\n",
|
||||
tda,
|
||||
tdaList->list.count);
|
||||
int K2 = get_K2(scc,NULL,sched_ctrl->active_ubwp, tda, mu);
|
||||
const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]);
|
||||
const int sched_slot = (slot + K2) % nr_slots_per_frame[mu];
|
||||
/* check if slot is UL, and that slot is 8 (assuming K2=6 because of UE
|
||||
* limitations). Note that if K2 or the TDD configuration is changed, below
|
||||
* conditions might exclude each other and never be true */
|
||||
@@ -514,8 +438,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
|
||||
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti);
|
||||
|
||||
int CCEIndex = find_pdcch_candidate(nr_mac,
|
||||
CC_id,
|
||||
@@ -527,7 +450,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
|
||||
if (CCEIndex < 0) {
|
||||
LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PUSCH\n", __func__);
|
||||
nr_mac->pdcch_cand[cid]--;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -536,6 +458,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
const int mcs = target_ul_mcs;
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
sched_pusch->mcs = mcs;
|
||||
sched_ctrl->ul_bler_stats.mcs = mcs; /* for logging output */
|
||||
sched_pusch->rbStart = rbStart;
|
||||
sched_pusch->rbSize = rbSize;
|
||||
/* get the PID of a HARQ process awaiting retransmission, or -1 for "any new" */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,18 +35,17 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id, int UE_id, NR_SRS_Resource_t *srs_resource) {
|
||||
void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id,NR_UE_info_t* UE, NR_SRS_Resource_t *srs_resource) {
|
||||
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
NR_BWP_t ubwp = sched_ctrl->active_ubwp ?
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
|
||||
srs_pdu->rnti = UE_info->rnti[UE_id];
|
||||
srs_pdu->rnti = UE->rnti;
|
||||
srs_pdu->handle = 0;
|
||||
srs_pdu->bwp_size = NRRIV2BW(ubwp.locationAndBandwidth, MAX_BWP_SIZE);;
|
||||
srs_pdu->bwp_start = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth, MAX_BWP_SIZE);;
|
||||
@@ -83,7 +82,7 @@ void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id, int
|
||||
srs_pdu->t_offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
|
||||
}
|
||||
|
||||
void nr_fill_nfapi_srs(int module_id, int CC_id, int UE_id, sub_frame_t slot, NR_SRS_Resource_t *srs_resource) {
|
||||
void nr_fill_nfapi_srs(int module_id, int CC_id, NR_UE_info_t* UE, sub_frame_t slot, NR_SRS_Resource_t *srs_resource) {
|
||||
|
||||
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][slot];
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
@@ -95,7 +94,7 @@ void nr_fill_nfapi_srs(int module_id, int CC_id, int UE_id, sub_frame_t slot, NR
|
||||
memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t));
|
||||
future_ul_tti_req->n_pdus += 1;
|
||||
|
||||
nr_configure_srs(srs_pdu, module_id, CC_id, UE_id, srs_resource);
|
||||
nr_configure_srs(srs_pdu, module_id, CC_id, UE, srs_resource);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@@ -112,21 +111,19 @@ void nr_fill_nfapi_srs(int module_id, int CC_id, int UE_id, sub_frame_t slot, NR
|
||||
void nr_schedule_srs(int module_id, frame_t frame) {
|
||||
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
||||
const NR_list_t *UE_list = &UE_info->list;
|
||||
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UEs_t *UE_info = &nrmac->UE_info;
|
||||
|
||||
UE_iterator(UE_info->list, UE) {
|
||||
const int CC_id = 0;
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_CellGroupConfig_t *cg = UE->CellGroup;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
sched_ctrl->sched_srs.frame = -1;
|
||||
sched_ctrl->sched_srs.slot = -1;
|
||||
sched_ctrl->sched_srs.srs_scheduled = false;
|
||||
|
||||
if(!UE_info->Msg4_ACKed[UE_id] || sched_ctrl->rrc_processing_timer > 0) {
|
||||
if(!UE->Msg4_ACKed || sched_ctrl->rrc_processing_timer > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -179,7 +176,7 @@ void nr_schedule_srs(int module_id, frame_t frame) {
|
||||
// Check if UE will transmit the SRS in this frame
|
||||
if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) {
|
||||
LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame);
|
||||
nr_fill_nfapi_srs(module_id, CC_id, UE_id, offset%n_slots_frame, srs_resource);
|
||||
nr_fill_nfapi_srs(module_id, CC_id, UE, offset%n_slots_frame, srs_resource);
|
||||
sched_ctrl->sched_srs.frame = frame;
|
||||
sched_ctrl->sched_srs.slot = offset%n_slots_frame;
|
||||
sched_ctrl->sched_srs.srs_scheduled = true;
|
||||
|
||||
@@ -38,17 +38,15 @@
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot,
|
||||
const NR_sched_pucch_t *pucch,
|
||||
int UE_id)
|
||||
{
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[mod_id];
|
||||
NR_UE_info_t *UE_info = &nr_mac->UE_info;
|
||||
|
||||
static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac,
|
||||
frame_t frame,
|
||||
sub_frame_t slot,
|
||||
const NR_sched_pucch_t *pucch,
|
||||
NR_UE_info_t* UE)
|
||||
{
|
||||
nfapi_nr_ul_tti_request_t *future_ul_tti_req =
|
||||
&RC.nrmac[mod_id]->UL_tti_req_ahead[0][pucch->ul_slot];
|
||||
&nrmac->UL_tti_req_ahead[0][pucch->ul_slot];
|
||||
AssertFatal(future_ul_tti_req->SFN == pucch->frame
|
||||
&& future_ul_tti_req->Slot == pucch->ul_slot,
|
||||
"Current %4d.%2d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n",
|
||||
@@ -57,9 +55,12 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
future_ul_tti_req->Slot,
|
||||
pucch->frame,
|
||||
pucch->ul_slot);
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
|
||||
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
|
||||
// n_pdus is number of pdus, so, in the array, it is the index of the next free element
|
||||
if (future_ul_tti_req->n_pdus >= sizeofArray(future_ul_tti_req->pdus_list) ) {
|
||||
LOG_E(NR_MAC,"future_ul_tti_req->n_pdus %d is full, slot: %d, sr flag %d dropping request\n",
|
||||
future_ul_tti_req->n_pdus, pucch->ul_slot, pucch->sr_flag);
|
||||
return;
|
||||
}
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE;
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t);
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pucch_pdu;
|
||||
@@ -77,9 +78,9 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
pucch->dai_c,
|
||||
pucch->csi_bits,
|
||||
pucch->resource_indicator);
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
|
||||
NR_CellGroupConfig_t *cg=UE_info->CellGroup[UE_id];
|
||||
NR_COMMON_channels_t * common_ch=nrmac->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = common_ch->ServingCellConfigCommon;
|
||||
NR_CellGroupConfig_t *cg=UE->CellGroup;
|
||||
|
||||
NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated &&
|
||||
cg->spCellConfig->spCellConfigDedicated->uplinkConfig ?
|
||||
@@ -88,14 +89,14 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
LOG_D(NR_MAC,"%4d.%2d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch to be scheduled in %4d.%2d\n",
|
||||
frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot);
|
||||
|
||||
const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
const NR_SIB1_t *sib1 = common_ch->sib1 ? common_ch->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
nr_configure_pucch(sib1,
|
||||
pucch_pdu,
|
||||
scc,
|
||||
UE_info->CellGroup[UE_id],
|
||||
UE_info->UE_sched_ctrl[UE_id].active_ubwp,
|
||||
UE->CellGroup,
|
||||
UE->UE_sched_ctrl.active_ubwp,
|
||||
ubwpd,
|
||||
UE_info->rnti[UE_id],
|
||||
UE->rnti,
|
||||
pucch->resource_indicator,
|
||||
pucch->csi_bits,
|
||||
pucch->dai_c,
|
||||
@@ -139,22 +140,18 @@ int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = {
|
||||
};
|
||||
|
||||
|
||||
void nr_schedule_pucch(int Mod_idP,
|
||||
void nr_schedule_pucch(gNB_MAC_INST *nrmac,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP)
|
||||
{
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP];
|
||||
if (!is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[slotP / 64], slotP))
|
||||
return;
|
||||
|
||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
||||
const NR_list_t *UE_list = &UE_info->list;
|
||||
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
UE_iterator(nrmac->UE_info.list, UE) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch);
|
||||
for (int i = 0; i < n; i++) {
|
||||
NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i];
|
||||
NR_sched_pucch_t *curr_pucch = &UE->UE_sched_ctrl.sched_pucch[i];
|
||||
const uint16_t O_ack = curr_pucch->dai_c;
|
||||
const uint16_t O_csi = curr_pucch->csi_bits;
|
||||
const uint8_t O_sr = curr_pucch->sr_flag;
|
||||
@@ -162,9 +159,11 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
|| frameP != curr_pucch->frame
|
||||
|| slotP != curr_pucch->ul_slot)
|
||||
continue;
|
||||
if (O_csi > 0) LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %4d.%2d O_ack %d, O_sr %d, O_csi %d\n",
|
||||
i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack,O_sr,O_csi);
|
||||
nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id);
|
||||
|
||||
if (O_csi > 0)
|
||||
LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %04x in %4d.%2d O_ack %d, O_sr %d, O_csi %d\n",
|
||||
i,UE->rnti,curr_pucch->frame,curr_pucch->ul_slot,O_ack,O_sr,O_csi);
|
||||
nr_fill_nfapi_pucch(nrmac, frameP, slotP, curr_pucch, UE);
|
||||
memset(curr_pucch, 0, sizeof(*curr_pucch));
|
||||
}
|
||||
}
|
||||
@@ -291,7 +290,6 @@ void compute_li_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void get_n1n2_o1o2_singlepanel(int *n1, int *n2, int *o1, int *o2,
|
||||
struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo *morethantwo) {
|
||||
|
||||
@@ -563,9 +561,8 @@ void compute_cqi_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig,
|
||||
AssertFatal(1==0,"Sub-band CQI reporting not yet supported");
|
||||
}
|
||||
|
||||
|
||||
//!TODO : same function can be written to handle csi_resources
|
||||
void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){
|
||||
void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE){
|
||||
uint8_t csi_report_id = 0;
|
||||
uint8_t nb_resources = 0;
|
||||
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type;
|
||||
@@ -577,7 +574,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in
|
||||
for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){
|
||||
struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
|
||||
// MAC structure for CSI measurement reports (per UE and per report)
|
||||
nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id];
|
||||
nr_csi_report_t *csi_report = &UE->csi_report_template[csi_report_id];
|
||||
// csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration
|
||||
// (either CSI-RS or SSB)
|
||||
csi_ResourceConfigId = csi_reportconfig->resourcesForChannelMeasurement;
|
||||
@@ -662,24 +659,22 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in
|
||||
}
|
||||
|
||||
|
||||
uint16_t nr_get_csi_bitlen(int Mod_idP,
|
||||
int UE_id,
|
||||
uint16_t nr_get_csi_bitlen(NR_UE_info_t *UE,
|
||||
uint8_t csi_report_id) {
|
||||
|
||||
uint16_t csi_bitlen = 0;
|
||||
uint16_t max_bitlen = 0;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
L1_RSRP_bitlen_t * CSI_report_bitlen = NULL;
|
||||
CSI_Meas_bitlen_t * csi_meas_bitlen = NULL;
|
||||
|
||||
if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type||
|
||||
NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type){
|
||||
CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements
|
||||
if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP==UE->csi_report_template[csi_report_id].reportQuantity_type||
|
||||
NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP==UE->csi_report_template[csi_report_id].reportQuantity_type){
|
||||
CSI_report_bitlen = &(UE->csi_report_template[csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements
|
||||
csi_bitlen+= ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) +
|
||||
CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen *
|
||||
(CSI_report_bitlen->nb_ssbri_cri -1 )));
|
||||
} else{
|
||||
csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements
|
||||
csi_meas_bitlen = &(UE->csi_report_template[csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements
|
||||
uint16_t temp_bitlen;
|
||||
for (int i=0; i<8; i++) {
|
||||
temp_bitlen = (csi_meas_bitlen->cri_bitlen+
|
||||
@@ -705,11 +700,10 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_list_t *UE_list = &UE_info->list;
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
const NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
UE_iterator(RC.nrmac[Mod_idP]->UE_info.list, UE ) {
|
||||
const NR_CellGroupConfig_t *CellGroup = UE->CellGroup;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
if ((sched_ctrl->rrc_processing_timer > 0) || (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0)) {
|
||||
continue;
|
||||
}
|
||||
@@ -752,7 +746,7 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
if (*pucchresset->resourceList.list.array[res_index] == pucchcsires->pucch_Resource)
|
||||
break;
|
||||
AssertFatal(res_index < n,
|
||||
"CSI pucch resource %ld not found among PUCCH resources\n",pucchcsires->pucch_Resource);
|
||||
"CSI pucch resource %ld not found among PUCCH resources\n", pucchcsires->pucch_Resource);
|
||||
|
||||
// find free PUCCH that is in order with possibly existing PUCCH
|
||||
// schedulings (other CSI, SR)
|
||||
@@ -761,13 +755,12 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
&& !curr_pucch->sr_flag
|
||||
&& curr_pucch->dai_c == 0,
|
||||
"PUCCH not free at index 1 for UE %04x\n",
|
||||
UE_info->rnti[UE_id]);
|
||||
UE->rnti);
|
||||
curr_pucch->r_pucch = -1;
|
||||
curr_pucch->frame = frame;
|
||||
curr_pucch->ul_slot = sched_slot;
|
||||
curr_pucch->resource_indicator = res_index;
|
||||
curr_pucch->csi_bits +=
|
||||
nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id);
|
||||
curr_pucch->csi_bits += nr_get_csi_bitlen(UE,csi_report_id);
|
||||
|
||||
const NR_SIB1_t *sib1 = RC.nrmac[Mod_idP]->common_channels[0].sib1 ? RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
|
||||
NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp,
|
||||
@@ -819,37 +812,37 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((unused))
|
||||
static void handle_dl_harq(module_id_t mod_id,
|
||||
int UE_id,
|
||||
static void handle_dl_harq(NR_UE_info_t * UE,
|
||||
int8_t harq_pid,
|
||||
bool success)
|
||||
bool success,
|
||||
int harq_round_max)
|
||||
{
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[harq_pid];
|
||||
NR_UE_harq_t *harq = &UE->UE_sched_ctrl.harq_processes[harq_pid];
|
||||
harq->feedback_slot = -1;
|
||||
harq->is_waiting = false;
|
||||
if (success) {
|
||||
add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid);
|
||||
add_tail_nr_list(&UE->UE_sched_ctrl.available_dl_harq, harq_pid);
|
||||
harq->round = 0;
|
||||
harq->ndi ^= 1;
|
||||
} else if (harq->round >= RC.nrmac[mod_id]->harq_round_max - 1) {
|
||||
add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid);
|
||||
|
||||
} else if (harq->round >= harq_round_max - 1) {
|
||||
add_tail_nr_list(&UE->UE_sched_ctrl.available_dl_harq, harq_pid);
|
||||
harq->round = 0;
|
||||
harq->ndi ^= 1;
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
stats->dlsch_errors++;
|
||||
LOG_D(NR_MAC, "retransmission error for UE %d (total %"PRIu64")\n", UE_id, stats->dlsch_errors);
|
||||
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
stats->dl.errors++;
|
||||
LOG_D(NR_MAC, "retransmission error for UE %04x (total %"PRIu64")\n", UE->rnti, stats->dl.errors);
|
||||
|
||||
} else {
|
||||
LOG_D(PHY,"NACK for: pid %d, ue %x\n",harq_pid, UE_id);
|
||||
add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid);
|
||||
LOG_D(PHY,"NACK for: pid %d, ue %04x\n",harq_pid, UE->rnti);
|
||||
add_tail_nr_list(&UE->UE_sched_ctrl.retrans_dl_harq, harq_pid);
|
||||
harq->round++;
|
||||
}
|
||||
}
|
||||
|
||||
int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) {
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ;
|
||||
int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, NR_UE_info_t * UE) {
|
||||
NR_CellGroupConfig_t *CellGroup = UE->CellGroup;
|
||||
int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count;
|
||||
NR_TCI_State_t *tci =NULL;
|
||||
int i;
|
||||
@@ -874,13 +867,12 @@ int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, i
|
||||
return -1;
|
||||
}
|
||||
|
||||
int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) {
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ;
|
||||
int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, NR_UE_info_t *UE) {
|
||||
NR_CellGroupConfig_t *CellGroup = UE->CellGroup ;
|
||||
int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count;
|
||||
NR_TCI_State_t *tci =NULL;
|
||||
NR_TCI_StateId_t *tci_id = NULL;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
NR_ControlResourceSet_t *coreset = sched_ctrl->coreset;
|
||||
int i;
|
||||
int flag = 0;
|
||||
@@ -935,7 +927,7 @@ int get_diff_rsrp(uint8_t index, int strongest_rsrp) {
|
||||
//identifies the target SSB Beam index
|
||||
//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally
|
||||
//handles triggering of PDCCH and PDSCH MAC CEs
|
||||
void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
void tci_handling(NR_UE_info_t *UE, frame_t frame, slot_t slot) {
|
||||
|
||||
int strongest_ssb_rsrp = 0;
|
||||
int cqi_idx = 0;
|
||||
@@ -947,10 +939,10 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
int ssb_index[MAX_NUM_SSB] = {0};
|
||||
int ssb_rsrp[MAX_NUM_SSB] = {0};
|
||||
uint8_t idx = 0;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
const int bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
|
||||
NR_CellGroupConfig_t *CellGroup = UE->CellGroup;
|
||||
|
||||
//bwp indicator
|
||||
int n_dl_bwp=0;
|
||||
@@ -960,7 +952,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
n_dl_bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
|
||||
uint8_t nr_ssbri_cri = 0;
|
||||
uint8_t nb_of_csi_ssb_report = UE_info->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report;
|
||||
uint8_t nb_of_csi_ssb_report = UE->csi_report_template[cqi_idx].nb_of_csi_ssb_report;
|
||||
int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially
|
||||
uint8_t diff_rsrp_idx = 0;
|
||||
uint8_t i, j;
|
||||
@@ -1031,7 +1023,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
The length of the field is 7 bits
|
||||
*/
|
||||
if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) {
|
||||
int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id);
|
||||
int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], UE);
|
||||
|
||||
if( tci_state_id != -1)
|
||||
sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id;
|
||||
@@ -1041,7 +1033,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
int flag = 0;
|
||||
|
||||
for(i =0; ssb_index_sorted[i]!=0; i++) {
|
||||
tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i], Mod_idP, UE_id) ;
|
||||
tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i],UE) ;
|
||||
|
||||
if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) {
|
||||
sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id;
|
||||
@@ -1055,7 +1047,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id);
|
||||
int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], UE);
|
||||
|
||||
if (tci_state_id !=-1)
|
||||
sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id;
|
||||
@@ -1065,7 +1057,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
int flag = 0;
|
||||
|
||||
for(i =0; ssb_index_sorted[i]!=0; i++) {
|
||||
tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], Mod_idP, UE_id);
|
||||
tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], UE);
|
||||
|
||||
if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) {
|
||||
sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id;
|
||||
@@ -1126,15 +1118,14 @@ uint8_t pickandreverse_bits(uint8_t *payload, uint16_t bitlen, uint8_t start_bit
|
||||
}
|
||||
|
||||
|
||||
void evaluate_rsrp_report(NR_UE_info_t *UE_info,
|
||||
void evaluate_rsrp_report(NR_UE_info_t *UE,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
int UE_id,
|
||||
uint8_t csi_report_id,
|
||||
uint8_t *payload,
|
||||
int *cumul_bits,
|
||||
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){
|
||||
|
||||
nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id];
|
||||
nr_csi_report_t *csi_report = &UE->csi_report_template[csi_report_id];
|
||||
uint8_t cri_ssbri_bitlen = csi_report->CSI_report_bitlen.cri_ssbri_bitlen;
|
||||
uint16_t curr_payload;
|
||||
|
||||
@@ -1186,7 +1177,7 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info,
|
||||
}
|
||||
csi_report->nb_of_csi_ssb_report++;
|
||||
int strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report.ssb_cri_report.RSRP);
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
// including ssb rsrp in mac stats
|
||||
stats->cumul_rsrp += strongest_ssb_rsrp;
|
||||
stats->num_rsrp_meas++;
|
||||
@@ -1250,7 +1241,12 @@ void evaluate_cqi_report(uint8_t *payload,
|
||||
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi;
|
||||
LOG_D(MAC,"Wide-band CQI for the second TB %d\n", temp_cqi);
|
||||
}
|
||||
sched_ctrl->set_mcs = true;
|
||||
|
||||
// TODO for wideband case and multiple TB
|
||||
const int cqi_idx = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb;
|
||||
const int mcs_table = sched_ctrl->pdsch_semi_static.mcsTableIdx;
|
||||
const int cqi_table = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table;
|
||||
sched_ctrl->dl_max_mcs = get_mcs_from_cqi(mcs_table, cqi_table, cqi_idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -1319,22 +1315,19 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu,
|
||||
frame_t frame,
|
||||
slot_t slot,
|
||||
int UE_id,
|
||||
module_id_t Mod_idP) {
|
||||
|
||||
NR_UE_info_t *UE,
|
||||
NR_ServingCellConfigCommon_t *scc)
|
||||
{
|
||||
/** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */
|
||||
NR_ServingCellConfigCommon_t *scc =
|
||||
RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload;
|
||||
uint16_t bitlen = uci_pdu->csi_part1.csi_part1_bit_len;
|
||||
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING;
|
||||
NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
int cumul_bits = 0;
|
||||
int r_index = -1;
|
||||
for (int csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) {
|
||||
nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id];
|
||||
nr_csi_report_t *csi_report = &UE->csi_report_template[csi_report_id];
|
||||
csi_report->nb_of_csi_ssb_report = 0;
|
||||
uint8_t cri_bitlen = 0;
|
||||
uint8_t ri_bitlen = 0;
|
||||
@@ -1349,10 +1342,10 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
LOG_D(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type);
|
||||
switch(reportQuantity_type){
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP:
|
||||
evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type);
|
||||
evaluate_rsrp_report(UE,sched_ctrl,csi_report_id,payload,&cumul_bits,reportQuantity_type);
|
||||
break;
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP:
|
||||
evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type);
|
||||
evaluate_rsrp_report(UE,sched_ctrl,csi_report_id,payload,&cumul_bits,reportQuantity_type);
|
||||
break;
|
||||
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI:
|
||||
cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen;
|
||||
@@ -1408,7 +1401,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
}
|
||||
}
|
||||
|
||||
static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t slot, int UE_id)
|
||||
static NR_UE_harq_t *find_harq(frame_t frame, sub_frame_t slot, NR_UE_info_t * UE, int harq_round_max)
|
||||
{
|
||||
/* In case of realtime problems: we can only identify a HARQ process by
|
||||
* timing. If the HARQ process's feedback_frame/feedback_slot is not the one we
|
||||
@@ -1416,7 +1409,7 @@ static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t sl
|
||||
* skip this HARQ process, which is what happens in the loop below.
|
||||
* Similarly, we might be "in advance", in which case we need to skip
|
||||
* this result. */
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
int8_t pid = sched_ctrl->feedback_dl_harq.head;
|
||||
if (pid < 0)
|
||||
return NULL;
|
||||
@@ -1432,7 +1425,7 @@ static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t sl
|
||||
frame,
|
||||
slot);
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
handle_dl_harq(mod_id, UE_id, pid, 0);
|
||||
handle_dl_harq(UE, pid, 0, harq_round_max);
|
||||
pid = sched_ctrl->feedback_dl_harq.head;
|
||||
if (pid < 0)
|
||||
return NULL;
|
||||
@@ -1457,20 +1450,19 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
|
||||
sub_frame_t slot,
|
||||
const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01)
|
||||
{
|
||||
int UE_id = find_nr_UE_id(mod_id, uci_01->rnti);
|
||||
if (UE_id < 0) {
|
||||
NR_UE_info_t * UE = find_nr_UE(&RC.nrmac[mod_id]->UE_info, uci_01->rnti);
|
||||
if (!UE) {
|
||||
LOG_E(NR_MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_01->rnti);
|
||||
return;
|
||||
}
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
if (((uci_01->pduBitmap >> 1) & 0x01)) {
|
||||
// iterate over received harq bits
|
||||
for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) {
|
||||
const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value;
|
||||
const uint8_t harq_confidence = uci_01->harq->harq_confidence_level;
|
||||
NR_UE_harq_t *harq = find_harq(mod_id, frame, slot, UE_id);
|
||||
NR_UE_harq_t *harq = find_harq(frame, slot, UE, RC.nrmac[mod_id]->harq_round_max);
|
||||
if (!harq) {
|
||||
LOG_E(NR_MAC, "Oh no! Could not find a harq in %s!\n", __FUNCTION__);
|
||||
break;
|
||||
@@ -1479,8 +1471,8 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
|
||||
const int8_t pid = sched_ctrl->feedback_dl_harq.head;
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
LOG_D(NR_MAC,"%4d.%2d bit %d pid %d ack/nack %d\n",frame, slot, harq_bit,pid,harq_value);
|
||||
handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0);
|
||||
if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++;
|
||||
handle_dl_harq(UE, pid, harq_value == 0 && harq_confidence == 0, RC.nrmac[mod_id]->harq_round_max);
|
||||
if (harq_confidence == 1) UE->mac_stats.pucch0_DTX++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1505,19 +1497,21 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
sub_frame_t slot,
|
||||
const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234)
|
||||
{
|
||||
int UE_id = find_nr_UE_id(mod_id, uci_234->rnti);
|
||||
if (UE_id < 0) {
|
||||
NR_UE_info_t * UE = find_nr_UE(&RC.nrmac[mod_id]->UE_info, uci_234->rnti);
|
||||
if (!UE) {
|
||||
LOG_E(NR_MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti);
|
||||
return;
|
||||
}
|
||||
AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id],"Cellgroup is null for UE %d/%x\n",UE_id,uci_234->rnti);
|
||||
AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig, "Cellgroup->spCellConfig is null for UE %d/%x\n",UE_id,uci_234->rnti);
|
||||
AssertFatal(RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated, "Cellgroup->spCellConfig->spCellConfigDedicated is null for UE %d/%x\n",UE_id,uci_234->rnti);
|
||||
if ( RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig==NULL) return;
|
||||
AssertFatal(UE->CellGroup,"Cellgroup is null for UE %04x\n", uci_234->rnti);
|
||||
AssertFatal(UE->CellGroup->spCellConfig,
|
||||
"Cellgroup->spCellConfig is null for UE %04x\n", uci_234->rnti);
|
||||
AssertFatal(UE->CellGroup->spCellConfig->spCellConfigDedicated,
|
||||
"Cellgroup->spCellConfig->spCellConfigDedicated is null for UE %04x\n", uci_234->rnti);
|
||||
if ( UE->CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig==NULL)
|
||||
return;
|
||||
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = UE->CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
// tpc (power control)
|
||||
// TODO PUCCH2 SNR computation is not correct -> ignore the following
|
||||
@@ -1530,20 +1524,20 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
// iterate over received harq bits
|
||||
for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) {
|
||||
const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01;
|
||||
NR_UE_harq_t *harq = find_harq(mod_id, frame, slot, UE_id);
|
||||
NR_UE_harq_t *harq = find_harq(frame, slot, UE, RC.nrmac[mod_id]->harq_round_max);
|
||||
if (!harq)
|
||||
break;
|
||||
DevAssert(harq->is_waiting);
|
||||
const int8_t pid = sched_ctrl->feedback_dl_harq.head;
|
||||
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack);
|
||||
handle_dl_harq(UE, pid, uci_234->harq.harq_crc != 1 && acknack, RC.nrmac[mod_id]->harq_round_max);
|
||||
}
|
||||
}
|
||||
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_id, mod_id);
|
||||
extract_pucch_csi_report(csi_MeasConfig, uci_234, frame, slot, UE, RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon);
|
||||
//TCI handling function
|
||||
tci_handling(mod_id, UE_id,frame, slot);
|
||||
tci_handling(UE,frame, slot);
|
||||
}
|
||||
if ((uci_234->pduBitmap >> 3) & 0x01) {
|
||||
//@TODO:Handle CSI Report 2
|
||||
@@ -1611,12 +1605,11 @@ bool test_acknack_vrb_occupation(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
// if the function returns -1 it was not possible to schedule acknack
|
||||
// when current pucch is ready to be scheduled nr_fill_nfapi_pucch is called
|
||||
int nr_acknack_scheduling(int mod_id,
|
||||
int UE_id,
|
||||
NR_UE_info_t *UE,
|
||||
frame_t frame,
|
||||
sub_frame_t slot,
|
||||
int r_pucch,
|
||||
int is_common) {
|
||||
|
||||
const int CC_id = 0;
|
||||
const int minfbtime = RC.nrmac[mod_id]->minRXTXTIMEpdsch;
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels[CC_id].ServingCellConfigCommon;
|
||||
@@ -1634,8 +1627,8 @@ int nr_acknack_scheduling(int mod_id,
|
||||
* * SR uses format 0 and is allocated in the first UL (mixed) slot (and not
|
||||
* later)
|
||||
* * each UE has dedicated PUCCH Format 0 resources, and we use index 0! */
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id];
|
||||
NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
NR_CellGroupConfig_t *cg = UE->CellGroup;
|
||||
|
||||
NR_PUCCH_Config_t *pucch_Config = NULL;
|
||||
if (sched_ctrl->active_ubwp) {
|
||||
@@ -1670,11 +1663,13 @@ int nr_acknack_scheduling(int mod_id,
|
||||
const int f = pucch->frame;
|
||||
const int s = pucch->ul_slot;
|
||||
LOG_D(NR_MAC, "In %s: %4d.%2d DAI = 2 pucch currently in %4d.%2d, advancing by 1 slot\n", __FUNCTION__, frame, slot, f, s);
|
||||
|
||||
if (!(csi_pucch
|
||||
&& csi_pucch->csi_bits > 0
|
||||
&& csi_pucch->frame == f
|
||||
&& csi_pucch->ul_slot == s))
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id);
|
||||
&& csi_pucch->csi_bits > 0
|
||||
&& csi_pucch->frame == f
|
||||
&& csi_pucch->ul_slot == s))
|
||||
nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, pucch, UE);
|
||||
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
if(((s + 1)%nr_slots_period) == 0)
|
||||
@@ -1691,7 +1686,8 @@ int nr_acknack_scheduling(int mod_id,
|
||||
&& csi_pucch->ul_slot == pucch->ul_slot
|
||||
&& !csi_pucch->simultaneous_harqcsi) {
|
||||
LOG_D(NR_MAC,"Cannot multiplex csi_pucch for %d.%d\n",csi_pucch->frame,csi_pucch->ul_slot);
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id);
|
||||
nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, csi_pucch, UE);
|
||||
|
||||
memset(csi_pucch, 0, sizeof(*csi_pucch));
|
||||
pucch->frame = pucch->ul_slot == n_slots_frame - 1 ? (pucch->frame + 1) % 1024 : pucch->frame;
|
||||
if(((pucch->ul_slot + 1)%nr_slots_period) == 0)
|
||||
@@ -1718,7 +1714,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
const int bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
|
||||
int max_fb_time = 0;
|
||||
get_pdsch_to_harq_feedback(mod_id, UE_id, bwp_id, ss_type, &max_fb_time, pdsch_to_harq_feedback);
|
||||
get_pdsch_to_harq_feedback(UE, bwp_id, ss_type, &max_fb_time, pdsch_to_harq_feedback);
|
||||
|
||||
LOG_D(NR_MAC, "In %s: 1b. DL %4d.%2d, UL_ACK %4d.%2d, DAI_C %d\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c);
|
||||
/* there is a HARQ. Check whether we can use it for this ACKNACK */
|
||||
@@ -1745,14 +1741,14 @@ int nr_acknack_scheduling(int mod_id,
|
||||
csi_pucch->csi_bits > 0 &&
|
||||
csi_pucch->frame == f &&
|
||||
csi_pucch->ul_slot == s))
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id);
|
||||
nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, pucch, UE);
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
if(((s + 1)%nr_slots_period) == 0)
|
||||
pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame;
|
||||
else
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot, r_pucch,is_common);
|
||||
return nr_acknack_scheduling(mod_id, UE, frame, slot, r_pucch,is_common);
|
||||
}
|
||||
|
||||
pucch->timing_indicator = i;
|
||||
@@ -1778,8 +1774,8 @@ int nr_acknack_scheduling(int mod_id,
|
||||
((pucch->frame*n_slots_frame + pucch->ul_slot) <
|
||||
(frame*n_slots_frame + slot))) {
|
||||
AssertFatal(pucch->sr_flag + pucch->dai_c == 0,
|
||||
"expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n",
|
||||
UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot);
|
||||
"expected no SR/AckNack for UE %04x in %4d.%2d, but has %d/%d for %4d.%2d\n",
|
||||
UE->rnti, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot);
|
||||
const int s = next_ul_slot;
|
||||
pucch->frame = s < n_slots_frame ? frame : (frame + 1) % 1024;
|
||||
pucch->ul_slot = s % n_slots_frame;
|
||||
@@ -1829,11 +1825,11 @@ int nr_acknack_scheduling(int mod_id,
|
||||
}
|
||||
if (ind_found==-1) {
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d could not find pdsch_to_harq_feedback for UE %d: earliest "
|
||||
"%4d.%2d could not find pdsch_to_harq_feedback for UE %04x: earliest "
|
||||
"ack slot %d\n",
|
||||
frame,
|
||||
slot,
|
||||
UE_id,
|
||||
UE->rnti,
|
||||
pucch->ul_slot);
|
||||
return -1;
|
||||
}
|
||||
@@ -1847,8 +1843,9 @@ int nr_acknack_scheduling(int mod_id,
|
||||
// FIXME currently we support at most 11 bits in pucch2 so skip also in that case
|
||||
if(!csi_pucch->simultaneous_harqcsi
|
||||
|| ((csi_pucch->csi_bits + csi_pucch->dai_c) >= 11)) {
|
||||
|
||||
LOG_D(NR_MAC,"Cannot multiplex csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot);
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id);
|
||||
nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, csi_pucch, UE);
|
||||
memset(csi_pucch, 0, sizeof(*csi_pucch));
|
||||
/* advance the UL slot information in PUCCH by one so we won't schedule in
|
||||
* the same slot again */
|
||||
@@ -1860,7 +1857,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame;
|
||||
else
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot, r_pucch,is_common);
|
||||
return nr_acknack_scheduling(mod_id, UE, frame, slot, r_pucch,is_common);
|
||||
}
|
||||
// multiplexing harq and csi in a pucch
|
||||
else {
|
||||
@@ -1897,31 +1894,27 @@ int nr_acknack_scheduling(int mod_id,
|
||||
}
|
||||
|
||||
|
||||
void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
|
||||
{
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP];
|
||||
if (!is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[slot / 64], slot))
|
||||
return;
|
||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
||||
NR_list_t *UE_list = &UE_info->list;
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
UE_iterator(nrmac->UE_info.list, UE) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
|
||||
if (sched_ctrl->ul_failure==1) continue;
|
||||
if (sched_ctrl->ul_failure==1 || sched_ctrl->rrc_processing_timer>0) continue;
|
||||
NR_PUCCH_Config_t *pucch_Config = NULL;
|
||||
if (sched_ctrl->active_ubwp) {
|
||||
pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
|
||||
} else if (RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id] &&
|
||||
RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig &&
|
||||
RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated &&
|
||||
RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP &&
|
||||
RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) {
|
||||
pucch_Config = RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
} else if (UE->CellGroup &&
|
||||
UE->CellGroup->spCellConfig &&
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP &&
|
||||
UE->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) {
|
||||
pucch_Config = UE->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
}
|
||||
|
||||
else continue;
|
||||
if (!pucch_Config->schedulingRequestResourceToAddModList)
|
||||
continue;
|
||||
@@ -1966,7 +1959,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
continue;
|
||||
nfapi_nr_pucch_pdu_t *pdu = &ul_tti_req->pdus_list[i].pucch_pdu;
|
||||
/* check that it is our PUCCH F0. Assuming there can be only one */
|
||||
if (pdu->rnti == UE_info->rnti[UE_id]
|
||||
if (pdu->rnti == UE->rnti
|
||||
&& pdu->format_type == 0 // does not use NR_PUCCH_Resource__format_PR_format0
|
||||
&& pdu->initial_cyclic_shift == pucch_res->format.choice.format0->initialCyclicShift
|
||||
&& pdu->nr_of_symbols == pucch_res->format.choice.format0->nrofSymbols
|
||||
@@ -1975,8 +1968,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
pdu->sr_flag = 1;
|
||||
nfapi_allocated = true;
|
||||
break;
|
||||
}
|
||||
else if (pdu->rnti == UE_info->rnti[UE_id]
|
||||
} else if (pdu->rnti == UE->rnti
|
||||
&& pdu->format_type == 2 // does not use NR_PUCCH_Resource__format_PR_format0
|
||||
&& pdu->nr_of_symbols == pucch_res->format.choice.format2->nrofSymbols
|
||||
&& pdu->start_symbol_index == pucch_res->format.choice.format2->startingSymbolIndex) {
|
||||
@@ -1984,9 +1976,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
pdu->sr_flag = 1;
|
||||
nfapi_allocated = true;
|
||||
break;
|
||||
|
||||
}
|
||||
else if (pdu->rnti == UE_info->rnti[UE_id]
|
||||
} else if (pdu->rnti == UE->rnti
|
||||
&& pdu->format_type == 1 // does not use NR_PUCCH_Resource__format_PR_format0
|
||||
&& pdu->nr_of_symbols == pucch_res->format.choice.format1->nrofSymbols
|
||||
&& pdu->start_symbol_index == pucch_res->format.choice.format1->startingSymbolIndex) {
|
||||
@@ -1994,9 +1984,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
pdu->sr_flag = 1;
|
||||
nfapi_allocated = true;
|
||||
break;
|
||||
|
||||
}
|
||||
else if (pdu->rnti == UE_info->rnti[UE_id]
|
||||
} else if (pdu->rnti == UE->rnti
|
||||
&& pdu->format_type == 3 // does not use NR_PUCCH_Resource__format_PR_format0
|
||||
&& pdu->nr_of_symbols == pucch_res->format.choice.format3->nrofSymbols
|
||||
&& pdu->start_symbol_index == pucch_res->format.choice.format3->startingSymbolIndex) {
|
||||
@@ -2004,9 +1992,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
pdu->sr_flag = 1;
|
||||
nfapi_allocated = true;
|
||||
break;
|
||||
|
||||
}
|
||||
else if (pdu->rnti == UE_info->rnti[UE_id]
|
||||
} else if (pdu->rnti == UE->rnti
|
||||
&& pdu->format_type == 4 // does not use NR_PUCCH_Resource__format_PR_format0
|
||||
&& pdu->nr_of_symbols == pucch_res->format.choice.format4->nrofSymbols
|
||||
&& pdu->start_symbol_index == pucch_res->format.choice.format4->startingSymbolIndex) {
|
||||
@@ -2014,7 +2000,6 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
pdu->sr_flag = 1;
|
||||
nfapi_allocated = true;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2038,7 +2023,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
.resource_indicator = found,
|
||||
.r_pucch = -1
|
||||
};
|
||||
nr_fill_nfapi_pucch(Mod_idP, SFN, slot, &sched_sr, UE_id);
|
||||
nr_fill_nfapi_pucch(nrmac, SFN, slot, &sched_sr, UE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,6 @@ void mac_top_init_gNB(void);
|
||||
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc);
|
||||
@@ -52,7 +51,6 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP,
|
||||
uint32_t rrc_reconfiguration_delay);
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
int sib1_tda,
|
||||
@@ -203,7 +201,7 @@ void config_uldci(const NR_SIB1_t *sib1,
|
||||
int n_ubwp,
|
||||
int bwp_id);
|
||||
|
||||
void nr_schedule_pucch(int Mod_idP,
|
||||
void nr_schedule_pucch(gNB_MAC_INST* nrmac,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
|
||||
@@ -218,15 +216,14 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
|
||||
int nr_acknack_scheduling(int Mod_idP,
|
||||
int UE_id,
|
||||
int nr_acknack_scheduling( int Mod_idP,
|
||||
NR_UE_info_t * UE,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
int r_pucch,
|
||||
int do_common);
|
||||
|
||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int UE_id,
|
||||
void get_pdsch_to_harq_feedback(NR_UE_info_t *,
|
||||
int bwp_id,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type,
|
||||
int *max_fb_time,
|
||||
@@ -291,7 +288,7 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
|
||||
int nr_of_candidates,
|
||||
NR_sched_pdcch_t *pdcch,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
uint16_t Y);
|
||||
uint32_t Y);
|
||||
|
||||
void fill_pdcch_vrb_map(gNB_MAC_INST *mac,
|
||||
int CC_id,
|
||||
@@ -336,7 +333,7 @@ NR_PDSCH_TimeDomainResourceAllocationList_t *get_pdsch_TimeDomainAllocationList(
|
||||
const NR_SIB1_t *sib1);
|
||||
|
||||
/* find coreset within the search space */
|
||||
NR_ControlResourceSet_t *get_coreset(module_id_t module_idP,
|
||||
NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
void *bwp,
|
||||
NR_SearchSpace_t *ss,
|
||||
@@ -374,8 +371,6 @@ void nr_set_pusch_semi_static(const NR_SIB1_t *sib1,
|
||||
uint8_t nrOfLayers,
|
||||
NR_pusch_semi_static_t *ps);
|
||||
|
||||
uint16_t get_Y(int cid, int slot, rnti_t rnti);
|
||||
|
||||
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr);
|
||||
|
||||
int get_spf(nfapi_nr_config_request_scf_t *cfg);
|
||||
@@ -388,20 +383,12 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead,
|
||||
uint8_t numdmrscdmgroupnodata,
|
||||
uint8_t tb_scaling);
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for uplink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB);
|
||||
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
|
||||
|
||||
/* Functions to manage an NR_list_t */
|
||||
void dump_nr_list(NR_list_t *listP);
|
||||
void create_nr_list(NR_list_t *listP, int len);
|
||||
void resize_nr_list(NR_list_t *list, int new_len);
|
||||
void destroy_nr_list(NR_list_t *list);
|
||||
@@ -411,27 +398,19 @@ void add_tail_nr_list(NR_list_t *listP, int id);
|
||||
void add_front_nr_list(NR_list_t *listP, int id);
|
||||
void remove_front_nr_list(NR_list_t *listP);
|
||||
|
||||
int find_nr_UE_id(module_id_t mod_idP, 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);
|
||||
|
||||
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup);
|
||||
NR_UE_info_t*add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup);
|
||||
|
||||
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
|
||||
void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti);
|
||||
|
||||
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti);
|
||||
|
||||
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
int aggregation,
|
||||
uint16_t Y,
|
||||
int m,
|
||||
int nr_of_candidates);
|
||||
|
||||
int nr_get_default_pucch_res(int pucch_ResourceCommon);
|
||||
|
||||
void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP);
|
||||
void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE);
|
||||
|
||||
int get_dlscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
@@ -439,16 +418,6 @@ int get_ulscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
void config_nr_mib(int Mod_idP,
|
||||
int CC_idP,
|
||||
int p_gNBP,
|
||||
int subCarrierSpacingCommon,
|
||||
uint32_t ssb_SubcarrierOffset,
|
||||
int dmrs_TypeA_Position,
|
||||
uint32_t pdcch_ConfigSIB1,
|
||||
int cellBarred,
|
||||
int intraFreqReselection);
|
||||
|
||||
int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
const NR_UE_sched_ctrl_t *ue_sched_ctl,
|
||||
unsigned char *mac_pdu,
|
||||
@@ -491,6 +460,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
const NR_PDSCH_ServingCellConfig_t *pdsch);
|
||||
|
||||
void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
void handle_nr_ul_harq(const int CC_idP,
|
||||
module_id_t mod_id,
|
||||
frame_t frame,
|
||||
@@ -514,18 +487,15 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
int xp_pdsch_antenna_ports,
|
||||
int codebook_mode);
|
||||
|
||||
void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
uint8_t *target_mcs,
|
||||
uint8_t mcs_table_idx);
|
||||
uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx);
|
||||
|
||||
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp);
|
||||
void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp);
|
||||
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
|
||||
const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
|
||||
|
||||
bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id);
|
||||
bool find_free_CCE(sub_frame_t slot, NR_UE_info_t *UE);
|
||||
|
||||
bool nr_find_nb_rb(uint16_t Qm,
|
||||
uint16_t R,
|
||||
@@ -538,9 +508,17 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
uint32_t *tbs,
|
||||
uint16_t *nb_rb);
|
||||
|
||||
void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP);
|
||||
int get_mcs_from_bler(const NR_bler_options_t *bler_options,
|
||||
const NR_mac_dir_stats_t *stats,
|
||||
NR_bler_stats_t *bler_stats,
|
||||
int max_mcs,
|
||||
frame_t frame);
|
||||
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp);
|
||||
void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCommon_t *scc, int n, int CCid);
|
||||
|
||||
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP);
|
||||
|
||||
size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp);
|
||||
|
||||
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
|
||||
@@ -45,107 +45,130 @@
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
#define MACSTATSSTRLEN 16384
|
||||
#define MACSTATSSTRLEN 65536
|
||||
|
||||
void *nrmac_stats_thread(void *arg) {
|
||||
|
||||
gNB_MAC_INST *gNB = (gNB_MAC_INST *)arg;
|
||||
|
||||
char output[MACSTATSSTRLEN];
|
||||
memset(output,0,MACSTATSSTRLEN);
|
||||
FILE *fd=fopen("nrMAC_stats.log","w");
|
||||
AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
|
||||
char output[MACSTATSSTRLEN] = {0};
|
||||
const char *end = output + MACSTATSSTRLEN;
|
||||
FILE *file = fopen("nrMAC_stats.log","w");
|
||||
AssertFatal(file!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
|
||||
|
||||
while (oai_exit == 0) {
|
||||
dump_mac_stats(gNB,output,MACSTATSSTRLEN,false);
|
||||
fprintf(fd,"%s\n",output);
|
||||
fflush(fd);
|
||||
usleep(200000);
|
||||
fseek(fd,0,SEEK_SET);
|
||||
char *p = output;
|
||||
p += dump_mac_stats(gNB, p, end - p, false);
|
||||
p += snprintf(p, end - p, "\n");
|
||||
p += print_meas_log(&gNB->eNB_scheduler, "DL & UL scheduling timing", NULL, NULL, p, end - p);
|
||||
p += print_meas_log(&gNB->schedule_dlsch, "dlsch scheduler", NULL, NULL, p, end - p);
|
||||
p += print_meas_log(&gNB->rlc_data_req, "rlc_data_req", NULL, NULL, p, end - p);
|
||||
p += print_meas_log(&gNB->rlc_status_ind, "rlc_status_ind", NULL, NULL, p, end - p);
|
||||
fwrite(output, p - output, 1, file);
|
||||
fflush(file);
|
||||
sleep(1);
|
||||
fseek(file,0,SEEK_SET);
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void clear_mac_stats(gNB_MAC_INST *gNB) {
|
||||
memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t));
|
||||
UE_iterator(gNB->UE_info.list, UE) {
|
||||
memset(&UE->mac_stats,0,sizeof(UE->mac_stats));
|
||||
}
|
||||
}
|
||||
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp)
|
||||
size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp)
|
||||
{
|
||||
NR_UE_info_t *UE_info = &gNB->UE_info;
|
||||
int num = 1;
|
||||
const char *begin = output;
|
||||
const char *end = output + strlen;
|
||||
|
||||
int stroff=0;
|
||||
if (UE_info->num_UEs == 0) return;
|
||||
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
|
||||
|
||||
const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
pthread_mutex_lock(&gNB->UE_info.mutex);
|
||||
UE_iterator(gNB->UE_info.list, UE) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
|
||||
stroff+=sprintf(output+stroff,"UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
|
||||
UE_id,
|
||||
UE_info->rnti[UE_id],
|
||||
num++,
|
||||
UE_info->num_UEs,
|
||||
sched_ctrl->ph,
|
||||
sched_ctrl->pcmax,
|
||||
avg_rsrp,
|
||||
stats->num_rsrp_meas);
|
||||
stroff+=sprintf(output+stroff,"UE %d: CQI %d, RI %d, PMI (%d,%d)\n",
|
||||
UE_id,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.ri+1,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
|
||||
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n",
|
||||
UE_id,
|
||||
stats->dlsch_rounds[0], stats->dlsch_rounds[1],
|
||||
stats->dlsch_rounds[2], stats->dlsch_rounds[3],
|
||||
stats->dlsch_errors,
|
||||
stats->pucch0_DTX,
|
||||
sched_ctrl->dl_bler_stats.bler,
|
||||
sched_ctrl->dl_bler_stats.mcs);
|
||||
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
|
||||
UE->rnti,
|
||||
num++,
|
||||
sched_ctrl->ph,
|
||||
sched_ctrl->pcmax,
|
||||
avg_rsrp,
|
||||
stats->num_rsrp_meas);
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: CQI %d, RI %d, PMI (%d,%d)\n",
|
||||
UE->rnti,
|
||||
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb,
|
||||
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.ri+1,
|
||||
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
|
||||
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
|
||||
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n",
|
||||
UE->rnti,
|
||||
stats->dl.rounds[0], stats->dl.rounds[1],
|
||||
stats->dl.rounds[2], stats->dl.rounds[3],
|
||||
stats->dl.errors,
|
||||
stats->pucch0_DTX,
|
||||
sched_ctrl->dl_bler_stats.bler,
|
||||
sched_ctrl->dl_bler_stats.mcs);
|
||||
if (reset_rsrp) {
|
||||
stats->num_rsrp_meas = 0;
|
||||
stats->cumul_rsrp = 0;
|
||||
}
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %"PRIu64"\n", UE_id, stats->dlsch_total_bytes);
|
||||
stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", ulsch_DTX %d, ulsch_errors %"PRIu64"\n",
|
||||
UE_id,
|
||||
stats->ulsch_rounds[0], stats->ulsch_rounds[1],
|
||||
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
|
||||
stats->ulsch_DTX,
|
||||
stats->ulsch_errors);
|
||||
stroff+=sprintf(output+stroff,
|
||||
"UE %d: ulsch_total_bytes_scheduled %"PRIu64", ulsch_total_bytes_received %"PRIu64"\n",
|
||||
UE_id,
|
||||
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: dlsch_total_bytes %"PRIu64"\n",
|
||||
UE->rnti,
|
||||
stats->dl.total_bytes);
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: ulsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", ulsch_DTX %d, ulsch_errors %"PRIu64", BLER %.5f MCS %d\n",
|
||||
UE->rnti,
|
||||
stats->ul.rounds[0], stats->ul.rounds[1],
|
||||
stats->ul.rounds[2], stats->ul.rounds[3],
|
||||
stats->ulsch_DTX,
|
||||
stats->ul.errors,
|
||||
sched_ctrl->ul_bler_stats.bler,
|
||||
sched_ctrl->ul_bler_stats.mcs);
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: ulsch_total_bytes_scheduled %"PRIu64", ulsch_total_bytes_received %"PRIu64"\n",
|
||||
UE->rnti,
|
||||
stats->ulsch_total_bytes_scheduled, stats->ul.total_bytes);
|
||||
for (int lc_id = 0; lc_id < 63; lc_id++) {
|
||||
if (stats->lc_bytes_tx[lc_id] > 0) {
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
}
|
||||
if (stats->lc_bytes_rx[lc_id] > 0) {
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
}
|
||||
if (stats->dl.lc_bytes[lc_id] > 0)
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: LCID %d: %"PRIu64" bytes TX\n",
|
||||
UE->rnti,
|
||||
lc_id,
|
||||
stats->dl.lc_bytes[lc_id]);
|
||||
if (stats->ul.lc_bytes[lc_id] > 0)
|
||||
output += snprintf(output,
|
||||
end - output,
|
||||
"UE %04x: LCID %d: %"PRIu64" bytes RX\n",
|
||||
UE->rnti,
|
||||
lc_id,
|
||||
stats->ul.lc_bytes[lc_id]);
|
||||
}
|
||||
}
|
||||
print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL);
|
||||
print_meas(&gNB->schedule_dlsch,"dlsch scheduler",NULL,NULL);
|
||||
print_meas(&gNB->rlc_data_req, "rlc_data_req",NULL,NULL);
|
||||
print_meas(&gNB->rlc_status_ind,"rlc_status_ind",NULL,NULL);
|
||||
pthread_mutex_unlock(&gNB->UE_info.mutex);
|
||||
return output - begin;
|
||||
}
|
||||
|
||||
|
||||
void mac_top_init_gNB(void)
|
||||
{
|
||||
module_id_t i;
|
||||
int list_el;
|
||||
NR_UE_info_t *UE_info;
|
||||
gNB_MAC_INST *nrmac;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst);
|
||||
@@ -179,6 +202,8 @@ void mac_top_init_gNB(void)
|
||||
|
||||
RC.nrmac[i]->first_MIB = true;
|
||||
|
||||
pthread_mutex_init(&RC.nrmac[i]->UE_info.mutex, NULL);
|
||||
|
||||
if (get_softmodem_params()->phy_test) {
|
||||
RC.nrmac[i]->pre_processor_dl = nr_preprocessor_phytest;
|
||||
RC.nrmac[i]->pre_processor_ul = nr_ul_preprocessor_phytest;
|
||||
@@ -210,13 +235,7 @@ void mac_top_init_gNB(void)
|
||||
|
||||
nrmac = RC.nrmac[i];
|
||||
nrmac->if_inst = NR_IF_Module_init(i);
|
||||
|
||||
UE_info = &nrmac->UE_info;
|
||||
UE_info->num_UEs = 0;
|
||||
create_nr_list(&UE_info->list, MAX_MOBILES_PER_GNB);
|
||||
for (list_el = 0; list_el < MAX_MOBILES_PER_GNB; list_el++) {
|
||||
UE_info->active[list_el] = false;
|
||||
}
|
||||
memset(&nrmac->UE_info, 0, sizeof(nrmac->UE_info));
|
||||
}
|
||||
|
||||
srand48(0);
|
||||
|
||||
@@ -91,6 +91,7 @@ typedef struct {
|
||||
int len;
|
||||
} NR_list_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
RA_IDLE = 0,
|
||||
Msg2 = 1,
|
||||
@@ -459,13 +460,12 @@ typedef struct NR_UE_harq {
|
||||
|
||||
//! fixme : need to enhace for the multiple TB CQI report
|
||||
|
||||
typedef struct NR_DL_bler_stats {
|
||||
frame_t last_frame_slot;
|
||||
typedef struct NR_bler_stats {
|
||||
frame_t last_frame;
|
||||
float bler;
|
||||
float rd2_bler;
|
||||
uint8_t mcs;
|
||||
uint64_t dlsch_rounds[8];
|
||||
} NR_DL_bler_stats_t;
|
||||
uint64_t rounds[8];
|
||||
} NR_bler_stats_t;
|
||||
|
||||
//
|
||||
/*! As per spec 38.214 section 5.2.1.4.2
|
||||
@@ -613,6 +613,9 @@ typedef struct {
|
||||
NR_pdsch_semi_static_t pdsch_semi_static;
|
||||
/// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI
|
||||
NR_sched_pdsch_t sched_pdsch;
|
||||
/// UE-estimated maximum MCS (from CSI-RS)
|
||||
uint8_t dl_max_mcs;
|
||||
|
||||
/// For UL synchronization: store last UL scheduling grant
|
||||
frame_t last_ul_frame;
|
||||
sub_frame_t last_ul_slot;
|
||||
@@ -624,7 +627,8 @@ typedef struct {
|
||||
mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID];
|
||||
|
||||
/// Estimation of HARQ from BLER
|
||||
NR_DL_bler_stats_t dl_bler_stats;
|
||||
NR_bler_stats_t dl_bler_stats;
|
||||
NR_bler_stats_t ul_bler_stats;
|
||||
|
||||
uint16_t ta_frame;
|
||||
int16_t ta_update;
|
||||
@@ -641,7 +645,6 @@ typedef struct {
|
||||
int ul_failure;
|
||||
struct CSI_Report CSI_report;
|
||||
bool SR;
|
||||
bool set_mcs;
|
||||
bool set_pmi;
|
||||
/// information about every HARQ process
|
||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||
@@ -674,45 +677,64 @@ typedef struct {
|
||||
uicc_t *uicc;
|
||||
} NRUEcontext_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t lc_bytes_tx[64];
|
||||
uint64_t lc_bytes_rx[64];
|
||||
uint64_t dlsch_rounds[8];
|
||||
uint64_t dlsch_errors;
|
||||
uint64_t dlsch_total_bytes;
|
||||
int dlsch_current_bytes;
|
||||
uint64_t ulsch_rounds[8];
|
||||
uint64_t ulsch_errors;
|
||||
typedef struct NR_mac_dir_stats {
|
||||
uint64_t lc_bytes[64];
|
||||
uint64_t rounds[8];
|
||||
uint64_t errors;
|
||||
uint64_t total_bytes;
|
||||
uint32_t current_bytes;
|
||||
} NR_mac_dir_stats_t;
|
||||
|
||||
typedef struct NR_mac_stats {
|
||||
NR_mac_dir_stats_t dl;
|
||||
NR_mac_dir_stats_t ul;
|
||||
uint32_t ulsch_DTX;
|
||||
uint64_t ulsch_total_bytes_scheduled;
|
||||
uint64_t ulsch_total_bytes_rx;
|
||||
int ulsch_current_bytes;
|
||||
uint32_t pucch0_DTX;
|
||||
int cumul_rsrp;
|
||||
uint8_t num_rsrp_meas;
|
||||
} NR_mac_stats_t;
|
||||
|
||||
typedef struct NR_bler_options {
|
||||
double upper;
|
||||
double lower;
|
||||
uint8_t max_mcs;
|
||||
} NR_bler_options_t;
|
||||
|
||||
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
||||
#define MAX_CSI_REPORTCONFIG 48
|
||||
typedef struct {
|
||||
rnti_t rnti;
|
||||
/// scheduling control info
|
||||
nr_csi_report_t csi_report_template[MAX_MOBILES_PER_GNB][MAX_CSI_REPORTCONFIG];
|
||||
NR_UE_sched_ctrl_t UE_sched_ctrl[MAX_MOBILES_PER_GNB];
|
||||
NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB];
|
||||
NR_list_t list;
|
||||
int num_UEs;
|
||||
bool active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB];
|
||||
nr_csi_report_t csi_report_template[MAX_CSI_REPORTCONFIG];
|
||||
NR_UE_sched_ctrl_t UE_sched_ctrl;
|
||||
NR_mac_stats_t mac_stats;
|
||||
NR_CellGroupConfig_t *CellGroup;
|
||||
char cg_buf[32768]; /* arbitrary size */
|
||||
asn_enc_rval_t enc_rval;
|
||||
/// CCE indexing
|
||||
int m[MAX_MOBILES_PER_GNB];
|
||||
int m;
|
||||
// UE selected beam index
|
||||
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
|
||||
bool Msg4_ACKed[MAX_MOBILES_PER_GNB];
|
||||
|
||||
uint8_t UE_beam_index;
|
||||
bool Msg3_dcch_dtch;
|
||||
bool Msg4_ACKed;
|
||||
/// Sched CSI-RS: scheduling decisions
|
||||
NR_gNB_UCI_STATS_t uci_statS;
|
||||
float ul_thr_ue;
|
||||
float dl_thr_ue;
|
||||
int layers;
|
||||
} NR_UE_info_t;
|
||||
|
||||
typedef struct {
|
||||
/// scheduling control info
|
||||
// last element always NULL
|
||||
pthread_mutex_t mutex;
|
||||
NR_UE_info_t *list[MAX_MOBILES_PER_GNB+1];
|
||||
bool sched_csirs;
|
||||
} NR_UEs_t;
|
||||
|
||||
#define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++)))
|
||||
|
||||
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot);
|
||||
@@ -770,8 +792,8 @@ typedef struct gNB_MAC_INST_s {
|
||||
nfapi_nr_ul_dci_request_t UL_dci_req[NFAPI_CC_MAX];
|
||||
/// NFAPI DL PDU structure
|
||||
nfapi_nr_tx_data_request_t TX_req[NFAPI_CC_MAX];
|
||||
int pdcch_cand[MAX_NUM_CORESET];
|
||||
NR_UE_info_t UE_info;
|
||||
|
||||
NR_UEs_t UE_info;
|
||||
|
||||
/// UL handle
|
||||
uint32_t ul_handle;
|
||||
@@ -807,15 +829,8 @@ typedef struct gNB_MAC_INST_s {
|
||||
|
||||
/// bitmap of DLSCH slots, can hold up to 160 slots
|
||||
uint64_t dlsch_slot_bitmap[3];
|
||||
/// Lookup for preferred time domain allocation for BWP, in DL, slots
|
||||
/// dynamically allocated
|
||||
int *preferred_dl_tda[MAX_NUM_BWP];
|
||||
/// bitmap of ULSCH slots, can hold up to 160 slots
|
||||
uint64_t ulsch_slot_bitmap[3];
|
||||
/// Lookup for preferred time domain allocation for UL BWP, dynamically
|
||||
/// allocated. The index refers to the DL slot, and the indicated TDA's k2
|
||||
/// points to the right UL slot
|
||||
int *preferred_ul_tda[MAX_NUM_BWP];
|
||||
|
||||
/// maximum number of slots before a UE will be scheduled ULSCH automatically
|
||||
uint32_t ulsch_max_frame_inactivity;
|
||||
@@ -833,10 +848,8 @@ typedef struct gNB_MAC_INST_s {
|
||||
int xp_pdsch_antenna_ports;
|
||||
|
||||
bool first_MIB;
|
||||
double dl_bler_target_upper;
|
||||
double dl_bler_target_lower;
|
||||
double dl_rd2_bler_threshold;
|
||||
uint8_t dl_max_mcs;
|
||||
NR_bler_options_t dl_bler;
|
||||
NR_bler_options_t ul_bler;
|
||||
uint8_t harq_round_max;
|
||||
uint8_t min_grant_prb;
|
||||
uint8_t min_grant_mcs;
|
||||
|
||||
@@ -274,9 +274,8 @@ static void do_pdcp_data_ind(
|
||||
if (rb != NULL) {
|
||||
rb->recv_pdu(rb, (char *)sdu_buffer->data, sdu_buffer_size);
|
||||
} else {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n",
|
||||
LOG_E(PDCP, "%s:%d:%s: no RB found (rb_id %ld, srb_flag %d)\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, rb_id, srb_flagP);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
@@ -977,11 +976,6 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (drb_id != 1) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, drb_id);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
|
||||
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
|
||||
|
||||
@@ -77,14 +77,15 @@ nr_rlc_entity_t *new_nr_rlc_entity_am(
|
||||
ret->sn_modulus = 1 << ret->sn_field_length;
|
||||
ret->window_size = ret->sn_modulus / 2;
|
||||
|
||||
ret->common.recv_pdu = nr_rlc_entity_am_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_am_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_am_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_am_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_am_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_am_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_am_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_am_delete;
|
||||
ret->common.recv_pdu = nr_rlc_entity_am_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_am_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_am_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_am_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_am_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_am_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_am_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_am_delete;
|
||||
ret->common.available_tx_space = nr_rlc_entity_am_available_tx_space;
|
||||
|
||||
ret->common.deliver_sdu = deliver_sdu;
|
||||
ret->common.deliver_sdu_data = deliver_sdu_data;
|
||||
@@ -127,14 +128,15 @@ nr_rlc_entity_t *new_nr_rlc_entity_um(
|
||||
ret->sn_modulus = 1 << ret->sn_field_length;
|
||||
ret->window_size = ret->sn_modulus / 2;
|
||||
|
||||
ret->common.recv_pdu = nr_rlc_entity_um_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_um_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_um_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_um_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_um_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_um_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_um_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_um_delete;
|
||||
ret->common.recv_pdu = nr_rlc_entity_um_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_um_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_um_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_um_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_um_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_um_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_um_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_um_delete;
|
||||
ret->common.available_tx_space = nr_rlc_entity_um_available_tx_space;
|
||||
|
||||
ret->common.deliver_sdu = deliver_sdu;
|
||||
ret->common.deliver_sdu_data = deliver_sdu_data;
|
||||
@@ -158,14 +160,15 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
|
||||
|
||||
ret->tx_maxsize = tx_maxsize;
|
||||
|
||||
ret->common.recv_pdu = nr_rlc_entity_tm_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_tm_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_tm_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_tm_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_tm_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_tm_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_tm_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_tm_delete;
|
||||
ret->common.recv_pdu = nr_rlc_entity_tm_recv_pdu;
|
||||
ret->common.buffer_status = nr_rlc_entity_tm_buffer_status;
|
||||
ret->common.generate_pdu = nr_rlc_entity_tm_generate_pdu;
|
||||
ret->common.recv_sdu = nr_rlc_entity_tm_recv_sdu;
|
||||
ret->common.set_time = nr_rlc_entity_tm_set_time;
|
||||
ret->common.discard_sdu = nr_rlc_entity_tm_discard_sdu;
|
||||
ret->common.reestablishment = nr_rlc_entity_tm_reestablishment;
|
||||
ret->common.delete = nr_rlc_entity_tm_delete;
|
||||
ret->common.available_tx_space = nr_rlc_entity_tm_available_tx_space;
|
||||
|
||||
ret->common.deliver_sdu = deliver_sdu;
|
||||
ret->common.deliver_sdu_data = deliver_sdu_data;
|
||||
|
||||
@@ -50,6 +50,8 @@ typedef struct nr_rlc_entity_t {
|
||||
|
||||
void (*delete)(struct nr_rlc_entity_t *entity);
|
||||
|
||||
int (*available_tx_space)(struct nr_rlc_entity_t *entity);
|
||||
|
||||
/* callbacks provided to the RLC module */
|
||||
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_rlc_entity_t *entity,
|
||||
char *buf, int size);
|
||||
|
||||
@@ -1910,3 +1910,9 @@ void nr_rlc_entity_am_delete(nr_rlc_entity_t *_entity)
|
||||
clear_entity(entity);
|
||||
free(entity);
|
||||
}
|
||||
|
||||
int nr_rlc_entity_am_available_tx_space(nr_rlc_entity_t *_entity)
|
||||
{
|
||||
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
|
||||
return entity->tx_maxsize - entity->tx_size;
|
||||
}
|
||||
|
||||
@@ -99,5 +99,6 @@ void nr_rlc_entity_am_set_time(nr_rlc_entity_t *entity, uint64_t now);
|
||||
void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
|
||||
void nr_rlc_entity_am_reestablishment(nr_rlc_entity_t *_entity);
|
||||
void nr_rlc_entity_am_delete(nr_rlc_entity_t *entity);
|
||||
int nr_rlc_entity_am_available_tx_space(nr_rlc_entity_t *entity);
|
||||
|
||||
#endif /* _NR_RLC_ENTITY_AM_H_ */
|
||||
|
||||
@@ -174,3 +174,9 @@ void nr_rlc_entity_tm_delete(nr_rlc_entity_t *_entity)
|
||||
clear_entity(entity);
|
||||
free(entity);
|
||||
}
|
||||
|
||||
int nr_rlc_entity_tm_available_tx_space(nr_rlc_entity_t *_entity)
|
||||
{
|
||||
nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity;
|
||||
return entity->tx_maxsize - entity->tx_size;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,6 @@ void nr_rlc_entity_tm_set_time(nr_rlc_entity_t *entity, uint64_t now);
|
||||
void nr_rlc_entity_tm_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
|
||||
void nr_rlc_entity_tm_reestablishment(nr_rlc_entity_t *_entity);
|
||||
void nr_rlc_entity_tm_delete(nr_rlc_entity_t *entity);
|
||||
int nr_rlc_entity_tm_available_tx_space(nr_rlc_entity_t *entity);
|
||||
|
||||
#endif /* _NR_RLC_ENTITY_TM_H_ */
|
||||
|
||||
@@ -695,3 +695,9 @@ void nr_rlc_entity_um_delete(nr_rlc_entity_t *_entity)
|
||||
clear_entity(entity);
|
||||
free(entity);
|
||||
}
|
||||
|
||||
int nr_rlc_entity_um_available_tx_space(nr_rlc_entity_t *_entity)
|
||||
{
|
||||
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
|
||||
return entity->tx_maxsize - entity->tx_size;
|
||||
}
|
||||
|
||||
@@ -75,5 +75,6 @@ void nr_rlc_entity_um_set_time(nr_rlc_entity_t *entity, uint64_t now);
|
||||
void nr_rlc_entity_um_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id);
|
||||
void nr_rlc_entity_um_reestablishment(nr_rlc_entity_t *_entity);
|
||||
void nr_rlc_entity_um_delete(nr_rlc_entity_t *entity);
|
||||
int nr_rlc_entity_um_available_tx_space(nr_rlc_entity_t *entity);
|
||||
|
||||
#endif /* _NR_RLC_ENTITY_UM_H_ */
|
||||
|
||||
@@ -101,6 +101,7 @@ void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config
|
||||
switch (rlc_config_pr){
|
||||
case NR_RLC_Config_PR_um_Bi_Directional:
|
||||
// RLC UM Bi-directional Bearer configuration
|
||||
LOG_I(RLC, "RLC UM Bi-directional Bearer configuration selected \n");
|
||||
rlc_Config->choice.um_Bi_Directional = calloc(1, sizeof(*rlc_Config->choice.um_Bi_Directional));
|
||||
rlc_Config->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = calloc(1, sizeof(*rlc_Config->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength));
|
||||
*rlc_Config->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = NR_SN_FieldLengthUM_size12;
|
||||
@@ -123,7 +124,7 @@ void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config
|
||||
rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms15;
|
||||
break;
|
||||
default:
|
||||
LOG_E (RLC, "Error in %s: RLC config type %d is not handled\n", __FUNCTION__, rlc_config_pr);
|
||||
AssertFatal(0, "RLC config type %d not handled\n", rlc_config_pr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -213,10 +214,12 @@ tbs_size_t mac_rlc_data_req(
|
||||
}
|
||||
|
||||
if (rb != NULL) {
|
||||
LOG_D(RLC, "MAC PDU to get created for channel_idP:%d \n", channel_idP);
|
||||
rb->set_time(rb, nr_rlc_current_time);
|
||||
maxsize = tb_sizeP;
|
||||
ret = rb->generate_pdu(rb, buffer_pP, maxsize);
|
||||
} else {
|
||||
LOG_D(RLC, "MAC PDU failed to get created for channel_idP:%d \n", channel_idP);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
@@ -394,6 +397,35 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
|
||||
return RLC_OP_STATUS_OK;
|
||||
}
|
||||
|
||||
int nr_rlc_get_available_tx_space(
|
||||
const rnti_t rntiP,
|
||||
const logical_chan_id_t channel_idP)
|
||||
{
|
||||
nr_rlc_ue_t *ue;
|
||||
nr_rlc_entity_t *rb;
|
||||
int ret;
|
||||
|
||||
nr_rlc_manager_lock(nr_rlc_ue_manager);
|
||||
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP);
|
||||
|
||||
switch (channel_idP) {
|
||||
case 1 ... 3: rb = ue->srb[channel_idP - 1]; break;
|
||||
case 4 ... 8: rb = ue->drb[channel_idP - 4]; break;
|
||||
default: rb = NULL; break;
|
||||
}
|
||||
|
||||
if (rb != NULL) {
|
||||
ret = rb->available_tx_space(rb);
|
||||
} else {
|
||||
LOG_E(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rlc_module_init(int enb_flag)
|
||||
{
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -46,4 +46,8 @@ void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig, NR_RLC_BearerCo
|
||||
|
||||
void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config_pr);
|
||||
|
||||
void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig);
|
||||
void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChannelConfig);
|
||||
|
||||
int nr_rlc_get_available_tx_space(
|
||||
const rnti_t rntiP,
|
||||
const logical_chan_id_t channel_idP);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1065,3 +1065,15 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
sdu_sizeP,
|
||||
sdu_pP, NULL, NULL);
|
||||
}
|
||||
|
||||
/* HACK to be removed: nr_rlc_get_available_tx_space is needed by
|
||||
* openair3/ocp-gtpu/gtp_itf.cpp which is compiled in lte-softmodem
|
||||
* so let's put a dummy nr_rlc_get_available_tx_space here
|
||||
*/
|
||||
int nr_rlc_get_available_tx_space(
|
||||
const rnti_t rntiP,
|
||||
const logical_chan_id_t channel_idP)
|
||||
{
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,8 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
// End debug information
|
||||
netif_stop_queue(dev);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1796)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) \
|
||||
|| (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796 && RHEL_RELEASE_CODE != 2403)
|
||||
netif_trans_update(dev);
|
||||
#else
|
||||
dev->trans_start = jiffies;
|
||||
@@ -267,7 +268,8 @@ void nas_tx_timeout(struct net_device *dev)
|
||||
printk("TX_TIMEOUT: begin\n");
|
||||
// (struct nas_priv *)(dev->priv)->stats.tx_errors++;
|
||||
(priv->stats).tx_errors++;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1796)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) \
|
||||
|| (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796 && RHEL_RELEASE_CODE != 2403)
|
||||
netif_trans_update(dev);
|
||||
#else
|
||||
dev->trans_start = jiffies;
|
||||
@@ -285,7 +287,8 @@ static const struct net_device_ops nasmesh_netdev_ops = {
|
||||
.ndo_set_mac_address = NULL,
|
||||
.ndo_set_config = nas_set_config,
|
||||
.ndo_do_ioctl = nas_CTL_ioctl,
|
||||
#if (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1797 && LINUX_VERSION_CODE <= KERNEL_VERSION(3,11,0))
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,11,0) \
|
||||
|| (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1797 && RHEL_RELEASE_CODE != 2403)
|
||||
.extended.ndo_change_mtu = nas_change_mtu,
|
||||
#else
|
||||
.ndo_change_mtu = nas_change_mtu,
|
||||
|
||||
@@ -239,7 +239,8 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) {
|
||||
|
||||
// End debug information
|
||||
netif_stop_queue(dev_pP);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) \
|
||||
|| (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796 && RHEL_RELEASE_CODE != 2403)
|
||||
netif_trans_update(dev_pP);
|
||||
#else
|
||||
dev_pP->trans_start = jiffies;
|
||||
@@ -315,7 +316,8 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
|
||||
printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
|
||||
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
|
||||
(priv_p->stats).tx_errors++;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) \
|
||||
|| (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796 && RHEL_RELEASE_CODE != 2403)
|
||||
netif_trans_update(dev_pP);
|
||||
#else
|
||||
dev_pP->trans_start = jiffies;
|
||||
@@ -333,7 +335,7 @@ static const struct net_device_ops ue_ip_netdev_ops = {
|
||||
.ndo_set_mac_address = ue_ip_set_mac_address,
|
||||
.ndo_set_config = ue_ip_set_config,
|
||||
.ndo_do_ioctl = NULL,
|
||||
#if (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1797)
|
||||
#if defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1797 && RHEL_RELEASE_CODE != 2403
|
||||
.extended.ndo_change_mtu = ue_ip_change_mtu,
|
||||
#else
|
||||
.ndo_change_mtu = ue_ip_change_mtu,
|
||||
|
||||
@@ -77,7 +77,7 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
|
||||
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7);
|
||||
|
||||
if (UL_info->rach_ind.number_of_pdus > 0 && in_timewindow) {
|
||||
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
|
||||
LOG_A(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);
|
||||
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
|
||||
UL_info->rach_ind.number_of_pdus--;
|
||||
@@ -372,9 +372,6 @@ static void match_crc_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, nfapi_nr_crc
|
||||
|
||||
void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
||||
AssertFatal(UL_info!=NULL,"UL_info is null\n");
|
||||
#ifdef DUMP_FAPI
|
||||
dump_ul(UL_info);
|
||||
#endif
|
||||
module_id_t module_id = UL_info->module_id;
|
||||
int CC_id = UL_info->CC_id;
|
||||
NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id];
|
||||
|
||||
@@ -66,17 +66,6 @@ queue_t nr_tx_req_queue;
|
||||
queue_t nr_ul_dci_req_queue;
|
||||
queue_t nr_ul_tti_req_queue;
|
||||
|
||||
static slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT];
|
||||
|
||||
//static int get_mcs_from_sinr(float sinr);
|
||||
//static int get_cqi_from_mcs(void);
|
||||
static void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int sf, int index);
|
||||
//static bool did_drop_transport_block(int slot, uint16_t rnti);
|
||||
static float get_bler_val(uint8_t mcs, int sinr);
|
||||
static bool should_drop_transport_block(int slot, uint16_t rnti);
|
||||
static void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request);
|
||||
static inline bool is_channel_modeling(void);
|
||||
|
||||
void nrue_init_standalone_socket(int tx_port, int rx_port)
|
||||
{
|
||||
{
|
||||
@@ -939,7 +928,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
|
||||
return;
|
||||
}
|
||||
|
||||
static void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request)
|
||||
void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request)
|
||||
{
|
||||
int count_sent = 0;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
@@ -1343,245 +1332,3 @@ void RCconfig_nr_ue_L1(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static int get_mcs_from_sinr(float sinr)
|
||||
{
|
||||
if (sinr < (nr_bler_data[0].bler_table[0][0]))
|
||||
{
|
||||
LOG_D(NR_MAC, "The SINR found is smaller than first MCS table\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sinr > (nr_bler_data[NR_NUM_MCS-1].bler_table[nr_bler_data[NR_NUM_MCS-1].length - 1][0]))
|
||||
{
|
||||
LOG_D(NR_MAC, "The SINR found is larger than last MCS table\n");
|
||||
return NR_NUM_MCS-1;
|
||||
}
|
||||
|
||||
for (int n = NR_NUM_MCS-1; n >= 0; n--)
|
||||
{
|
||||
CHECK_INDEX(nr_bler_data, n);
|
||||
float largest_sinr = (nr_bler_data[n].bler_table[nr_bler_data[n].length - 1][0]);
|
||||
float smallest_sinr = (nr_bler_data[n].bler_table[0][0]);
|
||||
if (sinr < largest_sinr && sinr > smallest_sinr)
|
||||
{
|
||||
LOG_D(NR_MAC, "The SINR found in MCS %d table\n", n);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
LOG_E(NR_MAC, "Unable to get an MCS value.\n");
|
||||
abort();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
static int get_cqi_from_mcs(void)
|
||||
{
|
||||
static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
|
||||
9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15};
|
||||
assert(NUM_ELEMENTS(mcs_to_cqi) == NR_NUM_MCS);
|
||||
int slot = 0;
|
||||
while (slot < NUM_NFAPI_SLOT)
|
||||
{
|
||||
if (slot_rnti_mcs[slot].latest)
|
||||
{
|
||||
int num_pdus = slot_rnti_mcs[slot].num_pdus;
|
||||
if (num_pdus <= 0)
|
||||
{
|
||||
LOG_E(NR_MAC, "%s: slot_rnti_mcs[%d].num_pdus = 0\n", __FUNCTION__, slot);
|
||||
abort();
|
||||
}
|
||||
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].mcs, num_pdus);
|
||||
int mcs = get_mcs_from_sinr(slot_rnti_mcs[slot].sinr);
|
||||
CHECK_INDEX(mcs_to_cqi, mcs);
|
||||
int cqi = mcs_to_cqi[mcs];
|
||||
LOG_D(NR_MAC, "SINR: %f -> MCS: %d -> CQI: %d\n", slot_rnti_mcs[slot].sinr, mcs, cqi);
|
||||
return cqi;
|
||||
}
|
||||
slot++;
|
||||
}
|
||||
LOG_E(NR_MAC, "Unable to get CQI value because no MCS found\n");
|
||||
abort();
|
||||
}
|
||||
*/
|
||||
|
||||
static void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int slot, int index)
|
||||
{
|
||||
if (pdu == NULL)
|
||||
{
|
||||
LOG_E(NR_MAC,"PDU NULL\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
/* This function is executed for every pdsch pdu type in a dl_tti_request. We save
|
||||
the assocaited MCS and RNTI value for each. The 'index' passed in is a count of
|
||||
how many times we have called this function for a particular dl_tti_request. It
|
||||
allows us to save MCS/RNTI data in correct indicies when multiple pdsch pdu's are received.*/
|
||||
for (int i = 0; i < NUM_NFAPI_SLOT; i++)
|
||||
{
|
||||
slot_rnti_mcs[i].latest = false;
|
||||
}
|
||||
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].rnti, index);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].mcs, index);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].drop_flag, index);
|
||||
slot_rnti_mcs[slot].rnti[index] = pdu->rnti;
|
||||
slot_rnti_mcs[slot].mcs[index] = pdu->mcsIndex[0];
|
||||
slot_rnti_mcs[slot].rvIndex[index] = pdu->rvIndex[0];
|
||||
slot_rnti_mcs[slot].drop_flag[index] = false;
|
||||
slot_rnti_mcs[slot].num_pdus = index+1; //index starts at 0 so we incrament to get num of pdus
|
||||
slot_rnti_mcs[slot].latest = true;
|
||||
LOG_D(NR_MAC, "Adding MCS %d and RNTI %x for slot_rnti_mcs[%d]\n", slot_rnti_mcs[slot].mcs[index], slot_rnti_mcs[slot].rnti[index], slot);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
static bool did_drop_transport_block(int slot, uint16_t rnti)
|
||||
{
|
||||
int num_pdus = slot_rnti_mcs[slot].num_pdus;
|
||||
if (num_pdus <= 0)
|
||||
{
|
||||
LOG_E(MAC, "Problem, the PDU size is <= 0. We dropped this packet\n");
|
||||
return true;
|
||||
}
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].rnti, num_pdus);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].drop_flag, num_pdus);
|
||||
for (int n = 0; n < num_pdus; n++)
|
||||
{
|
||||
if (slot_rnti_mcs[slot].rnti[n] == rnti && slot_rnti_mcs[slot].drop_flag[n])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
static float get_bler_val(uint8_t mcs, int sinr)
|
||||
{
|
||||
// 4th col = dropped packets, 5th col = total packets
|
||||
float bler_val = 0.0;
|
||||
CHECK_INDEX(nr_bler_data, mcs);
|
||||
LOG_D(NR_MAC, "sinr %d min %d max %d\n", sinr,
|
||||
(int)(nr_bler_data[mcs].bler_table[0][0] * 10),
|
||||
(int)(nr_bler_data[mcs].bler_table[nr_bler_data[mcs].length - 1][0] * 10)
|
||||
);
|
||||
|
||||
if (sinr < (int)(nr_bler_data[mcs].bler_table[0][0] * 10))
|
||||
{
|
||||
LOG_D(NR_MAC, "MCS %d table. SINR is smaller than lowest SINR, bler_val is set based on lowest SINR in table\n", mcs);
|
||||
bler_val = nr_bler_data[mcs].bler_table[0][4] / nr_bler_data[mcs].bler_table[0][5];
|
||||
return bler_val;
|
||||
}
|
||||
if (sinr > (int)(nr_bler_data[mcs].bler_table[nr_bler_data[mcs].length - 1][0] * 10))
|
||||
{
|
||||
LOG_D(NR_MAC, "MCS %d table. SINR is greater than largest SINR. bler_val is set based on largest SINR in table\n", mcs);
|
||||
bler_val = nr_bler_data[mcs].bler_table[(nr_bler_data[mcs].length - 1)][4] / nr_bler_data[mcs].bler_table[(nr_bler_data[mcs].length - 1)][5];
|
||||
return bler_val;
|
||||
}
|
||||
// Loop through bler table to find sinr_index
|
||||
for (int i = 0; i < nr_bler_data[mcs].length; i++)
|
||||
{
|
||||
int temp_sinr = (int)(nr_bler_data[mcs].bler_table[i][0] * 10);
|
||||
if (temp_sinr == sinr)
|
||||
{
|
||||
bler_val = nr_bler_data[mcs].bler_table[i][4] / nr_bler_data[mcs].bler_table[i][5];
|
||||
return bler_val;
|
||||
}
|
||||
// Linear interpolation when SINR is between indices
|
||||
if (temp_sinr > sinr)
|
||||
{
|
||||
float bler_val1 = nr_bler_data[mcs].bler_table[i - 1][4] / nr_bler_data[mcs].bler_table[i - 1][5];
|
||||
float bler_val2 = nr_bler_data[mcs].bler_table[i][4] / nr_bler_data[mcs].bler_table[i][5];
|
||||
LOG_D(NR_MAC, "sinr %d min %f max %f\n", sinr, bler_val1, bler_val2);
|
||||
return ((bler_val1 + bler_val2) / 2);
|
||||
}
|
||||
}
|
||||
LOG_E(NR_MAC, "NO SINR INDEX FOUND!\n");
|
||||
abort();
|
||||
|
||||
}
|
||||
|
||||
static inline bool is_channel_modeling(void)
|
||||
{
|
||||
/* TODO: For now we enable channel modeling based on the node_number.
|
||||
Replace with a command line option to enable/disable channel modeling.
|
||||
The LTE UE will crash when channel modeling is conducted for NSA
|
||||
mode. It does not crash for LTE mode. We have not implemented channel
|
||||
modeling for NSA mode yet. For now, we ensure only do do channel modeling
|
||||
in LTE/NR mode. */
|
||||
return get_softmodem_params()->node_number == 0 && !get_softmodem_params()->nsa;
|
||||
}
|
||||
|
||||
static bool should_drop_transport_block(int slot, uint16_t rnti)
|
||||
{
|
||||
if (!is_channel_modeling())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We want to avoid dropping setup messages because this would be pathological. */
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
if (mac->ra.ra_state < RA_SUCCEEDED)
|
||||
{
|
||||
LOG_D(NR_MAC, "Not dropping because MAC state: %d", mac->ra.ra_state);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get block error rate (bler_val) from table based on every saved
|
||||
MCS and SINR to be used as the cutoff rate for dropping packets.
|
||||
Generate random uniform vairable to compare against bler_val. */
|
||||
int num_pdus = slot_rnti_mcs[slot].num_pdus;
|
||||
assert(slot < 20 && slot >= 0);
|
||||
LOG_D(NR_MAC, "rnti: %x num_pdus %d state %d slot %u sinr %f\n",
|
||||
rnti, num_pdus, mac->ra.ra_state, slot, slot_rnti_mcs[slot].sinr);
|
||||
assert(num_pdus > 0);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].rnti, num_pdus);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].mcs, num_pdus);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].drop_flag, num_pdus);
|
||||
int n = 0;
|
||||
uint8_t mcs = 99;
|
||||
for (n = 0; n < num_pdus; n++)
|
||||
{
|
||||
if (slot_rnti_mcs[slot].rnti[n] == rnti)
|
||||
{
|
||||
mcs = slot_rnti_mcs[slot].mcs[n];
|
||||
}
|
||||
if (mcs != 99)
|
||||
{
|
||||
/* Use MCS to get the bler value. Since there can be multiple MCS
|
||||
values for a particular slot, we verify that all PDUs are not
|
||||
flagged for drop before returning. If even one is flagged for drop
|
||||
we return immediately because we drop the entire packet. */
|
||||
|
||||
LOG_D(NR_MAC, "rnti: %x mcs %u slot %u sinr %f\n",
|
||||
slot_rnti_mcs[slot].rnti[n], mcs, slot, slot_rnti_mcs[slot].sinr);
|
||||
|
||||
float bler_val;
|
||||
if (slot_rnti_mcs[slot].rvIndex[n] != 0)
|
||||
bler_val = 0;
|
||||
else
|
||||
bler_val = get_bler_val(mcs, ((int)(slot_rnti_mcs[slot].sinr * 10)));
|
||||
double drop_cutoff = ((double) rand() / (RAND_MAX));
|
||||
assert(drop_cutoff <= 1);
|
||||
LOG_D(NR_MAC, "SINR = %f, Bler_val = %f, MCS = %"PRIu8"\n", slot_rnti_mcs[slot].sinr, bler_val, slot_rnti_mcs[slot].mcs[n]);
|
||||
if (drop_cutoff <= bler_val)
|
||||
{
|
||||
slot_rnti_mcs[slot].drop_flag[n] = true;
|
||||
LOG_T(NR_MAC, "We are dropping this packet. Bler_val = %f, MCS = %"PRIu8", slot = %d\n", bler_val, slot_rnti_mcs[slot].mcs[n], slot);
|
||||
return slot_rnti_mcs[slot].drop_flag[n];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mcs == 99)
|
||||
{
|
||||
LOG_E(NR_MAC, "NO MCS Found for rnti %x. slot_rnti_mcs[%d].mcs[%d] \n", rnti, slot, n);
|
||||
abort();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,45 +40,12 @@
|
||||
#include "openair2/PHY_INTERFACE/queue_t.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "NR_Packet_Drop.h"
|
||||
|
||||
#define NR_NUM_MCS 29
|
||||
#define NUM_SINR 100
|
||||
#define NUM_BLER_COL 13
|
||||
#define NUM_NFAPI_SLOT 20
|
||||
#define NR_NUM_LAYER 1
|
||||
extern slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT];
|
||||
|
||||
typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t;
|
||||
|
||||
typedef struct nr_phy_channel_params_t
|
||||
{
|
||||
uint16_t sfn_slot;
|
||||
uint16_t message_id;
|
||||
uint16_t nb_of_sinrs;
|
||||
float sinr[NR_NUM_LAYER];
|
||||
// Incomplete, need all channel parameters
|
||||
} nr_phy_channel_params_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t slot;
|
||||
uint16_t rnti[256];
|
||||
uint8_t mcs[256];
|
||||
uint8_t rvIndex[256];
|
||||
float sinr;
|
||||
uint16_t num_pdus;
|
||||
bool drop_flag[256];
|
||||
bool latest;
|
||||
|
||||
} slot_rnti_mcs_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t length;
|
||||
float bler_table[NUM_SINR][NUM_BLER_COL];
|
||||
} nr_bler_struct;
|
||||
|
||||
extern nr_bler_struct nr_bler_data[NR_NUM_MCS];
|
||||
|
||||
typedef enum {
|
||||
ONLY_PUSCH,
|
||||
NOT_PUSCH,
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
|
||||
slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT];
|
||||
void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int slot, int index)
|
||||
{
|
||||
if (pdu == NULL)
|
||||
{
|
||||
LOG_E(NR_MAC,"PDU NULL\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
/* This function is executed for every pdsch pdu type in a dl_tti_request. We save
|
||||
the assocaited MCS and RNTI value for each. The 'index' passed in is a count of
|
||||
how many times we have called this function for a particular dl_tti_request. It
|
||||
allows us to save MCS/RNTI data in correct indicies when multiple pdsch pdu's are received.*/
|
||||
for (int i = 0; i < NUM_NFAPI_SLOT; i++)
|
||||
{
|
||||
slot_rnti_mcs[i].latest = false;
|
||||
}
|
||||
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].rnti, index);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].mcs, index);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].drop_flag, index);
|
||||
slot_rnti_mcs[slot].rnti[index] = pdu->rnti;
|
||||
slot_rnti_mcs[slot].mcs[index] = pdu->mcsIndex[0];
|
||||
slot_rnti_mcs[slot].rvIndex[index] = pdu->rvIndex[0];
|
||||
slot_rnti_mcs[slot].drop_flag[index] = false;
|
||||
slot_rnti_mcs[slot].num_pdus = index+1; //index starts at 0 so we incrament to get num of pdus
|
||||
slot_rnti_mcs[slot].latest = true;
|
||||
LOG_D(NR_MAC, "Adding MCS %d and RNTI %x for slot_rnti_mcs[%d]\n", slot_rnti_mcs[slot].mcs[index], slot_rnti_mcs[slot].rnti[index], slot);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
extern nr_bler_struct nr_bler_data[NR_NUM_MCS];
|
||||
float get_bler_val(uint8_t mcs, int sinr)
|
||||
{
|
||||
// 4th col = dropped packets, 5th col = total packets
|
||||
float bler_val = 0.0;
|
||||
CHECK_INDEX(nr_bler_data, mcs);
|
||||
LOG_D(NR_MAC, "sinr %d min %d max %d\n", sinr,
|
||||
(int)(nr_bler_data[mcs].bler_table[0][0] * 10),
|
||||
(int)(nr_bler_data[mcs].bler_table[nr_bler_data[mcs].length - 1][0] * 10)
|
||||
);
|
||||
|
||||
if (sinr < (int)(nr_bler_data[mcs].bler_table[0][0] * 10))
|
||||
{
|
||||
LOG_D(NR_MAC, "MCS %d table. SINR is smaller than lowest SINR, bler_val is set based on lowest SINR in table\n", mcs);
|
||||
bler_val = nr_bler_data[mcs].bler_table[0][4] / nr_bler_data[mcs].bler_table[0][5];
|
||||
return bler_val;
|
||||
}
|
||||
if (sinr > (int)(nr_bler_data[mcs].bler_table[nr_bler_data[mcs].length - 1][0] * 10))
|
||||
{
|
||||
LOG_D(NR_MAC, "MCS %d table. SINR is greater than largest SINR. bler_val is set based on largest SINR in table\n", mcs);
|
||||
bler_val = nr_bler_data[mcs].bler_table[(nr_bler_data[mcs].length - 1)][4] / nr_bler_data[mcs].bler_table[(nr_bler_data[mcs].length - 1)][5];
|
||||
return bler_val;
|
||||
}
|
||||
// Loop through bler table to find sinr_index
|
||||
for (int i = 0; i < nr_bler_data[mcs].length; i++)
|
||||
{
|
||||
int temp_sinr = (int)(nr_bler_data[mcs].bler_table[i][0] * 10);
|
||||
if (temp_sinr == sinr)
|
||||
{
|
||||
bler_val = nr_bler_data[mcs].bler_table[i][4] / nr_bler_data[mcs].bler_table[i][5];
|
||||
return bler_val;
|
||||
}
|
||||
// Linear interpolation when SINR is between indices
|
||||
if (temp_sinr > sinr)
|
||||
{
|
||||
float bler_val1 = nr_bler_data[mcs].bler_table[i - 1][4] / nr_bler_data[mcs].bler_table[i - 1][5];
|
||||
float bler_val2 = nr_bler_data[mcs].bler_table[i][4] / nr_bler_data[mcs].bler_table[i][5];
|
||||
LOG_D(NR_MAC, "sinr %d min %f max %f\n", sinr, bler_val1, bler_val2);
|
||||
return ((bler_val1 + bler_val2) / 2);
|
||||
}
|
||||
}
|
||||
LOG_E(NR_MAC, "NO SINR INDEX FOUND!\n");
|
||||
abort();
|
||||
|
||||
}
|
||||
|
||||
bool is_channel_modeling(void)
|
||||
{
|
||||
/* TODO: For now we enable channel modeling based on the node_number.
|
||||
Replace with a command line option to enable/disable channel modeling.
|
||||
The LTE UE will crash when channel modeling is conducted for NSA
|
||||
mode. It does not crash for LTE mode. We have not implemented channel
|
||||
modeling for NSA mode yet. For now, we ensure only do do channel modeling
|
||||
in LTE/NR mode. */
|
||||
return get_softmodem_params()->node_number == 0 && !get_softmodem_params()->nsa;
|
||||
}
|
||||
|
||||
bool should_drop_transport_block(int slot, uint16_t rnti)
|
||||
{
|
||||
if (!is_channel_modeling())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We want to avoid dropping setup messages because this would be pathological. */
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
if (mac->ra.ra_state < RA_SUCCEEDED)
|
||||
{
|
||||
LOG_D(NR_MAC, "Not dropping because MAC state: %d", mac->ra.ra_state);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get block error rate (bler_val) from table based on every saved
|
||||
MCS and SINR to be used as the cutoff rate for dropping packets.
|
||||
Generate random uniform vairable to compare against bler_val. */
|
||||
int num_pdus = slot_rnti_mcs[slot].num_pdus;
|
||||
assert(slot < 20 && slot >= 0);
|
||||
LOG_D(NR_MAC, "rnti: %x num_pdus %d state %d slot %u sinr %f\n",
|
||||
rnti, num_pdus, mac->ra.ra_state, slot, slot_rnti_mcs[slot].sinr);
|
||||
assert(num_pdus > 0);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].rnti, num_pdus);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].mcs, num_pdus);
|
||||
CHECK_INDEX(slot_rnti_mcs[slot].drop_flag, num_pdus);
|
||||
int n = 0;
|
||||
uint8_t mcs = 99;
|
||||
for (n = 0; n < num_pdus; n++)
|
||||
{
|
||||
if (slot_rnti_mcs[slot].rnti[n] == rnti)
|
||||
{
|
||||
mcs = slot_rnti_mcs[slot].mcs[n];
|
||||
}
|
||||
if (mcs != 99)
|
||||
{
|
||||
/* Use MCS to get the bler value. Since there can be multiple MCS
|
||||
values for a particular slot, we verify that all PDUs are not
|
||||
flagged for drop before returning. If even one is flagged for drop
|
||||
we return immediately because we drop the entire packet. */
|
||||
|
||||
LOG_D(NR_MAC, "rnti: %x mcs %u slot %u sinr %f\n",
|
||||
slot_rnti_mcs[slot].rnti[n], mcs, slot, slot_rnti_mcs[slot].sinr);
|
||||
|
||||
float bler_val;
|
||||
if (slot_rnti_mcs[slot].rvIndex[n] != 0)
|
||||
bler_val = 0;
|
||||
else
|
||||
bler_val = get_bler_val(mcs, ((int)(slot_rnti_mcs[slot].sinr * 10)));
|
||||
double drop_cutoff = ((double) rand() / (RAND_MAX));
|
||||
assert(drop_cutoff <= 1);
|
||||
LOG_D(NR_MAC, "SINR = %f, Bler_val = %f, MCS = %"PRIu8"\n", slot_rnti_mcs[slot].sinr, bler_val, slot_rnti_mcs[slot].mcs[n]);
|
||||
if (drop_cutoff <= bler_val)
|
||||
{
|
||||
slot_rnti_mcs[slot].drop_flag[n] = true;
|
||||
LOG_T(NR_MAC, "We are dropping this packet. Bler_val = %f, MCS = %"PRIu8", slot = %d\n", bler_val, slot_rnti_mcs[slot].mcs[n], slot);
|
||||
return slot_rnti_mcs[slot].drop_flag[n];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mcs == 99)
|
||||
{
|
||||
LOG_E(NR_MAC, "NO MCS Found for rnti %x. slot_rnti_mcs[%d].mcs[%d] \n", rnti, slot, n);
|
||||
abort();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
#ifndef __NR_CHAN_MODEL_H__
|
||||
#define __NR_CHAN_MODEL_H__
|
||||
|
||||
#include <platform_types.h>
|
||||
#include <nfapi_nr_interface_scf.h>
|
||||
#include <openair1/PHY/thread_NR_UE.h>
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
|
||||
#define NR_NUM_MCS 29
|
||||
#define NUM_SINR 100
|
||||
#define NUM_BLER_COL 13
|
||||
#define NUM_NFAPI_SLOT 20
|
||||
#define NR_NUM_LAYER 1
|
||||
#define MAX_CHAN_PARAMS 256
|
||||
|
||||
typedef struct nr_phy_channel_params_t
|
||||
{
|
||||
uint16_t sfn_slot;
|
||||
uint16_t message_id;
|
||||
uint16_t nb_of_sinrs;
|
||||
float sinr[NR_NUM_LAYER];
|
||||
} nr_phy_channel_params_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t slot;
|
||||
uint16_t rnti[MAX_CHAN_PARAMS];
|
||||
uint8_t mcs[MAX_CHAN_PARAMS];
|
||||
uint8_t rvIndex[MAX_CHAN_PARAMS];
|
||||
float sinr;
|
||||
uint16_t num_pdus;
|
||||
bool drop_flag[MAX_CHAN_PARAMS];
|
||||
bool latest;
|
||||
} slot_rnti_mcs_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t length;
|
||||
float bler_table[NUM_SINR][NUM_BLER_COL];
|
||||
} nr_bler_struct;
|
||||
|
||||
void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int sf, int index);
|
||||
void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request);
|
||||
float get_bler_val(uint8_t mcs, int sinr);
|
||||
bool should_drop_transport_block(int slot, uint16_t rnti);
|
||||
bool is_channel_modeling(void);
|
||||
|
||||
#endif
|
||||
@@ -1956,7 +1956,7 @@ static int get_mcs_from_sinr(float sinr)
|
||||
|
||||
static int get_cqi_from_mcs(void)
|
||||
{
|
||||
static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15};
|
||||
static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15};
|
||||
assert(NUM_ELEMENTS(mcs_to_cqi) == NUM_MCS);
|
||||
int sf = 0;
|
||||
while(sf < NUM_NFAPI_SUBFRAME)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
|
||||
#include "queue_t.h"
|
||||
|
||||
#define NUM_MCS 28
|
||||
#define NUM_MCS 29
|
||||
#define NUM_SINR 100
|
||||
#define NUM_BLER_COL 13
|
||||
#define LTE_NUM_LAYER 1
|
||||
|
||||
@@ -1331,10 +1331,8 @@ uint8_t do_SIB23(uint8_t Mod_id,
|
||||
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1 = calloc(1, sizeof(struct LTE_RACH_ConfigCommon__ext1));
|
||||
memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1, 0, sizeof(struct LTE_RACH_ConfigCommon__ext1));
|
||||
|
||||
if (rrconfig->preambleTransMax_CE_r13) {
|
||||
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = calloc(1, sizeof(LTE_PreambleTransMax_t));
|
||||
*(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = *rrconfig->preambleTransMax_CE_r13; // to be re-initialized when we find the enum
|
||||
} else (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = NULL;
|
||||
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = calloc(1, sizeof(LTE_PreambleTransMax_t));
|
||||
*(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = rrconfig->preambleTransMax_CE_r13; // to be re-initialized when we find the enum
|
||||
|
||||
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
|
||||
memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13, 0, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <nr/nr_common.h>
|
||||
#include <softmodem-common.h>
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
#include "asn1_msg.h"
|
||||
#include "../nr_rrc_proto.h"
|
||||
@@ -198,7 +199,6 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
||||
|
||||
asn_enc_rval_t enc_rval;
|
||||
rrc_gNB_carrier_data_t *carrier = &rrc->carrier;
|
||||
const gNB_RrcConfigurationReq *configuration = &rrc->configuration;
|
||||
|
||||
NR_BCCH_BCH_Message_t *mib = &carrier->mib;
|
||||
NR_ServingCellConfigCommon_t *scc = carrier->servingcellconfigcommon;
|
||||
@@ -224,11 +224,19 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
||||
|
||||
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
||||
int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
int ssb_subcarrier_offset;
|
||||
if(band<100) //FR1
|
||||
ssb_subcarrier_offset = (configuration->ssb_SubcarrierOffset<24) ? (configuration->ssb_SubcarrierOffset<<*scc->ssbSubcarrierSpacing) : configuration->ssb_SubcarrierOffset;
|
||||
else // FR2
|
||||
ssb_subcarrier_offset = configuration->ssb_SubcarrierOffset;
|
||||
frequency_range_t frequency_range = band<100?FR1:FR2;
|
||||
int scs_scaling = 1<<*scc->ssbSubcarrierSpacing;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
int ssb_subcarrier_offset = 31; // default value for NSA
|
||||
if (get_softmodem_params()->sa) {
|
||||
ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
|
||||
if(frequency_range == FR1)
|
||||
ssb_subcarrier_offset <<= *scc->ssbSubcarrierSpacing;
|
||||
}
|
||||
mib->message.choice.mib->ssb_SubcarrierOffset = ssb_subcarrier_offset&15;
|
||||
|
||||
/*
|
||||
@@ -402,7 +410,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP;
|
||||
initialDownlinkBWP->genericParameters=
|
||||
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
|
||||
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) {
|
||||
asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,
|
||||
@@ -410,7 +417,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
|
||||
}
|
||||
|
||||
|
||||
int scs_scaling0 = 1<<(configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing);
|
||||
int scs_scaling = scs_scaling0;
|
||||
int scs_scaling2 = scs_scaling0;
|
||||
@@ -519,7 +525,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
ss7->searchSpaceType->choice.common=calloc(1,sizeof(*ss7->searchSpaceType->choice.common));
|
||||
ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
|
||||
|
||||
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1, 0);
|
||||
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7);
|
||||
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5);
|
||||
@@ -1012,7 +1017,6 @@ long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) {
|
||||
return c_srs;
|
||||
}
|
||||
|
||||
|
||||
void fill_initial_SpCellConfig(int uid,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
@@ -1199,7 +1203,7 @@ void fill_initial_SpCellConfig(int uid,
|
||||
srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index=0;
|
||||
ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0);
|
||||
|
||||
scheduling_request_config(scc, cellGroupConfig->mac_CellGroupConfig, pucch_Config);
|
||||
scheduling_request_config(scc, pucch_Config);
|
||||
|
||||
set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME);
|
||||
|
||||
@@ -1214,8 +1218,9 @@ void fill_initial_SpCellConfig(int uid,
|
||||
bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList));
|
||||
|
||||
NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset));
|
||||
|
||||
uint64_t bitmap = get_ssb_bitmap(scc);
|
||||
rrc_coreset_config(coreset, curr_bwp, bitmap);
|
||||
rrc_coreset_config(coreset, 0, curr_bwp, bitmap);
|
||||
|
||||
ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list,
|
||||
coreset);
|
||||
@@ -1565,25 +1570,19 @@ void fill_initial_SpCellConfig(int uid,
|
||||
|
||||
}
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb) {
|
||||
|
||||
cellGroupConfig->cellGroupId = 0;
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
|
||||
// RLC Bearer Config
|
||||
// TS38.331 9.2.1 Default SRB configurations
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
|
||||
NR_RLC_Config_t *rlc_Config = NULL;
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig = NULL;
|
||||
long *logicalChannelGroup = NULL;
|
||||
NR_RLC_BearerConfig_t *get_SRB_RLC_BearerConfig(long channelId,
|
||||
long priority,
|
||||
e_NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration bucketSizeDuration)
|
||||
{
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
|
||||
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig->logicalChannelIdentity = 2;
|
||||
rlc_BearerConfig->logicalChannelIdentity = channelId;
|
||||
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
|
||||
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
|
||||
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 2;
|
||||
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = channelId;
|
||||
rlc_BearerConfig->reestablishRLC = NULL;
|
||||
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
|
||||
NR_RLC_Config_t *rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
rlc_Config->present = NR_RLC_Config_PR_am;
|
||||
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
|
||||
rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
@@ -1597,12 +1596,14 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
|
||||
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
|
||||
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));
|
||||
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = 3;
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = priority;
|
||||
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));
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = bucketSizeDuration;
|
||||
|
||||
long *logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
|
||||
@@ -1610,44 +1611,63 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
|
||||
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
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig_drb = NULL;
|
||||
NR_RLC_Config_t *rlc_Config_drb = NULL;
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig_drb = NULL;
|
||||
long *logicalChannelGroup_drb = NULL;
|
||||
rlc_BearerConfig_drb = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig_drb->logicalChannelIdentity = 4;
|
||||
rlc_BearerConfig_drb->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig_drb->servedRadioBearer));
|
||||
rlc_BearerConfig_drb->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
|
||||
rlc_BearerConfig_drb->servedRadioBearer->choice.drb_Identity = 1;
|
||||
rlc_BearerConfig_drb->reestablishRLC = NULL;
|
||||
rlc_Config_drb = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
|
||||
if (use_rlc_um_for_drb) nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_um_Bi_Directional);
|
||||
else nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_am);
|
||||
|
||||
|
||||
rlc_BearerConfig_drb->rlc_Config = rlc_Config_drb;
|
||||
logicalChannelConfig_drb = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig_drb->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters));
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->priority = 13;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100;
|
||||
logicalChannelGroup_drb = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup_drb = 1;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup_drb;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
rlc_BearerConfig_drb->mac_LogicalChannelConfig = logicalChannelConfig_drb;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig_drb);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig_drb);
|
||||
return rlc_BearerConfig;
|
||||
}
|
||||
|
||||
NR_RLC_BearerConfig_t *get_DRB_RLC_BearerConfig(long lcChannelId, long drbId, NR_RLC_Config_PR rlc_conf, long priority)
|
||||
{
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig->logicalChannelIdentity = lcChannelId;
|
||||
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
|
||||
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
|
||||
rlc_BearerConfig->servedRadioBearer->choice.drb_Identity = drbId;
|
||||
rlc_BearerConfig->reestablishRLC = NULL;
|
||||
|
||||
NR_RLC_Config_t *rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
nr_drb_config(rlc_Config, rlc_conf);
|
||||
rlc_BearerConfig->rlc_Config = rlc_Config;
|
||||
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = priority;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100;
|
||||
|
||||
long *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;
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
|
||||
return rlc_BearerConfig;
|
||||
}
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb, uint8_t configure_srb, uint8_t bearer_id_start, uint8_t nb_bearers_to_setup, long *priority) {
|
||||
|
||||
cellGroupConfig->cellGroupId = 0;
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
|
||||
// RLC Bearer Config
|
||||
// TS38.331 9.2.1 Default SRB configurations
|
||||
if (configure_srb){
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = get_SRB_RLC_BearerConfig(2, 3, NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5);
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
}
|
||||
|
||||
// DRB Configuration
|
||||
for (int i = bearer_id_start; i < bearer_id_start + nb_bearers_to_setup; i++ ){
|
||||
const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am;
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + i, i, rlc_conf, priority[i-bearer_id_start]);
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
}
|
||||
}
|
||||
|
||||
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_UE_NR_Capability_t *uecap,
|
||||
@@ -1673,59 +1693,24 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void fill_initial_cellGroupConfig(int uid,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
const gNB_RrcConfigurationReq *configuration)
|
||||
{
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
|
||||
NR_RLC_Config_t *rlc_Config = NULL;
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig = NULL;
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL;
|
||||
NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = NULL;
|
||||
long *logicalChannelGroup = NULL;
|
||||
|
||||
cellGroupConfig->cellGroupId = 0;
|
||||
|
||||
/* Rlc Bearer Config */
|
||||
/* TS38.331 9.2.1 Default SRB configurations */
|
||||
cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig->logicalChannelIdentity = 1;
|
||||
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
|
||||
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
|
||||
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1;
|
||||
rlc_BearerConfig->reestablishRLC = NULL;
|
||||
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
rlc_Config->present = NR_RLC_Config_PR_am;
|
||||
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
|
||||
rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35;
|
||||
rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0;
|
||||
rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45;
|
||||
rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity;
|
||||
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
|
||||
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 = 1;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
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;
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = get_SRB_RLC_BearerConfig(1, 1, NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000);
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
@@ -1750,6 +1735,14 @@ void fill_initial_cellGroupConfig(int uid,
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1;
|
||||
|
||||
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
|
||||
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
|
||||
struct NR_SchedulingRequestToAddMod *schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist));
|
||||
schedulingrequestlist->schedulingRequestId = 0;
|
||||
schedulingrequestlist->sr_ProhibitTimer = NULL;
|
||||
schedulingrequestlist->sr_TransMax = NR_SchedulingRequestToAddMod__sr_TransMax_n64;
|
||||
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
|
||||
|
||||
cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig;
|
||||
|
||||
physicalCellGroupConfig = calloc(1,sizeof(*physicalCellGroupConfig));
|
||||
@@ -1758,6 +1751,8 @@ void fill_initial_cellGroupConfig(int uid,
|
||||
physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic;
|
||||
cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig;
|
||||
|
||||
cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig));
|
||||
|
||||
fill_initial_SpCellConfig(uid,cellGroupConfig,scc,servingcellconfigdedicated,configuration);
|
||||
|
||||
cellGroupConfig->sCellToAddModList = NULL;
|
||||
@@ -1875,7 +1870,7 @@ int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_I(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
|
||||
LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
|
||||
enc_rval.encoded,(enc_rval.encoded+7)/8);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ uint8_t do_RRCReject(uint8_t Mod_id,
|
||||
uint8_t *const buffer);
|
||||
|
||||
void fill_initial_SpCellConfig(int uid,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
const gNB_RrcConfigurationReq *configuration);
|
||||
|
||||
@@ -117,7 +117,13 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_UE_NR_Capability_t *uecap,
|
||||
const gNB_RrcConfigurationReq *configuration);
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb);
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_CellGroupConfig_t *ue_context_mastercellGroup,
|
||||
int use_rlc_um_for_drb,
|
||||
uint8_t configure_srb,
|
||||
uint8_t bearer_id_start,
|
||||
uint8_t nb_bearers_to_setup,
|
||||
long *priority);
|
||||
|
||||
int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
|
||||
@@ -36,17 +36,18 @@ const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160};
|
||||
|
||||
|
||||
void rrc_coreset_config(NR_ControlResourceSet_t *coreset,
|
||||
int bwp_id,
|
||||
int curr_bwp,
|
||||
uint64_t ssb_bitmap) {
|
||||
|
||||
// frequency domain resources depends on BWP size
|
||||
// frequency domain resources depending on BWP size
|
||||
coreset->frequencyDomainResources.buf = calloc(1,6);
|
||||
coreset->frequencyDomainResources.buf[0] = (curr_bwp < 48) ? 0xf0 : 0xff;
|
||||
coreset->frequencyDomainResources.buf[1] = (curr_bwp < 96) ? 0x00 : 0xff;
|
||||
coreset->frequencyDomainResources.buf[2] = (curr_bwp < 144) ? 0x00 : 0xff;
|
||||
coreset->frequencyDomainResources.buf[3] = (curr_bwp < 192) ? 0x00 : 0xff;
|
||||
coreset->frequencyDomainResources.buf[4] = 0;
|
||||
coreset->frequencyDomainResources.buf[5] = 0;
|
||||
coreset->frequencyDomainResources.buf[4] = (curr_bwp < 240) ? 0x00 : 0xff;
|
||||
coreset->frequencyDomainResources.buf[5] = 0x00;
|
||||
coreset->frequencyDomainResources.size = 6;
|
||||
coreset->frequencyDomainResources.bits_unused = 3;
|
||||
coreset->duration = (curr_bwp < 48) ? 2 : 1;
|
||||
@@ -54,10 +55,7 @@ void rrc_coreset_config(NR_ControlResourceSet_t *coreset,
|
||||
coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||
|
||||
// The ID space is used across the BWPs of a Serving Cell as per 38.331
|
||||
coreset->controlResourceSetId = (coreset->frequencyDomainResources.buf[0] > 0) +
|
||||
(coreset->frequencyDomainResources.buf[1] > 0) +
|
||||
(coreset->frequencyDomainResources.buf[2] > 0) +
|
||||
(coreset->frequencyDomainResources.buf[3] > 0);
|
||||
coreset->controlResourceSetId = bwp_id + 1;
|
||||
|
||||
coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList));
|
||||
NR_TCI_StateId_t *tci[64];
|
||||
@@ -219,7 +217,8 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
*nzpcsi0->powerControlOffsetSS = NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
|
||||
nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId;
|
||||
set_csirs_periodicity(nzpcsi0, uid, nb_slots_per_period);
|
||||
nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL;
|
||||
nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS));
|
||||
*nzpcsi0->qcl_InfoPeriodicCSI_RS = 0;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0);
|
||||
}
|
||||
else {
|
||||
@@ -367,8 +366,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
|
||||
}
|
||||
fs_cc->supportedModulationOrderDL = CALLOC(1,sizeof(*fs_cc->supportedModulationOrderDL));
|
||||
*fs_cc->supportedModulationOrderDL = NR_ModulationOrder_qam256;
|
||||
ASN_SEQUENCE_ADD(&fs->featureSetsDownlinkPerCC->list,
|
||||
fs_cc);
|
||||
ASN_SEQUENCE_ADD(&fs->featureSetsDownlinkPerCC->list, fs_cc);
|
||||
}
|
||||
|
||||
phy_Parameters->phy_ParametersFRX_Diff = CALLOC(1,sizeof(*phy_Parameters->phy_ParametersFRX_Diff));
|
||||
@@ -385,8 +383,7 @@ void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsc
|
||||
int len_coreset = 1;
|
||||
if (curr_bwp < 48)
|
||||
len_coreset = 2;
|
||||
|
||||
// setting default TDA for DL with
|
||||
// setting default TDA for DL with TDA index 0
|
||||
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
|
||||
// k0: Slot offset between DCI and its scheduled PDSCH (see TS 38.214 clause 5.1.2.1) When the field is absent the UE applies the value 0.
|
||||
//timedomainresourceallocation->k0 = calloc(1,sizeof(*timedomainresourceallocation->k0));
|
||||
@@ -394,18 +391,21 @@ void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsc
|
||||
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
timedomainresourceallocation->startSymbolAndLength = get_SLIV(len_coreset,14-len_coreset); // basic slot configuration starting in symbol 1 til the end of the slot
|
||||
ASN_SEQUENCE_ADD(&pdsch_TimeDomainAllocationList->list, timedomainresourceallocation);
|
||||
// setting TDA for CSI-RS symbol with index 1
|
||||
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation1 = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
|
||||
timedomainresourceallocation1->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
timedomainresourceallocation1->startSymbolAndLength = get_SLIV(len_coreset,14-len_coreset-1); // 1 symbol CSI-RS
|
||||
ASN_SEQUENCE_ADD(&pdsch_TimeDomainAllocationList->list, timedomainresourceallocation1);
|
||||
if(frame_type==TDD) {
|
||||
// TDD
|
||||
if(tdd_UL_DL_ConfigurationCommon) {
|
||||
int dl_symb = tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols;
|
||||
if(dl_symb > 1) {
|
||||
timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
|
||||
// k0: Slot offset between DCI and its scheduled PDSCH (see TS 38.214 clause 5.1.2.1) When the field is absent the UE applies the value 0.
|
||||
//timedomainresourceallocation->k0 = calloc(1,sizeof(*timedomainresourceallocation->k0));
|
||||
//*timedomainresourceallocation->k0 = 0;
|
||||
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
timedomainresourceallocation->startSymbolAndLength = get_SLIV(len_coreset,dl_symb-len_coreset); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
|
||||
ASN_SEQUENCE_ADD(&pdsch_TimeDomainAllocationList->list, timedomainresourceallocation);
|
||||
// mixed slot TDA with TDA index 2
|
||||
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation2 = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
|
||||
timedomainresourceallocation2->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
|
||||
timedomainresourceallocation2->startSymbolAndLength = get_SLIV(len_coreset,dl_symb-len_coreset); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
|
||||
ASN_SEQUENCE_ADD(&pdsch_TimeDomainAllocationList->list, timedomainresourceallocation2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,58 +417,45 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){
|
||||
//TODO change to accomodate for SRS
|
||||
|
||||
frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
|
||||
int temp_min_delay = 6; // k2 = 2 or 3 won'r work as well as higher values
|
||||
if(frame_type==TDD && scc->tdd_UL_DL_ConfigurationCommon) {
|
||||
|
||||
switch (scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) {
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2p5: // 30kHz SCS
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2: // 60kHz SCS
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1p25: // 60kHz SCS
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1: // 120kHz SCS
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p625: // 120kHz SCS
|
||||
case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p5: // 120kHz SCS
|
||||
temp_min_delay = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int k2 = (min_fb_delay<temp_min_delay)?temp_min_delay:min_fb_delay;
|
||||
const int k2 = min_fb_delay;
|
||||
|
||||
uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3
|
||||
int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
|
||||
// UL TDA index 0 is basic slot configuration starting in symbol 0 til the last but one symbol
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
|
||||
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
|
||||
*pusch_timedomainresourceallocation->k2 = k2;
|
||||
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(0,13); // basic slot configuration starting in symbol 0 til the last but one symbol
|
||||
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(0,13);
|
||||
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
|
||||
|
||||
if(frame_type==TDD) {
|
||||
|
||||
// TDD
|
||||
if(scc->tdd_UL_DL_ConfigurationCommon) {
|
||||
int ul_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
|
||||
pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
|
||||
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
|
||||
*pusch_timedomainresourceallocation->k2 = k2;
|
||||
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
|
||||
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
|
||||
if (ul_symb>1) {
|
||||
// UL TDA index 1 for mixed slot (TDD)
|
||||
pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
|
||||
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
|
||||
*pusch_timedomainresourceallocation->k2 = k2;
|
||||
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
|
||||
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
|
||||
|
||||
// for msg3 in the mixed slot
|
||||
int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
|
||||
int nb_slots_per_period = ((1<<mu) * 10)/nb_periods_per_frame;
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation_msg3 = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
|
||||
pusch_timedomainresourceallocation_msg3->k2 = CALLOC(1,sizeof(long));
|
||||
*pusch_timedomainresourceallocation_msg3->k2 = nb_slots_per_period - DELTA[mu];
|
||||
if(*pusch_timedomainresourceallocation_msg3->k2 < min_fb_delay)
|
||||
*pusch_timedomainresourceallocation_msg3->k2 += nb_slots_per_period;
|
||||
AssertFatal(*pusch_timedomainresourceallocation_msg3->k2<33,"Computed k2 for msg3 %ld is larger than the range allowed by RRC (0..32)\n",
|
||||
*pusch_timedomainresourceallocation_msg3->k2);
|
||||
pusch_timedomainresourceallocation_msg3->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
pusch_timedomainresourceallocation_msg3->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
|
||||
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation_msg3);
|
||||
// UL TDA index 2 for msg3 in the mixed slot (TDD)
|
||||
int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
|
||||
int nb_slots_per_period = ((1<<mu) * 10)/nb_periods_per_frame;
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation_msg3 = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
|
||||
pusch_timedomainresourceallocation_msg3->k2 = CALLOC(1,sizeof(long));
|
||||
*pusch_timedomainresourceallocation_msg3->k2 = nb_slots_per_period - DELTA[mu];
|
||||
if(*pusch_timedomainresourceallocation_msg3->k2 < min_fb_delay)
|
||||
*pusch_timedomainresourceallocation_msg3->k2 += nb_slots_per_period;
|
||||
AssertFatal(*pusch_timedomainresourceallocation_msg3->k2<33,"Computed k2 for msg3 %ld is larger than the range allowed by RRC (0..32)\n",
|
||||
*pusch_timedomainresourceallocation_msg3->k2);
|
||||
pusch_timedomainresourceallocation_msg3->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
pusch_timedomainresourceallocation_msg3->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
|
||||
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation_msg3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,17 +640,8 @@ void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequ
|
||||
}
|
||||
|
||||
void scheduling_request_config(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
|
||||
NR_PUCCH_Config_t *pucch_Config) {
|
||||
|
||||
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
|
||||
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
|
||||
struct NR_SchedulingRequestToAddMod *schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist));
|
||||
schedulingrequestlist->schedulingRequestId = 0;
|
||||
schedulingrequestlist->sr_ProhibitTimer = NULL;
|
||||
schedulingrequestlist->sr_TransMax = NR_SchedulingRequestToAddMod__sr_TransMax_n64;
|
||||
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
|
||||
|
||||
// format with <=2 bits in pucch resource set 0
|
||||
NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[0];
|
||||
// assigning the 1st pucch resource in the set to scheduling request
|
||||
@@ -701,7 +679,7 @@ void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap,
|
||||
}
|
||||
AssertFatal(bw_rb>0,"Could not find scs-SpecificCarrierList element for scs %d",scs);
|
||||
int bw = get_supported_band_index(scs, band, bw_rb);
|
||||
AssertFatal(bw>0,"Supported band corresponding to %d RBs not found\n", bw_rb);
|
||||
AssertFatal(bw>=0,"Supported band corresponding to %d RBs not found\n", bw_rb);
|
||||
|
||||
bool supported = false;
|
||||
if (band>256) {
|
||||
@@ -758,7 +736,7 @@ void config_downlinkBWP(NR_BWP_Downlink_t *bwp,
|
||||
|
||||
NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset));
|
||||
uint64_t ssb_bitmap = get_ssb_bitmap(scc);
|
||||
rrc_coreset_config(coreset, curr_bwp, ssb_bitmap);
|
||||
rrc_coreset_config(coreset, bwp->bwp_Id, curr_bwp, ssb_bitmap);
|
||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset;
|
||||
|
||||
bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceZero=NULL;
|
||||
@@ -945,7 +923,7 @@ void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
|
||||
config_pucch_resset0(pucch_Config, uid, curr_bwp, uecap);
|
||||
config_pucch_resset1(pucch_Config, uecap);
|
||||
set_pucch_power_config(pucch_Config, configuration->do_CSIRS);
|
||||
scheduling_request_config(scc, cellGroupConfig->mac_CellGroupConfig, pucch_Config);
|
||||
scheduling_request_config(scc, pucch_Config);
|
||||
set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME);
|
||||
|
||||
ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config));
|
||||
|
||||
@@ -113,6 +113,7 @@ typedef struct physicalcellgroup_s{
|
||||
|
||||
uint64_t get_ssb_bitmap(NR_ServingCellConfigCommon_t *scc);
|
||||
void rrc_coreset_config(NR_ControlResourceSet_t *coreset,
|
||||
int bwp_id,
|
||||
int curr_bwp,
|
||||
uint64_t ssb_bitmap);
|
||||
void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList,
|
||||
@@ -125,7 +126,6 @@ void config_pucch_resset1(NR_PUCCH_Config_t *pucch_Config, NR_UE_NR_Capability_t
|
||||
void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time);
|
||||
void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs);
|
||||
void scheduling_request_config(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
|
||||
NR_PUCCH_Config_t *pucch_Config);
|
||||
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
|
||||
@@ -290,10 +290,10 @@ typedef struct gNB_RRC_UE_s {
|
||||
NR_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
|
||||
uint8_t DRB_active[8];
|
||||
|
||||
NR_SRB_INFO SI;
|
||||
NR_SRB_INFO Srb0;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb1;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb2;
|
||||
NR_SRB_INFO SI;
|
||||
NR_SRB_INFO Srb0;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb1;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb2;
|
||||
NR_MeasConfig_t *measConfig;
|
||||
HANDOVER_INFO *handover_info;
|
||||
NR_MeasResults_t *measResults;
|
||||
@@ -447,7 +447,8 @@ typedef struct {
|
||||
|
||||
NR_BCCH_BCH_Message_t mib;
|
||||
NR_BCCH_BCH_Message_t *mib_DU;
|
||||
NR_BCCH_DL_SCH_Message_t *siblock1_DU;
|
||||
NR_SIB1_t *siblock1_DU;
|
||||
//NR_BCCH_DL_SCH_Message_t *siblock1_DU;
|
||||
NR_SIB1_t *sib1;
|
||||
NR_SIB2_t *sib2;
|
||||
NR_SIB3_t *sib3;
|
||||
|
||||
@@ -120,7 +120,7 @@ rrc_gNB_generate_SecurityModeCommand(
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
);
|
||||
|
||||
uint8_t
|
||||
uint8_t
|
||||
rrc_gNB_get_next_transaction_identifier(
|
||||
module_id_t gnb_mod_idP
|
||||
);
|
||||
@@ -209,7 +209,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
|
||||
void
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP);
|
||||
rrc_gNB_ue_context_t *ue_context_pP,
|
||||
NR_CellGroupConfig_t *cell_groupConfig_from_DU);
|
||||
|
||||
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
|
||||
+534
-120
@@ -99,6 +99,7 @@
|
||||
#include <openair2/X2AP/x2ap_eNB.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
|
||||
#include "BIT_STRING.h"
|
||||
#include "assertions.h"
|
||||
@@ -164,9 +165,8 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
|
||||
|
||||
LOG_I(NR_RRC,"Done init_NR_SI\n");
|
||||
|
||||
if (NODE_IS_MONOLITHIC(rrc->node_type)){
|
||||
if (NODE_IS_MONOLITHIC(rrc->node_type) || NODE_IS_DU(rrc->node_type)){
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
@@ -276,7 +276,6 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
|
||||
|
||||
NR_CellGroupConfig_t *cgc = get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : NULL;
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
@@ -472,7 +471,6 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
||||
|
||||
rrc_mac_config_req_gNB(rrc_instance_p->module_id,
|
||||
rrc_instance_p->configuration.ssb_SubcarrierOffset,
|
||||
rrc_instance_p->configuration.pdsch_AntennaPorts,
|
||||
rrc_instance_p->configuration.pusch_AntennaPorts,
|
||||
rrc_instance_p->configuration.sib1_tda,
|
||||
@@ -808,6 +806,19 @@ rrc_gNB_generate_defaultRRCReconfiguration(
|
||||
}
|
||||
|
||||
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
|
||||
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
rrc->configuration.minRXTXTIME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ue_p->rnti,
|
||||
ue_p->masterCellGroup);
|
||||
|
||||
uint32_t delay_ms = ue_context_pP->ue_context.masterCellGroup &&
|
||||
ue_context_pP->ue_context.masterCellGroup->spCellConfig &&
|
||||
ue_context_pP->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
@@ -825,7 +836,8 @@ rrc_gNB_generate_defaultRRCReconfiguration(
|
||||
void
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP
|
||||
rrc_gNB_ue_context_t *ue_context_pP,
|
||||
NR_CellGroupConfig_t *cell_groupConfig_from_DU
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
@@ -845,7 +857,10 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
int qos_flow_index = 0;
|
||||
int pdu_sessions_done = 0;
|
||||
int i;
|
||||
NR_CellGroupConfig_t *cellGroupConfig;
|
||||
uint8_t drb_id_to_setup_start = 1;
|
||||
uint8_t nb_drb_to_setup = 0;
|
||||
long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
|
||||
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
|
||||
|
||||
@@ -887,6 +902,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
|
||||
DRB_config = CALLOC(1, sizeof(*DRB_config));
|
||||
DRB_config->drb_Identity = i+1;
|
||||
if (drb_id_to_setup_start == 1) drb_id_to_setup_start = DRB_config->drb_Identity;
|
||||
nb_drb_to_setup++;
|
||||
DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation));
|
||||
DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config;
|
||||
// sdap_Config
|
||||
@@ -999,9 +1016,17 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
}
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup,
|
||||
rrc->um_on_default_drb);
|
||||
if(cell_groupConfig_from_DU == NULL){
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
// FIXME: fill_mastercellGroupConfig() won't fill the right priorities or
|
||||
// bearer IDs for the DRBs
|
||||
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup, rrc->um_on_default_drb, (drb_id_to_setup_start < 2) ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority);
|
||||
}
|
||||
else{
|
||||
LOG_I(NR_RRC, "Master cell group originating from the DU \n");
|
||||
cellGroupConfig = cell_groupConfig_from_DU;
|
||||
}
|
||||
|
||||
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
|
||||
xid,
|
||||
*SRB_configList2,
|
||||
@@ -1056,6 +1081,18 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
#endif
|
||||
|
||||
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
rrc->configuration.minRXTXTIME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ue_context_pP->ue_context.rnti,
|
||||
ue_context_pP->ue_context.masterCellGroup);
|
||||
|
||||
uint32_t delay_ms = ue_context_pP->ue_context.masterCellGroup &&
|
||||
ue_context_pP->ue_context.masterCellGroup->spCellConfig &&
|
||||
ue_context_pP->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
@@ -1389,7 +1426,6 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
|
||||
NR_DRB_Identity_t *drb_id_p = NULL;
|
||||
// uint8_t nr_DRB2LCHAN[8];
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
||||
|
||||
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
|
||||
|
||||
@@ -1428,20 +1464,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
NULL,
|
||||
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
|
||||
/* Refresh SRBs/DRBs */
|
||||
|
||||
if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
rrc->configuration.minRXTXTIME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ue_context_pP->ue_context.rnti,
|
||||
ue_context_pP->ue_context.masterCellGroup);
|
||||
LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
|
||||
nr_rrc_rlc_config_asn1_req(ctxt_pP,
|
||||
SRB_configList, // NULL,
|
||||
@@ -1450,49 +1473,6 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
NULL,
|
||||
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
|
||||
}
|
||||
else if(SRB_configList!=NULL || DRB_configList!=NULL){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
|
||||
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p);
|
||||
req->gNB_CU_ue_id = 0;
|
||||
req->gNB_DU_ue_id = 0;
|
||||
req->rnti = ue_context_pP->ue_context.rnti;
|
||||
req->mcc = rrc->configuration.mcc[0];
|
||||
req->mnc = rrc->configuration.mnc[0];
|
||||
req->mnc_digit_length = rrc->configuration.mnc_digit_length[0];
|
||||
req->nr_cellid = rrc->nr_cellid;
|
||||
if(SRB_configList!=NULL){
|
||||
req->srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t));
|
||||
req->srbs_to_be_setup_length = SRB_configList->list.count;
|
||||
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
|
||||
for (int i = 0; i < SRB_configList->list.count; i++){
|
||||
if(SRB_configList->list.array[i]->srb_Identity > 1){
|
||||
SRBs[i].srb_id = SRB_configList->list.array[i]->srb_Identity;
|
||||
SRBs[i].lcid = SRB_configList->list.array[i]->srb_Identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(DRB_configList!=NULL){
|
||||
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
|
||||
memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t));
|
||||
req->drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
|
||||
req->drbs_to_be_setup_length = DRB_configList->list.count;
|
||||
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
|
||||
LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, req->drbs_to_be_setup_length);
|
||||
for (int i = 0; i < DRB_configList->list.count; i++){
|
||||
DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
|
||||
DRBs[i].rlc_mode = RLC_MODE_AM;
|
||||
DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
|
||||
DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd;
|
||||
DRBs[i].up_ul_tnl_length = 1;
|
||||
DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr);
|
||||
DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd;
|
||||
DRBs[i].up_dl_tnl_length = 1;
|
||||
}
|
||||
LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
|
||||
}
|
||||
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the SRB active in UE context */
|
||||
@@ -1643,7 +1623,7 @@ rrc_gNB_generate_RRCReestablishment(
|
||||
ue_context->Srb0.Tx_buffer.payload_size);
|
||||
#if(0)
|
||||
/* TODO : It may be needed if gNB goes into full stack working. */
|
||||
UE_id = find_nr_UE_id(module_id, rnti);
|
||||
UE = find_nr_UE(module_id, rnti);
|
||||
if (UE_id != -1) {
|
||||
/* Activate reject timer, if RRCComplete not received after 10 frames, reject UE */
|
||||
RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
|
||||
@@ -1975,6 +1955,19 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
|
||||
NULL,
|
||||
masterCellGroup);
|
||||
|
||||
gNB_RrcConfigurationReq *configuration = &RC.nrrrc[ctxt_pP->module_id]->configuration;
|
||||
rrc_mac_config_req_gNB(ctxt_pP->module_id,
|
||||
configuration->pdsch_AntennaPorts,
|
||||
configuration->pusch_AntennaPorts,
|
||||
configuration->sib1_tda,
|
||||
configuration->minRXTXTIME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ue_context_pP->ue_context.rnti,
|
||||
masterCellGroup);
|
||||
|
||||
nr_rrc_data_req(ctxt_pP,
|
||||
DCCH,
|
||||
rrc_gNB_mui++,
|
||||
@@ -2781,11 +2774,76 @@ rrc_gNB_decode_dcch(
|
||||
ul_dcch_msg);
|
||||
}
|
||||
|
||||
if (ue_context_p->ue_context.established_pdu_sessions_flag == 1) {
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(ctxt_pP, ue_context_p);
|
||||
} else {
|
||||
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
|
||||
if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)){
|
||||
if (ue_context_p->ue_context.established_pdu_sessions_flag == 1) {
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(ctxt_pP, ue_context_p, NULL);
|
||||
} else {
|
||||
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
|
||||
}
|
||||
}
|
||||
else{
|
||||
/*Generate a UE context setup request message towards the DU to provide the UE
|
||||
*capability info and get the updates on master cell group config from the DU*/
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
|
||||
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p);
|
||||
//UE_IDs will be extracted from F1AP layer
|
||||
req->gNB_CU_ue_id = 0;
|
||||
req->gNB_DU_ue_id = 0;
|
||||
req->rnti = ue_context_p->ue_context.rnti;
|
||||
req->mcc = RC.nrrrc[ctxt_pP->module_id]->configuration.mcc[0];
|
||||
req->mnc = RC.nrrrc[ctxt_pP->module_id]->configuration.mnc[0];
|
||||
req->mnc_digit_length = RC.nrrrc[ctxt_pP->module_id]->configuration.mnc_digit_length[0];
|
||||
req->nr_cellid = RC.nrrrc[ctxt_pP->module_id]->nr_cellid;
|
||||
|
||||
if (ue_context_p->ue_context.established_pdu_sessions_flag == 1) {
|
||||
/*Instruction towards the DU for SRB2 configuration*/
|
||||
req->srbs_to_be_setup = malloc(1*sizeof(f1ap_srb_to_be_setup_t));
|
||||
req->srbs_to_be_setup_length = 1;
|
||||
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
|
||||
SRBs[0].srb_id = 2;
|
||||
SRBs[0].lcid = 2;
|
||||
|
||||
/*Instruction towards the DU for DRB configuration and tunnel creation*/
|
||||
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
|
||||
memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t));
|
||||
req->drbs_to_be_setup = malloc(1*sizeof(f1ap_drb_to_be_setup_t));
|
||||
req->drbs_to_be_setup_length = 1;
|
||||
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
|
||||
LOG_I(RRC, "Length of DRB list:%d \n", req->drbs_to_be_setup_length);
|
||||
DRBs[0].drb_id = 1;
|
||||
DRBs[0].rlc_mode = RLC_MODE_AM;
|
||||
DRBs[0].up_ul_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt_pP->module_id]->eth_params_s.my_addr);
|
||||
DRBs[0].up_ul_tnl[0].port=RC.nrrrc[ctxt_pP->module_id]->eth_params_s.my_portd;
|
||||
DRBs[0].up_ul_tnl_length = 1;
|
||||
DRBs[0].up_dl_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt_pP->module_id]->eth_params_s.remote_addr);
|
||||
DRBs[0].up_dl_tnl[0].port=RC.nrrrc[ctxt_pP->module_id]->eth_params_s.remote_portd;
|
||||
DRBs[0].up_dl_tnl_length = 1;
|
||||
}
|
||||
if( ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.present ==
|
||||
NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation ) {
|
||||
struct NR_UE_CapabilityRAT_ContainerList *ue_CapabilityRAT_ContainerList =
|
||||
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList;
|
||||
if(ue_CapabilityRAT_ContainerList!=NULL){
|
||||
LOG_I(NR_RRC, "ue_CapabilityRAT_ContainerList is present \n");
|
||||
req->cu_to_du_rrc_information = calloc(1,sizeof(cu_to_du_rrc_information_t));
|
||||
req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList = calloc(1,4096);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRAT_ContainerList,
|
||||
NULL,
|
||||
ue_CapabilityRAT_ContainerList,
|
||||
req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList,
|
||||
4096);
|
||||
AssertFatal (enc_rval.encoded > 0, "ASN1 ue_CapabilityRAT_ContainerList encoding failed (%s, %jd)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length = (enc_rval.encoded+7)>>3;
|
||||
}
|
||||
else{
|
||||
LOG_I(NR_RRC, "ue_CapabilityRAT_ContainerList is not present \n");
|
||||
}
|
||||
}
|
||||
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
@@ -2898,11 +2956,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
|
||||
memset(mib->message.choice.mib,0,sizeof(struct NR_MIB));
|
||||
memcpy(mib->message.choice.mib, mib_DU->message.choice.mib, sizeof(struct NR_MIB));
|
||||
|
||||
rrc->carrier.SIB1 = malloc(f1_setup_req->sib1_length[i]);
|
||||
rrc->carrier.sizeof_SIB1 = f1_setup_req->sib1_length[i];
|
||||
memcpy((void *)rrc->carrier.SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]);
|
||||
dec_rval = uper_decode_complete(NULL,
|
||||
&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
&asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
(void **)&rrc->carrier.siblock1_DU,
|
||||
f1_setup_req->sib1[i],
|
||||
f1_setup_req->sib1_length[i]);
|
||||
@@ -2912,12 +2967,12 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
|
||||
dec_rval.consumed );
|
||||
|
||||
// Parse message and extract SystemInformationBlockType1 field
|
||||
NR_BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier.siblock1_DU;
|
||||
AssertFatal(bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1,
|
||||
"bcch_message->message.present != NR_BCCH_DL_SCH_MessageType_PR_c1\n");
|
||||
AssertFatal(bcch_message->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
|
||||
"bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
|
||||
rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||
rrc->carrier.sib1 = rrc->carrier.siblock1_DU;
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1)){
|
||||
LOG_I(NR_RRC, "Printing received SIB1 container inside F1 setup request message:\n");
|
||||
xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)rrc->carrier.sib1);
|
||||
}
|
||||
|
||||
rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci;
|
||||
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
|
||||
@@ -3245,10 +3300,236 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
|
||||
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p);
|
||||
uint32_t incoming_teid = 0;
|
||||
|
||||
if(req->cu_to_du_rrc_information!=NULL){
|
||||
if(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList!=NULL){
|
||||
LOG_I(NR_RRC, "Length of ue_CapabilityRAT_ContainerList is: %d \n", (int) req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length);
|
||||
struct NR_UE_CapabilityRAT_ContainerList *ue_CapabilityRAT_ContainerList = NULL;
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_UE_CapabilityRAT_ContainerList,
|
||||
(void **)&ue_CapabilityRAT_ContainerList,
|
||||
(uint8_t *)req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList,
|
||||
(int) req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length);
|
||||
|
||||
NR_CellGroupConfig_t *cellGroupConfig;
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup,rrc->um_on_default_drb);
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
AssertFatal(1==0,"UE Capability RAT ContainerList decode error\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_UE_CapabilityRAT_ContainerList, ue_CapabilityRAT_ContainerList, 1 );
|
||||
return;
|
||||
}
|
||||
//To fill ue_context.UE_Capability_MRDC, ue_context.UE_Capability_nr ...
|
||||
int NR_index = -1;
|
||||
for(int i = 0;i < ue_CapabilityRAT_ContainerList->list.count; i++){
|
||||
if(ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
|
||||
NR_RAT_Type_nr){
|
||||
LOG_I(NR_RRC, "DU received NR_RAT_Type_nr UE capabilities Info through the UE Context Setup Request from the CU \n");
|
||||
if(ue_context_p->ue_context.UE_Capability_nr){
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
|
||||
ue_context_p->ue_context.UE_Capability_nr = 0;
|
||||
}
|
||||
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_UE_NR_Capability,
|
||||
(void**)&ue_context_p->ue_context.UE_Capability_nr,
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf,
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size,
|
||||
0,0);
|
||||
if(LOG_DEBUGFLAG(DEBUG_ASN1)){
|
||||
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
|
||||
}
|
||||
|
||||
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){
|
||||
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode nr UE capabilities (%zu bytes)\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(&ctxt),dec_rval.consumed);
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
|
||||
ue_context_p->ue_context.UE_Capability_nr = 0;
|
||||
}
|
||||
|
||||
ue_context_p->ue_context.UE_Capability_size =
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size;
|
||||
if(NR_index != -1){
|
||||
LOG_E(NR_RRC,"fatal: more than 1 eutra capability\n");
|
||||
exit(1);
|
||||
}
|
||||
NR_index = i;
|
||||
}
|
||||
|
||||
if(ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
|
||||
NR_RAT_Type_eutra_nr){
|
||||
LOG_I(NR_RRC, "DU received NR_RAT_Type_eutra_nr UE capabilities Info through the UE Context Setup Request from the CU \n");
|
||||
if(ue_context_p->ue_context.UE_Capability_MRDC){
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
|
||||
ue_context_p->ue_context.UE_Capability_MRDC = 0;
|
||||
}
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_UE_MRDC_Capability,
|
||||
(void**)&ue_context_p->ue_context.UE_Capability_MRDC,
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf,
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size,
|
||||
0,0);
|
||||
if(LOG_DEBUGFLAG(DEBUG_ASN1)){
|
||||
xer_fprint(stdout,&asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
|
||||
}
|
||||
|
||||
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){
|
||||
LOG_E(NR_RRC,PROTOCOL_NR_RRC_CTXT_FMT" Failed to decode nr UE capabilities (%zu bytes)\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(&ctxt),dec_rval.consumed);
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
|
||||
ue_context_p->ue_context.UE_Capability_MRDC = 0;
|
||||
}
|
||||
ue_context_p->ue_context.UE_MRDC_Capability_size =
|
||||
ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size;
|
||||
}
|
||||
|
||||
if(ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
|
||||
NR_RAT_Type_eutra){
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t drb_id_to_setup_start = 0;
|
||||
uint8_t nb_drb_to_setup = 0;
|
||||
long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
|
||||
|
||||
/* Configure SRB2 */
|
||||
NR_SRB_ToAddMod_t *SRB2_config = NULL;
|
||||
NR_SRB_ToAddModList_t *SRB_configList = NULL;
|
||||
uint8_t SRBs_before_new_addition = 0;
|
||||
|
||||
if(req->srbs_to_be_setup_length>0){
|
||||
if(ue_context_p->ue_context.SRB_configList == NULL){
|
||||
LOG_W(NR_RRC, "The SRB list of the UE context is empty before the addition of new SRB at the DU \n");
|
||||
ue_context_p->ue_context.SRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.SRB_configList));
|
||||
}
|
||||
SRB_configList = ue_context_p->ue_context.SRB_configList;
|
||||
SRBs_before_new_addition = SRB_configList->list.count;
|
||||
for (int i=0; i<req->srbs_to_be_setup_length; i++){
|
||||
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
|
||||
SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id;
|
||||
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
|
||||
}
|
||||
}
|
||||
|
||||
/* Configure DRB */
|
||||
NR_DRB_ToAddMod_t *DRB_config = NULL;
|
||||
NR_DRB_ToAddModList_t *DRB_configList = NULL;
|
||||
if(req->drbs_to_be_setup_length>0){
|
||||
if(ue_context_p->ue_context.DRB_configList == NULL){
|
||||
ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList));
|
||||
}
|
||||
DRB_configList = ue_context_p->ue_context.DRB_configList;
|
||||
nb_drb_to_setup = req->drbs_to_be_setup_length;
|
||||
for (int i=0; i<req->drbs_to_be_setup_length; i++){
|
||||
DRB_config = CALLOC(1, sizeof(*DRB_config));
|
||||
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
|
||||
ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
|
||||
f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i];
|
||||
transport_layer_addr_t addr;
|
||||
memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address));
|
||||
addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8;
|
||||
extern instance_t DUuniqInstance;
|
||||
if (!drb_id_to_setup_start) drb_id_to_setup_start = drb_p.drb_id;
|
||||
incoming_teid=newGtpuCreateTunnel(DUuniqInstance,
|
||||
req->rnti,
|
||||
drb_p.drb_id,
|
||||
drb_p.drb_id,
|
||||
drb_p.up_ul_tnl[0].teid,
|
||||
addr,
|
||||
drb_p.up_ul_tnl[0].port,
|
||||
DURecvCb);
|
||||
}
|
||||
}
|
||||
|
||||
NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length>0)
|
||||
// FIXME: fill_mastercellGroupConfig() won't fill the right priorities or
|
||||
// bearer IDs for the DRBs
|
||||
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup, rrc->um_on_default_drb, SRB2_config ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority);
|
||||
|
||||
apply_macrlc_config(rrc, ue_context_p, &ctxt);
|
||||
|
||||
if(req->rrc_container_length > 0){
|
||||
mem_block_t *pdcp_pdu_p = get_free_mem_block(req->rrc_container_length, __func__);
|
||||
memcpy(&pdcp_pdu_p->data[0], req->rrc_container, req->rrc_container_length);
|
||||
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, req->rrc_container_length, pdcp_pdu_p);
|
||||
LOG_I(F1AP, "Printing RRC Container of UE context setup request: \n");
|
||||
for (int j=0; j<req->rrc_container_length; j++){
|
||||
printf("%02x ", pdcp_pdu_p->data[j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* Fill the UE context setup response ITTI message to send to F1AP */
|
||||
resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
|
||||
resp->rnti = ctxt.rnti;
|
||||
if(DRB_configList){
|
||||
if(DRB_configList->list.count > 0){
|
||||
resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
|
||||
resp->drbs_to_be_setup_length = DRB_configList->list.count;
|
||||
for (int i=0; i<DRB_configList->list.count; i++){
|
||||
resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
|
||||
resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM;
|
||||
resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid;
|
||||
resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr);
|
||||
resp->drbs_to_be_setup[i].up_dl_tnl_length = 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context setup request with a DRB to setup list\n");
|
||||
}
|
||||
}
|
||||
if(SRB_configList){
|
||||
if(SRB_configList->list.count >0 && SRBs_before_new_addition < SRB_configList->list.count){
|
||||
resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t));
|
||||
resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length;
|
||||
for (int i=SRBs_before_new_addition; i<SRB_configList->list.count; i++){
|
||||
resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity;
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
|
||||
}
|
||||
/* fixme:
|
||||
* Here we should be encoding the updates on cellgroupconfig based on the content of UE capabilities
|
||||
*/
|
||||
resp->du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t));
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
ue_context_p->ue_context.masterCellGroup, //(void *)cellGroupConfig,
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig,
|
||||
1024);
|
||||
if (enc_rval.encoded == -1) {
|
||||
LOG_E(F1AP,"Could not encode ue_context.masterCellGroup, failed element %s\n",enc_rval.failed_type->name);
|
||||
exit(-1);
|
||||
}
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded+7)>>3;
|
||||
free(cellGroupConfig);
|
||||
itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p);
|
||||
}
|
||||
|
||||
static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, const char *msg_name, instance_t instance){
|
||||
|
||||
f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_MODIFICATION_REQ(msg_p);
|
||||
protocol_ctxt_t ctxt;
|
||||
ctxt.rnti = req->rnti;
|
||||
ctxt.module_id = instance;
|
||||
ctxt.instance = instance;
|
||||
ctxt.enb_flag = 1;
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
|
||||
gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id];
|
||||
struct rrc_gNB_ue_context_s *ue_context_p =
|
||||
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_RESP);
|
||||
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_MODIFICATION_RESP(message_p);
|
||||
uint32_t incoming_teid = 0;
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
|
||||
/* Configure SRB2 */
|
||||
NR_SRB_ToAddMod_t *SRB2_config = NULL;
|
||||
@@ -3297,11 +3578,46 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
|
||||
}
|
||||
}
|
||||
|
||||
apply_macrlc_config(rrc, ue_context_p, &ctxt);
|
||||
if(req->srbs_to_be_setup_length>0 || req->drbs_to_be_setup_length>0){
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
uint8_t drb_id_to_setup_start = 1;
|
||||
long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
|
||||
fill_mastercellGroupConfig(cellGroupConfig,
|
||||
ue_context_p->ue_context.masterCellGroup,
|
||||
rrc->um_on_default_drb,
|
||||
drb_id_to_setup_start < 2 ? 1 : 0,
|
||||
drb_id_to_setup_start,
|
||||
req->drbs_to_be_setup_length,
|
||||
drb_priority);
|
||||
apply_macrlc_config(rrc, ue_context_p, &ctxt);
|
||||
}
|
||||
if(req->ReconfigComplOutcome == RRCreconf_failure){
|
||||
LOG_W(NR_RRC, "CU reporting RRC Reconfiguration failure \n");
|
||||
}
|
||||
else if(req->ReconfigComplOutcome == RRCreconf_success){
|
||||
LOG_I(NR_RRC, "CU reporting RRC Reconfiguration success \n");
|
||||
if(ue_context_p->ue_context.DRB_configList!=NULL){
|
||||
LOG_I(NR_RRC, "Send first DDD buffer status reporting towards the CU through an ITTI message to gtp-u \n");
|
||||
uint8_t drb_id = ue_context_p->ue_context.DRB_configList->list.array[0]->drb_Identity;
|
||||
rnti_t rnti = ue_context_p->ue_context.rnti;
|
||||
int rlc_tx_buffer_space = nr_rlc_get_available_tx_space(rnti, drb_id);
|
||||
LOG_I(NR_RRC, "Reported in DDD drb_id:%d, rnti:%d\n", drb_id, rnti);
|
||||
MessageDef *msg = itti_alloc_new_message_sized(TASK_RRC_GNB, 0, GTPV1U_DU_BUFFER_REPORT_REQ,
|
||||
sizeof(gtpv1u_gnb_tunnel_data_req_t));
|
||||
gtpv1u_DU_buffer_report_req_t *req=>PV1U_DU_BUFFER_REPORT_REQ(msg);
|
||||
req->pdusession_id = drb_id;
|
||||
req->rnti = rnti;
|
||||
req->buffer_availability = rlc_tx_buffer_space; //10000000; //Hardcoding to be removed and read the actual RLC buffer availability instead
|
||||
extern instance_t DUuniqInstance;
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill the UE context setup response ITTI message to send to F1AP */
|
||||
resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
|
||||
resp->rnti = ctxt.rnti;
|
||||
if(DRB_configList){
|
||||
if(DRB_configList){
|
||||
if(DRB_configList->list.count > 0){
|
||||
resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
|
||||
resp->drbs_to_be_setup_length = DRB_configList->list.count;
|
||||
@@ -3314,7 +3630,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context setup request with a DRB to setup list\n");
|
||||
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context modification request with a DRB to setup list\n");
|
||||
}
|
||||
}
|
||||
if(SRB_configList){
|
||||
@@ -3326,20 +3642,23 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context modification request at the DU\n");
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
|
||||
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context modification request at the DU\n");
|
||||
}
|
||||
resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t));
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
|
||||
//if(cellGroupConfig != NULL) {
|
||||
resp->du_to_cu_rrc_information = calloc(1,sizeof(du_to_cu_rrc_information_t));
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
resp->du_to_cu_rrc_information,
|
||||
ue_context_p->ue_context.masterCellGroup, //(void *)cellGroupConfig,
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig,
|
||||
1024);
|
||||
resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3;
|
||||
free(cellGroupConfig);
|
||||
resp->du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded+7)>>3;
|
||||
//}
|
||||
itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p);
|
||||
}
|
||||
|
||||
@@ -3358,8 +3677,8 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_CellGroupConfig,
|
||||
(void **)&cellGroupConfig,
|
||||
(uint8_t *)resp->du_to_cu_rrc_information,
|
||||
(int) resp->du_to_cu_rrc_information_length);
|
||||
(uint8_t *)resp->du_to_cu_rrc_information->cellGroupConfig,
|
||||
(int) resp->du_to_cu_rrc_information->cellGroupConfig_length);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
AssertFatal(1==0,"Cell group config decode error\n");
|
||||
@@ -3374,20 +3693,89 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch
|
||||
}
|
||||
if(cellGroupConfig->rlc_BearerToAddModList!=NULL){
|
||||
if(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList != NULL){
|
||||
LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n");
|
||||
free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList);
|
||||
int ue_ctxt_rlc_Bearers = ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList->list.count;
|
||||
for(int i=ue_ctxt_rlc_Bearers; i<ue_ctxt_rlc_Bearers + cellGroupConfig->rlc_BearerToAddModList->list.count; i++){
|
||||
ASN_SEQUENCE_ADD(&ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList->list,
|
||||
cellGroupConfig->rlc_BearerToAddModList->list.array[i-ue_ctxt_rlc_Bearers]);
|
||||
}
|
||||
}
|
||||
ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
|
||||
else{
|
||||
LOG_W(NR_RRC, "Empty rlc_BearerToAddModList at ue_context of the CU before filling the updates from UE context setup response \n");
|
||||
ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
|
||||
sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
}
|
||||
}
|
||||
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup);
|
||||
|
||||
if (ue_context_p->ue_context.established_pdu_sessions_flag == 1) {
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p, cellGroupConfig);
|
||||
} else {
|
||||
rrc_gNB_generate_defaultRRCReconfiguration(&ctxt, ue_context_p);
|
||||
}
|
||||
|
||||
free(cellGroupConfig->rlc_BearerToAddModList);
|
||||
free(cellGroupConfig);
|
||||
|
||||
}
|
||||
|
||||
static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, const char *msg_name, instance_t instance){
|
||||
|
||||
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
|
||||
protocol_ctxt_t ctxt;
|
||||
ctxt.rnti = resp->rnti;
|
||||
ctxt.module_id = instance;
|
||||
ctxt.instance = instance;
|
||||
ctxt.enb_flag = 1;
|
||||
ctxt.eNB_index = instance;
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti);
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
|
||||
if(resp->du_to_cu_rrc_information->cellGroupConfig!=NULL){
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_CellGroupConfig,
|
||||
(void **)&cellGroupConfig,
|
||||
(uint8_t *)resp->du_to_cu_rrc_information->cellGroupConfig,
|
||||
(int) resp->du_to_cu_rrc_information->cellGroupConfig_length);
|
||||
|
||||
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
AssertFatal(1==0,"Cell group config decode error\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 );
|
||||
return;
|
||||
}
|
||||
//xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig);
|
||||
|
||||
if(ue_context_p->ue_context.masterCellGroup == NULL){
|
||||
ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
}
|
||||
|
||||
if(cellGroupConfig->rlc_BearerToAddModList!=NULL){
|
||||
if(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList != NULL){
|
||||
int ue_ctxt_rlc_Bearers = ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList->list.count;
|
||||
for(int i=ue_ctxt_rlc_Bearers; i<ue_ctxt_rlc_Bearers + cellGroupConfig->rlc_BearerToAddModList->list.count; i++){
|
||||
ASN_SEQUENCE_ADD(&ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList->list,
|
||||
cellGroupConfig->rlc_BearerToAddModList->list.array[i-ue_ctxt_rlc_Bearers]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
LOG_W(NR_RRC, "Empty rlc_BearerToAddModList at ue_context of the CU before filling the updates from UE context setup response \n");
|
||||
ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
|
||||
sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
}
|
||||
}
|
||||
LOG_I(NR_RRC, "Updated master cell group configuration stored at the UE context of the CU:\n");
|
||||
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup);
|
||||
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p, cellGroupConfig);
|
||||
|
||||
free(cellGroupConfig->rlc_BearerToAddModList);
|
||||
free(cellGroupConfig);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int mask_flip(unsigned int x) {
|
||||
return((((x>>8) + (x<<8))&0xffff)>>6);
|
||||
}
|
||||
@@ -3549,6 +3937,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
FILE *fd=NULL;//fopen("nrRRCstats.log","w");
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
ctxt_pP->rnti = ue_context_p->ue_id_rnti;
|
||||
gNB_MAC_INST *nrmac=RC.nrmac[ctxt_pP->module_id]; //WHAT A BEAUTIFULL RACE CONDITION !!!
|
||||
|
||||
if (fd) {
|
||||
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
|
||||
@@ -3588,15 +3977,27 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
|
||||
// Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G
|
||||
if(ue_context_p->ue_context.StatusRrc < NR_RRC_CONNECTED || ue_context_p->ue_context.gNB_ue_ngap_id == 0) {
|
||||
mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti);
|
||||
rrc_rlc_remove_ue(ctxt_pP);
|
||||
pdcp_remove_UE(ctxt_pP);
|
||||
if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->instance]->node_type)){
|
||||
mac_remove_nr_ue(nrmac, ctxt_pP->rnti);
|
||||
rrc_rlc_remove_ue(ctxt_pP);
|
||||
pdcp_remove_UE(ctxt_pP);
|
||||
|
||||
/* remove RRC UE Context */
|
||||
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti);
|
||||
if (ue_context_p) {
|
||||
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
||||
LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti);
|
||||
/* remove RRC UE Context */
|
||||
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti);
|
||||
if (ue_context_p) {
|
||||
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
||||
LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti);
|
||||
}
|
||||
}
|
||||
// In case of CU trigger UE context release command towards the DU
|
||||
else{
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
|
||||
f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p);
|
||||
rel_cmd->rnti = ctxt_pP->rnti;
|
||||
rel_cmd->cause = F1AP_CAUSE_RADIO_NETWORK;
|
||||
rel_cmd->cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
|
||||
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, message_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3612,7 +4013,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
ue_context_p->ue_context.rnti);
|
||||
ue_context_p->ue_context.ue_release_timer_rrc = 0;
|
||||
|
||||
mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti);
|
||||
mac_remove_nr_ue(nrmac, ctxt_pP->rnti);
|
||||
rrc_rlc_remove_ue(ctxt_pP);
|
||||
pdcp_remove_UE(ctxt_pP);
|
||||
newGtpuDeleteAllTunnels(ctxt_pP->instance, ctxt_pP->rnti);
|
||||
@@ -3631,7 +4032,6 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
|
||||
if (fd) fclose(fd);
|
||||
|
||||
|
||||
/* send a tick to x2ap */
|
||||
if (is_x2ap_enabled()){
|
||||
msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_SUBFRAME_PROCESS);
|
||||
@@ -3783,17 +4183,30 @@ void *rrc_gnb_task(void *args_p) {
|
||||
rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p));
|
||||
break;
|
||||
|
||||
case NR_DU_RRC_DL_INDICATION:
|
||||
rrc_process_DU_DL(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
case NR_DU_RRC_DL_INDICATION:
|
||||
rrc_process_DU_DL(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_SETUP_REQ:
|
||||
rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
case F1AP_UE_CONTEXT_SETUP_REQ:
|
||||
rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_SETUP_RESP:
|
||||
rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
case F1AP_UE_CONTEXT_SETUP_RESP:
|
||||
rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_MODIFICATION_RESP:
|
||||
rrc_CU_process_ue_context_modification_response(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_MODIFICATION_REQ:
|
||||
rrc_DU_process_ue_context_modification_request(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_RELEASE_CMD:
|
||||
LOG_W(NR_RRC, "Received F1AP_UE_CONTEXT_RELEASE_CMD for processing at the RRC layer of the DU. Processing function "
|
||||
"implementation is pending\n");
|
||||
break;
|
||||
|
||||
/* Messages from X2AP */
|
||||
case X2AP_ENDC_SGNB_ADDITION_REQ:
|
||||
@@ -4064,5 +4477,6 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe)
|
||||
message_p = itti_alloc_new_message(TASK_RRC_GNB, 0, RRC_SUBFRAME_PROCESS);
|
||||
RRC_SUBFRAME_PROCESS(message_p).ctxt = *ctxt;
|
||||
RRC_SUBFRAME_PROCESS(message_p).CC_id = CC_id;
|
||||
LOG_D(NR_RRC, "Time in RRC: %u/ %u \n", frame, subframe);
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, ctxt->module_id, message_p);
|
||||
}
|
||||
|
||||
@@ -307,7 +307,6 @@ nr_rrc_pdcp_config_security(
|
||||
//uint8_t *k_kdf = NULL;
|
||||
static int print_keys= 1;
|
||||
|
||||
|
||||
/* Derive the keys from kgnb */
|
||||
if (SRB_configList != NULL) {
|
||||
nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
@@ -905,7 +904,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
|
||||
for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) {
|
||||
// if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) {
|
||||
if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) {
|
||||
pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession];
|
||||
pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdu_sessions_done];
|
||||
tmp->pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id;
|
||||
// tmp->pdusession_id = 1;
|
||||
tmp->nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos;
|
||||
@@ -1050,7 +1049,46 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
|
||||
// TEST
|
||||
// ue_context_p->ue_context.pdusession[0].status = PDU_SESSION_STATUS_DONE;
|
||||
// rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(&ctxt, ue_context_p, 0);
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p);
|
||||
if(!NODE_IS_CU(RC.nrrrc[ctxt.module_id]->node_type)){
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p, NULL);
|
||||
}
|
||||
else{
|
||||
/*Generate a UE context modification request message towards the DU to instruct the DU
|
||||
*for SRB2 and DRB configuration and get the updates on master cell group config from the DU*/
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_REQ);
|
||||
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_MODIFICATION_REQ (message_p);
|
||||
req->rnti = ue_context_p->ue_context.rnti;
|
||||
req->mcc = RC.nrrrc[ctxt.module_id]->configuration.mcc[0];
|
||||
req->mnc = RC.nrrrc[ctxt.module_id]->configuration.mnc[0];
|
||||
req->mnc_digit_length = RC.nrrrc[ctxt.module_id]->configuration.mnc_digit_length[0];
|
||||
req->nr_cellid = RC.nrrrc[ctxt.module_id]->nr_cellid;
|
||||
|
||||
/*Instruction towards the DU for SRB2 configuration*/
|
||||
req->srbs_to_be_setup = malloc(1*sizeof(f1ap_srb_to_be_setup_t));
|
||||
req->srbs_to_be_setup_length = 1;
|
||||
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
|
||||
SRBs[0].srb_id = 2;
|
||||
SRBs[0].lcid = 2;
|
||||
|
||||
/*Instruction towards the DU for DRB configuration and tunnel creation*/
|
||||
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
|
||||
memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t));
|
||||
req->drbs_to_be_setup = malloc(1*sizeof(f1ap_drb_to_be_setup_t));
|
||||
req->drbs_to_be_setup_length = 1;
|
||||
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
|
||||
LOG_D(RRC, "Length of DRB list:%d \n", req->drbs_to_be_setup_length);
|
||||
DRBs[0].drb_id = 1;
|
||||
DRBs[0].rlc_mode = RLC_MODE_AM;
|
||||
DRBs[0].up_ul_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt.module_id]->eth_params_s.my_addr);
|
||||
DRBs[0].up_ul_tnl[0].port=RC.nrrrc[ctxt.module_id]->eth_params_s.my_portd;
|
||||
DRBs[0].up_ul_tnl_length = 1;
|
||||
DRBs[0].up_dl_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt.module_id]->eth_params_s.remote_addr);
|
||||
DRBs[0].up_dl_tnl[0].port=RC.nrrrc[ctxt.module_id]->eth_params_s.remote_portd;
|
||||
DRBs[0].up_dl_tnl_length = 1;
|
||||
|
||||
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
// configure MAC and RLC
|
||||
if (NODE_IS_DU(rrc->node_type)) {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
@@ -362,7 +361,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
ue_context_p->ue_context.secondaryCellGroup);
|
||||
} else {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->configuration.ssb_SubcarrierOffset,
|
||||
rrc->configuration.pdsch_AntennaPorts,
|
||||
rrc->configuration.pusch_AntennaPorts,
|
||||
rrc->configuration.sib1_tda,
|
||||
@@ -426,7 +424,8 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
|
||||
|
||||
rrc_rlc_remove_ue(&ctxt);
|
||||
|
||||
mac_remove_nr_ue(rrc->module_id, rnti);
|
||||
// WHAT A RACE CONDITION
|
||||
mac_remove_nr_ue(RC.nrmac[rrc->module_id], rnti);
|
||||
gtpv1u_enb_delete_tunnel_req_t tmp={0};
|
||||
tmp.rnti=rnti;
|
||||
tmp.from_gnb=1;
|
||||
|
||||
@@ -83,7 +83,6 @@ void fix_servingcellconfigdedicated(NR_ServingCellConfig_t *scd) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
@@ -108,9 +107,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
|
||||
AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n");
|
||||
|
||||
fix_servingcellconfigdedicated(servingcellconfigdedicated);
|
||||
|
||||
uint64_t bitmap = get_ssb_bitmap(servingcellconfigcommon);
|
||||
fix_servingcellconfigdedicated(servingcellconfigdedicated);
|
||||
|
||||
memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t));
|
||||
secondaryCellGroup->cellGroupId = scg_id;
|
||||
@@ -123,31 +121,33 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList));
|
||||
ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig);
|
||||
|
||||
secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig));
|
||||
secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL;
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = secondaryCellGroup->mac_CellGroupConfig;
|
||||
|
||||
secondaryCellGroup->mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->bsr_Config));
|
||||
secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
|
||||
secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf160;
|
||||
secondaryCellGroup->mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config));
|
||||
secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL;
|
||||
secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList));
|
||||
mac_CellGroupConfig=calloc(1,sizeof(*mac_CellGroupConfig));
|
||||
mac_CellGroupConfig->drx_Config = NULL;
|
||||
|
||||
mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*mac_CellGroupConfig->bsr_Config));
|
||||
mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
|
||||
mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf160;
|
||||
mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*mac_CellGroupConfig->tag_Config));
|
||||
mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL;
|
||||
mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*mac_CellGroupConfig->tag_Config->tag_ToAddModList));
|
||||
struct NR_TAG *tag=calloc(1,sizeof(*tag));
|
||||
tag->tag_Id = 0;
|
||||
tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity;
|
||||
ASN_SEQUENCE_ADD(&secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag);
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config));
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup));
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->dummy=false;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false;
|
||||
secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real;
|
||||
secondaryCellGroup->mac_CellGroupConfig->skipUplinkTxDynamic=false;
|
||||
secondaryCellGroup->mac_CellGroupConfig->ext1 = NULL;
|
||||
ASN_SEQUENCE_ADD(&mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag);
|
||||
mac_CellGroupConfig->phr_Config = calloc(1,sizeof(*mac_CellGroupConfig->phr_Config));
|
||||
mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup = calloc(1,sizeof(*mac_CellGroupConfig->phr_Config->choice.setup));
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->dummy=false;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real;
|
||||
mac_CellGroupConfig->skipUplinkTxDynamic=false;
|
||||
mac_CellGroupConfig->ext1 = NULL;
|
||||
secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig));
|
||||
secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH=NULL;
|
||||
secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH=NULL;
|
||||
@@ -616,6 +616,14 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL;
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL;
|
||||
|
||||
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
|
||||
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
|
||||
struct NR_SchedulingRequestToAddMod *schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist));
|
||||
schedulingrequestlist->schedulingRequestId = 0;
|
||||
schedulingrequestlist->sr_ProhibitTimer = NULL;
|
||||
schedulingrequestlist->sr_TransMax = NR_SchedulingRequestToAddMod__sr_TransMax_n64;
|
||||
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
|
||||
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig));
|
||||
NR_PUSCH_ServingCellConfig_t *pusch_scc = calloc(1,sizeof(*pusch_scc));
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup;
|
||||
@@ -893,7 +901,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
NR_RRCReconfiguration_IEs_t *reconfig,
|
||||
|
||||
@@ -450,7 +450,7 @@ nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id) {
|
||||
if(sdap_entity == NULL)
|
||||
return NULL;
|
||||
|
||||
while(sdap_entity->rnti != rnti && sdap_entity->next_entity != NULL) {
|
||||
while(( sdap_entity->rnti != rnti || sdap_entity->pdusession_id != pdusession_id ) && sdap_entity->next_entity != NULL) {
|
||||
sdap_entity = sdap_entity->next_entity;
|
||||
}
|
||||
|
||||
@@ -460,6 +460,7 @@ nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void delete_nr_sdap_entity(uint16_t rnti) {
|
||||
nr_sdap_entity_t *entityPtr, *entityPrev = NULL;
|
||||
entityPtr = sdap_info.sdap_entity_llist;
|
||||
|
||||
@@ -109,11 +109,14 @@ typedef enum radio_type_e {
|
||||
|
||||
extern int opt_enabled;
|
||||
#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(0, x)
|
||||
#define trace_NRpdu(x...) if (opt_enabled) trace_pdu_implementation(1, x)
|
||||
#define trace_NRpdu(x...) if (opt_enabled) nr_trace_pdu_implementation(1, x)
|
||||
|
||||
void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
|
||||
int oob_event, int oob_event_value);
|
||||
void nr_trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
|
||||
int oob_event, int oob_event_value);
|
||||
|
||||
int init_opt(void);
|
||||
|
||||
|
||||
@@ -476,6 +476,14 @@ static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
extern RAN_CONTEXT_t RC;
|
||||
#include <openair1/PHY/phy_extern_ue.h>
|
||||
/* Remote serveraddress (where Wireshark is running) */
|
||||
void nr_trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
||||
int oob_event_value) {
|
||||
trace_pdu_implementation(nr, direction, pdu_buffer, pdu_buffer_size,
|
||||
rnti, rntiType, rnti, sysFrameNumber, subFrameNumber, oob_event,
|
||||
oob_event_value);
|
||||
}
|
||||
|
||||
void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
||||
int oob_event_value) {
|
||||
|
||||
Reference in New Issue
Block a user