Merge remote-tracking branch 'origin/develop' into NR_CSIRS_tomerge
This commit is contained in:
@@ -24,10 +24,13 @@ MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t
|
||||
|
||||
/* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/
|
||||
MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req)
|
||||
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge)
|
||||
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_failure_t , f1ap_gnb_cu_configuration_update_failure)
|
||||
|
||||
/* F1AP -> eNB_DU or eNB_CU_RRC -> F1AP application layer messages */
|
||||
MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t , f1ap_setup_resp)
|
||||
MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure)
|
||||
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_t , f1ap_gnb_cu_configuration_update)
|
||||
|
||||
/* MAC -> F1AP messages */
|
||||
MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message)
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
#define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req
|
||||
#define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp
|
||||
#define F1AP_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update
|
||||
#define F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_acknowledge
|
||||
#define F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_failure
|
||||
#define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure
|
||||
|
||||
#define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message
|
||||
@@ -55,6 +58,8 @@
|
||||
// Note this should be 512 from maxval in 38.473
|
||||
#define F1AP_MAX_NB_CELLS 2
|
||||
|
||||
#define F1AP_MAX_NO_OF_TNL_ASSOCIATIONS 32
|
||||
#define F1AP_MAX_NO_UE_ID 1024
|
||||
typedef struct f1ap_net_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
@@ -98,7 +103,7 @@ typedef struct f1ap_setup_req_s {
|
||||
|
||||
// Served Cell Information
|
||||
/* Tracking area code */
|
||||
uint16_t tac[F1AP_MAX_NB_CELLS];
|
||||
uint32_t tac[F1AP_MAX_NB_CELLS];
|
||||
|
||||
/* Mobile Country Codes
|
||||
* Mobile Network Codes
|
||||
@@ -174,6 +179,24 @@ typedef struct f1ap_setup_req_s {
|
||||
|
||||
} f1ap_setup_req_t;
|
||||
|
||||
typedef struct served_cells_to_activate_s {
|
||||
/// mcc of DU cells
|
||||
uint16_t mcc;
|
||||
/// mnc of DU cells
|
||||
uint16_t mnc;
|
||||
/// mnc digit length of DU cells
|
||||
uint8_t mnc_digit_length;
|
||||
// NR Global Cell Id
|
||||
uint64_t nr_cellid;
|
||||
/// NRPCI
|
||||
uint16_t nrpci;
|
||||
/// num SI messages per DU cell
|
||||
uint8_t num_SI;
|
||||
/// SI message containers (up to 21 messages per cell)
|
||||
uint8_t *SI_container[21];
|
||||
int SI_container_length[21];
|
||||
} served_cells_to_activate_t;
|
||||
|
||||
typedef struct f1ap_setup_resp_s {
|
||||
/* Connexion id used between SCTP/F1AP */
|
||||
uint16_t cnx_id;
|
||||
@@ -189,29 +212,62 @@ typedef struct f1ap_setup_resp_s {
|
||||
char *gNB_CU_name;
|
||||
/// number of DU cells to activate
|
||||
uint16_t num_cells_to_activate; //0< num_cells_to_activate <= 512;
|
||||
/// mcc of DU cells
|
||||
uint16_t mcc[F1AP_MAX_NB_CELLS];
|
||||
/// mnc of DU cells
|
||||
uint16_t mnc[F1AP_MAX_NB_CELLS];
|
||||
/// mnc digit length of DU cells
|
||||
uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS];
|
||||
// NR Global Cell Id
|
||||
uint64_t nr_cellid[F1AP_MAX_NB_CELLS];
|
||||
/// NRPCI
|
||||
uint16_t nrpci[F1AP_MAX_NB_CELLS];
|
||||
/// num SI messages per DU cell
|
||||
uint8_t num_SI[F1AP_MAX_NB_CELLS];
|
||||
/// SI message containers (up to 21 messages per cell)
|
||||
uint8_t *SI_container[F1AP_MAX_NB_CELLS][21];
|
||||
int SI_container_length[F1AP_MAX_NB_CELLS][21];
|
||||
served_cells_to_activate_t cells_to_activate[F1AP_MAX_NB_CELLS];
|
||||
} f1ap_setup_resp_t;
|
||||
|
||||
typedef struct f1ap_gnb_cu_configuration_update_s {
|
||||
/* Connexion id used between SCTP/F1AP */
|
||||
uint16_t cnx_id;
|
||||
|
||||
/* SCTP association id */
|
||||
int32_t assoc_id;
|
||||
|
||||
/* Number of SCTP streams used for a mme association */
|
||||
uint16_t sctp_in_streams;
|
||||
uint16_t sctp_out_streams;
|
||||
|
||||
/// string holding gNB_CU_name
|
||||
char *gNB_CU_name;
|
||||
/// number of DU cells to activate
|
||||
uint16_t num_cells_to_activate; //0< num_cells_to_activate/mod <= 512;
|
||||
served_cells_to_activate_t cells_to_activate[F1AP_MAX_NB_CELLS];
|
||||
} f1ap_gnb_cu_configuration_update_t;
|
||||
|
||||
typedef struct f1ap_setup_failure_s {
|
||||
uint16_t cause;
|
||||
uint16_t time_to_wait;
|
||||
uint16_t criticality_diagnostics;
|
||||
} f1ap_setup_failure_t;
|
||||
|
||||
typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s {
|
||||
uint16_t num_cells_failed_to_be_activated;
|
||||
uint16_t mcc[F1AP_MAX_NB_CELLS];
|
||||
uint16_t mnc[F1AP_MAX_NB_CELLS];
|
||||
uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS];
|
||||
uint64_t nr_cellid[F1AP_MAX_NB_CELLS];
|
||||
uint16_t cause[F1AP_MAX_NB_CELLS];
|
||||
int have_criticality;
|
||||
uint16_t criticality_diagnostics;
|
||||
uint16_t noofTNLAssociations_to_setup;
|
||||
uint16_t have_port[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS];
|
||||
in_addr_t tl_address[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; // currently only IPv4 supported
|
||||
uint16_t noofTNLAssociations_failed;
|
||||
in_addr_t tl_address_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; // currently only IPv4 supported
|
||||
uint16_t cause_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS];
|
||||
uint16_t noofDedicatedSIDeliveryNeededUEs;
|
||||
uint32_t gNB_CU_ue_id[F1AP_MAX_NO_UE_ID];
|
||||
uint16_t ue_mcc[F1AP_MAX_NO_UE_ID];
|
||||
uint16_t ue_mnc[F1AP_MAX_NO_UE_ID];
|
||||
uint8_t ue_mnc_digit_length[F1AP_MAX_NO_UE_ID];
|
||||
uint64_t ue_nr_cellid[F1AP_MAX_NO_UE_ID];
|
||||
} f1ap_gnb_cu_configuration_update_acknowledge_t;
|
||||
|
||||
typedef struct f1ap_gnb_cu_configuration_update_failure_s {
|
||||
uint16_t cause;
|
||||
uint16_t time_to_wait;
|
||||
uint16_t criticality_diagnostics;
|
||||
} f1ap_gnb_cu_configuration_update_failure_t;
|
||||
|
||||
typedef struct f1ap_dl_rrc_message_s {
|
||||
|
||||
uint32_t gNB_CU_ue_id;
|
||||
@@ -243,7 +299,7 @@ typedef struct f1ap_initial_ul_rrc_message_s {
|
||||
uint16_t crnti;
|
||||
uint8_t *rrc_container;
|
||||
int rrc_container_length;
|
||||
uint8_t *du2cu_rrc_container;
|
||||
int8_t *du2cu_rrc_container;
|
||||
int du2cu_rrc_container_length;
|
||||
} f1ap_initial_ul_rrc_message_t;
|
||||
|
||||
|
||||
@@ -33,4 +33,5 @@ MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv
|
||||
|
||||
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp)
|
||||
MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq
|
||||
#define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp
|
||||
#define GTPV1U_GNB_NG_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uNGReq
|
||||
#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq
|
||||
|
||||
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
|
||||
|
||||
@@ -167,21 +168,23 @@ typedef struct gtpv1u_enb_end_marker_ind_s {
|
||||
uint32_t sdu_size;
|
||||
uint8_t *sdu_p;
|
||||
uint8_t mode;
|
||||
uint16_t rnti;
|
||||
uint8_t module_id;
|
||||
uint16_t rnti;
|
||||
uint8_t module_id;
|
||||
uint8_t eNB_index;
|
||||
} gtpv1u_enb_end_marker_ind_t;
|
||||
|
||||
typedef struct {
|
||||
in_addr_t enb_ip_address_for_S1u_S12_S4_up;
|
||||
tcp_udp_port_t enb_port_for_S1u_S12_S4_up;
|
||||
char addrStr[256];
|
||||
char portStr[256];
|
||||
char addrStr[256];
|
||||
char portStr[256];
|
||||
} Gtpv1uS1Req;
|
||||
|
||||
typedef struct {
|
||||
in_addr_t gnb_ip_address_for_NGu_up;
|
||||
tcp_udp_port_t gnb_port_for_NGu_up;
|
||||
char addrStr[256];
|
||||
char portStr[256];
|
||||
} Gtpv1uNGReq;
|
||||
typedef struct gtpv1u_gnb_create_tunnel_req_s {
|
||||
rnti_t rnti;
|
||||
@@ -212,4 +215,12 @@ typedef struct gtpv1u_gnb_delete_tunnel_resp_s {
|
||||
teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted
|
||||
} gtpv1u_gnb_delete_tunnel_resp_t;
|
||||
|
||||
typedef struct gtpv1u_gnb_tunnel_data_req_s {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
uint32_t offset; ///< start of message offset in buffer
|
||||
rnti_t rnti;
|
||||
pdusessionid_t pdusession_id;
|
||||
} gtpv1u_gnb_tunnel_data_req_t;
|
||||
|
||||
#endif /* GTPV1_U_MESSAGES_TYPES_H_ */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define MAC_MESSAGES_TYPES_H_
|
||||
|
||||
#include <LTE_DRX-Config.h>
|
||||
#include "OCTET_STRING.h"
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// Defines to access message fields.
|
||||
@@ -143,6 +144,7 @@ typedef struct NRRrcMacCcchDataInd_s {
|
||||
uint16_t rnti;
|
||||
uint32_t sdu_size;
|
||||
uint8_t sdu[CCCH_SDU_SIZE];
|
||||
OCTET_STRING_t *du_to_cu_rrc_container;
|
||||
uint8_t gnb_index;
|
||||
int CC_id;
|
||||
} NRRrcMacCcchDataInd;
|
||||
|
||||
@@ -33,4 +33,5 @@ MESSAGE_DEF(RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataIn
|
||||
MESSAGE_DEF(RRC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq, rrc_pcch_data_req)
|
||||
|
||||
// gNB
|
||||
MESSAGE_DEF(NR_RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataReq, nr_rrc_dcch_data_req)
|
||||
MESSAGE_DEF(NR_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataInd, nr_rrc_dcch_data_ind)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#define RRC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_pcch_data_req
|
||||
|
||||
// gNB
|
||||
#define NR_RRC_DCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_req
|
||||
#define NR_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_ind
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
@@ -64,6 +65,20 @@ typedef struct RrcDcchDataInd_s {
|
||||
uint8_t eNB_index; // LG: needed in UE
|
||||
} RrcDcchDataInd;
|
||||
|
||||
typedef struct NRRrcDcchDataReq_s {
|
||||
uint32_t frame;
|
||||
uint8_t gnb_flag;
|
||||
rb_id_t rb_id;
|
||||
uint32_t muip;
|
||||
uint32_t confirmp;
|
||||
uint32_t sdu_size;
|
||||
uint8_t *sdu_p;
|
||||
uint8_t mode;
|
||||
uint16_t rnti;
|
||||
uint8_t module_id;
|
||||
uint8_t gNB_index;
|
||||
} NRRrcDcchDataReq;
|
||||
|
||||
typedef struct NRRrcDcchDataInd_s {
|
||||
uint32_t frame;
|
||||
uint8_t dcch_index;
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
#define MAX_gNB 2
|
||||
#endif
|
||||
|
||||
#define NUMBER_OF_NR_UCI_STATS_MAX 16
|
||||
#define MAX_MANAGED_ENB_PER_MOBILE 2
|
||||
#define MAX_MANAGED_GNB_PER_MOBILE 2
|
||||
|
||||
|
||||
@@ -3161,25 +3161,25 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) {
|
||||
rrc_eNB_carrier_data_t *carrier = &RC.rrc[i]->carrier[0];
|
||||
// identify local index of cell j by nr_cellid, plmn identity and physical cell ID
|
||||
LOG_I(ENB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n",
|
||||
j,i,RC.rrc[i]->nr_cellid,resp->nr_cellid[j]);
|
||||
j,i,RC.rrc[i]->nr_cellid,resp->cells_to_activate[j].nr_cellid);
|
||||
|
||||
if (RC.rrc[i]->nr_cellid == resp->nr_cellid[j] &&
|
||||
(check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 &&
|
||||
resp->nrpci[j] == carrier->physCellId)) {
|
||||
if (RC.rrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid &&
|
||||
(check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 &&
|
||||
resp->cells_to_activate[j].nrpci == carrier->physCellId)) {
|
||||
// copy system information and decode it
|
||||
for (si_ind=2; si_ind<10; si_ind++) {
|
||||
//printf("SI %d size %d: ", si_ind, resp->SI_container_length[j][si_ind]);
|
||||
//for (int n=0;n<resp->SI_container_length[j][si_ind];n++)
|
||||
// printf("%02x ",resp->SI_container[j][si_ind][n]);
|
||||
for (si_ind=2; si_ind<resp->cells_to_activate[j].num_SI + 2; si_ind++) {
|
||||
//printf("SI %d size %d: ", si_ind, resp->cells_to_activate[j].SI_container_length[si_ind]);
|
||||
//for (int n=0;n<resp->cells_to_activate[j].SI_container_length[si_ind];n++)
|
||||
// printf("%02x ",resp->cells_to_activate[j].SI_container[si_ind][n]);
|
||||
//printf("\n");
|
||||
if (si_ind==6) si_ind=9;
|
||||
if (resp->SI_container[j][si_ind] != NULL) {
|
||||
extract_and_decode_SI(i,
|
||||
if (resp->cells_to_activate[j].SI_container[si_ind] != NULL) {
|
||||
extract_and_decode_SI(i,
|
||||
si_ind,
|
||||
resp->SI_container[j][si_ind],
|
||||
resp->SI_container_length[j][si_ind]);
|
||||
resp->cells_to_activate[j].SI_container[si_ind],
|
||||
resp->cells_to_activate[j].SI_container_length[si_ind]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// perform MAC/L1 common configuration
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "NR_BCCH-BCH-Message.h"
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
#include "NR_MIB.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "../../../../nfapi/oai_integration/vendor_ext.h"
|
||||
/* Softmodem params */
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup){
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
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,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list){
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "f1ap_cu_interface_management.h"
|
||||
|
||||
extern f1ap_setup_req_t *f1ap_du_data_from_du;
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
@@ -102,8 +103,12 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
|
||||
assoc_id, stream);
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_SETUP_REQ);
|
||||
|
||||
if(RC.nrrrc) {
|
||||
message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ);
|
||||
} else {
|
||||
message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_SETUP_REQ);
|
||||
}
|
||||
|
||||
/* assoc_id */
|
||||
F1AP_SETUP_REQ(message_p).assoc_id = assoc_id;
|
||||
|
||||
@@ -134,58 +139,57 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
|
||||
int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available;
|
||||
|
||||
for (i=0; i<num_cells_available; i++) {
|
||||
F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p;
|
||||
F1AP_GNB_DU_Served_Cells_Item_t *served_cells_item_p;
|
||||
|
||||
served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item);
|
||||
served_cells_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item);
|
||||
|
||||
/* tac */
|
||||
if (served_celles_item_p->served_Cell_Information.fiveGS_TAC) {
|
||||
OCTET_STRING_TO_INT16(served_celles_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]);
|
||||
LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n",
|
||||
i, F1AP_SETUP_REQ(message_p).tac[i]);
|
||||
if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) {
|
||||
OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]);
|
||||
LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]);
|
||||
}
|
||||
/* - nRCGI */
|
||||
TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i],
|
||||
TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i],
|
||||
F1AP_SETUP_REQ(message_p).mnc[i],
|
||||
F1AP_SETUP_REQ(message_p).mnc_digit_length[i]);
|
||||
|
||||
|
||||
// NR cellID
|
||||
BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity,
|
||||
BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity,
|
||||
F1AP_SETUP_REQ(message_p).nr_cellid[i]);
|
||||
LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id,
|
||||
F1AP_SETUP_REQ(message_p).mcc[i],
|
||||
F1AP_SETUP_REQ(message_p).mnc[i],
|
||||
(long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]);
|
||||
LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n",
|
||||
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0],
|
||||
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1],
|
||||
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2],
|
||||
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3],
|
||||
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]);
|
||||
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0],
|
||||
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1],
|
||||
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2],
|
||||
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3],
|
||||
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]);
|
||||
/* - nRPCI */
|
||||
F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI;
|
||||
F1AP_SETUP_REQ(message_p).nr_pci[i] = served_cells_item_p->served_Cell_Information.nRPCI;
|
||||
LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n",
|
||||
i, F1AP_SETUP_REQ(message_p).nr_pci[i]);
|
||||
|
||||
// System Information
|
||||
/* mib */
|
||||
F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char));
|
||||
memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf,
|
||||
served_celles_item_p->gNB_DU_System_Information->mIB_message.size);
|
||||
F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char));
|
||||
memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_cells_item_p->gNB_DU_System_Information->mIB_message.buf,
|
||||
served_cells_item_p->gNB_DU_System_Information->mIB_message.size);
|
||||
/* Convert the mme name to a printable string */
|
||||
F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0';
|
||||
F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size;
|
||||
F1AP_SETUP_REQ(message_p).mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0';
|
||||
F1AP_SETUP_REQ(message_p).mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size;
|
||||
LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n",
|
||||
i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]);
|
||||
|
||||
/* sib1 */
|
||||
F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char));
|
||||
memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf,
|
||||
served_celles_item_p->gNB_DU_System_Information->sIB1_message.size);
|
||||
F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char));
|
||||
memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf,
|
||||
served_cells_item_p->gNB_DU_System_Information->sIB1_message.size);
|
||||
/* Convert the mme name to a printable string */
|
||||
F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0';
|
||||
F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size;
|
||||
F1AP_SETUP_REQ(message_p).sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0';
|
||||
F1AP_SETUP_REQ(message_p).sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size;
|
||||
LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n",
|
||||
i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]);
|
||||
}
|
||||
@@ -246,10 +250,18 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
|
||||
);
|
||||
|
||||
if (num_cells_available > 0) {
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
} else {
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
}
|
||||
} else {
|
||||
CU_send_F1_SETUP_FAILURE(instance);
|
||||
itti_free(TASK_RRC_ENB,message_p);
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
itti_free(TASK_RRC_GNB,message_p);
|
||||
} else {
|
||||
itti_free(TASK_RRC_ENB,message_p);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -306,45 +318,51 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
|
||||
|
||||
/* mandatory */
|
||||
/* c3. cells to be Activated list */
|
||||
ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List;
|
||||
|
||||
int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate;
|
||||
LOG_D(F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate);
|
||||
for (i=0;
|
||||
i<num_cells_to_activate;
|
||||
i++) {
|
||||
if (num_cells_to_activate >0) {
|
||||
ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List;
|
||||
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
|
||||
cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t));
|
||||
cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
|
||||
for (i=0; i<num_cells_to_activate; i++) {
|
||||
|
||||
/* 3.1 cells to be Activated list item */
|
||||
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
|
||||
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
|
||||
LOG_D(F1AP, "[c3] (cell %d) mcc = %d, mnc = %d, mnc_digit_length = %d, nr_cellid = %lu\n",
|
||||
i,
|
||||
f1ap_setup_resp->cells_to_activate[i].mcc,
|
||||
f1ap_setup_resp->cells_to_activate[i].mnc,
|
||||
f1ap_setup_resp->cells_to_activate[i].mnc_digit_length,
|
||||
f1ap_setup_resp->cells_to_activate[i].nr_cellid);
|
||||
|
||||
/* - nRCGI */
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i],
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity);
|
||||
cells_to_be_activated_list_item.nRCGI = nRCGI;
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
|
||||
cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t));
|
||||
cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
|
||||
|
||||
/* optional */
|
||||
/* - nRPCI */
|
||||
if (1) {
|
||||
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
|
||||
*cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->nrpci[i]; // int 0..1007
|
||||
}
|
||||
/* 3.1 cells to be Activated list item */
|
||||
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
|
||||
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
|
||||
|
||||
/* optional */
|
||||
/* - gNB-CU System Information */
|
||||
if (1) {
|
||||
/* - nRCGI */
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(f1ap_setup_resp->cells_to_activate[i].mcc, f1ap_setup_resp->cells_to_activate[i].mnc, f1ap_setup_resp->cells_to_activate[i].mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_activated_list_item.nRCGI = nRCGI;
|
||||
|
||||
/* optional */
|
||||
/* - nRPCI */
|
||||
if (1) {
|
||||
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
|
||||
*cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007
|
||||
}
|
||||
|
||||
/* optional */
|
||||
/* - gNB-CU System Information */
|
||||
if (1) {
|
||||
/* 3.1.2 gNB-CUSystem Information */
|
||||
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs;
|
||||
cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t));
|
||||
@@ -356,47 +374,44 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
|
||||
//LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]);
|
||||
//for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++)
|
||||
// printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]);
|
||||
//printf("\n");
|
||||
for (int j=2;
|
||||
j<10;
|
||||
j++) {
|
||||
if (j==6) j=9;
|
||||
if (f1ap_setup_resp->SI_container[i][j]!=NULL) {
|
||||
LOG_I(F1AP,"SETUP RESP: SI %d, Type %d\n",i,j);
|
||||
AssertFatal((j < 6) || (j == 9), "Illegal SI type %d\n",j);
|
||||
//printf("\n");
|
||||
|
||||
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
|
||||
for (int sIBtype=2;sIBtype<21;sIBtype++) {
|
||||
if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
|
||||
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
|
||||
F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item));
|
||||
sib_item->sIBtype = j;
|
||||
memset((void*)sib_item,0,sizeof(*sib_item));
|
||||
sib_item->sIBtype = sIBtype;
|
||||
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
|
||||
(const char*)f1ap_setup_resp->SI_container[i][j],
|
||||
f1ap_setup_resp->SI_container_length[i][j]);
|
||||
|
||||
LOG_I(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,j,f1ap_setup_resp->SI_container_length[i][j]);
|
||||
ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item);
|
||||
(const char*)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype],
|
||||
f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
|
||||
|
||||
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
|
||||
ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item);
|
||||
}
|
||||
}
|
||||
cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation;
|
||||
|
||||
|
||||
F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t;
|
||||
memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t));
|
||||
|
||||
ASN_SEQUENCE_ADD(&p_154P112_t.list,
|
||||
cells_to_be_activated_list_itemExtIEs);
|
||||
ASN_SEQUENCE_ADD(&p_154P112_t.list, cells_to_be_activated_list_itemExtIEs);
|
||||
cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t;
|
||||
|
||||
free(gNB_CUSystemInformation);
|
||||
gNB_CUSystemInformation = NULL;
|
||||
}
|
||||
/* ADD */
|
||||
cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, cells_to_be_activated_list_item_ies);
|
||||
}
|
||||
/* ADD */
|
||||
cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
|
||||
cells_to_be_activated_list_item_ies);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 setup response\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -482,7 +497,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) {
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 setup failure\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -521,7 +536,7 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
|
||||
*/
|
||||
|
||||
//void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) {
|
||||
int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP) {
|
||||
int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update) {
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_GNBCUConfigurationUpdate_t *out;
|
||||
F1AP_GNBCUConfigurationUpdateIEs_t *ie;
|
||||
@@ -530,10 +545,6 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
|
||||
uint32_t len;
|
||||
int i = 0;
|
||||
|
||||
// for test
|
||||
int mcc = 208;
|
||||
int mnc = 93;
|
||||
int mnc_digit_length = 8;
|
||||
|
||||
/* Create */
|
||||
/* 0. Message Type */
|
||||
@@ -551,304 +562,355 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
|
||||
ie->id = F1AP_ProtocolIE_ID_id_TransactionID;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID;
|
||||
ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP);
|
||||
ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, 0);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c2. Cells_to_be_Activated_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List;
|
||||
// mandatory
|
||||
// c2. Cells_to_be_Activated_List
|
||||
if (f1ap_gnb_cu_configuration_update->num_cells_to_activate > 0) {
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
for (i=0; i<f1ap_gnb_cu_configuration_update->num_cells_to_activate; i++) {
|
||||
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
|
||||
cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t));
|
||||
cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
|
||||
LOG_D(F1AP, "[c2] (cell %d) mcc = %d, mnc = %d, mnc_digit_length = %d, nr_cellid = %lu\n",
|
||||
i,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid);
|
||||
|
||||
/* 2.1 cells to be Activated list item */
|
||||
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
|
||||
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
|
||||
cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t));
|
||||
cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
|
||||
|
||||
/* - nRCGI */
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_activated_list_item.nRCGI = nRCGI;
|
||||
// 2.1 cells to be Activated list item
|
||||
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
|
||||
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
|
||||
|
||||
/* optional */
|
||||
/* - nRPCI */
|
||||
if (0) {
|
||||
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
|
||||
*cells_to_be_activated_list_item.nRPCI = 321L; // int 0..1007
|
||||
}
|
||||
// - nRCGI
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid,
|
||||
&nRCGI.nRCellIdentity);
|
||||
cells_to_be_activated_list_item.nRCGI = nRCGI;
|
||||
|
||||
/* optional */
|
||||
/* - gNB-CU System Information */
|
||||
//if (1) {
|
||||
if(RC.nrrrc) {
|
||||
|
||||
//}
|
||||
/* ADD */
|
||||
cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
|
||||
cells_to_be_activated_list_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
// optional
|
||||
// -nRPCI
|
||||
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
|
||||
*cells_to_be_activated_list_item.nRPCI = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007
|
||||
|
||||
// optional
|
||||
// 3.1.2 gNB-CUSystem Information
|
||||
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs;
|
||||
cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t));
|
||||
cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation;
|
||||
cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation;
|
||||
|
||||
if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].num_SI > 0) {
|
||||
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t));
|
||||
//LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]);
|
||||
//for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++)
|
||||
// printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]);
|
||||
//printf("\n");
|
||||
|
||||
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
|
||||
for (int sIBtype=2;sIBtype<21;sIBtype++) {
|
||||
if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
|
||||
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
|
||||
F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item));
|
||||
memset((void*)sib_item,0,sizeof(*sib_item));
|
||||
sib_item->sIBtype = sIBtype;
|
||||
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
|
||||
(const char*)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype],
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
|
||||
|
||||
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
|
||||
ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item);
|
||||
}
|
||||
}
|
||||
cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation;
|
||||
|
||||
|
||||
F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t;
|
||||
memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t));
|
||||
|
||||
/* mandatory */
|
||||
/* c3. Cells_to_be_Deactivated_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List;
|
||||
ASN_SEQUENCE_ADD(&p_154P112_t.list,
|
||||
cells_to_be_activated_list_itemExtIEs);
|
||||
cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
free(gNB_CUSystemInformation);
|
||||
gNB_CUSystemInformation = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies;
|
||||
cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t));
|
||||
cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item;
|
||||
// ADD
|
||||
cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
|
||||
cells_to_be_activated_list_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* 3.1 cells to be Deactivated list item */
|
||||
F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item;
|
||||
memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t));
|
||||
|
||||
/* - nRCGI */
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_deactivated_list_item.nRCGI = nRCGI;
|
||||
|
||||
//}
|
||||
/* ADD */
|
||||
cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list,
|
||||
cells_to_be_deactivated_list_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c4. GNB_CU_TNL_Association_To_Add_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies;
|
||||
gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item;
|
||||
gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item;
|
||||
|
||||
/* 4.1 GNB_CU_TNL_Association_To_Add_Item */
|
||||
F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t));
|
||||
|
||||
|
||||
/* 4.1.1 tNLAssociationTransportLayerAddress */
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
/* 4.1.2 tNLAssociationUsage */
|
||||
gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
|
||||
|
||||
|
||||
/* ADD */
|
||||
gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list,
|
||||
gnb_cu_tnl_association_to_add_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c5. GNB_CU_TNL_Association_To_Remove_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies;
|
||||
gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item;
|
||||
gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item;
|
||||
|
||||
/* 4.1 GNB_CU_TNL_Association_To_Remove_Item */
|
||||
F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t));
|
||||
|
||||
|
||||
/* 4.1.1 tNLAssociationTransportLayerAddress */
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
|
||||
/* ADD */
|
||||
gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list,
|
||||
gnb_cu_tnl_association_to_remove_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
/* c6. GNB_CU_TNL_Association_To_Update_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies;
|
||||
gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item;
|
||||
gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item;
|
||||
|
||||
/* 4.1 GNB_CU_TNL_Association_To_Update_Item */
|
||||
F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t));
|
||||
|
||||
|
||||
/* 4.1.1 tNLAssociationTransportLayerAddress */
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
|
||||
/* 4.1.2 tNLAssociationUsage */
|
||||
if (1) {
|
||||
gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t));
|
||||
*gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
|
||||
}
|
||||
|
||||
/* ADD */
|
||||
gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list,
|
||||
gnb_cu_tnl_association_to_update_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c7. Cells_to_be_Barred_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies;
|
||||
cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t));
|
||||
cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item;
|
||||
|
||||
/* 7.1 cells to be Deactivated list item */
|
||||
F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item;
|
||||
memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t));
|
||||
|
||||
/* - nRCGI */
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI,0,sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_barred_item.nRCGI = nRCGI;
|
||||
|
||||
/* 7.2 cellBarred*/
|
||||
cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred;
|
||||
|
||||
/* ADD */
|
||||
cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list,
|
||||
cells_to_be_barred_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
if(!RC.nrrrc) {
|
||||
|
||||
/* mandatory */
|
||||
/* c3. Cells_to_be_Deactivated_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies;
|
||||
cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t));
|
||||
cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item;
|
||||
|
||||
// 3.1 cells to be Deactivated list item
|
||||
F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item;
|
||||
memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t));
|
||||
|
||||
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_deactivated_list_item.nRCGI = nRCGI;
|
||||
|
||||
cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list,
|
||||
cells_to_be_deactivated_list_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c4. GNB_CU_TNL_Association_To_Add_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies;
|
||||
gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item;
|
||||
gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item;
|
||||
|
||||
// 4.1 GNB_CU_TNL_Association_To_Add_Item
|
||||
F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t));
|
||||
|
||||
|
||||
// 4.1.1 tNLAssociationTransportLayerAddress
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
// 4.1.2 tNLAssociationUsage
|
||||
gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
|
||||
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c8. Protected_EUTRA_Resources_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list,
|
||||
gnb_cu_tnl_association_to_add_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies;
|
||||
/* mandatory */
|
||||
/* c5. GNB_CU_TNL_Association_To_Remove_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
/* 8.1 SpectrumSharingGroupID */
|
||||
protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t));
|
||||
protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List;
|
||||
protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject;
|
||||
protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item;
|
||||
((F1AP_Protected_EUTRA_Resources_Item_t*)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L;
|
||||
memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0,
|
||||
sizeof(F1AP_Protected_EUTRA_Resources_Item_t));
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies);
|
||||
F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies;
|
||||
gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item;
|
||||
gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item;
|
||||
|
||||
/*
|
||||
// 4.1 GNB_CU_TNL_Association_To_Remove_Item
|
||||
F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t));
|
||||
|
||||
|
||||
// 4.1.1 tNLAssociationTransportLayerAddress
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
|
||||
|
||||
gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list,
|
||||
gnb_cu_tnl_association_to_remove_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c6. GNB_CU_TNL_Association_To_Update_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies;
|
||||
gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t));
|
||||
gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item;
|
||||
gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject;
|
||||
gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item;
|
||||
|
||||
// 4.1 GNB_CU_TNL_Association_To_Update_Item
|
||||
F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item;
|
||||
memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t));
|
||||
|
||||
|
||||
// 4.1.1 tNLAssociationTransportLayerAddress
|
||||
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
|
||||
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
|
||||
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
|
||||
|
||||
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
|
||||
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
|
||||
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
|
||||
// TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
|
||||
|
||||
gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
|
||||
|
||||
|
||||
// 4.1.2 tNLAssociationUsage
|
||||
if (1) {
|
||||
gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t));
|
||||
*gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
|
||||
}
|
||||
|
||||
|
||||
gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list,
|
||||
gnb_cu_tnl_association_to_update_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c7. Cells_to_be_Barred_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List;
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies;
|
||||
cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t));
|
||||
cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
|
||||
cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject;
|
||||
cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item;
|
||||
|
||||
// 7.1 cells to be Deactivated list item
|
||||
F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item;
|
||||
memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t));
|
||||
|
||||
// - nRCGI
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
memset(&nRCGI,0,sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
|
||||
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity);
|
||||
cells_to_be_barred_item.nRCGI = nRCGI;
|
||||
|
||||
// 7.2 cellBarred
|
||||
cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred;
|
||||
|
||||
cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item;
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list,
|
||||
cells_to_be_barred_item_ies);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* mandatory */
|
||||
/* c8. Protected_EUTRA_Resources_List */
|
||||
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List;
|
||||
|
||||
for (i=0;
|
||||
i<1;
|
||||
i++) {
|
||||
|
||||
|
||||
F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies;
|
||||
|
||||
// 8.1 SpectrumSharingGroupID
|
||||
protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t));
|
||||
protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List;
|
||||
protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject;
|
||||
protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item;
|
||||
((F1AP_Protected_EUTRA_Resources_Item_t*)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L;
|
||||
memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0,
|
||||
sizeof(F1AP_Protected_EUTRA_Resources_Item_t));
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies);
|
||||
|
||||
/*
|
||||
F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information;
|
||||
memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t));
|
||||
|
||||
@@ -879,17 +941,22 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
|
||||
ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information);
|
||||
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 gNB-CU CONFIGURATION UPDATE\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(F1AP, "F1AP gNB-CU CONFIGURATION UPDATE\n");
|
||||
//for (int i=0;i<len;i++) printf("%02x ",buffer[i]);
|
||||
//printf("\n");
|
||||
|
||||
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -905,7 +972,8 @@ int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
LOG_D(F1AP,"Cell Configuration ok (assoc_id %d)\n",assoc_id);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,8 +85,7 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
|
||||
/*
|
||||
* gNB-CU Configuration Update
|
||||
*/
|
||||
int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP);
|
||||
|
||||
int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update);
|
||||
int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
|
||||
@@ -114,28 +114,62 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
/* RRC Container */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, true);
|
||||
|
||||
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
|
||||
// create an ITTI message and copy SDU
|
||||
message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND);
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
ccch_sdu_len = ie->value.choice.RRCContainer.size;
|
||||
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
|
||||
ccch_sdu_len);
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND);
|
||||
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
ccch_sdu_len = ie->value.choice.RRCContainer.size;
|
||||
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
|
||||
ccch_sdu_len);
|
||||
} else {
|
||||
message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND);
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
ccch_sdu_len = ie->value.choice.RRCContainer.size;
|
||||
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
|
||||
ccch_sdu_len);
|
||||
}
|
||||
|
||||
//LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__,
|
||||
// ie->value.choice.RRCContainer.size);
|
||||
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
|
||||
// printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
|
||||
//printf("\n");
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
|
||||
LOG_D(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size);
|
||||
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
|
||||
// printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
|
||||
//printf("\n");
|
||||
|
||||
/* DUtoCURRCContainer */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, true);
|
||||
if (ie) {
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t));
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(
|
||||
ie->value.choice.DUtoCURRCContainer.size);
|
||||
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf,
|
||||
ie->value.choice.DUtoCURRCContainer.buf,
|
||||
ie->value.choice.DUtoCURRCContainer.size);
|
||||
}
|
||||
}
|
||||
|
||||
// Find instance from nr_cellid
|
||||
int rrc_inst = -1;
|
||||
for (int i=0;i<RC.nb_inst;i++) {
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
for (int i=0;i<RC.nb_nr_inst;i++) {
|
||||
// first get RRC instance (note, no the ITTI instance)
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[i];
|
||||
if (rrc->nr_cellid == nr_cellid) {
|
||||
rrc_inst = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<RC.nb_inst;i++) {
|
||||
// first get RRC instance (note, no the ITTI instance)
|
||||
eNB_RRC_INST *rrc = RC.rrc[i];
|
||||
if (rrc->nr_cellid == nr_cellid) {
|
||||
rrc_inst = i;
|
||||
break;
|
||||
eNB_RRC_INST *rrc = RC.rrc[i];
|
||||
if (rrc->nr_cellid == nr_cellid) {
|
||||
rrc_inst = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid);
|
||||
@@ -148,15 +182,23 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
}
|
||||
f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
|
||||
|
||||
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
|
||||
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
|
||||
} else {
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -171,7 +213,8 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
f1ap_dl_rrc_message_t *f1ap_dl_rrc)
|
||||
{
|
||||
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n");
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_DLRRCMessageTransfer_t *out;
|
||||
F1AP_DLRRCMessageTransferIEs_t *ie;
|
||||
|
||||
@@ -252,10 +295,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
//LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length);
|
||||
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
|
||||
// printf("%02x ", f1ap_dl_rrc->rrc_container[i]);
|
||||
//printf("\n");
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length);
|
||||
for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
|
||||
printf("%02x ", f1ap_dl_rrc->rrc_container[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* optional */
|
||||
/* c7. RAT_FrequencyPriorityInformation */
|
||||
@@ -279,7 +324,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -302,7 +347,6 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
F1AP_ULRRCMessageTransfer_t *container;
|
||||
F1AP_ULRRCMessageTransferIEs_t *ie;
|
||||
|
||||
|
||||
uint64_t cu_ue_f1ap_id;
|
||||
uint64_t du_ue_f1ap_id;
|
||||
uint64_t srb_id;
|
||||
@@ -351,6 +395,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
// print message in debug mode
|
||||
|
||||
// create an ITTI message and copy SDU
|
||||
|
||||
/*
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND);
|
||||
@@ -373,6 +418,8 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
ctxt.instance = instance;
|
||||
ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id);
|
||||
ctxt.enb_flag = 1;
|
||||
ctxt.eNB_index = 0;
|
||||
ctxt.configured = 1;
|
||||
mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__);
|
||||
memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size);
|
||||
LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "proto_agent.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern uint8_t proto_agent_flag;
|
||||
|
||||
f1ap_setup_req_t *f1ap_du_data_from_du;
|
||||
f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
|
||||
@@ -71,7 +72,12 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams;
|
||||
|
||||
/* setup parameters for F1U and start the server */
|
||||
const cudu_params_t params = {
|
||||
const cudu_params_t params = (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_CU) ? (cudu_params_t){
|
||||
.local_ipv4_address = RC.nrrrc[instance]->eth_params_s.my_addr,
|
||||
.local_port = RC.nrrrc[instance]->eth_params_s.my_portd,
|
||||
.remote_ipv4_address = RC.nrrrc[instance]->eth_params_s.remote_addr,
|
||||
.remote_port = RC.nrrrc[instance]->eth_params_s.remote_portd
|
||||
} : (cudu_params_t){
|
||||
.local_ipv4_address = RC.rrc[instance]->eth_params_s.my_addr,
|
||||
.local_port = RC.rrc[instance]->eth_params_s.my_portd,
|
||||
.remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr,
|
||||
@@ -79,6 +85,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
};
|
||||
AssertFatal(proto_agent_start(instance, ¶ms) == 0,
|
||||
"could not start PROTO_AGENT for F1U on instance %ld!\n", instance);
|
||||
proto_agent_flag = 1;
|
||||
}
|
||||
|
||||
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
|
||||
@@ -107,7 +114,11 @@ void cu_task_send_sctp_init_req(instance_t enb_id) {
|
||||
message_p->ittiMsg.sctp_init.ipv4 = 1;
|
||||
message_p->ittiMsg.sctp_init.ipv6 = 0;
|
||||
message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1;
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr);
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr);
|
||||
} else{
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr);
|
||||
}
|
||||
/*
|
||||
* SR WARNING: ipv6 multi-homing fails sometimes for localhost.
|
||||
* * * * Disable it for now.
|
||||
@@ -166,13 +177,27 @@ void *F1AP_CU_task(void *arg) {
|
||||
&F1AP_SETUP_RESP(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_DL_RRC_MESSAGE: // from rrc
|
||||
case F1AP_GNB_CU_CONFIGURATION_UPDATE: // from rrc
|
||||
LOG_I(F1AP, "CU Task Received F1AP_GNB_CU_CONFIGURAITON_UPDATE\n");
|
||||
// CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
// &F1AP_SETUP_RESP(received_msg));
|
||||
CU_send_gNB_CU_CONFIGURATION_UPDATE(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_GNB_CU_CONFIGURATION_UPDATE(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_DL_RRC_MESSAGE: // from rrc
|
||||
LOG_I(F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n");
|
||||
CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_DL_RRC_MESSAGE(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc
|
||||
case F1AP_UE_CONTEXT_SETUP_REQ: // from rrc
|
||||
LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_SETUP_REQ\n");
|
||||
CU_send_UE_CONTEXT_SETUP_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UE_CONTEXT_SETUP_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),
|
||||
&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg));
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
extern f1ap_setup_req_t *f1ap_du_data_from_du;
|
||||
extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern uint32_t f1ap_assoc_id;
|
||||
|
||||
int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) {
|
||||
@@ -263,7 +264,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
f1ap_ue_context_setup_req->mnc,
|
||||
f1ap_ue_context_setup_req->mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
NR_CELL_ID_TO_BIT_STRING(12345678, &nRCGI.nRCellIdentity);
|
||||
scell_toBeSetup_item.sCell_ID = nRCGI;
|
||||
|
||||
/* 10.1.2 sCellIndex */
|
||||
@@ -475,7 +476,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
/* OPTIONAL */
|
||||
/* gBR_QoS_Flow_Information */
|
||||
if (0) {
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t));
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t));
|
||||
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L);
|
||||
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L);
|
||||
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L);
|
||||
@@ -484,14 +485,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
/* OPTIONAL */
|
||||
/* maxPacketLossRateDownlink */
|
||||
if (0) {
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
|
||||
*DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L;
|
||||
}
|
||||
|
||||
/* OPTIONAL */
|
||||
/* maxPacketLossRateUplink */
|
||||
if (0) {
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
|
||||
DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
|
||||
*DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L;
|
||||
}
|
||||
|
||||
@@ -500,7 +501,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
/* OPTIONAL */
|
||||
/* reflective_QoS_Attribute */
|
||||
if (0) {
|
||||
DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long));
|
||||
DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long));
|
||||
*DRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L;
|
||||
}
|
||||
|
||||
@@ -581,8 +582,9 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
|
||||
/* packetErrorRate */
|
||||
flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L;
|
||||
flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L;
|
||||
/* OPTIONAL */
|
||||
flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L;
|
||||
|
||||
/* OPTIONAL */
|
||||
/* delayCritical */
|
||||
if (0) {
|
||||
flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long));
|
||||
@@ -727,7 +729,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation;
|
||||
|
||||
int endc = 1; // RK: Get this from somewhere ...
|
||||
int endc = 1; // RK: Get this from somewhere ...
|
||||
if (endc) {
|
||||
ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC;
|
||||
ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L;
|
||||
@@ -740,13 +742,13 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
|
||||
/* OPTIONAL */
|
||||
/* RRCContainer */
|
||||
if (0) {
|
||||
if(RC.nrrrc) {
|
||||
ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as",
|
||||
strlen("asdsa1d32sa1d31asd31as"));
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_ue_context_setup_req->rrc_container,
|
||||
f1ap_ue_context_setup_req->rrc_container_length);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
@@ -763,10 +765,28 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP REQUEST\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)pdu);
|
||||
|
||||
// asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
// buffer = res.buffer;
|
||||
// len = res.result.encoded;
|
||||
|
||||
// if (res.result.encoded <= 0) {
|
||||
// LOG_E(F1AP, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded);
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len);
|
||||
|
||||
if(RC.nrrrc) {
|
||||
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -774,7 +794,42 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
F1AP_UEContextSetupResponse_t *container;
|
||||
F1AP_UEContextSetupResponseIEs_t *ie;
|
||||
|
||||
DevAssert(pdu);
|
||||
|
||||
container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse;
|
||||
|
||||
/* GNB_CU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
|
||||
|
||||
/* GNB_DU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
|
||||
/* DUtoCURRCInformation */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true);
|
||||
|
||||
/* DRBs_Setup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true);
|
||||
|
||||
/* SRBs_FailedToBeSetup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true);
|
||||
|
||||
/* DRBs_FailedToBeSetup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true);
|
||||
|
||||
/* SCell_FailedtoSetup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance,
|
||||
@@ -1030,8 +1085,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
|
||||
|
||||
// for test
|
||||
int mcc = 208;
|
||||
int mnc = 93;
|
||||
int mnc_digit_length = 8;
|
||||
int mnc = 92;
|
||||
int mnc_digit_length = 2;
|
||||
|
||||
/* Create */
|
||||
/* 0. Message Type */
|
||||
@@ -1072,7 +1127,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
|
||||
F1AP_NRCGI_t nRCGI;
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
NR_CELL_ID_TO_BIT_STRING(12345678, &nRCGI.nRCellIdentity);
|
||||
ie->value.choice.NRCGI = nRCGI;
|
||||
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
@@ -1197,7 +1252,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
NR_CELL_ID_TO_BIT_STRING(12345678, &nRCGI.nRCellIdentity);
|
||||
scell_toBeSetupMod_item.sCell_ID = nRCGI;
|
||||
|
||||
/* sCellIndex */
|
||||
@@ -1237,7 +1292,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
|
||||
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
|
||||
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
|
||||
&nRCGI.pLMN_Identity);
|
||||
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
|
||||
NR_CELL_ID_TO_BIT_STRING(12345678, &nRCGI.nRCellIdentity);
|
||||
scell_toBeRemoved_item.sCell_ID = nRCGI;
|
||||
|
||||
/* ADD */
|
||||
@@ -1484,7 +1539,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_gNBCUConfigurationUpdate:
|
||||
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer:
|
||||
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_InitialULRRCMessageTransfer\n", __func__);
|
||||
@@ -69,6 +74,9 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
|
||||
case F1AP_ProcedureCode_id_UEContextReleaseRequest:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextReleaseRequest\n", __func__);
|
||||
break;
|
||||
case F1AP_ProcedureCode_id_UEContextSetup:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
|
||||
break;
|
||||
// case F1AP_ProcedureCode_id_InitialContextSetup:
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
// message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
@@ -102,6 +110,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu)
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_gNBCUConfigurationUpdate:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n", __func__);
|
||||
break;
|
||||
|
||||
case F1AP_ProcedureCode_id_UEContextRelease:
|
||||
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__);
|
||||
break;
|
||||
@@ -157,7 +169,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t
|
||||
//LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code);
|
||||
|
||||
if (dec_ret.code != RC_OK) {
|
||||
LOG_E(F1AP, "Failed to decode pdu\n");
|
||||
AssertFatal(1==0,"Failed to decode pdu\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,18 @@
|
||||
#include "assertions.h"
|
||||
|
||||
extern f1ap_setup_req_t *f1ap_du_data;
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273};
|
||||
|
||||
int to_NRNRB(int nrb) {
|
||||
if (RC.nrrrc) {
|
||||
for (int i=0;i<29;i++) if (nrb_lut[i] == nrb) return i;
|
||||
AssertFatal(1==0,"nrb %d is not in the list of possible NRNRB\n",nrb);
|
||||
} else {
|
||||
return nrb;
|
||||
}
|
||||
}
|
||||
|
||||
int DU_handle_RESET(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
@@ -188,9 +199,19 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007
|
||||
|
||||
/* - fiveGS_TAC */
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char*)&f1ap_du_data->tac[i],
|
||||
3);
|
||||
if (RC.nrrrc) {
|
||||
uint8_t fiveGS_TAC[3];
|
||||
fiveGS_TAC[0] = ((uint8_t*)&f1ap_du_data->tac[i])[2];
|
||||
fiveGS_TAC[1] = ((uint8_t*)&f1ap_du_data->tac[i])[1];
|
||||
fiveGS_TAC[2] = ((uint8_t*)&f1ap_du_data->tac[i])[0];
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char *)fiveGS_TAC,
|
||||
3);
|
||||
} else {
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char*)&f1ap_du_data->tac[i],
|
||||
3);
|
||||
}
|
||||
|
||||
/* - Configured_EPS_TAC */
|
||||
if(0){
|
||||
@@ -299,10 +320,10 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
|
||||
/* FDD.3 UL Transmission Bandwidth */
|
||||
fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs;
|
||||
fDD_Info->uL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.ul_nrb;
|
||||
fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.ul_nrb);
|
||||
/* FDD.4 DL Transmission Bandwidth */
|
||||
fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs;
|
||||
fDD_Info->dL_Transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].fdd.dl_nrb;
|
||||
fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.dl_nrb);
|
||||
|
||||
nR_Mode_Info.choice.fDD = fDD_Info;
|
||||
} else { // TDD
|
||||
@@ -354,7 +375,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
|
||||
/* TDD.2 transmission_Bandwidth */
|
||||
tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs;
|
||||
tDD_Info->transmission_Bandwidth.nRNRB = f1ap_du_data->nr_mode_info[i].tdd.nrb;
|
||||
tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].tdd.nrb);
|
||||
|
||||
nR_Mode_Info.choice.tDD = tDD_Info;
|
||||
} // if nR_Mode_Info
|
||||
@@ -376,6 +397,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
(const char*)f1ap_du_data->mib[i],//f1ap_du_data->mib,
|
||||
f1ap_du_data->mib_length[i]);
|
||||
|
||||
LOG_D(F1AP,"Filling SIB1_message for cell %d, length %d\n",i,f1ap_du_data->sib1_length[i]);
|
||||
OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018
|
||||
(const char*)f1ap_du_data->sib1[i],
|
||||
f1ap_du_data->sib1_length[i]);
|
||||
@@ -391,6 +413,20 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
/* c5. RRC VERSION */
|
||||
if(RC.nrrrc) {
|
||||
ie = (F1AP_F1SetupRequestIEs_t *) calloc(1, sizeof(F1AP_F1SetupRequestIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version;
|
||||
ie->value.choice.RRC_Version.latest_RRC_Version.buf = calloc(1, sizeof(char));
|
||||
ie->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0;
|
||||
ie->value.choice.RRC_Version.latest_RRC_Version.size = 1;
|
||||
ie->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
@@ -417,158 +453,175 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
|
||||
F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
|
||||
LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n");
|
||||
LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n");
|
||||
|
||||
AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome,
|
||||
"pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup,
|
||||
"pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject,
|
||||
"pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse,
|
||||
"pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n");
|
||||
AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome,
|
||||
"pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup,
|
||||
"pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject,
|
||||
"pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse,
|
||||
"pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n");
|
||||
|
||||
F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse;
|
||||
F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse;
|
||||
|
||||
|
||||
F1AP_F1SetupResponseIEs_t *ie;
|
||||
int TransactionId = -1;
|
||||
int num_cells_to_activate = 0;
|
||||
F1AP_Cells_to_be_Activated_List_Item_t *cell;
|
||||
F1AP_F1SetupResponseIEs_t *ie;
|
||||
int TransactionId = -1;
|
||||
int num_cells_to_activate = 0;
|
||||
F1AP_Cells_to_be_Activated_List_Item_t *cell;
|
||||
|
||||
MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP);
|
||||
MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP);
|
||||
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n",
|
||||
in->protocolIEs.list.count);
|
||||
for (int i=0;i < in->protocolIEs.list.count; i++) {
|
||||
ie = in->protocolIEs.list.array[i];
|
||||
switch (ie->id) {
|
||||
case F1AP_ProtocolIE_ID_id_TransactionID:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n");
|
||||
TransactionId=ie->value.choice.TransactionID;
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n",
|
||||
TransactionId);
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_gNB_CU_Name:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_ignore,
|
||||
"ie->criticality != F1AP_Criticality_ignore\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n");
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1);
|
||||
memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size);
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0';
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n",
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name);
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n");
|
||||
num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count;
|
||||
LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate);
|
||||
for (int i=0;i<num_cells_to_activate;i++) {
|
||||
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i];
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n",
|
||||
in->protocolIEs.list.count);
|
||||
for (int i=0;i < in->protocolIEs.list.count; i++) {
|
||||
ie = in->protocolIEs.list.array[i];
|
||||
switch (ie->id) {
|
||||
case F1AP_ProtocolIE_ID_id_TransactionID:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n");
|
||||
TransactionId=ie->value.choice.TransactionID;
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n",
|
||||
TransactionId);
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_gNB_CU_Name:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_ignore,
|
||||
"ie->criticality != F1AP_Criticality_ignore\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n");
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1);
|
||||
memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size);
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0';
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n",
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name);
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version:
|
||||
LOG_D(F1AP, "F1AP: Received GNB-CU-RRC-Version, ignoring\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List:
|
||||
{
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List,
|
||||
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n");
|
||||
num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count;
|
||||
LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate);
|
||||
for (int i=0;i<num_cells_to_activate;i++) {
|
||||
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject,
|
||||
"cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item");
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i];
|
||||
|
||||
cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item;
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject,
|
||||
"cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item");
|
||||
|
||||
TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]);
|
||||
AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n");
|
||||
LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n",
|
||||
cell->nRCGI.nRCellIdentity.buf[0],
|
||||
cell->nRCGI.nRCellIdentity.buf[1],
|
||||
cell->nRCGI.nRCellIdentity.buf[2],
|
||||
cell->nRCGI.nRCellIdentity.buf[3],
|
||||
cell->nRCGI.nRCellIdentity.buf[4]);
|
||||
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
|
||||
F1AP_SETUP_RESP (msg_p).nr_cellid[i]);
|
||||
F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI;
|
||||
cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item;
|
||||
|
||||
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
|
||||
AssertFatal(ext!=NULL,"Extension is null\n");
|
||||
for (int cnt=0;cnt<ext->list.count;cnt++) {
|
||||
TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc_digit_length);
|
||||
|
||||
LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n",
|
||||
cell->nRCGI.nRCellIdentity.buf[0],
|
||||
cell->nRCGI.nRCellIdentity.buf[1],
|
||||
cell->nRCGI.nRCellIdentity.buf[2],
|
||||
cell->nRCGI.nRCellIdentity.buf[3],
|
||||
cell->nRCGI.nRCellIdentity.buf[4]);
|
||||
|
||||
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid);
|
||||
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
|
||||
|
||||
if (ext==NULL) continue;
|
||||
|
||||
for (int cnt=0;cnt<ext->list.count;cnt++) {
|
||||
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt];
|
||||
switch (cells_to_be_activated_list_itemExtIEs->id) {
|
||||
/*
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING:
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List
|
||||
*/
|
||||
case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation:
|
||||
{
|
||||
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation;
|
||||
F1AP_SETUP_RESP (msg_p).num_SI[i] = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;
|
||||
AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n");
|
||||
LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n",
|
||||
i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i],
|
||||
F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]);
|
||||
for (int si =0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) {
|
||||
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
|
||||
size_t size = sib_item->sIBmessage.size;
|
||||
F1AP_SETUP_RESP (msg_p).SI_container_length[i][sib_item->sIBtype] = size;
|
||||
LOG_I(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size);
|
||||
F1AP_SETUP_RESP (msg_p).SI_container[i][sib_item->sIBtype] = malloc(size);
|
||||
memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][sib_item->sIBtype],
|
||||
(void*)sib_item->sIBmessage.buf,
|
||||
size);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_AvailablePLMNList:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id);
|
||||
break;
|
||||
/*
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING:
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List
|
||||
*/
|
||||
case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation:
|
||||
{
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0;
|
||||
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation;
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;
|
||||
AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n");
|
||||
LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n",
|
||||
i, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc,
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI);
|
||||
for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) {
|
||||
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
|
||||
size_t size = sib_item->sIBmessage.size;
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[sib_item->sIBtype] = size;
|
||||
LOG_I(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size);
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[sib_item->sIBtype] = malloc(size);
|
||||
memcpy((void*)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[sib_item->sIBtype],
|
||||
(void*)sib_item->sIBmessage.buf,
|
||||
size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case F1AP_ProtocolIE_ID_id_AvailablePLMNList:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id);
|
||||
break;
|
||||
}
|
||||
} // for (cnt=...
|
||||
} // for (cells_to_activate...
|
||||
} // switch ie
|
||||
} // for IE
|
||||
AssertFatal(TransactionId!=-1,"TransactionId was not sent\n");
|
||||
AssertFatal(num_cells_to_activate>0,"No cells activated\n");
|
||||
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate;
|
||||
} // for (cnt=...
|
||||
} // for (cells_to_activate...
|
||||
break;
|
||||
} // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List
|
||||
|
||||
for (int i=0;i<num_cells_to_activate;i++)
|
||||
AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i);
|
||||
default:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n", (int)ie->id);
|
||||
break;
|
||||
} // switch ie
|
||||
} // for IE
|
||||
AssertFatal(TransactionId!=-1,"TransactionId was not sent\n");
|
||||
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate;
|
||||
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
MSC_F1AP_DU,
|
||||
MSC_F1AP_CU,
|
||||
0,
|
||||
0,
|
||||
MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d",
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
assoc_id);
|
||||
|
||||
LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n",
|
||||
for (int i=0;i<num_cells_to_activate;i++)
|
||||
AssertFatal(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI > 0, "System Information %d is missing",i);
|
||||
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
MSC_F1AP_DU,
|
||||
MSC_F1AP_CU,
|
||||
0,
|
||||
0,
|
||||
MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d",
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
assoc_id);
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to GNB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_ENB_APP, instance, msg_p);
|
||||
itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
|
||||
} else {
|
||||
LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_ENB_APP, instance, msg_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SETUP FAILURE
|
||||
@@ -577,6 +630,26 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n");
|
||||
|
||||
F1AP_F1SetupFailure_t *out;
|
||||
F1AP_F1SetupFailureIEs_t *ie;
|
||||
|
||||
out = &pdu->choice.unsuccessfulOutcome->value.choice.F1SetupFailure;
|
||||
|
||||
/* Transaction ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out,
|
||||
F1AP_ProtocolIE_ID_id_TransactionID, true);
|
||||
|
||||
/* Cause */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out,
|
||||
F1AP_ProtocolIE_ID_id_Cause, true);
|
||||
|
||||
if(0) {
|
||||
/* TimeToWait */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out,
|
||||
F1AP_ProtocolIE_ID_id_TimeToWait, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -659,9 +732,19 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007
|
||||
|
||||
/* - fiveGS_TAC */
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char *) &f1ap_setup_req->tac[i],
|
||||
3);
|
||||
if (RC.nrrrc) {
|
||||
uint8_t fiveGS_TAC[3];
|
||||
fiveGS_TAC[0] = ((uint8_t*)&f1ap_setup_req->tac[i])[2];
|
||||
fiveGS_TAC[1] = ((uint8_t*)&f1ap_setup_req->tac[i])[1];
|
||||
fiveGS_TAC[2] = ((uint8_t*)&f1ap_setup_req->tac[i])[0];
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char *)fiveGS_TAC,
|
||||
3);
|
||||
} else {
|
||||
OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC,
|
||||
(const char *) &f1ap_setup_req->tac[i],
|
||||
3);
|
||||
}
|
||||
|
||||
/* - Configured_EPS_TAC */
|
||||
if(1){
|
||||
@@ -676,7 +759,6 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity);
|
||||
ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item);
|
||||
|
||||
|
||||
// // /* - CHOICE NR-MODE-Info */
|
||||
F1AP_NR_Mode_Info_t nR_Mode_Info;
|
||||
|
||||
@@ -838,8 +920,6 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity);
|
||||
ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item);
|
||||
|
||||
|
||||
|
||||
// // /* - CHOICE NR-MODE-Info */
|
||||
F1AP_NR_Mode_Info_t nR_Mode_Info;
|
||||
|
||||
@@ -978,7 +1058,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
|
||||
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 gNB-DU CONFIGURATION UPDATE\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1006,17 +1086,229 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
|
||||
if(!RC.nrrrc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_D(F1AP, "DU_handle_gNB_CU_CONFIGURATION_UPDATE\n");
|
||||
|
||||
AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_initiatingMessage,
|
||||
"pdu->present != F1AP_F1AP_PDU_PR_initiatingMessage\n");
|
||||
AssertFatal(pdu->choice.initiatingMessage->procedureCode == F1AP_ProcedureCode_id_gNBCUConfigurationUpdate,
|
||||
"pdu->choice.initiatingMessage->procedureCode != F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n");
|
||||
AssertFatal(pdu->choice.initiatingMessage->criticality == F1AP_Criticality_reject,
|
||||
"pdu->choice.initiatingMessage->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(pdu->choice.initiatingMessage->value.present == F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate,
|
||||
"pdu->choice.initiatingMessage->value.present != F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate\n");
|
||||
|
||||
F1AP_GNBCUConfigurationUpdate_t *in = &pdu->choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate;
|
||||
|
||||
|
||||
F1AP_GNBCUConfigurationUpdateIEs_t *ie;
|
||||
int TransactionId = -1;
|
||||
int num_cells_to_activate = 0;
|
||||
F1AP_Cells_to_be_Activated_List_Item_t *cell;
|
||||
|
||||
MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
|
||||
|
||||
LOG_D(F1AP, "F1AP: gNB_CU_Configuration_Update: protocolIEs.list.count %d\n",
|
||||
in->protocolIEs.list.count);
|
||||
for (int i=0;i < in->protocolIEs.list.count; i++) {
|
||||
ie = in->protocolIEs.list.array[i];
|
||||
switch (ie->id) {
|
||||
case F1AP_ProtocolIE_ID_id_TransactionID:
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID,
|
||||
"ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID\n");
|
||||
TransactionId=ie->value.choice.TransactionID;
|
||||
LOG_D(F1AP, "F1AP: GNB-CU-ConfigurationUpdate: TransactionId %d\n",
|
||||
TransactionId);
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List:
|
||||
{
|
||||
AssertFatal(ie->criticality == F1AP_Criticality_reject,
|
||||
"ie->criticality != F1AP_Criticality_reject\n");
|
||||
AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List,
|
||||
"ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List\n");
|
||||
num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count;
|
||||
LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate);
|
||||
for (int i=0;i<num_cells_to_activate;i++) {
|
||||
|
||||
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *) ie->value.choice.Cells_to_be_Activated_List.list.array[i];
|
||||
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject,
|
||||
"cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject");
|
||||
AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item,
|
||||
"cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item");
|
||||
|
||||
cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item;
|
||||
|
||||
TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc_digit_length);
|
||||
|
||||
LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n",
|
||||
cell->nRCGI.nRCellIdentity.buf[0],
|
||||
cell->nRCGI.nRCellIdentity.buf[1],
|
||||
cell->nRCGI.nRCellIdentity.buf[2],
|
||||
cell->nRCGI.nRCellIdentity.buf[3],
|
||||
cell->nRCGI.nRCellIdentity.buf[4]);
|
||||
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid);
|
||||
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
|
||||
|
||||
if (ext==NULL) continue;
|
||||
|
||||
for (int cnt=0;cnt<ext->list.count;cnt++) {
|
||||
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt];
|
||||
switch (cells_to_be_activated_list_itemExtIEs->id) {
|
||||
/*
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING:
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU,
|
||||
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List
|
||||
*/
|
||||
case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation:
|
||||
{
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0;
|
||||
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;
|
||||
AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n");
|
||||
LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n",
|
||||
i, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc,
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI);
|
||||
for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) {
|
||||
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
|
||||
size_t size = sib_item->sIBmessage.size;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[sib_item->sIBtype] = size;
|
||||
LOG_I(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size);
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[sib_item->sIBtype] = malloc(size);
|
||||
memcpy((void*)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[sib_item->sIBtype],
|
||||
(void*)sib_item->sIBmessage.buf,
|
||||
size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case F1AP_ProtocolIE_ID_id_AvailablePLMNList:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id);
|
||||
break;
|
||||
}
|
||||
} // for (cnt=...
|
||||
} // for (cells_to_activate...
|
||||
break;
|
||||
} // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List
|
||||
|
||||
default:
|
||||
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n", (int)ie->id);
|
||||
break;
|
||||
} // switch ie
|
||||
} // for IE
|
||||
AssertFatal(TransactionId!=-1,"TransactionId was not sent\n");
|
||||
LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate);
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).num_cells_to_activate = num_cells_to_activate;
|
||||
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
MSC_F1AP_DU,
|
||||
MSC_F1AP_CU,
|
||||
0,
|
||||
0,
|
||||
MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d",
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
assoc_id);
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to GNB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
|
||||
} else {
|
||||
LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to ENB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance,
|
||||
F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure) {
|
||||
AssertFatal(1==0,"received gNB CU CONFIGURATION UPDATE FAILURE with cause %d\n",
|
||||
GNBCUConfigurationUpdateFailure->cause);
|
||||
}
|
||||
|
||||
int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
|
||||
F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge) {
|
||||
|
||||
if(!RC.nrrrc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AssertFatal(GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated == 0,
|
||||
"%d cells failed to activate\n",
|
||||
GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated);
|
||||
|
||||
AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup == 0,
|
||||
"%d TNLAssociations to setup, handle this ...\n",
|
||||
GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup);
|
||||
|
||||
|
||||
AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed == 0,
|
||||
"%d TNLAssociations failed\n",
|
||||
GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed);
|
||||
|
||||
AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs == 0,
|
||||
"%d DedicatedSIDeliveryNeededUEs\n",
|
||||
GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs);
|
||||
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
|
||||
/* Create */
|
||||
/* 0. pdu Type */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome;
|
||||
pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t));
|
||||
pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate;
|
||||
pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject;
|
||||
pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge;
|
||||
F1AP_GNBCUConfigurationUpdateAcknowledge_t *out = &pdu.choice.successfulOutcome->value.choice.GNBCUConfigurationUpdateAcknowledge;
|
||||
|
||||
/* mandatory */
|
||||
/* c1. Transaction ID (integer value)*/
|
||||
F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *ie = (F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_TransactionID;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID;
|
||||
ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode GNB-DU-Configuration-Update-Acknowledge\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,17 +98,17 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
F1AP_F1AP_PDU_t *pdu);
|
||||
|
||||
int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance,
|
||||
F1AP_GNBCUConfigurationUpdateFailure_t *GNBCUConfigurationUpdateFailure);
|
||||
f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure);
|
||||
|
||||
int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
|
||||
F1AP_GNBCUConfigurationUpdateAcknowledge_t *GNBCUConfigurationUpdateAcknowledge);
|
||||
f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge);
|
||||
|
||||
|
||||
/*
|
||||
* gNB-DU Resource Coordination
|
||||
*/
|
||||
int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance,
|
||||
F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest);
|
||||
F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest);
|
||||
|
||||
int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
|
||||
@@ -42,13 +42,19 @@
|
||||
#include "LTE_DL-DCCH-Message.h"
|
||||
#include "LTE_UL-DCCH-Message.h"
|
||||
|
||||
#include "NR_DL-CCCH-Message.h"
|
||||
#include "NR_UL-CCCH-Message.h"
|
||||
#include "NR_DL-DCCH-Message.h"
|
||||
#include "NR_UL-DCCH-Message.h"
|
||||
// for SRB1_logicalChannelConfig_defaultValue
|
||||
#include "rrc_extern.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "rrc_eNB_UE_context.h"
|
||||
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
|
||||
#include "asn1_msg.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
// undefine C_RNTI from
|
||||
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
|
||||
@@ -61,13 +67,32 @@ extern f1ap_setup_req_t *f1ap_du_data;
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
|
||||
|
||||
extern 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,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list);
|
||||
|
||||
uint8_t du_ccch_flag = 1;
|
||||
|
||||
int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu);
|
||||
|
||||
/* DL RRC Message Transfer */
|
||||
int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
|
||||
LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n");
|
||||
return DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu);
|
||||
}
|
||||
|
||||
LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n");
|
||||
|
||||
F1AP_DLRRCMessageTransfer_t *container;
|
||||
@@ -454,36 +479,36 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity;
|
||||
}
|
||||
|
||||
rrc_mac_config_req_eNB(
|
||||
ctxt.module_id,
|
||||
0,0,0,0,0,0,
|
||||
0,
|
||||
ue_context_p->ue_context.rnti,
|
||||
(LTE_BCCH_BCH_Message_t *) NULL,
|
||||
(LTE_RadioResourceConfigCommonSIB_t *) NULL,
|
||||
(LTE_RadioResourceConfigCommonSIB_t *) NULL,
|
||||
physicalConfigDedicated,
|
||||
(LTE_SCellToAddMod_r10_t *)NULL,
|
||||
//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
|
||||
(LTE_MeasObjectToAddMod_t **) NULL,
|
||||
mac_MainConfig,
|
||||
DRB2LCHAN[i],
|
||||
DRB_configList->list.array[i]->logicalChannelConfig,
|
||||
measGapConfig,
|
||||
(LTE_TDD_Config_t *) NULL,
|
||||
NULL,
|
||||
(LTE_SchedulingInfoList_t *) NULL,
|
||||
0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
|
||||
, 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL,
|
||||
0,
|
||||
(LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
|
||||
(LTE_SchedulingInfo_MBMS_r14_t *) NULL,
|
||||
(struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
|
||||
(LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
|
||||
(LTE_MBSFN_AreaInfoList_r9_t *) NULL,
|
||||
(LTE_MBSFNAreaConfiguration_r9_t*) NULL
|
||||
);
|
||||
rrc_mac_config_req_eNB(
|
||||
ctxt.module_id,
|
||||
0,0,0,0,0,0,
|
||||
0,
|
||||
ue_context_p->ue_context.rnti,
|
||||
(LTE_BCCH_BCH_Message_t *) NULL,
|
||||
(LTE_RadioResourceConfigCommonSIB_t *) NULL,
|
||||
(LTE_RadioResourceConfigCommonSIB_t *) NULL,
|
||||
physicalConfigDedicated,
|
||||
(LTE_SCellToAddMod_r10_t *)NULL,
|
||||
//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
|
||||
(LTE_MeasObjectToAddMod_t **) NULL,
|
||||
mac_MainConfig,
|
||||
DRB2LCHAN[i],
|
||||
DRB_configList->list.array[i]->logicalChannelConfig,
|
||||
measGapConfig,
|
||||
(LTE_TDD_Config_t *) NULL,
|
||||
NULL,
|
||||
(LTE_SchedulingInfoList_t *) NULL,
|
||||
0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
|
||||
, 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL,
|
||||
0,
|
||||
(LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL,
|
||||
(LTE_SchedulingInfo_MBMS_r14_t *) NULL,
|
||||
(struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL,
|
||||
(LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
|
||||
(LTE_MBSFN_AreaInfoList_r9_t *) NULL,
|
||||
(LTE_MBSFNAreaConfiguration_r9_t*) NULL
|
||||
);
|
||||
}
|
||||
|
||||
} else { // remove LCHAN from MAC/PHY
|
||||
@@ -765,7 +790,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
}
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -780,7 +805,10 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
int UE_id,
|
||||
rnti_t rntiP,
|
||||
const uint8_t *sduP,
|
||||
sdu_size_t sdu_lenP) {
|
||||
sdu_size_t sdu_lenP,
|
||||
const int8_t *sdu2P,
|
||||
sdu_size_t sdu2_lenP) {
|
||||
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_InitialULRRCMessageTransfer_t *out;
|
||||
F1AP_InitialULRRCMessageTransferIEs_t *ie;
|
||||
@@ -850,29 +878,36 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
|
||||
/* optional */
|
||||
/* c5. DUtoCURRCContainer */
|
||||
if (0) {
|
||||
if (sdu2P && RC.nrrrc) {
|
||||
ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val",
|
||||
strlen("dummy_val"));
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, (char *)sdu2P, sdu2_lenP);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
}
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 INITIAL UL RRC MESSAGE TRANSFER\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]);
|
||||
ue_context_p->ue_id_rnti = rntiP;
|
||||
ue_context_p->ue_context.rnti = rntiP;
|
||||
ue_context_p->ue_context.random_ue_identity = rntiP;
|
||||
ue_context_p->ue_context.Srb0.Active = 1;
|
||||
RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p);
|
||||
if (RC.nrrrc && RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) {
|
||||
struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
|
||||
ue_context_p->ue_id_rnti = rntiP;
|
||||
ue_context_p->ue_context.rnti = rntiP;
|
||||
ue_context_p->ue_context.random_ue_identity = rntiP;
|
||||
ue_context_p->ue_context.Srb0.Active = 1;
|
||||
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
|
||||
} else {
|
||||
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]);
|
||||
ue_context_p->ue_id_rnti = rntiP;
|
||||
ue_context_p->ue_context.rnti = rntiP;
|
||||
ue_context_p->ue_context.random_ue_identity = rntiP;
|
||||
ue_context_p->ue_context.Srb0.Active = 1;
|
||||
RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p);
|
||||
}
|
||||
du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id);
|
||||
|
||||
return 0;
|
||||
@@ -884,4 +919,631 @@ void init_f1ap_du_ue_inst (void) {
|
||||
memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst));
|
||||
}
|
||||
|
||||
int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
const f1ap_ul_rrc_message_t *msg) {
|
||||
const rnti_t rnti = msg->rnti;
|
||||
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_ULRRCMessageTransfer_t *out;
|
||||
F1AP_ULRRCMessageTransferIEs_t *ie;
|
||||
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t len;
|
||||
|
||||
|
||||
LOG_I(F1AP, "[DU %ld] %s: size %d UE RNTI %x in SRB %d\n",
|
||||
instance, __func__, msg->rrc_container_length, rnti, msg->srb_id);
|
||||
|
||||
//LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length);
|
||||
//for (int i = 0;i < msg->rrc_container_length; i++)
|
||||
// printf("%02x ", msg->rrc_container[i]);
|
||||
//printf("\n");
|
||||
|
||||
/* Create */
|
||||
/* 0. Message Type */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t));
|
||||
pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer;
|
||||
pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer;
|
||||
out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
|
||||
|
||||
/* mandatory */
|
||||
/* c1. GNB_CU_UE_F1AP_ID */
|
||||
ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
|
||||
|
||||
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti);
|
||||
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
/* c2. GNB_DU_UE_F1AP_ID */
|
||||
ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
|
||||
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
/* c3. SRBID */
|
||||
ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_SRBID;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID;
|
||||
ie->value.choice.SRBID = msg->srb_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
// issue in here
|
||||
/* mandatory */
|
||||
/* c4. RRCContainer */
|
||||
ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t));
|
||||
ie->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie->criticality = F1AP_Criticality_reject;
|
||||
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer,
|
||||
(const char *) msg->rrc_container,
|
||||
msg->rrc_container_length);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
if (msg->srb_id == 1 || msg->srb_id == 2) {
|
||||
struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti);
|
||||
|
||||
|
||||
NR_UL_DCCH_Message_t* ul_dcch_msg=NULL;
|
||||
asn_dec_rval_t dec_rval;
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_UL_DCCH_Message,
|
||||
(void**)&ul_dcch_msg,
|
||||
&ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header
|
||||
msg->rrc_container_length, 0, 0);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed);
|
||||
/* for rfsim, because UE send RRCSetupRequest in SRB1 */
|
||||
// NR_UL_CCCH_Message_t *ul_ccch_msg;
|
||||
// dec_rval = uper_decode(NULL,
|
||||
// &asn_DEF_NR_UL_CCCH_Message,
|
||||
// (void**)&ul_ccch_msg,
|
||||
// &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header
|
||||
// msg->rrc_container_length, 0, 0);
|
||||
// if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
// LOG_E(F1AP, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed);
|
||||
// } else {
|
||||
// LOG_I(F1AP, "decode UL-CCCH success \n");
|
||||
// LOG_I(F1AP, "Received message: present %d and c1 present %d\n",
|
||||
// ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present);
|
||||
|
||||
// if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) {
|
||||
// if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) {
|
||||
// LOG_I(F1AP, "[MSG] RRC Setup Request\n");
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
LOG_I(F1AP, "Received message: present %d and c1 present %d\n",
|
||||
ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present);
|
||||
|
||||
if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) {
|
||||
|
||||
switch (ul_dcch_msg->message.choice.c1->present) {
|
||||
case NR_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_measurementReport:
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete:
|
||||
LOG_I(F1AP, "[MSG] RRC UL rrcReconfigurationComplete\n");
|
||||
|
||||
/* CDRX: activated when RRC Connection Reconfiguration Complete is received */
|
||||
#if(0)
|
||||
int UE_id_mac = find_nr_UE_id(instance, rnti);
|
||||
|
||||
if (UE_id_mac == -1) {
|
||||
LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti);
|
||||
break;
|
||||
}
|
||||
|
||||
UE_sched_ctrl_t *UE_scheduling_control = &(RC.nrmac[instance]->UE_info.UE_sched_ctrl[UE_id_mac]);
|
||||
|
||||
if (UE_scheduling_control->cdrx_waiting_ack == TRUE) {
|
||||
UE_scheduling_control->cdrx_waiting_ack = FALSE;
|
||||
UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received
|
||||
LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n");
|
||||
}
|
||||
/* End of CDRX processing */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete:
|
||||
LOG_I(F1AP, "[MSG] RRC UL rrcSetupComplete \n");
|
||||
|
||||
if(!ue_context_p){
|
||||
LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti);
|
||||
|
||||
} else {
|
||||
LOG_I(F1AP, "Processing RRCSetupComplete UE %x\n", rnti);
|
||||
ue_context_p->ue_context.StatusRrc = NR_RRC_CONNECTED;
|
||||
}
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete:
|
||||
LOG_I(F1AP, "[MSG] RRC ReestablishmentComplete \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete:
|
||||
LOG_I(F1AP, "[MSG] RRC ResumeComplete \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete:
|
||||
LOG_I(F1AP, "[MSG] RRC securityModeComplete \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_securityModeFailure:
|
||||
LOG_I(F1AP, "[MSG] RRC securityModeFailure \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer:
|
||||
LOG_I(F1AP, "[MSG] RRC UL Information Transfer \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_locationMeasurementIndication:
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
|
||||
LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n");
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_ueAssistanceInformation:
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_failureInformation:
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformation:
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformationEUTRA:
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(NR_RRC, "Unknown UL DCCH message type, present %d \n", ul_dcch_msg->message.choice.c1->present);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* DL NR RRC Message Transfer */
|
||||
int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
LOG_D(F1AP, "DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n");
|
||||
|
||||
F1AP_DLRRCMessageTransfer_t *container;
|
||||
F1AP_DLRRCMessageTransferIEs_t *ie;
|
||||
|
||||
uint64_t cu_ue_f1ap_id;
|
||||
uint64_t du_ue_f1ap_id;
|
||||
uint64_t srb_id;
|
||||
int executeDuplication;
|
||||
sdu_size_t rrc_dl_sdu_len;
|
||||
//uint64_t subscriberProfileIDforRFP;
|
||||
//uint64_t rAT_FrequencySelectionPriority;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
if (stream != 0) {
|
||||
LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n",
|
||||
assoc_id, stream);
|
||||
return -1;
|
||||
}
|
||||
|
||||
container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
|
||||
|
||||
|
||||
/* GNB_CU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
|
||||
cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
|
||||
LOG_D(F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id);
|
||||
|
||||
|
||||
/* GNB_DU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
|
||||
LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n",
|
||||
du_ue_f1ap_id,
|
||||
f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer
|
||||
|
||||
if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) {
|
||||
LOG_E(F1AP, "Failed to find the F1AP UID \n");
|
||||
//return -1;
|
||||
}
|
||||
|
||||
/* optional */
|
||||
/* oldgNB_DU_UE_F1AP_ID */
|
||||
if (0) {
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true);
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* SRBID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_SRBID, true);
|
||||
srb_id = ie->value.choice.SRBID;
|
||||
LOG_D(F1AP, "srb_id %lu \n", srb_id);
|
||||
|
||||
/* optional */
|
||||
/* ExecuteDuplication */
|
||||
if (0) {
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_ExecuteDuplication, true);
|
||||
executeDuplication = ie->value.choice.ExecuteDuplication;
|
||||
LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication);
|
||||
}
|
||||
|
||||
// issue in here
|
||||
/* mandatory */
|
||||
/* RRC Container */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, true);
|
||||
// BK: need check
|
||||
// create an ITTI message and copy SDU
|
||||
|
||||
// message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND);
|
||||
// memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
rrc_dl_sdu_len = ie->value.choice.RRCContainer.size;
|
||||
// memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
|
||||
// ccch_sdu_len);
|
||||
|
||||
//LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size);
|
||||
//for (int i = 0;i < ie->value.choice.RRCContainer.size; i++)
|
||||
// printf("%02x ", ie->value.choice.RRCContainer.buf[i]);
|
||||
//printf("\n");
|
||||
|
||||
/* optional */
|
||||
/* RAT_FrequencyPriorityInformation */
|
||||
if (0) {
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true);
|
||||
|
||||
switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) {
|
||||
case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC:
|
||||
//subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP;
|
||||
break;
|
||||
case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN:
|
||||
//rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority;
|
||||
break;
|
||||
default:
|
||||
LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// decode RRC Container and act on the message type
|
||||
AssertFatal(srb_id<3,"illegal srb_id\n");
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id);
|
||||
ctxt.module_id = instance;
|
||||
ctxt.instance = instance;
|
||||
ctxt.enb_flag = 1;
|
||||
|
||||
struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context(
|
||||
RC.nrrrc[ctxt.module_id],
|
||||
ctxt.rnti);
|
||||
|
||||
if (srb_id == 0) {
|
||||
NR_DL_CCCH_Message_t* dl_ccch_msg=NULL;
|
||||
asn_dec_rval_t dec_rval;
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_DL_CCCH_Message,
|
||||
(void**)&dl_ccch_msg,
|
||||
ie->value.choice.RRCContainer.buf,
|
||||
rrc_dl_sdu_len,0,0);
|
||||
AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n");
|
||||
switch (dl_ccch_msg->message.choice.c1->present) {
|
||||
|
||||
case NR_DL_CCCH_MessageType__c1_PR_NOTHING:
|
||||
|
||||
LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n");
|
||||
break;
|
||||
|
||||
case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
|
||||
LOG_I(F1AP,
|
||||
"Logical Channel DL-CCCH (SRB0), Received RRCReject\n");
|
||||
break;
|
||||
|
||||
case NR_DL_CCCH_MessageType__c1_PR_rrcSetup:
|
||||
{
|
||||
LOG_I(F1AP,
|
||||
"Logical Channel DL-CCCH (SRB0), Received RRCSetup DU_ID %lx/RNTI %x\n",
|
||||
du_ue_f1ap_id,
|
||||
f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id));
|
||||
// Get configuration
|
||||
|
||||
NR_RRCSetup_t* rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup;
|
||||
AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n");
|
||||
NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup;
|
||||
|
||||
ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
|
||||
AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n");
|
||||
asn_dec_rval_t dec_rval;
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_CellGroupConfig,
|
||||
(void**)&ue_context_p->ue_context.masterCellGroup,
|
||||
rrcSetup_ies->masterCellGroup.buf,
|
||||
rrcSetup_ies->masterCellGroup.size,0,0);
|
||||
AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n");
|
||||
|
||||
// configure MAC
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
|
||||
rrc_mac_config_req_gNB(ctxt.module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
rrc->carrier.pdsch_AntennaPorts,
|
||||
rrc->carrier.pusch_AntennaPorts,
|
||||
NULL,
|
||||
0,
|
||||
ue_context_p->ue_context.rnti,
|
||||
ue_context_p->ue_context.masterCellGroup
|
||||
);
|
||||
|
||||
// rrc_rlc_config_asn1_req
|
||||
nr_rrc_rlc_config_asn1_req(&ctxt,
|
||||
ue_context_p->ue_context.SRB_configList,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
// This should be somewhere in the f1ap_cudu_ue_inst_t
|
||||
/*int macrlc_instance = 0;
|
||||
|
||||
rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id);
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[macrlc_instance],rnti);
|
||||
*/
|
||||
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
|
||||
AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n");
|
||||
|
||||
memcpy((void*)ue_p->Srb0.Tx_buffer.Payload,
|
||||
(void*)ie->value.choice.RRCContainer.buf,
|
||||
rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size
|
||||
|
||||
ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len;
|
||||
|
||||
// NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL;
|
||||
// if (cellGroupConfig->mac_CellGroupConfig)
|
||||
// mac_CellGroupConfig = cellGroupConfig->mac_CellGroupConfig;
|
||||
|
||||
// rrc_mac_config_req_gNB
|
||||
break;
|
||||
} // case
|
||||
|
||||
case NR_DL_CCCH_MessageType__c1_PR_spare2:
|
||||
LOG_I(F1AP,
|
||||
"Logical Channel DL-CCCH (SRB0), Received spare2\n");
|
||||
break;
|
||||
|
||||
case NR_DL_CCCH_MessageType__c1_PR_spare1:
|
||||
LOG_I(F1AP,
|
||||
"Logical Channel DL-CCCH (SRB0), Received spare1\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0,
|
||||
"Unknown message\n");
|
||||
break;
|
||||
}// switch case
|
||||
return(0);
|
||||
} else if (srb_id == 1) {
|
||||
|
||||
NR_DL_DCCH_Message_t* dl_dcch_msg=NULL;
|
||||
asn_dec_rval_t dec_rval;
|
||||
dec_rval = uper_decode(NULL,
|
||||
&asn_DEF_NR_DL_DCCH_Message,
|
||||
(void**)&dl_dcch_msg,
|
||||
&ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header
|
||||
rrc_dl_sdu_len-6,0,0);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
|
||||
LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed);
|
||||
else
|
||||
LOG_D(F1AP, "Received message: present %d and c1 present %d\n",
|
||||
dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present);
|
||||
|
||||
if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
|
||||
switch (dl_dcch_msg->message.choice.c1->present) {
|
||||
case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
|
||||
LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n");
|
||||
return 0;
|
||||
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
|
||||
// handle RRCReconfiguration
|
||||
LOG_I(F1AP,
|
||||
"Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration DU_ID %lx/RNTI %x\n",
|
||||
du_ue_f1ap_id,
|
||||
f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id));
|
||||
|
||||
NR_RRCReconfiguration_t* rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration;
|
||||
|
||||
if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
|
||||
NR_RRCReconfiguration_IEs_t* rrcReconfiguration_ies =
|
||||
rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
|
||||
|
||||
if (rrcReconfiguration_ies->measConfig != NULL) {
|
||||
LOG_I(F1AP, "Measurement Configuration is present\n");
|
||||
}
|
||||
|
||||
if (rrcReconfiguration_ies->radioBearerConfig) {
|
||||
LOG_I(F1AP, "Radio Resource Configuration is present\n");
|
||||
long drb_id;
|
||||
int i;
|
||||
NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList;
|
||||
NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList;
|
||||
// NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList;
|
||||
|
||||
// rrc_rlc_config_asn1_req
|
||||
|
||||
if (SRB_configList != NULL) {
|
||||
for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
|
||||
if (SRB_configList->list.array[i]->srb_Identity == 1 ){
|
||||
ue_context_p->ue_context.Srb1.Active=1;
|
||||
}
|
||||
else if (SRB_configList->list.array[i]->srb_Identity == 2 ) {
|
||||
ue_context_p->ue_context.Srb2.Active=1;
|
||||
ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2;
|
||||
LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id);
|
||||
} else {
|
||||
LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
|
||||
SRB_configList->list.array[i]->srb_Identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DRB_configList != NULL) {
|
||||
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
|
||||
if (DRB_configList->list.array[i]) {
|
||||
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
|
||||
LOG_I(F1AP,
|
||||
"[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n",
|
||||
ctxt.module_id,
|
||||
ctxt.rnti,
|
||||
(int)DRB_configList->list.array[i]->drb_Identity);
|
||||
// (int)*DRB_configList->list.array[i]->logicalChannelIdentity);
|
||||
|
||||
if (ue_context_p->ue_context.DRB_active[drb_id] == 0) {
|
||||
ue_context_p->ue_context.DRB_active[drb_id] = 1;
|
||||
|
||||
// logicalChannelIdentity
|
||||
// rrc_mac_config_req_eNB
|
||||
}
|
||||
|
||||
} else { // remove LCHAN from MAC/PHY
|
||||
AssertFatal(1==0,"Can't handle this yet in DU\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
|
||||
LOG_I(F1AP,"Received rrcResume\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
|
||||
LOG_I(F1AP,"Received rrcRelease\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
|
||||
LOG_I(F1AP,"Received rrcReestablishment\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
|
||||
LOG_I(F1AP,"Received securityModeCommand\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
|
||||
LOG_I(F1AP, "Received dlInformationTransfer\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
|
||||
LOG_I(F1AP, "Received ueCapabilityEnquiry\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
|
||||
LOG_I(F1AP, "Received counterCheck\n");
|
||||
break;
|
||||
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_spare3:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_spare2:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_spare1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (srb_id == 2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id);
|
||||
|
||||
|
||||
// rlc_op_status_t rlc_status;
|
||||
// boolean_t ret = TRUE;
|
||||
mem_block_t *pdcp_pdu_p = NULL;
|
||||
pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__);
|
||||
|
||||
//LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size);
|
||||
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
|
||||
// printf("%02x ", ie->value.choice.RRCContainer.buf[i]);
|
||||
|
||||
//printf (", PDCP PDU size %d:", rrc_dl_sdu_len);
|
||||
//for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]);
|
||||
//printf("\n");
|
||||
|
||||
if (pdcp_pdu_p != NULL) {
|
||||
memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len);
|
||||
memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len);
|
||||
|
||||
/* for rfsim */
|
||||
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, pdcp_pdu_p);
|
||||
// rlc_status = rlc_data_req(&ctxt
|
||||
// , 1
|
||||
// , MBMS_FLAG_NO
|
||||
// , srb_id
|
||||
// , 0
|
||||
// , 0
|
||||
// , rrc_dl_sdu_len
|
||||
// , pdcp_pdu_p
|
||||
// ,NULL
|
||||
// ,NULL
|
||||
// );
|
||||
// switch (rlc_status) {
|
||||
// case RLC_OP_STATUS_OK:
|
||||
// //LOG_I(F1AP, "Data sending request over RLC succeeded!\n");
|
||||
// ret=TRUE;
|
||||
// break;
|
||||
|
||||
// case RLC_OP_STATUS_BAD_PARAMETER:
|
||||
// LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
|
||||
// ret= FALSE;
|
||||
// break;
|
||||
|
||||
// case RLC_OP_STATUS_INTERNAL_ERROR:
|
||||
// LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
|
||||
// ret= FALSE;
|
||||
// break;
|
||||
|
||||
// case RLC_OP_STATUS_OUT_OF_RESSOURCES:
|
||||
// LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
|
||||
// ret= FALSE;
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
|
||||
// ret= FALSE;
|
||||
// break;
|
||||
// } // switch case
|
||||
// return ret;
|
||||
} // if pdcp_pdu_p
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,12 +42,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
F1AP_F1AP_PDU_t *pdu);
|
||||
|
||||
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
|
||||
int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
|
||||
|
||||
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
int CC_idP,
|
||||
int UE_id,
|
||||
rnti_t rntiP,
|
||||
const uint8_t *sduP,
|
||||
sdu_size_t sdu_lenP);
|
||||
sdu_size_t sdu_lenP,
|
||||
const int8_t *sdu2P,
|
||||
sdu_size_t sdu2_lenP);
|
||||
|
||||
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
|
||||
|
||||
@@ -102,7 +102,12 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
f1ap_du_data->default_sctp_stream_id = 0;
|
||||
|
||||
/* setup parameters for F1U and start the server */
|
||||
const cudu_params_t params = {
|
||||
const cudu_params_t params = (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) ? (cudu_params_t){
|
||||
.local_ipv4_address = RC.nrmac[instance]->eth_params_n.my_addr,
|
||||
.local_port = RC.nrmac[instance]->eth_params_n.my_portd,
|
||||
.remote_ipv4_address = RC.nrmac[instance]->eth_params_n.remote_addr,
|
||||
.remote_port = RC.nrmac[instance]->eth_params_n.remote_portd
|
||||
} : (cudu_params_t){
|
||||
.local_ipv4_address = RC.mac[instance]->eth_params_n.my_addr,
|
||||
.local_port = RC.mac[instance]->eth_params_n.my_portd,
|
||||
.remote_ipv4_address = RC.mac[instance]->eth_params_n.remote_addr,
|
||||
@@ -159,6 +164,14 @@ void *F1AP_DU_task(void *arg) {
|
||||
du_task_send_sctp_association_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_SETUP_REQ(received_msg));
|
||||
break;
|
||||
case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE:
|
||||
DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg));
|
||||
break;
|
||||
case F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE:
|
||||
DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(received_msg));
|
||||
break;
|
||||
|
||||
case SCTP_NEW_ASSOCIATION_RESP:
|
||||
// 1. store the respon
|
||||
@@ -175,10 +188,26 @@ void *F1AP_DU_task(void *arg) {
|
||||
&received_msg->ittiMsg.sctp_data_ind);
|
||||
break;
|
||||
|
||||
case F1AP_INITIAL_UL_RRC_MESSAGE: // to rrc
|
||||
LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n");
|
||||
|
||||
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg);
|
||||
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
|
||||
msg->rrc_container,
|
||||
msg->rrc_container_length,
|
||||
(const int8_t*)msg->du2cu_rrc_container,
|
||||
msg->du2cu_rrc_container_length);
|
||||
break;
|
||||
|
||||
case F1AP_UL_RRC_MESSAGE: // to rrc
|
||||
LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
|
||||
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UL_RRC_MESSAGE(received_msg));
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UL_RRC_MESSAGE(received_msg));
|
||||
} else {
|
||||
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UL_RRC_MESSAGE(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC
|
||||
|
||||
@@ -108,51 +108,82 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
|
||||
f1ap_ue_context_setup_req->cellULConfigured = NULL;
|
||||
}
|
||||
|
||||
/* CUtoDURRCInformation */
|
||||
/* Candidate_SpCell_List */
|
||||
/* optional */
|
||||
/* DRXCycle */
|
||||
/* optional */
|
||||
/* ResourceCoordinationTransferContainer */
|
||||
/* SCell_ToBeSetup_List */
|
||||
/* SRBs_ToBeSetup_List */
|
||||
/* DRBs_ToBeSetup_List */
|
||||
/* Decode DRBs_ToBeSetup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true);
|
||||
f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count;
|
||||
f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length,
|
||||
sizeof(f1ap_drb_to_be_setup_t));
|
||||
AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup,
|
||||
"could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n");
|
||||
if (RC.nrrrc) {
|
||||
/* RRCContainer */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, false);
|
||||
if (ie) {
|
||||
/* correct here */
|
||||
f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size);
|
||||
memcpy(f1ap_ue_context_setup_req->rrc_container, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
|
||||
} else {
|
||||
LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
|
||||
}
|
||||
|
||||
for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) {
|
||||
f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i];
|
||||
F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p;
|
||||
drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item;
|
||||
drb_p->drb_id = drbs_tobesetup_item_p->dRBID;
|
||||
/* TODO in the following, assume only one UP UL TNL is present.
|
||||
* this matches/assumes OAI CU implementation, can be up to 2! */
|
||||
drb_p->up_ul_tnl_length = 1;
|
||||
AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0,
|
||||
"no UL UP TNL Information in DRBs to be Setup list\n");
|
||||
F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0];
|
||||
F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel;
|
||||
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address);
|
||||
OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid);
|
||||
// AssertFatal(0, "check configuration, send to appropriate handler\n");
|
||||
|
||||
switch (drbs_tobesetup_item_p->rLCMode) {
|
||||
case F1AP_RLCMode_rlc_am:
|
||||
drb_p->rlc_mode = RLC_MODE_AM;
|
||||
break;
|
||||
protocol_ctxt_t ctxt;
|
||||
// ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID);
|
||||
ctxt.rnti = 0x1234;
|
||||
ctxt.module_id = instance;
|
||||
ctxt.instance = instance;
|
||||
ctxt.enb_flag = 1;
|
||||
|
||||
default:
|
||||
drb_p->rlc_mode = RLC_MODE_TM;
|
||||
break;
|
||||
mem_block_t *pdcp_pdu_p = NULL;
|
||||
pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__);
|
||||
if (pdcp_pdu_p != NULL) {
|
||||
memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size);
|
||||
memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
|
||||
|
||||
/* for rfsim */
|
||||
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p);
|
||||
}
|
||||
} else {
|
||||
/* CUtoDURRCInformation */
|
||||
/* Candidate_SpCell_List */
|
||||
/* optional */
|
||||
/* DRXCycle */
|
||||
/* optional */
|
||||
/* ResourceCoordinationTransferContainer */
|
||||
/* SCell_ToBeSetup_List */
|
||||
/* SRBs_ToBeSetup_List */
|
||||
/* DRBs_ToBeSetup_List */
|
||||
/* Decode DRBs_ToBeSetup_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true);
|
||||
f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count;
|
||||
f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length,
|
||||
sizeof(f1ap_drb_to_be_setup_t));
|
||||
AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup,
|
||||
"could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n");
|
||||
|
||||
for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) {
|
||||
f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i];
|
||||
F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p;
|
||||
drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item;
|
||||
drb_p->drb_id = drbs_tobesetup_item_p->dRBID;
|
||||
/* TODO in the following, assume only one UP UL TNL is present.
|
||||
* this matches/assumes OAI CU implementation, can be up to 2! */
|
||||
drb_p->up_ul_tnl_length = 1;
|
||||
AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0,
|
||||
"no UL UP TNL Information in DRBs to be Setup list\n");
|
||||
F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0];
|
||||
F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel;
|
||||
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address);
|
||||
OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid);
|
||||
|
||||
switch (drbs_tobesetup_item_p->rLCMode) {
|
||||
case F1AP_RLCMode_rlc_am:
|
||||
drb_p->rlc_mode = RLC_MODE_AM;
|
||||
break;
|
||||
|
||||
default:
|
||||
drb_p->rlc_mode = RLC_MODE_TM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal(0, "check configuration, send to appropriate handler\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -511,7 +542,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1181,7 +1212,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT MODIFICATION RESPONSE\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = {
|
||||
{ CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */
|
||||
{ 0, 0, 0 }, /* ErrorIndication */
|
||||
{ 0, 0, 0 }, /* gNBDUConfigurationUpdate */
|
||||
{ 0, 0, 0 }, /* gNBCUConfigurationUpdate */
|
||||
{ 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 */
|
||||
|
||||
@@ -47,7 +47,9 @@
|
||||
#define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd"
|
||||
#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference"
|
||||
#define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads"
|
||||
|
||||
#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"
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* L1 configuration parameters */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
@@ -62,7 +64,10 @@
|
||||
{CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:3, TYPE_UINT, 0} \
|
||||
{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, 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:200, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \
|
||||
}
|
||||
#define L1_CC_IDX 0
|
||||
#define L1_TRANSPORT_N_PREFERENCE_IDX 1
|
||||
@@ -74,6 +79,9 @@
|
||||
#define L1_LOCAL_N_PORTD_IDX 7
|
||||
#define L1_REMOTE_N_PORTD_IDX 8
|
||||
#define L1_PUSCH_PROC_THREADS 9
|
||||
#define L1_PUCCH0_DTX_THRESHOLD 10
|
||||
#define L1_PRACH_DTX_THRESHOLD 11
|
||||
#define L1_PUSCH_DTX_THRESHOLD 12
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
|
||||
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
|
||||
#define CONFIG_STRING_MACRLC_ULSCH_MAX_SLOTS_INACTIVITY "ulsch_max_slots_inactivity"
|
||||
#define CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10 "pusch_TargetSNRx10"
|
||||
#define CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10 "pucch_TargetSNRx10"
|
||||
#define CONFIG_STRING_MACRLC_PUCCHFAILURETHRES "pucch_FailureThres"
|
||||
#define CONFIG_STRING_MACRLC_PUSCHFAILURETHRES "pusch_FailureThres"
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* MacRLC configuration parameters */
|
||||
@@ -80,6 +84,10 @@
|
||||
{CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_ULSCH_MAX_SLOTS_INACTIVITY, "Maximum number of slots before a UE is scheduled ULSCH due to inactivity", 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUSCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUCCHTARGETSNRX10, NULL, 0, iptr:NULL, defintval:150, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUCCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \
|
||||
{CONFIG_STRING_MACRLC_PUSCHFAILURETHRES, NULL, 0, iptr:NULL, defintval:10, TYPE_INT, 0}, \
|
||||
}
|
||||
#define MACRLC_CC_IDX 0
|
||||
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
|
||||
@@ -99,5 +107,9 @@
|
||||
#define MACRLC_LOCAL_S_PORTD_IDX 15
|
||||
#define MACRLC_REMOTE_S_PORTD_IDX 16
|
||||
#define MACRLC_ULSCH_MAX_SLOTS_INACTIVITY 17
|
||||
#define MACRLC_PUSCHTARGETSNRX10_IDX 17
|
||||
#define MACRLC_PUCCHTARGETSNRX10_IDX 18
|
||||
#define MACRLC_PUCCHFAILURETHRES_IDX 19
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 20
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
#define GNB_CONFIG_STRING_PUCCHGROUPHOPPING "pucchGroupHopping"
|
||||
#define GNB_CONFIG_STRING_HOPPINGID "hoppingId"
|
||||
#define GNB_CONFIG_STRING_P0NOMINAL "p0_nominal"
|
||||
#define GNB_CONFIG_STRING_PUCCHRES "pucch_ResourceCommon"
|
||||
#define GNB_CONFIG_STRING_INITIALULBWPK2_0 "initialULBWPk2_0"
|
||||
#define GNB_CONFIG_STRING_INITIALULBWPMAPPINGTYPE_0 "initialULBWPmappingType_0"
|
||||
#define GNB_CONFIG_STRING_INITIALULBWPSTARTSYMBOLANDLENGTH_0 "initialULBWPstartSymbolAndLength_0"
|
||||
@@ -397,6 +398,7 @@
|
||||
{GNB_CONFIG_STRING_PUCCHGROUPHOPPING, NULL,0,i64ptr:&scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_GroupHopping,defint64val:NR_PUCCH_ConfigCommon__pucch_GroupHopping_neither,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_HOPPINGID, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->hoppingId,defint64val:40,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_P0NOMINAL, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal,defint64val:1,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_PUCCHRES, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon,defint64val:0,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_SSBPOSITIONSINBURSTPR,NULL,0,uptr:&scc->ssb_PositionsInBurst->present,defuintval:NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap,TYPE_UINT,0/*140*/}, \
|
||||
{GNB_CONFIG_STRING_SSBPOSITIONSINBURST,NULL,0,u64ptr:&ssb_bitmap,defintval:0xff,TYPE_UINT64,0}, \
|
||||
{GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING,NULL,0,i64ptr:&scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing,defint64val:NR_SubcarrierSpacing_kHz30,TYPE_INT64,0},\
|
||||
|
||||
+104
-24
@@ -29,6 +29,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <nr_pdcp/nr_pdcp.h>
|
||||
#include <softmodem-common.h>
|
||||
#include <split_headers.h>
|
||||
#include <proto_agent.h>
|
||||
|
||||
#include "gnb_app.h"
|
||||
#include "gnb_config.h"
|
||||
@@ -43,7 +47,9 @@
|
||||
#include "sctp_eNB_task.h"
|
||||
#include "gtpv1u_eNB_task.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
|
||||
#include "f1ap_cu_task.h"
|
||||
#include "f1ap_du_task.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
extern unsigned char NB_gNB_INST;
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
@@ -61,7 +67,7 @@ static void configure_nr_rrc(uint32_t gnb_id)
|
||||
if (RC.nrrrc[gnb_id]) {
|
||||
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
|
||||
|
||||
|
||||
LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type);
|
||||
LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n");
|
||||
itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
|
||||
@@ -82,26 +88,25 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//,
|
||||
{
|
||||
if(NGAP_CONF_MODE){
|
||||
ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse
|
||||
|
||||
// note: there is an implicit relationship between the data structure and the message name
|
||||
|
||||
// note: there is an implicit relationship between the data structure and the message name
|
||||
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse
|
||||
|
||||
RCconfig_NR_NG(msg_p, gnb_id);
|
||||
|
||||
|
||||
ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse
|
||||
|
||||
LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx);
|
||||
|
||||
itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
}
|
||||
LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx);
|
||||
|
||||
itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
}
|
||||
if (gnb_id == 0) RCconfig_nr_gtpu();
|
||||
|
||||
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
|
||||
|
||||
register_gnb_pending++;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
|
||||
|
||||
register_gnb_pending++;
|
||||
}
|
||||
|
||||
return register_gnb_pending;
|
||||
}
|
||||
@@ -126,15 +131,42 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end)
|
||||
return register_gnb_x2_pending;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
static void init_pdcp(void) {
|
||||
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
|
||||
pdcp_layer_init();
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
LOG_I(PDCP, "IS_SOFTMODEM_NOS1 option enabled\n");
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
|
||||
}
|
||||
|
||||
pdcp_module_init(pdcp_initmask);
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
|
||||
} else {
|
||||
LOG_I(PDCP, "node is gNB \n");
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
void *gNB_app_task(void *args_p)
|
||||
{
|
||||
|
||||
uint32_t gnb_nb = RC.nb_nr_inst;
|
||||
uint32_t gnb_id_start = 0;
|
||||
uint32_t gnb_id_end = gnb_id_start + gnb_nb;
|
||||
|
||||
uint32_t gnb_id;
|
||||
MessageDef *msg_p = NULL;
|
||||
const char *msg_name = NULL;
|
||||
@@ -143,11 +175,12 @@ void *gNB_app_task(void *args_p)
|
||||
/* for no gcc warnings */
|
||||
(void)instance;
|
||||
|
||||
int cell_to_activate = 0;
|
||||
itti_mark_task_ready (TASK_GNB_APP);
|
||||
|
||||
LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__);
|
||||
|
||||
RCconfig_nr_macrlc();
|
||||
if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc();
|
||||
|
||||
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
|
||||
|
||||
@@ -169,19 +202,43 @@ void *gNB_app_task(void *args_p)
|
||||
configure_nr_rrc(gnb_id);
|
||||
}
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
init_pdcp();
|
||||
}
|
||||
|
||||
if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type)
|
||||
LOG_I(X2AP, "X2AP enabled \n");
|
||||
__attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end);
|
||||
}
|
||||
|
||||
if (AMF_MODE_ENABLED) {
|
||||
/* Try to register each gNB */
|
||||
//registered_gnb = 0;
|
||||
__attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
|
||||
} else {
|
||||
/* Start L2L1 task */
|
||||
msg_p = itti_alloc_new_message(TASK_GNB_APP, 0, INITIALIZE_MESSAGE);
|
||||
itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p);
|
||||
/* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info
|
||||
* can originate from the DU. Add check on whether x2ap is enabled to account for ENDC NSA scenario.*/
|
||||
if ((AMF_MODE_ENABLED || is_x2ap_enabled()) && !NODE_IS_DU(RC.nrrrc[0]->node_type) && !NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
/* Try to register each gNB */
|
||||
//registered_gnb = 0;
|
||||
__attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);
|
||||
}
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
|
||||
if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) {
|
||||
LOG_E(F1AP, "Create task for F1AP CU failed\n");
|
||||
AssertFatal(1==0,"exiting");
|
||||
}
|
||||
}
|
||||
|
||||
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
|
||||
|
||||
if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) {
|
||||
LOG_E(F1AP, "Create task for F1AP DU failed\n");
|
||||
AssertFatal(1==0,"exiting");
|
||||
}
|
||||
// configure F1AP here for F1C
|
||||
LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n");
|
||||
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ);
|
||||
RCconfig_NR_DU_F1(msg_p, 0);
|
||||
|
||||
itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p);
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -245,6 +302,29 @@ void *gNB_app_task(void *args_p)
|
||||
*/
|
||||
break;
|
||||
|
||||
case F1AP_SETUP_RESP:
|
||||
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n");
|
||||
|
||||
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
|
||||
F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate);
|
||||
cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate;
|
||||
|
||||
gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p));
|
||||
|
||||
break;
|
||||
case F1AP_GNB_CU_CONFIGURATION_UPDATE:
|
||||
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n");
|
||||
|
||||
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).gNB_CU_name,F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate);
|
||||
|
||||
cell_to_activate += F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate;
|
||||
gNB_app_handle_f1ap_gnb_cu_configuration_update(&F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p));
|
||||
|
||||
/* Check if at least gNB is registered with one AMF */
|
||||
AssertFatal(cell_to_activate == 1,"No cells to activate or cells > 1 %d\n",cell_to_activate);
|
||||
|
||||
break;
|
||||
case NGAP_DEREGISTERED_GNB_IND:
|
||||
LOG_W(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name,
|
||||
NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf);
|
||||
|
||||
+535
-14
@@ -43,6 +43,7 @@
|
||||
#include "ngap_gNB.h"
|
||||
#include "sctp_eNB_task.h"
|
||||
#include "sctp_default_values.h"
|
||||
#include "F1AP_CauseRadioNetwork.h"
|
||||
// #include "SystemInformationBlockType2.h"
|
||||
// #include "LAYER2/MAC/extern.h"
|
||||
// #include "LAYER2/MAC/proto.h"
|
||||
@@ -79,7 +80,12 @@
|
||||
#include "NR_ControlResourceSet.h"
|
||||
#include "NR_EUTRA-MBSFN-SubframeConfig.h"
|
||||
|
||||
#include "RRC/NR/MESSAGES/asn1_msg.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
|
||||
|
||||
extern uint16_t sf_ahead;
|
||||
int macrlc_has_f1 = 0;
|
||||
extern ngran_node_t node_type;
|
||||
|
||||
extern int config_check_band_frequencies(int ind, int16_t band, uint64_t downlink_frequency,
|
||||
int32_t uplink_frequency_offset, uint32_t frame_type);
|
||||
@@ -323,6 +329,10 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) {
|
||||
free(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing);
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing=NULL;
|
||||
}
|
||||
|
||||
// check pucch_ResourceConfig
|
||||
AssertFatal(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon < 2,
|
||||
"pucch_ResourceConfig should be 0 or 1 for now\n");
|
||||
}
|
||||
|
||||
/* Function to allocate dedicated serving cell config strutures */
|
||||
@@ -588,11 +598,13 @@ void RCconfig_NR_L1(void) {
|
||||
RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB));
|
||||
LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]);
|
||||
memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB));
|
||||
RC.gNB[j]->Mod_id = j;
|
||||
RC.gNB[j]->Mod_id = j;
|
||||
}
|
||||
|
||||
RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr);
|
||||
|
||||
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);
|
||||
if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
|
||||
//sf_ahead = 2; // Need 4 subframe gap between RX and TX
|
||||
}else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
@@ -662,10 +674,25 @@ void RCconfig_nr_macrlc() {
|
||||
|
||||
for (j=0;j<RC.nb_nr_macrlc_inst;j++) {
|
||||
RC.nb_nr_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
|
||||
|
||||
RC.nrmac[j]->pusch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHTARGETSNRX10_IDX].iptr);
|
||||
RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr);
|
||||
RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
|
||||
RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
|
||||
|
||||
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
|
||||
// check number of instances is same as RRC/PDCP
|
||||
|
||||
}else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
|
||||
printf("Configuring F1 interfaces for MACRLC\n");
|
||||
RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
|
||||
RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
|
||||
RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
|
||||
RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
macrlc_has_f1 = 1;
|
||||
}else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
|
||||
RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
@@ -691,8 +718,6 @@ void RCconfig_nr_macrlc() {
|
||||
RC.nrmac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
|
||||
RC.nrmac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
|
||||
|
||||
//sf_ahead = 2; // Cannot cope with 4 subframes between RX and TX - set it to 2
|
||||
|
||||
printf("**************** vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc);
|
||||
configure_nr_nfapi_vnf(RC.nrmac[j]->eth_params_s.my_addr, RC.nrmac[j]->eth_params_s.my_portc);
|
||||
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc);
|
||||
@@ -702,7 +727,8 @@ void RCconfig_nr_macrlc() {
|
||||
RC.nrmac[j]->ulsch_max_slots_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_SLOTS_INACTIVITY].uptr);
|
||||
}// for (j=0;j<RC.nb_nr_macrlc_inst;j++)
|
||||
}else {// MacRLC_ParamList.numelt > 0
|
||||
AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found");
|
||||
LOG_E(PHY,"No %s configuration found\n", CONFIG_STRING_MACRLC_LIST);
|
||||
// AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -807,7 +833,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
int num_gnbs = 0;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
int32_t gnb_id = 0;
|
||||
int k;
|
||||
int k = 0;
|
||||
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
////////// Identification parameters
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
@@ -917,6 +944,41 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
fix_scd(scd);
|
||||
|
||||
printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
|
||||
if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) {
|
||||
paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix,"%s.[%u].%s",GNB_CONFIG_STRING_GNB_LIST,i,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
rrc->node_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr);
|
||||
LOG_I(GNB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id);
|
||||
rrc->node_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr));
|
||||
LOG_I(GNB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,rrc->node_name);
|
||||
rrc->eth_params_s.local_if_name = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_IF_NAME_IDX].strptr));
|
||||
rrc->eth_params_s.my_addr = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_ADDRESS_IDX].strptr));
|
||||
rrc->eth_params_s.remote_addr = strdup(*(GNBParamList.paramarray[i][GNB_REMOTE_S_ADDRESS_IDX].strptr));
|
||||
rrc->eth_params_s.my_portc = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTC_IDX].uptr);
|
||||
rrc->eth_params_s.remote_portc = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTC_IDX].uptr);
|
||||
rrc->eth_params_s.my_portd = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTD_IDX].uptr);
|
||||
rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr);
|
||||
rrc->eth_params_s.transp_preference = ETH_UDP_MODE;
|
||||
rrc->node_type = ngran_gNB_CU;
|
||||
rrc->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
rrc->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
} else {
|
||||
// set to ngran_gNB for now, it will get set to ngran_gNB_DU if macrlc entity which uses F1 is present
|
||||
// Note: we will have to handle the case of ngran_ng_gNB_DU
|
||||
if (macrlc_has_f1 == 0) {
|
||||
rrc->node_type = ngran_gNB;
|
||||
LOG_I(NR_RRC,"Setting node_type to ngran_gNB\n");
|
||||
} else {
|
||||
rrc->node_type = ngran_gNB_DU;
|
||||
LOG_I(NR_RRC,"Setting node_type to ngran_gNB_DU\n");
|
||||
}
|
||||
}
|
||||
|
||||
rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
|
||||
|
||||
if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {
|
||||
|
||||
} else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
|
||||
@@ -983,16 +1045,13 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr;
|
||||
printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr);
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr;
|
||||
printf("pusch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr);
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).pusch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr;
|
||||
printf("pucch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr);
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).pucch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr;
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).scc = scc;
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).scd = scd;
|
||||
|
||||
|
||||
}//
|
||||
}//End for (k=0; k <num_gnbs ; k++)
|
||||
memcpy(&rrc->configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p)));
|
||||
}//End if (num_gnbs>0)
|
||||
|
||||
config_security(rrc);
|
||||
@@ -1054,15 +1113,17 @@ int RCconfig_nr_gtpu(void ) {
|
||||
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
|
||||
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
|
||||
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U;
|
||||
strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address);
|
||||
sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU);
|
||||
} else {// TODO SA
|
||||
message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ);
|
||||
AssertFatal(message!=NULL,"");
|
||||
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" );
|
||||
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up);
|
||||
GTPV1U_GNB_NG_REQ(message).gnb_port_for_NGu_up = gnb_port_for_NGU;
|
||||
strcpy(GTPV1U_GNB_NG_REQ(message).addrStr,address);
|
||||
sprintf(GTPV1U_GNB_NG_REQ(message).portStr,"%d", gnb_port_for_NGU);
|
||||
}
|
||||
strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address);
|
||||
sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU);
|
||||
itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
|
||||
} else
|
||||
LOG_E(GTPU,"invalid address for NGU\n");
|
||||
@@ -1241,10 +1302,12 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1;
|
||||
}
|
||||
|
||||
/* not in configuration yet ...
|
||||
if (NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr)
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].numelt;
|
||||
else
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = 0;
|
||||
*/
|
||||
|
||||
AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] <= NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
|
||||
"List of broadcast PLMN to be sent to AMF can not be longer than actual "
|
||||
@@ -1351,7 +1414,7 @@ void NRRCConfig(void) {
|
||||
|
||||
// Get num MACRLC instances
|
||||
config_getlist( &MACRLCParamList,NULL,0, NULL);
|
||||
RC.nb_macrlc_inst = MACRLCParamList.numelt;
|
||||
RC.nb_nr_macrlc_inst = MACRLCParamList.numelt;
|
||||
// Get num L1 instances
|
||||
config_getlist( &L1ParamList,NULL,0, NULL);
|
||||
RC.nb_nr_L1_inst = L1ParamList.numelt;
|
||||
@@ -1570,3 +1633,461 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
|
||||
int k;
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
|
||||
AssertFatal (i < num_gnbs,
|
||||
"Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
if (num_gnbs > 0) {
|
||||
// Output a list of all eNBs.
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL,
|
||||
"gNB id %u is not defined in configuration file\n",i);
|
||||
F1AP_SETUP_REQ (msg_p).num_cells_available = 0;
|
||||
|
||||
for (k=0; k <num_gnbs ; k++) {
|
||||
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[k], *(GNBParamList.paramarray[i][GNB_GNB_NAME_IDX].strptr)) == 0) {
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
|
||||
paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC;
|
||||
paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0};
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
|
||||
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
|
||||
paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
|
||||
F1AP_SETUP_REQ (msg_p).num_cells_available++;
|
||||
F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr);
|
||||
LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id);
|
||||
F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr));
|
||||
LOG_I(GNB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name);
|
||||
F1AP_SETUP_REQ (msg_p).tac[k] = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]);
|
||||
F1AP_SETUP_REQ (msg_p).mcc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
|
||||
LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]);
|
||||
F1AP_SETUP_REQ (msg_p).mnc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
|
||||
LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]);
|
||||
F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr;
|
||||
LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]);
|
||||
AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) ||
|
||||
(F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3),
|
||||
"BAD MNC DIGIT LENGTH %d",
|
||||
F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]);
|
||||
F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
|
||||
LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]);
|
||||
LOG_I(GNB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.remote_addr);
|
||||
LOG_I(GNB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr));
|
||||
F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0;
|
||||
F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4 = 1;
|
||||
//strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, "");
|
||||
strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.remote_addr);
|
||||
LOG_I(GNB_APP,"F1AP: DU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.my_addr);
|
||||
LOG_I(GNB_APP,"FIAP: DU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.my_addr));
|
||||
F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0;
|
||||
F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1;
|
||||
//strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, "");
|
||||
strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr);
|
||||
//strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr));
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[k];
|
||||
// wait until RRC cell information is configured
|
||||
int cell_info_configured = 0;
|
||||
|
||||
do {
|
||||
LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n");
|
||||
usleep(100000);
|
||||
pthread_mutex_lock(&rrc->cell_info_mutex);
|
||||
cell_info_configured = rrc->cell_info_configured;
|
||||
pthread_mutex_unlock(&rrc->cell_info_mutex);
|
||||
} while (cell_info_configured == 0);
|
||||
|
||||
rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).mcc[k];
|
||||
rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).mnc[k];
|
||||
rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).tac[k];
|
||||
rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).nr_cellid[k];
|
||||
F1AP_SETUP_REQ (msg_p).nr_pci[k] = *rrc->configuration.scc->physCellId;
|
||||
F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0;
|
||||
|
||||
if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) {
|
||||
LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k);
|
||||
F1AP_SETUP_REQ (msg_p).fdd_flag = 0;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.sul_active = 0;
|
||||
} else {
|
||||
/***************** for test *****************/
|
||||
LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k);
|
||||
F1AP_SETUP_REQ (msg_p).fdd_flag = 1;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = 26200UL;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = 26200UL;
|
||||
// For LTE use scs field to carry prefix type and number of antennas
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = 0;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = 0;
|
||||
// use nrb field to hold LTE N_RB_DL (0...5)
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3;
|
||||
// RK: we need to check there value for FDD's frequency_bands DL/UL
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_frequency_bands = 1;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_band[0] = 7;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_frequency_bands = 1;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_band[0] = 7;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_sul_band[0] = 7;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_sul_band[0] = 7;
|
||||
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0;
|
||||
/***************** for test *****************/
|
||||
}
|
||||
|
||||
F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = "0";
|
||||
F1AP_SETUP_REQ (msg_p).ranac[k] = 0;
|
||||
F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier.MIB;
|
||||
F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier.SIB1;
|
||||
F1AP_SETUP_REQ (msg_p).mib_length[k] = rrc->carrier.sizeof_MIB;
|
||||
F1AP_SETUP_REQ (msg_p).sib1_length[k] = rrc->carrier.sizeof_SIB1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int du_check_plmn_identity(rrc_gNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) {
|
||||
NR_SIB1_t *sib1 = carrier->siblock1->message.choice.c1->choice.systemInformationBlockType1;
|
||||
AssertFatal(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_IdentityList.list.count > 0,
|
||||
"plmn info isn't there\n");
|
||||
AssertFatal(mnc_digit_length == 2 || mnc_digit_length == 3,
|
||||
"impossible mnc_digit_length %d\n", mnc_digit_length);
|
||||
NR_PLMN_Identity_t *plmn_Identity = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]
|
||||
->plmn_IdentityList.list.array[0];
|
||||
|
||||
// check if mcc is different and return failure if so
|
||||
if (mcc !=
|
||||
((*plmn_Identity->mcc->list.array[0])*100)+
|
||||
((*plmn_Identity->mcc->list.array[1])*10) +
|
||||
(*plmn_Identity->mcc->list.array[2])) {
|
||||
LOG_E(GNB_APP, "mcc in F1AP_SETUP_RESP message is different from mcc in DU \n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
// check that mnc digit length is different and return failure if so
|
||||
if (mnc_digit_length != plmn_Identity->mnc.list.count) {
|
||||
LOG_E(GNB_APP, "mnc(length: %d) in F1AP_SETUP_RESP message is different from mnc(length: %d) in DU \n",
|
||||
mnc_digit_length, plmn_Identity->mnc.list.count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check that 2 digit mnc is different and return failure if so
|
||||
if (mnc_digit_length == 2 &&
|
||||
(mnc !=
|
||||
(*plmn_Identity->mnc.list.array[0]*10) +
|
||||
(*plmn_Identity->mnc.list.array[1]))) {
|
||||
LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld) in DU \n",
|
||||
mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1]);
|
||||
return(0);
|
||||
}
|
||||
else if (mnc_digit_length == 3 &&
|
||||
(mnc !=
|
||||
(*plmn_Identity->mnc.list.array[0]*100) +
|
||||
(*plmn_Identity->mnc.list.array[1]*10) +
|
||||
(*plmn_Identity->mnc.list.array[2]))) {
|
||||
LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld%ld) in DU \n",
|
||||
mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1], *plmn_Identity->mnc.list.array[2]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// if we're here, the mcc/mnc match so return success
|
||||
return(1);
|
||||
}
|
||||
|
||||
void du_extract_and_decode_SI(int inst, int si_ind, uint8_t *si_container, int si_container_length) {
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[inst];
|
||||
rrc_gNB_carrier_data_t *carrier = &rrc->carrier;
|
||||
NR_BCCH_DL_SCH_Message_t *bcch_message ;
|
||||
AssertFatal(si_ind == 0, "Can only handle a single SI block for now\n");
|
||||
LOG_I(GNB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n", inst, si_ind, si_container, si_container_length);
|
||||
// point to first SI block
|
||||
bcch_message = &carrier->systemInformation;
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
(void **)&bcch_message,
|
||||
(const void *)si_container,
|
||||
si_container_length);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
AssertFatal(1==0, "[GNB_APP][NR_RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
|
||||
inst,
|
||||
dec_rval.consumed );
|
||||
}
|
||||
|
||||
if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) {
|
||||
switch (bcch_message->message.choice.c1->present) {
|
||||
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
|
||||
AssertFatal(1 == 0, "Should have received SIB1 from CU\n");
|
||||
break;
|
||||
|
||||
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
|
||||
{
|
||||
NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation;
|
||||
|
||||
if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation) {
|
||||
for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) {
|
||||
LOG_I(GNB_APP, "Extracting SI %d/%d\n", i, si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count);
|
||||
SystemInformation_IEs__sib_TypeAndInfo__Member *typeAndInfo;
|
||||
typeAndInfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i];
|
||||
|
||||
switch(typeAndInfo->present) {
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_NOTHING:
|
||||
AssertFatal(0, "Should have received SIB2 SIB3 from CU\n");
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
carrier->sib2 = typeAndInfo->choice.sib2;
|
||||
carrier->SIB23 = (uint8_t *)malloc(64);
|
||||
memcpy((void *)carrier->SIB23, (void *)si_container, si_container_length);
|
||||
carrier->sizeof_SIB23 = si_container_length;
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3:
|
||||
carrier->sib3 = typeAndInfo->choice.sib3;
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610:
|
||||
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB14 in CU F1AP_SETUP_RESP message\n", inst);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0,"Shouldn't have received this SI %d\n", typeAndInfo->present);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
|
||||
AssertFatal(0, "Should have received SIB1 from CU\n");
|
||||
break;
|
||||
}
|
||||
} else AssertFatal(1 == 0, "No SI messages\n");
|
||||
}
|
||||
|
||||
void configure_gnb_du_mac(int inst) {
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[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.scc,
|
||||
0,
|
||||
0, // rnti
|
||||
(NR_CellGroupConfig_t *)NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) {
|
||||
int i, j, si_ind;
|
||||
int ret=0;
|
||||
LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n",
|
||||
resp->num_cells_to_activate, RC.nb_nr_inst);
|
||||
|
||||
for (j = 0; j < resp->num_cells_to_activate; j++) {
|
||||
for (i = 0; i < RC.nb_nr_inst; i++) {
|
||||
rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier;
|
||||
// identify local index of cell j by nr_cellid, plmn identity and physical cell ID
|
||||
LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n",
|
||||
j, i, RC.nrrrc[i]->nr_cellid, resp->cells_to_activate[j].nr_cellid);
|
||||
|
||||
if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid &&
|
||||
(du_check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 &&
|
||||
resp->cells_to_activate[j].nrpci == carrier->physCellId)) {
|
||||
// copy system information and decode it
|
||||
for (si_ind=0; si_ind<resp->cells_to_activate[j].num_SI; si_ind++) {
|
||||
|
||||
du_extract_and_decode_SI(i,
|
||||
si_ind,
|
||||
resp->cells_to_activate[j].SI_container[2+si_ind],
|
||||
resp->cells_to_activate[j].SI_container_length[2+si_ind]);
|
||||
}
|
||||
|
||||
// perform MAC/L1 common configuration
|
||||
configure_gnb_du_mac(i);
|
||||
ret++;
|
||||
} else {
|
||||
LOG_E(GNB_APP, "F1 Setup Response not matching\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update) {
|
||||
int i, j, si_ind, ret=0;
|
||||
LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n",
|
||||
gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst);
|
||||
|
||||
for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) {
|
||||
for (i = 0; i < RC.nb_nr_inst; i++) {
|
||||
rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier;
|
||||
// identify local index of cell j by nr_cellid, plmn identity and physical cell ID
|
||||
LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, gnb_cu_cfg_updatenr_cellid %lx\n",
|
||||
j, i, RC.nrrrc[i]->nr_cellid, gnb_cu_cfg_update->cells_to_activate[j].nr_cellid);
|
||||
|
||||
if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid &&
|
||||
(du_check_plmn_identity(carrier, gnb_cu_cfg_update->cells_to_activate[j].mcc, gnb_cu_cfg_update->cells_to_activate[j].mnc, gnb_cu_cfg_update->cells_to_activate[j].mnc_digit_length)>0 &&
|
||||
gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) {
|
||||
// copy system information and decode it
|
||||
for (si_ind=0; si_ind<gnb_cu_cfg_update->cells_to_activate[j].num_SI; si_ind++) {
|
||||
|
||||
du_extract_and_decode_SI(i,
|
||||
si_ind,
|
||||
gnb_cu_cfg_update->cells_to_activate[j].SI_container[2+si_ind],
|
||||
gnb_cu_cfg_update->cells_to_activate[j].SI_container_length[2+si_ind]);
|
||||
}
|
||||
|
||||
// perform MAC/L1 common configuration
|
||||
configure_gnb_du_mac(i);
|
||||
ret++;
|
||||
} else {
|
||||
LOG_E(GNB_APP, "GNB_CU_CONFIGURATION_UPDATE not matching\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
MessageDef *msg_ack_p = NULL;
|
||||
if (ret > 0) {
|
||||
// generate gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE
|
||||
msg_ack_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE);
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).num_cells_failed_to_be_activated = 0;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).have_criticality = 0;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_to_setup =0;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_failed = 0;
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofDedicatedSIDeliveryNeededUEs = 0;
|
||||
itti_send_msg_to_task (TASK_DU_F1, INSTANCE_DEFAULT, msg_ack_p);
|
||||
|
||||
}
|
||||
else {
|
||||
// generate gNB_CU_CONFIGURATION_UPDATE_FAILURE
|
||||
msg_ack_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE);
|
||||
F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(msg_ack_p).cause = F1AP_CauseRadioNetwork_cell_not_available;
|
||||
|
||||
itti_send_msg_to_task (TASK_DU_F1, INSTANCE_DEFAULT, msg_ack_p);
|
||||
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void set_node_type(void) {
|
||||
int j;
|
||||
paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
|
||||
paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
|
||||
paramdef_t GNBParams[] = GNBPARAMS_DESC;
|
||||
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
|
||||
|
||||
config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if ( MacRLC_ParamList.numelt > 0) {
|
||||
RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt;
|
||||
for (j=0;j<RC.nb_nr_macrlc_inst;j++) {
|
||||
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
|
||||
macrlc_has_f1 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(*(GNBParamList.paramarray[0][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) {
|
||||
node_type = ngran_gNB_CU;
|
||||
} else {
|
||||
if (macrlc_has_f1 == 0) {
|
||||
node_type = ngran_gNB;
|
||||
LOG_I(NR_RRC,"Setting node_type to ngran_gNB\n");
|
||||
} else {
|
||||
node_type = ngran_gNB_DU;
|
||||
LOG_I(NR_RRC,"Setting node_type to ngran_gNB_DU\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nr_read_config_and_init(void) {
|
||||
MessageDef *msg_p = NULL;
|
||||
uint32_t gnb_id;
|
||||
uint32_t gnb_nb = RC.nb_nr_inst;
|
||||
|
||||
RCconfig_NR_L1();
|
||||
set_node_type();
|
||||
RCconfig_nr_macrlc();
|
||||
|
||||
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
|
||||
|
||||
if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n");
|
||||
|
||||
AssertFatal (gnb_nb <= RC.nb_nr_inst,
|
||||
"Number of gNB is greater than gNB defined in configuration file (%d/%d)!",
|
||||
gnb_nb, RC.nb_nr_inst);
|
||||
|
||||
LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst);
|
||||
|
||||
RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *));
|
||||
LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc);
|
||||
|
||||
for (gnb_id = 0; gnb_id < RC.nb_nr_inst ; gnb_id++) {
|
||||
RC.nrrrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST));
|
||||
LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, RC.nb_nr_inst);
|
||||
memset((void *)RC.nrrrc[gnb_id],0,sizeof(gNB_RRC_INST));
|
||||
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ);
|
||||
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
|
||||
}
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
pdcp_layer_init();
|
||||
// nr_DRB_preconfiguration(0x1234);
|
||||
rrc_init_nr_global_param();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "s1ap_messages_types.h"
|
||||
#include "ngap_messages_types.h"
|
||||
#include "f1ap_messages_types.h"
|
||||
|
||||
#ifdef CMAKER
|
||||
#include "rrc_messages_types.h"
|
||||
@@ -105,6 +106,10 @@ extern void NRRCConfig(void);
|
||||
void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc);
|
||||
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
|
||||
int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
|
||||
int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i);
|
||||
int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp);
|
||||
int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update);
|
||||
void nr_read_config_and_init(void);
|
||||
|
||||
#endif /* GNB_CONFIG_H_ */
|
||||
/** @} */
|
||||
|
||||
@@ -116,8 +116,7 @@ typedef enum {
|
||||
#define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset"
|
||||
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts"
|
||||
#define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts"
|
||||
#define GNB_CONFIG_STRING_PUSCHTARGETPOWX10 "pusch_TargetSNRx10"
|
||||
#define GNB_CONFIG_STRING_PUCCHTARGETPOWX10 "pucch_TargetSNRx10"
|
||||
#define GNB_CONFIG_STRING_NRCELLID "nr_cellid"
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* cell configuration parameters */
|
||||
@@ -141,8 +140,7 @@ typedef enum {
|
||||
{GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PUSCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_PUCCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_NRCELLID , NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \
|
||||
}
|
||||
|
||||
#define GNB_GNB_ID_IDX 0
|
||||
@@ -162,8 +160,7 @@ typedef enum {
|
||||
#define GNB_SSB_SUBCARRIEROFFSET_IDX 14
|
||||
#define GNB_PDSCH_ANTENNAPORTS_IDX 15
|
||||
#define GNB_PUSCH_ANTENNAPORTS_IDX 16
|
||||
#define GNB_PUSCH_TARGETPOW_X10_IDX 17
|
||||
#define GNB_PUCCH_TARGETPOW_X10_IDX 18
|
||||
#define GNB_NRCELLID_IDX 17
|
||||
|
||||
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
|
||||
#define GNBPARAMS_CHECK { \
|
||||
|
||||
@@ -303,7 +303,22 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
|
||||
first_rb = ra->msg3_first_rb;
|
||||
|
||||
if (sduP == NULL) { // we've got an error on Msg3
|
||||
bool no_sig = true;
|
||||
if (sduP) {
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
if(sduP[k]!=0) {
|
||||
no_sig = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (no_sig || sduP == NULL) { // we've got an error on Msg3
|
||||
|
||||
if(no_sig) {
|
||||
LOG_D(MAC,"No signal in Msg3\n");
|
||||
}
|
||||
|
||||
LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
@@ -312,6 +327,20 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
|
||||
|
||||
if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
|
||||
|
||||
// Release RNTI of LTE PHY when RA does not succeed
|
||||
UE_free_list_t *free_list = NULL;
|
||||
pthread_mutex_lock(&lock_ue_freelist);
|
||||
free_list = &mac->UE_free_list;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = current_rnti;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = 1;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 1;
|
||||
free_list->num_UEs++;
|
||||
mac->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[mac->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = current_rnti;
|
||||
mac->UE_release_req.ue_release_request_body.number_of_TLVs++;
|
||||
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
|
||||
pthread_mutex_unlock(&lock_ue_freelist);
|
||||
|
||||
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
|
||||
nfapi_hi_dci0_request_t *hi_dci0_req = NULL;
|
||||
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP);
|
||||
@@ -690,6 +719,19 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
break;
|
||||
}
|
||||
|
||||
bool no_sig = true;
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
if(sduP[k]!=0) {
|
||||
no_sig = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(no_sig) {
|
||||
LOG_D(MAC, "No signal\n");
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
|
||||
@@ -1192,6 +1192,8 @@ typedef struct {
|
||||
rnti_t rnti;
|
||||
///remove UE context flag
|
||||
boolean_t removeContextFlg;
|
||||
///remove RA flag
|
||||
boolean_t raFlag;
|
||||
} UE_free_ctrl_t;
|
||||
/*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/
|
||||
typedef struct {
|
||||
|
||||
@@ -51,6 +51,8 @@ uint32_t nr_compute_tbs(uint16_t Qm,
|
||||
uint32_t Ninfo, Np_info, C;
|
||||
uint8_t n, scale;
|
||||
|
||||
LOG_D(MAC,"nb_symb_sch %d, nb_dmrs_prb %d, nb_rb_oh %d\n",nb_symb_sch,nb_dmrs_prb,nb_rb_oh);
|
||||
|
||||
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;
|
||||
|
||||
@@ -1179,12 +1179,12 @@ int get_format0(uint8_t index,
|
||||
return format;
|
||||
}
|
||||
|
||||
int64_t *get_prach_config_info(uint32_t pointa,
|
||||
int64_t *get_prach_config_info(frequency_range_t freq_range,
|
||||
uint8_t index,
|
||||
uint8_t unpaired) {
|
||||
int64_t *prach_config_info_p;
|
||||
|
||||
if (pointa > 2016666) { //FR2
|
||||
if (freq_range == FR2) { //FR2
|
||||
prach_config_info_p = table_6_3_3_2_4_prachConfig_Index[index];
|
||||
}
|
||||
else { // FR1
|
||||
@@ -2524,7 +2524,7 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) {
|
||||
|
||||
// Set the transform precoding status according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16:
|
||||
// - "UE procedure for applying transform precoding on PUSCH"
|
||||
uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc,
|
||||
uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
|
||||
const NR_PUSCH_Config_t *pusch_config,
|
||||
const NR_BWP_Uplink_t *ubwp,
|
||||
uint8_t *dci_format,
|
||||
@@ -2539,7 +2539,7 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc,
|
||||
}
|
||||
}
|
||||
|
||||
if (rnti_type != NR_RNTI_RA) {
|
||||
if (rnti_type != NR_RNTI_RA && rnti_type != NR_RNTI_TC) {
|
||||
if (*dci_format != NR_UL_DCI_FORMAT_0_0) {
|
||||
if (pusch_config->transformPrecoder != NULL) {
|
||||
return *pusch_config->transformPrecoder;
|
||||
@@ -2547,7 +2547,7 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc,
|
||||
}
|
||||
}
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) {
|
||||
if (initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) {
|
||||
return 1; // Transformprecoding disabled
|
||||
} else {
|
||||
LOG_D(PHY, "MAC_COMMON: Transform Precodig enabled through msg3_transformPrecoder\n");
|
||||
@@ -2558,8 +2558,8 @@ uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc,
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
uint16_t nr_dci_size(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
|
||||
const NR_CellGroupConfig_t *cg,
|
||||
dci_pdu_rel15_t *dci_pdu,
|
||||
nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
@@ -2578,8 +2578,9 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
NR_PUSCH_Config_t *pusch_Config = NULL;
|
||||
NR_SRS_Config_t *srs_config = NULL;
|
||||
if(bwp_id > 0) {
|
||||
bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
AssertFatal(cg!=NULL,"Cellgroup is null and bwp_id!=0");
|
||||
bwp=cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
ubwp=cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||
pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup;
|
||||
@@ -2591,7 +2592,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
/// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20
|
||||
size += 20;
|
||||
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated
|
||||
size += nr_dci_size(scc,secondaryCellGroup,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size
|
||||
size += nr_dci_size(initialUplinkBWP,cg,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size
|
||||
// UL/SUL indicator assumed to be 0
|
||||
break;
|
||||
|
||||
@@ -2599,24 +2600,24 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
/// fixed: Format identifier 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2, ULSCH indicator 1 --16
|
||||
size += 16;
|
||||
// Carrier indicator
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) {
|
||||
if (cg->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) {
|
||||
dci_pdu->carrier_indicator.nbits=3;
|
||||
size += dci_pdu->carrier_indicator.nbits;
|
||||
}
|
||||
// UL/SUL indicator
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) {
|
||||
if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink != NULL) {
|
||||
dci_pdu->carrier_indicator.nbits=1;
|
||||
size += dci_pdu->ul_sul_indicator.nbits;
|
||||
}
|
||||
// BWP Indicator
|
||||
uint8_t n_ul_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
|
||||
uint8_t n_ul_bwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
|
||||
if (n_ul_bwp < 2)
|
||||
dci_pdu->bwp_indicator.nbits = n_ul_bwp;
|
||||
else
|
||||
dci_pdu->bwp_indicator.nbits = 2;
|
||||
size += dci_pdu->bwp_indicator.nbits;
|
||||
// Freq domain assignment
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup->rbg_Size != NULL)
|
||||
if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup->rbg_Size != NULL)
|
||||
rbg_size_config = 1;
|
||||
else
|
||||
rbg_size_config = 0;
|
||||
@@ -2647,13 +2648,13 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
size += 1;
|
||||
}
|
||||
// 1st DAI
|
||||
if (secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook==NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic)
|
||||
if (cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook==NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic)
|
||||
dci_pdu->dai[0].nbits = 2;
|
||||
else
|
||||
dci_pdu->dai[0].nbits = 1;
|
||||
size += dci_pdu->dai[0].nbits;
|
||||
// 2nd DAI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { //TODO not sure about that
|
||||
if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { //TODO not sure about that
|
||||
dci_pdu->dai[1].nbits = 2;
|
||||
size += dci_pdu->dai[1].nbits;
|
||||
}
|
||||
@@ -2673,9 +2674,9 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
else {
|
||||
int lmin,Lmax = 0;
|
||||
int lsum = 0;
|
||||
if ( secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig != NULL) {
|
||||
if ( secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers != NULL)
|
||||
Lmax = *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers;
|
||||
if ( cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig != NULL) {
|
||||
if ( cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers != NULL)
|
||||
Lmax = *cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers;
|
||||
else
|
||||
AssertFatal(1==0,"MIMO on PUSCH not supported, maxMIMO_Layers needs to be set to 1\n");
|
||||
}
|
||||
@@ -2695,7 +2696,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
}
|
||||
}
|
||||
// Precoding info and number of layers
|
||||
long transformPrecoder = get_transformPrecoding(scc, pusch_Config, ubwp, (uint8_t*)&format, rnti_type, 0);
|
||||
long transformPrecoder = get_transformPrecoding(initialUplinkBWP, pusch_Config, ubwp, (uint8_t*)&format, rnti_type, 0);
|
||||
|
||||
if (pusch_Config->txConfig != NULL){
|
||||
if (*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_codebook){
|
||||
@@ -2739,21 +2740,21 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
dci_pdu->antenna_ports.nbits = xb;
|
||||
size += dci_pdu->antenna_ports.nbits;
|
||||
// SRS request
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL)
|
||||
if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL)
|
||||
dci_pdu->srs_request.nbits = 2;
|
||||
else
|
||||
dci_pdu->srs_request.nbits = 3;
|
||||
size += dci_pdu->srs_request.nbits;
|
||||
// CSI request
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig != NULL) {
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize != NULL) {
|
||||
dci_pdu->csi_request.nbits = *secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize;
|
||||
if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig != NULL) {
|
||||
if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize != NULL) {
|
||||
dci_pdu->csi_request.nbits = *cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize;
|
||||
size += dci_pdu->csi_request.nbits;
|
||||
}
|
||||
}
|
||||
// CBGTI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
int num = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
|
||||
if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
int num = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
|
||||
dci_pdu->cbgti.nbits = 2 + (num<<1);
|
||||
size += dci_pdu->cbgti.nbits;
|
||||
}
|
||||
@@ -2786,7 +2787,6 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
dci_pdu->time_domain_assignment.nbits = 4;
|
||||
dci_pdu->vrb_to_prb_mapping.nbits = 1;
|
||||
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
@@ -2794,19 +2794,19 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
// Format identifier
|
||||
size = 1;
|
||||
// Carrier indicator
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) {
|
||||
if (cg->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) {
|
||||
dci_pdu->carrier_indicator.nbits=3;
|
||||
size += dci_pdu->carrier_indicator.nbits;
|
||||
}
|
||||
// BWP Indicator
|
||||
uint8_t n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
uint8_t n_dl_bwp = cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
if (n_dl_bwp < 2)
|
||||
dci_pdu->bwp_indicator.nbits = n_dl_bwp;
|
||||
else
|
||||
dci_pdu->bwp_indicator.nbits = 2;
|
||||
size += dci_pdu->bwp_indicator.nbits;
|
||||
// Freq domain assignment
|
||||
rbg_size_config = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size;
|
||||
rbg_size_config = cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size;
|
||||
numRBG = getNRBG(NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
rbg_size_config);
|
||||
@@ -2862,7 +2862,7 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
// HARQ PID
|
||||
size += 4;
|
||||
// DAI
|
||||
if (secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell
|
||||
if (cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell
|
||||
dci_pdu->dai[0].nbits = 2;
|
||||
size += dci_pdu->dai[0].nbits;
|
||||
}
|
||||
@@ -2886,20 +2886,20 @@ uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
size += dci_pdu->transmission_configuration_indication.nbits;
|
||||
}
|
||||
// SRS request
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL)
|
||||
if (cg->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL)
|
||||
dci_pdu->srs_request.nbits = 2;
|
||||
else
|
||||
dci_pdu->srs_request.nbits = 3;
|
||||
size += dci_pdu->srs_request.nbits;
|
||||
// CBGTI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
uint8_t maxCBGperTB = (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2;
|
||||
if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
uint8_t maxCBGperTB = (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2;
|
||||
long *maxCWperDCI_rrc = pdsch_config->maxNrofCodeWordsScheduledByDCI;
|
||||
uint8_t maxCW = (maxCWperDCI_rrc == NULL) ? 1 : *maxCWperDCI_rrc;
|
||||
dci_pdu->cbgti.nbits = maxCBGperTB * maxCW;
|
||||
size += dci_pdu->cbgti.nbits;
|
||||
// CBGFI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) {
|
||||
if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) {
|
||||
dci_pdu->cbgfi.nbits = 1;
|
||||
size += dci_pdu->cbgfi.nbits;
|
||||
}
|
||||
@@ -2950,64 +2950,64 @@ int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig, long transformPrec
|
||||
|
||||
int tdd_period_to_num[8] = {500,625,1000,1250,2000,2500,5000,10000};
|
||||
|
||||
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) {
|
||||
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slot) {
|
||||
|
||||
int period,period1,period2=0;
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon==NULL) return(1);
|
||||
if (tdd_UL_DL_ConfigurationCommon==NULL) return(1);
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
period1 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
period2 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
}
|
||||
period = period1+period2;
|
||||
int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int scs=tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int slots=period*(1<<scs)/1000;
|
||||
int slots1=period1*(1<<scs)/1000;
|
||||
int slot_in_period = slot % slots;
|
||||
if (slot_in_period < slots1) return(slot_in_period <= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
if (slot_in_period < slots1) return(slot_in_period <= tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period <= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
}
|
||||
|
||||
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type_t frame_type) {
|
||||
int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, lte_frame_type_t frame_type) {
|
||||
|
||||
int period,period1,period2=0;
|
||||
|
||||
// Note: condition on frame_type
|
||||
// goal: the UL scheduler assumes mode is TDD therefore this hack is needed to make FDD work
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon == NULL || frame_type == FDD) {
|
||||
if (tdd_UL_DL_ConfigurationCommon == NULL || frame_type == FDD) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
period1 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
period2 = tdd_period_to_num[tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
}
|
||||
period = period1+period2;
|
||||
int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int scs=tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int slots=period*(1<<scs)/1000;
|
||||
int slots1=period1*(1<<scs)/1000;
|
||||
int slot_in_period = slot % slots;
|
||||
if (slot_in_period < slots1) return(slot_in_period >= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
if (slot_in_period < slots1) return(slot_in_period >= tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
}
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI) {
|
||||
|
||||
@@ -49,16 +49,16 @@ uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, ui
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI);
|
||||
|
||||
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
|
||||
|
||||
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slotP, lte_frame_type_t frame_type);
|
||||
int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, lte_frame_type_t frame_type);
|
||||
|
||||
uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
uint16_t nr_dci_size(const NR_BWP_UplinkCommon_t *initialULBWP,
|
||||
const NR_CellGroupConfig_t *cg,
|
||||
dci_pdu_rel15_t *dci_pdu,
|
||||
nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB,
|
||||
int bwp_id);
|
||||
|
||||
void find_aggregation_candidates(uint8_t *aggregation_level,
|
||||
@@ -113,7 +113,7 @@ int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig,long transformPreco
|
||||
|
||||
int get_format0(uint8_t index, uint8_t unpaired,frequency_range_t);
|
||||
|
||||
int64_t *get_prach_config_info(uint32_t pointa,
|
||||
int64_t *get_prach_config_info(frequency_range_t freq_range,
|
||||
uint8_t index,
|
||||
uint8_t unpaired);
|
||||
|
||||
@@ -162,7 +162,7 @@ uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi
|
||||
@param rnti_type rnti type
|
||||
@param configuredGrant indicates whether a configured grant was received or not
|
||||
@returns transformPrecoding value */
|
||||
uint8_t get_transformPrecoding(const NR_ServingCellConfigCommon_t *scc,
|
||||
uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
|
||||
const NR_PUSCH_Config_t *pusch_config,
|
||||
const NR_BWP_Uplink_t *ubwp,
|
||||
uint8_t *dci_format,
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include <executables/softmodem-common.h>
|
||||
|
||||
extern uint32_t N_RB_DL;
|
||||
|
||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
|
||||
int mu,
|
||||
@@ -149,6 +151,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
|
||||
int i;
|
||||
|
||||
mac->phy_config.Mod_id = module_id;
|
||||
@@ -157,77 +160,80 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
// carrier config
|
||||
LOG_D(MAC, "Entering UE Config Common\n");
|
||||
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
AssertFatal(scc==NULL || scc_SIB==NULL,"Both scc and scc_SIB cannot be null\n");
|
||||
|
||||
cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
if (scc) {
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
|
||||
cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i] = 0;
|
||||
cfg->carrier_config.dl_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i] = 0;
|
||||
cfg->carrier_config.dl_k0[i] = 0;
|
||||
|
||||
cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
else
|
||||
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
|
||||
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
UL_pointA)/1000; // freq in kHz
|
||||
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i] = 0;
|
||||
cfg->carrier_config.ul_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
mac->frequency_range = band<100?FR1:FR2;
|
||||
|
||||
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
|
||||
|
||||
cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
// cell config
|
||||
|
||||
cfg->cell_config.phy_cell_id = *scc->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = frame_type;
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
|
||||
|
||||
// SSB Table config
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
||||
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);
|
||||
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 = 0; // TODO currently not in RRC?
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
else
|
||||
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
|
||||
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
UL_pointA)/1000; // freq in kHz
|
||||
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i] = 0;
|
||||
cfg->carrier_config.ul_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
frequency_range_t frequency_range = band<100?FR1:FR2;
|
||||
|
||||
mac->frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
|
||||
|
||||
// cell config
|
||||
|
||||
cfg->cell_config.phy_cell_id = *scc->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = mac->frame_type;
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
|
||||
|
||||
// SSB Table config
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
||||
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);
|
||||
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 = 0; // TODO currently not in RRC?
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
@@ -246,48 +252,48 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present);
|
||||
}
|
||||
|
||||
// TDD Table Configuration
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period);
|
||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0)
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
else
|
||||
LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
// PRACH configuration
|
||||
|
||||
uint8_t nb_preambles = 64;
|
||||
if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL)
|
||||
nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles;
|
||||
|
||||
cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1;
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
|
||||
cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig;
|
||||
|
||||
switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) {
|
||||
}
|
||||
|
||||
// TDD Table Configuration
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period);
|
||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0)
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
else
|
||||
LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
// PRACH configuration
|
||||
|
||||
uint8_t nb_preambles = 64;
|
||||
if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL)
|
||||
nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles;
|
||||
|
||||
cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1;
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
|
||||
cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig;
|
||||
|
||||
switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) {
|
||||
case 0 :
|
||||
cfg->prach_config.num_prach_fd_occasions = 1;
|
||||
break;
|
||||
@@ -302,36 +308,187 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM);
|
||||
}
|
||||
|
||||
cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t));
|
||||
for (i=0; i<cfg->prach_config.num_prach_fd_occasions; i++) {
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i;
|
||||
if (cfg->prach_config.prach_sequence_length)
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||
else
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup,
|
||||
nb_preambles, frame_type,mac->frequency_range);
|
||||
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
|
||||
}
|
||||
|
||||
cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
|
||||
|
||||
} // scc
|
||||
|
||||
else { // scc_SIB
|
||||
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR);
|
||||
|
||||
cfg->carrier_config.dl_frequency = downlink_frequency[0][0] - (10+scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA)*(15<<scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing);
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i] = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i] = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i] = 0;
|
||||
cfg->carrier_config.dl_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList==NULL ? *scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR : *scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList->list.array[0]->freqBandIndicatorNR);
|
||||
|
||||
|
||||
if (scc_SIB->uplinkConfigCommon->frequencyInfoUL.absoluteFrequencyPointA == NULL)
|
||||
cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency;
|
||||
else
|
||||
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc_SIB->uplinkConfigCommon->frequencyInfoUL.frequencyBandList->list.array[0]->freqBandIndicatorNR,
|
||||
scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
*scc_SIB->uplinkConfigCommon->frequencyInfoUL.absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i] = scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i] = scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i] = 0;
|
||||
cfg->carrier_config.ul_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t band = *scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR;
|
||||
frequency_range_t frequency_range = band<100?FR1:FR2;
|
||||
|
||||
lte_frame_type_t frame_type = get_frame_type(band, get_softmodem_params()->numerology);
|
||||
|
||||
// cell config
|
||||
|
||||
cfg->cell_config.phy_cell_id = mac->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = frame_type;
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc_SIB->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = get_softmodem_params()->numerology;
|
||||
|
||||
// SSB Table config
|
||||
|
||||
cfg->ssb_table.ssb_offset_point_a = scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA;
|
||||
cfg->ssb_table.ssb_period = scc_SIB->ssb_PeriodicityServingCell;
|
||||
cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
|
||||
|
||||
AssertFatal(scc_SIB->ssb_PositionsInBurst.groupPresence==NULL, "Cannot handle more than 8 SSBs for now (%x.%x.%x.%x.%x.%x.%x.%x)\n",
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[0],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[1],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[2],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[3],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[4],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[5],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[6],
|
||||
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[7]);
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc_SIB->ssb_PositionsInBurst.inOneGroup.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
|
||||
|
||||
// TDD Table Configuration
|
||||
if (scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period = scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period = *scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period);
|
||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||
scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0)
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
else
|
||||
LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
// PRACH configuration
|
||||
|
||||
uint8_t nb_preambles = 64;
|
||||
if(scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL)
|
||||
nb_preambles = *scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles;
|
||||
|
||||
cfg->prach_config.prach_sequence_length = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1;
|
||||
|
||||
if (scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
|
||||
cfg->prach_config.prach_sub_c_spacing = *scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
cfg->prach_config.prach_sub_c_spacing = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
cfg->prach_config.restricted_set_config = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->restrictedSetConfig;
|
||||
|
||||
switch (scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) {
|
||||
case 0 :
|
||||
cfg->prach_config.num_prach_fd_occasions = 1;
|
||||
break;
|
||||
case 1 :
|
||||
cfg->prach_config.num_prach_fd_occasions = 2;
|
||||
break;
|
||||
case 2 :
|
||||
cfg->prach_config.num_prach_fd_occasions = 4;
|
||||
break;
|
||||
case 3 :
|
||||
cfg->prach_config.num_prach_fd_occasions = 8;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM);
|
||||
}
|
||||
|
||||
cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t));
|
||||
for (i=0; i<cfg->prach_config.num_prach_fd_occasions; i++) {
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i;
|
||||
if (cfg->prach_config.prach_sequence_length)
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||
else
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||
if (get_softmodem_params()->sa) {
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||
} else {
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||
}
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
|
||||
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
|
||||
}
|
||||
|
||||
cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
|
||||
cfg->prach_config.ssb_per_rach = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** \brief This function performs some configuration routines according to clause 12 "Bandwidth part operation" 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
@param NR_UE_MAC_INST_t mac: pointer to local MAC instance
|
||||
@returns void
|
||||
*/
|
||||
|
||||
void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format){
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated;
|
||||
|
||||
if (bwp_ind && dci_format){
|
||||
|
||||
@@ -366,6 +523,70 @@ void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format
|
||||
|
||||
}
|
||||
|
||||
|
||||
void fill_default_coreset_zero(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
// Search space zero
|
||||
|
||||
if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero));
|
||||
if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId));
|
||||
if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot));
|
||||
if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||
if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates));
|
||||
if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType));
|
||||
if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common));
|
||||
if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
mac->search_space_zero->searchSpaceId = 0;
|
||||
*mac->search_space_zero->controlResourceSetId = 0;
|
||||
mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset));
|
||||
mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||
mac->search_space_zero->duration=NULL;
|
||||
// should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7);
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2;
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||
|
||||
// FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
|
||||
// Coreset0
|
||||
if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0));
|
||||
mac->coreset0->controlResourceSetId = 0;
|
||||
// frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B,
|
||||
if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||
mac->coreset0->frequencyDomainResources.buf[0] = 0xff;
|
||||
mac->coreset0->frequencyDomainResources.buf[1] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[2] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[3] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[4] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[5] = 0;
|
||||
mac->coreset0->frequencyDomainResources.size = 6;
|
||||
mac->coreset0->frequencyDomainResources.bits_unused = 3;
|
||||
mac->coreset0->duration = 1;
|
||||
mac->coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved));
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL;
|
||||
mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||
if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList));
|
||||
NR_TCI_StateId_t *tci[8];
|
||||
for (int i=0;i<8;i++) {
|
||||
tci[i]=calloc(1,sizeof(*tci[i]));
|
||||
*tci[i] = i;
|
||||
ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||
}
|
||||
mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||
mac->coreset0->tci_PresentInDCI = NULL;
|
||||
mac->coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||
}
|
||||
|
||||
/** \brief This function is relavant for the UE procedures for control. It loads the search spaces, the BWPs and the CORESETs into the MAC instance and
|
||||
\brief performs assert checks on the relevant RRC configuration.
|
||||
@param NR_UE_MAC_INST_t mac: pointer to local MAC instance
|
||||
@@ -375,7 +596,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
|
||||
uint8_t coreset_id = 1, ss_id;
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated;
|
||||
AssertFatal(scd->downlinkBWP_ToAddModList != NULL, "downlinkBWP_ToAddModList is null\n");
|
||||
AssertFatal(scd->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count);
|
||||
|
||||
@@ -447,65 +668,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
ss_id++;
|
||||
}
|
||||
|
||||
// TODO: Merge this code in a single function as fill_default_searchSpaceZero() in rrc_gNB_reconfig.c
|
||||
// Search space zero
|
||||
if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero));
|
||||
if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId));
|
||||
if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot));
|
||||
if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||
if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates));
|
||||
if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType));
|
||||
if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common));
|
||||
if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
mac->search_space_zero->searchSpaceId = 0;
|
||||
*mac->search_space_zero->controlResourceSetId = 0;
|
||||
mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset));
|
||||
mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||
mac->search_space_zero->duration=NULL;
|
||||
// should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7);
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2;
|
||||
mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||
|
||||
// FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
|
||||
// Coreset0
|
||||
if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0));
|
||||
mac->coreset0->controlResourceSetId = 0;
|
||||
// frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B,
|
||||
if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||
mac->coreset0->frequencyDomainResources.buf[0] = 0xff;
|
||||
mac->coreset0->frequencyDomainResources.buf[1] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[2] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[3] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[4] = 0;
|
||||
mac->coreset0->frequencyDomainResources.buf[5] = 0;
|
||||
mac->coreset0->frequencyDomainResources.size = 6;
|
||||
mac->coreset0->frequencyDomainResources.bits_unused = 3;
|
||||
mac->coreset0->duration = 1;
|
||||
mac->coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved));
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||
mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL;
|
||||
mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||
if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList));
|
||||
NR_TCI_StateId_t *tci[8];
|
||||
for (int i=0;i<8;i++) {
|
||||
tci[i]=calloc(1,sizeof(*tci[i]));
|
||||
*tci[i] = i;
|
||||
ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||
}
|
||||
mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||
mac->coreset0->tci_PresentInDCI = NULL;
|
||||
mac->coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||
fill_default_coreset_zero(mac);
|
||||
|
||||
}
|
||||
|
||||
@@ -514,10 +677,11 @@ int nr_rrc_mac_config_req_ue(
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
// NR_ServingCellConfigCommon_t *sccP,
|
||||
NR_ServingCellConfigCommonSIB_t *sccP,
|
||||
// NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
|
||||
// NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
|
||||
NR_CellGroupConfig_t *cell_group_config ){
|
||||
NR_CellGroupConfig_t *cell_group_config,
|
||||
NR_CellGroupConfig_t *scell_group_config){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
@@ -525,25 +689,71 @@ int nr_rrc_mac_config_req_ue(
|
||||
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
|
||||
|
||||
if(mibP != NULL){
|
||||
mac->mib = mibP; // update by every reception
|
||||
}
|
||||
|
||||
if(cell_group_config != NULL ){
|
||||
mac->scg = cell_group_config;
|
||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||
// if this is the first MIB intialize coreset0 for SA
|
||||
if (mac->mib == NULL) fill_default_coreset_zero(mac);
|
||||
|
||||
mac->mib = mibP; // update by every reception
|
||||
mac->phy_config.Mod_id = module_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
mac->phy_config.config_req.ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
|
||||
mac->phy_config.config_req.tdd_table.tdd_period_in_slots=5<<get_softmodem_params()->numerology;
|
||||
mac->phy_config.config_req.ssb_table.ssb_offset_point_a = (N_RB_DL-20)>>1;
|
||||
}
|
||||
AssertFatal(scell_group_config == NULL || cell_group_config == NULL,
|
||||
"both scell_group_config and cell_group_config cannot be non-NULL\n");
|
||||
|
||||
if (sccP != NULL) {
|
||||
|
||||
mac->scc_SIB=sccP;
|
||||
LOG_I(MAC,"Keeping ServingCellConfigCommonSIB\n");
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
int num_slots_ul = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||
if (mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols>0) num_slots_ul++;
|
||||
LOG_I(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul);
|
||||
mac->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
|
||||
// Setup the SSB to Rach Occasions mapping according to the config
|
||||
build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type);
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
mac->common_configuration_complete = 1;
|
||||
}
|
||||
if(scell_group_config != NULL ){
|
||||
mac->cg = scell_group_config;
|
||||
mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex;
|
||||
config_control_ue(mac);
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
|
||||
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
if (scell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||
if (scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
|
||||
ra->rach_ConfigDedicated = scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
}
|
||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||
mac->scc = scell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||
mac->physCellId = *mac->scc->physCellId;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
mac->crnti = scell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||
}
|
||||
|
||||
// Setup the SSB to Rach Occasions mapping according to the config
|
||||
build_ssb_to_ro_map(mac->scc, mac->phy_config.config_req.cell_config.frame_duplex_type);
|
||||
build_ssb_to_ro_map(mac);
|
||||
}
|
||||
else if (cell_group_config != NULL){
|
||||
LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n");
|
||||
mac->cg = cell_group_config;
|
||||
mac->servCellIndex = cell_group_config->spCellConfig->servCellIndex ? *cell_group_config->spCellConfig->servCellIndex : 0;
|
||||
if(get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) {
|
||||
config_control_ue(mac);
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
|
||||
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
}
|
||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||
}
|
||||
|
||||
// Setup the SSB to Rach Occasions mapping according to the config
|
||||
build_ssb_to_ro_map(mac);
|
||||
}
|
||||
|
||||
/*
|
||||
if(mac_cell_group_configP != NULL){
|
||||
|
||||
@@ -315,10 +315,13 @@ typedef struct {
|
||||
typedef struct {
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc;
|
||||
NR_CellGroupConfig_t *scg;
|
||||
NR_ServingCellConfigCommonSIB_t *scc_SIB;
|
||||
NR_CellGroupConfig_t *cg;
|
||||
int servCellIndex;
|
||||
NR_CSI_ReportConfig_t *csirc;
|
||||
long physCellId;
|
||||
//// MAC config
|
||||
int common_configuration_complete;
|
||||
NR_DRX_Config_t *drx_Config;
|
||||
NR_SchedulingRequestConfig_t *schedulingRequestConfig;
|
||||
NR_BSR_Config_t *bsr_Config;
|
||||
@@ -361,7 +364,8 @@ typedef struct {
|
||||
uint8_t mib_ssb;
|
||||
/// Last NDI of UL HARQ processes
|
||||
uint8_t UL_ndi[NR_MAX_HARQ_PROCESSES];
|
||||
|
||||
/// first ULTX of UL HARQ processes
|
||||
int first_ul_tx[NR_MAX_HARQ_PROCESSES];
|
||||
//// FAPI-like interface message
|
||||
fapi_nr_ul_config_request_t *ul_config_request;
|
||||
fapi_nr_dl_config_request_t dl_config_request;
|
||||
@@ -380,6 +384,7 @@ typedef struct {
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||
NR_SearchSpace_t *search_space_zero;
|
||||
NR_ControlResourceSet_t *coreset0;
|
||||
frequency_range_t frequency_range;
|
||||
|
||||
dci_pdu_rel15_t def_dci_pdu_rel15[8];
|
||||
|
||||
@@ -502,5 +507,8 @@ typedef struct ssb_list_info {
|
||||
uint8_t nb_tx_ssb;
|
||||
} 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__ */
|
||||
|
||||
@@ -53,7 +53,8 @@ int8_t nr_ue_decode_mib(
|
||||
uint8_t extra_bits,
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
void *pduP,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id );
|
||||
|
||||
/**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind
|
||||
@@ -82,8 +83,10 @@ int nr_rrc_mac_config_req_ue(
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
//NR_ServingCellConfigCommon_t *sccP,
|
||||
NR_CellGroupConfig_t *cell_group_config);
|
||||
NR_ServingCellConfigCommonSIB_t *sccP,
|
||||
NR_CellGroupConfig_t *cell_group_config,
|
||||
NR_CellGroupConfig_t *scell_group_config
|
||||
);
|
||||
|
||||
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
|
||||
@@ -166,6 +169,10 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
unsigned short post_padding,
|
||||
uint16_t buflen);
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
|
||||
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 ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot);
|
||||
|
||||
uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
@@ -301,7 +308,7 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
|
||||
uint8_t *nb_dmrs_re_per_rb,
|
||||
uint16_t *number_dmrs_symbols);
|
||||
|
||||
void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired);
|
||||
void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac);
|
||||
|
||||
void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
|
||||
|
||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||
|
||||
@@ -50,12 +51,26 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
||||
|
||||
//init mac here
|
||||
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
|
||||
if (rrc_inst) {
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
for (int j=0;j<NB_NR_UE_MAC_INST;j++)
|
||||
for (int i=0;i<NR_MAX_HARQ_PROCESSES;i++)
|
||||
nr_ue_mac_inst[j].first_ul_tx[i]=1;
|
||||
|
||||
if (rrc_inst && (rrc_inst->scell_group_config || rrc_inst->cell_group_config)) {
|
||||
|
||||
if(rrc_inst->scell_group_config) {
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config);
|
||||
//if (IS_SOFTMODEM_NOS1){
|
||||
// AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
|
||||
// nr_pdcp_layer_init();
|
||||
// nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
|
||||
//}
|
||||
} else if (rrc_inst->cell_group_config) {
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,rrc_inst->cell_group_config,NULL);
|
||||
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
|
||||
pdcp_layer_init();
|
||||
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
pdcp_layer_init();
|
||||
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate memory for ul_config_request in the mac instance. This is now a pointer and will
|
||||
@@ -68,8 +83,14 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
||||
LOG_D(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul);
|
||||
nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_I(MAC,"Running without CellGroupConfig\n");
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL);
|
||||
if(get_softmodem_params()->sa == 1) {
|
||||
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
else LOG_I(MAC,"Running without RRC instance\n");
|
||||
|
||||
return (nr_ue_mac_inst);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,11 @@
|
||||
int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc!=NULL) ?
|
||||
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
NR_SubcarrierSpacing_t scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing;
|
||||
int prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present - 1;
|
||||
int prach_sequence_length = (mac->scc!=NULL)?(mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present - 1) : (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1);
|
||||
uint8_t prachConfigIndex, mu;
|
||||
|
||||
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
@@ -145,11 +146,10 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma
|
||||
int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
int8_t receivedTargerPower;
|
||||
int8_t delta_preamble;
|
||||
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc != NULL) ? mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower;
|
||||
delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format);
|
||||
|
||||
@@ -205,7 +205,8 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
|
||||
long nr_get_Pcmax(module_id_t mod_id){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
uint32_t band = *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
uint32_t band = (mac->scc!=NULL) ? *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] :
|
||||
*mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR;
|
||||
NR_P_Max_t p_max = 0;
|
||||
uint8_t P_powerclass = 23;
|
||||
uint8_t delta_P_powerclass = 0;
|
||||
@@ -224,17 +225,18 @@ long nr_get_Pcmax(module_id_t mod_id){
|
||||
delta_MPR_c = 0.5;
|
||||
}
|
||||
|
||||
if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1){
|
||||
if (*mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1->powerBoostPi2BPSK == 1){
|
||||
if (mac->cg && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1){
|
||||
if (*mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1->powerBoostPi2BPSK == 1){
|
||||
// TbD: assuming power class 3 capable UE operating in TDD bands n40, n41, n77, n78, and n79 with Pi/2 BPSK modulation
|
||||
delta_P_powerclass = -3;
|
||||
p_max += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max){
|
||||
NR_P_Max_t *p_Max = (mac->scc!=NULL) ? mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max : mac->scc_SIB->uplinkConfigCommon->frequencyInfoUL.p_Max;
|
||||
if (p_Max){
|
||||
|
||||
p_max += *mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max;
|
||||
p_max += *p_Max;
|
||||
|
||||
LOG_D(MAC, "In %s maximum UL transmission power p_max is %ld dBm \n", __FUNCTION__, p_max);
|
||||
|
||||
@@ -256,4 +258,4 @@ long nr_get_Pcmax(module_id_t mod_id){
|
||||
|
||||
return P_cmax;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,16 +246,18 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
long deltaPreamble_Msg3 = 0;
|
||||
uint8_t noGroupB = 0;
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){
|
||||
deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB
|
||||
NR_BWP_UplinkCommon_t *initialUplinkBWP = (mac->scc) ? mac->scc->uplinkConfigCommon->initialUplinkBWP : &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP;
|
||||
if (initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){
|
||||
deltaPreamble_Msg3 = (*initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB
|
||||
LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3);
|
||||
}
|
||||
|
||||
if (!nr_rach_ConfigCommon->groupBconfigured) {
|
||||
if (!setup->groupBconfigured) {
|
||||
noGroupB = 1;
|
||||
LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__);
|
||||
} else {
|
||||
@@ -263,8 +265,8 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
// - Random Access Preambles group B is configured for 4-step RA type
|
||||
// - Defining the number of RA preambles in RA Preamble Group A for each SSB
|
||||
LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__);
|
||||
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
||||
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
||||
sizeOfRA_PreamblesGroupA = setup->groupBconfigured->numberOfRA_PreamblesGroupA;
|
||||
switch (setup->groupBconfigured->ra_Msg3SizeGroupA){
|
||||
/* - Threshold to determine the groups of RA preambles */
|
||||
case 0:
|
||||
messageSizeGroupA = 56;
|
||||
@@ -297,13 +299,13 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
messageSizeGroupA = 72;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "Unknown ra_Msg3SizeGroupA %lu\n", nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA);
|
||||
AssertFatal(1 == 0, "Unknown ra_Msg3SizeGroupA %lu\n", setup->groupBconfigured->ra_Msg3SizeGroupA);
|
||||
/* todo cases 10 -15*/
|
||||
}
|
||||
|
||||
/* Power offset for preamble selection in dB */
|
||||
messagePowerOffsetGroupB = -9999;
|
||||
switch (nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB){
|
||||
switch (setup->groupBconfigured->messagePowerOffsetGroupB){
|
||||
case 0:
|
||||
messagePowerOffsetGroupB = -9999;
|
||||
break;
|
||||
@@ -329,7 +331,7 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
messagePowerOffsetGroupB = 18;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", setup->groupBconfigured->messagePowerOffsetGroupB);
|
||||
}
|
||||
|
||||
PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
||||
@@ -420,7 +422,10 @@ void nr_get_prach_resources(module_id_t mod_id,
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc)?
|
||||
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup :
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
|
||||
LOG_D(PHY, "In %s: getting PRACH resources frame (first_Msg3 %d)\n", __FUNCTION__, ra->first_Msg3);
|
||||
|
||||
@@ -455,7 +460,9 @@ void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
||||
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc) ?
|
||||
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
RA_config_t *ra = &mac->ra;
|
||||
|
||||
LOG_D(MAC,"In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP);
|
||||
@@ -499,9 +506,9 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
uint8_t *payload;
|
||||
uint16_t size_sdu = 0;
|
||||
unsigned short post_padding;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
AssertFatal(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup != NULL, "In %s: FATAL! nr_rach_ConfigCommon is NULL...\n", __FUNCTION__);
|
||||
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__);
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated;
|
||||
@@ -513,19 +520,23 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
// Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side
|
||||
if (!prach_resources->init_msg1) {
|
||||
if (((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150){
|
||||
if ( (mac->common_configuration_complete>0 || get_softmodem_params()->do_ra==1) && ((MAX_FRAME_NUMBER+frame-prach_resources->sync_frame)%MAX_FRAME_NUMBER)>150 ){
|
||||
prach_resources->init_msg1 = 1;
|
||||
} else {
|
||||
LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n",
|
||||
frame,prach_resources->init_msg1,ra->ra_state,ra->RA_active);
|
||||
|
||||
if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) {
|
||||
|
||||
if (ra->RA_active == 0) {
|
||||
/* RA not active - checking if RRC is ready to initiate the RA procedure */
|
||||
|
||||
LOG_D(MAC, "RA not active. Checking for data to transmit from upper layers...\n");
|
||||
LOG_D(NR_MAC, "RA not active. Checking for data to transmit from upper layers...\n");
|
||||
|
||||
uint8_t TBS_max = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
payload = (uint8_t*) mac->CCCH_pdu.payload;
|
||||
@@ -546,7 +557,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
sdu_lengths[0] = size_sdu;
|
||||
|
||||
LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu);
|
||||
LOG_D(NR_MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu);
|
||||
|
||||
if (size_sdu > 0) {
|
||||
|
||||
@@ -555,7 +566,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
// Random Access Procedure has been successful after reception of Msg4
|
||||
memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6);
|
||||
|
||||
LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx);
|
||||
LOG_D(NR_MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx);
|
||||
|
||||
ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
|
||||
@@ -564,9 +575,9 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
nr_get_RA_window(mac);
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
if (ra->generate_nr_prach == GENERATE_PREAMBLE)
|
||||
if (ra->generate_nr_prach == GENERATE_PREAMBLE) {
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
|
||||
}
|
||||
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
||||
(uint8_t *) payload, // UL MAC pdu pointer
|
||||
num_sdus, // num sdus
|
||||
@@ -632,15 +643,16 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
ra->RA_window_cnt--;
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
|
||||
if (ra->generate_nr_prach == GENERATE_PREAMBLE) {
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
}
|
||||
} else if (ra->RA_backoff_cnt > 0) {
|
||||
|
||||
LOG_D(MAC, "[UE %d][%d.%d]: RAR not received yet (RA backoff count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_backoff_cnt);
|
||||
|
||||
ra->RA_backoff_cnt--;
|
||||
|
||||
if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0){
|
||||
if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0) {
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
}
|
||||
|
||||
@@ -652,6 +664,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
nr_ue_contention_resolution(mod_id, CC_id, frame, nr_slot_tx, prach_resources);
|
||||
}
|
||||
|
||||
LOG_D(MAC,"ra->generate_nr_prach %d ra->ra_state %d (GENERATE_IDLE %d)\n",ra->generate_nr_prach,ra->ra_state,GENERATE_IDLE);
|
||||
if(ra->generate_nr_prach != GENERATE_IDLE) {
|
||||
return ra->generate_nr_prach;
|
||||
} else {
|
||||
@@ -664,17 +677,21 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac){
|
||||
|
||||
uint8_t mu, ra_ResponseWindow;
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__);
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
|
||||
long scs = (mac->scc) ?
|
||||
mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing :
|
||||
mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow;
|
||||
|
||||
if (setup->msg1_SubcarrierSpacing)
|
||||
mu = *setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
mu = scs;
|
||||
|
||||
ra->RA_window_cnt = ra->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
#define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
|
||||
|
||||
// #define DEBUG_DCI
|
||||
//#define DEBUG_DCI
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
|
||||
|
||||
@@ -70,11 +70,22 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
uint16_t monitoringSymbolsWithinSlot = 0;
|
||||
uint8_t coreset_id = 1;
|
||||
int sps = 0;
|
||||
AssertFatal(mac->scc != NULL, "scc is null\n");
|
||||
|
||||
AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n");
|
||||
|
||||
NR_BWP_Id_t bwp_id = mac->DL_BWP_Id;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
|
||||
NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
|
||||
NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common=NULL;
|
||||
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=NULL;
|
||||
NR_BWP_UplinkCommon_t *initialUplinkBWP=NULL;
|
||||
|
||||
if (scc!=NULL || scc_SIB != NULL) {
|
||||
initialDownlinkBWP = scc!=NULL ? scc->downlinkConfigCommon->initialDownlinkBWP : &scc_SIB->downlinkConfigCommon.initialDownlinkBWP;
|
||||
initialUplinkBWP = scc!=NULL ? scc->uplinkConfigCommon->initialUplinkBWP : &scc_SIB->uplinkConfigCommon->initialUplinkBWP;
|
||||
|
||||
bwp_Common = bwp_id>0 ? mac->DLbwp[bwp_id-1]->bwp_Common : NULL;
|
||||
}
|
||||
|
||||
NR_SearchSpace_t *ss;
|
||||
NR_ControlResourceSet_t *coreset;
|
||||
@@ -101,8 +112,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved;
|
||||
rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize);
|
||||
rel15->coreset.InterleaverSize = (interleaved->interleaverSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2 + interleaved->interleaverSize);
|
||||
AssertFatal(scc->physCellId != NULL, "mac->scc->physCellId is null\n");
|
||||
rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : *scc->physCellId;
|
||||
rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : mac->physCellId;
|
||||
} else {
|
||||
rel15->coreset.RegBundleSize = 0;
|
||||
rel15->coreset.InterleaverSize = 0;
|
||||
@@ -116,7 +126,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID;
|
||||
rel15->coreset.scrambling_rnti = mac->crnti;
|
||||
} else {
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = mac->physCellId;
|
||||
rel15->coreset.scrambling_rnti = 0;
|
||||
}
|
||||
|
||||
@@ -128,15 +138,23 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
switch(rnti_type) {
|
||||
case NR_RNTI_C:
|
||||
// we use DL BWP dedicated
|
||||
sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
sps = bwp_Common ?
|
||||
(bwp_Common->genericParameters.cyclicPrefix ? 12 : 14) :
|
||||
initialDownlinkBWP->genericParameters.cyclicPrefix ? 12 : 14;
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->rnti = mac->crnti;
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (!bwp_Common) {
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
else {
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
}
|
||||
for (int i = 0; i < rel15->num_dci_options; i++) {
|
||||
rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
|
||||
rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
|
||||
}
|
||||
break;
|
||||
case NR_RNTI_RA:
|
||||
@@ -151,7 +169,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
|
||||
rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
|
||||
break;
|
||||
case NR_RNTI_P:
|
||||
break;
|
||||
@@ -165,13 +183,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id);
|
||||
rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id);
|
||||
break;
|
||||
case NR_RNTI_SP_CSI:
|
||||
break;
|
||||
case NR_RNTI_SI:
|
||||
// we use DL BWP dedicated
|
||||
sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
if (bwp_Common) sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
else sps=14; // note: normally this would be found with SSS detection
|
||||
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
@@ -182,7 +201,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
||||
|
||||
for (int i = 0; i < rel15->num_dci_options; i++) {
|
||||
rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0);
|
||||
rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0);
|
||||
}
|
||||
break;
|
||||
case NR_RNTI_SFI:
|
||||
@@ -224,167 +243,175 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
int ss_id;
|
||||
uint8_t bwp_id = 1, coreset_id = 1;
|
||||
|
||||
uint8_t bwp_id = (mac->cg) ? 1 : 0, coreset_id = (mac->cg) ? 1 : 0;
|
||||
//NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_BWP_Downlink_t *bwp = mac->DLbwp[bwp_id - 1];
|
||||
NR_BWP_Downlink_t *bwp = (mac->cg) ? mac->DLbwp[bwp_id - 1] : NULL;
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti);
|
||||
#endif
|
||||
LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti);
|
||||
|
||||
// loop over all available SS for BWP ID 1, CORESET ID 1
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
||||
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;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->scg->physicalCellGroupConfig;
|
||||
switch (ss->searchSpaceType->present){
|
||||
case NR_SearchSpace__searchSpaceType_PR_common:
|
||||
// this is for CSSs, we use BWP common and pdcch_ConfigCommon
|
||||
if (mac->cg) { // do this only after we have a Master or Secondary Cell group
|
||||
// loop over all available SS for BWP ID 1, CORESET ID 1
|
||||
if (bwp) {
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss_id %d\n",ss_id);
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
||||
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;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig;
|
||||
switch (ss->searchSpaceType->present){
|
||||
case NR_SearchSpace__searchSpaceType_PR_common:
|
||||
// this is for CSSs, we use BWP common and pdcch_ConfigCommon
|
||||
|
||||
// Fetch configuration for searchSpaceZero
|
||||
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||
}
|
||||
*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
||||
}
|
||||
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
||||
// check available SS IDs
|
||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
switch(ra->ra_state){
|
||||
case WAIT_RAR:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
if (get_softmodem_params()->sa) {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1);
|
||||
} else {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||
}
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
// Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end DCI 00 and 01
|
||||
// DCI 2_0
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_0){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_1
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_1){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_2
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_2){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_3
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_3){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// Fetch configuration for searchSpaceZero
|
||||
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||
}
|
||||
*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
||||
}
|
||||
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
||||
// check available SS IDs
|
||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
switch(ra->ra_state){
|
||||
case WAIT_RAR:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
if (get_softmodem_params()->sa) {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1);
|
||||
} else {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||
}
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
// Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end DCI 00 and 01
|
||||
// DCI 2_0
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_0){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_1
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_1){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_2
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_2){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_3
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_3){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
|
||||
break;
|
||||
case NR_SearchSpace__searchSpaceType_PR_ue_Specific:
|
||||
// this is an USS
|
||||
if (ss->searchSpaceType->choice.ue_Specific){
|
||||
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
|
||||
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
|
||||
if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
|
||||
rel15->num_dci_options = 2;
|
||||
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);
|
||||
break;
|
||||
case NR_SearchSpace__searchSpaceType_PR_ue_Specific:
|
||||
// this is an USS
|
||||
if (ss->searchSpaceType->choice.ue_Specific){
|
||||
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
|
||||
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
|
||||
if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
|
||||
rel15->num_dci_options = 2;
|
||||
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);
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
|
||||
ss_id,
|
||||
ss->searchSpaceType->choice.ue_Specific,
|
||||
ss->searchSpaceType->present,
|
||||
ss->searchSpaceType->choice.ue_Specific->dci_Formats);
|
||||
#endif
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->sp_CSI_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
|
||||
ss_id,
|
||||
ss->searchSpaceType->choice.ue_Specific,
|
||||
ss->searchSpaceType->present,
|
||||
ss->searchSpaceType->choice.ue_Specific->dci_Formats);
|
||||
#endif
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->sp_CSI_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
AssertFatal(1==0,"Handle DCI searching when CellGroup without dedicated BWP\n");
|
||||
}
|
||||
// Search space 0, CORESET ID 0
|
||||
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp ? bwp->bwp_Common : NULL;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp?bwp_Common->pdcch_ConfigCommon:NULL;
|
||||
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (pdcch_ConfigCommon &&
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
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;
|
||||
@@ -398,5 +425,13 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else { // use coreset0/ss0
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[0].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, NR_RNTI_C , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,10 +62,13 @@
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
//#define DEBUG_MIB
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
//#define DEBUG_EXTRACT_DCI
|
||||
//#define DEBUG_RAR
|
||||
|
||||
extern uint32_t N_RB_DL;
|
||||
|
||||
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
@@ -99,47 +102,54 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id)
|
||||
{
|
||||
LOG_D(MAC,"[L2][MAC] decode mib\n");
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
frequency_range_t frequency_range;
|
||||
mac->physCellId = cell_id;
|
||||
|
||||
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
|
||||
|
||||
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
|
||||
//if(mac->mib != NULL){
|
||||
uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused);
|
||||
uint16_t frame_number_4lsb = 0;
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i);
|
||||
uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4]
|
||||
|
||||
uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5]
|
||||
uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset;
|
||||
|
||||
frame = frame << 4;
|
||||
frame = frame | frame_number_4lsb;
|
||||
if(ssb_length == 64){
|
||||
frequency_range = FR2;
|
||||
mac->frequency_range = FR2;
|
||||
for (int i=0; i<3; i++)
|
||||
ssb_index += (((extra_bits>>(7-i))&0x01)<<(3+i));
|
||||
}else{
|
||||
frequency_range = FR1;
|
||||
mac->frequency_range = FR1;
|
||||
if(ssb_subcarrier_offset_msb){
|
||||
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
|
||||
LOG_D(MAC,"system frame number(with LSB): %d\n", (int)frame);
|
||||
LOG_D(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
|
||||
LOG_D(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset);
|
||||
LOG_D(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position);
|
||||
LOG_D(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
|
||||
LOG_D(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
|
||||
LOG_D(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
|
||||
LOG_D(MAC,"ssb index(extra bits): %d\n", (int)ssb_index);
|
||||
#ifdef DEBUG_MIB
|
||||
uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4]
|
||||
LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
|
||||
LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame);
|
||||
LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
|
||||
LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset);
|
||||
LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position);
|
||||
LOG_I(MAC,"controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero);
|
||||
LOG_I(MAC,"searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero);
|
||||
LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
|
||||
LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
|
||||
LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
|
||||
LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index);
|
||||
#endif
|
||||
|
||||
//storing ssb index in the mac structure
|
||||
mac->mib_ssb = ssb_index;
|
||||
@@ -147,16 +157,10 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
if (get_softmodem_params()->sa == 1) {
|
||||
|
||||
// TODO these values shouldn't be taken from SCC in SA
|
||||
uint8_t scs_ssb = *scc->ssbSubcarrierSpacing;
|
||||
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
int scs_scaling = 1<<scs_ssb;
|
||||
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);
|
||||
|
||||
uint8_t scs_ssb = get_softmodem_params()->numerology;
|
||||
uint32_t band = get_softmodem_params()->band;
|
||||
uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
|
||||
uint16_t ssb_offset_point_a = (ssb_start_subcarrier - ssb_subcarrier_offset)/12;
|
||||
|
||||
get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config,
|
||||
frame,
|
||||
@@ -165,9 +169,9 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
ssb_subcarrier_offset,
|
||||
ssb_start_symbol,
|
||||
scs_ssb,
|
||||
frequency_range,
|
||||
mac->frequency_range,
|
||||
ssb_index,
|
||||
absolute_diff/(12*scs_scaling)-10);
|
||||
ssb_offset_point_a);
|
||||
|
||||
|
||||
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
|
||||
@@ -230,10 +234,10 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(MAC,"riv = %i\n", riv);
|
||||
LOG_D(MAC,"n_RB_DLBWP = %i\n", n_RB_DLBWP);
|
||||
LOG_D(MAC,"number_rbs = %i\n", dlsch_config_pdu->number_rbs);
|
||||
LOG_D(MAC,"start_rb = %i\n", dlsch_config_pdu->start_rb);
|
||||
LOG_D(MAC,"DLSCH riv = %i\n", riv);
|
||||
LOG_D(MAC,"DLSCH n_RB_DLBWP = %i\n", n_RB_DLBWP);
|
||||
LOG_D(MAC,"DLSCH number_rbs = %i\n", dlsch_config_pdu->number_rbs);
|
||||
LOG_D(MAC,"DLSCH start_rb = %i\n", dlsch_config_pdu->start_rb);
|
||||
|
||||
}
|
||||
if(pusch_config_pdu != NULL){
|
||||
@@ -256,7 +260,10 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
||||
LOG_W(MAC, "Frequency domain assignment values are invalid! #RBs: %d, Start RB: %d, n_RB_ULBWP: %d \n",pusch_config_pdu->rb_size, pusch_config_pdu->rb_start, n_RB_ULBWP);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(MAC,"ULSCH riv = %i\n", riv);
|
||||
LOG_D(MAC,"ULSCH n_RB_DLBWP = %i\n", n_RB_ULBWP);
|
||||
LOG_D(MAC,"ULSCH number_rbs = %i\n", pusch_config_pdu->rb_size);
|
||||
LOG_D(MAC,"ULSCH start_rb = %i\n", pusch_config_pdu->rb_start);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -265,9 +272,10 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
||||
uint8_t time_domain_ind,
|
||||
bool use_default){
|
||||
bool use_default
|
||||
){
|
||||
int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position;
|
||||
|
||||
int dmrs_typeA_pos = mac->scc->dmrs_TypeA_Position;
|
||||
// uint8_t k_offset=0;
|
||||
uint8_t sliv_S=0;
|
||||
uint8_t sliv_L=0;
|
||||
@@ -317,10 +325,16 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
*/
|
||||
if(dlsch_config_pdu != NULL){
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
|
||||
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
if (mac->DLbwp[0] &&
|
||||
mac->DLbwp[0]->bwp_Dedicated &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
|
||||
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
else if (mac->DLbwp[0] && mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup)
|
||||
pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
|
||||
if (pdsch_TimeDomainAllocationList && use_default==false) {
|
||||
|
||||
if (time_domain_ind >= pdsch_TimeDomainAllocationList->list.count) {
|
||||
@@ -370,13 +384,22 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
*/
|
||||
if(pusch_config_pdu != NULL){
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||
if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
|
||||
else pusch_TimeDomainAllocationList = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
|
||||
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",
|
||||
@@ -386,6 +409,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"Filling Time-Domain Allocation from pusch_TimeDomainAllocationList\n");
|
||||
int startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->startSymbolAndLength;
|
||||
int S,L;
|
||||
SLIV2SL(startSymbolAndLength,&S,&L);
|
||||
@@ -393,6 +417,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->nr_of_symbols=L;
|
||||
}
|
||||
else {
|
||||
LOG_D(NR_MAC,"Filling Time-Domain Allocation from tables\n");
|
||||
// k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
||||
sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][1];
|
||||
sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][2];
|
||||
@@ -402,6 +427,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->nr_of_symbols = sliv_L;
|
||||
pusch_config_pdu->start_symbol_index = sliv_S;
|
||||
}
|
||||
LOG_D(NR_MAC,"start_symbol = %i\n", pusch_config_pdu->start_symbol_index);
|
||||
LOG_D(NR_MAC,"number_symbols = %i\n", pusch_config_pdu->nr_of_symbols);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -409,13 +436,14 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci) {
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format];
|
||||
|
||||
LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits);
|
||||
|
||||
if (nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, &mac->def_dci_pdu_rel15[dci->dci_format]))
|
||||
return -1;
|
||||
return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, &mac->def_dci_pdu_rel15[dci->dci_format], dci->rnti, dci->dci_format));
|
||||
int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15);
|
||||
if ((ret&1) == 1) return -1;
|
||||
else if (ret == 2) dci->dci_format = NR_UL_DCI_FORMAT_0_0;
|
||||
return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci->dci_format));
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint8_t dci_format){
|
||||
@@ -430,11 +458,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||
uint8_t is_Msg3 = 0;
|
||||
|
||||
//const uint16_t n_RB_DLBWP = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP; //make sure this has been set
|
||||
AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
||||
AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
||||
|
||||
const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
uint16_t n_RB_DLBWP;
|
||||
if (mac->DLbwp[0]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
|
||||
else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||
|
||||
LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP);
|
||||
|
||||
@@ -473,6 +500,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
return -1;
|
||||
}
|
||||
|
||||
AssertFatal(ul_config->number_pdus<FAPI_NR_UL_CONFIG_LIST_NUM, "ul_config->number_pdus %d out of bounds\n",ul_config->number_pdus);
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
||||
|
||||
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
|
||||
@@ -597,14 +625,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
||||
NR_PDSCH_Config_t *pdsch_config = NULL;
|
||||
uint16_t BWPSize = 0;
|
||||
NR_PDSCH_Config_t *pdsch_config= (mac->DLbwp[0]) ? mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup : NULL;
|
||||
uint16_t BWPSize = n_RB_DLBWP;
|
||||
|
||||
if(rnti == SI_RNTI) {
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
|
||||
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
||||
if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
|
||||
BWPSize = dlsch_config_pdu_1_0->BWPSize;
|
||||
} else {
|
||||
if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){
|
||||
@@ -613,20 +642,30 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||
}
|
||||
if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) {
|
||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (get_softmodem_params()->sa) {
|
||||
if (mac->scc == NULL) {
|
||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
else {
|
||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
} else { // NSA mode is not using the Initial BWP
|
||||
}
|
||||
if (!get_softmodem_params()->sa) { // NSA mode is not using the Initial BWP
|
||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||
BWPSize = dlsch_config_pdu_1_0->BWPSize;
|
||||
}
|
||||
} else {
|
||||
} else if (mac->DLbwp[0]) {
|
||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||
} else if (mac->scc_SIB) {
|
||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
|
||||
pdsch_config = NULL;
|
||||
}
|
||||
BWPSize = n_RB_DLBWP;
|
||||
}
|
||||
|
||||
/* IDENTIFIER_DCI_FORMATS */
|
||||
@@ -642,24 +681,25 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
}
|
||||
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
|
||||
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
if (mac->DLbwp[0] &&
|
||||
mac->DLbwp[0]->bwp_Dedicated &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
|
||||
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
else if (mac->DLbwp[0] && mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup)
|
||||
pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
|
||||
int mappingtype = pdsch_TimeDomainAllocationList ? pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType : ((dlsch_config_pdu_1_0->start_symbol <= 3)? typeA: typeB);
|
||||
|
||||
/* dmrs symbol positions*/
|
||||
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(NULL,
|
||||
mac->scc->dmrs_TypeA_Position,
|
||||
dlsch_config_pdu_1_0->number_symbols,
|
||||
dlsch_config_pdu_1_0->start_symbol,
|
||||
mappingtype);
|
||||
|
||||
// For DCI 1_0, dmrs type is type1. referred to section 5.1.6.2 of 3GPP TS 38.214
|
||||
dlsch_config_pdu_1_0->dmrsConfigType = 0;
|
||||
LOG_D(MAC, "DCI 1_0 start_sym:%d NR Symb:%d, DMRS_symb_pos:%x\n", dlsch_config_pdu_1_0->start_symbol, dlsch_config_pdu_1_0->number_symbols, dlsch_config_pdu_1_0->dlDmrsSymbPos);
|
||||
|
||||
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
||||
mac->mib->dmrs_TypeA_Position,
|
||||
dlsch_config_pdu_1_0->number_symbols,
|
||||
dlsch_config_pdu_1_0->start_symbol,
|
||||
mappingtype);
|
||||
dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[0] != NULL) ? (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0;
|
||||
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
|
||||
if (dlsch_config_pdu_1_0->number_symbols == 2)
|
||||
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1;
|
||||
@@ -708,20 +748,42 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
dlsch_config_pdu_1_0->pucch_resource_id = dci->pucch_resource_indicator;
|
||||
// Sanity check for pucch_resource_indicator value received to check for false DCI.
|
||||
valid = 0;
|
||||
pucch_res_set_cnt = mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count;
|
||||
for (int id = 0; id < pucch_res_set_cnt; id++) {
|
||||
if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
|
||||
valid = 1;
|
||||
break;
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pucch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup&&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList) {
|
||||
pucch_res_set_cnt = mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count;
|
||||
for (int id = 0; id < pucch_res_set_cnt; id++) {
|
||||
if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[0]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
|
||||
valid = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mac->cg &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList){
|
||||
pucch_res_set_cnt = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.count;
|
||||
for (int id = 0; id < pucch_res_set_cnt; id++) {
|
||||
if (dlsch_config_pdu_1_0->pucch_resource_id < mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
|
||||
valid = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else valid=1;
|
||||
if (!valid) {
|
||||
LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dlsch_config_pdu_1_0->pucch_resource_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/
|
||||
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
|
||||
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = 1+dci->pdsch_to_harq_feedback_timing_indicator.val;
|
||||
|
||||
LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n",
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti,
|
||||
@@ -819,12 +881,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
}
|
||||
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
|
||||
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
if (mac->DLbwp[0] &&
|
||||
mac->DLbwp[0]->bwp_Dedicated &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
|
||||
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
else if (mac->DLbwp[0] && mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup)
|
||||
pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
|
||||
int mappingtype = pdsch_TimeDomainAllocationList ? pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType : ((dlsch_config_pdu_1_1->start_symbol <= 3)? typeA: typeB);
|
||||
|
||||
/* dmrs symbol positions*/
|
||||
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
||||
@@ -1133,23 +1200,32 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
uint64_t *dci_pdu,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15) {
|
||||
|
||||
int N_RB = 0;
|
||||
int pos = 0;
|
||||
int fsize = 0;
|
||||
|
||||
int rnti_type = get_rnti_type(mac, rnti);
|
||||
|
||||
AssertFatal(mac->DLbwp[0] != NULL, "DLbwp[0] shouldn't be null here!\n");
|
||||
AssertFatal(mac->ULbwp[0] != NULL, "ULbwp[0] shouldn't be null here!\n");
|
||||
int N_RB = get_n_rb(mac, rnti_type);
|
||||
int N_RB_UL = (mac->scg != NULL) ?
|
||||
NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) :
|
||||
NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
int pos=0;
|
||||
int fsize=0;
|
||||
int N_RB_UL = 0;
|
||||
if(mac->scc_SIB) {
|
||||
N_RB_UL = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
} else if(mac->ULbwp[0]) {
|
||||
N_RB_UL = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
} else if(mac->scc) {
|
||||
N_RB_UL = NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
|
||||
LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d\n",*dci_pdu,dci_size);
|
||||
switch(dci_format) {
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_0:
|
||||
switch(rnti_type) {
|
||||
case NR_RNTI_RA:
|
||||
if(mac->scc_SIB) {
|
||||
N_RB = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
} else {
|
||||
N_RB = get_n_rb(mac, rnti_type);
|
||||
}
|
||||
// Freq domain assignment
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos=fsize;
|
||||
@@ -1189,11 +1265,19 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
//Identifier for DCI formats
|
||||
pos++;
|
||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||
|
||||
//switch to DCI_0_0
|
||||
if (dci_pdu_rel15->format_indicator == 0)
|
||||
return 1; // discard dci, format indicator not corresponding to dci_format
|
||||
return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, dci_pdu, dci_pdu_rel15);
|
||||
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
|
||||
// check BWP id
|
||||
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// Freq domain assignment (275rb >> fsize = 16)
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
@@ -1333,46 +1417,50 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
break;
|
||||
|
||||
case NR_RNTI_SI:
|
||||
N_RB = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||
// Time domain assignment 4 bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
|
||||
// Time domain assignment 4 bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
// VRB to PRB mapping 1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||
|
||||
// VRB to PRB mapping 1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
pos+=5;
|
||||
dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
pos+=5;
|
||||
dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||
// Redundancy version 2 bit
|
||||
pos+=2;
|
||||
dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3;
|
||||
|
||||
// Redundancy version 2 bit
|
||||
pos+=2;
|
||||
dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3;
|
||||
// System information indicator 1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||
|
||||
// System information indicator 1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1;
|
||||
|
||||
LOG_D(MAC,"N_RB = %i\n", N_RB);
|
||||
LOG_D(MAC,"dci_size = %i\n", dci_size);
|
||||
LOG_D(MAC,"fsize = %i\n", fsize);
|
||||
LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||
LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||
LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||
LOG_D(MAC,"N_RB = %i\n", N_RB);
|
||||
LOG_D(MAC,"dci_size = %i\n", dci_size);
|
||||
LOG_D(MAC,"fsize = %i\n", fsize);
|
||||
LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||
LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||
LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||
LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||
|
||||
break;
|
||||
|
||||
case NR_RNTI_TC:
|
||||
|
||||
// check BWP id
|
||||
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// indicating a DL DCI format - 1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||
@@ -1445,38 +1533,68 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
break;
|
||||
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
if (mac->ULbwp[0]) N_RB_UL=NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB_UL=NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
switch(rnti_type)
|
||||
{
|
||||
case NR_RNTI_C:
|
||||
//Identifier for DCI formats
|
||||
pos++;
|
||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Format indicator %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
if (dci_pdu_rel15->format_indicator == 1)
|
||||
return 1; // discard dci, format indicator not corresponding to dci_format
|
||||
fsize = (int)ceil( log2( (N_RB_UL*(N_RB_UL+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Freq domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment.val,fsize,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Time domain assignment 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"time-domain assignment %d (4 bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment.val,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Frequency hopping flag E1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->frequency_hopping_flag.val= (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"frequency_hopping %d (1 bit)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_hopping_flag.val,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// MCS 5 bit
|
||||
pos+=5;
|
||||
dci_pdu_rel15->mcs= (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"mcs %d (5 bits)=> %d (0x%lx)\n",dci_pdu_rel15->mcs,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// New data indicator 1bit
|
||||
pos++;
|
||||
dci_pdu_rel15->ndi= (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"NDI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->ndi,1,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Redundancy version 2bit
|
||||
pos+=2;
|
||||
dci_pdu_rel15->rv= (*dci_pdu>>(dci_size-pos))&3;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"RV %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->rv,2,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// HARQ process number 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"HARQ_PID %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->harq_pid,4,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// TPC command for scheduled PUSCH E2 bits
|
||||
pos+=2;
|
||||
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"TPC %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->tpc,2,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// UL/SUL indicator E1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
@@ -1637,10 +1755,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
// Freq domain assignment max 16 bit
|
||||
fsize = (int)ceil( log2( (N_RB_UL*(N_RB_UL+1))>>1 ) );
|
||||
//pos+=dci_pdu_rel15->frequency_domain_assignment.nbits;
|
||||
pos+=fsize;
|
||||
|
||||
//pos+=dci_pdu_rel15->frequency_domain_assignment.nbits;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||
|
||||
// Time domain assignment 4bit
|
||||
@@ -1776,7 +1891,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
frame_t frameP = dl_info->frame;
|
||||
int slot = dl_info->slot;
|
||||
uint8_t *pduP = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu;
|
||||
int32_t pdu_len = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length;
|
||||
int16_t pdu_len = (int16_t)(dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length;
|
||||
uint8_t gNB_index = dl_info->gNB_index;
|
||||
uint8_t CC_id = dl_info->cc_id;
|
||||
uint8_t done = 0;
|
||||
@@ -1794,9 +1909,6 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
|
||||
mac_sdu_len = 0x0000;
|
||||
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
|
||||
//#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID, pdu_len);
|
||||
//#endif
|
||||
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
|
||||
switch(rx_lcid){
|
||||
@@ -2009,8 +2121,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) {
|
||||
// if (IS_SOFTMODEM_NOS1){
|
||||
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DCCH) {
|
||||
|
||||
mac_rlc_data_ind(module_idP,
|
||||
mac->crnti,
|
||||
@@ -2026,7 +2138,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
} else {
|
||||
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, gNB_index);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in
|
||||
ul_config->sfn = frame_tx;
|
||||
ul_config->number_pdus++;
|
||||
|
||||
LOG_D(MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus);
|
||||
LOG_D(NR_MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,17 +95,25 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||
long k2 = -1;
|
||||
// Get K2 from RRC configuration
|
||||
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||
if (pusch_config->pusch_TimeDomainAllocationList) {
|
||||
if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList)
|
||||
pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
else AssertFatal(1==0,"need to fall back to default PUSCH time-domain allocations\n");
|
||||
|
||||
if (pusch_TimeDomainAllocationList) {
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@@ -116,7 +124,7 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||
"Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n",
|
||||
k2,DURATION_RX_TO_TX);
|
||||
|
||||
LOG_D(MAC, "get_k2(): k2 is %ld\n", k2);
|
||||
LOG_D(NR_MAC, "get_k2(): k2 is %ld\n", k2);
|
||||
return k2;
|
||||
}
|
||||
|
||||
@@ -126,22 +134,26 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||
*/
|
||||
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot)
|
||||
{
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon;
|
||||
|
||||
//Check if request to access ul_config is for a UL slot
|
||||
if (is_nr_UL_slot(mac->scc, slot, mac->frame_type) == 0) {
|
||||
LOG_W(MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__);
|
||||
if (is_nr_UL_slot(tdd_config, slot, mac->frame_type) == 0) {
|
||||
LOG_W(NR_MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Calculate the index of the UL slot in mac->ul_config_request list. This is
|
||||
// based on the TDD pattern (slot configuration period) and number of UL+mixed
|
||||
// slots in the period. TS 38.213 Sec 11.1
|
||||
int mu = mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||
int mu = mac->ULbwp[0] ?
|
||||
mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
|
||||
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &tdd_config->pattern1;
|
||||
const int num_slots_per_tdd = nr_slots_per_frame[mu] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
||||
const int num_slots_ul = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
||||
int index = (slot + num_slots_ul - num_slots_per_tdd) % num_slots_per_tdd;
|
||||
int index = slot % num_slots_ul;
|
||||
|
||||
LOG_D(MAC, "In %s slots per tdd %d, num_slots_ul %d, index %d\n", __FUNCTION__,
|
||||
LOG_D(NR_MAC, "In %s slots per tdd %d, num_slots_ul %d, index %d\n", __FUNCTION__,
|
||||
num_slots_per_tdd,
|
||||
num_slots_ul,
|
||||
index);
|
||||
@@ -496,7 +508,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
int N_PRB_oh = 0;
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
int rnti_type = get_rnti_type(mac, rnti);
|
||||
|
||||
// Common configuration
|
||||
@@ -504,6 +515,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_config_pdu->nrOfLayers = 1;
|
||||
pusch_config_pdu->rnti = rnti;
|
||||
NR_BWP_UplinkCommon_t *initialUplinkBWP;
|
||||
if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP;
|
||||
else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP;
|
||||
|
||||
pusch_dmrs_AdditionalPosition_t add_pos = pusch_dmrs_pos2;
|
||||
pusch_maxLength_t dmrslength = pusch_len1;
|
||||
@@ -511,23 +525,39 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
if (rar_grant) {
|
||||
|
||||
// Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0
|
||||
|
||||
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
||||
NR_BWP_UplinkDedicated_t *ibwp = mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
|
||||
NR_PUSCH_Config_t *pusch_Config = ibwp->pusch_Config->choice.setup;
|
||||
int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
|
||||
int mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
|
||||
NR_BWP_UplinkDedicated_t *ibwp;
|
||||
int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype;
|
||||
NR_PUSCH_Config_t *pusch_Config=NULL;
|
||||
if (mac->cg && ubwp &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) {
|
||||
|
||||
ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
|
||||
pusch_Config = ibwp->pusch_Config->choice.setup;
|
||||
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
|
||||
mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
|
||||
|
||||
// active BWP start
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
// active BWP start
|
||||
abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
}
|
||||
else {
|
||||
startSymbolAndLength = initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
|
||||
mappingtype = initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
|
||||
|
||||
// initial BWP start
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
// active BWP start
|
||||
abwp_start = NRRIV2PRBOFFSET(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
abwp_size = NRRIV2BW(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
scs = initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
}
|
||||
int ibwp_start = NRRIV2PRBOFFSET(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_size = NRRIV2BW(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// BWP start selection according to 8.3 of TS 38.213
|
||||
// BWP start selection according to 8.3 of TS 38.213
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) {
|
||||
pusch_config_pdu->bwp_start = abwp_start;
|
||||
pusch_config_pdu->bwp_size = abwp_size;
|
||||
@@ -555,11 +585,11 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->start_symbol_index = StartSymbolIndex;
|
||||
pusch_config_pdu->nr_of_symbols = NrOfSymbols;
|
||||
|
||||
l_prime_mask = get_l_prime(NrOfSymbols, mappingtype, add_pos, dmrslength, StartSymbolIndex, scc->dmrs_TypeA_Position);
|
||||
l_prime_mask = get_l_prime(NrOfSymbols, mappingtype, add_pos, dmrslength, StartSymbolIndex, mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position);
|
||||
LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , DMRS_MASK:%x\n", pusch_config_pdu->start_symbol_index, pusch_config_pdu->nr_of_symbols, mappingtype, l_prime_mask);
|
||||
|
||||
#ifdef DEBUG_MSG3
|
||||
LOG_D(MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size);
|
||||
LOG_D(NR_MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size);
|
||||
#endif
|
||||
|
||||
// MCS
|
||||
@@ -576,17 +606,17 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->scid = 0;
|
||||
|
||||
// Transform precoding according to 6.1.3 UE procedure for applying transform precoding on PUSCH in 38.214
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(scc, pusch_Config, NULL, NULL, NR_RNTI_RA, 0); // TBR fix rnti and take out
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, NULL, NR_RNTI_TC, 0); // TBR fix rnti and take out
|
||||
|
||||
// Resource allocation in frequency domain according to 6.1.2.2 in TS 38.214
|
||||
pusch_config_pdu->resource_alloc = pusch_Config->resourceAllocation;
|
||||
pusch_config_pdu->resource_alloc = (mac->cg) ? pusch_Config->resourceAllocation : 1;
|
||||
|
||||
//// Completing PUSCH PDU
|
||||
pusch_config_pdu->mcs_table = 0;
|
||||
pusch_config_pdu->cyclic_prefix = 0;
|
||||
pusch_config_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_config_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
pusch_config_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pusch_config_pdu->data_scrambling_id = mac->physCellId;
|
||||
pusch_config_pdu->ul_dmrs_scrambling_id = mac->physCellId;
|
||||
pusch_config_pdu->subcarrier_spacing = scs;
|
||||
pusch_config_pdu->vrb_to_prb_mapping = 0;
|
||||
pusch_config_pdu->uplink_frequency_shift_7p5khz = 0;
|
||||
//Optional Data only included if indicated in pduBitmap
|
||||
@@ -599,18 +629,29 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
int target_ss;
|
||||
bool valid_ptrs_setup = 0;
|
||||
uint16_t n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
uint16_t n_RB_ULBWP;
|
||||
if (mac->ULbwp[0] && mac->ULbwp[0]->bwp_Common) {
|
||||
n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
else {
|
||||
pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
n_RB_ULBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
|
||||
pusch_config_pdu->bwp_size = n_RB_ULBWP;
|
||||
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
|
||||
|
||||
// Basic sanity check for MCS value to check for a false or erroneous DCI
|
||||
if (dci->mcs > 28) {
|
||||
LOG_W(MAC, "MCS value %d out of bounds! Possibly due to false DCI. Ignoring DCI!\n", dci->mcs);
|
||||
LOG_W(NR_MAC, "MCS value %d out of bounds! Possibly due to false DCI. Ignoring DCI!\n", dci->mcs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Transform precoding */
|
||||
if (rnti_type != NR_RNTI_CS || (rnti_type == NR_RNTI_CS && dci->ndi == 1)) {
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(scc, pusch_Config, NULL, dci_format, rnti_type, 0);
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, dci_format, rnti_type, 0);
|
||||
}
|
||||
|
||||
/*DCI format-related configuration*/
|
||||
@@ -622,7 +663,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* BANDWIDTH_PART_IND */
|
||||
if (dci->bwp_indicator.val != 1) {
|
||||
LOG_W(MAC, "bwp_indicator != 1! Possibly due to false DCI. Ignoring DCI!\n");
|
||||
LOG_W(NR_MAC, "bwp_indicator != 1! Possibly due to false DCI. Ignoring DCI!\n");
|
||||
return -1;
|
||||
}
|
||||
config_bwp_ue(mac, &dci->bwp_indicator.val, dci_format);
|
||||
@@ -632,24 +673,33 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
} else {
|
||||
|
||||
LOG_E(MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, *dci_format);
|
||||
LOG_E(NR_MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, *dci_format);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||
if (pusch_Config->pusch_TimeDomainAllocationList) {
|
||||
if (pusch_Config && pusch_Config->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = pusch_Config->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList)
|
||||
pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
else AssertFatal(1==0,"need to fall back to default PUSCH time-domain allocations\n");
|
||||
|
||||
int mappingtype = pusch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
|
||||
|
||||
NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL;
|
||||
NR_DMRS_ulconfig = (mappingtype == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA)
|
||||
? pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup : pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup;
|
||||
if(pusch_Config) {
|
||||
NR_DMRS_ulconfig = (mappingtype == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA)
|
||||
? pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup : pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup;
|
||||
}
|
||||
|
||||
/* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -673,7 +723,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
else
|
||||
AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n");
|
||||
|
||||
LOG_D(MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d \n", pusch_config_pdu->num_dmrs_cdm_grps_no_data,
|
||||
LOG_D(NR_MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d \n", pusch_config_pdu->num_dmrs_cdm_grps_no_data,
|
||||
pusch_config_pdu->dfts_ofdm.low_papr_group_number);
|
||||
}
|
||||
|
||||
@@ -690,7 +740,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
/* FREQ_HOPPING_FLAG */
|
||||
if ((pusch_Config->frequencyHopping!=NULL) && (pusch_Config->resourceAllocation != NR_PUSCH_Config__resourceAllocation_resourceAllocationType0)){
|
||||
if ((pusch_Config!=NULL) && (pusch_Config->frequencyHopping!=NULL) && (pusch_Config->resourceAllocation != NR_PUSCH_Config__resourceAllocation_resourceAllocationType0)){
|
||||
pusch_config_pdu->frequency_hopping = dci->frequency_hopping_flag.val;
|
||||
}
|
||||
|
||||
@@ -699,9 +749,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* MCS TABLE */
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_Table, 0, *dci_format, rnti_type, target_ss, false);
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, *dci_format, rnti_type, target_ss, false);
|
||||
} else {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_TableTransformPrecoder, 1, *dci_format, rnti_type, target_ss, false);
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, 1, *dci_format, rnti_type, target_ss, false);
|
||||
}
|
||||
|
||||
/* NDI */
|
||||
@@ -731,19 +781,30 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
/* DMRS */
|
||||
l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, mappingtype, add_pos, dmrslength, pusch_config_pdu->start_symbol_index, scc->dmrs_TypeA_Position);
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled)
|
||||
l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, 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[0] && pusch_config_pdu->transform_precoding == transform_precoder_disabled))
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_enabled))
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
|
||||
// Num PRB Overhead from PUSCH-ServingCellConfig
|
||||
if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead == NULL) {
|
||||
N_PRB_oh = 0;
|
||||
} else {
|
||||
N_PRB_oh = *mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
||||
}
|
||||
if (mac->cg &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead)
|
||||
N_PRB_oh = *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
||||
|
||||
else N_PRB_oh = 0;
|
||||
|
||||
/* PTRS */
|
||||
if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS != NULL) {
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) {
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) {
|
||||
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
|
||||
pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
|
||||
@@ -755,13 +816,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
if(valid_ptrs_setup==true) {
|
||||
pusch_config_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS;
|
||||
}
|
||||
LOG_D(MAC, "UL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", pusch_config_pdu->pusch_ptrs.ptrs_time_density, pusch_config_pdu->pusch_ptrs.ptrs_freq_density);
|
||||
LOG_D(NR_MAC, "UL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", pusch_config_pdu->pusch_ptrs.ptrs_time_density, pusch_config_pdu->pusch_ptrs.ptrs_freq_density);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOG_D(MAC, "In %s: received UL grant (rb_start %d, rb_size %d, start_symbol_index %d, nr_of_symbols %d) for RNTI type %s \n",
|
||||
LOG_D(NR_MAC, "In %s: received UL grant (rb_start %d, rb_size %d, start_symbol_index %d, nr_of_symbols %d) for RNTI type %s \n",
|
||||
__FUNCTION__,
|
||||
pusch_config_pdu->rb_start,
|
||||
pusch_config_pdu->rb_size,
|
||||
@@ -774,7 +835,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
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) {
|
||||
LOG_W(MAC, "In %s: Invalid code rate or Mod order, likely due to unexpected UL DCI. Ignoring DCI! \n", __FUNCTION__);
|
||||
LOG_W(NR_MAC, "In %s: Invalid code rate or Mod order, likely due to unexpected UL DCI. Ignoring DCI! \n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -817,8 +878,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
|
||||
// check type0 from 38.213 13 if we have no CellGroupConfig
|
||||
// TODO: implementation to be completed
|
||||
if (mac->scg == NULL) {
|
||||
|
||||
LOG_D(NR_MAC,"nr_ue_scheduler(): mac->cg %p\n",mac->cg);
|
||||
if (mac->cg == NULL) {
|
||||
if(dl_info->ssb_index != -1){
|
||||
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 1){
|
||||
@@ -859,17 +920,39 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti = 0xaaaa; // to be set
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106; // to be set
|
||||
|
||||
LOG_I(MAC,"nr_ue_scheduler Type0 PDCCH with rnti %x, BWP %d\n",
|
||||
LOG_I(NR_MAC,"nr_ue_scheduler Type0 PDCCH with rnti %x, BWP %d\n",
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti,
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP);
|
||||
*/
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
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;
|
||||
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
|
||||
if( mac->scc == NULL && mac->scc_SIB == NULL && (rx_frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (rx_slot == mac->type0_PDCCH_CSS_config.n_0) ){
|
||||
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(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",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);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
// this is for Msg2/Msg4
|
||||
if (mac->ra.ra_state >= WAIT_RAR) {
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_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);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
}
|
||||
} else { // we have an scg
|
||||
} else { // we have a Master or Secondary CellGroupConfig
|
||||
|
||||
dcireq.module_id = mod_id;
|
||||
dcireq.gNB_index = gNB_index;
|
||||
@@ -915,9 +998,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
|
||||
// Schedule ULSCH only if the current frame and slot match those in ul_config_req
|
||||
// AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus)
|
||||
if ((ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){
|
||||
if (ul_config && (ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){
|
||||
|
||||
LOG_D(MAC, "In %s:[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", __FUNCTION__, frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot);
|
||||
LOG_D(NR_MAC, "In %s:[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", __FUNCTION__, frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot);
|
||||
|
||||
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
uint8_t data_existing = 0;
|
||||
@@ -931,15 +1014,26 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) {
|
||||
|
||||
uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
|
||||
|
||||
LOG_D(NR_MAC,"harq_id %d, NDI %d NDI_DCI %d, TBS_bytes %d (ra_state %d\n",
|
||||
ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id,
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id],
|
||||
ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator,
|
||||
TBS_bytes,
|
||||
ra->ra_state);
|
||||
if (ra->ra_state == WAIT_RAR && !ra->cfra){
|
||||
memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes);
|
||||
LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n");
|
||||
for (int k = 0; k < TBS_bytes; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,mac->ulsch_pdu.payload[k]);
|
||||
}
|
||||
LOG_D(NR_MAC,"Flipping NDI for harq_id %d (Msg3)\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator);
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
} else {
|
||||
if (IS_SOFTMODEM_NOS1 && (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator)){
|
||||
|
||||
if ( (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator ||
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id]==1)){
|
||||
|
||||
// Getting IP traffic to be transmitted
|
||||
data_existing = nr_ue_get_sdu(mod_id,
|
||||
cc_id,
|
||||
@@ -951,15 +1045,19 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
&access_mode);
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"Flipping NDI for harq_id %d\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator);
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
|
||||
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
|
||||
if (!IS_SOFTMODEM_NOS1 || !data_existing) {
|
||||
if (!data_existing) {
|
||||
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
|
||||
//and block this traffic from being forwarded to the upper layers at the gNB
|
||||
LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes);
|
||||
|
||||
// Make the first byte padding so that gNB ignores the PHY random
|
||||
// data in the TB for the PHY at the MAC layer
|
||||
//Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
|
||||
//in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
|
||||
//have a valid LCID (nr_process_mac_pdu function)
|
||||
ulsch_input_buffer[0] = UL_SCH_LCID_PADDING;
|
||||
|
||||
for (int i = 1; i < TBS_bytes; i++) {
|
||||
@@ -1021,9 +1119,15 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
int delta = 0;
|
||||
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
||||
|
||||
// Get the numerology to calculate the Tx frame and slot
|
||||
int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
struct NR_PUSCH_TimeDomainResourceAllocationList *pusch_TimeDomainAllocationList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
int mu = ubwp ?
|
||||
ubwp->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ubwp ?
|
||||
ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
// k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1
|
||||
// PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon
|
||||
int k2;
|
||||
@@ -1071,14 +1175,14 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
}
|
||||
|
||||
LOG_D(MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta);
|
||||
LOG_D(NR_MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
// Build the list of all the valid RACH occasions in the maximum association pattern period according to the PRACH config
|
||||
static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
static void build_ro_list(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
int x,y; // PRACH Configuration Index table variables used to compute the valid frame numbers
|
||||
int y2; // PRACH Configuration Index table additional variable used to compute the valid frame numbers
|
||||
@@ -1096,7 +1200,6 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
int nb_fdm;
|
||||
|
||||
uint8_t config_index, mu;
|
||||
uint32_t pointa;
|
||||
int msg1_FDM;
|
||||
|
||||
uint8_t prach_conf_period_idx;
|
||||
@@ -1104,18 +1207,21 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
uint8_t prach_conf_period_frame_idx;
|
||||
int64_t *prach_config_info_p;
|
||||
|
||||
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
NR_RACH_ConfigCommon_t *setup = (mac->scc) ?
|
||||
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
|
||||
config_index = rach_ConfigGeneric->prach_ConfigurationIndex;
|
||||
|
||||
if (setup->msg1_SubcarrierSpacing)
|
||||
if (setup->msg1_SubcarrierSpacing) {
|
||||
mu = *setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
} else if(mac->scc) {
|
||||
mu = mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
} else {
|
||||
mu = get_softmodem_params()->numerology;
|
||||
}
|
||||
|
||||
pointa = frequencyInfoDL->absoluteFrequencyPointA;
|
||||
msg1_FDM = rach_ConfigGeneric->msg1_FDM;
|
||||
|
||||
switch (msg1_FDM){
|
||||
@@ -1133,12 +1239,13 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
// ==============================
|
||||
// WIP: For now assume no rejected PRACH occasions because of conflict with SSB or TDD_UL_DL_ConfigurationCommon schedule
|
||||
|
||||
int unpaired = mac->phy_config.config_req.cell_config.frame_duplex_type;
|
||||
// Identify the proper PRACH Configuration Index table according to the operating frequency
|
||||
LOG_D(MAC,"Pointa %u, mu = %u, PRACH config index = %u, unpaired = %u\n", pointa, mu, config_index, unpaired);
|
||||
LOG_D(NR_MAC,"mu = %u, PRACH config index = %u, unpaired = %u\n", mu, config_index, unpaired);
|
||||
|
||||
prach_config_info_p = get_prach_config_info(pointa, config_index, unpaired);
|
||||
prach_config_info_p = get_prach_config_info(mac->frequency_range, config_index, unpaired);
|
||||
|
||||
if (pointa > 2016666) { //FR2
|
||||
if (mac->frequency_range == FR2) { //FR2
|
||||
|
||||
x = prach_config_info_p[2];
|
||||
y = prach_config_info_p[3];
|
||||
@@ -1169,6 +1276,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
prach_conf_start_symbol = prach_config_info_p[5];
|
||||
N_t_slot = prach_config_info_p[7];
|
||||
N_dur = prach_config_info_p[8];
|
||||
LOG_D(NR_MAC,"N_t_slot %d, N_dur %d\n",N_t_slot,N_dur);
|
||||
if (prach_config_info_p[1] != -1)
|
||||
format2 = (uint8_t) prach_config_info_p[1];
|
||||
format = ((uint8_t) prach_config_info_p[0]) | (format2<<8);
|
||||
@@ -1184,7 +1292,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
prach_assoc_pattern.nb_of_prach_conf_period_in_max_period = MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD / x;
|
||||
nb_of_frames_per_prach_conf_period = x;
|
||||
|
||||
LOG_D(MAC,"nb_of_prach_conf_period_in_max_period %d\n", prach_assoc_pattern.nb_of_prach_conf_period_in_max_period);
|
||||
LOG_D(NR_MAC,"nb_of_prach_conf_period_in_max_period %d\n", prach_assoc_pattern.nb_of_prach_conf_period_in_max_period);
|
||||
|
||||
// Fill in the PRACH occasions table for every slot in every frame in every PRACH configuration periods in the maximum association pattern period
|
||||
// ----------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -1196,14 +1304,14 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_frame = nb_of_frames_per_prach_conf_period;
|
||||
prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_slot = nr_slots_per_frame[mu];
|
||||
|
||||
LOG_D(MAC,"PRACH Conf Period Idx %d\n", prach_conf_period_idx);
|
||||
LOG_D(NR_MAC,"PRACH Conf Period Idx %d\n", prach_conf_period_idx);
|
||||
|
||||
// For every frames in a PRACH configuration period
|
||||
// ------------------------------------------------
|
||||
for (prach_conf_period_frame_idx=0; prach_conf_period_frame_idx<nb_of_frames_per_prach_conf_period; prach_conf_period_frame_idx++) {
|
||||
frame = (prach_conf_period_idx * nb_of_frames_per_prach_conf_period) + prach_conf_period_frame_idx;
|
||||
|
||||
LOG_D(MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", prach_conf_period_frame_idx, frame);
|
||||
LOG_D(NR_MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", prach_conf_period_frame_idx, frame);
|
||||
// Is it a valid frame for this PRACH configuration index? (n_sfn mod x = y)
|
||||
if ( (frame%x)==y || (frame%x)==y2 ) {
|
||||
|
||||
@@ -1230,7 +1338,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
|
||||
for (n_prach_occ_in_time=0; n_prach_occ_in_time<N_t_slot; n_prach_occ_in_time++) {
|
||||
uint8_t start_symbol = prach_conf_start_symbol + n_prach_occ_in_time * N_dur;
|
||||
LOG_D(MAC,"PRACH Occ in time %d\n", n_prach_occ_in_time);
|
||||
LOG_D(NR_MAC,"PRACH Occ in time %d\n", n_prach_occ_in_time);
|
||||
|
||||
for (n_prach_occ_in_freq=0; n_prach_occ_in_freq<nb_fdm; n_prach_occ_in_freq++) {
|
||||
prach_occasion_info_t *prach_occasion_p = &prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].prach_occasion[n_prach_occ_in_time][n_prach_occ_in_freq];
|
||||
@@ -1242,7 +1350,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
prach_occasion_p->format = format;
|
||||
prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_prach_occasion++;
|
||||
|
||||
LOG_D(MAC,"Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n",
|
||||
LOG_D(NR_MAC,"Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n",
|
||||
frame, slot, start_symbol, n_prach_occ_in_time, n_prach_occ_in_freq, prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].nb_of_prach_occasion,
|
||||
prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].nb_of_prach_occasion_in_time,
|
||||
prach_assoc_pattern.prach_conf_period_list[prach_conf_period_idx].prach_occasion_slot_map[prach_conf_period_frame_idx][slot].nb_of_prach_occasion_in_freq);
|
||||
@@ -1256,7 +1364,7 @@ static void build_ro_list(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired) {
|
||||
}
|
||||
|
||||
// Build the list of all the valid/transmitted SSBs according to the config
|
||||
static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) {
|
||||
static void build_ssb_list(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
// Create the list of transmitted SSBs
|
||||
// ===================================
|
||||
@@ -1264,19 +1372,21 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) {
|
||||
uint64_t ssb_positionsInBurst;
|
||||
uint8_t ssb_idx = 0;
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
if (mac->scc) {
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap:
|
||||
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap;
|
||||
|
||||
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap);
|
||||
LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
|
||||
for (uint8_t bit_nb=3; bit_nb<=3; bit_nb--) {
|
||||
// If SSB is transmitted
|
||||
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
|
||||
ssb_list.nb_tx_ssb++;
|
||||
ssb_list.tx_ssb[ssb_idx].transmitted = true;
|
||||
LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
}
|
||||
ssb_idx++;
|
||||
}
|
||||
@@ -1285,14 +1395,14 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) {
|
||||
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap;
|
||||
|
||||
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap);
|
||||
LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
|
||||
for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) {
|
||||
// If SSB is transmitted
|
||||
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
|
||||
ssb_list.nb_tx_ssb++;
|
||||
ssb_list.tx_ssb[ssb_idx].transmitted = true;
|
||||
LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
}
|
||||
ssb_idx++;
|
||||
}
|
||||
@@ -1301,14 +1411,14 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) {
|
||||
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.longBitmap;
|
||||
|
||||
ssb_positionsInBurst = BIT_STRING_to_uint64(ssb_bitmap);
|
||||
LOG_D(MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
|
||||
for (uint8_t bit_nb=63; bit_nb<=63; bit_nb--) {
|
||||
// If SSB is transmitted
|
||||
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
|
||||
ssb_list.nb_tx_ssb++;
|
||||
ssb_list.tx_ssb[ssb_idx].transmitted = true;
|
||||
LOG_D(MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
}
|
||||
ssb_idx++;
|
||||
}
|
||||
@@ -1316,16 +1426,36 @@ static void build_ssb_list(NR_ServingCellConfigCommon_t *scc) {
|
||||
default:
|
||||
AssertFatal(false,"ssb_PositionsInBurst not present\n");
|
||||
break;
|
||||
}
|
||||
} else { // This is configuration from SIB1
|
||||
|
||||
AssertFatal(mac->scc_SIB->ssb_PositionsInBurst.groupPresence == NULL, "Handle case for >8 SSBs\n");
|
||||
ssb_bitmap = &mac->scc_SIB->ssb_PositionsInBurst.inOneGroup;
|
||||
|
||||
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap);
|
||||
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
|
||||
|
||||
for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) {
|
||||
// If SSB is transmitted
|
||||
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
|
||||
ssb_list.nb_tx_ssb++;
|
||||
ssb_list.tx_ssb[ssb_idx].transmitted = true;
|
||||
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
|
||||
}
|
||||
ssb_idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Map the transmitted SSBs to the ROs and create the association pattern according to the config
|
||||
static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
// Map SSBs to PRACH occasions
|
||||
// ===========================
|
||||
// WIP: Assumption: No PRACH occasion is rejected because of a conflict with SSBs or TDD_UL_DL_ConfigurationCommon schedule
|
||||
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon_t *setup = (mac->scc) ?
|
||||
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
|
||||
|
||||
boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB
|
||||
@@ -1372,14 +1502,14 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config);
|
||||
break;
|
||||
}
|
||||
LOG_D(MAC,"SSB rach ratio %d, Multiple SSB per RO %d\n", ssb_rach_ratio, multiple_ssb_per_ro);
|
||||
LOG_D(NR_MAC,"SSB rach ratio %d, Multiple SSB per RO %d\n", ssb_rach_ratio, multiple_ssb_per_ro);
|
||||
|
||||
// Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period
|
||||
// ==============================================================================================================
|
||||
// WIP: Assumption for now is that all the PRACH configuration periods within a maximum association pattern period have the same number of PRACH occasions
|
||||
// (No PRACH occasions are conflicting with SSBs nor TDD_UL_DL_ConfigurationCommon schedule)
|
||||
// There is only one possible association period which can contain up to 16 PRACH configuration periods
|
||||
LOG_D(MAC,"Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period\n");
|
||||
LOG_D(NR_MAC,"Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period\n");
|
||||
if (true == multiple_ssb_per_ro) {
|
||||
required_nb_of_prach_occasion = ((ssb_list.nb_tx_ssb-1) + ssb_rach_ratio) / ssb_rach_ratio;
|
||||
}
|
||||
@@ -1387,6 +1517,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
required_nb_of_prach_occasion = ssb_list.nb_tx_ssb * ssb_rach_ratio;
|
||||
}
|
||||
|
||||
AssertFatal(prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion>0,"prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion shouldn't be 0 (ssb_list.nb_tx_ssb %d, ssb_rach_ratio %d\n",ssb_list.nb_tx_ssb,ssb_rach_ratio);
|
||||
required_nb_of_prach_conf_period = ((required_nb_of_prach_occasion-1) + prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion) / prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion;
|
||||
|
||||
if (required_nb_of_prach_conf_period == 1) {
|
||||
@@ -1412,7 +1543,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
prach_assoc_pattern.prach_association_period_list[0].nb_of_frame = prach_assoc_pattern.prach_association_period_list[0].nb_of_prach_conf_period * prach_assoc_pattern.prach_conf_period_list[0].nb_of_frame;
|
||||
prach_assoc_pattern.nb_of_frame = prach_assoc_pattern.prach_association_period_list[0].nb_of_frame;
|
||||
|
||||
LOG_D(MAC,"Assoc period %d, Nb of frames in assoc period %d\n",
|
||||
LOG_D(NR_MAC,"Assoc period %d, Nb of frames in assoc period %d\n",
|
||||
prach_assoc_pattern.prach_association_period_list[0].nb_of_prach_conf_period,
|
||||
prach_assoc_pattern.prach_association_period_list[0].nb_of_frame);
|
||||
|
||||
@@ -1424,7 +1555,7 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
prach_conf_period_t *prach_conf_period_p;
|
||||
|
||||
// Map all the association periods within the association pattern period
|
||||
LOG_D(MAC,"Proceed to the SSB to RO mapping\n");
|
||||
LOG_D(NR_MAC,"Proceed to the SSB to RO mapping\n");
|
||||
for (association_period_idx=0; association_period_idx<prach_assoc_pattern.nb_of_assoc_period; association_period_idx++) {
|
||||
uint8_t n_prach_conf=0; // PRACH Configuration period index within the association period
|
||||
uint8_t frame=0;
|
||||
@@ -1472,8 +1603,8 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++;
|
||||
AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro);
|
||||
|
||||
LOG_D(MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq);
|
||||
LOG_D(MAC,"Nb mapped ROs for this ssb idx: in the association period only %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro);
|
||||
LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq);
|
||||
LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro);
|
||||
|
||||
// If all the required SSBs are mapped to this RO, exit the loop of SSBs
|
||||
if (ro_p->nb_mapped_ssb == ssb_rach_ratio) {
|
||||
@@ -1520,6 +1651,9 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
for (ssb_idx=0; ssb_idx<MAX_NB_SSB; ssb_idx++) {
|
||||
uint8_t nb_mapped_ro_in_association_period=0; // Reset the nb of mapped ROs for the new SSB index
|
||||
|
||||
LOG_D(NR_MAC,"Checking ssb_idx %d => %d\n",
|
||||
ssb_idx,ssb_list.tx_ssb[ssb_idx].transmitted);
|
||||
|
||||
// Map only the transmitted ssb_idx
|
||||
if (true == ssb_list.tx_ssb[ssb_idx].transmitted) {
|
||||
|
||||
@@ -1544,8 +1678,8 @@ static void map_ssb_to_ro(NR_ServingCellConfigCommon_t *scc) {
|
||||
AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro);
|
||||
nb_mapped_ro_in_association_period++;
|
||||
|
||||
LOG_D(MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq);
|
||||
LOG_D(MAC,"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period);
|
||||
LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq);
|
||||
LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period);
|
||||
|
||||
// Exit the loop if this SSB has been mapped to all the required ROs
|
||||
// WIP: Assuming that ssb_rach_ratio equals the maximum nb of times a given ssb_idx is mapped within an association period:
|
||||
@@ -1608,7 +1742,9 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx,
|
||||
// - exact slot number
|
||||
// - frame offset
|
||||
ssb_info_p = &ssb_list.tx_ssb[ssb_idx];
|
||||
LOG_D(NR_MAC,"checking for prach : ssb_info_p->nb_mapped_ro %d\n",ssb_info_p->nb_mapped_ro);
|
||||
for (uint8_t n_mapped_ro=0; n_mapped_ro<ssb_info_p->nb_mapped_ro; n_mapped_ro++) {
|
||||
LOG_D(NR_MAC,"%d.%d: mapped_ro[%d]->frame.slot %d.%d, prach_assoc_pattern.nb_of_frame %d\n",frame,slot,n_mapped_ro,ssb_info_p->mapped_ro[n_mapped_ro]->frame,ssb_info_p->mapped_ro[n_mapped_ro]->slot,prach_assoc_pattern.nb_of_frame);
|
||||
if ((slot == ssb_info_p->mapped_ro[n_mapped_ro]->slot) &&
|
||||
(ssb_info_p->mapped_ro[n_mapped_ro]->frame == (frame % prach_assoc_pattern.nb_of_frame))) {
|
||||
|
||||
@@ -1668,24 +1804,24 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx,
|
||||
}
|
||||
|
||||
// Build the SSB to RO mapping upon RRC configuration update
|
||||
void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired){
|
||||
void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
// Clear all the lists and maps
|
||||
memset(&prach_assoc_pattern, 0, sizeof(prach_association_pattern_t));
|
||||
memset(&ssb_list, 0, sizeof(ssb_list_info_t));
|
||||
|
||||
// Build the list of all the valid RACH occasions in the maximum association pattern period according to the PRACH config
|
||||
LOG_D(MAC,"Build RO list\n");
|
||||
build_ro_list(scc, unpaired);
|
||||
LOG_D(NR_MAC,"Build RO list\n");
|
||||
build_ro_list(mac);
|
||||
|
||||
// Build the list of all the valid/transmitted SSBs according to the config
|
||||
LOG_D(MAC,"Build SSB list\n");
|
||||
build_ssb_list(scc);
|
||||
LOG_D(NR_MAC,"Build SSB list\n");
|
||||
build_ssb_list(mac);
|
||||
|
||||
// Map the transmitted SSBs to the ROs and create the association pattern according to the config
|
||||
LOG_D(MAC,"Map SSB to RO\n");
|
||||
map_ssb_to_ro(scc);
|
||||
LOG_D(MAC,"Map SSB to RO done\n");
|
||||
LOG_D(NR_MAC,"Map SSB to RO\n");
|
||||
map_ssb_to_ro(mac);
|
||||
LOG_D(NR_MAC,"Map SSB to RO done\n");
|
||||
}
|
||||
|
||||
// This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
|
||||
@@ -1709,13 +1845,17 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
nr_scheduled_response_t scheduled_response;
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (scc!=NULL) setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
else setup = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
|
||||
ra->RA_offset = 2; // to compensate the rx frame offset at the gNB
|
||||
ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = scc==NULL ? scc_SIB->tdd_UL_DL_ConfigurationCommon : scc->tdd_UL_DL_ConfigurationCommon;
|
||||
|
||||
if (is_nr_UL_slot(scc, slotP, mac->frame_type)) {
|
||||
if (is_nr_UL_slot(tdd_config, slotP, mac->frame_type)) {
|
||||
|
||||
// WIP Need to get the proper selected ssb_idx
|
||||
// Initial beam selection functionality is not available yet
|
||||
@@ -1745,7 +1885,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
|
||||
ncs = get_NCS(rach_ConfigGeneric->zeroCorrelationZoneConfig, format0, setup->restrictedSetConfig);
|
||||
|
||||
prach_config_pdu->phys_cell_id = *scc->physCellId;
|
||||
prach_config_pdu->phys_cell_id = mac->physCellId;
|
||||
prach_config_pdu->num_prach_ocas = 1;
|
||||
prach_config_pdu->prach_slot = prach_occasion_info_p->slot;
|
||||
prach_config_pdu->prach_start_symbol = prach_occasion_info_p->start_symbol;
|
||||
@@ -1756,7 +1896,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
prach_config_pdu->restricted_set = prach_config->restricted_set_config;
|
||||
prach_config_pdu->freq_msg1 = prach_config->num_prach_fd_occasions_list[prach_occasion_info_p->fdm].k1;
|
||||
|
||||
LOG_D(MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra);
|
||||
LOG_D(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra);
|
||||
|
||||
// Search which SSB is mapped in the RO (among all the SSBs mapped to this RO)
|
||||
for (prach_config_pdu->ssb_nb_in_ro=0; prach_config_pdu->ssb_nb_in_ro<prach_occasion_info_p->nb_mapped_ssb; prach_config_pdu->ssb_nb_in_ro++) {
|
||||
@@ -1825,6 +1965,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
} // if is_nr_UL_slot
|
||||
}
|
||||
|
||||
#define MAX_LCID 8 //Fixme: also defined in LCID table
|
||||
uint8_t
|
||||
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
@@ -1832,17 +1973,16 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
uint8_t total_rlc_pdu_header_len = 0;
|
||||
int16_t buflen_remain = 0;
|
||||
uint8_t lcid = 0;
|
||||
uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint16_t sdu_lengths[MAX_LCID] = { 0 };
|
||||
uint8_t sdu_lcids[MAX_LCID] = { 0 };
|
||||
uint16_t payload_offset = 0, num_sdus = 0;
|
||||
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
uint16_t sdu_length_total = 0;
|
||||
//unsigned short post_padding = 0;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||
|
||||
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
|
||||
0, lcid_buffer_occupancy_new = 0;
|
||||
LOG_D(MAC,
|
||||
rlc_buffer_occupancy_t lcid_buffer_occupancy_new = 0;
|
||||
LOG_D(NR_MAC,
|
||||
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
|
||||
module_idP, frameP, subframe, buflen);
|
||||
AssertFatal(CC_id == 0,
|
||||
@@ -1851,23 +1991,20 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
// Check for DCCH first
|
||||
// TO DO: Multiplex in the order defined by the logical channel prioritization
|
||||
for (lcid = UL_SCH_LCID_SRB1;
|
||||
lcid < NR_MAX_NUM_LCID; lcid++) {
|
||||
|
||||
lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid);
|
||||
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
|
||||
|
||||
if(lcid_buffer_occupancy_new){
|
||||
lcid < MAX_LCID; lcid++) {
|
||||
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid);
|
||||
|
||||
if(lcid_buffer_occupancy_new) {
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
|
||||
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
|
||||
module_idP, frameP, lcid, lcid_buffer_occupancy_new,
|
||||
buflen, sdu_length_total,
|
||||
total_rlc_pdu_header_len, buflen_remain); // ,nr_ue_mac_inst->scheduling_info.BSR_bytes[nr_ue_mac_inst->scheduling_info.LCGID[lcid]]
|
||||
|
||||
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
|
||||
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
|
||||
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
|
||||
mac->crnti,
|
||||
@@ -1895,20 +2032,13 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
}
|
||||
|
||||
/* Get updated BO after multiplexing this PDU */
|
||||
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,
|
||||
mac->crnti,
|
||||
eNB_index,
|
||||
frameP,
|
||||
subframe,
|
||||
ENB_FLAG_NO,
|
||||
lcid);
|
||||
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,mac->crnti,eNB_index,frameP, subframe, ENB_FLAG_NO, lcid);
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generate ULSCH PDU
|
||||
if (num_sdus>0) {
|
||||
payload_offset = nr_generate_ulsch_pdu(ulsch_sdus,
|
||||
@@ -1923,9 +2053,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
0, // long_bsr
|
||||
0, // post_padding
|
||||
buflen); // TBS in bytes
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
// Padding: fill remainder of ULSCH with 0
|
||||
if (buflen - payload_offset > 0){
|
||||
@@ -1934,7 +2064,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset);
|
||||
LOG_I(NR_MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset);
|
||||
for (int i = 0; i < buflen ; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
|
||||
@@ -54,6 +54,87 @@ extern RAN_CONTEXT_t RC;
|
||||
extern void mac_top_init_gNB(void);
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list,
|
||||
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
if (rlc_bearer2add_list)
|
||||
// keep lcids
|
||||
for (int i=0;i<rlc_bearer2add_list->list.count;i++) {
|
||||
sched_ctrl->lcid_mask |= (1<<rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
|
||||
LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n",
|
||||
(int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity,
|
||||
rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB",
|
||||
(int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
|
||||
}
|
||||
if (rlc_bearer2release_list)
|
||||
for (int i=0;i<rlc_bearer2release_list->list.count;i++)
|
||||
sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void process_drx_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_DRX_Config_t *drx_Config) {
|
||||
if (!drx_Config) return;
|
||||
AssertFatal(drx_Config->present != NR_SetupRelease_DRX_Config_PR_NOTHING, "Cannot have NR_SetupRelease_DRX_Config_PR_NOTHING\n");
|
||||
|
||||
if (drx_Config->present == NR_SetupRelease_DRX_Config_PR_setup) {
|
||||
LOG_I(NR_MAC,"Adding DRX config\n");
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC,"Removing DRX config\n");
|
||||
}
|
||||
}
|
||||
|
||||
void process_schedulingRequestConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_SchedulingRequestConfig_t *schedulingRequestConfig) {
|
||||
if (!schedulingRequestConfig) return;
|
||||
|
||||
LOG_I(NR_MAC,"Adding SchedulingRequestconfig\n");
|
||||
}
|
||||
|
||||
void process_bsrConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_BSR_Config_t *bsr_Config) {
|
||||
if (!bsr_Config) return;
|
||||
LOG_I(NR_MAC,"Adding BSR config\n");
|
||||
}
|
||||
|
||||
void process_tag_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_TAG_Config_t *tag_Config) {
|
||||
if (!tag_Config) return;
|
||||
LOG_I(NR_MAC,"Adding TAG config\n");
|
||||
}
|
||||
|
||||
void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_PHR_Config_t *phr_Config) {
|
||||
if (!phr_Config) return;
|
||||
AssertFatal(phr_Config->present != NR_SetupRelease_PHR_Config_PR_NOTHING, "Cannot have NR_SetupRelease_PHR_Config_PR_NOTHING\n");
|
||||
|
||||
if (phr_Config->present == NR_SetupRelease_PHR_Config_PR_setup) {
|
||||
LOG_I(NR_MAC,"Adding PHR config\n");
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC,"Removing PHR config\n");
|
||||
}
|
||||
}
|
||||
|
||||
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
AssertFatal(CellGroup, "CellGroup is null\n");
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = CellGroup->mac_CellGroupConfig;
|
||||
|
||||
|
||||
if (mac_CellGroupConfig) {
|
||||
process_drx_Config(sched_ctrl,mac_CellGroupConfig->drx_Config);
|
||||
process_schedulingRequestConfig(sched_ctrl,mac_CellGroupConfig->schedulingRequestConfig);
|
||||
process_bsrConfig(sched_ctrl,mac_CellGroupConfig->bsr_Config);
|
||||
process_tag_Config(sched_ctrl,mac_CellGroupConfig->tag_Config);
|
||||
process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config);
|
||||
}
|
||||
else {
|
||||
// apply defaults
|
||||
|
||||
}
|
||||
|
||||
process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList,CellGroup->rlc_BearerToReleaseList,sched_ctrl);
|
||||
|
||||
}
|
||||
void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
@@ -67,7 +148,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value);
|
||||
LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value);
|
||||
|
||||
cfg->carrier_config.dl_frequency.value = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
@@ -95,7 +176,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value);
|
||||
LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value);
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
@@ -298,7 +379,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
cfg->carrier_config.num_rx_ant.value = pusch_AntennaPorts;
|
||||
AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n");
|
||||
cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG;
|
||||
LOG_I(MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value);
|
||||
LOG_I(NR_MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value);
|
||||
AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value );
|
||||
cfg->num_tlv++;
|
||||
cfg->num_tlv++;
|
||||
@@ -315,7 +396,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
if(cfg->cell_config.frame_duplex_type.value == TDD){
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
||||
LOG_I(NR_MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
||||
int periods_per_frame = set_tdd_config_nr(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
@@ -324,9 +405,9 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
|
||||
|
||||
if (periods_per_frame < 0)
|
||||
LOG_E(MAC,"TDD configuration can not be done\n");
|
||||
LOG_E(NR_MAC,"TDD configuration can not be done\n");
|
||||
else {
|
||||
LOG_I(MAC,"TDD has been properly configurated\n");
|
||||
LOG_I(NR_MAC,"TDD has been properly configurated\n");
|
||||
RC.nrmac[Mod_idP]->tdd_beam_association = (int16_t *)malloc16(periods_per_frame*sizeof(int16_t));
|
||||
}
|
||||
}
|
||||
@@ -338,12 +419,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
int pusch_tgt_snrx10,
|
||||
int pucch_tgt_snrx10,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup){
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup) {
|
||||
|
||||
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);
|
||||
@@ -372,14 +451,14 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL,
|
||||
"could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n");
|
||||
|
||||
LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n");
|
||||
LOG_I(NR_MAC,"Configuring common parameters from NR ServingCellConfig\n");
|
||||
|
||||
config_common(Mod_idP,
|
||||
ssb_SubcarrierOffset,
|
||||
pdsch_AntennaPorts,
|
||||
pusch_AntennaPorts,
|
||||
scc);
|
||||
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
scc);
|
||||
LOG_D(NR_MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
@@ -389,10 +468,8 @@ 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]->pusch_target_snrx10 = pusch_tgt_snrx10;
|
||||
RC.nrmac[Mod_idP]->pucch_target_snrx10 = pucch_tgt_snrx10;
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
phycfg.Mod_id = Mod_idP;
|
||||
phycfg.CC_id = 0;
|
||||
@@ -407,14 +484,14 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots;
|
||||
const int nr_dlmix_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0);
|
||||
const int nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0);
|
||||
|
||||
for (int slot = 0; slot < n; ++slot) {
|
||||
/* FIXME: it seems there is a problem with slot 0/10/slots right after UL:
|
||||
* we just get retransmissions. Thus, do not schedule such slots in DL */
|
||||
if (slot % nr_slots_period != 0)
|
||||
RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) < nr_dlmix_slots) << (slot % 64);
|
||||
RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64);
|
||||
LOG_D(MAC,
|
||||
"slot %d DL %d UL %d\n",
|
||||
LOG_D(NR_MAC, "slot %d DL %d UL %d\n",
|
||||
slot,
|
||||
(RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0,
|
||||
(RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0);
|
||||
@@ -427,32 +504,47 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
RC.nrmac[Mod_idP]->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(Mod_idP, 0);
|
||||
RC.nrmac[Mod_idP]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(Mod_idP, 0);
|
||||
}
|
||||
|
||||
if (get_softmodem_params()->sa > 0) {
|
||||
NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0];
|
||||
for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) {
|
||||
cc->ra[n].cfra = false;
|
||||
cc->ra[n].rnti = 0;
|
||||
cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
|
||||
cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
|
||||
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
|
||||
cc->ra[n].preambles.preamble_list[i] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (secondaryCellGroup) {
|
||||
if (CellGroup) {
|
||||
|
||||
RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup;
|
||||
const NR_ServingCellConfig_t *servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated;
|
||||
|
||||
const NR_ServingCellConfig_t *servingCellConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated;
|
||||
const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList;
|
||||
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);
|
||||
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;
|
||||
AssertFatal(ubwpList->list.count > 0, "downlinkBWP_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);
|
||||
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList;
|
||||
if(ubwpList) {
|
||||
AssertFatal(ubwpList->list.count > 0, "downlinkBWP_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, secondaryCellGroup);
|
||||
LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti);
|
||||
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]);
|
||||
} 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];
|
||||
@@ -462,16 +554,17 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
if((cc->ra[ra_index].state == RA_IDLE) && (!cc->ra[ra_index].cfra)) break;
|
||||
}
|
||||
if (ra_index == NR_NB_RA_PROC_MAX) {
|
||||
LOG_E(MAC, "%s() %s:%d RA processes are not available for CFRA RNTI :%x\n", __FUNCTION__, __FILE__, __LINE__, rnti);
|
||||
LOG_E(NR_MAC, "%s() %s:%d RA processes are not available for CFRA RNTI :%x\n", __FUNCTION__, __FILE__, __LINE__, rnti);
|
||||
return -1;
|
||||
}
|
||||
NR_RA_t *ra = &cc->ra[ra_index];
|
||||
ra->secondaryCellGroup = secondaryCellGroup;
|
||||
if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) {
|
||||
if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) {
|
||||
ra->CellGroup = CellGroup;
|
||||
if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync &&
|
||||
CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) {
|
||||
if (CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) {
|
||||
ra->cfra = true;
|
||||
ra->rnti = rnti;
|
||||
struct NR_CFRA *cfra = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra;
|
||||
struct NR_CFRA *cfra = CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra;
|
||||
uint8_t num_preamble = cfra->resources.choice.ssb->ssb_ResourceList.list.count;
|
||||
ra->preambles.num_preambles = num_preamble;
|
||||
ra->preambles.preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
|
||||
@@ -494,11 +587,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
|
||||
ra->preambles.preamble_list[i] = i;
|
||||
}
|
||||
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
|
||||
} else { // secondaryCellGroup has been updated
|
||||
LOG_I(NR_MAC,"Added new RA process for UE RNTI %04x with initial CellGroup\n", rnti);
|
||||
} else { // CellGroup has been updated
|
||||
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
|
||||
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -66,7 +66,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
|
||||
NR_UE_info_t *UE_info = &gNB->UE_info;
|
||||
int num = 1;
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
|
||||
LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n",
|
||||
LOG_I(NR_MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n",
|
||||
UE_id,
|
||||
UE_info->rnti[UE_id],
|
||||
num++,
|
||||
@@ -75,32 +75,29 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
|
||||
UE_info->UE_sched_ctrl[UE_id].pcmax);
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
|
||||
LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n",
|
||||
LOG_I(NR_MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n",
|
||||
UE_id,
|
||||
stats->dlsch_rounds[0], stats->dlsch_rounds[1],
|
||||
stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors,
|
||||
avg_rsrp, stats->num_rsrp_meas);
|
||||
stats->num_rsrp_meas = 0;
|
||||
stats->cumul_rsrp = 0 ;
|
||||
LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
|
||||
const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d, PUSCH SNR %2.1f dB, PUCCH SNR %2.1f dB, noise rssi %2.1f dB\n",
|
||||
LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
|
||||
LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
|
||||
UE_id,
|
||||
stats->ulsch_rounds[0], stats->ulsch_rounds[1],
|
||||
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
|
||||
stats->ulsch_errors,
|
||||
(float) sched_ctrl->pusch_snrx10 / 10,
|
||||
(float) sched_ctrl->pucch_snrx10 / 10,
|
||||
(float) (sched_ctrl->raw_rssi - 1280) / 10);
|
||||
LOG_I(MAC,
|
||||
stats->ulsch_DTX,
|
||||
stats->ulsch_errors);
|
||||
LOG_I(NR_MAC,
|
||||
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
|
||||
UE_id,
|
||||
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
|
||||
for (int lc_id = 0; lc_id < 63; lc_id++) {
|
||||
if (stats->lc_bytes_tx[lc_id] > 0)
|
||||
LOG_I(MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
if (stats->lc_bytes_rx[lc_id] > 0)
|
||||
LOG_I(MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
}
|
||||
}
|
||||
print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL);
|
||||
@@ -322,9 +319,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frame,
|
||||
sub_frame_t slot){
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
protocol_ctxt_t ctxt={0};
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
|
||||
|
||||
|
||||
const int bwp_id = 1;
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
@@ -355,7 +352,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing);
|
||||
}
|
||||
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0
|
||||
memset(RC.nrmac[module_idP]->cce_list[0][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id])
|
||||
|
||||
@@ -246,7 +246,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
|
||||
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[0][slotP];
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0];
|
||||
|
||||
if (is_nr_UL_slot(scc, slotP, cc->frame_type)) {
|
||||
if (is_nr_UL_slot(scc->tdd_UL_DL_ConfigurationCommon, slotP, cc->frame_type)) {
|
||||
|
||||
uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot;
|
||||
@@ -539,10 +539,13 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
else
|
||||
ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8);
|
||||
|
||||
ra->bwp_id = 1;
|
||||
NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP
|
||||
if(get_softmodem_params()->sa != 1) {
|
||||
bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
// This should be handled differently when we use the initialBWP for RA
|
||||
ra->bwp_id = 0;
|
||||
NR_BWP_Downlink_t *bwp=NULL;
|
||||
if (ra->CellGroup && ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
|
||||
ra->bwp_id = 1;
|
||||
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
|
||||
@@ -585,13 +588,15 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
}
|
||||
AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n");
|
||||
|
||||
// Common searchspace list
|
||||
// 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");
|
||||
|
||||
// retrieving ra pdcch monitoring period and offset
|
||||
find_monitoring_periodicity_offset_common(ra->ra_ss, &monitoring_slot_period, &monitoring_offset);
|
||||
|
||||
@@ -612,8 +617,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
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;
|
||||
// This condition allows for the usage of a preconfigured rnti for the first UE
|
||||
if (!ra->cfra || ra->rnti == 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++;
|
||||
@@ -690,12 +694,18 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
|
||||
uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes
|
||||
|
||||
int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
int mu = ubwp ?
|
||||
ubwp->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot;
|
||||
ra->Msg3_tda_id = 16; // initialization to a value above limit
|
||||
|
||||
for (int i=0; i<ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count; i++) {
|
||||
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList= ubwp ?
|
||||
ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
|
||||
for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) {
|
||||
startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
|
||||
// we want to transmit in the uplink symbols of mixed slot
|
||||
if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) {
|
||||
@@ -705,7 +715,7 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
}
|
||||
AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n");
|
||||
|
||||
uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2;
|
||||
uint8_t k2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2;
|
||||
|
||||
temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213
|
||||
ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu];
|
||||
@@ -729,7 +739,10 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex);
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE];
|
||||
const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint16_t bwpSize = NRRIV2BW(ubwp ?
|
||||
ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
|
||||
/* search msg3_nb_rb free RBs */
|
||||
int rbSize = 0;
|
||||
@@ -786,13 +799,28 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu;
|
||||
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
|
||||
future_ul_tti_req->n_pdus += 1;
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int abwp_size = ibwp_size;
|
||||
int abwp_start = ibwp_start;
|
||||
int scs = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
int fh = 0;
|
||||
int startSymbolAndLength = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength;
|
||||
int mappingtype = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType;
|
||||
|
||||
if (ra->CellGroup) {
|
||||
AssertFatal(ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n", ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
||||
NR_BWP_Uplink_t *ubwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
|
||||
|
||||
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength;
|
||||
mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType;
|
||||
abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
scs = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
fh = ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping ? 1 : 0;
|
||||
}
|
||||
|
||||
AssertFatal(ra->secondaryCellGroup,
|
||||
"no secondaryCellGroup for RNTI %04x\n",
|
||||
ra->crnti);
|
||||
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
||||
NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
|
||||
LOG_D(NR_MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
|
||||
frameP,
|
||||
slotP,
|
||||
@@ -803,24 +831,19 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
ra->msg3_round,
|
||||
ra->rnti);
|
||||
|
||||
int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength;
|
||||
int start_symbol_index,nr_of_symbols;
|
||||
SLIV2SL(startSymbolAndLength, &start_symbol_index, &nr_of_symbols);
|
||||
int mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType;
|
||||
|
||||
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_pdu->rnti = ra->rnti;
|
||||
pusch_pdu->handle = 0;
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
pusch_pdu->bwp_start = ibwp_start;
|
||||
pusch_pdu->bwp_size = ibwp_size;
|
||||
pusch_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pusch_pdu->subcarrier_spacing = scs;
|
||||
pusch_pdu->cyclic_prefix = 0;
|
||||
pusch_pdu->mcs_index = 0;
|
||||
pusch_pdu->mcs_table = 0;
|
||||
@@ -849,10 +872,8 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
else
|
||||
pusch_pdu->rb_size = ra->msg3_nb_rb;
|
||||
pusch_pdu->vrb_to_prb_mapping = 0;
|
||||
if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping == NULL)
|
||||
pusch_pdu->frequency_hopping = 0;
|
||||
else
|
||||
pusch_pdu->frequency_hopping = 1;
|
||||
|
||||
pusch_pdu->frequency_hopping = fh;
|
||||
//pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
|
||||
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
|
||||
//Resource Allocation in time domain
|
||||
@@ -894,24 +915,29 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP
|
||||
if(get_softmodem_params()->sa != 1) {
|
||||
bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
}
|
||||
|
||||
NR_BWP_Downlink_t *bwp = NULL;
|
||||
NR_ControlResourceSet_t *coreset = NULL;
|
||||
if(bwp) {
|
||||
coreset = get_coreset(bwp, ss, 0);
|
||||
} else {
|
||||
coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
}
|
||||
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList=NULL;
|
||||
long BWPStart = 0;
|
||||
if (get_softmodem_params()->sa != 1) {
|
||||
BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
} else {
|
||||
BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
if (ra->CellGroup &&
|
||||
ra->CellGroup->spCellConfig &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]) {
|
||||
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
genericParameters = &bwp->bwp_Common->genericParameters;
|
||||
pdsch_TimeDomainAllocationList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
}
|
||||
else {
|
||||
genericParameters= &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
}
|
||||
BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
coreset = get_coreset(scc,bwp, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
|
||||
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg2\n");
|
||||
|
||||
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||
for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) {
|
||||
@@ -944,25 +970,19 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
// Calculate number of symbols
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->
|
||||
downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
|
||||
pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n");
|
||||
|
||||
int mappingtype = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->
|
||||
downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
|
||||
pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
LOG_D(MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",startSymbolIndex,nrOfSymbols);
|
||||
|
||||
uint8_t numDmrsCdmGrpsNoData = 2;
|
||||
if (nrOfSymbols == 2) {
|
||||
numDmrsCdmGrpsNoData = 1;
|
||||
}
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
|
||||
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
|
||||
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
|
||||
const int bwpid = bwp ? bwp->bwp_Id : 0;
|
||||
const int coresetid = coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid];
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
|
||||
if (!pdcch_pdu_rel15) {
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
@@ -971,7 +991,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_req->nPDUs += 1;
|
||||
pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp);
|
||||
nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15;
|
||||
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
|
||||
}
|
||||
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
@@ -984,36 +1004,39 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
LOG_I(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d\n",
|
||||
module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state);
|
||||
|
||||
AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->RA_rnti);
|
||||
|
||||
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||
ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
||||
|
||||
// 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.
|
||||
const int pduindex = nr_mac->pdu_index[CC_id]++;
|
||||
|
||||
uint8_t mcsTableIdx = 0;
|
||||
if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL)
|
||||
mcsTableIdx = 0;
|
||||
else{
|
||||
if (bwp &&
|
||||
bwp->bwp_Dedicated &&
|
||||
bwp->bwp_Dedicated->pdsch_Config &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table) {
|
||||
if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0)
|
||||
mcsTableIdx = 1;
|
||||
else
|
||||
mcsTableIdx = 2;
|
||||
}
|
||||
else mcsTableIdx = 0;
|
||||
|
||||
AssertFatal(numDmrsCdmGrpsNoData == 1 || numDmrsCdmGrpsNoData == 2,
|
||||
"nr_mac->schedCtrlCommon->numDmrsCdmGrpsNoData %d is not possible",
|
||||
numDmrsCdmGrpsNoData);
|
||||
int dmrsConfigType=0;
|
||||
if (bwp &&
|
||||
bwp->bwp_Dedicated &&
|
||||
bwp->bwp_Dedicated->pdsch_Config &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)
|
||||
dmrsConfigType = 1;
|
||||
|
||||
pdsch_pdu_rel15->pduBitmap = 0;
|
||||
pdsch_pdu_rel15->rnti = ra->RA_rnti;
|
||||
pdsch_pdu_rel15->pduIndex = pduindex;
|
||||
pdsch_pdu_rel15->BWPSize = BWPSize;
|
||||
pdsch_pdu_rel15->BWPStart = BWPStart;
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
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);
|
||||
@@ -1025,10 +1048,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||
pdsch_pdu_rel15->refPoint = 0;
|
||||
pdsch_pdu_rel15->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0;
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->SCID = 0;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <= 2 ? 1 : 2;
|
||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||
pdsch_pdu_rel15->rbStart = rbStart;
|
||||
@@ -1088,19 +1111,21 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdcch_pdu_rel15->DurationSymbols);
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
nr_mac->secondaryCellGroupCommon,
|
||||
ra->CellGroup,
|
||||
&pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1],
|
||||
&dci_payload,
|
||||
NR_DL_DCI_FORMAT_1_0,
|
||||
NR_RNTI_RA,
|
||||
pdsch_pdu_rel15->BWPSize,
|
||||
ra->bwp_id);
|
||||
bwpid);
|
||||
|
||||
// DL TX request
|
||||
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
|
||||
|
||||
// Program UL processing for Msg3
|
||||
NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
NR_BWP_Uplink_t *ubwp = ra->CellGroup ?
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1] :
|
||||
NULL;
|
||||
nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra, nr_mac->tdd_beam_association);
|
||||
nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]);
|
||||
|
||||
@@ -1142,24 +1167,34 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
NR_SearchSpace_t *ss = ra->ra_ss;
|
||||
|
||||
NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP
|
||||
if(get_softmodem_params()->sa != 1) {
|
||||
bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
}
|
||||
|
||||
NR_BWP_Downlink_t *bwp = NULL;
|
||||
NR_ControlResourceSet_t *coreset = NULL;
|
||||
if(bwp) {
|
||||
coreset = get_coreset(bwp, ss, 0);
|
||||
} else {
|
||||
coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList=NULL;
|
||||
|
||||
if (ra->CellGroup &&
|
||||
ra->CellGroup->spCellConfig &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList &&
|
||||
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]) {
|
||||
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
genericParameters = &bwp->bwp_Common->genericParameters;
|
||||
pdsch_TimeDomainAllocationList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
}
|
||||
else {
|
||||
genericParameters= &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
}
|
||||
coreset = get_coreset(scc,bwp, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
|
||||
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg4\n");
|
||||
|
||||
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];
|
||||
|
||||
long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
long BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
long BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
long BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// HARQ management
|
||||
AssertFatal(sched_ctrl->available_dl_harq.head >= 0,
|
||||
@@ -1172,7 +1207,27 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
harq->is_waiting = true;
|
||||
ra->harq_pid = current_harq_pid;
|
||||
|
||||
int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP);
|
||||
// get CCEindex, needed also for PUCCH and then later for PDCCH
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates);
|
||||
if (CCEIndex < 0) {
|
||||
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
int n_rb=0;
|
||||
for (int i=0;i<6;i++)
|
||||
for (int j=0;j<8;j++) {
|
||||
n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1);
|
||||
}
|
||||
n_rb*=6;
|
||||
const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE;
|
||||
const int delta_PRI=0;
|
||||
int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1);
|
||||
|
||||
int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP, r_pucch);
|
||||
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;
|
||||
@@ -1189,22 +1244,18 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length;
|
||||
mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
|
||||
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + 2 bytes), mac_pdu_length %d\n",mac_sdu_length,mac_pdu_length);
|
||||
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", mac_sdu_length, (int)sizeof(NR_MAC_SUBHEADER_SHORT), mac_pdu_length);
|
||||
|
||||
// Calculate number of symbols
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->
|
||||
downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
|
||||
pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n");
|
||||
|
||||
int mappingtype = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->
|
||||
downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
|
||||
pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL,
|
||||
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype);
|
||||
@@ -1232,14 +1283,17 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
}
|
||||
|
||||
uint8_t mcsTableIdx = 0;
|
||||
if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL)
|
||||
mcsTableIdx = 0;
|
||||
else{
|
||||
if (bwp &&
|
||||
bwp->bwp_Dedicated &&
|
||||
bwp->bwp_Dedicated->pdsch_Config &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table) {
|
||||
if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0)
|
||||
mcsTableIdx = 1;
|
||||
else
|
||||
mcsTableIdx = 2;
|
||||
}
|
||||
else mcsTableIdx = 0;
|
||||
|
||||
int rbStart = 0;
|
||||
int rbSize = 0;
|
||||
@@ -1272,19 +1326,12 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates);
|
||||
if (CCEIndex < 0) {
|
||||
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
|
||||
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
|
||||
const int bwpid = bwp ? bwp->bwp_Id : 0;
|
||||
const int coresetid = coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid];
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
|
||||
if (!pdcch_pdu_rel15) {
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
@@ -1293,7 +1340,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_req->nPDUs += 1;
|
||||
pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp);
|
||||
nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15;
|
||||
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
|
||||
}
|
||||
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
@@ -1305,12 +1352,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
LOG_I(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);
|
||||
|
||||
AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->rnti);
|
||||
|
||||
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||
ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
||||
|
||||
// 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.
|
||||
const int pduindex = nr_mac->pdu_index[CC_id]++;
|
||||
@@ -1320,7 +1361,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->pduIndex = pduindex;
|
||||
pdsch_pdu_rel15->BWPSize = BWPSize;
|
||||
pdsch_pdu_rel15->BWPStart = BWPStart;
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
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);
|
||||
@@ -1335,7 +1376,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->SCID = 0;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <= 2 ? 1 : 2;
|
||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||
pdsch_pdu_rel15->rbStart = rbStart;
|
||||
@@ -1380,11 +1421,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_payload.ndi = harq->ndi;
|
||||
dci_payload.dai[0].val = (pucch->dai_c-1)&3;
|
||||
dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213
|
||||
dci_payload.pucch_resource_indicator = pucch->resource_indicator;
|
||||
dci_payload.pucch_resource_indicator = delta_PRI; // This is delta_PRI from 9.2.1 in 38.213
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
|
||||
"[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d pucchres %d harqtiming %d\n",
|
||||
dci_payload.frequency_domain_assignment.val,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
@@ -1392,7 +1433,9 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_payload.time_domain_assignment.val,
|
||||
dci_payload.vrb_to_prb_mapping.val,
|
||||
dci_payload.mcs,
|
||||
dci_payload.tb_scaling);
|
||||
dci_payload.tb_scaling,
|
||||
dci_payload.pucch_resource_indicator,
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val);
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
||||
@@ -1404,13 +1447,13 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdcch_pdu_rel15->DurationSymbols);
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
nr_mac->secondaryCellGroupCommon,
|
||||
ra->CellGroup,
|
||||
&pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1],
|
||||
&dci_payload,
|
||||
NR_DL_DCI_FORMAT_1_0,
|
||||
NR_RNTI_TC,
|
||||
pdsch_pdu_rel15->BWPSize,
|
||||
ra->bwp_id);
|
||||
bwpid);
|
||||
|
||||
// Add padding header and zero rest out if there is space left
|
||||
if (mac_pdu_length < harq->tb_size) {
|
||||
@@ -1475,6 +1518,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
nr_clear_ra_proc(module_id, CC_id, frame, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
UE_info->Msg4_ACKed[UE_id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -139,8 +139,7 @@ void schedule_ssb(frame_t frame, sub_frame_t slot,
|
||||
|
||||
}
|
||||
|
||||
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
{
|
||||
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc;
|
||||
nfapi_nr_dl_tti_request_t *dl_tti_request;
|
||||
@@ -380,14 +379,13 @@ void schedule_control_sib1(module_id_t module_id,
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype);
|
||||
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||
|
||||
LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos);
|
||||
int rbSize = 0;
|
||||
uint32_t TBS = 0;
|
||||
do {
|
||||
rbSize++;
|
||||
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
|
||||
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
|
||||
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
|
||||
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
|
||||
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
|
||||
} while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes);
|
||||
|
||||
@@ -398,6 +396,8 @@ void schedule_control_sib1(module_id_t module_id,
|
||||
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
|
||||
LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
|
||||
LOG_D(MAC,"TBS = %i\n", TBS);
|
||||
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
|
||||
LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
|
||||
LOG_D(MAC,"mappingtype = %d\n", mappingtype);
|
||||
|
||||
// Mark the corresponding RBs as used
|
||||
@@ -417,7 +417,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP];
|
||||
NR_COMMON_channels_t *cc = gNB_mac->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon;
|
||||
NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp;
|
||||
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
@@ -524,7 +523,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
int rnti_type = NR_RNTI_SI;
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
secondaryCellGroup,
|
||||
NULL,
|
||||
&pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1],
|
||||
&dci_payload,
|
||||
dci_format,
|
||||
|
||||
@@ -55,11 +55,12 @@
|
||||
#define HALFWORD 16
|
||||
#define WORD 32
|
||||
//#define SIZE_OF_POINTER sizeof (void *)
|
||||
static int loop_dcch_dtch = DL_SCH_LCID_DTCH;
|
||||
|
||||
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_Id;
|
||||
const int bwp_id = bwp ? bwp->bwp_Id : 0;
|
||||
if (nrmac->preferred_dl_tda[bwp_id])
|
||||
return;
|
||||
|
||||
@@ -69,9 +70,10 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *
|
||||
scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||
const int symb_dlMixed = tdd ? (1 << tdd->nrofDownlinkSymbols) - 1 : 0;
|
||||
|
||||
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
const NR_SearchSpace_t *search_space = get_searchspace(bwp, target_ss);
|
||||
const NR_ControlResourceSet_t *coreset = get_coreset(bwp, search_space, 1 /* dedicated */);
|
||||
const int target_ss = bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common;
|
||||
NR_SearchSpace_t *search_space = get_searchspace(scc, bwp ? bwp->bwp_Dedicated : NULL, target_ss);
|
||||
const NR_ControlResourceSet_t *coreset = get_coreset(scc, (NR_BWP_Downlink_t*)bwp, search_space, target_ss);
|
||||
|
||||
// get coreset symbol "map"
|
||||
const uint16_t symb_coreset = (1 << coreset->duration) - 1;
|
||||
|
||||
@@ -176,7 +178,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
((NR_MAC_CE_TA *) ce_ptr)->TAGID = tag_id;
|
||||
}
|
||||
|
||||
LOG_D(MAC, "NR MAC CE timing advance command = %d (%d) TAG ID = %d\n", timing_advance_cmd, ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND, tag_id);
|
||||
LOG_D(NR_MAC, "NR MAC CE timing advance command = %d (%d) TAG ID = %d\n", timing_advance_cmd, ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND, tag_id);
|
||||
mac_ce_size = sizeof(NR_MAC_CE_TA);
|
||||
// Copying bytes for MAC CEs to the mac pdu pointer
|
||||
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
|
||||
@@ -195,7 +197,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
// contention resolution identity MAC ce has a fixed 48 bit size
|
||||
// this contains the UL CCCH SDU. If UL CCCH SDU is longer than 48 bits,
|
||||
// it contains the first 48 bits of the UL CCCH SDU
|
||||
LOG_T(MAC, "[gNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
|
||||
LOG_T(NR_MAC, "[gNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
|
||||
ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2],
|
||||
ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]);
|
||||
// Copying bytes (6 octects) to CEs pointer
|
||||
@@ -220,7 +222,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
nr_UESpec_TCI_StateInd_PDCCH.ServingCellId = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId) & 0x1F; //extracting LSB 5 Bits
|
||||
nr_UESpec_TCI_StateInd_PDCCH.TciStateId = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId) & 0x7F; //extracting LSB 7 bits
|
||||
nr_UESpec_TCI_StateInd_PDCCH.CoresetId2 = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId) & 0x1; //extracting LSB 1 bit
|
||||
LOG_D(MAC, "NR MAC CE TCI state indication for UE Specific PDCCH = %d \n", nr_UESpec_TCI_StateInd_PDCCH.TciStateId);
|
||||
LOG_D(NR_MAC, "NR MAC CE TCI state indication for UE Specific PDCCH = %d \n", nr_UESpec_TCI_StateInd_PDCCH.TciStateId);
|
||||
mac_ce_size = sizeof(NR_TCI_PDCCH);
|
||||
// Copying bytes for MAC CEs to the mac pdu pointer
|
||||
memcpy((void *) mac_pdu_ptr, (void *)&nr_UESpec_TCI_StateInd_PDCCH, mac_ce_size);
|
||||
@@ -331,7 +333,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->BWPID = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.bwpid & 0x3; //2 bits
|
||||
((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->CSIRS_RSC_ID = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.rsc_id & 0xF; //4 bits
|
||||
((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->R = 0;
|
||||
LOG_D(MAC, "NR MAC CE of ZP CSIRS Serv cell ID = %d BWPID= %d Rsc set ID = %d\n", ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.serv_cell_id, ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.bwpid,
|
||||
LOG_D(NR_MAC, "NR MAC CE of ZP CSIRS Serv cell ID = %d BWPID= %d Rsc set ID = %d\n", ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.serv_cell_id, ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.bwpid,
|
||||
ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.rsc_id);
|
||||
mac_ce_size = sizeof(NR_MAC_CE_SP_ZP_CSI_RS_RES_SET);
|
||||
mac_pdu_ptr += (unsigned char) mac_ce_size;
|
||||
@@ -388,7 +390,15 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
sched_ctrl->num_total_bytes = 0;
|
||||
const int lcid = DL_SCH_LCID_DTCH;
|
||||
if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DTCH;
|
||||
else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH;
|
||||
else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH1;
|
||||
|
||||
const int lcid = loop_dcch_dtch;
|
||||
// const int lcid = DL_SCH_LCID_DTCH;
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
|
||||
rnti,
|
||||
@@ -401,11 +411,23 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
0,
|
||||
0);
|
||||
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
||||
LOG_D(MAC,
|
||||
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
|
||||
frame,
|
||||
slot,
|
||||
lcid,
|
||||
sched_ctrl->num_total_bytes);
|
||||
|
||||
if (sched_ctrl->num_total_bytes == 0
|
||||
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
|
||||
return;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
__func__,
|
||||
frame,
|
||||
slot,
|
||||
lcid<4?"DCCH":"DTCH",
|
||||
lcid,
|
||||
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
||||
sched_ctrl->ta_apply);
|
||||
@@ -418,18 +440,25 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
uint8_t *rballoc_mask,
|
||||
int *n_rb_sched,
|
||||
int UE_id,
|
||||
int current_harq_pid)
|
||||
{
|
||||
int current_harq_pid) {
|
||||
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
|
||||
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_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch;
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_bwp ?
|
||||
&sched_ctrl->active_bwp->bwp_Common->genericParameters :
|
||||
&RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? (f ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2)) : (ps->nrOfSymbols == 2 ? 1 : 2);
|
||||
|
||||
int rbSize = 0;
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot];
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
/* Check that there are enough resources for retransmission */
|
||||
while (rbSize < retInfo->rbSize) {
|
||||
@@ -438,7 +467,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart])
|
||||
rbStart++;
|
||||
if (rbStart >= bwpSize) {
|
||||
LOG_D(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 UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]);
|
||||
return false;
|
||||
}
|
||||
while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && rbSize < retInfo->rbSize)
|
||||
@@ -446,10 +475,9 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
}
|
||||
/* check whether we need to switch the TDA allocation since the last
|
||||
* (re-)transmission */
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pdsch_semi_static(
|
||||
scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
} else {
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
@@ -459,7 +487,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
rbSize++;
|
||||
NR_pdsch_semi_static_t temp_ps;
|
||||
nr_set_pdsch_semi_static(
|
||||
scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, &temp_ps);
|
||||
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, &temp_ps);
|
||||
uint32_t new_tbs;
|
||||
uint16_t new_rbSize;
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
@@ -492,7 +520,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
|
||||
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1);
|
||||
if (alloc<0) {
|
||||
LOG_D(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
@@ -532,8 +560,10 @@ void pf_dl(module_id_t module_id,
|
||||
int max_num_ue,
|
||||
int n_rb_sched,
|
||||
uint8_t *rballoc_mask) {
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
|
||||
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];
|
||||
@@ -541,6 +571,7 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
/* 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;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
@@ -558,7 +589,7 @@ void pf_dl(module_id_t module_id,
|
||||
bool r = allocate_dl_retransmission(
|
||||
module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid);
|
||||
if (!r) {
|
||||
LOG_D(MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot);
|
||||
LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot);
|
||||
continue;
|
||||
}
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
@@ -573,7 +604,7 @@ void pf_dl(module_id_t module_id,
|
||||
sched_pdsch->mcs = 9;
|
||||
uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs];
|
||||
coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id];
|
||||
LOG_D(MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
|
||||
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]);
|
||||
/* Create UE_sched list for UEs eligible for new transmission*/
|
||||
add_tail_nr_list(&UE_sched, UE_id);
|
||||
@@ -601,14 +632,19 @@ void pf_dl(module_id_t module_id,
|
||||
*p = -1;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_bwp ?
|
||||
&sched_ctrl->active_bwp->bwp_Common->genericParameters:
|
||||
&scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
/* Find a free CCE */
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
if (!freeCCE) {
|
||||
LOG_D(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 UE %d/RNTI %04x\n", frame, slot, UE_id, rnti);
|
||||
continue;
|
||||
}
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
@@ -617,9 +653,9 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1);
|
||||
if (alloc<0) {
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
__func__,
|
||||
UE_id,
|
||||
@@ -628,7 +664,7 @@ void pf_dl(module_id_t module_id,
|
||||
slot);
|
||||
int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
UE_info->num_pdcch_cand[UE_id][cid]--;
|
||||
int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid];
|
||||
int *cce_list = mac->cce_list[bwp_Id][cid];
|
||||
for (int i = 0; i < sched_ctrl->aggregation_level; i++)
|
||||
cce_list[sched_ctrl->cce_index + i] = 0;
|
||||
return;
|
||||
@@ -641,13 +677,14 @@ void pf_dl(module_id_t module_id,
|
||||
max_rbSize++;
|
||||
|
||||
/* MCS has been set above */
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot];
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? (f ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2)) : (ps->nrOfSymbols == 2 ? 1 : 2);
|
||||
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pdsch_semi_static(
|
||||
scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
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->pucch_allocation = alloc;
|
||||
@@ -677,6 +714,7 @@ void pf_dl(module_id_t module_id,
|
||||
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_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
|
||||
|
||||
if (UE_info->num_UEs == 0)
|
||||
return;
|
||||
@@ -688,11 +726,10 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
int UE_id = UE_info->list.head;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot];
|
||||
if (tda < 0)
|
||||
return;
|
||||
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp ?
|
||||
sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
|
||||
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||
uint8_t rballoc_mask[bwpSize];
|
||||
@@ -764,6 +801,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
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];
|
||||
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;
|
||||
|
||||
@@ -773,7 +811,7 @@ 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(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 %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot);
|
||||
}
|
||||
|
||||
if (sched_pdsch->rbSize <= 0)
|
||||
@@ -819,7 +857,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->is_waiting = true;
|
||||
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d RNTI %04x start %3d RBs %3d startSymbol %2d nb_symbol %2d MCS %2d TBS %4d HARQ PID %2d round %d NDI %d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -835,15 +873,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->ndi);
|
||||
|
||||
NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp;
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList,
|
||||
"searchSpacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count > 0,
|
||||
"searchSPacesToAddModList is empty\n");
|
||||
|
||||
/* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not
|
||||
* exist, create it */
|
||||
const int bwpid = sched_ctrl->active_bwp->bwp_Id;
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const int bwpid = bwp ? bwp->bwp_Id : 0;
|
||||
const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
|
||||
if (!pdcch_pdu) {
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
@@ -852,7 +886,10 @@ 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;
|
||||
nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, bwp);
|
||||
LOG_D(NR_MAC,"Trying to configure DL pdcch for bwp %d, cs %d\n",bwpid,coresetid);
|
||||
NR_SearchSpace_t *ss = bwp ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space;
|
||||
NR_ControlResourceSet_t *coreset = bwp? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset;
|
||||
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, bwp);
|
||||
gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
@@ -872,13 +909,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->pduIndex = pduindex;
|
||||
|
||||
// BWP
|
||||
pdsch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
|
||||
pdsch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (bwp->bwp_Common->genericParameters.cyclicPrefix)
|
||||
pdsch_pdu->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
else
|
||||
pdsch_pdu->CyclicPrefix = 0;
|
||||
NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing;
|
||||
|
||||
pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0;
|
||||
|
||||
// Codeword information
|
||||
pdsch_pdu->NrOfCodewords = 1;
|
||||
@@ -886,6 +923,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->qamModOrder[0] = Qm;
|
||||
pdsch_pdu->mcsIndex[0] = sched_pdsch->mcs;
|
||||
pdsch_pdu->mcsTable[0] = ps->mcsTableIdx;
|
||||
AssertFatal(harq!=NULL,"harq is null\n");
|
||||
AssertFatal(harq->round<4,"%d",harq->round);
|
||||
pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round];
|
||||
pdsch_pdu->TBSize[0] = TBS;
|
||||
@@ -913,9 +951,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->StartSymbolIndex = ps->startSymbolIndex;
|
||||
pdsch_pdu->NrOfSymbols = ps->nrOfSymbols;
|
||||
|
||||
NR_PDSCH_Config_t *pdsch_Config=NULL;
|
||||
if (bwp &&
|
||||
bwp->bwp_Dedicated &&
|
||||
bwp->bwp_Dedicated->pdsch_Config &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup)
|
||||
pdsch_Config = bwp->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||
|
||||
/* Check and validate PTRS values */
|
||||
struct NR_SetupRelease_PTRS_DownlinkConfig *phaseTrackingRS =
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS;
|
||||
pdsch_Config ? pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS : NULL;
|
||||
if (phaseTrackingRS) {
|
||||
bool valid_ptrs_setup = set_dl_ptrs_values(phaseTrackingRS->choice.setup,
|
||||
pdsch_pdu->rbSize,
|
||||
@@ -935,7 +980,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
|
||||
pdcch_pdu->numDlDci++;
|
||||
dci_pdu->RNTI = rnti;
|
||||
if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
if (sched_ctrl->coreset &&
|
||||
sched_ctrl->search_space &&
|
||||
sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID;
|
||||
dci_pdu->ScramblingRNTI = rnti;
|
||||
@@ -952,19 +999,19 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_pdu_rel15_t dci_payload;
|
||||
memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t));
|
||||
// bwp indicator
|
||||
const int n_dl_bwp = UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
AssertFatal(n_dl_bwp == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||
n_dl_bwp);
|
||||
const int n_dl_bwp = bwp ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0;
|
||||
AssertFatal(n_dl_bwp <= 1, "downlinkBWP_ToAddModList has %d BWP!\n", n_dl_bwp);
|
||||
|
||||
// as per table 7.3.1.1.2-1 in 38.212
|
||||
dci_payload.bwp_indicator.val = n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1;
|
||||
AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
dci_payload.bwp_indicator.val = bwp ? (n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1) : 0;
|
||||
if (bwp) AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
dci_payload.frequency_domain_assignment.val =
|
||||
PRBalloc_to_locationandbandwidth0(
|
||||
pdsch_pdu->rbSize,
|
||||
pdsch_pdu->rbStart,
|
||||
pdsch_pdu->BWPSize);
|
||||
dci_payload.format_indicator = 1;
|
||||
dci_payload.time_domain_assignment.val = ps->time_domain_allocation;
|
||||
dci_payload.mcs = sched_pdsch->mcs;
|
||||
dci_payload.rv = pdsch_pdu->rvIndex[0];
|
||||
@@ -976,9 +1023,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI
|
||||
dci_payload.antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0
|
||||
dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID;
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), "
|
||||
"time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
"time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d tpc %d\n",
|
||||
frame,
|
||||
slot,
|
||||
dci_payload.frequency_domain_assignment.val,
|
||||
@@ -990,22 +1037,23 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_payload.mcs,
|
||||
dci_payload.tb_scaling,
|
||||
dci_payload.ndi,
|
||||
dci_payload.rv);
|
||||
dci_payload.rv,
|
||||
dci_payload.tpc);
|
||||
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0;
|
||||
const int dci_format = bwp ? (f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0) : NR_DL_DCI_FORMAT_1_0;
|
||||
const int rnti_type = NR_RNTI_C;
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
UE_info->secondaryCellGroup[UE_id],
|
||||
UE_info->CellGroup[UE_id],
|
||||
dci_pdu,
|
||||
&dci_payload,
|
||||
dci_format,
|
||||
rnti_type,
|
||||
pdsch_pdu->BWPSize,
|
||||
bwp->bwp_Id);
|
||||
bwp? bwp->bwp_Id : 0);
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
||||
(unsigned long long)pdcch_pdu->FreqDomainResource,
|
||||
pdcch_pdu->StartSymbolIndex,
|
||||
@@ -1015,7 +1063,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
/* we do not have to do anything, since we do not require to get data
|
||||
* from RLC or encode MAC CEs. The TX_req structure is filled below
|
||||
* or copy data to FAPI structures */
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%2d DL retransmission UE %d/RNTI %04x HARQ PID %d round %d NDI %d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -1024,13 +1072,14 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
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,
|
||||
current_harq_pid);
|
||||
} else { /* initial transmission */
|
||||
|
||||
LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
|
||||
LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
|
||||
|
||||
uint8_t *buf = (uint8_t *) harq->tb;
|
||||
|
||||
@@ -1046,7 +1095,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
|
||||
/* next, get RLC data */
|
||||
|
||||
const int lcid = DL_SCH_LCID_DTCH;
|
||||
// const int lcid = DL_SCH_LCID_DTCH;
|
||||
const int lcid = loop_dcch_dtch;
|
||||
int dlsch_total_bytes = 0;
|
||||
if (sched_ctrl->num_total_bytes > 0) {
|
||||
tbs_size_t len = 0;
|
||||
@@ -1073,12 +1123,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
0,
|
||||
0);
|
||||
|
||||
LOG_D(MAC,
|
||||
"%4d.%2d RNTI %04x: %d bytes from DTCH %d (ndata %d, remaining size %d)\n",
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n",
|
||||
frame,
|
||||
slot,
|
||||
rnti,
|
||||
len,
|
||||
lcid < 4 ? "DCCH" : "DTCH",
|
||||
lcid,
|
||||
ndata,
|
||||
size);
|
||||
@@ -1107,7 +1158,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
buf += 3;
|
||||
size -= 3;
|
||||
DevAssert(size > 0);
|
||||
LOG_D(MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size);
|
||||
LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size);
|
||||
// fill dlsch_buffer with random data
|
||||
for (int i = 0; i < size; i++)
|
||||
buf[i] = lrand48() & 0xff;
|
||||
@@ -1149,7 +1200,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
if (sched_ctrl->ta_apply) {
|
||||
sched_ctrl->ta_apply = false;
|
||||
sched_ctrl->ta_frame = frame;
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%2d UE %d TA scheduled, resetting TA frame\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -1172,6 +1223,6 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
gNB_mac->TX_req[CC_id].Slot = slot;
|
||||
|
||||
/* mark UE as scheduled */
|
||||
memset(sched_pdsch, 0, sizeof(*sched_pdsch));
|
||||
sched_pdsch->rbSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,10 +271,10 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
{
|
||||
if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot))
|
||||
return;
|
||||
const int CC_id = 0;
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
|
||||
const int UE_id = 0;
|
||||
const int CC_id = 0;
|
||||
AssertFatal(UE_info->active[UE_id],
|
||||
"%s(): expected UE %d to be active\n",
|
||||
__func__,
|
||||
@@ -339,7 +339,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
__func__,
|
||||
UE_id);
|
||||
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1);
|
||||
if (alloc < 0) {
|
||||
LOG_D(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
@@ -364,11 +364,11 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
sched_pdsch->pucch_allocation = alloc;
|
||||
sched_pdsch->rbStart = rbStart;
|
||||
sched_pdsch->rbSize = rbSize;
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot];
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pdsch_semi_static(
|
||||
scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
|
||||
sched_pdsch->mcs = target_dl_mcs;
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
@@ -414,7 +414,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
const int tda = RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot];
|
||||
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 =
|
||||
@@ -423,7 +423,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
"time domain assignment %d >= %d\n",
|
||||
tda,
|
||||
tdaList->list.count);
|
||||
int K2 = get_K2(sched_ctrl->active_ubwp, tda, mu);
|
||||
int K2 = get_K2(scc,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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
* \company Eurecom
|
||||
*/
|
||||
|
||||
#include <softmodem-common.h>
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "NR_MAC_COMMON/nr_mac_extern.h"
|
||||
@@ -73,12 +74,14 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
|
||||
nr_configure_pucch(pucch_pdu,
|
||||
scc,
|
||||
UE_info->CellGroup[UE_id],
|
||||
UE_info->UE_sched_ctrl[UE_id].active_ubwp,
|
||||
UE_info->rnti[UE_id],
|
||||
pucch->resource_indicator,
|
||||
pucch->csi_bits,
|
||||
pucch->dai_c,
|
||||
pucch->sr_flag);
|
||||
pucch->sr_flag,
|
||||
pucch->r_pucch);
|
||||
}
|
||||
|
||||
#define MIN_RSRP_VALUE -141
|
||||
@@ -130,6 +133,7 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
|
||||
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];
|
||||
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
|
||||
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];
|
||||
@@ -140,7 +144,7 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
|| frameP != curr_pucch->frame
|
||||
|| slotP != curr_pucch->ul_slot)
|
||||
continue;
|
||||
|
||||
LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack);
|
||||
nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id);
|
||||
memset(curr_pucch, 0, sizeof(*curr_pucch));
|
||||
}
|
||||
@@ -461,9 +465,11 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
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 *secondaryCellGroup = UE_info->secondaryCellGroup[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];
|
||||
const NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated ||
|
||||
!CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) continue;
|
||||
const NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count > 0,
|
||||
"NO CSI report configuration available");
|
||||
NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
|
||||
@@ -571,13 +577,13 @@ static void handle_dl_harq(module_id_t mod_id,
|
||||
|
||||
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 *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ;
|
||||
int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ;
|
||||
int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count;
|
||||
NR_TCI_State_t *tci =NULL;
|
||||
int i;
|
||||
|
||||
for(i=0; i<nb_tci_states && i<64; i++) {
|
||||
tci = (NR_TCI_State_t *)secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i];
|
||||
tci = (NR_TCI_State_t *)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i];
|
||||
|
||||
if(tci != NULL) {
|
||||
if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) {
|
||||
@@ -598,19 +604,19 @@ int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, i
|
||||
|
||||
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 *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ;
|
||||
int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id] ;
|
||||
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;
|
||||
int bwp_id = 1;
|
||||
NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1];
|
||||
int i;
|
||||
int flag = 0;
|
||||
int tci_stateID = -1;
|
||||
|
||||
for(i=0; i<nb_tci_states && i<128; i++) {
|
||||
tci = (NR_TCI_State_t *)secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i];
|
||||
tci = (NR_TCI_State_t *)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i];
|
||||
|
||||
if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) {
|
||||
if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) {
|
||||
@@ -672,10 +678,10 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
|
||||
uint8_t idx = 0;
|
||||
int bwp_id = 1;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
|
||||
NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
|
||||
NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
//bwp indicator
|
||||
int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
int 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;
|
||||
int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially
|
||||
@@ -1103,7 +1109,12 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti);
|
||||
return;
|
||||
}
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
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;
|
||||
|
||||
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];
|
||||
|
||||
@@ -1146,7 +1157,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
int nr_acknack_scheduling(int mod_id,
|
||||
int UE_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot)
|
||||
sub_frame_t slot,
|
||||
int r_pucch)
|
||||
{
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
@@ -1172,6 +1184,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
* * 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_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0];
|
||||
pucch->r_pucch=r_pucch;
|
||||
AssertFatal(pucch->csi_bits == 0,
|
||||
"%s(): csi_bits %d in sched_pucch[0]\n",
|
||||
__func__,
|
||||
@@ -1190,6 +1203,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
csi_pucch = &sched_ctrl->sched_pucch[1];
|
||||
// skip the CSI PUCCH if it is present and if in the next frame/slot
|
||||
// and if we don't multiplex
|
||||
csi_pucch->r_pucch=-1;
|
||||
if (csi_pucch->csi_bits > 0
|
||||
&& csi_pucch->frame == pucch->frame
|
||||
&& csi_pucch->ul_slot == pucch->ul_slot
|
||||
@@ -1201,6 +1215,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot);
|
||||
/* if the UE's next PUCCH occasion is after the possible UL slots (within the
|
||||
* same frame) or wrapped around to the next frame, then we assume there is
|
||||
* no possible PUCCH allocation anymore */
|
||||
@@ -1209,8 +1224,8 @@ int nr_acknack_scheduling(int mod_id,
|
||||
|| (pucch->frame == frame + 1))
|
||||
return -1;
|
||||
|
||||
// this is hardcoded for now as ue specific
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
// this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific: NR_SearchSpace__searchSpaceType_PR_common;
|
||||
uint8_t pdsch_to_harq_feedback[8];
|
||||
get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback);
|
||||
|
||||
@@ -1235,7 +1250,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot);
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot, pucch->r_pucch);
|
||||
}
|
||||
|
||||
pucch->timing_indicator = i;
|
||||
@@ -1267,6 +1282,8 @@ int nr_acknack_scheduling(int mod_id,
|
||||
// Find the right timing_indicator value.
|
||||
int i = 0;
|
||||
while (i < 8) {
|
||||
LOG_D(MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n",
|
||||
i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot);
|
||||
if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot)
|
||||
break;
|
||||
++i;
|
||||
@@ -1301,7 +1318,7 @@ int nr_acknack_scheduling(int mod_id,
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot);
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot, -1);
|
||||
}
|
||||
// multiplexing harq and csi in a pucch
|
||||
else {
|
||||
@@ -1313,13 +1330,26 @@ int nr_acknack_scheduling(int mod_id,
|
||||
|
||||
pucch->timing_indicator = i; // index in the list of timing indicators
|
||||
|
||||
LOG_D(MAC,"2. DL slot %d, UL_ACK %d (index %d)\n",slot,pucch->ul_slot,i);
|
||||
|
||||
pucch->dai_c++;
|
||||
pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources
|
||||
|
||||
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_id]->UE_info.CellGroup[UE_id] &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) {
|
||||
pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
}
|
||||
|
||||
/* verify that at that slot and symbol, resources are free. We only do this
|
||||
* for initialCyclicShift 0 (we assume it always has that one), so other
|
||||
* initialCyclicShifts can overlap with ICS 0!*/
|
||||
const NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
|
||||
const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator];
|
||||
DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0);
|
||||
if (resource->format.choice.format0->initialCyclicShift == 0) {
|
||||
@@ -1537,7 +1567,19 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot)
|
||||
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];
|
||||
NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
AssertFatal(pucch_Config->schedulingRequestResourceToAddModList->list.count>0,"NO SR configuration available");
|
||||
|
||||
for (int SR_resource_id =0; SR_resource_id < pucch_Config->schedulingRequestResourceToAddModList->list.count;SR_resource_id++) {
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include <openair2/UTIL/OPT/opt.h>
|
||||
|
||||
|
||||
//38.321 Table 6.1.3.1-1
|
||||
const uint32_t NR_SHORT_BSR_TABLE[32] = {
|
||||
@@ -69,7 +71,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub
|
||||
return;
|
||||
|
||||
/* there is a mixed slot only when in TDD */
|
||||
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
|
||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
|
||||
const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
const NR_TDD_UL_DL_Pattern_t *tdd =
|
||||
scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||
@@ -117,7 +119,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub
|
||||
const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
AssertFatal(tdaList->list.count >= 3, "need to have at least three TDAs for UL slots\n");
|
||||
const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_UL = tdaList->list.array[0];
|
||||
const int k2 = get_K2(ubwp, /* tda = */ 0, mu);
|
||||
const int k2 = get_K2(scc, (NR_BWP_Uplink_t*)ubwp,0, mu);
|
||||
int start, len;
|
||||
SLIV2SL(tdaP_UL->startSymbolAndLength, &start, &len);
|
||||
const uint16_t symb_tda = ((1 << len) - 1) << start;
|
||||
@@ -129,10 +131,10 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub
|
||||
// get largest time domain allocation (TDA) for UL slot and UL in mixed slot
|
||||
int tdaMi = -1;
|
||||
const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1];
|
||||
AssertFatal(k2 == get_K2(ubwp, /* tda = */ 1, mu),
|
||||
AssertFatal(k2 == get_K2(scc, (NR_BWP_Uplink_t*)ubwp, 1, mu),
|
||||
"scheduler cannot handle different k2 for UL slot (%d) and UL Mixed slot (%ld)\n",
|
||||
k2,
|
||||
get_K2(ubwp, /* tda = */ 1, mu));
|
||||
get_K2(scc, (NR_BWP_Uplink_t*)ubwp, 1, mu));
|
||||
SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len);
|
||||
const uint16_t symb_tda_mi = ((1 << len) - 1) << start;
|
||||
// check whether PUCCH and TDA overlap: then, we cannot use it. Also, check
|
||||
@@ -188,7 +190,6 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
int pdu_len = mac_pdu_len;
|
||||
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
|
||||
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
// For both DL/UL-SCH
|
||||
@@ -222,7 +223,7 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
mac_sdu_len = 0;
|
||||
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
|
||||
|
||||
LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid);
|
||||
LOG_D(NR_MAC, "LCID received at gNB side: %d \n", rx_lcid);
|
||||
|
||||
unsigned char *ce_ptr;
|
||||
int n_Lcg = 0;
|
||||
@@ -231,7 +232,7 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
// MAC CE
|
||||
|
||||
/*#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||
LOG_D(NR_MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||
#endif*/
|
||||
case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY:
|
||||
// 38.321 Ch6.1.3.20
|
||||
@@ -251,7 +252,7 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr;
|
||||
sched_ctrl->estimated_ul_buffer = 0;
|
||||
sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size];
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"SHORT BSR at %4d.%2d, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n",
|
||||
frameP,
|
||||
slot,
|
||||
@@ -279,10 +280,17 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 +
|
||||
bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0;
|
||||
|
||||
LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n",
|
||||
bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4,
|
||||
bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0);
|
||||
|
||||
for (int n = 0; n < n_Lcg; n++){
|
||||
LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d",
|
||||
n, n_Lcg, pdu_ptr[mac_subheader_len + 1 + n],
|
||||
NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]]);
|
||||
sched_ctrl->estimated_ul_buffer +=
|
||||
NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]];
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"LONG BSR at %4d.%2d, %d/%d (n/n_Lcg), BS Index %d, BS value < %d, total %d\n",
|
||||
frameP,
|
||||
slot,
|
||||
@@ -307,19 +315,19 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
//fixed length
|
||||
mac_ce_len = 2;
|
||||
/* Extract SINGLE ENTRY PHR elements for PHR calculation */
|
||||
ce_ptr = &pdu_ptr[mac_subheader_len];
|
||||
NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr;
|
||||
/* Save the phr info */
|
||||
const int PH = phr->PH;
|
||||
const int PCMAX = phr->PCMAX;
|
||||
/* 38.133 Table10.1.17.1-1 */
|
||||
if (PH < 55)
|
||||
sched_ctrl->ph = PH - 32;
|
||||
else
|
||||
sched_ctrl->ph = PH - 32 + (PH - 54);
|
||||
/* 38.133 Table10.1.18.1-1 */
|
||||
sched_ctrl->pcmax = PCMAX - 29;
|
||||
LOG_D(MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n",
|
||||
ce_ptr = &pdu_ptr[mac_subheader_len];
|
||||
NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr;
|
||||
/* Save the phr info */
|
||||
const int PH = phr->PH;
|
||||
const int PCMAX = phr->PCMAX;
|
||||
/* 38.133 Table10.1.17.1-1 */
|
||||
if (PH < 55)
|
||||
sched_ctrl->ph = PH - 32;
|
||||
else
|
||||
sched_ctrl->ph = PH - 32 + (PH - 54);
|
||||
/* 38.133 Table10.1.18.1-1 */
|
||||
sched_ctrl->pcmax = PCMAX - 29;
|
||||
LOG_D(MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n",
|
||||
phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax);
|
||||
break;
|
||||
|
||||
@@ -352,13 +360,30 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
// end of MAC PDU, can ignore the rest.
|
||||
break;
|
||||
|
||||
// MAC SDUs
|
||||
case UL_SCH_LCID_SRB1:
|
||||
// todo
|
||||
break;
|
||||
case UL_SCH_LCID_SRB2:
|
||||
// todo
|
||||
break;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8)
|
||||
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff);
|
||||
} else {
|
||||
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: %d \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, *UE_info->rnti);
|
||||
mac_rlc_data_ind(module_idP,
|
||||
UE_info->rnti[UE_id],
|
||||
module_idP,
|
||||
frameP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
rx_lcid,
|
||||
(char *) (pdu_ptr + mac_subheader_len),
|
||||
mac_sdu_len,
|
||||
1,
|
||||
NULL);
|
||||
break;
|
||||
case UL_SCH_LCID_SRB3:
|
||||
// todo
|
||||
break;
|
||||
@@ -414,16 +439,16 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n",
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
|
||||
module_idP,
|
||||
frameP,
|
||||
rx_lcid<4?"DCCH":"DTCH",
|
||||
rx_lcid,
|
||||
module_idP,
|
||||
mac_sdu_len);
|
||||
UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
|
||||
log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
|
||||
#endif
|
||||
|
||||
mac_rlc_data_ind(module_idP,
|
||||
@@ -446,7 +471,7 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid);
|
||||
LOG_E(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
@@ -454,8 +479,8 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
|
||||
if (pdu_len < 0) {
|
||||
LOG_E(MAC, "%s() residual mac pdu length < 0!, pdu_len: %d\n", __func__, pdu_len);
|
||||
LOG_E(MAC, "MAC PDU ");
|
||||
LOG_E(NR_MAC, "%s() residual mac pdu length < 0!, pdu_len: %d\n", __func__, pdu_len);
|
||||
LOG_E(NR_MAC, "MAC PDU ");
|
||||
for (int i = 0; i < 20; i++) // Only printf 1st - 20nd bytes
|
||||
printf("%02x ", pdu_ptr[i]);
|
||||
printf("\n");
|
||||
@@ -489,7 +514,7 @@ void handle_nr_ul_harq(module_id_t mod_id,
|
||||
{
|
||||
int UE_id = find_nr_UE_id(mod_id, crc_pdu->rnti);
|
||||
if (UE_id < 0) {
|
||||
LOG_E(MAC, "%s(): unknown RNTI %04x in PUSCH\n", __func__, crc_pdu->rnti);
|
||||
LOG_E(NR_MAC, "%s(): unknown RNTI %04x in PUSCH\n", __func__, crc_pdu->rnti);
|
||||
return;
|
||||
}
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
@@ -497,7 +522,7 @@ void handle_nr_ul_harq(module_id_t mod_id,
|
||||
|
||||
int8_t harq_pid = sched_ctrl->feedback_ul_harq.head;
|
||||
while (crc_pdu->harq_id != harq_pid || harq_pid < 0) {
|
||||
LOG_W(MAC,
|
||||
LOG_W(NR_MAC,
|
||||
"Unexpected ULSCH HARQ PID %d (have %d) for RNTI %04x (ignore this warning for RA)\n",
|
||||
crc_pdu->harq_id,
|
||||
harq_pid,
|
||||
@@ -523,20 +548,20 @@ void handle_nr_ul_harq(module_id_t mod_id,
|
||||
if (!crc_pdu->tb_crc_status) {
|
||||
harq->ndi ^= 1;
|
||||
harq->round = 0;
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"Ulharq id %d crc passed for RNTI %04x\n",
|
||||
harq_pid,
|
||||
crc_pdu->rnti);
|
||||
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
|
||||
} else if (harq->round >= MAX_HARQ_ROUNDS - 1) {
|
||||
abort_nr_ul_harq(mod_id, UE_id, harq_pid);
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"RNTI %04x: Ulharq id %d crc failed in all rounds\n",
|
||||
crc_pdu->rnti,
|
||||
harq_pid);
|
||||
} else {
|
||||
harq->round++;
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"Ulharq id %d crc failed for RNTI %04x\n",
|
||||
harq_pid,
|
||||
crc_pdu->rnti);
|
||||
@@ -563,6 +588,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
const int current_rnti = rntiP;
|
||||
const int UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
|
||||
const int target_snrx10 = gNB_mac->pusch_target_snrx10;
|
||||
const int pusch_failure_thres = gNB_mac->pusch_failure_thres;
|
||||
|
||||
if (UE_id != -1) {
|
||||
NR_UE_sched_ctrl_t *UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id];
|
||||
@@ -574,7 +600,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
T_BUFFER(sduP, sdu_lenP));
|
||||
|
||||
UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP;
|
||||
LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d sduP %p\n",
|
||||
LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d TA %d sduP %p\n",
|
||||
gnb_mod_idP,
|
||||
harq_pid,
|
||||
CC_idP,
|
||||
@@ -583,6 +609,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ul_cqi,
|
||||
timing_advance,
|
||||
sduP);
|
||||
|
||||
// if not missed detection (10dB threshold for now)
|
||||
@@ -600,7 +627,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
|
||||
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
||||
LOG_I(NR_MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
||||
for (int i = 0; i < sdu_lenP ; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
@@ -613,6 +640,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (sduP != NULL){
|
||||
LOG_D(NR_MAC, "Received PDU at MAC gNB \n");
|
||||
|
||||
UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt = 0;
|
||||
const uint32_t tb_size = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.tb_size;
|
||||
UE_scheduling_control->sched_ul_bytes -= tb_size;
|
||||
if (UE_scheduling_control->sched_ul_bytes < 0)
|
||||
@@ -620,6 +648,24 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
nr_process_mac_pdu(gnb_mod_idP, UE_id, CC_idP, frameP, slotP, sduP, sdu_lenP);
|
||||
}
|
||||
else {
|
||||
NR_UE_ul_harq_t *cur_harq = &UE_scheduling_control->ul_harq_processes[harq_pid];
|
||||
/* reduce sched_ul_bytes when cur_harq->round == 3 */
|
||||
if (cur_harq->round == 3){
|
||||
const uint32_t tb_size = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.tb_size;
|
||||
UE_scheduling_control->sched_ul_bytes -= tb_size;
|
||||
if (UE_scheduling_control->sched_ul_bytes < 0)
|
||||
UE_scheduling_control->sched_ul_bytes = 0;
|
||||
}
|
||||
if (ul_cqi <= 128) {
|
||||
UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++;
|
||||
UE_info->mac_stats[UE_id].ulsch_DTX++;
|
||||
}
|
||||
if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) {
|
||||
LOG_D(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n");
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure = 1;
|
||||
}
|
||||
}
|
||||
} else if(sduP) {
|
||||
|
||||
bool no_sig = true;
|
||||
@@ -647,7 +693,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
continue;
|
||||
|
||||
if(no_sig) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
} else {
|
||||
@@ -660,7 +706,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
current_rnti);
|
||||
|
||||
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x\n", i, ra->state,ra->rnti,current_rnti);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
}
|
||||
@@ -668,7 +714,9 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
continue;
|
||||
}
|
||||
|
||||
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup);
|
||||
int UE_id=-1;
|
||||
|
||||
UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup);
|
||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||
|
||||
// re-initialize ta update variables after RA procedure completion
|
||||
@@ -716,7 +764,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -725,16 +772,18 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (ra->state != WAIT_Msg3)
|
||||
continue;
|
||||
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (state is not WAIT_Msg3)\n", i, ra->state);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long get_K2(const NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) {
|
||||
DevAssert(ubwp);
|
||||
const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment];
|
||||
long get_K2(NR_ServingCellConfigCommon_t *scc,NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) {
|
||||
DevAssert(scc);
|
||||
const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp ?
|
||||
ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment];
|
||||
if (tda_list->k2)
|
||||
return *tda_list->k2;
|
||||
else if (mu < 2)
|
||||
@@ -793,13 +842,23 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
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_sched_pusch_t *retInfo = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch;
|
||||
int rbStart =
|
||||
NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint16_t bwpSize =
|
||||
NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
const int tda = RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot];
|
||||
// frame/slot in sched_pusch has been set previously. In the following, we
|
||||
// overwrite the information in the retransmission information before storing
|
||||
// as the new scheduling instruction
|
||||
retInfo->frame = sched_ctrl->sched_pusch.frame;
|
||||
retInfo->slot = sched_ctrl->sched_pusch.slot;
|
||||
|
||||
// Get previous PUSCH filed info
|
||||
sched_ctrl->sched_pusch = *retInfo;
|
||||
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0;
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? 1 : 2;
|
||||
const int tda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1;
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
/* Check the resource is enough for retransmission */
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart])
|
||||
@@ -812,7 +871,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
* (re-)transmission */
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
|
||||
const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0;
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->dci_format != dci_format
|
||||
|| ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data)
|
||||
@@ -828,7 +887,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
rbSize++;
|
||||
NR_pusch_semi_static_t temp_ps;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
|
||||
const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0;
|
||||
nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps);
|
||||
uint32_t new_tbs;
|
||||
uint16_t new_rbSize;
|
||||
@@ -860,14 +919,6 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
return false;
|
||||
}
|
||||
|
||||
/* frame/slot in sched_pusch has been set previously. In the following, we
|
||||
* overwrite the information in the retransmission information before storing
|
||||
* as the new scheduling instruction */
|
||||
retInfo->frame = sched_ctrl->sched_pusch.frame;
|
||||
retInfo->slot = sched_ctrl->sched_pusch.slot;
|
||||
/* Get previous PSUCH field info */
|
||||
sched_ctrl->sched_pusch = *retInfo;
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
LOG_D(MAC,
|
||||
"%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n",
|
||||
frame,
|
||||
@@ -893,8 +944,8 @@ void update_ul_ue_R_Qm(NR_sched_pusch_t *sched_pusch, const NR_pusch_semi_static
|
||||
const int mcs = sched_pusch->mcs;
|
||||
sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table);
|
||||
sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table);
|
||||
if (ps->pusch_Config->tp_pi2BPSK
|
||||
&& ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) {
|
||||
|
||||
if (ps->pusch_Config && ps->pusch_Config->tp_pi2BPSK && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) {
|
||||
sched_pusch->R >>= 1;
|
||||
sched_pusch->Qm <<= 1;
|
||||
}
|
||||
@@ -911,7 +962,6 @@ void pf_ul(module_id_t module_id,
|
||||
uint8_t *rballoc_mask) {
|
||||
|
||||
const int CC_id = 0;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
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;
|
||||
@@ -923,10 +973,13 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
/* Loop UE_list to calculate throughput and coeff */
|
||||
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;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int rbStart =
|
||||
NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0;
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
@@ -965,7 +1018,7 @@ void pf_ul(module_id_t module_id,
|
||||
/* if no data, pre-allocate 5RB */
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
if (!freeCCE) {
|
||||
LOG_D(MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
continue;
|
||||
}
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
@@ -973,20 +1026,22 @@ void pf_ul(module_id_t module_id,
|
||||
if (max_num_ue < 0)
|
||||
return;
|
||||
|
||||
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb,rbStart);
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_D(MAC, "cannot allocate continuous data for UE %d/RNTI %04x: no resources\n",
|
||||
UE_id, UE_info->rnti[UE_id]);
|
||||
continue;
|
||||
LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether dci_format, TDA, or
|
||||
* num_dmrs_cdm_grps_no_data has changed and only then recompute */
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_ubwp ? 1 : 2;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
|
||||
const int tda = nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot];
|
||||
const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0;
|
||||
const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1;
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->dci_format != dci_format
|
||||
|| ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data)
|
||||
@@ -1021,7 +1076,7 @@ void pf_ul(module_id_t module_id,
|
||||
sched_pusch->mcs = 9;
|
||||
const uint32_t tbs = ul_pf_tbs[ps->mcs_table][sched_pusch->mcs];
|
||||
coeff_ue[UE_id] = (float) tbs / ul_thr_ue[UE_id];
|
||||
LOG_D(MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
|
||||
LOG_D(NR_MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
|
||||
b, UE_id, ul_thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]);
|
||||
}
|
||||
|
||||
@@ -1047,7 +1102,7 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
if (!freeCCE) {
|
||||
LOG_D(MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1057,10 +1112,9 @@ void pf_ul(module_id_t module_id,
|
||||
return;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
/* for some reason, the UEs do not like when they are scheduled on the last
|
||||
* RB. Hence, as a (hopefully temporary) fix, schedule one RB less. */
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) - 1;
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0;
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
@@ -1070,13 +1124,20 @@ void pf_ul(module_id_t module_id,
|
||||
while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize])
|
||||
max_rbSize++;
|
||||
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether dci_format, TDA, or
|
||||
* num_dmrs_cdm_grps_no_data has changed and only then recompute */
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_ubwp ? 1 : 2;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
|
||||
const int tda = nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot];
|
||||
const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0;
|
||||
const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1;
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->dci_format != dci_format
|
||||
|| ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data)
|
||||
@@ -1126,10 +1187,10 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
* schedule now (slot + k2 is not UL slot) */
|
||||
int UE_id = UE_info->list.head;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const int tda = nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot];
|
||||
const int tda = sched_ctrl->active_ubwp ? nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1;
|
||||
if (tda < 0)
|
||||
return false;
|
||||
int K2 = get_K2(sched_ctrl->active_ubwp, tda, mu);
|
||||
int K2 = get_K2(scc, 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];
|
||||
if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot))
|
||||
@@ -1139,6 +1200,8 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
sched_ctrl->sched_pusch.frame = sched_frame;
|
||||
for (UE_id = UE_info->list.next[UE_id]; 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];
|
||||
AssertFatal(K2 == get_K2(scc,sched_ctrl->active_ubwp, tda, mu),
|
||||
"Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(scc,sched_ctrl->active_ubwp, tda, mu), UE_id);
|
||||
sched_ctrl->sched_pusch.slot = sched_slot;
|
||||
sched_ctrl->sched_pusch.frame = sched_frame;
|
||||
}
|
||||
@@ -1148,13 +1211,18 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
* Calculate largest contiguous RBs */
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList =
|
||||
sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp ?
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_ubwp ?
|
||||
sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex;
|
||||
|
||||
int st = 0, e = 0, len = 0;
|
||||
for (int i = 0; i < bwpSize; i++) {
|
||||
while ((vrb_map_UL[i] & symb) != 0 && i < bwpSize)
|
||||
@@ -1222,7 +1290,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
/* Uplink data ONLY can be scheduled when the current slot is downlink slot,
|
||||
* because we have to schedule the DCI0 first before schedule uplink data */
|
||||
if (!is_xlsch_in_slot(nr_mac->dlsch_slot_bitmap[slot / 64], slot)) {
|
||||
LOG_D(MAC, "Current slot %d is NOT DL slot, cannot schedule DCI0 for UL data\n", slot);
|
||||
LOG_D(NR_MAC, "Current slot %d is NOT DL slot, cannot schedule DCI0 for UL data\n", slot);
|
||||
return;
|
||||
}
|
||||
bool do_sched = RC.nrmac[module_id]->pre_processor_ul(module_id, frame, slot);
|
||||
@@ -1243,11 +1311,13 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
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];
|
||||
if (sched_ctrl->ul_failure == 1 && get_softmodem_params()->phy_test==0) continue;
|
||||
UE_info->mac_stats[UE_id].ulsch_current_bytes = 0;
|
||||
|
||||
/* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
|
||||
* every TTI are pre-populated by the preprocessor and used below */
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
LOG_D(NR_MAC,"UE %x : sched_pusch->rbSize %d\n",UE_info->rnti[UE_id],sched_pusch->rbSize);
|
||||
if (sched_pusch->rbSize <= 0)
|
||||
continue;
|
||||
|
||||
@@ -1297,7 +1367,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
cur_harq->sched_pusch.time_domain_allocation = ps->time_domain_allocation;
|
||||
sched_ctrl->sched_ul_bytes += sched_pusch->tb_size;
|
||||
} else {
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%d.%2d UL retransmission RNTI %04x sched %d.%2d HARQ PID %d round %d NDI %d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -1312,7 +1382,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
sched_ctrl->last_ul_frame = sched_pusch->frame;
|
||||
sched_ctrl->last_ul_slot = sched_pusch->slot;
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d RNTI %04x UL sched %4d.%2d start %2d RBS %3d startSymbol %2d nb_symbol %2d MCS %2d TBS %4d HARQ PID %2d round %d NDI %d est %6d sched %6d est BSR %6d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -1349,16 +1419,18 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
|
||||
future_ul_tti_req->n_pdus += 1;
|
||||
|
||||
LOG_D(MAC, "%4d.%2d Scheduling UE specific PUSCH\n", frame, slot);
|
||||
LOG_D(NR_MAC, "%4d.%2d Scheduling UE specific PUSCH for sched %d.%d, ul_tto_req %d.%d\n", frame, slot,
|
||||
sched_pusch->frame,sched_pusch->slot,future_ul_tti_req->SFN,future_ul_tti_req->Slot);
|
||||
|
||||
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_pdu->rnti = rnti;
|
||||
pusch_pdu->handle = 0; //not yet used
|
||||
|
||||
/* FAPI: BWP */
|
||||
pusch_pdu->bwp_size = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->subcarrier_spacing = sched_ctrl->active_ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing;
|
||||
pusch_pdu->cyclic_prefix = 0;
|
||||
|
||||
/* FAPI: PUSCH information always included */
|
||||
@@ -1367,7 +1439,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->mcs_index = sched_pusch->mcs;
|
||||
pusch_pdu->mcs_table = ps->mcs_table;
|
||||
pusch_pdu->transform_precoding = ps->transform_precoding;
|
||||
if (ps->pusch_Config->dataScramblingIdentityPUSCH)
|
||||
if (ps->pusch_Config &&
|
||||
ps->pusch_Config->dataScramblingIdentityPUSCH)
|
||||
pusch_pdu->data_scrambling_id = *ps->pusch_Config->dataScramblingIdentityPUSCH;
|
||||
else
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
@@ -1377,10 +1450,10 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->ul_dmrs_symb_pos = ps->ul_dmrs_symb_pos;
|
||||
pusch_pdu->dmrs_config_type = ps->dmrs_config_type;
|
||||
if (pusch_pdu->transform_precoding) { // transform precoding disabled
|
||||
long *scramblingid;
|
||||
if (pusch_pdu->scid == 0)
|
||||
long *scramblingid=NULL;
|
||||
if (ps->NR_DMRS_UplinkConfig && pusch_pdu->scid == 0)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0;
|
||||
else
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1;
|
||||
if (scramblingid == NULL)
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
@@ -1389,9 +1462,9 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
}
|
||||
else {
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
if (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
pusch_pdu->pusch_identity = *ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity;
|
||||
else
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
pusch_pdu->pusch_identity = *scc->physCellId;
|
||||
}
|
||||
pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]
|
||||
@@ -1399,13 +1472,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->dmrs_ports = 1;
|
||||
|
||||
/* FAPI: Pusch Allocation in frequency domain */
|
||||
AssertFatal(ps->pusch_Config->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
pusch_pdu->resource_alloc = 1; //type 1
|
||||
pusch_pdu->rb_start = sched_pusch->rbStart;
|
||||
pusch_pdu->rb_size = sched_pusch->rbSize;
|
||||
pusch_pdu->vrb_to_prb_mapping = 0;
|
||||
if (ps->pusch_Config->frequencyHopping==NULL)
|
||||
if (ps->pusch_Config==NULL || ps->pusch_Config->frequencyHopping==NULL)
|
||||
pusch_pdu->frequency_hopping = 0;
|
||||
else
|
||||
pusch_pdu->frequency_hopping = 1;
|
||||
@@ -1429,8 +1500,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30;
|
||||
|
||||
// V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled
|
||||
if ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL))
|
||||
if ((ps->NR_DMRS_UplinkConfig==NULL) || ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)))
|
||||
pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0;
|
||||
else
|
||||
AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n");
|
||||
@@ -1441,7 +1512,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
||||
/* PUSCH PTRS */
|
||||
if (ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
bool valid_ptrs_setup = false;
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
valid_ptrs_setup = set_ul_ptrs_values(ps->NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup,
|
||||
@@ -1459,8 +1530,10 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
|
||||
/* look up the PDCCH PDU for this BWP and CORESET. If it does not exist,
|
||||
* create it */
|
||||
const int bwpid = sched_ctrl->active_bwp->bwp_Id;
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const int bwpid = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
NR_SearchSpace_t *ss = sched_ctrl->active_bwp ? sched_ctrl->search_space: RC.nrmac[module_id]->sched_ctrlCommon->search_space;
|
||||
NR_ControlResourceSet_t *coreset = sched_ctrl->active_bwp? sched_ctrl->coreset: RC.nrmac[module_id]->sched_ctrlCommon->coreset;
|
||||
const int coresetid = coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = pdcch_pdu_bwp_coreset[bwpid][coresetid];
|
||||
if (!pdcch_pdu) {
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &ul_dci_req->ul_dci_pdu_list[ul_dci_req->numPdus];
|
||||
@@ -1469,19 +1542,19 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
pdcch_pdu = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
ul_dci_req->numPdus += 1;
|
||||
nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, sched_ctrl->active_bwp);
|
||||
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, sched_ctrl->active_bwp);
|
||||
pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot);
|
||||
LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot);
|
||||
|
||||
/* Fill PDCCH DL DCI PDU */
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
|
||||
pdcch_pdu->numDlDci++;
|
||||
dci_pdu->RNTI = rnti;
|
||||
if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID;
|
||||
if (coreset->pdcch_DMRS_ScramblingID &&
|
||||
ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *coreset->pdcch_DMRS_ScramblingID;
|
||||
dci_pdu->ScramblingRNTI = rnti;
|
||||
} else {
|
||||
dci_pdu->ScramblingId = *scc->physCellId;
|
||||
@@ -1494,24 +1567,30 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
|
||||
dci_pdu_rel15_t uldci_payload;
|
||||
memset(&uldci_payload, 0, sizeof(uldci_payload));
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
|
||||
const int n_ubwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
|
||||
int n_ubwp=1;
|
||||
if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)
|
||||
n_ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
|
||||
|
||||
config_uldci(sched_ctrl->active_ubwp,
|
||||
scc,
|
||||
pusch_pdu,
|
||||
&uldci_payload,
|
||||
ps->dci_format,
|
||||
ps->time_domain_allocation,
|
||||
UE_info->UE_sched_ctrl[UE_id].tpc0,
|
||||
n_ubwp,
|
||||
sched_ctrl->active_bwp->bwp_Id);
|
||||
bwpid);
|
||||
fill_dci_pdu_rel15(scc,
|
||||
secondaryCellGroup,
|
||||
CellGroup,
|
||||
dci_pdu,
|
||||
&uldci_payload,
|
||||
ps->dci_format,
|
||||
rnti_types[0],
|
||||
pusch_pdu->bwp_size,
|
||||
sched_ctrl->active_bwp->bwp_Id);
|
||||
bwpid);
|
||||
|
||||
memset(sched_pusch, 0, sizeof(*sched_pusch));
|
||||
}
|
||||
|
||||
@@ -51,12 +51,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
int pusch_tgt_snrx10,
|
||||
int pucch_tgt_snrx10,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup
|
||||
);
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
@@ -167,6 +165,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
|
||||
|
||||
void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int dci_format,
|
||||
@@ -193,9 +192,10 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
sub_frame_t slotP);
|
||||
|
||||
int nr_acknack_scheduling(int Mod_idP,
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
int r_pucch);
|
||||
|
||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int UE_id,
|
||||
@@ -222,13 +222,15 @@ int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space,
|
||||
*/
|
||||
|
||||
void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Uplink_t *bwp,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_CellGroupConfig_t *CellGroup,
|
||||
NR_BWP_Uplink_t *bwp,
|
||||
uint16_t rnti,
|
||||
uint8_t pucch_resource,
|
||||
uint16_t O_csi,
|
||||
uint16_t O_ack,
|
||||
uint8_t O_sr);
|
||||
uint8_t O_sr,
|
||||
int r_pucch);
|
||||
|
||||
void find_search_space(int ss_type,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
@@ -241,7 +243,7 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
NR_BWP_Downlink_t *bwp);
|
||||
|
||||
void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
const NR_CellGroupConfig_t *CellGroup,
|
||||
nfapi_nr_dl_dci_pdu_t *pdcch_dci_pdu,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int dci_formats,
|
||||
@@ -249,18 +251,23 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
int N_RB,
|
||||
int bwp_id);
|
||||
|
||||
void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
void prepare_dci(const NR_CellGroupConfig_t *CellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
nr_dci_format_t format,
|
||||
int bwp_id);
|
||||
|
||||
/* find coreset within the search space */
|
||||
NR_ControlResourceSet_t *get_coreset(const NR_BWP_Downlink_t *bwp, const NR_SearchSpace_t *ss, int ss_type);
|
||||
NR_ControlResourceSet_t *get_coreset(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type);
|
||||
|
||||
/* find a search space within a BWP */
|
||||
NR_SearchSpace_t *get_searchspace(const NR_BWP_Downlink_t *bwp, NR_SearchSpace__searchSpaceType_PR target_ss);
|
||||
NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
|
||||
NR_SearchSpace__searchSpaceType_PR target_ss);
|
||||
|
||||
long get_K2(const NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu);
|
||||
long get_K2(NR_ServingCellConfigCommon_t *scc, NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu);
|
||||
|
||||
void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
@@ -312,7 +319,7 @@ int find_nr_UE_id(module_id_t mod_idP, 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 *secondaryCellGroup);
|
||||
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup);
|
||||
|
||||
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
|
||||
|
||||
@@ -335,6 +342,8 @@ uint16_t compute_pucch_prb_size(uint8_t format,
|
||||
uint8_t n_symb,
|
||||
uint8_t n_re_ctrl);
|
||||
|
||||
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);
|
||||
|
||||
int get_dlscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
@@ -96,12 +96,12 @@ void mac_top_init_gNB(void)
|
||||
// These should be out of here later
|
||||
pdcp_layer_init();
|
||||
|
||||
if(IS_SOFTMODEM_NOS1 && !(get_softmodem_params()->do_ra || get_softmodem_params()->sa) )
|
||||
if(IS_SOFTMODEM_NOS1 && get_softmodem_params()->phy_test)
|
||||
nr_DRB_preconfiguration(0x1234);
|
||||
|
||||
rrc_init_nr_global_param();
|
||||
|
||||
}else {
|
||||
} else {
|
||||
RC.nrmac = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,8 +160,8 @@ typedef struct {
|
||||
NR_SearchSpace_t *ra_ss;
|
||||
// Beam index
|
||||
uint8_t beam_id;
|
||||
/// secondaryCellGroup for UE in NSA that is to come
|
||||
NR_CellGroupConfig_t *secondaryCellGroup;
|
||||
/// CellGroup for UE that is to come (NSA is non-null, null for SA)
|
||||
NR_CellGroupConfig_t *CellGroup;
|
||||
/// Preambles for contention-free access
|
||||
NR_preamble_ue_t preambles;
|
||||
/// NSA: the UEs C-RNTI to use
|
||||
@@ -303,6 +303,7 @@ typedef struct NR_sched_pucch {
|
||||
uint8_t dai_c;
|
||||
uint8_t timing_indicator;
|
||||
uint8_t resource_indicator;
|
||||
int r_pucch;
|
||||
} NR_sched_pucch_t;
|
||||
|
||||
/* PUSCH semi-static configuration: as long as the TDA and DCI format remain
|
||||
@@ -558,6 +559,7 @@ typedef struct {
|
||||
/// per-LC status data
|
||||
mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID];
|
||||
|
||||
int lcid_mask;
|
||||
uint16_t ta_frame;
|
||||
int16_t ta_update;
|
||||
bool ta_apply;
|
||||
@@ -566,7 +568,11 @@ typedef struct {
|
||||
int raw_rssi;
|
||||
int pusch_snrx10;
|
||||
int pucch_snrx10;
|
||||
|
||||
uint16_t ul_rssi;
|
||||
uint8_t current_harq_pid;
|
||||
int pusch_consecutive_dtx_cnt;
|
||||
int pucch_consecutive_dtx_cnt;
|
||||
int ul_failure;
|
||||
struct CSI_Report CSI_report[MAX_CSI_REPORTS];
|
||||
bool SR;
|
||||
|
||||
@@ -603,6 +609,7 @@ typedef struct {
|
||||
int dlsch_current_bytes;
|
||||
int ulsch_rounds[8];
|
||||
int ulsch_errors;
|
||||
int ulsch_DTX;
|
||||
int ulsch_total_bytes_scheduled;
|
||||
int ulsch_total_bytes_rx;
|
||||
int ulsch_current_bytes;
|
||||
@@ -623,13 +630,14 @@ typedef struct {
|
||||
|
||||
bool active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB];
|
||||
/// CCE indexing
|
||||
int Y[MAX_MOBILES_PER_GNB][3][160];
|
||||
int m[MAX_MOBILES_PER_GNB];
|
||||
int num_pdcch_cand[MAX_MOBILES_PER_GNB][MAX_NUM_CORESET];
|
||||
// UE selected beam index
|
||||
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
|
||||
bool Msg4_ACKed[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_info_t;
|
||||
|
||||
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
|
||||
@@ -655,6 +663,10 @@ typedef struct gNB_MAC_INST_s {
|
||||
int pusch_target_snrx10;
|
||||
/// Pucch target SNR
|
||||
int pucch_target_snrx10;
|
||||
/// PUCCH Failure threshold (compared to consecutive PUCCH DTX)
|
||||
int pucch_failure_thres;
|
||||
/// PUSCH Failure threshold (compared to consecutive PUSCH DTX)
|
||||
int pusch_failure_thres;
|
||||
/// Subcarrier Offset
|
||||
int ssb_SubcarrierOffset;
|
||||
/// Common cell resources
|
||||
@@ -734,7 +746,6 @@ typedef struct gNB_MAC_INST_s {
|
||||
nr_pp_impl_ul pre_processor_ul;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrlCommon;
|
||||
NR_CellGroupConfig_t *secondaryCellGroupCommon;
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64];
|
||||
|
||||
} gNB_MAC_INST;
|
||||
|
||||
@@ -1081,7 +1081,13 @@ pdcp_data_ind(
|
||||
pdcpHead->inst = 1;
|
||||
}
|
||||
} // nfapi_mode
|
||||
}
|
||||
} else {
|
||||
if (UE_NAS_USE_TUN) {
|
||||
pdcpHead->inst = ctxt_pP->module_id;
|
||||
} else if (ENB_NAS_USE_TUN) {
|
||||
pdcpHead->inst = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pdcpHead->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB);
|
||||
pdcpHead->inst = ctxt_pP->module_id;
|
||||
|
||||
@@ -43,6 +43,7 @@ extern int otg_enabled;
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/ip.h>
|
||||
#define rtf_put write
|
||||
#define rtf_get read
|
||||
|
||||
@@ -222,7 +223,11 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
|
||||
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||
} else { // => ENB_NAS_USE_TUN
|
||||
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
|
||||
/* Get the IP from a packet */
|
||||
struct ip *ip_pack = (struct ip *) nl_rx_buf;
|
||||
/* Use last octet of destination IP to get index of UE */
|
||||
int ue_indx = ((ip_pack->ip_dst.s_addr >> 24) - 2) % MAX_MOBILES_PER_ENB;
|
||||
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[ue_indx];
|
||||
ctxt.enb_flag=ENB_FLAG_YES;
|
||||
ctxt.module_id=0;
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#define PROTO_AGENT_H_
|
||||
#include "ENB_APP/enb_config.h" // for enb properties
|
||||
#include "proto_agent_common.h"
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "RRC/NR/nr_rrc_defs.h"
|
||||
|
||||
|
||||
void *proto_agent_receive(void *args);
|
||||
|
||||
@@ -33,10 +33,9 @@
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "proto_agent_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "rrc_eNB_UE_context.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
/*
|
||||
* message primitives
|
||||
@@ -364,28 +363,23 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto
|
||||
pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len;
|
||||
pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
|
||||
|
||||
if (!pdcp_pdu_p) goto error;
|
||||
if (!pdcp_pdu_p) {
|
||||
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
|
||||
result = rlc_data_req(&ctxt_pP
|
||||
,srb_flagP
|
||||
,flag_MBMS
|
||||
,rb_idP
|
||||
,muiP
|
||||
,confirmP
|
||||
,pdcp_pdu_size
|
||||
,pdcp_pdu_p
|
||||
,NULL
|
||||
,NULL
|
||||
);
|
||||
if (RC.nrrrc) {
|
||||
LOG_D(PROTO_AGENT, "proto_agent received pdcp_data_req \n");
|
||||
// for (int i = 0; i < pdcp_pdu_size; i++)
|
||||
// printf(" %2.2x", (unsigned char)pdcp_pdu_p->data[i]);
|
||||
// printf("\n");
|
||||
du_rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
|
||||
result = 1;
|
||||
} else {
|
||||
result = rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p, NULL, NULL);
|
||||
}
|
||||
return result;
|
||||
error:
|
||||
|
||||
if (pdcp_pdu_p)
|
||||
free_mem_block(pdcp_pdu_p, __func__);
|
||||
|
||||
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) {
|
||||
@@ -531,6 +525,8 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto
|
||||
ctxt_pP.rnti = ctxt->fsp_rnti;
|
||||
ctxt_pP.frame = ctxt->fsp_frame;
|
||||
ctxt_pP.subframe = ctxt->fsp_subframe;
|
||||
ctxt_pP.configured = 1;
|
||||
ctxt_pP.brOption = 0;
|
||||
ctxt_pP.eNB_index = ctxt->fsp_enb_index;
|
||||
srb_flagP = rlc_data->fsp_srb_flag;
|
||||
flag_MBMS = rlc_data->fsp_mbms_flag;
|
||||
|
||||
@@ -624,6 +624,14 @@ rlc_op_status_t rlc_stat_req (
|
||||
*/
|
||||
int rlc_module_init(int enb_flag);
|
||||
|
||||
void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP,
|
||||
mem_block_t *sdu_pP);
|
||||
/** @} */
|
||||
|
||||
#define RLC_FG_COLOR_BLACK "\e[0;30m"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 <stdint.h>
|
||||
|
||||
#ifndef _NR_PDCP_H_
|
||||
#define _NR_PDCP_H_
|
||||
|
||||
void nr_pdcp_layer_init_ue(void);
|
||||
void nr_DRB_preconfiguration(uint16_t crnti);
|
||||
|
||||
#endif /* _NR_PDCP_H_ */
|
||||
@@ -49,7 +49,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(buffer[0] & 0x80)) {
|
||||
if (entity->type != NR_PDCP_SRB && !(buffer[0] & 0x80)) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
@@ -65,7 +65,8 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
header_size = 3;
|
||||
}
|
||||
|
||||
if (entity->has_integrity) {
|
||||
/* SRBs always have MAC-I, even if integrity is not active */
|
||||
if (entity->has_integrity || entity->type == NR_PDCP_SRB) {
|
||||
integrity_size = 4;
|
||||
} else {
|
||||
integrity_size = 0;
|
||||
@@ -77,7 +78,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
}
|
||||
|
||||
rx_deliv_sn = entity->rx_deliv & entity->sn_max;
|
||||
rx_deliv_hfn = (entity->rx_deliv >> entity->sn_size) & ~entity->sn_max;
|
||||
rx_deliv_hfn = entity->rx_deliv >> entity->sn_size;
|
||||
|
||||
if (rcvd_sn < rx_deliv_sn - entity->window_size) {
|
||||
rcvd_hfn = rx_deliv_hfn + 1;
|
||||
@@ -99,9 +100,8 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
entity->integrity(entity->integrity_context, integrity,
|
||||
buffer, size - integrity_size,
|
||||
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
|
||||
if (memcmp(integrity, buffer, 4) != 0) {
|
||||
if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) {
|
||||
LOG_E(PDCP, "discard NR PDU, integrity failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
entity->rx_deliv = count;
|
||||
}
|
||||
|
||||
if (entity->t_reordering_start != 0 && entity->rx_deliv > entity->rx_reord) {
|
||||
if (entity->t_reordering_start != 0 && entity->rx_deliv >= entity->rx_reord) {
|
||||
/* stop and reset t-Reordering */
|
||||
entity->t_reordering_start = 0;
|
||||
}
|
||||
@@ -180,7 +180,8 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
|
||||
header_size = 3;
|
||||
}
|
||||
|
||||
if (entity->has_integrity) {
|
||||
/* SRBs always have MAC-I, even if integrity is not active */
|
||||
if (entity->has_integrity || entity->type == NR_PDCP_SRB) {
|
||||
integrity_size = 4;
|
||||
} else {
|
||||
integrity_size = 0;
|
||||
@@ -194,6 +195,10 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
|
||||
(unsigned char *)buf, header_size + size,
|
||||
entity->rb_id, count, entity->is_gnb ? 1 : 0);
|
||||
|
||||
// set MAC-I to 0 for SRBs with integrity not active
|
||||
else if (integrity_size == 4)
|
||||
memset(buf + header_size + size, 0, 4);
|
||||
|
||||
if (entity->has_ciphering)
|
||||
entity->cipher(entity->security_context,
|
||||
(unsigned char *)buf + header_size, size + integrity_size,
|
||||
@@ -205,18 +210,71 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
|
||||
header_size + size + integrity_size, sdu_id);
|
||||
}
|
||||
|
||||
static void nr_pdcp_entity_set_integrity_key(nr_pdcp_entity_t *entity,
|
||||
char *key)
|
||||
/* may be called several times, take care to clean previous settings */
|
||||
static void nr_pdcp_entity_set_security(nr_pdcp_entity_t *entity,
|
||||
int integrity_algorithm,
|
||||
char *integrity_key,
|
||||
int ciphering_algorithm,
|
||||
char *ciphering_key)
|
||||
{
|
||||
LOG_E(PDCP, "%s: %d: %s: TODO? to remove?\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
//memcpy(entity->integrity_key, key, 16);
|
||||
if (integrity_algorithm != -1)
|
||||
entity->integrity_algorithm = integrity_algorithm;
|
||||
if (ciphering_algorithm != -1)
|
||||
entity->ciphering_algorithm = ciphering_algorithm;
|
||||
if (integrity_key != NULL)
|
||||
memcpy(entity->integrity_key, integrity_key, 16);
|
||||
if (ciphering_key != NULL)
|
||||
memcpy(entity->ciphering_key, ciphering_key, 16);
|
||||
|
||||
if (integrity_algorithm == 0) {
|
||||
entity->has_integrity = 0;
|
||||
if (entity->free_integrity != NULL)
|
||||
entity->free_integrity(entity->integrity_context);
|
||||
entity->free_integrity = NULL;
|
||||
}
|
||||
|
||||
if (integrity_algorithm != 0 && integrity_algorithm != -1) {
|
||||
if (integrity_algorithm != 2) {
|
||||
LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n");
|
||||
exit(1);
|
||||
}
|
||||
entity->has_integrity = 1;
|
||||
if (entity->free_integrity != NULL)
|
||||
entity->free_integrity(entity->integrity_context);
|
||||
entity->integrity_context = nr_pdcp_integrity_nia2_init(entity->integrity_key);
|
||||
entity->integrity = nr_pdcp_integrity_nia2_integrity;
|
||||
entity->free_integrity = nr_pdcp_integrity_nia2_free_integrity;
|
||||
}
|
||||
|
||||
if (ciphering_algorithm == 0) {
|
||||
entity->has_ciphering = 0;
|
||||
if (entity->free_security != NULL)
|
||||
entity->free_security(entity->security_context);
|
||||
entity->free_security = NULL;
|
||||
}
|
||||
|
||||
if (ciphering_algorithm != 0 && ciphering_algorithm != -1) {
|
||||
if (ciphering_algorithm != 2) {
|
||||
LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n");
|
||||
exit(1);
|
||||
}
|
||||
entity->has_ciphering = 1;
|
||||
if (entity->free_security != NULL)
|
||||
entity->free_security(entity->security_context);
|
||||
entity->security_context = nr_pdcp_security_nea2_init(entity->ciphering_key);
|
||||
entity->cipher = nr_pdcp_security_nea2_cipher;
|
||||
entity->free_security = nr_pdcp_security_nea2_free_security;
|
||||
}
|
||||
}
|
||||
|
||||
static void check_t_reordering(nr_pdcp_entity_t *entity)
|
||||
{
|
||||
uint32_t count;
|
||||
|
||||
/* if t_reordering is set to "infinity" (seen as -1) then do nothing */
|
||||
if (entity->t_reordering == -1)
|
||||
return;
|
||||
|
||||
if (entity->t_reordering_start == 0
|
||||
|| entity->t_current <= entity->t_reordering_start + entity->t_reordering)
|
||||
return;
|
||||
@@ -278,7 +336,8 @@ void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity)
|
||||
|
||||
nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
nr_pdcp_entity_type_t type,
|
||||
int is_gnb, int rb_id,
|
||||
int is_gnb, int rb_id, int pdusession_id,int has_sdap,
|
||||
int has_sdapULheader, int has_sdapDLheader,
|
||||
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
|
||||
char *buf, int size),
|
||||
void *deliver_sdu_data,
|
||||
@@ -303,10 +362,10 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
|
||||
ret->type = type;
|
||||
|
||||
ret->recv_pdu = nr_pdcp_entity_recv_pdu;
|
||||
ret->recv_sdu = nr_pdcp_entity_recv_sdu;
|
||||
ret->set_integrity_key = nr_pdcp_entity_set_integrity_key;
|
||||
ret->set_time = nr_pdcp_entity_set_time;
|
||||
ret->recv_pdu = nr_pdcp_entity_recv_pdu;
|
||||
ret->recv_sdu = nr_pdcp_entity_recv_sdu;
|
||||
ret->set_security = nr_pdcp_entity_set_security;
|
||||
ret->set_time = nr_pdcp_entity_set_time;
|
||||
|
||||
ret->delete = nr_pdcp_entity_delete;
|
||||
|
||||
@@ -317,6 +376,10 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
ret->deliver_pdu_data = deliver_pdu_data;
|
||||
|
||||
ret->rb_id = rb_id;
|
||||
ret->pdusession_id = pdusession_id;
|
||||
ret->has_sdap = has_sdap;
|
||||
ret->has_sdapULheader = has_sdapULheader;
|
||||
ret->has_sdapDLheader = has_sdapDLheader;
|
||||
ret->sn_size = sn_size;
|
||||
ret->t_reordering = t_reordering;
|
||||
ret->discard_timer = discard_timer;
|
||||
@@ -324,34 +387,11 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
ret->sn_max = (1 << sn_size) - 1;
|
||||
ret->window_size = 1 << (sn_size - 1);
|
||||
|
||||
if (ciphering_key != NULL && ciphering_algorithm != 0) {
|
||||
if (ciphering_algorithm != 2) {
|
||||
LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n");
|
||||
exit(1);
|
||||
}
|
||||
ret->has_ciphering = 1;
|
||||
ret->ciphering_algorithm = ciphering_algorithm;
|
||||
memcpy(ret->ciphering_key, ciphering_key, 16);
|
||||
|
||||
ret->security_context = nr_pdcp_security_nea2_init(ciphering_key);
|
||||
ret->cipher = nr_pdcp_security_nea2_cipher;
|
||||
ret->free_security = nr_pdcp_security_nea2_free_security;
|
||||
}
|
||||
ret->is_gnb = is_gnb;
|
||||
|
||||
if (integrity_key != NULL && integrity_algorithm != 0) {
|
||||
if (integrity_algorithm != 2) {
|
||||
LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n");
|
||||
exit(1);
|
||||
}
|
||||
ret->has_integrity = 1;
|
||||
ret->integrity_algorithm = integrity_algorithm;
|
||||
memcpy(ret->integrity_key, integrity_key, 16);
|
||||
|
||||
ret->integrity_context = nr_pdcp_integrity_nia2_init(integrity_key);
|
||||
ret->integrity = nr_pdcp_integrity_nia2_integrity;
|
||||
ret->free_integrity = nr_pdcp_integrity_nia2_free_integrity;
|
||||
}
|
||||
nr_pdcp_entity_set_security(ret,
|
||||
integrity_algorithm, (char *)integrity_key,
|
||||
ciphering_algorithm, (char *)ciphering_key);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,18 @@ typedef struct nr_pdcp_entity_t {
|
||||
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
|
||||
int sdu_id);
|
||||
void (*delete)(struct nr_pdcp_entity_t *entity);
|
||||
void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key);
|
||||
|
||||
/* set_security: pass -1 to integrity_algorithm / ciphering_algorithm
|
||||
* to keep the current algorithm
|
||||
* pass NULL to integrity_key / ciphering_key
|
||||
* to keep the current key
|
||||
*/
|
||||
void (*set_security)(struct nr_pdcp_entity_t *entity,
|
||||
int integrity_algorithm,
|
||||
char *integrity_key,
|
||||
int ciphering_algorithm,
|
||||
char *ciphering_key);
|
||||
|
||||
void (*set_time)(struct nr_pdcp_entity_t *entity, uint64_t now);
|
||||
|
||||
/* callbacks provided to the PDCP module */
|
||||
@@ -53,10 +64,13 @@ typedef struct nr_pdcp_entity_t {
|
||||
|
||||
/* configuration variables */
|
||||
int rb_id;
|
||||
|
||||
int pdusession_id;
|
||||
int has_sdap;
|
||||
int has_sdapULheader;
|
||||
int has_sdapDLheader;
|
||||
int sn_size; /* SN size, in bits */
|
||||
int t_reordering; /* unit: ms */
|
||||
int discard_timer; /* unit: ms */
|
||||
int t_reordering; /* unit: ms, -1 for infinity */
|
||||
int discard_timer; /* unit: ms, -1 for infinity */
|
||||
|
||||
int sn_max; /* (2^SN_size) - 1 */
|
||||
int window_size; /* 2^(SN_size - 1) */
|
||||
@@ -104,7 +118,8 @@ typedef struct nr_pdcp_entity_t {
|
||||
|
||||
nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
nr_pdcp_entity_type_t type,
|
||||
int is_gnb, int rb_id,
|
||||
int is_gnb, int rb_id, int pdusession_id,int has_sdap,
|
||||
int has_sdapULheader,int has_sdapDLheader,
|
||||
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
|
||||
char *buf, int size),
|
||||
void *deliver_sdu_data,
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 "nr_pdcp_entity_srb.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size)
|
||||
{
|
||||
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
|
||||
|
||||
if (size < 2) abort();
|
||||
entity->common.deliver_sdu(entity->common.deliver_sdu_data,
|
||||
(nr_pdcp_entity_t *)entity, buffer+2, size-6);
|
||||
}
|
||||
|
||||
void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size,
|
||||
int sdu_id)
|
||||
{
|
||||
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
|
||||
int sn;
|
||||
char buf[size+6];
|
||||
|
||||
sn = entity->common.next_nr_pdcp_tx_sn;
|
||||
|
||||
entity->common.next_nr_pdcp_tx_sn++;
|
||||
if (entity->common.next_nr_pdcp_tx_sn > entity->common.maximum_nr_pdcp_sn) {
|
||||
entity->common.next_nr_pdcp_tx_sn = 0;
|
||||
entity->common.tx_hfn++;
|
||||
}
|
||||
|
||||
buf[0] = (sn >> 8) & 0x0f;
|
||||
buf[1] = sn & 0xff;
|
||||
memcpy(buf+2, buffer, size);
|
||||
|
||||
/* For now use padding for the MAC-I bytes (normally carrying message authentication code)
|
||||
* which come after the data payload bytes (38.323, section 6.2.2.1) */
|
||||
for (int i=size+2; i<size+6; i++)
|
||||
buf[i] = 0x11*(i-size-1);
|
||||
|
||||
entity->common.deliver_pdu(entity->common.deliver_pdu_data,
|
||||
(nr_pdcp_entity_t *)entity, buf, size+6, sdu_id);
|
||||
}
|
||||
|
||||
void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity)
|
||||
{
|
||||
nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity;
|
||||
free(entity);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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_PDCP_ENTITY_SRB_H_
|
||||
#define _NR_PDCP_ENTITY_SRB_H_
|
||||
|
||||
#include "nr_pdcp_entity.h"
|
||||
|
||||
typedef struct {
|
||||
nr_pdcp_entity_t common;
|
||||
int srb_id;
|
||||
} nr_pdcp_entity_srb_t;
|
||||
|
||||
void nr_pdcp_entity_srb_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size);
|
||||
void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, int sdu_id);
|
||||
void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key);
|
||||
void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity);
|
||||
|
||||
|
||||
#endif /* _NR_PDCP_ENTITY_SRB_H_ */
|
||||
@@ -45,7 +45,7 @@ static void compute_t(unsigned char *t, uint32_t count, int bearer,
|
||||
t[1] = (count >> 16) & 255;
|
||||
t[2] = (count >> 8) & 255;
|
||||
t[3] = (count ) & 255;
|
||||
t[4] = (bearer << 3) | (direction << 2);
|
||||
t[4] = ((bearer-1) << 3) | (direction << 2);
|
||||
memset(&t[5], 0, 8-5);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ void nr_pdcp_integrity_nia2_integrity(void *integrity_context,
|
||||
* (which is identical to 128-NIA2, see 33.501 D.3.1.3) */
|
||||
compute_t(t, count, bearer, direction);
|
||||
|
||||
CMAC_Init(ctx, NULL, 0, NULL, NULL);
|
||||
CMAC_Update(ctx, t, 8);
|
||||
CMAC_Update(ctx, buffer, length);
|
||||
CMAC_Final(ctx, mac, &maclen);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "NR_RLC-Config.h"
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "openair2/RRC/NR/nr_rrc_proto.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* from OAI */
|
||||
#include "pdcp.h"
|
||||
@@ -52,6 +53,9 @@ static int nr_pdcp_current_time_last_subframe;
|
||||
hash_table_t *pdcp_coll_p;
|
||||
static uint64_t pdcp_optmask;
|
||||
|
||||
ngran_node_t node_type = ngran_gNB;
|
||||
uint8_t proto_agent_flag = 0;
|
||||
|
||||
/****************************************************************************/
|
||||
/* rlc_data_req queue - begin */
|
||||
/****************************************************************************/
|
||||
@@ -186,6 +190,26 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
if (pthread_mutex_unlock(&q.m) != 0) abort();
|
||||
}
|
||||
|
||||
void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP,
|
||||
mem_block_t *sdu_pP)
|
||||
{
|
||||
enqueue_rlc_data_req(ctxt_pP,
|
||||
srb_flagP,
|
||||
MBMS_flagP,
|
||||
rb_idP, muiP,
|
||||
confirmP,
|
||||
sdu_sizeP,
|
||||
sdu_pP,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* rlc_data_req queue - end */
|
||||
/****************************************************************************/
|
||||
@@ -345,7 +369,10 @@ void pdcp_layer_init(void)
|
||||
if (pthread_mutex_unlock(&m) != 0) abort();
|
||||
|
||||
nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(1);
|
||||
init_nr_rlc_data_req_queue();
|
||||
|
||||
if ((RC.nrrrc == NULL) || (!NODE_IS_CU(RC.nrrrc[0]->node_type))) {
|
||||
init_nr_rlc_data_req_queue();
|
||||
}
|
||||
|
||||
nr_pdcp_init_timer_thread(nr_pdcp_ue_manager);
|
||||
}
|
||||
@@ -437,22 +464,25 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
exit(1);
|
||||
|
||||
rb_found:
|
||||
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
|
||||
size + GTPU_HEADER_OVERHEAD_MAX);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
|
||||
//printf("\n");
|
||||
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
|
||||
{
|
||||
int offset=0;
|
||||
if (entity->has_sdap == 1 && entity->has_sdapULheader == 1) offset = 1; // this is the offset of the SDAP header in bytes
|
||||
|
||||
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
|
||||
size + GTPU_HEADER_OVERHEAD_MAX - offset);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf+offset, size-offset);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size-offset;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = entity->pdusession_id;
|
||||
if (offset==1) LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset);
|
||||
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,6 +527,105 @@ rb_found:
|
||||
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL);
|
||||
}
|
||||
|
||||
static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
char *buf, int size)
|
||||
{
|
||||
nr_pdcp_ue_t *ue = _ue;
|
||||
int srb_id;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (entity == ue->srb[i]) {
|
||||
srb_id = i+1;
|
||||
goto srb_found;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
|
||||
exit(1);
|
||||
|
||||
srb_found:
|
||||
{
|
||||
uint8_t *rrc_buffer_p = entity->is_gnb ?
|
||||
itti_malloc(TASK_PDCP_ENB, TASK_RRC_GNB, size):
|
||||
itti_malloc(TASK_PDCP_UE, TASK_RRC_NRUE, size);
|
||||
MessageDef *message_p;
|
||||
|
||||
AssertFatal(rrc_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(rrc_buffer_p, buf, size);
|
||||
message_p = entity->is_gnb ?
|
||||
itti_alloc_new_message(TASK_PDCP_ENB, 0, NR_RRC_DCCH_DATA_IND):
|
||||
itti_alloc_new_message(TASK_PDCP_UE, 0, NR_RRC_DCCH_DATA_IND);
|
||||
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id;
|
||||
NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p;
|
||||
NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size;
|
||||
NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rnti;
|
||||
|
||||
itti_send_msg_to_task(entity->is_gnb ? TASK_RRC_GNB : TASK_RRC_NRUE, 0, message_p);
|
||||
}
|
||||
}
|
||||
|
||||
static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
char *buf, int size, int sdu_id)
|
||||
{
|
||||
nr_pdcp_ue_t *ue = _ue;
|
||||
int srb_id;
|
||||
protocol_ctxt_t ctxt;
|
||||
int i;
|
||||
mem_block_t *memblock;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (entity == ue->srb[i]) {
|
||||
srb_id = i+1;
|
||||
goto srb_found;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
|
||||
exit(1);
|
||||
|
||||
srb_found:
|
||||
|
||||
|
||||
LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, srb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
|
||||
//printf("\n");
|
||||
if ((RC.nrrrc == NULL) || (!NODE_IS_CU(RC.nrrrc[0]->node_type))) {
|
||||
ctxt.module_id = 0;
|
||||
ctxt.enb_flag = 1;
|
||||
ctxt.instance = 0;
|
||||
ctxt.frame = 0;
|
||||
ctxt.subframe = 0;
|
||||
ctxt.eNB_index = 0;
|
||||
ctxt.configured = 1;
|
||||
ctxt.brOption = 0;
|
||||
|
||||
ctxt.rnti = ue->rnti;
|
||||
|
||||
memblock = get_free_mem_block(size, __FUNCTION__);
|
||||
memcpy(memblock->data, buf, size);
|
||||
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE);
|
||||
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)buf;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
|
||||
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->rnti;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
|
||||
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
|
||||
itti_send_msg_to_task (TASK_CU_F1, 0, message_p);
|
||||
LOG_D(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
|
||||
}
|
||||
}
|
||||
|
||||
boolean_t pdcp_data_ind(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
@@ -557,14 +686,26 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
|
||||
{
|
||||
MessageDef *msg_p;
|
||||
int result;
|
||||
protocol_ctxt_t ctxt;
|
||||
protocol_ctxt_t ctxt={.module_id=0,
|
||||
.enb_flag=1,
|
||||
.instance=0,
|
||||
.rnti=0,
|
||||
.frame=-1,
|
||||
.subframe=-1,
|
||||
.eNB_index=0,
|
||||
.configured=true,
|
||||
.brOption=false
|
||||
};
|
||||
|
||||
|
||||
while (1) {
|
||||
itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p);
|
||||
if (msg_p == NULL)
|
||||
break;
|
||||
if (msg_p == NULL){
|
||||
break;
|
||||
}
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case RRC_DCCH_DATA_REQ:
|
||||
LOG_D(PDCP, "Received RRC_DCCH_DATA_REQ type at PDCP task \n");
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(
|
||||
&ctxt,
|
||||
RRC_DCCH_DATA_REQ(msg_p).module_id,
|
||||
@@ -595,9 +736,34 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
|
||||
}
|
||||
}
|
||||
|
||||
static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
|
||||
static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s)
|
||||
{
|
||||
TODO;
|
||||
nr_pdcp_entity_t *pdcp_srb;
|
||||
nr_pdcp_ue_t *ue;
|
||||
int t_Reordering=3000;
|
||||
|
||||
int srb_id = s->srb_Identity;
|
||||
if (s->pdcp_Config == NULL ||
|
||||
s->pdcp_Config->t_Reordering == NULL) t_Reordering = 3000;
|
||||
else t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
|
||||
|
||||
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
|
||||
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
|
||||
if (ue->srb[srb_id-1] != NULL) {
|
||||
LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
} else {
|
||||
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
|
||||
0, 0, 0, 0, // sdap parameters
|
||||
deliver_sdu_srb, ue, deliver_pdu_srb, ue,
|
||||
12, t_Reordering, -1,
|
||||
0, 0,
|
||||
NULL, NULL);
|
||||
nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb);
|
||||
|
||||
LOG_D(PDCP, "%s:%d:%s: added srb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
}
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
}
|
||||
|
||||
static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
@@ -610,11 +776,41 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
nr_pdcp_ue_t *ue;
|
||||
|
||||
int drb_id = s->drb_Identity;
|
||||
int t_reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
|
||||
int sn_size_ul = decode_sn_size_ul(*s->pdcp_Config->drb->pdcp_SN_SizeUL);
|
||||
int sn_size_dl = decode_sn_size_dl(*s->pdcp_Config->drb->pdcp_SN_SizeDL);
|
||||
int discard_timer = decode_discard_timer(*s->pdcp_Config->drb->discardTimer);
|
||||
|
||||
/* if pdcp_Config->t_Reordering is not present, it means infinity (-1) */
|
||||
int t_reordering = -1;
|
||||
if (s->pdcp_Config->t_Reordering != NULL) {
|
||||
t_reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
|
||||
}
|
||||
|
||||
if ((!s->cnAssociation) || s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_NOTHING) {
|
||||
LOG_E(PDCP,"%s:%d:%s: fatal, cnAssociation is missing or present is NR_DRB_ToAddMod__cnAssociation_PR_NOTHING\n",__FILE__,__LINE__,__FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int pdusession_id;
|
||||
int has_sdap = 0;
|
||||
int has_sdapULheader=0;
|
||||
int has_sdapDLheader=0;
|
||||
if (s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity)
|
||||
pdusession_id = s->cnAssociation->choice.eps_BearerIdentity;
|
||||
else {
|
||||
if (!s->cnAssociation->choice.sdap_Config) {
|
||||
LOG_E(PDCP,"%s:%d:%s: fatal, sdap_Config is null",__FILE__,__LINE__,__FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session;
|
||||
has_sdap = 1;
|
||||
has_sdapULheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderUL == NR_SDAP_Config__sdap_HeaderUL_present ? 1 : 0;
|
||||
has_sdapDLheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderDL == NR_SDAP_Config__sdap_HeaderDL_present ? 1 : 0;
|
||||
if (has_sdapDLheader==1) {
|
||||
LOG_E(PDCP,"%s:%d:%s: fatal, no support for SDAP DL yet\n",__FILE__,__LINE__,__FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
/* TODO(?): accept different UL and DL SN sizes? */
|
||||
if (sn_size_ul != sn_size_dl) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal, bad SN sizes, must be same. ul=%d, dl=%d\n",
|
||||
@@ -634,7 +830,8 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
} else {
|
||||
pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,
|
||||
pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap,
|
||||
has_sdapULheader,has_sdapDLheader,
|
||||
deliver_sdu_drb, ue, deliver_pdu_drb, ue,
|
||||
sn_size_dl, t_reordering, discard_timer,
|
||||
ciphering_algorithm, integrity_algorithm,
|
||||
@@ -711,7 +908,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
|
||||
if (srb2add_list != NULL) {
|
||||
for (i = 0; i < srb2add_list->list.count; i++) {
|
||||
add_srb(rnti, srb2add_list->list.array[i]);
|
||||
add_srb(ctxt_pP->enb_flag,rnti, srb2add_list->list.array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -810,7 +1007,7 @@ void nr_DRB_preconfiguration(uint16_t crnti)
|
||||
}
|
||||
|
||||
NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
|
||||
nr_rlc_bearer_init(RLC_BearerConfig);
|
||||
nr_rlc_bearer_init(RLC_BearerConfig,NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity);
|
||||
nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional);
|
||||
nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig);
|
||||
|
||||
@@ -829,7 +1026,7 @@ void nr_DRB_preconfiguration(uint16_t crnti)
|
||||
(NR_SRB_ToAddModList_t *) NULL,
|
||||
rbconfig->drb_ToAddModList ,
|
||||
rbconfig->drb_ToReleaseList,
|
||||
0xff,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -876,37 +1073,87 @@ void pdcp_config_set_security(
|
||||
uint8_t *const kRRCint_pP,
|
||||
uint8_t *const kUPenc_pP)
|
||||
{
|
||||
DevAssert(pdcp_pP != NULL);
|
||||
nr_pdcp_ue_t *ue;
|
||||
nr_pdcp_entity_t *rb;
|
||||
int rnti = ctxt_pP->rnti;
|
||||
int integrity_algorithm;
|
||||
int ciphering_algorithm;
|
||||
|
||||
if ((security_modeP >= 0) && (security_modeP <= 0x77)) {
|
||||
pdcp_pP->cipheringAlgorithm = security_modeP & 0x0f;
|
||||
pdcp_pP->integrityProtAlgorithm = (security_modeP>>4) & 0xf;
|
||||
LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_SET_SECURITY_MODE: cipheringAlgorithm %d integrityProtAlgorithm %d\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
|
||||
pdcp_pP->cipheringAlgorithm,
|
||||
pdcp_pP->integrityProtAlgorithm);
|
||||
pdcp_pP->kRRCenc = kRRCenc_pP;
|
||||
pdcp_pP->kRRCint = kRRCint_pP;
|
||||
pdcp_pP->kUPenc = kUPenc_pP;
|
||||
/* Activate security */
|
||||
pdcp_pP->security_activated = 1;
|
||||
MSC_LOG_EVENT(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
"0 Set security ciph %X integ %x UE %"PRIx16" ",
|
||||
pdcp_pP->cipheringAlgorithm,
|
||||
pdcp_pP->integrityProtAlgorithm,
|
||||
ctxt_pP->rnti);
|
||||
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
|
||||
|
||||
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
|
||||
|
||||
/* TODO: proper handling of DRBs, for the moment only SRBs are handled */
|
||||
|
||||
if (rb_id >= 1 && rb_id <= 2) {
|
||||
rb = ue->srb[rb_id - 1];
|
||||
|
||||
if (rb == NULL) {
|
||||
LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, rnti, rb_id);
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
return;
|
||||
}
|
||||
|
||||
integrity_algorithm = (security_modeP>>4) & 0xf;
|
||||
ciphering_algorithm = security_modeP & 0x0f;
|
||||
rb->set_security(rb, integrity_algorithm, (char *)kRRCint_pP,
|
||||
ciphering_algorithm, (char *)kRRCenc_pP);
|
||||
} else {
|
||||
MSC_LOG_EVENT(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
"0 Set security failed UE %"PRIx16" ",
|
||||
ctxt_pP->rnti);
|
||||
LOG_E(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
|
||||
security_modeP);
|
||||
LOG_E(PDCP, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
}
|
||||
|
||||
static boolean_t pdcp_data_req_srb(
|
||||
protocol_ctxt_t *ctxt_pP,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t muiP,
|
||||
const confirm_t confirmP,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer)
|
||||
{
|
||||
LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size);
|
||||
nr_pdcp_ue_t *ue;
|
||||
nr_pdcp_entity_t *rb;
|
||||
int rnti = ctxt_pP->rnti;
|
||||
|
||||
if (ctxt_pP->module_id != 0 ||
|
||||
//ctxt_pP->enb_flag != 1 ||
|
||||
ctxt_pP->instance != 0 ||
|
||||
ctxt_pP->eNB_index != 0 /*||
|
||||
ctxt_pP->configured != 1 ||
|
||||
ctxt_pP->brOption != 0*/) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
|
||||
|
||||
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
|
||||
|
||||
if (rb_id < 1 || rb_id > 2)
|
||||
rb = NULL;
|
||||
else
|
||||
rb = ue->srb[rb_id - 1];
|
||||
|
||||
if (rb == NULL) {
|
||||
LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, rnti, rb_id);
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP);
|
||||
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static boolean_t pdcp_data_req_drb(
|
||||
protocol_ctxt_t *ctxt_pP,
|
||||
const rb_id_t rb_id,
|
||||
@@ -967,9 +1214,12 @@ boolean_t pdcp_data_req(
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (srb_flagP) { TODO; }
|
||||
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
|
||||
sdu_buffer);
|
||||
if (srb_flagP) {
|
||||
return pdcp_data_req_srb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer);
|
||||
}
|
||||
else{
|
||||
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind)
|
||||
|
||||
@@ -27,12 +27,21 @@
|
||||
#include <nettle/aes.h>
|
||||
#include <nettle/ctr.h>
|
||||
|
||||
#ifndef NETTLE_VERSION_MAJOR
|
||||
/* hack: include bignum.h, not version.h because version.h does not exist
|
||||
* in old versions and bignum.h includes version.h (as of today).
|
||||
* May completely fail to work... maybe we should skip support of old
|
||||
* versions of nettle.
|
||||
*/
|
||||
#include <nettle/bignum.h>
|
||||
#endif
|
||||
|
||||
void *nr_pdcp_security_nea2_init(unsigned char *ciphering_key)
|
||||
{
|
||||
void *ctx = calloc(1, nettle_aes128.context_size);
|
||||
if (ctx == NULL) exit(1);
|
||||
|
||||
#if NETTLE_VERSION_MAJOR < 3
|
||||
#if !defined(NETTLE_VERSION_MAJOR) || NETTLE_VERSION_MAJOR < 3
|
||||
nettle_aes128.set_encrypt_key(ctx, 16, ciphering_key);
|
||||
#else
|
||||
nettle_aes128.set_encrypt_key(ctx, ciphering_key);
|
||||
|
||||
@@ -85,7 +85,7 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti)
|
||||
if (m->ue_list[i]->rnti == rnti)
|
||||
return m->ue_list[i];
|
||||
|
||||
LOG_D(PDCP, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti);
|
||||
LOG_D(PDCP, "%s:%d:%s: new UE 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
|
||||
|
||||
m->ue_count++;
|
||||
m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count);
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
#include "NR_DRB-ToReleaseList.h"
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "NR_RLC-Config.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "NR_UL-CCCH-Message.h"
|
||||
|
||||
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
|
||||
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
|
||||
|
||||
#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -45,18 +54,25 @@ static uint64_t nr_rlc_current_time;
|
||||
static int nr_rlc_current_time_last_frame;
|
||||
static int nr_rlc_current_time_last_subframe;
|
||||
|
||||
void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig){
|
||||
|
||||
void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR rb_type){
|
||||
|
||||
RLC_BearerConfig->servedRadioBearer = calloc(1, sizeof(*RLC_BearerConfig->servedRadioBearer));
|
||||
RLC_BearerConfig->reestablishRLC = calloc(1, sizeof(*RLC_BearerConfig->reestablishRLC));
|
||||
RLC_BearerConfig->rlc_Config = calloc(1, sizeof(*RLC_BearerConfig->rlc_Config));
|
||||
RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1, sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig));
|
||||
|
||||
RLC_BearerConfig->logicalChannelIdentity = 4;
|
||||
RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
|
||||
RLC_BearerConfig->servedRadioBearer->choice.drb_Identity = 1;
|
||||
*RLC_BearerConfig->reestablishRLC = NR_RLC_BearerConfig__reestablishRLC_true;
|
||||
if(rb_type == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){
|
||||
RLC_BearerConfig->logicalChannelIdentity = 4;
|
||||
RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
|
||||
RLC_BearerConfig->servedRadioBearer->choice.drb_Identity = 1;
|
||||
}
|
||||
else{
|
||||
RLC_BearerConfig->logicalChannelIdentity = 1;
|
||||
RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
|
||||
RLC_BearerConfig->servedRadioBearer->choice.srb_Identity = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +176,7 @@ void mac_rlc_data_ind (
|
||||
} else {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal: no RB found (channel ID %d)\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, channel_idP);
|
||||
exit(1);
|
||||
// exit(1);
|
||||
}
|
||||
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
@@ -461,6 +477,27 @@ rb_found:
|
||||
T(T_ENB_RLC_UL,
|
||||
T_INT(0 /*ctxt_pP->module_id*/),
|
||||
T_INT(ue->rnti), T_INT(rb_id), T_INT(size));
|
||||
|
||||
const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type;
|
||||
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
|
||||
"Can't be CU, bad node type %d\n", type);
|
||||
|
||||
// if (NODE_IS_DU(type) && is_srb == 0) {
|
||||
// LOG_D(RLC, "call proto_agent_send_pdcp_data_ind() \n");
|
||||
// proto_agent_send_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (NODE_IS_DU(type) && is_srb == 1) {
|
||||
MessageDef *msg;
|
||||
msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE);
|
||||
F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti;
|
||||
F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id;
|
||||
F1AP_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf;
|
||||
F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size;
|
||||
itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) {
|
||||
@@ -561,7 +598,7 @@ static void max_retx_reached(void *_ue, nr_rlc_entity_t *entity)
|
||||
exit(1);
|
||||
|
||||
rb_found:
|
||||
LOG_D(RLC, "max RETX reached on %s %d\n",
|
||||
LOG_E(RLC, "max RETX reached on %s %d\n",
|
||||
is_srb ? "SRB" : "DRB",
|
||||
rb_id);
|
||||
|
||||
@@ -584,14 +621,15 @@ rb_found:
|
||||
#endif
|
||||
}
|
||||
|
||||
static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *rlc_BearerConfig)
|
||||
{
|
||||
nr_rlc_entity_t *nr_rlc_am;
|
||||
nr_rlc_ue_t *ue;
|
||||
|
||||
struct LTE_SRB_ToAddMod__rlc_Config *r = s->rlc_Config;
|
||||
struct LTE_SRB_ToAddMod__logicalChannelConfig *l = s->logicalChannelConfig;
|
||||
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
|
||||
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
|
||||
int srb_id = s->srb_Identity;
|
||||
int channel_id = rlc_BearerConfig->logicalChannelIdentity;
|
||||
int logical_channel_group;
|
||||
|
||||
int t_status_prohibit;
|
||||
@@ -602,25 +640,21 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
int t_reassembly;
|
||||
int sn_field_length;
|
||||
|
||||
LOG_D(RLC,"Trying to add SRB %d\n",srb_id);
|
||||
if (srb_id != 1 && srb_id != 2) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, srb_id);
|
||||
__FILE__, __LINE__, __FUNCTION__, srb_id);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch (l->present) {
|
||||
case LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue:
|
||||
logical_channel_group = *l->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup;
|
||||
break;
|
||||
case LTE_SRB_ToAddMod__logicalChannelConfig_PR_defaultValue:
|
||||
/* default value from 36.331 9.2.1 */
|
||||
logical_channel_group = 0;
|
||||
break;
|
||||
default:
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
if (channel_id != srb_id) {
|
||||
LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n",
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
|
||||
|
||||
/* TODO: accept other values? */
|
||||
if (logical_channel_group != 0) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
@@ -628,29 +662,22 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
}
|
||||
|
||||
switch (r->present) {
|
||||
case LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue: {
|
||||
struct LTE_RLC_Config__am *am;
|
||||
if (r->choice.explicitValue.present != LTE_RLC_Config_PR_am) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error, must be RLC AM\n",
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
am = &r->choice.explicitValue.choice.am;
|
||||
case NR_RLC_Config_PR_am: {
|
||||
struct NR_RLC_Config__am *am;
|
||||
am = r->choice.am;
|
||||
t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
|
||||
t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit);
|
||||
t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit);
|
||||
poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
|
||||
poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte);
|
||||
max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold);
|
||||
if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength);
|
||||
break;
|
||||
}
|
||||
case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue:
|
||||
/* default values from 36.331 9.2.1 */
|
||||
t_status_prohibit = 0;
|
||||
t_poll_retransmit = 45;
|
||||
poll_pdu = -1;
|
||||
poll_byte = -1;
|
||||
max_retx_threshold = 4;
|
||||
break;
|
||||
default:
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
@@ -659,7 +686,7 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
nr_rlc_manager_lock(nr_rlc_ue_manager);
|
||||
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
|
||||
if (ue->srb[srb_id-1] != NULL) {
|
||||
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI 0x%x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
} else {
|
||||
/* hack: hardcode values for NR */
|
||||
t_poll_retransmit = 45;
|
||||
@@ -680,8 +707,7 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
|
||||
sn_field_length);
|
||||
nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am);
|
||||
|
||||
LOG_D(RLC, "%s:%d:%s: added srb %d to ue %d\n",
|
||||
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
LOG_D(RLC, "%s:%d:%s: added srb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
|
||||
}
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
}
|
||||
@@ -722,7 +748,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
|
||||
/* TODO: accept other values? */
|
||||
if (logical_channel_group != 1) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
switch (r->present) {
|
||||
@@ -763,7 +789,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
|
||||
sn_field_length);
|
||||
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am);
|
||||
|
||||
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
}
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
}
|
||||
@@ -831,7 +857,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
|
||||
sn_field_length);
|
||||
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um);
|
||||
|
||||
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
}
|
||||
nr_rlc_manager_unlock(nr_rlc_ue_manager);
|
||||
}
|
||||
@@ -850,7 +876,7 @@ static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerCon
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
|
||||
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
|
||||
}
|
||||
|
||||
/* Dummy function due to dependency from LTE libraries */
|
||||
@@ -866,7 +892,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
|
||||
}
|
||||
|
||||
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const LTE_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
@@ -874,6 +900,7 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
|
||||
{
|
||||
int rnti = ctxt_pP->rnti;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*||
|
||||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
|
||||
@@ -896,13 +923,34 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
|
||||
|
||||
if (srb2add_listP != NULL) {
|
||||
for (i = 0; i < srb2add_listP->list.count; i++) {
|
||||
add_srb(rnti, srb2add_listP->list.array[i]);
|
||||
if (rlc_bearer2add_list != NULL) {
|
||||
for(j = 0; j < rlc_bearer2add_list->list.count; j++){
|
||||
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
|
||||
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity){
|
||||
if(srb2add_listP->list.array[i]->srb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.srb_Identity){
|
||||
add_rlc_srb(rnti, srb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (drb2add_listP != NULL) {
|
||||
if ((drb2add_listP != NULL) && (rlc_bearer2add_list != NULL)) {
|
||||
for (i = 0; i < drb2add_listP->list.count; i++) {
|
||||
add_drb(rnti, drb2add_listP->list.array[i], rlc_bearer2add_list->list.array[i]);
|
||||
if (rlc_bearer2add_list != NULL) {
|
||||
for(j = 0; j < rlc_bearer2add_list->list.count; j++){
|
||||
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
|
||||
if(rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){
|
||||
if(drb2add_listP->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){
|
||||
add_drb(rnti, drb2add_listP->list.array[i], rlc_bearer2add_list->list.array[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
struct NR_RLC_Config;
|
||||
struct NR_LogicalChannelConfig;
|
||||
|
||||
void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig);
|
||||
void nr_rlc_bearer_init(NR_RLC_BearerConfig_t *RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR rb_type);
|
||||
|
||||
void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config_pr);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti)
|
||||
if (m->ue_list[i]->rnti == rnti)
|
||||
return m->ue_list[i];
|
||||
|
||||
LOG_D(RLC, "%s:%d:%s: new UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
|
||||
LOG_D(RLC, "%s:%d:%s: new UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
|
||||
|
||||
m->ue_count++;
|
||||
m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count);
|
||||
|
||||
@@ -1031,3 +1031,14 @@ void rlc_tick(int frame, int subframe)
|
||||
rlc_current_time_last_subframe = subframe;
|
||||
}
|
||||
}
|
||||
|
||||
void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP,
|
||||
mem_block_t *sdu_pP){
|
||||
|
||||
}
|
||||
@@ -886,6 +886,7 @@ int nas_mesh_DC_receive(struct cx_entity *cx,struct nas_priv *gpriv)
|
||||
switch (cx->state) {
|
||||
case NAS_CX_RELEASING_FAILURE:
|
||||
cx->retry=0;
|
||||
/* fallthrough */
|
||||
|
||||
case NAS_CX_DCH:
|
||||
nas_mesh_DC_decode_cx_loss_ind(cx,p); // process message
|
||||
|
||||
@@ -107,7 +107,6 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
|
||||
UL_info->uci_ind.num_ucis = 0;
|
||||
}
|
||||
|
||||
|
||||
void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
{
|
||||
if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) {
|
||||
|
||||
@@ -47,7 +47,11 @@ const char *dl_indication_type[] = {"MIB", "SIB", "DLSCH", "DCI", "RAR"};
|
||||
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES];
|
||||
|
||||
// L2 Abstraction Layer
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id){
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id,
|
||||
unsigned int gNB_index, uint8_t *pduP,
|
||||
unsigned int additional_bits,
|
||||
uint32_t ssb_index, uint32_t ssb_length,
|
||||
uint16_t ssb_start_subcarrier, uint16_t cell_id){
|
||||
|
||||
return nr_ue_decode_mib(module_id,
|
||||
cc_id,
|
||||
@@ -55,7 +59,8 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui
|
||||
additional_bits,
|
||||
ssb_length, // Lssb = 64 is not support
|
||||
ssb_index,
|
||||
pduP,
|
||||
pduP,
|
||||
ssb_start_subcarrier,
|
||||
cell_id);
|
||||
|
||||
}
|
||||
@@ -90,7 +95,9 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
|
||||
|
||||
ret = nr_ue_scheduler(NULL, ul_info);
|
||||
|
||||
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->frame_type) && get_softmodem_params()->do_ra)
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon;
|
||||
|
||||
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test)
|
||||
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
|
||||
|
||||
switch(ret){
|
||||
@@ -155,14 +162,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
|
||||
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB:
|
||||
|
||||
ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.additional_bits,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -221,7 +221,15 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq);
|
||||
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
|
||||
\param ssb_length corresponding to L1 parameter L_ssb
|
||||
\param cell_id cell id */
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id);
|
||||
int handle_bcch_bch(module_id_t module_id,
|
||||
int cc_id,
|
||||
unsigned int gNB_index,
|
||||
uint8_t *pduP,
|
||||
unsigned int additional_bits,
|
||||
uint32_t ssb_index,
|
||||
uint32_t ssb_length,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id);
|
||||
|
||||
// TODO check
|
||||
/**\brief handle BCCH-DL-SCH message from dl_indication
|
||||
|
||||
@@ -392,7 +392,7 @@ rrc_rx_tx(
|
||||
current_timestamp_ms,
|
||||
ctxt_pP->frame,
|
||||
estimated_distance);
|
||||
LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
|
||||
LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.StatusRrc);
|
||||
push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
|
||||
estimated_distance);
|
||||
RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
|
||||
|
||||
@@ -316,8 +316,9 @@ mac_rrc_data_ind(
|
||||
UE_id,
|
||||
rntiP,
|
||||
sduP,
|
||||
sdu_lenP
|
||||
);
|
||||
sdu_lenP,
|
||||
NULL,
|
||||
0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
+32
-31
@@ -997,6 +997,7 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) {
|
||||
free_list = &eNB_MAC->UE_free_list;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag;
|
||||
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 0;
|
||||
free_list->num_UEs++;
|
||||
eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti;
|
||||
eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++;
|
||||
@@ -1046,12 +1047,12 @@ void release_UE_in_freeList(module_id_t mod_id) {
|
||||
eNB_PHY = RC.eNB[mod_id][CC_id];
|
||||
int id;
|
||||
// clean ULSCH entries for rnti
|
||||
id = find_ulsch(rnti,eNB_PHY,SEARCH_EXIST);
|
||||
id = find_ulsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
|
||||
|
||||
if (id>=0) clean_eNb_ulsch(eNB_PHY->ulsch[id]);
|
||||
|
||||
// clean DLSCH entries for rnti
|
||||
id = find_dlsch(rnti,eNB_PHY,SEARCH_EXIST);
|
||||
id = find_dlsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
|
||||
|
||||
if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
|
||||
|
||||
@@ -7613,7 +7614,7 @@ rrc_eNB_decode_ccch(
|
||||
|
||||
#define NCE nonCriticalExtension
|
||||
|
||||
static void
|
||||
static void
|
||||
get_ue_Category(
|
||||
LTE_UE_EUTRA_Capability_t *c,
|
||||
long *catDL,
|
||||
@@ -7649,7 +7650,7 @@ get_ue_Category(
|
||||
if (c125->ue_CategoryUL_r12) *catUL=*c125->ue_CategoryUL_r12;
|
||||
struct LTE_UE_EUTRA_Capability_v1260_IEs *c126=c125->NCE;
|
||||
if (c126 != NULL) { // v12.6
|
||||
if (c126->ue_CategoryDL_v1260) *catDL=*c126->ue_CategoryDL_v1260;
|
||||
if (c126->ue_CategoryDL_v1260) *catDL=*c126->ue_CategoryDL_v1260;
|
||||
struct LTE_UE_EUTRA_Capability_v1270_IEs *c127=c126->NCE;
|
||||
if (c127 != NULL) { // v12.7
|
||||
struct LTE_UE_EUTRA_Capability_v1280_IEs *c128=c127->NCE;
|
||||
@@ -7739,7 +7740,7 @@ is_ul_64QAM_supported(
|
||||
&& c->NCE->NCE->NCE->NCE != NULL // R106
|
||||
&& c->NCE->NCE->NCE->NCE->NCE != NULL // R109
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
|
||||
@@ -7763,7 +7764,7 @@ is_dl_256QAM_supported(
|
||||
&& c->NCE->NCE->NCE->NCE != NULL // R106
|
||||
&& c->NCE->NCE->NCE->NCE->NCE != NULL // R109
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
|
||||
@@ -7777,7 +7778,7 @@ is_dl_256QAM_supported(
|
||||
static int
|
||||
is_ul_256QAM_supported(
|
||||
LTE_UE_EUTRA_Capability_t *c
|
||||
)
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
return c != NULL // R8
|
||||
@@ -7787,14 +7788,14 @@ is_ul_256QAM_supported(
|
||||
&& c->NCE->NCE->NCE->NCE != NULL // R106
|
||||
&& c->NCE->NCE->NCE->NCE->NCE != NULL // R109
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134
|
||||
@@ -7803,7 +7804,7 @@ is_ul_256QAM_supported(
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430 != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430 != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430 != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array != NULL
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14!=NULL
|
||||
@@ -7826,14 +7827,14 @@ is_en_dc_supported(
|
||||
&& c->NCE->NCE->NCE->NCE != NULL // R106
|
||||
&& c->NCE->NCE->NCE->NCE->NCE != NULL // R109
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134
|
||||
@@ -7841,7 +7842,7 @@ is_en_dc_supported(
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //144
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //145
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //145
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //146
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //151
|
||||
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL
|
||||
@@ -7868,7 +7869,7 @@ int to_nr_rsrpq(long rsrpq_result,int nr_band) {
|
||||
return((rsrpq_result*10)-1175);
|
||||
case 77: // C
|
||||
case 78:
|
||||
case 79:
|
||||
case 79:
|
||||
return((rsrpq_result*10)-1170);
|
||||
case 28: // D
|
||||
return((rsrpq_result*10)-1165);
|
||||
@@ -8836,23 +8837,23 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
|
||||
}
|
||||
|
||||
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
|
||||
F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->configuration.mcc[0];
|
||||
F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->configuration.mnc[0];
|
||||
F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->configuration.mnc_digit_length[0];
|
||||
F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid;
|
||||
F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i];
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0];
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0];
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0];
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i];
|
||||
int num_SI= 0;
|
||||
if (rrc->carrier[0].SIB23) {
|
||||
F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][2+num_SI] = rrc->carrier[0].SIB23;
|
||||
F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][2+num_SI] = rrc->carrier[0].sizeof_SIB23;
|
||||
printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][2+num_SI]);
|
||||
for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][2+num_SI]; n++)
|
||||
printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][2+num_SI][n]);
|
||||
printf("\n");
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container[2+num_SI] = rrc->carrier[0].SIB23;
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container_length[2+num_SI] = rrc->carrier[0].sizeof_SIB23;
|
||||
//printf("SI %d size %d: ", 0, F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container_length[2+num_SI]);
|
||||
//for (int n = 0; n < F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container_length[2+num_SI]; n++)
|
||||
// printf("%02x ", F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container[2+num_SI][n]);
|
||||
//printf("\n");
|
||||
num_SI++;
|
||||
}
|
||||
|
||||
F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI;
|
||||
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].num_SI = num_SI;
|
||||
cu_cell_ind++;
|
||||
found_cell=1;
|
||||
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = cu_cell_ind;
|
||||
@@ -9059,7 +9060,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
|
||||
// check for UL failure or for UE to be released
|
||||
FILE *fd=NULL;
|
||||
if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0)
|
||||
if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0)
|
||||
fd=fopen("RRC_stats.log","w+");
|
||||
|
||||
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
@@ -9091,15 +9092,15 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
if (ue_context_p->ue_context.measResults) {
|
||||
fprintf(fd, "RRC PCell RSRP %ld, RSRQ %ld\n", ue_context_p->ue_context.measResults->measResultPCell.rsrpResult-140,
|
||||
ue_context_p->ue_context.measResults->measResultPCell.rsrqResult/2 - 20);
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells &&
|
||||
ue_context_p->ue_context.measResults->measResultNeighCells->present == LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15) {
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells &&
|
||||
ue_context_p->ue_context.measResults->measResultNeighCells->present == LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15) {
|
||||
|
||||
fprintf(fd,"NR_pci %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15);
|
||||
if(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15)
|
||||
fprintf(fd,"NR_rsrp %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0);
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15)
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15)
|
||||
fprintf(fd,"NR_rsrq %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0);
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15)
|
||||
if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15)
|
||||
fprintf(fd,"NR_ssb_index %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
* \email: raymond.knopp@eurecom.fr, kroempa@gmail.com
|
||||
*/
|
||||
|
||||
#include <f1ap_du_rrc_message_transfer.h>
|
||||
#include "platform_types.h"
|
||||
#include "nr_rrc_defs.h"
|
||||
#include "nr_rrc_extern.h"
|
||||
@@ -43,6 +44,7 @@
|
||||
#include "NR_MIB.h"
|
||||
#include "NR_BCCH-BCH-Message.h"
|
||||
#include "rrc_gNB_UE_context.h"
|
||||
#include "openair2/RRC/NR/MESSAGES/asn1_msg.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -164,12 +166,12 @@ nr_rrc_data_req(
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
if(sdu_sizeP == 255) {
|
||||
LOG_I(RRC,"sdu_sizeP == 255");
|
||||
LOG_D(RRC,"sdu_sizeP == 255");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_RRC_GNB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
|
||||
buffer_pP,
|
||||
sdu_sizeP,
|
||||
@@ -182,11 +184,11 @@ nr_rrc_data_req(
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ);
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
@@ -194,7 +196,7 @@ nr_rrc_data_req(
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
//memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP);
|
||||
//memcpy (NR_RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP);
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
@@ -203,12 +205,12 @@ nr_rrc_data_req(
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n");
|
||||
LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n");
|
||||
|
||||
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
|
||||
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
|
||||
* messages automatically */
|
||||
if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
|
||||
if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type))
|
||||
pdcp_run(ctxt_pP);
|
||||
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
@@ -281,6 +283,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
|
||||
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
|
||||
|
||||
AssertFatal(ue_context_p!=NULL,"failed to get ue_context\n");
|
||||
char payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
|
||||
|
||||
// check if data is there for MAC
|
||||
@@ -310,6 +313,42 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const boolean_t brOption) {
|
||||
|
||||
if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) {
|
||||
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
|
||||
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
|
||||
|
||||
// Generate DUtoCURRCContainer
|
||||
// call do_RRCSetup like full procedure and extract masterCellGroup
|
||||
NR_CellGroupConfig_t cellGroupConfig;
|
||||
NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon;
|
||||
uint8_t sdu2[100];
|
||||
memset(&cellGroupConfig,0,sizeof(cellGroupConfig));
|
||||
fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)&cellGroupConfig,
|
||||
sdu2,
|
||||
100);
|
||||
|
||||
int sdu2_len = (enc_rval.encoded+7)/8;
|
||||
if (enc_rval.encoded == -1) {
|
||||
LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name);
|
||||
exit(-1);
|
||||
}
|
||||
/* do ITTI message */
|
||||
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
|
||||
module_idP,
|
||||
CC_id,
|
||||
UE_id,
|
||||
rntiP,
|
||||
sduP,
|
||||
sdu_lenP,
|
||||
(const int8_t*)sdu2,
|
||||
sdu2_len
|
||||
);
|
||||
return(0);
|
||||
}
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0);
|
||||
|
||||
@@ -317,7 +356,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
|
||||
LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
|
||||
ctxt.brOption = brOption;
|
||||
if (sdu_lenP > 0) {
|
||||
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id);
|
||||
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+508
-105
@@ -70,6 +70,7 @@
|
||||
#include "NR_RRCReconfigurationComplete-IEs.h"
|
||||
#include "NR_DLInformationTransfer.h"
|
||||
#include "NR_RRCReestablishmentRequest.h"
|
||||
#include "NR_UE-CapabilityRequestFilterNR.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#if defined(NR_Rel16)
|
||||
#include "NR_SCS-SpecificCarrier.h"
|
||||
@@ -308,12 +309,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
|
||||
// TODO : Add support for more than one PLMN
|
||||
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
|
||||
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
||||
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
||||
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
||||
memset(nr_plmn,0,sizeof(nr_plmn));
|
||||
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
|
||||
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
|
||||
struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn);
|
||||
NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
|
||||
NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);;
|
||||
memset(nr_plmn,0,sizeof(struct NR_PLMN_Identity) * num_plmn);
|
||||
memset(nr_mcc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
|
||||
memset(nr_mnc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
|
||||
|
||||
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||
carrier->siblock1 = sib1_message;
|
||||
@@ -444,7 +445,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
ss1->nrofCandidates = calloc(1,sizeof(*ss1->nrofCandidates));
|
||||
ss1->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
ss1->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
ss1->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1;
|
||||
ss1->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4;
|
||||
ss1->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
ss1->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
ss1->searchSpaceType = calloc(1,sizeof(*ss1->searchSpaceType));
|
||||
@@ -658,6 +659,56 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
gNB_RrcConfigurationReq *configuration) {
|
||||
asn_enc_rval_t enc_rval;
|
||||
SystemInformation_IEs__sib_TypeAndInfo__Member *sib2 = NULL;
|
||||
SystemInformation_IEs__sib_TypeAndInfo__Member *sib3 = NULL;
|
||||
|
||||
NR_BCCH_DL_SCH_Message_t *sib_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||
sib_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
||||
sib_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
||||
sib_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation;
|
||||
sib_message->message.choice.c1->choice.systemInformation = CALLOC(1,sizeof(struct NR_SystemInformation));
|
||||
|
||||
struct NR_SystemInformation *sib = sib_message->message.choice.c1->choice.systemInformation;
|
||||
sib->criticalExtensions.present = NR_SystemInformation__criticalExtensions_PR_systemInformation;
|
||||
sib->criticalExtensions.choice.systemInformation = CALLOC(1, sizeof(struct NR_SystemInformation_IEs));
|
||||
|
||||
struct NR_SystemInformation_IEs *ies = sib->criticalExtensions.choice.systemInformation;
|
||||
sib2 = CALLOC(1, sizeof(SystemInformation_IEs__sib_TypeAndInfo__Member));
|
||||
sib2->present = NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2;
|
||||
sib2->choice.sib2 = CALLOC(1, sizeof(struct NR_SIB2));
|
||||
sib2->choice.sib2->cellReselectionInfoCommon.q_Hyst = NR_SIB2__cellReselectionInfoCommon__q_Hyst_dB1;
|
||||
sib2->choice.sib2->cellReselectionServingFreqInfo.threshServingLowP = 2; // INTEGER (0..31)
|
||||
sib2->choice.sib2->cellReselectionServingFreqInfo.cellReselectionPriority = 2; // INTEGER (0..7)
|
||||
sib2->choice.sib2->intraFreqCellReselectionInfo.q_RxLevMin = -50; // INTEGER (-70..-22)
|
||||
sib2->choice.sib2->intraFreqCellReselectionInfo.s_IntraSearchP = 2; // INTEGER (0..31)
|
||||
sib2->choice.sib2->intraFreqCellReselectionInfo.t_ReselectionNR = 2; // INTEGER (0..7)
|
||||
sib2->choice.sib2->intraFreqCellReselectionInfo.deriveSSB_IndexFromCell = true;
|
||||
ASN_SEQUENCE_ADD(&ies->sib_TypeAndInfo.list, sib2);
|
||||
|
||||
sib3 = CALLOC(1, sizeof(SystemInformation_IEs__sib_TypeAndInfo__Member));
|
||||
sib3->present = NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3;
|
||||
sib3->choice.sib3 = CALLOC(1, sizeof(struct NR_SIB3));
|
||||
ASN_SEQUENCE_ADD(&ies->sib_TypeAndInfo.list, sib3);
|
||||
|
||||
//encode SIB to data
|
||||
// carrier->SIB23 = (uint8_t *) malloc16(128);
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
NULL,
|
||||
(void *)sib_message,
|
||||
carrier->SIB23,
|
||||
100);
|
||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
|
||||
if (enc_rval.encoded==-1) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
void do_RLC_BEARER(uint8_t Mod_id,
|
||||
int CC_id,
|
||||
@@ -926,29 +977,360 @@ uint8_t do_RRCReject(uint8_t Mod_id,
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
NR_SpCellConfig_t *SpCellConfig,
|
||||
NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
SpCellConfig->servCellIndex = NULL;
|
||||
SpCellConfig->reconfigurationWithSync = NULL;
|
||||
SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL;
|
||||
SpCellConfig->rlf_TimersAndConstants = NULL;
|
||||
SpCellConfig->spCellConfigDedicated = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated));
|
||||
SpCellConfig->spCellConfigDedicated->uplinkConfig = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig));
|
||||
NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP));
|
||||
SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP;
|
||||
initialUplinkBWP->pucch_Config = calloc(1,sizeof(*initialUplinkBWP->pucch_Config));
|
||||
initialUplinkBWP->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup;
|
||||
NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config));
|
||||
initialUplinkBWP->pucch_Config->choice.setup=pucch_Config;
|
||||
pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList));
|
||||
pucch_Config->resourceSetToReleaseList = NULL;
|
||||
NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0));
|
||||
pucchresset0->pucch_ResourceSetId = 0;
|
||||
NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0));
|
||||
*pucchresset0id0=0;
|
||||
ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0);
|
||||
pucchresset0->maxPayloadSize=NULL;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0);
|
||||
|
||||
pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList));
|
||||
pucch_Config->resourceToReleaseList = NULL;
|
||||
// configure one single PUCCH0 opportunity for initial connection procedure
|
||||
// one symbol (13)
|
||||
NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0));
|
||||
pucchres0->pucch_ResourceId=0;
|
||||
pucchres0->startingPRB=0;
|
||||
pucchres0->intraSlotFrequencyHopping=NULL;
|
||||
pucchres0->secondHopPRB=NULL;
|
||||
pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0;
|
||||
pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0));
|
||||
pucchres0->format.choice.format0->initialCyclicShift=0;
|
||||
pucchres0->format.choice.format0->nrofSymbols=1;
|
||||
pucchres0->format.choice.format0->startingSymbolIndex=13;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0);
|
||||
|
||||
// configure Scheduling request
|
||||
// 40 slot period
|
||||
pucch_Config->schedulingRequestResourceToAddModList = calloc(1,sizeof(*pucch_Config->schedulingRequestResourceToAddModList));
|
||||
NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig = calloc(1,sizeof(*schedulingRequestResourceConfig));
|
||||
schedulingRequestResourceConfig->schedulingRequestResourceId = 1;
|
||||
schedulingRequestResourceConfig->schedulingRequestID= 0;
|
||||
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
|
||||
schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40;
|
||||
// note: make sure that there is no issue here. Later choose the RNTI accordingly.
|
||||
// Here we would be limited to 8 UEs on this resource (2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 8,9,18,19,28,29,38,39).
|
||||
// This should be a temporary resource until the first RRCReconfiguration gives new pucch resources.
|
||||
// Check for above configuration and exit for now if it is not the case
|
||||
AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30,
|
||||
"SCS != 30kHz\n");
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5,
|
||||
"TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
|
||||
|
||||
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2);
|
||||
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
|
||||
*schedulingRequestResourceConfig->resource = 0;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
|
||||
|
||||
SpCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->initialDownlinkBWP));
|
||||
NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP;
|
||||
bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp_Dedicated->pdcch_Config));
|
||||
bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup;
|
||||
bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup));
|
||||
|
||||
bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList));
|
||||
|
||||
NR_SearchSpace_t *ss2 = calloc(1,sizeof(*ss2));
|
||||
|
||||
ss2->searchSpaceId=2;
|
||||
ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId));
|
||||
*ss2->controlResourceSetId=0;
|
||||
ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset));
|
||||
ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||
ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0;
|
||||
ss2->duration=NULL;
|
||||
ss2->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss2->monitoringSymbolsWithinSlot));
|
||||
ss2->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||
ss2->monitoringSymbolsWithinSlot->size = 2;
|
||||
ss2->monitoringSymbolsWithinSlot->bits_unused = 2;
|
||||
ss2->monitoringSymbolsWithinSlot->buf[0]=0x80;
|
||||
ss2->monitoringSymbolsWithinSlot->buf[1]=0x0;
|
||||
ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates));
|
||||
ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1;
|
||||
ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType));
|
||||
ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific));
|
||||
ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0;
|
||||
|
||||
ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list,
|
||||
ss2);
|
||||
|
||||
SpCellConfig->spCellConfigDedicated->tag_Id=0;
|
||||
}
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup) {
|
||||
|
||||
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;
|
||||
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig->logicalChannelIdentity = 2;
|
||||
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->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 = 3;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5;
|
||||
logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
// DRB Configuration
|
||||
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));
|
||||
rlc_Config_drb->present = NR_RLC_Config_PR_am;
|
||||
rlc_Config_drb->choice.am = calloc(1, sizeof(*rlc_Config_drb->choice.am));
|
||||
rlc_Config_drb->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config_drb->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18;
|
||||
rlc_Config_drb->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms80;
|
||||
rlc_Config_drb->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms10;
|
||||
rlc_Config_drb->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config_drb->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18;
|
||||
rlc_Config_drb->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms80;
|
||||
rlc_Config_drb->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64;
|
||||
rlc_Config_drb->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB125;
|
||||
rlc_Config_drb->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t4;
|
||||
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);
|
||||
}
|
||||
|
||||
void fill_initial_cellGroupConfig(rnti_t rnti,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
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;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
/*
|
||||
// SRB2
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig2 = NULL;
|
||||
NR_RLC_Config_t *rlc_Config2 = NULL;
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig2= NULL;
|
||||
long *logicalChannelGroup2 = NULL;
|
||||
rlc_BearerConfig2 = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig2->logicalChannelIdentity = 2;
|
||||
rlc_BearerConfig2->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig2->servedRadioBearer));
|
||||
rlc_BearerConfig2->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
|
||||
rlc_BearerConfig2->servedRadioBearer->choice.srb_Identity = 2;
|
||||
rlc_BearerConfig2->reestablishRLC = NULL;
|
||||
rlc_Config2 = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
rlc_Config2->present = NR_RLC_Config_PR_am;
|
||||
rlc_Config2->choice.am = calloc(1, sizeof(*rlc_Config2->choice.am));
|
||||
rlc_Config2->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config2->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config2->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35;
|
||||
rlc_Config2->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0;
|
||||
rlc_Config2->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config2->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config2->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45;
|
||||
rlc_Config2->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity;
|
||||
rlc_Config2->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
|
||||
rlc_Config2->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
|
||||
rlc_BearerConfig2->rlc_Config = rlc_Config2;
|
||||
logicalChannelConfig2 = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig2->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig2->ul_SpecificParameters));
|
||||
logicalChannelConfig2->ul_SpecificParameters->priority = 1;
|
||||
logicalChannelConfig2->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
logicalChannelGroup2 = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup2 = 0;
|
||||
logicalChannelConfig2->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup2;
|
||||
logicalChannelConfig2->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig2->ul_SpecificParameters->schedulingRequestID));
|
||||
*logicalChannelConfig2->ul_SpecificParameters->schedulingRequestID = 0;
|
||||
logicalChannelConfig2->ul_SpecificParameters->logicalChannelSR_Mask = 0;
|
||||
logicalChannelConfig2->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
|
||||
rlc_BearerConfig2->mac_LogicalChannelConfig = logicalChannelConfig2;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig2);
|
||||
*/
|
||||
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
|
||||
/* mac CellGroup Config */
|
||||
if (1) {
|
||||
mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig));
|
||||
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
|
||||
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
|
||||
struct NR_SchedulingRequestToAddMod *schedulingrequestlist;
|
||||
schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist));
|
||||
schedulingrequestlist->schedulingRequestId = 0;
|
||||
schedulingrequestlist->sr_ProhibitTimer = CALLOC(1,sizeof(*schedulingrequestlist->sr_ProhibitTimer));
|
||||
*(schedulingrequestlist->sr_ProhibitTimer) = 0;
|
||||
schedulingrequestlist->sr_TransMax = 0;
|
||||
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
|
||||
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_sf80;
|
||||
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(&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_sf10;
|
||||
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;
|
||||
}
|
||||
cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig;
|
||||
|
||||
physicalCellGroupConfig = calloc(1,sizeof(*physicalCellGroupConfig));
|
||||
physicalCellGroupConfig->p_NR_FR1 = calloc(1,sizeof(*physicalCellGroupConfig->p_NR_FR1));
|
||||
*physicalCellGroupConfig->p_NR_FR1 = 20;
|
||||
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(rnti,cellGroupConfig->spCellConfig,scc);
|
||||
|
||||
cellGroupConfig->sCellToAddModList = NULL;
|
||||
cellGroupConfig->sCellToReleaseList = NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
int CC_id,
|
||||
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
NR_SRB_ToAddModList_t **SRB_configList)
|
||||
OCTET_STRING_t *masterCellGroup_from_DU,
|
||||
NR_ServingCellConfigCommon_t *scc)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
asn_enc_rval_t enc_rval;;
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_DL_CCCH_Message_t dl_ccch_msg;
|
||||
NR_RRCSetup_t *rrcSetup;
|
||||
NR_RRCSetup_IEs_t *ie;
|
||||
NR_SRB_ToAddMod_t *SRB1_config = NULL;
|
||||
NR_PDCP_Config_t *pdcp_Config = NULL;
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
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;
|
||||
|
||||
char masterCellGroup_buf[1000];
|
||||
long *logicalChannelGroup = NULL;
|
||||
|
||||
AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n");
|
||||
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
||||
NR_SRB_ToAddModList_t **SRB_configList = &ue_p->SRB_configList;
|
||||
|
||||
|
||||
|
||||
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
|
||||
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
|
||||
@@ -963,6 +1345,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
ie = rrcSetup->criticalExtensions.choice.rrcSetup;
|
||||
|
||||
/****************************** radioBearerConfig ******************************/
|
||||
|
||||
/* Configure SRB1 */
|
||||
if (*SRB_configList) {
|
||||
free(*SRB_configList);
|
||||
@@ -982,97 +1365,59 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
ie->radioBearerConfig.drb_ToAddModList = NULL;
|
||||
ie->radioBearerConfig.drb_ToReleaseList = NULL;
|
||||
ie->radioBearerConfig.securityConfig = NULL;
|
||||
|
||||
|
||||
/****************************** masterCellGroup ******************************/
|
||||
/* TODO */
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
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;
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
cellGroupConfig->sCellToAddModList = NULL;
|
||||
cellGroupConfig->sCellToReleaseList = NULL;
|
||||
|
||||
/* mac CellGroup Config */
|
||||
mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t));
|
||||
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_sf80;
|
||||
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_sf10;
|
||||
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;
|
||||
cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig;
|
||||
|
||||
// cellGroupConfig.physicalCellGroupConfig;
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
masterCellGroup_buf,
|
||||
100);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
if (masterCellGroup_from_DU) {
|
||||
memcpy(&ie->masterCellGroup,masterCellGroup_from_DU,sizeof(*masterCellGroup_from_DU));
|
||||
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
|
||||
uper_decode(NULL,
|
||||
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
|
||||
(void **)&cellGroupConfig,
|
||||
(uint8_t *)masterCellGroup_from_DU->buf,
|
||||
masterCellGroup_from_DU->size, 0, 0);
|
||||
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig);
|
||||
}
|
||||
else {
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc);
|
||||
|
||||
if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) {
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
masterCellGroup_buf,
|
||||
1000);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) {
|
||||
LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ue_p->masterCellGroup = cellGroupConfig;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_ccch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
NULL,
|
||||
(void *)&dl_ccch_msg,
|
||||
buffer,
|
||||
1000);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -1146,6 +1491,11 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
|
||||
const uint8_t Transaction_id)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
NR_UE_CapabilityRequestFilterNR_t *sa_band_filter;
|
||||
NR_FreqBandList_t *sa_band_list;
|
||||
NR_FreqBandInformation_t *sa_band_info;
|
||||
NR_FreqBandInformationNR_t *sa_band_infoNR;
|
||||
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request;
|
||||
|
||||
@@ -1162,6 +1512,35 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
|
||||
memset(ue_capabilityrat_request,0,sizeof(NR_UE_CapabilityRAT_Request_t));
|
||||
ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr;
|
||||
|
||||
sa_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
|
||||
sa_band_infoNR->bandNR = 78;
|
||||
sa_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
|
||||
sa_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
|
||||
sa_band_info->choice.bandInformationNR = sa_band_infoNR;
|
||||
|
||||
sa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
|
||||
ASN_SEQUENCE_ADD(&sa_band_list->list, sa_band_info);
|
||||
|
||||
sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t));
|
||||
sa_band_filter->frequencyBandListFilter = sa_band_list;
|
||||
|
||||
OCTET_STRING_t req_freq;
|
||||
unsigned char req_freq_buf[1024];
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR,
|
||||
NULL,
|
||||
(void *)sa_band_filter,
|
||||
req_freq_buf,
|
||||
1024);
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_UE_CapabilityRequestFilterNR, (void *)sa_band_filter);
|
||||
}
|
||||
|
||||
req_freq.buf = req_freq_buf;
|
||||
req_freq.size = (enc_rval.encoded+7)/8;
|
||||
|
||||
ue_capabilityrat_request->capabilityRequestFilter = &req_freq;
|
||||
|
||||
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list,
|
||||
ue_capabilityrat_request);
|
||||
|
||||
@@ -1235,7 +1614,7 @@ uint8_t do_NR_RRCRelease(uint8_t *buffer,
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t do_RRCReconfiguration(
|
||||
int16_t do_RRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *buffer,
|
||||
uint8_t Transaction_id,
|
||||
@@ -1245,14 +1624,15 @@ uint16_t do_RRCReconfiguration(
|
||||
NR_SecurityConfig_t *security_config,
|
||||
NR_SDAP_Config_t *sdap_config,
|
||||
NR_MeasConfig_t *meas_config,
|
||||
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
|
||||
*dedicatedNAS_MessageList,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig)
|
||||
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
|
||||
NR_CellGroupConfig_t *cellGroupConfig)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_RRCReconfiguration_IEs_t *ie;
|
||||
unsigned char masterCellGroup_buf[1000];
|
||||
|
||||
memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t));
|
||||
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
|
||||
@@ -1296,20 +1676,42 @@ uint16_t do_RRCReconfiguration(
|
||||
// lateNonCriticalExtension
|
||||
ie->lateNonCriticalExtension = NULL;
|
||||
// nonCriticalExtension
|
||||
ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t));
|
||||
ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList;
|
||||
|
||||
if (cellGroupConfig || dedicatedNAS_MessageList) {
|
||||
ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t));
|
||||
if (dedicatedNAS_MessageList)
|
||||
ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList;
|
||||
}
|
||||
|
||||
if(cellGroupConfig!=NULL){
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
masterCellGroup_buf,
|
||||
1000);
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig);
|
||||
ie->nonCriticalExtension->masterCellGroup = calloc(1,sizeof(OCTET_STRING_t));
|
||||
|
||||
ie->nonCriticalExtension->masterCellGroup->buf = masterCellGroup_buf;
|
||||
ie->nonCriticalExtension->masterCellGroup->size = (enc_rval.encoded+7)/8;
|
||||
}
|
||||
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
//if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
|
||||
}
|
||||
//}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
1000);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
|
||||
@@ -1509,6 +1911,7 @@ do_NR_DLInformationTransfer(
|
||||
AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %ld)!\n",
|
||||
"DLInformationTransfer", encoded);
|
||||
LOG_D(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded);
|
||||
//for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]);
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
gNB_RrcConfigurationReq *configuration
|
||||
);
|
||||
|
||||
uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
gNB_RrcConfigurationReq *configuration);
|
||||
|
||||
void do_RLC_BEARER(uint8_t Mod_id,
|
||||
int CC_id,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList,
|
||||
@@ -86,12 +89,22 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
|
||||
uint8_t do_RRCReject(uint8_t Mod_id,
|
||||
uint8_t *const buffer);
|
||||
|
||||
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
int CC_id,
|
||||
void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
NR_SpCellConfig_t *SpCellConfig,
|
||||
NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
void fill_initial_cellGroupConfig(rnti_t rnti,
|
||||
NR_CellGroupConfig_t *cellGroupConfig,
|
||||
NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup);
|
||||
|
||||
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
NR_SRB_ToAddModList_t **SRB_configList);
|
||||
OCTET_STRING_t *masterCellGroup_from_DU,
|
||||
NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
uint8_t do_NR_SecurityModeCommand(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *const buffer,
|
||||
@@ -105,7 +118,8 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
|
||||
|
||||
uint8_t do_NR_RRCRelease(uint8_t *buffer,
|
||||
uint8_t Transaction_id);
|
||||
uint16_t do_RRCReconfiguration(
|
||||
|
||||
int16_t do_RRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *buffer,
|
||||
uint8_t Transaction_id,
|
||||
@@ -115,9 +129,9 @@ uint16_t do_RRCReconfiguration(
|
||||
NR_SecurityConfig_t *security_config,
|
||||
NR_SDAP_Config_t *sdap_config,
|
||||
NR_MeasConfig_t *meas_config,
|
||||
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
|
||||
*dedicatedNAS_MessageList,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig);
|
||||
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
|
||||
NR_CellGroupConfig_t *cellGroupConfig);
|
||||
|
||||
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
|
||||
uint8_t *buffer,
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
#include "NR_EstablishmentCause.h"
|
||||
#include "NR_SIB1.h"
|
||||
//-------------------
|
||||
|
||||
#include "intertask_interface.h"
|
||||
@@ -300,6 +301,7 @@ typedef struct gNB_RRC_UE_s {
|
||||
int UE_MRDC_Capability_size;
|
||||
|
||||
NR_CellGroupConfig_t *secondaryCellGroup;
|
||||
NR_CellGroupConfig_t *masterCellGroup;
|
||||
NR_RRCReconfiguration_t *reconfig;
|
||||
NR_RadioBearerConfig_t *rb_config;
|
||||
|
||||
@@ -315,7 +317,7 @@ typedef struct gNB_RRC_UE_s {
|
||||
NR_CipheringAlgorithm_t ciphering_algorithm;
|
||||
e_NR_IntegrityProtAlgorithm integrity_algorithm;
|
||||
|
||||
uint8_t status;
|
||||
uint8_t StatusRrc;
|
||||
rnti_t rnti;
|
||||
uint64_t random_ue_identity;
|
||||
|
||||
@@ -425,10 +427,21 @@ typedef struct {
|
||||
uint8_t *SIB1;
|
||||
uint8_t sizeof_SIB1;
|
||||
|
||||
uint8_t *SIB23;
|
||||
uint8_t sizeof_SIB23;
|
||||
|
||||
uint8_t *ServingCellConfigCommon;
|
||||
uint8_t sizeof_servingcellconfigcommon;
|
||||
|
||||
int physCellId;
|
||||
|
||||
NR_BCCH_BCH_Message_t mib;
|
||||
NR_BCCH_BCH_Message_t *mib_DU;
|
||||
NR_BCCH_DL_SCH_Message_t *siblock1_DU;
|
||||
NR_SIB1_t *sib1;
|
||||
NR_SIB2_t *sib2;
|
||||
NR_SIB3_t *sib3;
|
||||
NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23
|
||||
int ssb_SubcarrierOffset;
|
||||
int pdsch_AntennaPorts;
|
||||
int pusch_AntennaPorts;
|
||||
@@ -441,7 +454,6 @@ typedef struct {
|
||||
NR_SRB_INFO SI;
|
||||
NR_SRB_INFO Srb0;
|
||||
int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS];
|
||||
int physCellId;
|
||||
int p_gNB;
|
||||
|
||||
} rrc_gNB_carrier_data_t;
|
||||
@@ -461,6 +473,9 @@ typedef struct {
|
||||
//---NR---(completely change)---------------------
|
||||
typedef struct gNB_RRC_INST_s {
|
||||
|
||||
ngran_node_t node_type;
|
||||
uint32_t node_id;
|
||||
char *node_name;
|
||||
int module_id;
|
||||
eth_params_t eth_params_s;
|
||||
rrc_gNB_carrier_data_t carrier;
|
||||
@@ -472,6 +487,12 @@ typedef struct gNB_RRC_INST_s {
|
||||
hash_table_t *initial_id2_ngap_ids;
|
||||
hash_table_t *ngap_id2_ngap_ids ;
|
||||
|
||||
/// NR cell id
|
||||
uint64_t nr_cellid;
|
||||
|
||||
// RRC configuration
|
||||
gNB_RrcConfigurationReq configuration;
|
||||
|
||||
// other PLMN parameters
|
||||
/// Mobile country code
|
||||
int mcc;
|
||||
@@ -488,6 +509,10 @@ typedef struct gNB_RRC_INST_s {
|
||||
int srb1_timer_reordering;
|
||||
int srb1_timer_status_prohibit;
|
||||
int srs_enable[MAX_NUM_CCs];
|
||||
uint16_t sctp_in_streams;
|
||||
uint16_t sctp_out_streams;
|
||||
int cell_info_configured;
|
||||
pthread_mutex_t cell_info_mutex;
|
||||
|
||||
// security configuration (preferred algorithms)
|
||||
nr_security_configuration_t security;
|
||||
|
||||
@@ -106,6 +106,14 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
||||
NR_RRCReconfiguration_t *reconfig,
|
||||
NR_RadioBearerConfig_t *rbconfig);
|
||||
|
||||
void
|
||||
rrc_gNB_generate_RRCSetup(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
OCTET_STRING_t *masterCellGroup_from_DU,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
const int CC_id);
|
||||
|
||||
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
|
||||
|
||||
void
|
||||
@@ -177,6 +185,7 @@ int8_t nr_mac_rrc_data_ind(
|
||||
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
||||
const uint8_t *buffer,
|
||||
int buffer_length,
|
||||
OCTET_STRING_t *du_to_cu_rrc_container,
|
||||
const int CC_id);
|
||||
|
||||
void
|
||||
@@ -186,3 +195,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
|
||||
uint8_t xid,
|
||||
uint32_t nas_length,
|
||||
uint8_t *nas_buffer);
|
||||
|
||||
void
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP);
|
||||
|
||||
+823
-234
File diff suppressed because it is too large
Load Diff
+143
-99
@@ -57,6 +57,7 @@
|
||||
#include "RRC/NR/MESSAGES/asn1_msg.h"
|
||||
#include "NR_UERadioAccessCapabilityInformation.h"
|
||||
#include "NR_UE-CapabilityRAT-ContainerList.h"
|
||||
#include "f1ap_messages_types.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -303,25 +304,44 @@ nr_rrc_pdcp_config_security(
|
||||
uint8_t *kRRCenc = NULL;
|
||||
uint8_t *kRRCint = NULL;
|
||||
uint8_t *kUPenc = NULL;
|
||||
pdcp_t *pdcp_p = NULL;
|
||||
static int print_keys= 1;
|
||||
hashtable_rc_t h_rc;
|
||||
hash_key_t key;
|
||||
static int print_keys= 1;
|
||||
|
||||
#ifndef PHYSIM
|
||||
/* Derive the keys from kgnb */
|
||||
if (SRB_configList != NULL) {
|
||||
nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kUPenc);
|
||||
}
|
||||
|
||||
nr_derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kRRCenc);
|
||||
nr_derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kRRCint);
|
||||
uint8_t *k_kdf = NULL;
|
||||
|
||||
/* Derive the keys from kgnb */
|
||||
if (SRB_configList != NULL) {
|
||||
k_kdf = NULL;
|
||||
nr_derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&k_kdf);
|
||||
/* kUPenc: last 128 bits of key derivation function which returns 256 bits */
|
||||
kUPenc = malloc(16);
|
||||
if (kUPenc == NULL) exit(1);
|
||||
memcpy(kUPenc, k_kdf+16, 16);
|
||||
free(k_kdf);
|
||||
}
|
||||
|
||||
k_kdf = NULL;
|
||||
nr_derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&k_kdf);
|
||||
/* kRRCenc: last 128 bits of key derivation function which returns 256 bits */
|
||||
kRRCenc = malloc(16);
|
||||
if (kRRCenc == NULL) exit(1);
|
||||
memcpy(kRRCenc, k_kdf+16, 16);
|
||||
free(k_kdf);
|
||||
|
||||
k_kdf = NULL;
|
||||
nr_derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&k_kdf);
|
||||
/* kRRCint: last 128 bits of key derivation function which returns 256 bits */
|
||||
kRRCint = malloc(16);
|
||||
if (kRRCint == NULL) exit(1);
|
||||
memcpy(kRRCint, k_kdf+16, 16);
|
||||
free(k_kdf);
|
||||
#endif
|
||||
if (!IS_SOFTMODEM_IQPLAYER) {
|
||||
SET_LOG_DUMP(DEBUG_SECURITY) ;
|
||||
@@ -337,28 +357,18 @@ nr_rrc_pdcp_config_security(
|
||||
}
|
||||
}
|
||||
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||
|
||||
if (h_rc == HASH_TABLE_OK) {
|
||||
pdcp_config_set_security(
|
||||
ctxt_pP,
|
||||
pdcp_p,
|
||||
DCCH,
|
||||
DCCH+2,
|
||||
(send_security_mode_command == TRUE) ?
|
||||
0 | (ue_context_pP->ue_context.integrity_algorithm << 4) :
|
||||
(ue_context_pP->ue_context.ciphering_algorithm ) |
|
||||
(ue_context_pP->ue_context.integrity_algorithm << 4),
|
||||
kRRCenc,
|
||||
kRRCint,
|
||||
kUPenc);
|
||||
} else {
|
||||
LOG_E(NR_RRC,
|
||||
PROTOCOL_NR_RRC_CTXT_UE_FMT"Could not get PDCP instance for SRB DCCH %u\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
DCCH);
|
||||
}
|
||||
pdcp_config_set_security(
|
||||
ctxt_pP,
|
||||
NULL, /* pdcp_pP not used anymore in NR */
|
||||
DCCH,
|
||||
DCCH+2,
|
||||
(send_security_mode_command == TRUE) ?
|
||||
0 | (ue_context_pP->ue_context.integrity_algorithm << 4) :
|
||||
(ue_context_pP->ue_context.ciphering_algorithm ) |
|
||||
(ue_context_pP->ue_context.integrity_algorithm << 4),
|
||||
kRRCenc,
|
||||
kRRCint,
|
||||
kUPenc);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -424,57 +434,57 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ(
|
||||
NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity;
|
||||
|
||||
if (rrcSetupComplete->registeredAMF != NULL) {
|
||||
NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami;
|
||||
NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami;
|
||||
|
||||
if (r_amf->plmn_Identity != NULL) {
|
||||
if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) {
|
||||
/* Use first indicated PLMN MCC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
if (r_amf->plmn_Identity != NULL) {
|
||||
if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) {
|
||||
/* Use first indicated PLMN MCC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
|
||||
if (r_amf->plmn_Identity->mnc.list.count > 0) {
|
||||
/* Use first indicated PLMN MNC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
} else {
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
if (r_amf->plmn_Identity->mnc.list.count > 0) {
|
||||
/* Use first indicated PLMN MNC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n",
|
||||
/* amf_Identifier */
|
||||
uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier);
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
|
||||
|
||||
ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len;
|
||||
ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer;
|
||||
|
||||
MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB,
|
||||
MSC_NGAP_AMF,
|
||||
(const char *)&message_p->ittiMsg.ngap_nas_first_req,
|
||||
sizeof(ngap_nas_first_req_t),
|
||||
MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
} else {
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
/* amf_Identifier */
|
||||
uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier);
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
|
||||
|
||||
ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len;
|
||||
ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer;
|
||||
|
||||
MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB,
|
||||
MSC_NGAP_AMF,
|
||||
(const char *)&message_p->ittiMsg.ngap_nas_first_req,
|
||||
sizeof(ngap_nas_first_req_t),
|
||||
MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, message_p);
|
||||
@@ -569,7 +579,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
|
||||
}
|
||||
|
||||
// in case, send the S1SP initial context response if it is not sent with the attach complete message
|
||||
if (ue_context_p->ue_context.status == NR_RRC_RECONFIGURED) {
|
||||
if (ue_context_p->ue_context.StatusRrc == NR_RRC_RECONFIGURED) {
|
||||
LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
|
||||
}
|
||||
@@ -626,6 +636,10 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(
|
||||
}
|
||||
|
||||
static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(uint16_t algorithms) {
|
||||
|
||||
return NR_CipheringAlgorithm_nea0;
|
||||
|
||||
|
||||
if (algorithms & NGAP_ENCRYPTION_NEA3_MASK) {
|
||||
return NR_CipheringAlgorithm_nea3;
|
||||
}
|
||||
@@ -638,10 +652,13 @@ static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(uint16_t algorithms) {
|
||||
return NR_CipheringAlgorithm_nea1;
|
||||
}
|
||||
|
||||
return NR_CipheringAlgorithm_nea0;
|
||||
}
|
||||
|
||||
static e_NR_IntegrityProtAlgorithm rrc_gNB_select_integrity(uint16_t algorithms) {
|
||||
|
||||
//only NIA2 supported for now
|
||||
return NR_IntegrityProtAlgorithm_nia2;
|
||||
|
||||
if (algorithms & NGAP_INTEGRITY_NIA3_MASK) {
|
||||
return NR_IntegrityProtAlgorithm_nia3;
|
||||
}
|
||||
@@ -784,28 +801,54 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS(
|
||||
/*
|
||||
* switch UL or DL NAS message without RRC piggybacked to SRB2 if active.
|
||||
*/
|
||||
switch (RC.nrrrc[ctxt.module_id]->node_type) {
|
||||
case ngran_gNB_CU:
|
||||
/* Transfer data to PDCP */
|
||||
nr_rrc_data_req (
|
||||
&ctxt,
|
||||
ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id,
|
||||
(*rrc_gNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
buffer,
|
||||
PDCP_TRANSMISSION_MODE_CONTROL);
|
||||
break;
|
||||
|
||||
case ngran_gNB_DU:
|
||||
// nothing to do for DU
|
||||
AssertFatal(1==0,"nothing to do for DU\n");
|
||||
break;
|
||||
|
||||
case ngran_gNB:
|
||||
{
|
||||
// rrc_mac_config_req_gNB
|
||||
#ifdef ITTI_SIM
|
||||
MessageDef *message_p;
|
||||
uint8_t *message_buffer;
|
||||
message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, length);
|
||||
memcpy (message_buffer, buffer, length);
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND);
|
||||
MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND);
|
||||
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
|
||||
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
|
||||
GNB_RRC_DCCH_DATA_IND (message_p).size = length;
|
||||
itti_send_msg_to_task (TASK_RRC_UE_SIM, instance, message_p);
|
||||
LOG_I(NR_RRC, "Send DL NAS message \n");
|
||||
#else
|
||||
/* Transfer data to PDCP */
|
||||
nr_rrc_data_req (
|
||||
&ctxt,
|
||||
ue_context_p->ue_context.Srb2.Srb_info.Srb_id,
|
||||
(*rrc_gNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
buffer,
|
||||
PDCP_TRANSMISSION_MODE_CONTROL);
|
||||
/* Transfer data to PDCP */
|
||||
nr_rrc_data_req (
|
||||
&ctxt,
|
||||
ue_context_p->ue_context.Srb2.Active == 1 ? ue_context_p->ue_context.Srb2.Srb_info.Srb_id : ue_context_p->ue_context.Srb1.Srb_info.Srb_id,
|
||||
(*rrc_gNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
buffer,
|
||||
PDCP_TRANSMISSION_MODE_CONTROL);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt.module_id]->node_type);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@@ -1015,8 +1058,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
|
||||
ue_context_p->ue_context.setup_pdu_sessions += nb_pdusessions_tosetup;
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,16 +346,25 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
|
||||
rrc->Nb_ue++;
|
||||
// configure MAC and RLC
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
rrc->carrier.pdsch_AntennaPorts,
|
||||
rrc->carrier.pusch_AntennaPorts,
|
||||
rrc->carrier.pusch_TargetSNRx10,
|
||||
rrc->carrier.pucch_TargetSNRx10,
|
||||
NULL,
|
||||
1, // add_ue flag
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.secondaryCellGroup);
|
||||
if (NODE_IS_DU(rrc->node_type)) {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
rrc->carrier.pdsch_AntennaPorts,
|
||||
rrc->carrier.pusch_AntennaPorts,
|
||||
rrc->carrier.servingcellconfigcommon,
|
||||
1, // add_ue flag
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.secondaryCellGroup);
|
||||
} else {
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
rrc->carrier.pdsch_AntennaPorts,
|
||||
rrc->carrier.pusch_AntennaPorts,
|
||||
NULL,
|
||||
1, // add_ue flag
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.secondaryCellGroup);
|
||||
}
|
||||
|
||||
if(m == NULL){
|
||||
LOG_W(RRC, "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", &ctxt,
|
||||
@@ -366,26 +375,25 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
ctxt.eNB_index);
|
||||
}
|
||||
|
||||
nr_rrc_pdcp_config_asn1_req(
|
||||
&ctxt,
|
||||
(NR_SRB_ToAddModList_t *) NULL,
|
||||
ue_context_p->ue_context.rb_config->drb_ToAddModList ,
|
||||
ue_context_p->ue_context.rb_config->drb_ToReleaseList,
|
||||
(ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm,
|
||||
NULL, /* kRRCenc - unused */
|
||||
NULL, /* kRRCint - unused */
|
||||
kUPenc, /* kUPenc */
|
||||
NULL, /* kUPint - unused */
|
||||
NULL,
|
||||
NULL,
|
||||
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
|
||||
nr_rrc_pdcp_config_asn1_req(&ctxt,
|
||||
get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL,
|
||||
ue_context_p->ue_context.rb_config->drb_ToAddModList ,
|
||||
ue_context_p->ue_context.rb_config->drb_ToReleaseList,
|
||||
(ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm,
|
||||
NULL, /* kRRCenc - unused */
|
||||
NULL, /* kRRCint - unused */
|
||||
kUPenc, /* kUPenc */
|
||||
NULL, /* kUPint - unused */
|
||||
NULL,
|
||||
NULL,
|
||||
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
|
||||
|
||||
nr_rrc_rlc_config_asn1_req (&ctxt,
|
||||
(NR_SRB_ToAddModList_t *) NULL,
|
||||
ue_context_p->ue_context.rb_config->drb_ToAddModList,
|
||||
ue_context_p->ue_context.rb_config->drb_ToReleaseList,
|
||||
(LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
|
||||
get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL,
|
||||
ue_context_p->ue_context.rb_config->drb_ToAddModList,
|
||||
ue_context_p->ue_context.rb_config->drb_ToReleaseList,
|
||||
(LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
|
||||
|
||||
LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti);
|
||||
|
||||
@@ -394,7 +402,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
|
||||
protocol_ctxt_t ctxt;
|
||||
rrc_gNB_ue_context_t *ue_context;
|
||||
MessageDef *msg_delete_tunnels_p;
|
||||
int e_rab;
|
||||
|
||||
LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti);
|
||||
@@ -411,25 +418,18 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
|
||||
rrc_rlc_remove_ue(&ctxt);
|
||||
|
||||
mac_remove_nr_ue(rrc->module_id, rnti);
|
||||
|
||||
/* delete gtp tunnel */
|
||||
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ);
|
||||
memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = rnti;
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 1;
|
||||
|
||||
LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d\n", ue_context->ue_context.nb_of_e_rabs);
|
||||
gtpv1u_enb_delete_tunnel_req_t tmp={0};
|
||||
tmp.rnti=rnti;
|
||||
tmp.from_gnb=1;
|
||||
LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %d\n", ue_context->ue_context.nb_of_e_rabs, rnti);
|
||||
for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) {
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] =
|
||||
ue_context->ue_context.gnb_gtp_ebi[e_rab];
|
||||
tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.gnb_gtp_ebi[e_rab];
|
||||
// erase data
|
||||
ue_context->ue_context.gnb_gtp_teid[e_rab] = 0;
|
||||
memset(&ue_context->ue_context.gnb_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.gnb_gtp_addrs[e_rab]));
|
||||
ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0;
|
||||
}
|
||||
|
||||
itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p);
|
||||
|
||||
gtpv1u_delete_s1u_tunnel(rrc->module_id, &tmp);
|
||||
/* remove context */
|
||||
rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context);
|
||||
}
|
||||
|
||||
@@ -50,29 +50,9 @@
|
||||
#define true 1
|
||||
|
||||
void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon) {
|
||||
|
||||
bwp->bwp_Id = 0;
|
||||
|
||||
bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common));
|
||||
memcpy((void*)&bwp->bwp_Common,
|
||||
&servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP,
|
||||
sizeof(bwp->bwp_Common));
|
||||
|
||||
bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated));
|
||||
bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config));
|
||||
bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup));
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
|
||||
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
|
||||
*bwp->bwp_Common = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP;
|
||||
}
|
||||
|
||||
void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon) {
|
||||
@@ -174,7 +154,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t));
|
||||
secondaryCellGroup->cellGroupId = scg_id;
|
||||
NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
|
||||
nr_rlc_bearer_init(RLC_BearerConfig);
|
||||
nr_rlc_bearer_init(RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity);
|
||||
if (get_softmodem_params()->do_ra || get_softmodem_params()->sa)
|
||||
nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional);
|
||||
else
|
||||
@@ -183,9 +163,9 @@ 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;
|
||||
|
||||
secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig));
|
||||
secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
|
||||
NR_SchedulingRequestToAddMod_t *SchedulingRequestConf = calloc(1,sizeof(*SchedulingRequestConf));
|
||||
@@ -1033,7 +1013,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
long *delay[8];
|
||||
for (int i=0;i<8;i++) {
|
||||
delay[i] = calloc(1,sizeof(*delay[i]));
|
||||
*delay[i] = i+2;
|
||||
*delay[i] = (i<6) ? (i+2) : 0;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
|
||||
}
|
||||
pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
|
||||
|
||||
@@ -162,12 +162,10 @@ rrc_data_req_ue(
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
message_buffer = itti_malloc (TASK_RRC_UE, TASK_PDCP_UE, sdu_sizeP);
|
||||
LOG_D(RRC,"Sending RRC message for SRB %ld, sdu_size %d\n",rb_idP, sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ);
|
||||
message_p = itti_alloc_new_message ( TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
|
||||
+1006
-1076
File diff suppressed because it is too large
Load Diff
@@ -105,6 +105,9 @@ typedef struct NR_UE_RRC_INST_s {
|
||||
|
||||
NR_MeasConfig_t *meas_config;
|
||||
NR_CellGroupConfig_t *cell_group_config;
|
||||
NR_CellGroupConfig_t *scell_group_config;
|
||||
NR_ServingCellConfigCommonSIB_t *servingCellConfigCommonSIB;
|
||||
|
||||
NR_RadioBearerConfig_t *radio_bearer_config;
|
||||
|
||||
NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
|
||||
@@ -123,7 +126,7 @@ typedef struct NR_UE_RRC_INST_s {
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
|
||||
|
||||
uint8_t MBMS_flag;
|
||||
OAI_NR_UECapability_t *UECap;
|
||||
OAI_NR_UECapability_t *UECap;
|
||||
uint8_t *UECapability;
|
||||
uint8_t UECapability_size;
|
||||
|
||||
@@ -209,7 +212,7 @@ typedef struct NR_UE_RRC_INST_s {
|
||||
long selected_plmn_identity;
|
||||
Rrc_State_NR_t nrRrcState;
|
||||
Rrc_Sub_State_NR_t nrRrcSubState;
|
||||
as_nas_info_t initialNasMsg;
|
||||
as_nas_info_t initialNasMsg;
|
||||
} NR_UE_RRC_INST_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -83,6 +83,9 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include "openair3/NAS/UE/nas_ue_task.h"
|
||||
#include <executables/split_headers.h>
|
||||
#include <executables/nr-uesoftmodem.h>
|
||||
#if ITTI_SIM
|
||||
#include "nr_nas_msg_sim.h"
|
||||
#endif
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
@@ -412,6 +415,12 @@ int create_tasks_nrue(uint32_t ue_nb) {
|
||||
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"create TASK_NAS_NRUE\n");
|
||||
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
|
||||
LOG_E(NR_RRC, "Create task for NAS UE failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -579,8 +588,14 @@ int main( int argc, char **argv )
|
||||
init_pdcp();
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
nr_read_config_and_init();
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
|
||||
for (int gnb_id = 0; gnb_id < RC.nb_nr_inst; gnb_id++) {
|
||||
MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ);
|
||||
NRRRC_CONFIGURATION_REQ(msg_p) = RC.nrrrc[gnb_id]->configuration;
|
||||
itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
}
|
||||
} else {
|
||||
printf("No ITTI, Initializing L1\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user