Merge branch 'CSI-SA' into aw2s-n41
Conflicts: openair1/PHY/NR_TRANSPORT/pucch_rx.c openair2/LAYER2/NR_MAC_gNB/config.c
This commit is contained in:
@@ -22,9 +22,7 @@
|
||||
#ifndef __MAC_RRC_PRIMITIVES_H__
|
||||
#define __MAC_RRC_PRIMITIVES_H__
|
||||
|
||||
#ifndef OPENAIR2_IN
|
||||
#include "LAYER2/RLC/rlc.h"
|
||||
#endif
|
||||
#include "LAYER2/RLC/rlc.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "openair2/RRC/LTE/rrc_defs.h"
|
||||
@@ -306,8 +304,6 @@ typedef struct {
|
||||
|
||||
|
||||
|
||||
#ifndef OPENAIR2_IN
|
||||
|
||||
typedef struct { //RRC_INTERFACE_FUNCTIONS
|
||||
unsigned int Frame_index;
|
||||
unsigned short UE_index[NB_MODULES_MAX][NB_SIG_CNX_UE];
|
||||
@@ -375,10 +371,6 @@ typedef struct {
|
||||
} MAC_RLC_XFACE;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//#define IDLE 0
|
||||
#define NEED_RADIO_CONFIG 3
|
||||
#define RADIO_CONFIG_TX 2
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
#else
|
||||
#define MAX_MOBILES_PER_ENB 4
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 4
|
||||
#define MAX_MOBILES_PER_GNB 2//16
|
||||
#define MAX_MOBILES_PER_GNB 4//16
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
#endif
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
rrm_config_structs.h
|
||||
-------------------
|
||||
AUTHOR : Linus GASSER modified by Lionel GAUTHIER Raymond KNOPP
|
||||
COMPANY : EURECOM
|
||||
EMAIL : linus.gasser@epfl.ch
|
||||
EMAIL : lionel.gauthier@eurecom.fr
|
||||
EMAIL : raymond.knopp@eurecom.fr
|
||||
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
#ifdef OLD_RRC_CELLULAR
|
||||
# ifndef __RRM_CONFIG_STRUCTS_H__
|
||||
# define __RRM_CONFIG_STRUCTS_H__
|
||||
|
||||
# include "platform_types.h"
|
||||
# include "platform_constants.h"
|
||||
# include "rrm_constants.h"
|
||||
# include "rlc.h"
|
||||
|
||||
typedef volatile struct {
|
||||
uint32_t e_r;
|
||||
int timer_poll;
|
||||
int timer_poll_prohibit;
|
||||
int timer_discard;
|
||||
int timer_poll_periodic;
|
||||
int timer_status_prohibit;
|
||||
int timer_status_periodic;
|
||||
int timer_rst;
|
||||
int timer_mrw;
|
||||
int missing_pdu_indicator;
|
||||
uint32_t pdu_size;
|
||||
// int in_sequence_delivery; // not implemented
|
||||
uint8_t max_rst;
|
||||
uint8_t max_dat;
|
||||
uint16_t poll_pdu;
|
||||
uint16_t poll_sdu;
|
||||
uint8_t poll_window;
|
||||
uint32_t tx_window_size;
|
||||
uint32_t rx_window_size;
|
||||
uint8_t max_mrw;
|
||||
uint8_t last_transmission_pdu_poll_trigger;
|
||||
uint8_t last_retransmission_pdu_poll_trigger;
|
||||
enum RLC_SDU_DISCARD_MODE sdu_discard_mode;
|
||||
uint32_t send_mrw;
|
||||
} AM;
|
||||
|
||||
typedef volatile struct {
|
||||
uint32_t e_r;
|
||||
uint32_t timer_discard;
|
||||
uint32_t sdu_discard_mode;
|
||||
uint32_t segmentation_indication;
|
||||
uint32_t delivery_of_erroneous_sdu;
|
||||
} TM;
|
||||
|
||||
typedef volatile struct {
|
||||
uint32_t e_r;
|
||||
uint32_t timer_discard;
|
||||
uint32_t sdu_discard_mode;
|
||||
} UM;
|
||||
|
||||
typedef volatile struct {
|
||||
uint8_t logch_identity;
|
||||
uint8_t mac_logch_priority;
|
||||
} MAP_INFO;
|
||||
|
||||
typedef volatile struct {
|
||||
uint32_t rlc_mode;
|
||||
AM am;
|
||||
TM tm;
|
||||
UM um;
|
||||
} RLC_INFO;
|
||||
|
||||
typedef volatile struct {
|
||||
int header_compression_algorithm;
|
||||
} PDCP_INFO;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
rb_type_t rb_type;
|
||||
RLC_INFO rlc_info;
|
||||
PDCP_INFO pdcp_info;
|
||||
uint16_t rb_id;
|
||||
// Added for OPENAIR MAC
|
||||
//LCHAN_DESC Lchan_desc;
|
||||
|
||||
} RADIOBEARER;
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
int TIMER300;
|
||||
int TIMER302;
|
||||
int TIMER305;
|
||||
int TIMER307;
|
||||
int TIMER308;
|
||||
int TIMER312;
|
||||
int TIMER313;
|
||||
int TIMER314;
|
||||
int TIMER315;
|
||||
} L3TIMERS_;
|
||||
|
||||
typedef volatile struct {
|
||||
int COUNTERN300;
|
||||
int COUNTERN302;
|
||||
int COUNTERN308;
|
||||
int COUNTERN312;
|
||||
int COUNTERN313;
|
||||
} L3COUNTERS_;
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
int MaxNumRemote;
|
||||
L3TIMERS_ Timers;
|
||||
L3COUNTERS_ Counters;
|
||||
} L3_;
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
uint8_t rrm_action; // ACTION_NULL,ADD,REMOVE,MODIFY
|
||||
uint8_t rrm_element; // rb,trch,cctrch
|
||||
uint8_t rrm_element_index; // rb/trch/cctrch index
|
||||
} RRM_COMMAND_MT;
|
||||
|
||||
typedef volatile struct {
|
||||
uint8_t rrm_action; // ACTION_NULL,ADD,REMOVE,MODIFY
|
||||
uint8_t mobile;
|
||||
uint8_t rrm_element; // rb,trch,cctrch
|
||||
uint8_t rrm_element_index; // rb/trch/cctrch index
|
||||
} RRM_COMMAND_RG;
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
uint8_t nb_commands;
|
||||
RRM_COMMAND_RG rrm_commands[JRRM_MAX_COMMANDS_PER_TRANSACTION];
|
||||
|
||||
|
||||
RADIOBEARER bearer[MAX_RB_RG];
|
||||
L3_ L3;
|
||||
|
||||
} RG_CONFIG;
|
||||
|
||||
typedef volatile struct {
|
||||
uint8_t nb_commands;
|
||||
RRM_COMMAND_MT rrm_commands[JRRM_MAX_COMMANDS_PER_TRANSACTION];
|
||||
|
||||
RADIOBEARER bearer[MAX_RB_MOBILE];
|
||||
L3_ L3;
|
||||
|
||||
} MT_CONFIG;
|
||||
|
||||
# ifdef NODE_RG
|
||||
typedef volatile struct {
|
||||
RG_CONFIG rg_config;
|
||||
MT_CONFIG mt_config[MAX_MOBILES_PER_RG];
|
||||
} RRM_VARS;
|
||||
|
||||
# else
|
||||
/* NODE_RG */
|
||||
typedef volatile struct {
|
||||
MT_CONFIG mt_config[MAX_MANAGED_RG_PER_MOBILE];
|
||||
|
||||
|
||||
|
||||
} RRM_VARS;
|
||||
# endif
|
||||
/* NODE_RG */
|
||||
//typedef MT_CONFIG MAIN_MOBILE ;
|
||||
//typedef RG_CONFIG MAIN_RADIO_GATEWAY;
|
||||
|
||||
# endif
|
||||
#endif
|
||||
@@ -33,7 +33,7 @@ MESSAGE_DEF(X2AP_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgT
|
||||
/* eNB application layer -> X2AP messages */
|
||||
MESSAGE_DEF(X2AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, x2ap_register_enb_req_t , x2ap_register_enb_req)
|
||||
MESSAGE_DEF(X2AP_SUBFRAME_PROCESS , MESSAGE_PRIORITY_MED, x2ap_subframe_process_t , x2ap_subframe_process)
|
||||
|
||||
MESSAGE_DEF(X2AP_RESET_REQ , MESSAGE_PRIORITY_MED, x2ap_reset_req_t , x2ap_reset_req)
|
||||
/* X2AP -> eNB application layer messages */
|
||||
MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_register_enb_cnf_t , x2ap_register_enb_cnf)
|
||||
MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind)
|
||||
|
||||
@@ -38,6 +38,8 @@ typedef enum {
|
||||
#define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req
|
||||
#define X2AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_req
|
||||
#define X2AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_resp
|
||||
#define X2AP_RESET_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_reset_req
|
||||
#define X2AP_RESET_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_reset_resp
|
||||
#define X2AP_HANDOVER_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req
|
||||
#define X2AP_HANDOVER_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req_ack
|
||||
#define X2AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_cnf
|
||||
@@ -68,6 +70,14 @@ typedef struct x2ap_setup_resp_s {
|
||||
int num_cc;
|
||||
} x2ap_setup_resp_t;
|
||||
|
||||
typedef struct x2ap_reset_req_s {
|
||||
uint32_t cause;
|
||||
} x2ap_reset_req_t;
|
||||
|
||||
typedef struct x2ap_reset_resp_s {
|
||||
int dummy;
|
||||
} x2ap_reset_resp_t;
|
||||
|
||||
/* X2AP UE CONTEXT RELEASE */
|
||||
typedef struct x2ap_ue_context_release_s {
|
||||
/* used for X2AP->RRC in source and RRC->X2AP in target */
|
||||
|
||||
@@ -55,11 +55,16 @@
|
||||
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc"
|
||||
#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_ULSCH_MAX_FRAME_INACTIVITY "ulsch_max_frame_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"
|
||||
#define CONFIG_STRING_MACRLC_DL_BLER_TARGET_UPPER "dl_bler_target_upper"
|
||||
#define CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER "dl_bler_target_lower"
|
||||
#define CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD "dl_rd2_bler_threshold"
|
||||
#define CONFIG_STRING_MACRLC_DL_MAX_MCS "dl_max_mcs"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* MacRLC configuration parameters */
|
||||
@@ -83,11 +88,15 @@
|
||||
{CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \
|
||||
{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_ULSCH_MAX_FRAME_INACTIVITY, NULL, 0, uptr:NULL, defintval:10, 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}, \
|
||||
{CONFIG_STRING_MACRLC_DL_BLER_TARGET_UPPER, "Upper threshold of BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.15, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER, "Lower threshold of BLER to increase DL MCS", 0, dblptr:NULL, defdblval:0.05, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD, "Threshold of RD2/RETX2 BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.01, TYPE_DOUBLE, 0}, \
|
||||
{CONFIG_STRING_MACRLC_DL_MAX_MCS, "Maximum DL MCS that should be used", 0, u8ptr:NULL, defintval:28, TYPE_UINT8, 0}, \
|
||||
}
|
||||
#define MACRLC_CC_IDX 0
|
||||
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
|
||||
@@ -106,10 +115,15 @@
|
||||
#define MACRLC_REMOTE_S_PORTC_IDX 14
|
||||
#define MACRLC_LOCAL_S_PORTD_IDX 15
|
||||
#define MACRLC_REMOTE_S_PORTD_IDX 16
|
||||
#define MACRLC_ULSCH_MAX_SLOTS_INACTIVITY 17
|
||||
#define MACRLC_ULSCH_MAX_FRAME_INACTIVITY 17
|
||||
#define MACRLC_PUSCHTARGETSNRX10_IDX 18
|
||||
#define MACRLC_PUCCHTARGETSNRX10_IDX 19
|
||||
#define MACRLC_PUCCHFAILURETHRES_IDX 20
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 21
|
||||
#define MACRLC_DL_BLER_TARGET_UPPER_IDX 22
|
||||
#define MACRLC_DL_BLER_TARGET_LOWER_IDX 23
|
||||
#define MACRLC_DL_RD2_BLER_THRESHOLD_IDX 24
|
||||
#define MACRLC_DL_MAX_MCS_IDX 25
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -549,6 +549,30 @@ void RCconfig_nr_flexran()
|
||||
|
||||
void RCconfig_NR_L1(void) {
|
||||
int j;
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
////////// Identification parameters
|
||||
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 (num_gnbs > 0,"Failed to parse config file no gnbs %s \n",GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
|
||||
if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl);
|
||||
char *pt = strtok(ulprbbl,",");
|
||||
int prbbl[275];
|
||||
int num_prbbl=0;
|
||||
memset(prbbl,0,275*sizeof(int));
|
||||
|
||||
while (pt) {
|
||||
prbbl[atoi(pt)] = 1;
|
||||
LOG_I(NR_PHY,"Blacklisting prb %d\n",atoi(pt));
|
||||
pt = strtok(NULL,",");
|
||||
num_prbbl++;
|
||||
}
|
||||
|
||||
paramdef_t L1_Params[] = L1PARAMS_DESC;
|
||||
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};
|
||||
|
||||
@@ -577,6 +601,9 @@ void RCconfig_NR_L1(void) {
|
||||
RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr);
|
||||
RC.gNB[j]->num_ulprbbl = num_prbbl;
|
||||
LOG_I(NR_PHY,"Copying %d blacklisted PRB to L1 context\n",num_prbbl);
|
||||
memcpy(RC.gNB[j]->ulprbbl,prbbl,275*sizeof(int));
|
||||
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) {
|
||||
@@ -633,9 +660,31 @@ void RCconfig_NR_L1(void) {
|
||||
void RCconfig_nr_macrlc() {
|
||||
int j;
|
||||
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
////////// Identification parameters
|
||||
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 (num_gnbs > 0,"Failed to parse config file no gnbs %s \n",GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
|
||||
char *pt = strtok(ulprbbl,",");
|
||||
int prbbl[275];
|
||||
int num_prbbl=0;
|
||||
int prb;
|
||||
memset(prbbl,0,275*sizeof(int));
|
||||
while (pt) {
|
||||
prb=atoi(pt);
|
||||
prbbl[prb] = 1;
|
||||
pt = strtok(NULL,",");
|
||||
num_prbbl++;
|
||||
}
|
||||
paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
|
||||
paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
|
||||
|
||||
config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
|
||||
if ( MacRLC_ParamList.numelt > 0) {
|
||||
@@ -701,7 +750,13 @@ void RCconfig_nr_macrlc() {
|
||||
}else { // other midhaul
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
RC.nrmac[j]->ulsch_max_slots_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_SLOTS_INACTIVITY].uptr);
|
||||
RC.nrmac[j]->ulsch_max_frame_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_FRAME_INACTIVITY].uptr);
|
||||
RC.nrmac[j]->dl_bler_target_upper = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_UPPER_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_bler_target_lower = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_LOWER_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_rd2_bler_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_RD2_BLER_THRESHOLD_IDX].dblptr);
|
||||
RC.nrmac[j]->dl_max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_MAX_MCS_IDX].u8ptr);
|
||||
RC.nrmac[j]->num_ulprbbl = num_prbbl;
|
||||
memcpy(RC.nrmac[j]->ulprbbl,prbbl,275*sizeof(prbbl[0]));
|
||||
}// for (j=0;j<RC.nb_nr_macrlc_inst;j++)
|
||||
}else {// MacRLC_ParamList.numelt > 0
|
||||
LOG_E(PHY,"No %s configuration found\n", CONFIG_STRING_MACRLC_LIST);
|
||||
|
||||
@@ -42,10 +42,7 @@
|
||||
#include "ngap_messages_types.h"
|
||||
#include "f1ap_messages_types.h"
|
||||
|
||||
#ifdef CMAKER
|
||||
#include "rrc_messages_types.h"
|
||||
#endif
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "RRC/NR/nr_rrc_defs.h"
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ typedef enum {
|
||||
#define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS"
|
||||
#define GNB_CONFIG_STRING_NRCELLID "nr_cellid"
|
||||
#define GNB_CONFIG_STRING_MINRXTXTIMEPDSCH "min_rxtxtime_pdsch"
|
||||
#define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* cell configuration parameters */
|
||||
@@ -146,8 +148,9 @@ typedef enum {
|
||||
{GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \
|
||||
{GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0} \
|
||||
}
|
||||
{GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0} \
|
||||
}
|
||||
|
||||
#define GNB_GNB_ID_IDX 0
|
||||
#define GNB_CELL_TYPE_IDX 1
|
||||
@@ -170,6 +173,7 @@ typedef enum {
|
||||
#define GNB_DO_CSIRS_IDX 18
|
||||
#define GNB_NRCELLID_IDX 19
|
||||
#define GNB_MINRXTXTIMEPDSCH_IDX 20
|
||||
#define GNB_ULPRBBLACKLIST_IDX 21
|
||||
|
||||
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
|
||||
#define GNBPARAMS_CHECK { \
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
*/
|
||||
#ifndef __LAYER2_MAC_DEFS_NB_IOT_H__
|
||||
#define __LAYER2_MAC_DEFS_NB_IOT_H__
|
||||
#ifdef USER_MODE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
//#include "COMMON/openair_defs.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
|
||||
@@ -105,13 +105,11 @@ eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN
|
||||
eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
|
||||
|
||||
|
||||
#ifdef OPENAIR2
|
||||
unsigned char NB_eNB_INST = 0;
|
||||
uint16_t NB_UE_INST = 0;
|
||||
uint16_t NB_THREAD_INST = 0;
|
||||
unsigned char NB_RN_INST = 0;
|
||||
unsigned char NB_INST = 0;
|
||||
#endif
|
||||
|
||||
|
||||
DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
|
||||
|
||||
@@ -77,13 +77,6 @@ static int mbms_mch_i=0;
|
||||
//static int num_msi_per_CSA[28];
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
#ifndef USER_MODE
|
||||
#define msg debug_msg
|
||||
#endif
|
||||
*/
|
||||
|
||||
mapping BSR_names[] = {
|
||||
{"NONE", 0},
|
||||
{"SHORT BSR", 1},
|
||||
@@ -1251,65 +1244,6 @@ int ue_query_mch_fembms(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef OLD
|
||||
// Acount for sf_allocable in CSA
|
||||
int num_sf_alloc = 0;
|
||||
|
||||
for (l = 0; l < 8; l++) {
|
||||
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
|
||||
continue;
|
||||
|
||||
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
|
||||
continue;
|
||||
|
||||
uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.choice.oneFrame.buf[0];
|
||||
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x80 >> j)) == (0x80 >> j));
|
||||
//num_sf_alloc=1;
|
||||
}
|
||||
|
||||
num_sf_alloc = 10;
|
||||
|
||||
num_non_mbsfn_SubframeConfig = (UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]<<1 | UE_mac_inst[module_idP].non_mbsfn_SubframeConfig->subframeAllocation_r14.buf[0]>>7);
|
||||
int ones=0;
|
||||
for(j=0; j < 16; j++){
|
||||
if(num_non_mbsfn_SubframeConfig & 1)
|
||||
ones++;
|
||||
num_non_mbsfn_SubframeConfig>>=1;
|
||||
}
|
||||
|
||||
for (l = 0; l < 28; l++) {
|
||||
if (UE_mac_inst[module_idP].pmch_stop_mtch[l] >= 1/*num_sf_alloc*/) {
|
||||
if (UE_mac_inst[module_idP].pmch_stop_mtch[l] != 2047) {
|
||||
if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL){
|
||||
mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
|
||||
//int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]->radioframeAllocationOffset;
|
||||
long common_mbsfn_period = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]->radioframeAllocationPeriod;
|
||||
long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
|
||||
if(UE_mac_inst[module_idP].common_num_sf_alloc >= UE_mac_inst[module_idP].pmch_stop_mtch[l]){
|
||||
//LOG_E(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);
|
||||
|
||||
mtch_mcs = -1;
|
||||
}/*else
|
||||
OG_W(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);*/
|
||||
LOG_D(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d num_sf_alloc %d commonSF_AllocPeriod %ld, common_mbsfn_period %ld num_non_mbsfn_SubframeConfig %x ones %d\n",UE_mac_inst[module_idP].common_num_sf_alloc,num_sf_alloc, commonSF_AllocPeriod,common_mbsfn_period,num_non_mbsfn_SubframeConfig,ones);
|
||||
UE_mac_inst[module_idP].common_num_sf_alloc++;
|
||||
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period-(1+ones)*(commonSF_AllocPeriod/4)); //TODO
|
||||
}
|
||||
else
|
||||
mtch_mcs = -1;
|
||||
|
||||
mch_lcid = (uint8_t)l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
// Acount for sf_allocable in Common SF Allocation
|
||||
int num_sf_alloc = 0;
|
||||
@@ -1869,49 +1803,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
|
||||
//}
|
||||
}
|
||||
|
||||
#ifdef OLD
|
||||
// Acount for sf_allocable in CSA
|
||||
int num_sf_alloc = 0;
|
||||
|
||||
for (l = 0; l < 8; l++) {
|
||||
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l] == NULL)
|
||||
continue;
|
||||
|
||||
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
|
||||
continue;
|
||||
|
||||
uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[l]->subframeAllocation.choice.oneFrame.buf[0];
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x80 >> j)) == (0x80 >> j));
|
||||
//num_sf_alloc=1;
|
||||
}
|
||||
|
||||
for (l = 0; l < 28; l++) {
|
||||
if (UE_mac_inst[module_idP].pmch_stop_mtch[l] >= 1/*num_sf_alloc*/) {
|
||||
if (UE_mac_inst[module_idP].pmch_stop_mtch[l] != 2047) {
|
||||
if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL){
|
||||
mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
|
||||
long common_mbsfn_period = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]->radioframeAllocationPeriod;
|
||||
long commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
|
||||
if(UE_mac_inst[module_idP].common_num_sf_alloc >= UE_mac_inst[module_idP].pmch_stop_mtch[l]){
|
||||
//LOG_E(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);
|
||||
|
||||
mtch_mcs = -1;
|
||||
}/*else
|
||||
LOG_W(MAC,"Attemp to UE_mac_inst[module_idP].common_num_sf_alloc %d\n",UE_mac_inst[module_idP].common_num_sf_alloc);*/
|
||||
UE_mac_inst[module_idP].common_num_sf_alloc++;
|
||||
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);
|
||||
}
|
||||
else
|
||||
mtch_mcs = -1;
|
||||
|
||||
mch_lcid = (uint8_t)l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
// Acount for sf_allocable in Common SF Allocation
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
|
||||
#include "NR_SubcarrierSpacing.h"
|
||||
|
||||
#define NR_SHORT_BSR_TABLE_SIZE 32
|
||||
#define NR_LONG_BSR_TABLE_SIZE 256
|
||||
|
||||
#define TABLE_38213_13_1_NUM_INDEXES 15
|
||||
#define TABLE_38213_13_2_NUM_INDEXES 14
|
||||
#define TABLE_38213_13_3_NUM_INDEXES 9
|
||||
@@ -65,6 +68,11 @@ typedef enum frequency_range_e {
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
#define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */
|
||||
#define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
|
||||
#define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
|
||||
#define NR_BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// Except:
|
||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||
|
||||
@@ -48,6 +48,33 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) {
|
||||
}
|
||||
}
|
||||
|
||||
//38.321 Table 6.1.3.1-1
|
||||
const uint32_t NR_SHORT_BSR_TABLE[NR_SHORT_BSR_TABLE_SIZE] = {
|
||||
0, 10, 14, 20, 28, 38, 53, 74,
|
||||
102, 142, 198, 276, 384, 535, 745, 1038,
|
||||
1446, 2014, 2806, 3909, 5446, 7587, 10570, 14726,
|
||||
20516, 28581, 39818, 55474, 77284, 107669, 150000, 300000
|
||||
};
|
||||
|
||||
//38.321 Table 6.1.3.1-2
|
||||
const uint32_t NR_LONG_BSR_TABLE[NR_LONG_BSR_TABLE_SIZE] ={
|
||||
0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26,
|
||||
28, 30, 32, 34, 36, 38, 40, 43, 46, 49, 52, 55, 59, 62, 66, 71,
|
||||
75, 80, 85, 91, 97, 103, 110, 117, 124, 132, 141, 150, 160, 170, 181, 193,
|
||||
205, 218, 233, 248, 264, 281, 299, 318, 339, 361, 384, 409, 436, 464, 494, 526,
|
||||
560, 597, 635, 677, 720, 767, 817, 870, 926, 987, 1051, 1119, 1191, 1269, 1351, 1439,
|
||||
1532, 1631, 1737, 1850, 1970, 2098, 2234, 2379, 2533, 2698, 2873, 3059, 3258, 3469, 3694, 3934,
|
||||
4189, 4461, 4751, 5059, 5387, 5737, 6109, 6506, 6928, 7378, 7857, 8367, 8910, 9488, 10104, 10760,
|
||||
11458, 12202, 12994, 13838, 14736, 15692, 16711, 17795, 18951, 20181, 21491, 22885, 24371, 25953, 27638, 29431,
|
||||
31342, 33376, 35543, 37850, 40307, 42923, 45709, 48676, 51836, 55200, 58784, 62599, 66663, 70990, 75598, 80505,
|
||||
85730, 91295, 97221, 103532, 110252, 117409, 125030, 133146, 141789, 150992, 160793, 171231, 182345, 194182, 206786, 220209,
|
||||
234503, 249725, 265935, 283197, 301579, 321155, 342002, 364202, 387842, 413018, 439827, 468377, 498780, 531156, 565634, 602350,
|
||||
641449, 683087, 727427, 774645, 824928, 878475, 935498, 996222, 1060888, 1129752, 1203085, 1281179, 1364342, 1452903, 1547213, 1647644,
|
||||
1754595, 1868488, 1989774, 2118933, 2256475, 2402946, 2558924, 2725027, 2901912, 3090279, 3290873, 3504487, 3731968, 3974215, 4232186, 4506902,
|
||||
4799451, 5110989, 5442750, 5796046, 6172275, 6572925, 6999582, 7453933, 7937777, 8453028, 9001725, 9586039, 10208280, 10870913, 11576557, 12328006,
|
||||
13128233, 13980403, 14887889, 15854280, 16883401, 17979324, 19146385, 20389201, 21712690, 23122088, 24622972, 26221280, 27923336, 29735875, 31666069, 33721553,
|
||||
35910462, 38241455, 40723756, 43367187, 46182206, 49179951, 52372284, 55771835, 59392055, 63247269, 67352729, 71724679, 76380419, 81338368, 162676736, 4294967295
|
||||
};
|
||||
|
||||
// start symbols for SSB types A,B,C,D,E
|
||||
uint16_t symbol_ssb_AC[8]={2,8,16,22,30,36,44,50};
|
||||
@@ -359,7 +386,6 @@ void get_info_from_tda_tables(int default_abc,
|
||||
}
|
||||
|
||||
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
||||
const char *duplex_mode[]={"FDD","TDD"};
|
||||
|
||||
uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) {
|
||||
|
||||
@@ -1573,60 +1599,6 @@ int get_nr_prach_occasion_info_from_index(uint8_t index,
|
||||
}
|
||||
|
||||
|
||||
uint8_t get_nr_prach_duration(uint8_t prach_format){
|
||||
|
||||
switch(prach_format){
|
||||
|
||||
case 0: // format 0
|
||||
return 0;
|
||||
|
||||
case 1: // format 1
|
||||
return 0;
|
||||
|
||||
case 2: // format 2
|
||||
return 0;
|
||||
|
||||
case 3: // format 3
|
||||
return 0;
|
||||
|
||||
case 4: // format A1
|
||||
return 2;
|
||||
|
||||
case 5: // format A2
|
||||
return 4;
|
||||
|
||||
case 6: // format A3
|
||||
return 6;
|
||||
|
||||
case 7: // format B1
|
||||
return 2;
|
||||
|
||||
case 8: // format B4
|
||||
return 12;
|
||||
|
||||
case 9: // format C0
|
||||
return 2;
|
||||
|
||||
case 10: // format C2
|
||||
return 6;
|
||||
|
||||
case 11: // format A1/B1
|
||||
return 2;
|
||||
|
||||
case 12: // format A2/B2
|
||||
return 4;
|
||||
|
||||
case 13: // format A3/B3
|
||||
return 6;
|
||||
|
||||
default :
|
||||
AssertFatal(1==0,"Invalid Prach format\n");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int get_nr_prach_info_from_index(uint8_t index,
|
||||
int frame,
|
||||
int slot,
|
||||
@@ -1981,170 +1953,6 @@ int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = {
|
||||
{0, 3072, -1, -1, 3, 1539, -1, -1}, //14 // (DMRS l' position)
|
||||
};
|
||||
|
||||
// Returns the corresponding row index of the NR table
|
||||
int get_nr_table_idx(int nr_bandP, uint8_t scs_index)
|
||||
{
|
||||
int i, j;
|
||||
int scs_khz = 15 << scs_index;
|
||||
int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95};
|
||||
size_t s = sizeof(supplementary_bands)/sizeof(supplementary_bands[0]);
|
||||
|
||||
for(j = 0; j < s; j++){
|
||||
if (nr_bandP == supplementary_bands[j])
|
||||
AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]);
|
||||
}
|
||||
|
||||
AssertFatal(nr_bandP <= nr_bandtable[nr_bandtable_size-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[nr_bandtable_size-1].band);
|
||||
for (i = 0; i < nr_bandtable_size && nr_bandtable[i].band != nr_bandP; i++);
|
||||
|
||||
// selection of correct Deltaf raster according to SCS
|
||||
if ((nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
||||
i++;
|
||||
|
||||
LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// Computes the duplex spacing (either positive or negative) in KHz
|
||||
int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index)
|
||||
{
|
||||
int nr_table_idx = get_nr_table_idx(nr_bandP, scs_index);
|
||||
|
||||
int32_t delta_duplex = (nr_bandtable[nr_table_idx].ul_min - nr_bandtable[nr_table_idx].dl_min);
|
||||
|
||||
LOG_I(NR_MAC, "NR band duplex spacing is %d KHz (nr_bandtable[%d].band = %d)\n", delta_duplex, nr_table_idx, nr_bandtable[nr_table_idx].band);
|
||||
|
||||
return delta_duplex;
|
||||
}
|
||||
|
||||
lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index)
|
||||
{
|
||||
lte_frame_type_t current_type;
|
||||
int32_t delta_duplex = get_delta_duplex(current_band, scs_index);
|
||||
|
||||
if (delta_duplex == 0)
|
||||
current_type = TDD;
|
||||
else
|
||||
current_type = FDD;
|
||||
|
||||
LOG_I(NR_MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[current_type], delta_duplex);
|
||||
|
||||
return current_type;
|
||||
}
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||
{
|
||||
|
||||
if (nr_band < 100) { //FR1
|
||||
switch(mu) {
|
||||
case 0 :
|
||||
if (nb_rb<=25)
|
||||
return 5;
|
||||
if (nb_rb<=52)
|
||||
return 10;
|
||||
if (nb_rb<=79)
|
||||
return 15;
|
||||
if (nb_rb<=106)
|
||||
return 20;
|
||||
if (nb_rb<=133)
|
||||
return 25;
|
||||
if (nb_rb<=160)
|
||||
return 30;
|
||||
if (nb_rb<=216)
|
||||
return 40;
|
||||
if (nb_rb<=270)
|
||||
return 50;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 1 :
|
||||
if (nb_rb<=11)
|
||||
return 5;
|
||||
if (nb_rb<=24)
|
||||
return 10;
|
||||
if (nb_rb<=38)
|
||||
return 15;
|
||||
if (nb_rb<=51)
|
||||
return 20;
|
||||
if (nb_rb<=65)
|
||||
return 25;
|
||||
if (nb_rb<=78)
|
||||
return 30;
|
||||
if (nb_rb<=106)
|
||||
return 40;
|
||||
if (nb_rb<=133)
|
||||
return 50;
|
||||
if (nb_rb<=162)
|
||||
return 60;
|
||||
if (nb_rb<=189)
|
||||
return 70;
|
||||
if (nb_rb<=217)
|
||||
return 80;
|
||||
if (nb_rb<=245)
|
||||
return 90;
|
||||
if (nb_rb<=273)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 2 :
|
||||
if (nb_rb<=11)
|
||||
return 10;
|
||||
if (nb_rb<=18)
|
||||
return 15;
|
||||
if (nb_rb<=24)
|
||||
return 20;
|
||||
if (nb_rb<=31)
|
||||
return 25;
|
||||
if (nb_rb<=38)
|
||||
return 30;
|
||||
if (nb_rb<=51)
|
||||
return 40;
|
||||
if (nb_rb<=65)
|
||||
return 50;
|
||||
if (nb_rb<=79)
|
||||
return 60;
|
||||
if (nb_rb<=93)
|
||||
return 70;
|
||||
if (nb_rb<=107)
|
||||
return 80;
|
||||
if (nb_rb<=121)
|
||||
return 90;
|
||||
if (nb_rb<=135)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(mu) {
|
||||
case 2 :
|
||||
if (nb_rb<=66)
|
||||
return 50;
|
||||
if (nb_rb<=132)
|
||||
return 100;
|
||||
if (nb_rb<=264)
|
||||
return 200;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 3 :
|
||||
if (nb_rb<=32)
|
||||
return 50;
|
||||
if (nb_rb<=66)
|
||||
return 100;
|
||||
if (nb_rb<=132)
|
||||
return 200;
|
||||
if (nb_rb<=264)
|
||||
return 400;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs){
|
||||
|
||||
@@ -2516,17 +2324,6 @@ static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8
|
||||
return 1;
|
||||
}
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask ) {
|
||||
|
||||
int num_dmrs=0;
|
||||
|
||||
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
|
||||
return(num_dmrs);
|
||||
}
|
||||
/* returns the total DMRS symbols in a slot*/
|
||||
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype){
|
||||
return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols, startSymbol, mappingtype));
|
||||
}
|
||||
|
||||
// Table 5.1.2.2.1-1 38.214
|
||||
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
|
||||
@@ -3248,9 +3045,9 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl
|
||||
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) {
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI, int length) {
|
||||
|
||||
int l0;int dmrs_AdditionalPosition = 0;int maxLength = 0;
|
||||
int l0;int dmrs_AdditionalPosition = 0;
|
||||
NR_DMRS_DownlinkConfig_t *dmrs_config = NULL;
|
||||
|
||||
LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype_fromDCI, dmrs_TypeA_Position);
|
||||
@@ -3262,7 +3059,6 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
// in case of DCI FORMAT 1_0 or dedicated pdsch config not received additionposition = pos2, len1 should be used
|
||||
// referred to section 5.1.6.2 in 38.214
|
||||
dmrs_AdditionalPosition = 2;
|
||||
maxLength = 1;
|
||||
|
||||
if (pdsch_Config != NULL) {
|
||||
if (mappingtype_fromDCI == typeA) { // Type A
|
||||
@@ -3277,8 +3073,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
|
||||
AssertFatal(dmrs_config != NULL," DMRS configs not present in PDSCH DMRS Downlink config\n");
|
||||
|
||||
// default values of maxlength = len2, additionalposition is pos2
|
||||
if (dmrs_config->maxLength != NULL) maxLength = 2;
|
||||
// default values of additionalposition is pos2
|
||||
if (dmrs_config->dmrs_AdditionalPosition != NULL) dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition;
|
||||
}
|
||||
|
||||
@@ -3293,11 +3088,6 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
// For TypeB, ld is the duration of the scheduled PDSCH resources
|
||||
ld = (mappingtype_fromDCI == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols;
|
||||
|
||||
// Section 7.4.1.1.2 in Spec 38.211
|
||||
//For PDSCH Mapping typeB, if PDSCH duration ld <=4, only single symbol DMRS is supported
|
||||
if (mappingtype_fromDCI == typeB && ld <= 4)
|
||||
maxLength = 1;
|
||||
|
||||
AssertFatal(ld > 2 && ld < 15,"Illegal NrOfSymbols according to Table 5.1.2.1-1 Spec 38.214 %d\n",ld);
|
||||
AssertFatal((NrOfSymbols + startSymbol) < 15,"Illegal S+L according to Table 5.1.2.1-1 Spec 38.214 S:%d L:%d\n",startSymbol, NrOfSymbols);
|
||||
|
||||
@@ -3314,7 +3104,8 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
|
||||
}
|
||||
|
||||
if (maxLength == 1) {
|
||||
// number of front loaded symbols
|
||||
if (length == 1) {
|
||||
row = ld - 2;
|
||||
l_prime = table_7_4_1_1_2_3_pdsch_dmrs_positions_l[row][column];
|
||||
l0 = 1 << l0;
|
||||
@@ -3325,7 +3116,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
l0 = 1<<l0 | 1<<(l0+1);
|
||||
}
|
||||
|
||||
LOG_D(MAC, "l0:%d, ld:%d,row:%d, column:%d, addpos:%d, maxlen:%d\n", l0, ld, row, column, dmrs_AdditionalPosition, maxLength);
|
||||
LOG_D(MAC, "l0:%d, ld:%d,row:%d, column:%d, addpos:%d, maxlen:%d\n", l0, ld, row, column, dmrs_AdditionalPosition, length);
|
||||
AssertFatal(l_prime>=0,"ERROR in configuration.Check Time Domain allocation of this Grant. l_prime < 1. row:%d, column:%d\n", row, column);
|
||||
|
||||
l_prime = (mappingtype_fromDCI == typeA) ? (l_prime | l0) : (l_prime << startSymbol);
|
||||
@@ -3606,13 +3397,23 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
|
||||
uint16_t ssb_start_symbol,
|
||||
NR_SubcarrierSpacing_t scs_ssb,
|
||||
frequency_range_t frequency_range,
|
||||
int nr_band,
|
||||
uint32_t ssb_index,
|
||||
uint32_t ssb_period,
|
||||
uint32_t ssb_offset_point_a) {
|
||||
|
||||
NR_SubcarrierSpacing_t scs_pdcch;
|
||||
|
||||
channel_bandwidth_t min_channel_bw = bw_10MHz; // TODO remove hardcoding and implement Table 5.3.5-1 in 38.104
|
||||
channel_bandwidth_t min_channel_bw;
|
||||
|
||||
// according to Table 5.3.5-1 in 38.104
|
||||
// band 79 is the only one which minimum is 40
|
||||
// for all the other channels it is either 10 or 5
|
||||
// and there is no difference between the two for this implementation so it is set it to 10
|
||||
if (nr_band == 79)
|
||||
min_channel_bw = bw_40MHz;
|
||||
else
|
||||
min_channel_bw = bw_10MHz;
|
||||
|
||||
if (frequency_range == FR2) {
|
||||
if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60)
|
||||
@@ -4015,7 +3816,7 @@ void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_conf
|
||||
|
||||
}
|
||||
|
||||
uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int L) {
|
||||
void fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) {
|
||||
|
||||
if(ss0 == NULL) ss0=calloc(1,sizeof(*ss0));
|
||||
if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId));
|
||||
@@ -4033,7 +3834,6 @@ uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t
|
||||
AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n");
|
||||
|
||||
max_agg = (type0_PDCCH_CSS_config->num_symbols*type0_PDCCH_CSS_config->num_rbs)/6;
|
||||
if (L>max_agg) return 0;
|
||||
|
||||
symbols = (1-(1<<type0_PDCCH_CSS_config->num_symbols))<<type0_PDCCH_CSS_config->first_symbol_index;
|
||||
duration = type0_PDCCH_CSS_config->search_space_duration;
|
||||
@@ -4066,28 +3866,11 @@ uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t
|
||||
// max values are set according to TS38.213 Section 10.1 Table 10.1-1
|
||||
ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
switch(L){
|
||||
case 4:
|
||||
ss0->nrofCandidates->aggregationLevel4 = (((max_agg>>2) > 4)? 4 : max_agg>>2);
|
||||
ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
break;
|
||||
case 8:
|
||||
ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0;
|
||||
ss0->nrofCandidates->aggregationLevel8 = (((max_agg>>3) > 2)? 2 : max_agg>>3);
|
||||
ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
break;
|
||||
case 16:
|
||||
ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0;
|
||||
ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
ss0->nrofCandidates->aggregationLevel16 = (((max_agg>>4) > 1)? 1 : max_agg>>4);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Invalid aggregation level %d for SS0\n",L);
|
||||
}
|
||||
ss0->nrofCandidates->aggregationLevel4 = (((max_agg>>2) > 4)? 4 : max_agg>>2);
|
||||
ss0->nrofCandidates->aggregationLevel8 = (((max_agg>>3) > 2)? 2 : max_agg>>3);
|
||||
ss0->nrofCandidates->aggregationLevel16 = (((max_agg>>4) > 1)? 1 : max_agg>>4);
|
||||
|
||||
ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,17 +37,11 @@
|
||||
#include "nr_mac.h"
|
||||
#include "openair1/PHY/impl_defs_nr.h"
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||
|
||||
lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index);
|
||||
|
||||
int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI);
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI,int length);
|
||||
|
||||
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
|
||||
|
||||
@@ -97,8 +91,6 @@ int get_nr_prach_occasion_info_from_index(uint8_t index,
|
||||
uint16_t *N_RA_sfn,
|
||||
uint8_t *max_association_period);
|
||||
|
||||
uint8_t get_nr_prach_duration(uint8_t prach_format);
|
||||
|
||||
uint8_t get_pusch_mcs_table(long *mcs_Table,
|
||||
int is_tp,
|
||||
int dci_format,
|
||||
@@ -121,7 +113,6 @@ int64_t *get_prach_config_info(frequency_range_t freq_range,
|
||||
|
||||
uint16_t get_NCS(uint8_t index, uint16_t format, uint8_t restricted_set_config);
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask );
|
||||
uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position);
|
||||
int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbolt, uint8_t dmrs_typeA_position);
|
||||
|
||||
@@ -136,6 +127,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
|
||||
uint16_t ssb_start_symbol,
|
||||
NR_SubcarrierSpacing_t scs_ssb,
|
||||
frequency_range_t frequency_range,
|
||||
int nr_band,
|
||||
uint32_t ssb_index,
|
||||
uint32_t ssb_period,
|
||||
uint32_t ssb_offset_point_a);
|
||||
@@ -150,7 +142,7 @@ void get_info_from_tda_tables(int default_abc,
|
||||
int *nrOfSymbols);
|
||||
|
||||
void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config);
|
||||
uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int L);
|
||||
void fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config);
|
||||
|
||||
uint16_t compute_pucch_prb_size(uint8_t format,
|
||||
uint8_t nr_prbs,
|
||||
@@ -183,8 +175,6 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config,
|
||||
uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower,
|
||||
uint8_t NrOfSymbols);
|
||||
|
||||
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype);
|
||||
|
||||
/* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16
|
||||
@param *pusch_config, pointer to pusch config
|
||||
@param *ubwp pointer to uplink bwp
|
||||
|
||||
@@ -76,6 +76,9 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
|
||||
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
|
||||
#endif*/
|
||||
|
||||
extern const uint32_t NR_SHORT_BSR_TABLE[NR_SHORT_BSR_TABLE_SIZE];
|
||||
extern const uint32_t NR_LONG_BSR_TABLE[NR_LONG_BSR_TABLE_SIZE];
|
||||
|
||||
// Type0-PDCCH search space
|
||||
extern const int32_t table_38213_13_1_c1[16];
|
||||
extern const int32_t table_38213_13_1_c2[16];
|
||||
|
||||
Executable → Regular
+28
-3
@@ -573,7 +573,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
struct NR_PDCCH_Config__searchSpacesToAddModList *searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList;
|
||||
AssertFatal(searchSpacesToAddModList != NULL, "searchSpacesToAddModList is null\n");
|
||||
AssertFatal(searchSpacesToAddModList->list.count > 0, "list of UE specifically configured Search Spaces is empty\n");
|
||||
AssertFatal(searchSpacesToAddModList->list.count < FAPI_NR_MAX_SS_PER_CORESET, "too many searchpaces per coreset %d\n", searchSpacesToAddModList->list.count);
|
||||
AssertFatal(searchSpacesToAddModList->list.count < FAPI_NR_MAX_SS, "too many searchpaces per coreset %d\n", searchSpacesToAddModList->list.count);
|
||||
|
||||
struct NR_UplinkConfig__uplinkBWP_ToAddModList *uplinkBWP_ToAddModList = scd->uplinkConfig->uplinkBWP_ToAddModList;
|
||||
if (ul_bwp_id > 0) {
|
||||
@@ -597,7 +597,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
AssertFatal(*ss->controlResourceSetId == mac->coreset[dl_bwp_id][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
mac->SSpace[dl_bwp_id][0][ss_id] = ss;
|
||||
mac->SSpace[dl_bwp_id][ss_id] = ss;
|
||||
}
|
||||
|
||||
// Check available CSSs in the commonSearchSpaceList (list of additional common search spaces)
|
||||
@@ -610,11 +610,23 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n");
|
||||
AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
mac->SSpace[dl_bwp_id][0][ss_id] = css;
|
||||
mac->SSpace[dl_bwp_id][ss_id] = css;
|
||||
ss_id++;
|
||||
}
|
||||
}
|
||||
|
||||
// todo handle mac_LogicalChannelConfig
|
||||
int nr_rrc_mac_config_req_ue_logicalChannelBearer(
|
||||
module_id_t module_id,
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
long logicalChannelIdentity,
|
||||
boolean_t status){
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
mac->logicalChannelBearer_exist[logicalChannelIdentity] = status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_rrc_mac_config_req_ue(
|
||||
module_id_t module_id,
|
||||
int cc_idP,
|
||||
@@ -648,6 +660,8 @@ int nr_rrc_mac_config_req_ue(
|
||||
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));
|
||||
for (int i=0; i<num_slots_ul; i++)
|
||||
pthread_mutex_init(&(mac->ul_config_request[i].mutex_ul_config), NULL);
|
||||
// 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);
|
||||
@@ -678,6 +692,17 @@ int nr_rrc_mac_config_req_ue(
|
||||
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;
|
||||
|
||||
mac->scheduling_info.periodicBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
mac->scheduling_info.retxBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
|
||||
LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
|
||||
module_id,
|
||||
mac->scheduling_info.periodicBSR_SF,
|
||||
mac->scheduling_info.retxBSR_SF);
|
||||
|
||||
config_control_ue(mac);
|
||||
//config_common_ue(mac,module_id,cc_idP);
|
||||
/*
|
||||
|
||||
Executable → Regular
+12
-13
@@ -182,9 +182,9 @@ typedef struct {
|
||||
uint16_t All_lcid_buffer_size_lastTTI;
|
||||
/// buffer status for each lcid
|
||||
uint8_t LCID_status[NR_MAX_NUM_LCID];
|
||||
/// SR pending as defined in 36.321
|
||||
/// SR pending as defined in 38.321
|
||||
uint8_t SR_pending;
|
||||
/// SR_COUNTER as defined in 36.321
|
||||
/// SR_COUNTER as defined in 38.321
|
||||
uint16_t SR_COUNTER;
|
||||
/// logical channel group ide for each LCID
|
||||
uint8_t LCGID[NR_MAX_NUM_LCID];
|
||||
@@ -328,15 +328,6 @@ typedef struct {
|
||||
|
||||
} RAR_grant_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t phr_reporting;
|
||||
uint16_t truncated_bsr;
|
||||
uint16_t short_bsr;
|
||||
uint16_t long_bsr;
|
||||
|
||||
} NR_UE_MAC_CE_t;
|
||||
|
||||
typedef struct {
|
||||
int n_HARQ_ACK;
|
||||
uint32_t ack_payload;
|
||||
@@ -353,6 +344,7 @@ typedef struct {
|
||||
int8_t delta_pucch;
|
||||
} PUCCH_sched_t;
|
||||
|
||||
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct {
|
||||
|
||||
@@ -375,7 +367,7 @@ typedef struct {
|
||||
NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP];
|
||||
NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP];
|
||||
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP];
|
||||
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET];
|
||||
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_SS];
|
||||
|
||||
lte_frame_type_t frame_type;
|
||||
|
||||
@@ -419,8 +411,15 @@ typedef struct {
|
||||
nr_ue_if_module_t *if_module;
|
||||
nr_phy_config_t phy_config;
|
||||
|
||||
/// BSR report flag management
|
||||
uint8_t BSR_reporting_active;
|
||||
|
||||
/// LogicalChannelConfig has bearer.
|
||||
boolean_t logicalChannelBearer_exist[NR_MAX_NUM_LCID];
|
||||
NR_UE_SCHEDULING_INFO scheduling_info;
|
||||
NR_UE_MAC_CE_t nr_ue_mac_ce;
|
||||
|
||||
/// PHR
|
||||
uint8_t PHR_reporting_active;
|
||||
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||
NR_SearchSpace_t *search_space_zero;
|
||||
|
||||
@@ -57,12 +57,12 @@ extern const uint8_t table_7_3_1_1_2_21[19][4];
|
||||
extern const uint8_t table_7_3_1_1_2_22[6][5];
|
||||
extern const uint8_t table_7_3_1_1_2_23[5][6];
|
||||
extern const uint8_t table_7_3_2_3_3_1[12][5];
|
||||
extern const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6];
|
||||
extern const uint8_t table_7_3_2_3_3_2_oneCodeword[31][10];
|
||||
extern const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10];
|
||||
extern const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5];
|
||||
extern const uint8_t table_7_3_2_3_3_3_oneCodeword[24][7];
|
||||
extern const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7];
|
||||
extern const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6];
|
||||
extern const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10];
|
||||
extern const uint8_t table_7_3_2_3_3_4_oneCodeword[58][14];
|
||||
extern const uint8_t table_7_3_2_3_3_4_twoCodeword[6][14];
|
||||
|
||||
extern const uint16_t table_7_2_1[16];
|
||||
|
||||
|
||||
Executable → Regular
+73
-24
@@ -40,6 +40,10 @@
|
||||
#define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */
|
||||
#define NR_DL_MAX_NB_CW (2) /* number of downlink code word */
|
||||
|
||||
/**\brief initialize the field in nr_mac instance
|
||||
\param module_id module id */
|
||||
void nr_ue_init_mac(module_id_t module_idP);
|
||||
|
||||
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
|
||||
\param module_id module id
|
||||
\param cc_id component carrier id
|
||||
@@ -74,6 +78,20 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
|
||||
uint8_t *pduP,
|
||||
uint32_t pdu_len);
|
||||
|
||||
/**\brief primitive from RRC layer to MAC layer to set if bearer exists for a logical channel. todo handle mac_LogicalChannelConfig
|
||||
\param module_id module id
|
||||
\param cc_id component carrier id
|
||||
\param gNB_index gNB index
|
||||
\param long logicalChannelIdentity
|
||||
\param boolean_t status*/
|
||||
int nr_rrc_mac_config_req_ue_logicalChannelBearer(
|
||||
module_id_t module_id,
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
long logicalChannelIdentity,
|
||||
boolean_t status
|
||||
);
|
||||
|
||||
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
|
||||
\param module_id module id
|
||||
\param cc_id component carrier id
|
||||
@@ -125,7 +143,53 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
int slot,
|
||||
int thread_id);
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, int slotP);
|
||||
/*! \fn int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP);
|
||||
\brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and DTCH and forms BSR elements and PHR in MAC header. CRNTI element is not supported yet. It computes transport block for up to 3 SDUs and generates header and forms the complete MAC SDU.
|
||||
\param[in] Mod_id Instance id of UE in machine
|
||||
\param[in] frameP subframe number
|
||||
\param[in] slotP slot number
|
||||
*/
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP);
|
||||
|
||||
/*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t gNB_index)
|
||||
\brief get the rlc stats and update the bsr level for each lcid
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] frameP Frame index
|
||||
\param[in] slot slotP number
|
||||
\param[in] uint8_t gNB_index
|
||||
*/
|
||||
boolean_t nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t gNB_index);
|
||||
|
||||
/*! \fn nr_locate_BsrIndexByBufferSize (int *table, int size, int value)
|
||||
\brief locate the BSR level in the table as defined in 38.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table.
|
||||
\param[in] *table Pointer to BSR table
|
||||
\param[in] size Size of the table
|
||||
\param[in] value Value of the buffer
|
||||
\return the index in the BSR_LEVEL table
|
||||
*/
|
||||
uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size,
|
||||
int value);
|
||||
|
||||
/*! \fn int nr_get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer)
|
||||
\brief get the number of subframe from the periodic BSR timer configured by the higher layers
|
||||
\param[in] periodicBSR_Timer timer for periodic BSR
|
||||
\return the number of subframe
|
||||
*/
|
||||
int nr_get_sf_periodicBSRTimer(uint8_t bucketSize);
|
||||
|
||||
/*! \fn int nr_get_ms_bucketsizeduration(uint8_t bucketSize)
|
||||
\brief get the time in ms form the bucket size duration configured by the higher layer
|
||||
\param[in] bucketSize the bucket size duration
|
||||
\return the time in ms
|
||||
*/
|
||||
int nr_get_ms_bucketsizeduration(uint8_t bucketsizeduration);
|
||||
|
||||
/*! \fn int nr_get_sf_retxBSRTimer(uint8_t retxBSR_Timer)
|
||||
\brief get the number of subframe form the bucket size duration configured by the higher layer
|
||||
\param[in] retxBSR_Timer timer for regular BSR
|
||||
\return the time in sf
|
||||
*/
|
||||
int nr_get_sf_retxBSRTimer(uint8_t retxBSR_Timer);
|
||||
|
||||
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, fapi_nr_dci_indication_pdu_t *dci_ind);
|
||||
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);
|
||||
@@ -170,7 +234,13 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
int pdu_id);
|
||||
|
||||
int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
NR_UE_MAC_INST_t *mac);
|
||||
NR_UE_MAC_INST_t *mac,
|
||||
uint8_t power_headroom, // todo: NR_POWER_HEADROOM_CMD *power_headroom,
|
||||
uint16_t *crnti,
|
||||
NR_BSR_SHORT *truncated_bsr,
|
||||
NR_BSR_SHORT *short_bsr,
|
||||
NR_BSR_LONG *long_bsr
|
||||
);
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
|
||||
@@ -270,23 +340,6 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
|
||||
fapi_nr_ul_config_pucch_pdu *pucch_pdu,
|
||||
int O_SR, int O_ACK, int O_CSI);
|
||||
|
||||
/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure.
|
||||
@param Mod_id Module id of UE
|
||||
@returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE
|
||||
*/
|
||||
int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t module_idP, uint8_t CC_id);
|
||||
|
||||
/** \brief Function to compute DELTA_PREAMBLE from 38.321 subclause 7.3
|
||||
(for RA power ramping procedure and Msg3 PUSCH power control policy)
|
||||
@param Mod_id Module id of UE
|
||||
@returns DELTA_PREAMBLE
|
||||
*/
|
||||
int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format);
|
||||
|
||||
/** \brief Function to compute configured maximum output power according to clause 6.2.4 of 3GPP TS 38.101-1 version 16.5.0 Release 16
|
||||
@param Mod_id Module id of UE
|
||||
*/
|
||||
long nr_get_Pcmax(module_id_t mod_id);
|
||||
|
||||
/* Random Access */
|
||||
|
||||
@@ -347,7 +400,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot);
|
||||
If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC
|
||||
attempts to retrieves the CCCH message from RRC. If the UE is in PUSCH mode for a particular eNB
|
||||
index and PUCCH format 0 (Scheduling Request) is not activated, the MAC may use this resource for
|
||||
andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 36.321)
|
||||
andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 38.321)
|
||||
@param mod_id Index of UE instance
|
||||
@param CC_id Component Carrier Index
|
||||
@param frame
|
||||
@@ -390,10 +443,6 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
||||
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id);
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
|
||||
|
||||
void 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_UE_MAC_INST_t *mac);
|
||||
|
||||
void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format);
|
||||
|
||||
@@ -257,161 +257,161 @@ const uint8_t table_7_3_1_1_2_23[5][6] = {
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_1[12][5] = {
|
||||
{1,0,0,0,0},
|
||||
{1,1,0,0,0},
|
||||
{1,0,1,0,0},
|
||||
{2,0,0,0,0},
|
||||
{1,1,1,0,0},
|
||||
{2,1,0,0,0},
|
||||
{2,2,0,0,0},
|
||||
{2,3,0,0,0},
|
||||
{2,0,1,0,0},
|
||||
{2,2,3,0,0},
|
||||
{2,0,1,2,0},
|
||||
{2,0,1,2,3},
|
||||
{2,0,2,0,0}
|
||||
{2,0,0,1,0},
|
||||
{2,0,0,0,1},
|
||||
{2,1,1,0,0},
|
||||
{2,0,0,1,1},
|
||||
{2,1,1,1,0},
|
||||
{2,1,1,1,1},
|
||||
{2,1,0,1,0}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6] = {
|
||||
{1,0,0,0,0,1},
|
||||
{1,1,0,0,0,1},
|
||||
{1,0,1,0,0,1},
|
||||
{2,0,0,0,0,1},
|
||||
{2,1,0,0,0,1},
|
||||
{2,2,0,0,0,1},
|
||||
{2,3,0,0,0,1},
|
||||
{2,0,1,0,0,1},
|
||||
{2,2,3,0,0,1},
|
||||
{2,0,1,2,0,1},
|
||||
{2,0,1,2,3,1},
|
||||
{2,0,2,0,0,1},
|
||||
{2,0,0,0,0,2},
|
||||
{2,1,0,0,0,2},
|
||||
{2,2,0,0,0,2},
|
||||
{2,3,0,0,0,2},
|
||||
{2,4,0,0,0,2},
|
||||
{2,5,0,0,0,2},
|
||||
{2,6,0,0,0,2},
|
||||
{2,7,0,0,0,2},
|
||||
{2,0,1,0,0,2},
|
||||
{2,2,3,0,0,2},
|
||||
{2,4,5,0,0,2},
|
||||
{2,6,7,0,0,2},
|
||||
{2,0,4,0,0,2},
|
||||
{2,2,6,0,0,2},
|
||||
{2,0,1,4,0,2},
|
||||
{2,2,3,6,0,2},
|
||||
{2,0,1,4,5,2},
|
||||
{2,2,3,6,7,2},
|
||||
{2,0,2,4,6,2}
|
||||
const uint8_t table_7_3_2_3_3_2_oneCodeword[31][10] = {
|
||||
{1,1,0,0,0,0,0,0,0,1},
|
||||
{1,0,1,0,0,0,0,0,0,1},
|
||||
{1,1,1,0,0,0,0,0,0,1},
|
||||
{2,1,0,0,0,0,0,0,0,1},
|
||||
{2,0,1,0,0,0,0,0,0,1},
|
||||
{2,0,0,1,0,0,0,0,0,1},
|
||||
{2,0,0,0,1,0,0,0,0,1},
|
||||
{2,1,1,0,0,0,0,0,0,1},
|
||||
{2,0,0,1,1,0,0,0,0,1},
|
||||
{2,1,1,1,0,0,0,0,0,1},
|
||||
{2,1,1,1,1,0,0,0,0,1},
|
||||
{2,1,0,1,0,0,0,0,0,1},
|
||||
{2,1,0,0,0,0,0,0,0,2},
|
||||
{2,0,1,0,0,0,0,0,0,2},
|
||||
{2,0,0,1,0,0,0,0,0,2},
|
||||
{2,0,0,0,1,0,0,0,0,2},
|
||||
{2,0,0,0,0,1,0,0,0,2},
|
||||
{2,0,0,0,0,0,1,0,0,2},
|
||||
{2,0,0,0,0,0,0,1,0,2},
|
||||
{2,0,0,0,0,0,0,0,1,2},
|
||||
{2,1,1,0,0,0,0,0,0,2},
|
||||
{2,0,0,1,1,0,0,0,0,2},
|
||||
{2,0,0,0,0,1,1,0,0,2},
|
||||
{2,0,0,0,0,0,0,1,1,2},
|
||||
{2,1,0,0,0,1,0,0,0,2},
|
||||
{2,0,0,1,0,0,0,1,0,2},
|
||||
{2,1,1,0,0,1,0,0,0,2},
|
||||
{2,0,0,1,1,0,0,1,0,2},
|
||||
{2,1,1,0,0,1,1,0,0,2},
|
||||
{2,0,0,1,1,0,0,1,1,2},
|
||||
{2,1,0,1,0,1,0,1,0,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10] = {
|
||||
{2,0,1,2,3,4,0,0,0,2},
|
||||
{2,0,1,2,3,4,6,0,0,2},
|
||||
{2,0,1,2,3,4,5,6,0,2},
|
||||
{2,0,1,2,3,4,5,6,7,2}
|
||||
{2,1,1,1,1,1,0,0,0,2},
|
||||
{2,1,1,1,1,1,0,1,0,2},
|
||||
{2,1,1,1,1,1,1,1,0,2},
|
||||
{2,1,1,1,1,1,1,1,1,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5] = {
|
||||
{1,0,0,0,0},
|
||||
{1,1,0,0,0},
|
||||
{1,0,1,0,0},
|
||||
{2,0,0,0,0},
|
||||
{2,1,0,0,0},
|
||||
{2,2,0,0,0},
|
||||
{2,3,0,0,0},
|
||||
{2,0,1,0,0},
|
||||
{2,2,3,0,0},
|
||||
{2,0,1,2,0},
|
||||
{2,0,1,2,3},
|
||||
{3,0,0,0,0},
|
||||
{3,1,0,0,0},
|
||||
{3,2,0,0,0},
|
||||
{3,3,0,0,0},
|
||||
{3,4,0,0,0},
|
||||
{3,5,0,0,0},
|
||||
{3,0,1,0,0},
|
||||
{3,2,3,0,0},
|
||||
{3,4,5,0,0},
|
||||
{3,0,1,2,0},
|
||||
{3,3,4,5,0},
|
||||
{3,0,1,2,3},
|
||||
{2,0,2,0,0}
|
||||
const uint8_t table_7_3_2_3_3_3_oneCodeword[24][7] = {
|
||||
{1,1,0,0,0,0,0},
|
||||
{1,0,1,0,0,0,0},
|
||||
{1,1,1,0,0,0,0},
|
||||
{2,1,0,0,0,0,0},
|
||||
{2,0,1,0,0,0,0},
|
||||
{2,0,0,1,0,0,0},
|
||||
{2,0,0,0,1,0,0},
|
||||
{2,1,1,0,0,0,0},
|
||||
{2,0,0,1,1,0,0},
|
||||
{2,1,1,1,0,0,0},
|
||||
{2,1,1,1,1,0,0},
|
||||
{3,1,0,0,0,0,0},
|
||||
{3,0,1,0,0,0,0},
|
||||
{3,0,0,1,0,0,0},
|
||||
{3,0,0,0,1,0,0},
|
||||
{3,0,0,0,0,1,0},
|
||||
{3,0,0,0,0,0,1},
|
||||
{3,1,1,0,0,0,0},
|
||||
{3,0,0,1,1,0,0},
|
||||
{3,0,0,0,0,1,1},
|
||||
{3,1,1,1,0,0,0},
|
||||
{3,0,0,0,1,1,1},
|
||||
{3,1,1,1,1,0,0},
|
||||
{3,1,0,1,0,0,0}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7] = {
|
||||
{3,0,1,2,3,4,0},
|
||||
{3,0,1,2,3,4,5}
|
||||
{3,1,1,1,1,1,0},
|
||||
{3,1,1,1,1,1,1}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6] = {
|
||||
{1,0,0,0,0,1},
|
||||
{1,1,0,0,0,1},
|
||||
{1,0,1,0,0,1},
|
||||
{2,0,0,0,0,1},
|
||||
{2,1,0,0,0,1},
|
||||
{2,2,0,0,0,1},
|
||||
{2,3,0,0,0,1},
|
||||
{2,0,1,0,0,1},
|
||||
{2,2,3,0,0,1},
|
||||
{2,0,1,2,0,1},
|
||||
{2,0,1,2,3,1},
|
||||
{3,0,0,0,0,1},
|
||||
{3,1,0,0,0,1},
|
||||
{3,2,0,0,0,1},
|
||||
{3,3,0,0,0,1},
|
||||
{3,4,0,0,0,1},
|
||||
{3,5,0,0,0,1},
|
||||
{3,0,1,0,0,1},
|
||||
{3,2,3,0,0,1},
|
||||
{3,4,5,0,0,1},
|
||||
{3,0,1,2,0,1},
|
||||
{3,3,4,5,0,1},
|
||||
{3,0,1,2,3,1},
|
||||
{2,0,2,0,0,1},
|
||||
{3,0,0,0,0,2},
|
||||
{3,1,0,0,0,2},
|
||||
{3,2,0,0,0,2},
|
||||
{3,3,0,0,0,2},
|
||||
{3,4,0,0,0,2},
|
||||
{3,5,0,0,0,2},
|
||||
{3,6,0,0,0,2},
|
||||
{3,7,0,0,0,2},
|
||||
{3,8,0,0,0,2},
|
||||
{3,9,0,0,0,2},
|
||||
{3,10,0,0,0,2},
|
||||
{3,11,0,0,0,2},
|
||||
{3,0,1,0,0,2},
|
||||
{3,2,3,0,0,2},
|
||||
{3,4,5,0,0,2},
|
||||
{3,6,7,0,0,2},
|
||||
{3,8,9,0,0,2},
|
||||
{3,10,11,0,0,2},
|
||||
{3,0,1,6,0,2},
|
||||
{3,2,3,8,0,2},
|
||||
{3,4,5,10,0,2},
|
||||
{3,0,1,6,7,2},
|
||||
{3,2,3,8,9,2},
|
||||
{3,4,5,10,11,2},
|
||||
{1,0,0,0,0,2},
|
||||
{1,1,0,0,0,2},
|
||||
{1,6,0,0,0,2},
|
||||
{1,7,0,0,0,2},
|
||||
{1,0,1,0,0,2},
|
||||
{1,6,7,0,0,2},
|
||||
{2,0,1,0,0,2},
|
||||
{2,2,3,0,0,2},
|
||||
{2,6,7,0,0,2},
|
||||
{2,8,9,0,0,2}
|
||||
const uint8_t table_7_3_2_3_3_4_oneCodeword[58][14] = {
|
||||
{1,1,0,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{1,0,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{1,1,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,1,0,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,0,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,0,0,1,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,0,0,0,1,0,0,0,0,0,0,0,0,1},
|
||||
{2,1,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,0,0,1,1,0,0,0,0,0,0,0,0,1},
|
||||
{2,1,1,1,0,0,0,0,0,0,0,0,0,1},
|
||||
{2,1,1,1,1,0,0,0,0,0,0,0,0,1},
|
||||
{3,1,0,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,1,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,0,1,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,0,0,1,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,0,0,0,1,0,0,0,0,0,0,1},
|
||||
{3,1,1,0,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,1,1,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,0,0,1,1,0,0,0,0,0,0,1},
|
||||
{3,1,1,1,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,0,0,0,1,1,1,0,0,0,0,0,0,1},
|
||||
{3,1,1,1,1,0,0,0,0,0,0,0,0,1},
|
||||
{2,1,0,1,0,0,0,0,0,0,0,0,0,1},
|
||||
{3,1,0,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,1,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,1,0,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,1,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,1,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,1,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,1,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,1,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,1,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,0,1,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,0,0,1,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,0,0,0,1,2},
|
||||
{3,1,1,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,1,1,0,0,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,1,1,0,0,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,1,1,0,0,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,1,1,0,0,2},
|
||||
{3,0,0,0,0,0,0,0,0,0,0,1,1,2},
|
||||
{3,1,1,0,0,0,0,1,0,0,0,0,0,2},
|
||||
{3,0,0,1,1,0,0,0,0,1,0,0,0,2},
|
||||
{3,0,0,0,0,1,1,0,0,0,0,1,0,2},
|
||||
{3,1,1,0,0,0,0,1,1,0,0,0,0,2},
|
||||
{3,0,0,1,1,0,0,0,0,1,1,0,0,2},
|
||||
{3,0,0,0,0,1,1,0,0,0,0,1,1,2},
|
||||
{1,1,0,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{1,0,1,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{1,0,0,0,0,0,0,1,0,0,0,0,0,2},
|
||||
{1,0,0,0,0,0,0,0,1,0,0,0,0,2},
|
||||
{1,1,1,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{1,0,0,0,0,0,0,1,1,0,0,0,0,2},
|
||||
{2,1,1,0,0,0,0,0,0,0,0,0,0,2},
|
||||
{2,0,0,1,1,0,0,0,0,0,0,0,0,2},
|
||||
{2,0,0,0,0,0,0,1,1,0,0,0,0,2},
|
||||
{2,0,0,0,0,0,0,0,0,1,1,0,0,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10] = {
|
||||
{3,0,1,2,3,4,0,0,0,1},
|
||||
{3,0,1,2,3,4,5,0,0,1},
|
||||
{2,0,1,2,3,6,0,0,0,2},
|
||||
{2,0,1,2,3,6,8,0,0,2},
|
||||
{2,0,1,2,3,6,7,8,0,2},
|
||||
{2,0,1,2,3,6,7,8,9,2}
|
||||
const uint8_t table_7_3_2_3_3_4_twoCodeword[6][14] = {
|
||||
{3,1,1,1,1,1,0,0,0,0,0,0,0,1},
|
||||
{3,1,1,1,1,1,1,0,0,0,0,0,0,1},
|
||||
{2,1,1,1,1,0,0,1,0,0,0,0,0,2},
|
||||
{2,1,1,1,1,0,0,1,0,1,0,0,0,2},
|
||||
{2,1,1,1,1,0,0,1,1,1,0,0,0,2},
|
||||
{2,1,1,1,1,0,0,1,1,1,1,0,0,2},
|
||||
};
|
||||
|
||||
// table 7.2-1 TS 38.321
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
|
||||
#include <pthread.h>
|
||||
|
||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||
|
||||
@@ -52,8 +53,9 @@ 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);
|
||||
|
||||
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;
|
||||
for (int j=0;j<NB_NR_UE_MAC_INST;j++) {
|
||||
nr_ue_init_mac(j);
|
||||
}
|
||||
|
||||
|
||||
if (rrc_inst && rrc_inst->scell_group_config) {
|
||||
@@ -73,6 +75,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
|
||||
num_slots_ul++;
|
||||
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));
|
||||
for (int i=0; i<num_slots_ul; i++)
|
||||
pthread_mutex_init(&(nr_ue_mac_inst->ul_config_request[i].mutex_ul_config), NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -35,150 +35,9 @@
|
||||
#include "mac_defs.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_UE/nr_l1_helpers.h"
|
||||
#include "NR_P-Max.h"
|
||||
|
||||
/* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */
|
||||
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_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 = (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");
|
||||
|
||||
// SCS configuration from msg1_SubcarrierSpacing and table 4.2-1 in TS 38.211
|
||||
|
||||
switch (scs){
|
||||
case NR_SubcarrierSpacing_kHz15:
|
||||
mu = 0;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz30:
|
||||
mu = 1;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz60:
|
||||
mu = 2;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz120:
|
||||
mu = 3;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz240:
|
||||
mu = 4;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare3:
|
||||
mu = 5;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare2:
|
||||
mu = 6;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare1:
|
||||
mu = 7;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown msg1_SubcarrierSpacing %lu\n", scs);
|
||||
}
|
||||
|
||||
// Preamble formats given by prach_ConfigurationIndex and tables 6.3.3.2-2 and 6.3.3.2-2 in TS 38.211
|
||||
|
||||
prachConfigIndex = nr_rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
|
||||
if (prach_sequence_length == 0) {
|
||||
AssertFatal(prach_format < 4, "Illegal PRACH format %d for sequence length 839\n", prach_format);
|
||||
switch (prach_format) {
|
||||
|
||||
// long preamble formats
|
||||
case 0:
|
||||
case 3:
|
||||
return 0;
|
||||
|
||||
case 1:
|
||||
return -3;
|
||||
|
||||
case 2:
|
||||
return -6;
|
||||
}
|
||||
} else {
|
||||
switch (prach_format) { // short preamble formats
|
||||
case 0:
|
||||
case 3:
|
||||
return 8 + 3*mu;
|
||||
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
return 5 + 3*mu;
|
||||
|
||||
case 2:
|
||||
case 5:
|
||||
return 3 + 3*mu;
|
||||
|
||||
case 6:
|
||||
return 3*mu;
|
||||
|
||||
case 7:
|
||||
return 5 + 3*mu;
|
||||
|
||||
default:
|
||||
AssertFatal(1 == 0, "[UE %d] ue_procedures.c: FATAL, Illegal preambleFormat %d, prachConfigIndex %d\n", mod_id, prach_format, prachConfigIndex);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration
|
||||
// Measurement units:
|
||||
// - preambleReceivedTargetPower dBm (-202..-60, 2 dBm granularity)
|
||||
// - delta_preamble dB
|
||||
// - RA_PREAMBLE_POWER_RAMPING_STEP dB
|
||||
// - POWER_OFFSET_2STEP_RA dB
|
||||
// returns receivedTargerPower in dBm
|
||||
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);
|
||||
int8_t receivedTargerPower;
|
||||
int8_t delta_preamble;
|
||||
|
||||
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);
|
||||
|
||||
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA;
|
||||
|
||||
LOG_D(MAC, "In %s: receivedTargerPower is %d dBm \n", __FUNCTION__, receivedTargerPower);
|
||||
|
||||
return receivedTargerPower;
|
||||
}
|
||||
|
||||
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){
|
||||
|
||||
int start_symbol = pusch_pdu->start_symbol_index;
|
||||
uint8_t number_of_symbols = pusch_pdu->nr_of_symbols;
|
||||
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos;
|
||||
uint8_t dmrs_type = pusch_pdu->dmrs_config_type;
|
||||
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
|
||||
*number_dmrs_symbols = 0;
|
||||
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||
if((ul_dmrs_symb_pos >> i) & 0x01)
|
||||
*number_dmrs_symbols += 1;
|
||||
}
|
||||
|
||||
*nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
|
||||
}
|
||||
|
||||
// Implementation of 6.2.4 Configured ransmitted power
|
||||
// 3GPP TS 38.101-1 version 16.5.0 Release 16
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/** \brief Function to compute configured maximum output power according to clause 6.2.4 of 3GPP TS 38.101-1 version 16.5.0 Release 16
|
||||
@param Mod_id Module id of UE
|
||||
*/
|
||||
long nr_get_Pcmax(module_id_t mod_id);
|
||||
/** @}*/
|
||||
@@ -30,23 +30,18 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
/* Tools */
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
/* RRC */
|
||||
#include "NR_RACH-ConfigCommon.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
|
||||
/* PHY */
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
|
||||
/* MAC */
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "NR_MAC_COMMON/nr_mac.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_UE/nr_l1_helpers.h"
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
|
||||
@@ -198,6 +193,130 @@ void init_RA(module_id_t mod_id,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */
|
||||
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_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 = (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");
|
||||
|
||||
// SCS configuration from msg1_SubcarrierSpacing and table 4.2-1 in TS 38.211
|
||||
|
||||
switch (scs){
|
||||
case NR_SubcarrierSpacing_kHz15:
|
||||
mu = 0;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz30:
|
||||
mu = 1;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz60:
|
||||
mu = 2;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz120:
|
||||
mu = 3;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_kHz240:
|
||||
mu = 4;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare3:
|
||||
mu = 5;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare2:
|
||||
mu = 6;
|
||||
break;
|
||||
|
||||
case NR_SubcarrierSpacing_spare1:
|
||||
mu = 7;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1 == 0,"Unknown msg1_SubcarrierSpacing %lu\n", scs);
|
||||
}
|
||||
|
||||
// Preamble formats given by prach_ConfigurationIndex and tables 6.3.3.2-2 and 6.3.3.2-2 in TS 38.211
|
||||
|
||||
prachConfigIndex = nr_rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
|
||||
if (prach_sequence_length == 0) {
|
||||
AssertFatal(prach_format < 4, "Illegal PRACH format %d for sequence length 839\n", prach_format);
|
||||
switch (prach_format) {
|
||||
|
||||
// long preamble formats
|
||||
case 0:
|
||||
case 3:
|
||||
return 0;
|
||||
|
||||
case 1:
|
||||
return -3;
|
||||
|
||||
case 2:
|
||||
return -6;
|
||||
}
|
||||
} else {
|
||||
switch (prach_format) { // short preamble formats
|
||||
case 0:
|
||||
case 3:
|
||||
return 8 + 3*mu;
|
||||
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
return 5 + 3*mu;
|
||||
|
||||
case 2:
|
||||
case 5:
|
||||
return 3 + 3*mu;
|
||||
|
||||
case 6:
|
||||
return 3*mu;
|
||||
|
||||
case 7:
|
||||
return 5 + 3*mu;
|
||||
|
||||
default:
|
||||
AssertFatal(1 == 0, "[UE %d] ue_procedures.c: FATAL, Illegal preambleFormat %d, prachConfigIndex %d\n", mod_id, prach_format, prachConfigIndex);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration
|
||||
// Measurement units:
|
||||
// - preambleReceivedTargetPower dBm (-202..-60, 2 dBm granularity)
|
||||
// - delta_preamble dB
|
||||
// - RA_PREAMBLE_POWER_RAMPING_STEP dB
|
||||
// - POWER_OFFSET_2STEP_RA dB
|
||||
// returns receivedTargerPower in dBm
|
||||
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);
|
||||
int8_t receivedTargerPower;
|
||||
int8_t delta_preamble;
|
||||
|
||||
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);
|
||||
|
||||
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA;
|
||||
|
||||
LOG_D(MAC, "In %s: receivedTargerPower is %d dBm \n", __FUNCTION__, receivedTargerPower);
|
||||
|
||||
return receivedTargerPower;
|
||||
}
|
||||
|
||||
void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){
|
||||
|
||||
// Determine the SSB to RACH mapping ratio
|
||||
@@ -280,6 +399,10 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
int PLThreshold = 0;
|
||||
long deltaPreamble_Msg3 = 0;
|
||||
uint8_t noGroupB = 0;
|
||||
// Random seed generation
|
||||
long long tmp = rdtsc_oai();
|
||||
unsigned short int *seed = (unsigned short int*)&tmp;
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
@@ -378,28 +501,28 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) {
|
||||
if (noGroupB) {
|
||||
// use Group A preamble
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % ra->cb_preambles_per_ssb);
|
||||
ra->RA_usedGroupA = 1;
|
||||
} else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) {
|
||||
// Group B is configured and RA preamble Group A is used
|
||||
// - todo add condition on CCCH_sdu_size for initiation by CCCH
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % sizeOfRA_PreamblesGroupA);
|
||||
ra->RA_usedGroupA = 1;
|
||||
} else {
|
||||
// Group B preamble is configured and used
|
||||
// the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A
|
||||
// the remaining belong to RA Preambles Group B
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (nrand48(seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->RA_usedGroupA = 0;
|
||||
}
|
||||
}
|
||||
} else { // Msg3 is being retransmitted
|
||||
if (ra->RA_usedGroupA && noGroupB) {
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % ra->cb_preambles_per_ssb);
|
||||
} else if (ra->RA_usedGroupA && !noGroupB){
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % sizeOfRA_PreamblesGroupA);
|
||||
} else {
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (nrand48(seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
}
|
||||
}
|
||||
prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex;
|
||||
@@ -467,7 +590,8 @@ void nr_get_prach_resources(module_id_t mod_id,
|
||||
if (rach_ConfigDedicated) {
|
||||
if (rach_ConfigDedicated->cfra){
|
||||
uint8_t cfra_ssb_resource_idx = 0;
|
||||
prach_resources->ra_PreambleIndex = rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[cfra_ssb_resource_idx]->ra_PreambleIndex;
|
||||
ra->ra_PreambleIndex = rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[cfra_ssb_resource_idx]->ra_PreambleIndex;
|
||||
prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex;
|
||||
LOG_D(MAC, "In %s: selected RA preamble index %d for contention-free random access procedure for SSB with Id %d\n", __FUNCTION__, prach_resources->ra_PreambleIndex, cfra_ssb_resource_idx);
|
||||
}
|
||||
} else {
|
||||
@@ -616,7 +740,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
} else {
|
||||
|
||||
size_sdu = nr_write_ce_ulsch_pdu(pdu, mac);
|
||||
size_sdu = nr_write_ce_ulsch_pdu(pdu, mac, 0, &(mac->crnti), NULL, NULL, NULL);
|
||||
pdu += size_sdu;
|
||||
ra->Msg3_size = size_sdu;
|
||||
|
||||
@@ -837,6 +961,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
// Random seed generation
|
||||
long long tmp = rdtsc_oai();
|
||||
unsigned short int *seed = (unsigned short int*)&tmp;
|
||||
|
||||
ra->first_Msg3 = 1;
|
||||
ra->ra_PreambleIndex = -1;
|
||||
@@ -850,7 +977,7 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
||||
LOG_D(MAC, "In %s: [UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...\n",
|
||||
__FUNCTION__, mod_id, frame, slot, ra->preambleTransMax);
|
||||
|
||||
ra->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
|
||||
ra->RA_backoff_cnt = nrand48(seed) % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
|
||||
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP += 2; // 2 dB increment
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id);
|
||||
|
||||
@@ -76,7 +76,6 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
||||
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){
|
||||
|
||||
uint16_t monitoringSymbolsWithinSlot = 0;
|
||||
uint8_t coreset_id = 1;
|
||||
int sps = 0;
|
||||
|
||||
AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n");
|
||||
@@ -97,11 +96,23 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
NR_SearchSpace_t *ss;
|
||||
NR_ControlResourceSet_t *coreset;
|
||||
if(ss_id>=0) {
|
||||
ss = mac->SSpace[bwp_id][coreset_id - 1][ss_id];
|
||||
if (rnti_type == NR_RNTI_TC || rnti_type == NR_RNTI_RA) {
|
||||
ss = mac->ra.ss;
|
||||
AssertFatal(mac->ra.ss->searchSpaceId == ss_id,"Search Space id %d does not correspond to the one in ra->ss %ld for RA procedures\n",
|
||||
ss_id,mac->ra.ss->searchSpaceId);
|
||||
}
|
||||
else
|
||||
ss = mac->SSpace[bwp_id][ss_id];
|
||||
}
|
||||
else
|
||||
ss = mac->search_space_zero;
|
||||
|
||||
uint8_t coreset_id = *ss->controlResourceSetId;
|
||||
|
||||
if(coreset_id>0) {
|
||||
coreset = mac->coreset[bwp_id][coreset_id - 1];
|
||||
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
|
||||
} else {
|
||||
ss = mac->search_space_zero;
|
||||
coreset = mac->coreset0;
|
||||
if(rnti_type == NR_RNTI_SI) {
|
||||
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||
@@ -255,7 +266,7 @@ 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 = (mac->cg) ? mac->DL_BWP_Id : 0, coreset_id = (mac->cg) ? 1 : 0;
|
||||
uint8_t bwp_id = (mac->cg) ? mac->DL_BWP_Id : 0;
|
||||
//NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_BWP_DownlinkDedicated_t *bwpd = (bwp_id>0) ? mac->DLbwp[bwp_id-1]->bwp_Dedicated : mac->cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = (bwp_id>0) ? mac->DLbwp[bwp_id-1]->bwp_Common : &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP;
|
||||
@@ -264,9 +275,9 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
|
||||
// loop over all available SS for CORESET ID 1
|
||||
if (bwpd) {
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id][coreset_id - 1][ss_id] != NULL; ss_id++){
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS && mac->SSpace[bwp_id][ss_id] != NULL; ss_id++){
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] ss_id %d\n",ss_id);
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id][coreset_id - 1][ss_id];
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id][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_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig;
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
/* PHY */
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
|
||||
/* utils */
|
||||
#include "assertions.h"
|
||||
@@ -135,6 +134,55 @@ const initial_pucch_resource_t initial_pucch_resource[16] = {
|
||||
};
|
||||
|
||||
|
||||
void nr_ue_init_mac(module_id_t module_idP) {
|
||||
int i;
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||
// default values as deined in 38.331 sec 9.2.2
|
||||
LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP);
|
||||
//mac->scheduling_info.macConfig=NULL;
|
||||
mac->scheduling_info.retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf10240;
|
||||
mac->scheduling_info.periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_infinity;
|
||||
// mac->scheduling_info.periodicPHR_Timer = NR_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
// mac->scheduling_info.prohibitPHR_Timer = NR_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
// mac->scheduling_info.PathlossChange_db = NR_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
// mac->PHR_state = NR_MAC_MainConfig__phr_Config_PR_setup;
|
||||
mac->scheduling_info.SR_COUNTER = 0;
|
||||
mac->scheduling_info.sr_ProhibitTimer = 0;
|
||||
mac->scheduling_info.sr_ProhibitTimer_Running = 0;
|
||||
// mac->scheduling_info.maxHARQ_Tx = NR_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
// mac->scheduling_info.ttiBundling = 0;
|
||||
// mac->scheduling_info.extendedBSR_Sizes_r10 = 0;
|
||||
// mac->scheduling_info.extendedPHR_r10 = 0;
|
||||
// mac->scheduling_info.drx_config = NULL;
|
||||
// mac->scheduling_info.phr_config = NULL;
|
||||
// set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW.
|
||||
mac->scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
mac->BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
// mac->scheduling_info.periodicPHR_SF = nr_get_sf_perioidicPHR_Timer(mac->scheduling_info.periodicPHR_Timer);
|
||||
// mac->scheduling_info.prohibitPHR_SF = nr_get_sf_prohibitPHR_Timer(mac->scheduling_info.prohibitPHR_Timer);
|
||||
// mac->scheduling_info.PathlossChange_db = nr_get_db_dl_PathlossChange(mac->scheduling_info.PathlossChange);
|
||||
// mac->PHR_reporting_active = 0;
|
||||
|
||||
for (i = 0; i < NR_MAX_NUM_LCID; i++) {
|
||||
LOG_D(NR_MAC, "[UE%d] Applying default logical channel config for LCGID %d\n",
|
||||
module_idP, i);
|
||||
mac->scheduling_info.Bj[i] = -1;
|
||||
mac->scheduling_info.bucket_size[i] = -1;
|
||||
|
||||
if (i < UL_SCH_LCID_DTCH) { // initialize all control channels lcgid to 0
|
||||
mac->scheduling_info.LCGID[i] = 0;
|
||||
} else { // initialize all the data channels lcgid to 1
|
||||
mac->scheduling_info.LCGID[i] = 1;
|
||||
}
|
||||
|
||||
mac->scheduling_info.LCID_status[i] = LCID_EMPTY;
|
||||
mac->scheduling_info.LCID_buffer_remain[i] = 0;
|
||||
for (int i=0;i<NR_MAX_HARQ_PROCESSES;i++) mac->first_ul_tx[i]=1;
|
||||
}
|
||||
}
|
||||
|
||||
void get_bwp_info(NR_UE_MAC_INST_t *mac,
|
||||
int dl_bwp_id,
|
||||
int ul_bwp_id,
|
||||
@@ -620,15 +668,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&ul_config->mutex_ul_config);
|
||||
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);
|
||||
pthread_mutex_unlock(&ul_config->mutex_ul_config);
|
||||
|
||||
// Config PUSCH PDU
|
||||
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -681,13 +729,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
return -1;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&ul_config->mutex_ul_config);
|
||||
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);
|
||||
pthread_mutex_unlock(&ul_config->mutex_ul_config);
|
||||
|
||||
// Config PUSCH PDU
|
||||
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
||||
|
||||
} else AssertFatal(1==0,"Cannot schedule PUSCH\n");
|
||||
break;
|
||||
}
|
||||
@@ -821,14 +871,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
mac->mib->dmrs_TypeA_Position,
|
||||
dlsch_config_pdu_1_0->number_symbols,
|
||||
dlsch_config_pdu_1_0->start_symbol,
|
||||
mappingtype);
|
||||
mappingtype, 1);
|
||||
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;
|
||||
else
|
||||
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2;
|
||||
dlsch_config_pdu_1_0->dmrs_ports = 1; // only port 0 in case of DCI 1_0
|
||||
/* VRB_TO_PRB_MAPPING */
|
||||
dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
|
||||
/* MCS TABLE INDEX */
|
||||
@@ -1008,13 +1060,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
|
||||
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,
|
||||
mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position,
|
||||
dlsch_config_pdu_1_1->number_symbols,
|
||||
dlsch_config_pdu_1_1->start_symbol,
|
||||
mappingtype);
|
||||
|
||||
dlsch_config_pdu_1_1->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? NFAPI_NR_DMRS_TYPE1 : NFAPI_NR_DMRS_TYPE2;
|
||||
|
||||
/* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
|
||||
@@ -1078,6 +1123,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
uint8_t n_codewords = 1; // FIXME!!!
|
||||
long *max_length = NULL;
|
||||
long *dmrs_type = NULL;
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = 1; // default value
|
||||
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA) {
|
||||
max_length = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength;
|
||||
dmrs_type = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type;
|
||||
@@ -1089,31 +1135,36 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
if ((dmrs_type == NULL) && (max_length == NULL)){
|
||||
// Table 7.3.1.2.2-1: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=1
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_1[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_1[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_1[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_1[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_1[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_1[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_1[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_1[dci->antenna_ports.val][4]<<3));
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = 1;
|
||||
}
|
||||
if ((dmrs_type == NULL) && (max_length != NULL)){
|
||||
// Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2
|
||||
if (n_codewords == 1) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][5];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][6]<<5) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][7]<<6) +
|
||||
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][8]<<7));
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][9];
|
||||
}
|
||||
if (n_codewords == 2) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][5];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][6];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[6] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][7];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[7] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][8];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][6]<<5) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][7]<<6) +
|
||||
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][8]<<7));
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][9];
|
||||
}
|
||||
}
|
||||
@@ -1121,44 +1172,67 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
// Table 7.3.1.2.2-3: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=1
|
||||
if (n_codewords == 1) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][6]<<5));
|
||||
}
|
||||
if (n_codewords == 2) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][5];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6]<<5));
|
||||
}
|
||||
}
|
||||
if ((dmrs_type != NULL) && (max_length != NULL)){
|
||||
// Table 7.3.1.2.2-4: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=2
|
||||
if (n_codewords == 1) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][5];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][6]<<5) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][7]<<6) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][8]<<7) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][9]<<8) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][10]<<9) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][11]<<10) +
|
||||
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][12]<<11));
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][13];
|
||||
}
|
||||
if (n_codewords == 2) {
|
||||
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][0];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][1];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][2];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][3];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][4];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][5];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][6];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[6] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][7];
|
||||
dlsch_config_pdu_1_1->dmrs_ports[7] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][8];
|
||||
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][1] +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][2]<<1) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][3]<<2) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][4]<<3) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][5]<<4) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][6]<<5) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][7]<<6) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][8]<<7) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9]<<8) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][10]<<9) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][11]<<10) +
|
||||
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][12]<<11));
|
||||
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9];
|
||||
}
|
||||
}
|
||||
|
||||
/* dmrs symbol positions*/
|
||||
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
|
||||
mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position,
|
||||
dlsch_config_pdu_1_1->number_symbols,
|
||||
dlsch_config_pdu_1_1->start_symbol,
|
||||
mappingtype,
|
||||
dlsch_config_pdu_1_1->n_front_load_symb);
|
||||
|
||||
/* TCI */
|
||||
if (mac->dl_config_request.dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.tci_present_in_dci == 1){
|
||||
// 0 bit if higher layer parameter tci-PresentInDCI is not enabled
|
||||
@@ -1396,7 +1470,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
|
||||
mac->cg->physicalCellGroupConfig &&
|
||||
(mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL ||
|
||||
mac->cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) {
|
||||
LOG_E(PHY,"PUCCH Unsupported cell group configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
LOG_E(MAC,"PUCCH Unsupported cell group configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return;
|
||||
}
|
||||
else if (mac->cg &&
|
||||
@@ -2203,9 +2277,54 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac,
|
||||
return false;
|
||||
}
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slot){
|
||||
// no UL-SCH resources available for this tti && UE has a valid PUCCH resources for SR configuration for this tti
|
||||
DevCheck(module_idP < (int) NB_UE_INST, module_idP, NB_NR_UE_MAC_INST, 0);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||
DSR_TRANSMAX_t dsr_TransMax = sr_n64; // todo
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d slot %d send SR indication (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
|
||||
module_idP, frameP, slot,
|
||||
mac->scheduling_info.SR_COUNTER,
|
||||
(1 << (2 + dsr_TransMax)),
|
||||
mac->scheduling_info.SR_pending); // todo
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, int slotP){
|
||||
return 0;
|
||||
if ((mac->scheduling_info.SR_pending == 1) &&
|
||||
(mac->scheduling_info.SR_COUNTER < (1 << (2 + dsr_TransMax)))) {
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d slot %d PHY asks for SR (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d, increment SR_COUNTER\n",
|
||||
module_idP, frameP, slot,
|
||||
mac->scheduling_info.SR_COUNTER,
|
||||
(1 << (2 + dsr_TransMax)),
|
||||
mac->scheduling_info.SR_pending); // todo
|
||||
mac->scheduling_info.SR_COUNTER++;
|
||||
|
||||
// start the sr-prohibittimer : rel 9 and above
|
||||
if (mac->scheduling_info.sr_ProhibitTimer > 0) { // timer configured
|
||||
mac->scheduling_info.sr_ProhibitTimer--;
|
||||
mac->scheduling_info.
|
||||
sr_ProhibitTimer_Running = 1;
|
||||
} else {
|
||||
mac->scheduling_info.
|
||||
sr_ProhibitTimer_Running = 0;
|
||||
}
|
||||
//mac->ul_active =1;
|
||||
return (1); //instruct phy to signal SR
|
||||
} else {
|
||||
// notify RRC to relase PUCCH/SRS
|
||||
// clear any configured dl/ul
|
||||
// initiate RA
|
||||
if (mac->scheduling_info.SR_pending) {
|
||||
// release all pucch resource
|
||||
//mac->physicalConfigDedicated = NULL; // todo
|
||||
//mac->ul_active = 0; // todo
|
||||
mac->BSR_reporting_active =
|
||||
NR_BSR_TRIGGER_NONE;
|
||||
LOG_I(NR_MAC, "[UE %d] Release all SRs \n", module_idP);
|
||||
}
|
||||
|
||||
mac->scheduling_info.SR_pending = 0;
|
||||
mac->scheduling_info.SR_COUNTER = 0;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3210,7 +3329,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;
|
||||
int16_t pdu_len = (int16_t)(dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length;
|
||||
int32_t pdu_len = (int32_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;
|
||||
@@ -3467,13 +3586,17 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
* Return: number of written bytes
|
||||
*/
|
||||
int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
NR_UE_MAC_INST_t *mac) {
|
||||
NR_UE_MAC_INST_t *mac,
|
||||
uint8_t power_headroom, // todo: NR_POWER_HEADROOM_CMD *power_headroom,
|
||||
uint16_t *crnti,
|
||||
NR_BSR_SHORT *truncated_bsr,
|
||||
NR_BSR_SHORT *short_bsr,
|
||||
NR_BSR_LONG *long_bsr) {
|
||||
|
||||
int mac_ce_len = 0;
|
||||
uint8_t mac_ce_size = 0;
|
||||
NR_UE_MAC_CE_t *nr_ue_mac_ce = &mac->nr_ue_mac_ce;
|
||||
|
||||
if (nr_ue_mac_ce->phr_reporting && mac->phr_Config != NULL) {
|
||||
uint8_t *pdu = mac_ce;
|
||||
if (power_headroom) {
|
||||
|
||||
// MAC CE fixed subheader
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
|
||||
@@ -3481,21 +3604,22 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
mac_ce++;
|
||||
|
||||
// PHR MAC CE (1 octet)
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PH = 0;
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PH = power_headroom;
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->R1 = 0;
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PCMAX = 0;
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PCMAX = 0; // todo
|
||||
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->R2 = 0;
|
||||
|
||||
// update pointer and length
|
||||
mac_ce_size = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
|
||||
mac_ce += mac_ce_size;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : power_headroom pdu %p mac_ce %p b\n",
|
||||
pdu, mac_ce);
|
||||
}
|
||||
|
||||
if (!get_softmodem_params()->sa && get_softmodem_params()->do_ra && mac->ra.ra_state != RA_SUCCEEDED) {
|
||||
if (crnti && (!get_softmodem_params()->sa && get_softmodem_params()->do_ra && mac->ra.ra_state != RA_SUCCEEDED)) {
|
||||
|
||||
LOG_D(NR_MAC, "In %s: generating C-RNTI MAC CE with C-RNTI %x\n", __FUNCTION__, mac->crnti);
|
||||
LOG_D(NR_MAC, "In %s: generating C-RNTI MAC CE with C-RNTI %x\n", __FUNCTION__, (*crnti));
|
||||
|
||||
// MAC CE fixed subheader
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
|
||||
@@ -3503,7 +3627,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
mac_ce++;
|
||||
|
||||
// C-RNTI MAC CE (2 octets)
|
||||
*(uint16_t *) mac_ce = mac->crnti;
|
||||
*(uint16_t *) mac_ce = (*crnti);
|
||||
|
||||
// update pointer and length
|
||||
mac_ce_size = sizeof(uint16_t);
|
||||
@@ -3512,55 +3636,110 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
|
||||
}
|
||||
|
||||
if (nr_ue_mac_ce->truncated_bsr) {
|
||||
if (truncated_bsr) {
|
||||
|
||||
LOG_D(NR_MAC, "In %s: generating short truncated BSR MAC CE with command %x\n", __FUNCTION__, nr_ue_mac_ce->truncated_bsr);
|
||||
|
||||
// MAC CE fixed subheader
|
||||
// MAC CE fixed subheader
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->LCID = UL_SCH_LCID_S_TRUNCATED_BSR;
|
||||
mac_ce++;
|
||||
|
||||
// Short truncated BSR MAC CE (1 octet)
|
||||
((NR_BSR_SHORT_TRUNCATED *) mac_ce)-> Buffer_size = 0;
|
||||
((NR_BSR_SHORT_TRUNCATED *) mac_ce)-> LcgID = 0;
|
||||
((NR_BSR_SHORT_TRUNCATED *) mac_ce)-> Buffer_size = truncated_bsr->Buffer_size;
|
||||
((NR_BSR_SHORT_TRUNCATED *) mac_ce)-> LcgID = truncated_bsr->LcgID;;
|
||||
|
||||
// update pointer and length
|
||||
mac_ce_size = sizeof(NR_BSR_SHORT_TRUNCATED);
|
||||
mac_ce += mac_ce_size;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : truncated_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
|
||||
truncated_bsr->Buffer_size, truncated_bsr->LcgID, pdu, mac_ce);
|
||||
|
||||
} else if (nr_ue_mac_ce->short_bsr) {
|
||||
} else if (short_bsr) {
|
||||
|
||||
LOG_D(NR_MAC, "In %s: generating short BSR MAC CE with command %x\n", __FUNCTION__, nr_ue_mac_ce->short_bsr);
|
||||
|
||||
// MAC CE fixed subheader
|
||||
// MAC CE fixed subheader
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->LCID = UL_SCH_LCID_S_BSR;
|
||||
mac_ce++;
|
||||
|
||||
// Short truncated BSR MAC CE (1 octet)
|
||||
((NR_BSR_SHORT *) mac_ce)->Buffer_size = nr_ue_mac_ce->short_bsr;
|
||||
((NR_BSR_SHORT *) mac_ce)->LcgID = 0;
|
||||
((NR_BSR_SHORT *) mac_ce)->Buffer_size = short_bsr->Buffer_size;
|
||||
((NR_BSR_SHORT *) mac_ce)->LcgID = short_bsr->LcgID;
|
||||
|
||||
// update pointer and length
|
||||
mac_ce_size = sizeof(NR_BSR_SHORT);
|
||||
mac_ce += mac_ce_size;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : short_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
|
||||
short_bsr->Buffer_size, short_bsr->LcgID, pdu, mac_ce);
|
||||
} else if (long_bsr) {
|
||||
|
||||
} else if (nr_ue_mac_ce->long_bsr) {
|
||||
// MAC CE variable subheader
|
||||
// todo ch 6.1.3.1. TS 38.321
|
||||
// ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->R = 0;
|
||||
// ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0;
|
||||
// ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = UL_SCH_LCID_L_BSR;
|
||||
// ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = 0;
|
||||
// sh_size = 2;
|
||||
// MAC CE variable subheader
|
||||
// ch 6.1.3.1. TS 38.321
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_ce)->R = 0;
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_ce)->F = 0;
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_ce)->LCID = UL_SCH_LCID_L_BSR;
|
||||
|
||||
// Short truncated BSR MAC CE (1 octet)
|
||||
// ((NR_BSR_LONG *) mac_ce)->Buffer_size0 = short_bsr;
|
||||
// ((NR_BSR_LONG *) mac_ce)->LCGID0 = 0;
|
||||
// mac_ce_size = sizeof(NR_BSR_LONG); // size is variable
|
||||
NR_MAC_SUBHEADER_SHORT *mac_pdu_subheader_ptr = (NR_MAC_SUBHEADER_SHORT *) mac_ce;
|
||||
mac_ce += 2;
|
||||
|
||||
// Could move to nr_get_sdu()
|
||||
uint8_t *Buffer_size_ptr= (uint8_t*) mac_ce + 1;
|
||||
//int NR_BSR_LONG_SIZE = 1;
|
||||
if (long_bsr->Buffer_size0 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID0 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID0 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size0;
|
||||
}
|
||||
if (long_bsr->Buffer_size1 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID1 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID1 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size1;
|
||||
}
|
||||
if (long_bsr->Buffer_size2 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID2 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID2 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size2;
|
||||
}
|
||||
if (long_bsr->Buffer_size3 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID3 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID3 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size3;
|
||||
}
|
||||
if (long_bsr->Buffer_size4 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID4 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID4 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size4;
|
||||
}
|
||||
if (long_bsr->Buffer_size5 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID5 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID5 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size5;
|
||||
}
|
||||
if (long_bsr->Buffer_size6 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID6 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID6 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size6;
|
||||
}
|
||||
if (long_bsr->Buffer_size7 == 0) {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID7 = 0;
|
||||
} else {
|
||||
((NR_BSR_LONG *) mac_ce)->LcgID7 = 1;
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size7;
|
||||
}
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_subheader_ptr)->L = mac_ce_size = (uint8_t*) Buffer_size_ptr - (uint8_t*) mac_ce;
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : long_bsr size %d Lcgbit 0x%02x Buffer_size %d %d %d %d %d %d %d %d\n", mac_ce_size, *((uint8_t*) mac_ce),
|
||||
((NR_BSR_LONG *) mac_ce)->Buffer_size0, ((NR_BSR_LONG *) mac_ce)->Buffer_size1, ((NR_BSR_LONG *) mac_ce)->Buffer_size2, ((NR_BSR_LONG *) mac_ce)->Buffer_size3,
|
||||
((NR_BSR_LONG *) mac_ce)->Buffer_size4, ((NR_BSR_LONG *) mac_ce)->Buffer_size5, ((NR_BSR_LONG *) mac_ce)->Buffer_size6, ((NR_BSR_LONG *) mac_ce)->Buffer_size7);
|
||||
// update pointer and length
|
||||
mac_ce = Buffer_size_ptr;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
}
|
||||
|
||||
return mac_ce_len;
|
||||
@@ -3612,8 +3791,6 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cc_id = dl_info->cc_id;
|
||||
uint8_t gNB_id = dl_info->gNB_index;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
uint8_t n_subPDUs = 0; // number of RAR payloads
|
||||
@@ -3625,7 +3802,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
||||
int ret = 0;
|
||||
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer
|
||||
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
|
||||
uint8_t preamble_index = get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex;
|
||||
uint8_t preamble_index = ra->ra_PreambleIndex;
|
||||
|
||||
LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
|
||||
|
||||
@@ -3770,13 +3947,15 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
||||
rnti = ra->t_crnti;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&ul_config->mutex_ul_config);
|
||||
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);
|
||||
pthread_mutex_unlock(&ul_config->mutex_ul_config);
|
||||
|
||||
// Config Msg3 PDU
|
||||
nr_config_pusch_pdu(mac, pusch_config_pdu, NULL, &rar_grant, rnti, NULL);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
@@ -318,7 +318,15 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
uint16_t sco = absolute_diff%(12*scs_scaling);
|
||||
AssertFatal(sco==(scs_scaling * (ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value))),"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset);
|
||||
// values of subcarrier offset larger than the limit only indicates CORESET for Type0-PDCCH CSS set is not present
|
||||
uint8_t ssb_SubcarrierOffset_limit = 0;
|
||||
if(frequency_range == FR1) {
|
||||
ssb_SubcarrierOffset_limit = 24;
|
||||
} else {
|
||||
ssb_SubcarrierOffset_limit = 12;
|
||||
}
|
||||
if (ssb_SubcarrierOffset<ssb_SubcarrierOffset_limit)
|
||||
AssertFatal(sco==(scs_scaling * (ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value))),"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset);
|
||||
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
|
||||
cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG;
|
||||
cfg->num_tlv++;
|
||||
@@ -354,8 +362,9 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG;
|
||||
cfg->num_tlv+=2;
|
||||
|
||||
// logical antenna ports
|
||||
cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts;
|
||||
AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 13, "pdsch_AntennaPorts in 1...12\n");
|
||||
AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 33, "pdsch_AntennaPorts in 1...32\n");
|
||||
cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG;
|
||||
|
||||
int num_ssb=0;
|
||||
@@ -534,11 +543,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
const NR_BWP_Downlink_t *bwp = bwpList->list.array[i];
|
||||
calculate_preferred_dl_tda(Mod_idP, bwp);
|
||||
}
|
||||
} else {
|
||||
calculate_preferred_dl_tda(Mod_idP, NULL);
|
||||
}
|
||||
|
||||
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList;
|
||||
if(ubwpList) {
|
||||
AssertFatal(ubwpList->list.count > 0, "downlinkBWP_ToAddModList no BWPs!\n");
|
||||
AssertFatal(ubwpList->list.count > 0, "uplinkBWP_ToAddModList no BWPs!\n");
|
||||
for (int i = 0; i < ubwpList->list.count; ++i) {
|
||||
const NR_BWP_Uplink_t *ubwp = ubwpList->list.array[i];
|
||||
calculate_preferred_ul_tda(Mod_idP, ubwp);
|
||||
@@ -613,8 +624,15 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP;
|
||||
}
|
||||
UE_info->UE_sched_ctrl[UE_id].search_space = get_searchspace(scc, bwpd, target_ss);
|
||||
UE_info->UE_sched_ctrl[UE_id].coreset = get_coreset(scc, bwpd, UE_info->UE_sched_ctrl[UE_id].search_space, target_ss);
|
||||
UE_info->UE_sched_ctrl[UE_id].coreset = get_coreset(Mod_idP, scc, bwpd, UE_info->UE_sched_ctrl[UE_id].search_space, target_ss);
|
||||
UE_info->UE_sched_ctrl[UE_id].maxL = 2;
|
||||
if (CellGroup->spCellConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup
|
||||
)
|
||||
compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP);
|
||||
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
|
||||
#include "openair1/PHY/defs_gNB.h"
|
||||
#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
@@ -62,7 +59,6 @@ uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
uint8_t vnf_first_sched_entry = 1;
|
||||
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
int CC_idP,
|
||||
frame_t frameP,
|
||||
@@ -351,7 +347,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
if ((slot == 0) && (frame & 127) == 0) {
|
||||
stats_output[0]='\0';
|
||||
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384);
|
||||
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384,true);
|
||||
LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,6 +261,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
|
||||
else
|
||||
mu = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
int bwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
uint8_t fdm = cfg->prach_config.num_prach_fd_occasions.value;
|
||||
// prach is scheduled according to configuration index and tables 6.3.3.2.2 to 6.3.3.2.4
|
||||
if ( get_nr_prach_info_from_index(config_index,
|
||||
@@ -387,7 +389,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
|
||||
const int16_t N_RA_RB = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch);
|
||||
uint16_t *vrb_map_UL = &cc->vrb_map_UL[slotP * MAX_BWP_SIZE];
|
||||
for (int i = 0; i < N_RA_RB * fdm; ++i)
|
||||
vrb_map_UL[rach_ConfigGeneric->msg1_FrequencyStart + i] = 0xff; // all symbols
|
||||
vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = 0xff; // all symbols
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -772,10 +774,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
|
||||
// generation of DCI 0_0 to schedule msg3 retransmission
|
||||
NR_SearchSpace_t *ss = ra->ra_ss;
|
||||
NR_ControlResourceSet_t *coreset = NULL;
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = *ss->controlResourceSetId==0 ? &nr_mac->type0_PDCCH_CSS_config[ra->beam_id] : NULL;
|
||||
|
||||
coreset = nr_mac->sched_ctrlCommon->coreset; // this is coreset 0
|
||||
NR_ControlResourceSet_t *coreset = get_coreset(module_idP, scc, NULL, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg3 retransmission\n");
|
||||
|
||||
nfapi_nr_ul_dci_request_t *ul_dci_req = &nr_mac->UL_dci_req[CC_id];
|
||||
@@ -789,13 +788,18 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
ul_dci_req->numPdus += 1;
|
||||
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, genericParameters, type0_PDCCH_CSS_config);
|
||||
nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
|
||||
nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15;
|
||||
}
|
||||
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 4);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac, NULL, 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);
|
||||
@@ -914,10 +918,19 @@ 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 ?
|
||||
ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
|
||||
int bwpSize = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int bwpStart = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
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];
|
||||
int act_bwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int act_bwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (!((bwpStart >= act_bwp_start) && ((bwpStart+bwpSize) <= (act_bwp_start+act_bwp_size))))
|
||||
bwpStart = act_bwp_start;
|
||||
}
|
||||
|
||||
/* search msg3_nb_rb free RBs */
|
||||
int rbSize = 0;
|
||||
@@ -925,16 +938,17 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
while (rbSize < msg3_nb_rb) {
|
||||
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
|
||||
rbSize = 0;
|
||||
while (rbStart < bwpSize && vrb_map_UL[rbStart])
|
||||
while (rbStart < bwpSize && vrb_map_UL[rbStart + bwpStart])
|
||||
rbStart++;
|
||||
AssertFatal(rbStart < bwpSize - msg3_nb_rb, "no space to allocate Msg 3 for RA!\n");
|
||||
while (rbStart + rbSize < bwpSize
|
||||
&& !vrb_map_UL[rbStart + rbSize]
|
||||
&& !vrb_map_UL[rbStart + bwpStart + rbSize]
|
||||
&& rbSize < msg3_nb_rb)
|
||||
rbSize++;
|
||||
}
|
||||
ra->msg3_nb_rb = msg3_nb_rb;
|
||||
ra->msg3_first_rb = rbStart;
|
||||
ra->msg3_bwp_start = bwpStart;
|
||||
}
|
||||
|
||||
|
||||
@@ -1020,12 +1034,12 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE];
|
||||
for (int i = 0; i < ra->msg3_nb_rb; ++i) {
|
||||
AssertFatal(!vrb_map_UL[i + ra->msg3_first_rb],
|
||||
AssertFatal(!vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start],
|
||||
"RB %d in %4d.%2d is already taken, cannot allocate Msg3!\n",
|
||||
i + ra->msg3_first_rb,
|
||||
ra->Msg3_frame,
|
||||
ra->Msg3_slot);
|
||||
vrb_map_UL[i + ra->msg3_first_rb] = 1;
|
||||
vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] = 1;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
|
||||
@@ -1044,9 +1058,6 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
|
||||
|
||||
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;
|
||||
@@ -1059,8 +1070,6 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1075,17 +1084,11 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
ra->msg3_round,
|
||||
ra->rnti);
|
||||
|
||||
int bwp_start;
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
bwp_start = abwp_start;
|
||||
else
|
||||
bwp_start = ibwp_start;
|
||||
|
||||
fill_msg3_pusch_pdu(pusch_pdu,scc,
|
||||
ra->msg3_round,
|
||||
startSymbolAndLength,
|
||||
ra->rnti, scs,
|
||||
ibwp_size, bwp_start,
|
||||
ibwp_size, ra->msg3_bwp_start,
|
||||
mappingtype, fh,
|
||||
ra->msg3_first_rb, ra->msg3_nb_rb);
|
||||
future_ul_tti_req->n_pdus += 1;
|
||||
@@ -1141,16 +1144,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
BWPSize = type0_PDCCH_CSS_config->num_rbs;
|
||||
}
|
||||
|
||||
if (*ss->controlResourceSetId == 0)
|
||||
coreset = nr_mac->sched_ctrlCommon->coreset; // this is coreset 0
|
||||
else
|
||||
coreset = get_coreset(scc, bwp, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
coreset = get_coreset(module_idP, 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++) {
|
||||
if (vrb_map[rbStart + i]) {
|
||||
if (vrb_map[BWPStart + rbStart + i]) {
|
||||
rbStart += i;
|
||||
i = 0;
|
||||
}
|
||||
@@ -1170,7 +1170,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss,4);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
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);
|
||||
@@ -1199,7 +1204,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
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, genericParameters, type0_PDCCH_CSS_config);
|
||||
nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
|
||||
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
|
||||
}
|
||||
|
||||
@@ -1272,7 +1277,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype);
|
||||
mappingtype, 1);
|
||||
|
||||
int x_Overhead = 0;
|
||||
uint8_t tb_scaling = 0;
|
||||
@@ -1290,14 +1295,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_pdu->powerControlOffsetSS = 1;
|
||||
|
||||
dci_pdu_rel15_t dci_payload;
|
||||
int effective_BWPSize = get_softmodem_params()->sa == 1 ? (pdcch_pdu_rel15->FreqDomainResource[0]==0xFF ? 48 : 24) : pdsch_pdu_rel15->BWPSize;
|
||||
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
effective_BWPSize);
|
||||
BWPSize);
|
||||
|
||||
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%d\n",pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
effective_BWPSize);
|
||||
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n",pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
BWPSize);
|
||||
|
||||
dci_payload.time_domain_assignment.val = time_domain_assignment;
|
||||
dci_payload.vrb_to_prb_mapping.val = 0;
|
||||
@@ -1305,11 +1309,11 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_payload.tb_scaling = tb_scaling;
|
||||
|
||||
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,%ld), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
|
||||
dci_payload.frequency_domain_assignment.val,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
effective_BWPSize,
|
||||
BWPSize,
|
||||
dci_payload.time_domain_assignment.val,
|
||||
dci_payload.vrb_to_prb_mapping.val,
|
||||
dci_payload.mcs,
|
||||
@@ -1330,7 +1334,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
&dci_payload,
|
||||
NR_DL_DCI_FORMAT_1_0,
|
||||
NR_RNTI_RA,
|
||||
effective_BWPSize,
|
||||
BWPSize,
|
||||
bwpid);
|
||||
|
||||
// DL TX request
|
||||
@@ -1360,7 +1364,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
// Mark the corresponding RBs as used
|
||||
for (int rb = 0; rb < rbSize; rb++) {
|
||||
vrb_map[rb + rbStart] = 1;
|
||||
vrb_map[BWPStart + rb + rbStart] = 1;
|
||||
}
|
||||
|
||||
ra->state = WAIT_Msg3;
|
||||
@@ -1397,10 +1401,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
}
|
||||
|
||||
if (*ss->controlResourceSetId == 0)
|
||||
coreset = nr_mac->sched_ctrlCommon->coreset; // this is coreset 0
|
||||
else
|
||||
coreset = get_coreset(scc, bwp, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
coreset = get_coreset(module_idP, scc, bwp, ss, NR_SearchSpace__searchSpaceType_PR_common);
|
||||
|
||||
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg4\n");
|
||||
|
||||
@@ -1440,7 +1441,12 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
// 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,4);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
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);
|
||||
@@ -1450,7 +1456,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
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+=((coreset->frequencyDomainResources.buf[i]>>j)&1);
|
||||
}
|
||||
n_rb*=6;
|
||||
const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE;
|
||||
@@ -1475,7 +1481,7 @@ 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])->LCID = DL_SCH_LCID_CCCH;
|
||||
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length;
|
||||
ra->mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", mac_sdu_length, (int)sizeof(NR_MAC_SUBHEADER_SHORT), ra->mac_pdu_length);
|
||||
LOG_I(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", mac_sdu_length, (int)sizeof(NR_MAC_SUBHEADER_SHORT), ra->mac_pdu_length);
|
||||
}
|
||||
|
||||
// Calculate number of symbols
|
||||
@@ -1490,7 +1496,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype);
|
||||
mappingtype, 1);
|
||||
|
||||
uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos);
|
||||
|
||||
@@ -1531,17 +1537,26 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
int rbSize = 0;
|
||||
uint8_t tb_scaling = 0;
|
||||
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||
// increase PRBs until we get to BWPSize or TBS is bigger than MAC PDU size
|
||||
do {
|
||||
rbSize++;
|
||||
LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
|
||||
LOG_D(NR_MAC,"Msg4 Allocation : RBloop Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
|
||||
harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
|
||||
nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
|
||||
rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
|
||||
} while (rbSize < BWPSize && harq->tb_size < ra->mac_pdu_length);
|
||||
|
||||
// increase mcs until we get a TBS that is big enough to fix the MAC PDU
|
||||
do {
|
||||
mcsIndex++;
|
||||
LOG_D(NR_MAC,"Msg4 Allocation: MCSloop Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
|
||||
harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
|
||||
nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
|
||||
rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
|
||||
} while (harq->tb_size < ra->mac_pdu_length && mcsIndex<10);
|
||||
AssertFatal(mcsIndex<10,"Cannot fit Msg4 in %d PRBs with QPSK\n",(int)BWPSize);
|
||||
int i = 0;
|
||||
while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) {
|
||||
if (vrb_map[rbStart + i]) {
|
||||
if (vrb_map[BWPStart + rbStart + i]) {
|
||||
rbStart += i+1;
|
||||
i = 0;
|
||||
} else {
|
||||
@@ -1574,7 +1589,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
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, genericParameters, type0_PDCCH_CSS_config);
|
||||
nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
|
||||
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
|
||||
}
|
||||
|
||||
@@ -1659,7 +1674,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
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,
|
||||
LOG_I(NR_MAC,
|
||||
"[RAPROC] DCI 1_0 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,
|
||||
@@ -1672,7 +1687,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_payload.pucch_resource_indicator,
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val);
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
LOG_I(NR_MAC,
|
||||
"[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d, BWPsize %d\n",
|
||||
pdcch_pdu_rel15->dci_pdu[0].RNTI,
|
||||
NR_RNTI_TC,
|
||||
@@ -1717,7 +1732,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
// Mark the corresponding RBs as used
|
||||
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) {
|
||||
vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1;
|
||||
vrb_map[BWPStart + rb + pdsch_pdu_rel15->rbStart] = 1;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize);
|
||||
@@ -1746,7 +1761,8 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
const int current_harq_pid = ra->harq_pid;
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid];
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
|
||||
LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
|
||||
@@ -1758,6 +1774,8 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
nr_clear_ra_proc(module_id, CC_id, frame, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
UE_info->Msg4_ACKed[UE_id] = true;
|
||||
if(sched_ctrl->retrans_dl_harq.head>=0)
|
||||
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti);
|
||||
|
||||
@@ -60,22 +60,21 @@ uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band)
|
||||
int ratio;
|
||||
switch (*scc->ssbSubcarrierSpacing) {
|
||||
case NR_SubcarrierSpacing_kHz15:
|
||||
AssertFatal(band <= 79,
|
||||
AssertFatal(band <= 95,
|
||||
"Band %ld is not possible for SSB with 15 kHz SCS\n",
|
||||
band);
|
||||
if (band < 77) // below 3GHz
|
||||
ratio = 3; // NRARFCN step is 5 kHz
|
||||
else
|
||||
ratio = 1; // NRARFCN step is 15 kHz
|
||||
// no band available above 3GHz using 15kHz
|
||||
ratio = 3; // NRARFCN step is 5 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz30:
|
||||
AssertFatal(band <= 79,
|
||||
"Band %ld is not possible for SSB with 15 kHz SCS\n",
|
||||
AssertFatal(band <= 96,
|
||||
"Band %ld is not possible for SSB with 30 kHz SCS\n",
|
||||
band);
|
||||
if (band < 77) // below 3GHz
|
||||
ratio = 6; // NRARFCN step is 5 kHz
|
||||
if (band == 46 || band == 48 || band == 77 ||
|
||||
band == 78 || band == 79 || band == 96) // above 3GHz
|
||||
ratio = 2; // NRARFCN step is 15 kHz
|
||||
else
|
||||
ratio = 2; // NRARFCN step is 15 kHz
|
||||
ratio = 6; // NRARFCN step is 5 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz120:
|
||||
AssertFatal(band >= 257,
|
||||
@@ -219,6 +218,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol,
|
||||
scs,
|
||||
FR1,
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
@@ -246,6 +246,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol,
|
||||
scs,
|
||||
FR1,
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
@@ -281,6 +282,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol,
|
||||
scs,
|
||||
FR2,
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
@@ -328,19 +330,16 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
|
||||
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||
int ret;
|
||||
|
||||
if (gNB_mac->sched_ctrlCommon == NULL){
|
||||
LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n");
|
||||
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
|
||||
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
|
||||
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
|
||||
for (int i=0; i<3; i++){ // loop over possible aggregation levels
|
||||
ret = fill_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space,type0_PDCCH_CSS_config,4<<i);
|
||||
if (ret == 1) break;
|
||||
}
|
||||
AssertFatal(ret==1,"No aggregation level for type0_PDCCH_CSS found\n");
|
||||
fill_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space,type0_PDCCH_CSS_config);
|
||||
fill_coresetZero(gNB_mac->sched_ctrlCommon->coreset,type0_PDCCH_CSS_config);
|
||||
gNB_mac->cset0_bwp_start = type0_PDCCH_CSS_config->cset_start_rb;
|
||||
gNB_mac->cset0_bwp_size = type0_PDCCH_CSS_config->num_rbs;
|
||||
}
|
||||
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation = time_domain_allocation;
|
||||
@@ -349,7 +348,11 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes;
|
||||
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space,4);
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space,4<<i);
|
||||
if (nr_of_candidates>0) break; // choosing the lower value of aggregation level available
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id],
|
||||
NULL,
|
||||
@@ -376,7 +379,6 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
// Calculate number of PRB_DMRS
|
||||
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6;
|
||||
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||
|
||||
LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos);
|
||||
int rbSize = 0;
|
||||
uint32_t TBS = 0;
|
||||
@@ -434,7 +436,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
dl_req->nPDUs += 1;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
nr_configure_pdcch(pdcch_pdu_rel15,
|
||||
nr_configure_pdcch(NULL,
|
||||
pdcch_pdu_rel15,
|
||||
gNB_mac->sched_ctrlCommon->search_space,
|
||||
gNB_mac->sched_ctrlCommon->coreset,
|
||||
scc,
|
||||
@@ -608,8 +611,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
|
||||
// TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
|
||||
int mappingtype = (startSymbolIndex <= 3)? typeA: typeB;
|
||||
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype);
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype, 1);
|
||||
|
||||
// Configure sched_ctrlCommon for SIB1
|
||||
uint32_t TBS = schedule_control_sib1(module_idP, CC_id,
|
||||
|
||||
@@ -29,11 +29,7 @@
|
||||
|
||||
*/
|
||||
|
||||
/*PHY*/
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
/*MAC*/
|
||||
#include "NR_MAC_COMMON/nr_mac.h"
|
||||
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
||||
@@ -78,14 +74,14 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *
|
||||
target_ss = 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, bwp ? bwp->bwp_Dedicated : NULL, search_space, target_ss);
|
||||
|
||||
NR_ControlResourceSet_t *coreset = get_coreset(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, search_space, target_ss);
|
||||
// get coreset symbol "map"
|
||||
const uint16_t symb_coreset = (1 << coreset->duration) - 1;
|
||||
|
||||
/* check that TDA index 0 fits into DL and does not overlap CORESET */
|
||||
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ?
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n");
|
||||
const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_DL = tdaList->list.array[0];
|
||||
AssertFatal(!tdaP_DL->k0 || *tdaP_DL->k0 == 0,
|
||||
@@ -386,6 +382,74 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
return offset;
|
||||
}
|
||||
|
||||
#define BLER_UPDATE_FRAME 10
|
||||
#define BLER_FILTER 0.9f
|
||||
int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id)
|
||||
{
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[mod_id];
|
||||
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
|
||||
NR_DL_bler_stats_t *bler_stats = &nrmac->UE_info.UE_sched_ctrl[UE_id].dl_bler_stats;
|
||||
/* first call: everything is zero. Initialize to sensible default */
|
||||
if (bler_stats->last_frame_slot == 0 && bler_stats->mcs == 0) {
|
||||
bler_stats->last_frame_slot = frame * n + slot;
|
||||
bler_stats->mcs = 9;
|
||||
bler_stats->bler = (nrmac->dl_bler_target_lower + nrmac->dl_bler_target_upper) / 2;
|
||||
bler_stats->rd2_bler = nrmac->dl_rd2_bler_threshold;
|
||||
}
|
||||
const int now = frame * n + slot;
|
||||
int diff = now - bler_stats->last_frame_slot;
|
||||
if (diff < 0) // wrap around
|
||||
diff += 1024 * n;
|
||||
|
||||
const uint8_t old_mcs = bler_stats->mcs;
|
||||
const NR_mac_stats_t *stats = &nrmac->UE_info.mac_stats[UE_id];
|
||||
// TODO put back this condition when relevant
|
||||
/*const int dret3x = stats->dlsch_rounds[3] - bler_stats->dlsch_rounds[3];
|
||||
if (dret3x > 0) {
|
||||
if there is a third retransmission, decrease MCS for stabilization and
|
||||
restart averaging window to stabilize transmission
|
||||
bler_stats->last_frame_slot = now;
|
||||
bler_stats->mcs = max(9, bler_stats->mcs - 1);
|
||||
memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds));
|
||||
LOG_D(MAC, "%4d.%2d: %d retx in 3rd round, setting MCS to %d and restarting window\n", frame, slot, dret3x, bler_stats->mcs);
|
||||
return bler_stats->mcs;
|
||||
}*/
|
||||
if (diff < BLER_UPDATE_FRAME * n)
|
||||
return old_mcs; // no update
|
||||
|
||||
// last update is longer than x frames ago
|
||||
const int dtx = (int)(stats->dlsch_rounds[0] - bler_stats->dlsch_rounds[0]);
|
||||
const int dretx = (int)(stats->dlsch_rounds[1] - bler_stats->dlsch_rounds[1]);
|
||||
const int dretx2 = (int)(stats->dlsch_rounds[2] - bler_stats->dlsch_rounds[2]);
|
||||
const float bler_window = dtx > 0 ? (float) dretx / dtx : bler_stats->bler;
|
||||
const float rd2_bler_wnd = dtx > 0 ? (float) dretx2 / dtx : bler_stats->rd2_bler;
|
||||
bler_stats->bler = BLER_FILTER * bler_stats->bler + (1 - BLER_FILTER) * bler_window;
|
||||
bler_stats->rd2_bler = BLER_FILTER / 4 * bler_stats->rd2_bler + (1 - BLER_FILTER / 4) * rd2_bler_wnd;
|
||||
|
||||
int new_mcs = old_mcs;
|
||||
// TODO put back this condition when relevant
|
||||
/* first ensure that number of 2nd retx is below threshold. If this is the
|
||||
* case, use 1st retx to adjust faster
|
||||
if (bler_stats->rd2_bler > nrmac->dl_rd2_bler_threshold && old_mcs > 6) {
|
||||
new_mcs -= 2;
|
||||
} else if (bler_stats->rd2_bler < nrmac->dl_rd2_bler_threshold) {*/
|
||||
if (bler_stats->bler < nrmac->dl_bler_target_lower && old_mcs < nrmac->dl_max_mcs && dtx > 9)
|
||||
new_mcs += 1;
|
||||
else if (bler_stats->bler > nrmac->dl_bler_target_upper && old_mcs > 6)
|
||||
new_mcs -= 1;
|
||||
// else we are within threshold boundaries
|
||||
|
||||
|
||||
bler_stats->last_frame_slot = now;
|
||||
bler_stats->mcs = new_mcs;
|
||||
memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds));
|
||||
LOG_D(MAC, "%4d.%2d MCS %d -> %d (dtx %d, dretx %d, BLER wnd %.3f avg %.6f, dretx2 %d, RD2 BLER wnd %.3f avg %.6f)\n",
|
||||
frame, slot, old_mcs, new_mcs, dtx, dretx, bler_window, bler_stats->bler, dretx2, rd2_bler_wnd, bler_stats->rd2_bler);
|
||||
return new_mcs;
|
||||
}
|
||||
|
||||
void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot) {
|
||||
@@ -450,7 +514,7 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
|
||||
if (sched_ctrl->num_total_bytes == 0
|
||||
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
|
||||
return;
|
||||
continue;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
@@ -485,16 +549,13 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
&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);
|
||||
int rbStart = 0; // start wrt BWPstart
|
||||
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
const long f = (sched_ctrl->active_bwp ||bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = (sched_ctrl->active_bwp ||bwpd) ? (f ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2)) : (ps->nrOfSymbols == 2 ? 1 : 2);
|
||||
int rbSize = 0;
|
||||
bool is_mixed_slot = is_xlsch_in_slot(RC.nrmac[module_id]->dlsch_slot_bitmap[slot / 64], slot) &&
|
||||
is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[slot / 64], slot);
|
||||
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : (0+(is_mixed_slot?1:0));
|
||||
int rbSize = 0;
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
/* Check that there are enough resources for retransmission */
|
||||
while (rbSize < retInfo->rbSize) {
|
||||
@@ -511,8 +572,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
}
|
||||
/* check whether we need to switch the TDA allocation since the last
|
||||
* (re-)transmission */
|
||||
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, ps);
|
||||
if (ps->time_domain_allocation != tda)
|
||||
nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, ps);
|
||||
} else {
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
@@ -520,13 +581,13 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
rbStart++;
|
||||
while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize])
|
||||
rbSize++;
|
||||
NR_pdsch_semi_static_t temp_ps;
|
||||
temp_ps.nrOfLayers = 1;
|
||||
nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, &temp_ps);
|
||||
NR_pdsch_semi_static_t temp_ps = *ps;
|
||||
nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd,tda, ps->nrOfLayers, sched_ctrl, &temp_ps);
|
||||
uint32_t new_tbs;
|
||||
uint16_t new_rbSize;
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
retInfo->R,
|
||||
temp_ps.nrOfLayers,
|
||||
temp_ps.nrOfSymbols,
|
||||
temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT,
|
||||
retInfo->tb_size,
|
||||
@@ -572,12 +633,12 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
return false;
|
||||
}
|
||||
|
||||
sched_ctrl->sched_pdsch.pucch_allocation = alloc;
|
||||
|
||||
/* just reuse from previous scheduling opportunity, set new start RB */
|
||||
sched_ctrl->sched_pdsch = *retInfo;
|
||||
sched_ctrl->sched_pdsch.rbStart = rbStart;
|
||||
|
||||
sched_ctrl->sched_pdsch.pucch_allocation = alloc;
|
||||
|
||||
/* retransmissions: directly allocate */
|
||||
*n_rb_sched -= sched_ctrl->sched_pdsch.rbSize;
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++)
|
||||
@@ -602,6 +663,7 @@ void pf_dl(module_id_t module_id,
|
||||
float coeff_ue[MAX_MOBILES_PER_GNB];
|
||||
// UEs that could be scheduled
|
||||
int ue_array[MAX_MOBILES_PER_GNB];
|
||||
int layers[MAX_MOBILES_PER_GNB];
|
||||
NR_list_t UE_sched = { .head = -1, .next = ue_array, .tail = -1, .len = MAX_MOBILES_PER_GNB };
|
||||
|
||||
/* Loop UE_info->list to check retransmission */
|
||||
@@ -614,6 +676,8 @@ void pf_dl(module_id_t module_id,
|
||||
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
|
||||
sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
|
||||
|
||||
layers[UE_id] = ps->nrOfLayers; // initialization of layers to the previous value in the strcuture
|
||||
|
||||
/* Calculate Throughput */
|
||||
const float a = 0.0005f; // corresponds to 200ms window
|
||||
const uint32_t b = UE_info->mac_stats[UE_id].dlsch_current_bytes;
|
||||
@@ -637,9 +701,19 @@ void pf_dl(module_id_t module_id,
|
||||
continue;
|
||||
|
||||
/* Calculate coeff */
|
||||
sched_pdsch->mcs = 9;
|
||||
ps->nrOfLayers = 1;
|
||||
uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs];
|
||||
set_dl_mcs(sched_pdsch,sched_ctrl,&mac->dl_max_mcs,ps->mcsTableIdx);
|
||||
sched_pdsch->mcs = get_mcs_from_bler(module_id, /* CC_id = */ 0, frame, slot, UE_id);
|
||||
layers[UE_id] = set_dl_nrOfLayers(sched_ctrl);
|
||||
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
uint32_t tbs = nr_compute_tbs(Qm,
|
||||
R,
|
||||
1, /* rbSize */
|
||||
10, /* hypothetical number of slots */
|
||||
0, /* N_PRB_DMRS * N_DMRS_SLOT */
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
layers[UE_id]) >> 3;
|
||||
coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id];
|
||||
LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
|
||||
b, UE_id, thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]);
|
||||
@@ -678,7 +752,7 @@ void pf_dl(module_id_t module_id,
|
||||
&scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = 0; // start wrt BWPstart
|
||||
|
||||
/* Find a free CCE */
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
@@ -718,16 +792,13 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
/* MCS has been set above */
|
||||
|
||||
bool is_mixed_slot = is_xlsch_in_slot(RC.nrmac[module_id]->dlsch_slot_bitmap[slot / 64], slot) &&
|
||||
is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[slot / 64], slot);
|
||||
|
||||
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : (0+(is_mixed_slot?1:0));
|
||||
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
const long f = (sched_ctrl->active_bwp || bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = (sched_ctrl->active_bwp || bwpd) ? (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->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps);
|
||||
if (ps->nrOfLayers != layers[UE_id] ||
|
||||
ps->time_domain_allocation != tda)
|
||||
nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, layers[UE_id], sched_ctrl, 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;
|
||||
@@ -736,6 +807,7 @@ void pf_dl(module_id_t module_id,
|
||||
const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024);
|
||||
nr_find_nb_rb(sched_pdsch->Qm,
|
||||
sched_pdsch->R,
|
||||
ps->nrOfLayers,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
|
||||
sched_ctrl->num_total_bytes + oh,
|
||||
@@ -770,6 +842,10 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
const uint16_t BWPStart = NRRIV2PRBOFFSET(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];
|
||||
@@ -777,7 +853,7 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
for (int i = 0; i < bwpSize; i++) {
|
||||
// calculate mask: init with "NOT" vrb_map:
|
||||
// if any RB in vrb_map is blocked (1), the current RBG will be 0
|
||||
rballoc_mask[i] = !vrb_map[i];
|
||||
rballoc_mask[i] = !vrb_map[i+BWPStart];
|
||||
n_rb_sched += rballoc_mask[i];
|
||||
}
|
||||
|
||||
@@ -899,8 +975,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(NR_MAC,
|
||||
"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) TPC %d\n",
|
||||
LOG_D(NR_MAC,"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
|
||||
frame,
|
||||
slot,
|
||||
UE_id,
|
||||
@@ -912,6 +987,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
ps->nrOfSymbols,
|
||||
ps->dl_dmrs_symb_pos,
|
||||
sched_pdsch->mcs,
|
||||
nrOfLayers,
|
||||
TBS,
|
||||
current_harq_pid,
|
||||
harq->round,
|
||||
@@ -920,6 +996,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pucch->timing_indicator,
|
||||
pucch->frame,
|
||||
pucch->ul_slot,
|
||||
sched_pdsch->pucch_allocation,
|
||||
sched_ctrl->tpc1);
|
||||
|
||||
NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp;
|
||||
@@ -943,7 +1020,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %d, bwp %d, cs %d\n",UE_id,bwpid,coresetid);
|
||||
NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space;
|
||||
NR_ControlResourceSet_t *coreset = (bwp||bwpd)? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset;
|
||||
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, genericParameters, NULL);
|
||||
nr_configure_pdcch(gNB_mac, pdcch_pdu, ss, coreset, scc, genericParameters, NULL);
|
||||
gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,8 @@
|
||||
*/
|
||||
|
||||
#include "nr_mac_gNB.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "NR_MAC_gNB/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
@@ -169,7 +166,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
scc->dmrs_TypeA_Position,
|
||||
NrOfSymbols,
|
||||
StartSymbolIndex,
|
||||
mappingtype);
|
||||
mappingtype, 1);
|
||||
|
||||
/*
|
||||
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
|
||||
@@ -264,7 +261,6 @@ extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData);
|
||||
uint32_t target_dl_mcs = 9;
|
||||
uint32_t target_dl_Nl = 1;
|
||||
uint32_t target_dl_bw = 50;
|
||||
int dl_maxL = 4;
|
||||
uint64_t dlsch_slot_bitmap = (1<<1);
|
||||
/* schedules whole bandwidth for first user, all the time */
|
||||
void nr_preprocessor_phytest(module_id_t module_id,
|
||||
@@ -284,6 +280,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
/* find largest unallocated chunk */
|
||||
const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const int BWPStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = 0;
|
||||
int rbSize = 0;
|
||||
if (target_dl_bw>bwpSize)
|
||||
@@ -292,11 +289,11 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
/* loop ensures that we allocate exactly target_dl_bw, or return */
|
||||
while (true) {
|
||||
/* advance to first free RB */
|
||||
while (rbStart < bwpSize && vrb_map[rbStart])
|
||||
while (rbStart < bwpSize && vrb_map[rbStart + BWPStart])
|
||||
rbStart++;
|
||||
rbSize = 1;
|
||||
/* iterate until we are at target_dl_bw or no available RBs */
|
||||
while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && rbSize < target_dl_bw)
|
||||
while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize + BWPStart] && rbSize < target_dl_bw)
|
||||
rbSize++;
|
||||
/* found target_dl_bw? */
|
||||
if (rbSize == target_dl_bw)
|
||||
@@ -323,13 +320,19 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
0,
|
||||
0);
|
||||
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
||||
sched_ctrl->lcid_to_schedule = lcid;
|
||||
|
||||
sched_ctrl->maxL = dl_maxL;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
sched_ctrl->maxL);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = UE_info->Y[UE_id][cid][slot];
|
||||
const int m = UE_info->num_pdcch_cand[UE_id][cid];
|
||||
@@ -371,13 +374,9 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
sched_pdsch->rbStart = rbStart;
|
||||
sched_pdsch->rbSize = rbSize;
|
||||
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;
|
||||
const long f = 1;
|
||||
ps->nrOfLayers = target_dl_Nl;
|
||||
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pdsch_semi_static(
|
||||
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps);
|
||||
|
||||
if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl)
|
||||
nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps);
|
||||
|
||||
sched_pdsch->mcs = target_dl_mcs;
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
@@ -397,14 +396,13 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
|
||||
/* mark the corresponding RBs as used */
|
||||
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
|
||||
vrb_map[rb + sched_pdsch->rbStart] = 1;
|
||||
vrb_map[rb + sched_pdsch->rbStart + BWPStart] = 1;
|
||||
|
||||
if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize);
|
||||
}
|
||||
|
||||
uint32_t target_ul_mcs = 9;
|
||||
uint32_t target_ul_bw = 50;
|
||||
int ul_maxL = 4;
|
||||
uint64_t ulsch_slot_bitmap = (1 << 8);
|
||||
bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
{
|
||||
@@ -460,8 +458,11 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
uint16_t rbSize;
|
||||
|
||||
const int bw = NRRIV2BW(sched_ctrl->active_ubwp ?
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const int BWPStart = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp ?
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
if (target_ul_bw>bw)
|
||||
rbSize = bw;
|
||||
@@ -472,7 +473,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
const uint16_t symb = ((1 << ps->nrOfSymbols) - 1) << ps->startSymbolIndex;
|
||||
for (int i = rbStart; i < rbStart + rbSize; ++i) {
|
||||
if ((vrb_map_UL[i] & symb) != 0) {
|
||||
if ((vrb_map_UL[i+BWPStart] & symb) != 0) {
|
||||
LOG_E(MAC,
|
||||
"%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n",
|
||||
__func__,
|
||||
@@ -487,11 +488,16 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
sched_ctrl->sched_pusch.frame = sched_frame;
|
||||
|
||||
uint8_t nr_of_candidates;
|
||||
sched_ctrl->maxL = ul_maxL;
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
sched_ctrl->maxL);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = UE_info->Y[UE_id][cid][slot];
|
||||
const int m = UE_info->num_pdcch_cand[UE_id][cid];
|
||||
@@ -536,6 +542,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
|
||||
/* mark the corresponding RBs as used */
|
||||
for (int rb = rbStart; rb < rbStart + rbSize; rb++)
|
||||
vrb_map_UL[rb] = 1;
|
||||
vrb_map_UL[rb+BWPStart] = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <softmodem-common.h>
|
||||
#include "assertions.h"
|
||||
|
||||
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
||||
@@ -112,6 +113,20 @@ uint8_t nr_ss_first_symb_idx_scs_120_120_mux3[4] = {4,8,2,6};
|
||||
uint8_t nr_max_number_of_candidates_per_slot[4] = {44, 36, 22, 20};
|
||||
uint8_t nr_max_number_of_cces_per_slot[4] = {56, 56, 48, 32};
|
||||
|
||||
// CQI TABLES
|
||||
// Table 1 (38.214 5.2.2.1-2)
|
||||
uint16_t cqi_table1[16][2] = {{0,0},{2,78},{2,120},{2,193},{2,308},{2,449},{2,602},{4,378},
|
||||
{4,490},{4,616},{6,466},{6,567},{6,666},{6,772},{6,873},{6,948}};
|
||||
|
||||
// Table 2 (38.214 5.2.2.1-3)
|
||||
uint16_t cqi_table2[16][2] = {{0,0},{2,78},{2,193},{2,449},{4,378},{4,490},{4,616},{6,466},
|
||||
{6,567},{6,666},{6,772},{6,873},{8,711},{8,797},{8,885},{8,948}};
|
||||
|
||||
// Table 2 (38.214 5.2.2.1-4)
|
||||
uint16_t cqi_table3[16][2] = {{0,0},{2,30},{2,50},{2,78},{2,120},{2,193},{2,308},{2,449},
|
||||
{2,602},{4,378},{4,490},{4,616},{6,466},{6,567},{6,666},{6,772}};
|
||||
|
||||
|
||||
static inline uint8_t get_max_candidates(uint8_t scs) {
|
||||
AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs);
|
||||
return (nr_max_number_of_candidates_per_slot[scs]);
|
||||
@@ -122,6 +137,59 @@ static inline uint8_t get_max_cces(uint8_t scs) {
|
||||
return (nr_max_number_of_cces_per_slot[scs]);
|
||||
}
|
||||
|
||||
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
// TODO check this but it should be enough for now
|
||||
// if there is not csi report RI is 0 from initialization
|
||||
return (sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri + 1);
|
||||
|
||||
}
|
||||
|
||||
void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
uint8_t *target_mcs,
|
||||
uint8_t mcs_table_idx) {
|
||||
|
||||
if (sched_ctrl->set_mcs) {
|
||||
// TODO for wideband case and multiple TB
|
||||
int cqi_idx = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb;
|
||||
uint16_t target_coderate,target_qm;
|
||||
if (cqi_idx>0) {
|
||||
int cqi_table = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table;
|
||||
AssertFatal(cqi_table == mcs_table_idx, "Indices of MCS tables don't correspond\n");
|
||||
switch (cqi_table) {
|
||||
case 0:
|
||||
target_qm = cqi_table1[cqi_idx][0];
|
||||
target_coderate = cqi_table1[cqi_idx][1];
|
||||
break;
|
||||
case 1:
|
||||
target_qm = cqi_table2[cqi_idx][0];
|
||||
target_coderate = cqi_table2[cqi_idx][1];
|
||||
break;
|
||||
case 2:
|
||||
target_qm = cqi_table3[cqi_idx][0];
|
||||
target_coderate = cqi_table3[cqi_idx][1];
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Invalid cqi table index %d\n",cqi_table);
|
||||
}
|
||||
int max_mcs = 28;
|
||||
int R,Qm;
|
||||
if (mcs_table_idx == 1)
|
||||
max_mcs = 27;
|
||||
for (int i=0; i<=max_mcs; i++) {
|
||||
R = nr_get_code_rate_dl(i, mcs_table_idx);
|
||||
Qm = nr_get_Qm_dl(i, mcs_table_idx);
|
||||
if ((Qm == target_qm) && (target_coderate <= R)) {
|
||||
*target_mcs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
sched_ctrl->set_mcs = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
|
||||
|
||||
//TODO first basic implementation of dmrs port selection
|
||||
@@ -129,40 +197,52 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
|
||||
// for now it assumes a selection of Nl consecutive dmrs ports
|
||||
// and a single front loaded symbol
|
||||
// dmrs_ports_id is the index of Tables 7.3.1.2.2-1/2/3/4
|
||||
// number of front loaded symbols need to be consistent with maxLength
|
||||
// when a more complete implementation is done
|
||||
|
||||
switch (ps->nrOfLayers) {
|
||||
case 1:
|
||||
ps->dmrs_ports_id = 0;
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 2:
|
||||
ps->dmrs_ports_id = 2;
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 3:
|
||||
ps->dmrs_ports_id = 9;
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 4:
|
||||
ps->dmrs_ports_id = 10;
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of layers %d\n not supported or not valid\n",ps->nrOfLayers);
|
||||
}
|
||||
}
|
||||
|
||||
NR_ControlResourceSet_t *get_coreset(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_ControlResourceSet_t *get_coreset(module_id_t module_idP,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
void *bwp,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type) {
|
||||
NR_ControlResourceSetId_t coreset_id = *ss->controlResourceSetId;
|
||||
if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) { // common search space
|
||||
NR_ControlResourceSet_t *coreset;
|
||||
if (bwp) coreset = ((NR_BWP_Downlink_t*)bwp)->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
else if (scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)
|
||||
if(coreset_id == 0) {
|
||||
coreset = RC.nrmac[module_idP]->sched_ctrlCommon->coreset; // this is coreset 0
|
||||
} else if (bwp) {
|
||||
coreset = ((NR_BWP_Downlink_t*)bwp)->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
} else if (scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet) {
|
||||
coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
else coreset = NULL;
|
||||
} else {
|
||||
coreset = NULL;
|
||||
}
|
||||
|
||||
if (coreset) AssertFatal(coreset_id == coreset->controlResourceSetId,
|
||||
"ID of common ss coreset does not correspond to id set in the "
|
||||
@@ -250,6 +330,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
|
||||
bool nr_find_nb_rb(uint16_t Qm,
|
||||
uint16_t R,
|
||||
uint8_t nrOfLayers,
|
||||
uint16_t nb_symb_sch,
|
||||
uint16_t nb_dmrs_prb,
|
||||
uint32_t bytes,
|
||||
@@ -259,7 +340,7 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
{
|
||||
/* is the maximum (not even) enough? */
|
||||
*nb_rb = nb_rb_max;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3;
|
||||
/* check whether it does not fit, or whether it exactly fits. Some algorithms
|
||||
* might depend on the return value! */
|
||||
if (bytes > *tbs)
|
||||
@@ -269,7 +350,7 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
|
||||
/* is the minimum enough? */
|
||||
*nb_rb = 5;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3;
|
||||
if (bytes <= *tbs)
|
||||
return true;
|
||||
|
||||
@@ -278,7 +359,7 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
int hi = nb_rb_max;
|
||||
int lo = 1;
|
||||
for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) {
|
||||
const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
|
||||
const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3;
|
||||
if (bytes == TBS) {
|
||||
hi = p;
|
||||
break;
|
||||
@@ -289,7 +370,7 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
}
|
||||
}
|
||||
*nb_rb = hi;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
|
||||
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3;
|
||||
/* return whether we could allocate all bytes and stay below nb_rb_max */
|
||||
return *tbs >= bytes && *nb_rb <= nb_rb_max;
|
||||
}
|
||||
@@ -299,18 +380,12 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_BWP_Downlink_t *bwp,
|
||||
const NR_BWP_DownlinkDedicated_t *bwpd0,
|
||||
int tda,
|
||||
const long dci_format,
|
||||
uint8_t layers,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
NR_pdsch_semi_static_t *ps)
|
||||
{
|
||||
ps->time_domain_allocation = tda;
|
||||
bool reset_dmrs = false;
|
||||
|
||||
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ?
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
|
||||
const int mapping_type = tdaList->list.array[tda]->mappingType;
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols);
|
||||
NR_BWP_DownlinkDedicated_t *bwpd;
|
||||
|
||||
if (bwp && bwp->bwp_Dedicated) {
|
||||
@@ -319,8 +394,8 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
bwpd = (NR_BWP_DownlinkDedicated_t*)bwpd0;
|
||||
}
|
||||
|
||||
ps->mcsTableIdx = 0;
|
||||
if (bwpd->pdsch_Config &&
|
||||
if (bwpd &&
|
||||
bwpd->pdsch_Config &&
|
||||
bwpd->pdsch_Config->choice.setup &&
|
||||
bwpd->pdsch_Config->choice.setup->mcs_Table) {
|
||||
if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0)
|
||||
@@ -330,15 +405,60 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
}
|
||||
else ps->mcsTableIdx = 0;
|
||||
|
||||
if(dci_format == 0) // format 1_0
|
||||
ps->numDmrsCdmGrpsNoData = (ps->nrOfSymbols == 2 ? 1 : 2);
|
||||
else
|
||||
set_dl_dmrs_ports(ps);
|
||||
ps->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0;
|
||||
NR_PDSCH_Config_t *pdsch_Config=NULL;
|
||||
if (bwpd) pdsch_Config = bwpd->pdsch_Config->choice.setup;
|
||||
LOG_D(NR_MAC,"tda %d, ps->time_domain_allocation %d,layers %d, ps->nrOfLayers %d, pdsch_config %p\n",tda,ps->time_domain_allocation,layers,ps->nrOfLayers,pdsch_Config);
|
||||
if (ps->time_domain_allocation != tda) {
|
||||
reset_dmrs = true;
|
||||
ps->time_domain_allocation = tda;
|
||||
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ?
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
|
||||
ps->mapping_type = tdaList->list.array[tda]->mappingType;
|
||||
if (pdsch_Config) {
|
||||
if (ps->mapping_type == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeB)
|
||||
ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||
else
|
||||
ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||
}
|
||||
else
|
||||
ps->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols);
|
||||
}
|
||||
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
int dci_format;
|
||||
if (sched_ctrl->search_space) {
|
||||
dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0;
|
||||
}
|
||||
else {
|
||||
dci_format = NR_DL_DCI_FORMAT_1_0;
|
||||
}
|
||||
if (dci_format == NR_DL_DCI_FORMAT_1_0) {
|
||||
if (ps->nrOfSymbols == 2)
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
else
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->dmrs_ports_id = 0;
|
||||
ps->frontloaded_symb = 1;
|
||||
ps->nrOfLayers = 1;
|
||||
}
|
||||
else {
|
||||
LOG_D(NR_MAC,"checking layers\n");
|
||||
if (ps->nrOfLayers != layers) {
|
||||
reset_dmrs = true;
|
||||
ps->nrOfLayers = layers;
|
||||
set_dl_dmrs_ports(ps);
|
||||
}
|
||||
}
|
||||
|
||||
ps->N_PRB_DMRS = ps->numDmrsCdmGrpsNoData * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
|
||||
ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type);
|
||||
ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos);
|
||||
if (reset_dmrs) {
|
||||
ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, ps->mapping_type, ps->frontloaded_symb);
|
||||
ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos);
|
||||
}
|
||||
LOG_D(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT);
|
||||
}
|
||||
|
||||
@@ -716,7 +836,8 @@ int nr_get_default_pucch_res(int pucch_ResourceCommon) {
|
||||
return(default_pucch_csset[pucch_ResourceCommon]);
|
||||
}
|
||||
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
void nr_configure_pdcch(gNB_MAC_INST *gNB_mac,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
@@ -724,9 +845,19 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) {
|
||||
|
||||
int sps;
|
||||
if (bwp && *ss->controlResourceSetId!=0) { // This is not for coreset0
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId,
|
||||
"coreset id in SS %ld does not correspond to the one in coreset %ld",
|
||||
*ss->controlResourceSetId, coreset->controlResourceSetId);
|
||||
|
||||
if (bwp) { // This is not for SIB1
|
||||
if(coreset->controlResourceSetId == 0){
|
||||
pdcch_pdu->BWPSize = gNB_mac->cset0_bwp_size;
|
||||
pdcch_pdu->BWPStart = gNB_mac->cset0_bwp_start;
|
||||
}
|
||||
else {
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
pdcch_pdu->SubcarrierSpacing = bwp->subcarrierSpacing;
|
||||
pdcch_pdu->CyclicPrefix = (bwp->cyclicPrefix==NULL) ? 0 : *bwp->cyclicPrefix;
|
||||
|
||||
@@ -1197,7 +1328,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
// indicating a DL DCI format 1bit
|
||||
pos++;
|
||||
*dci_pdu |= ((uint64_t)1) << (dci_size - pos);
|
||||
LOG_I(NR_MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"DCI1_0 (size %d): Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",
|
||||
dci_size,
|
||||
dci_pdu_rel15->format_indicator,
|
||||
@@ -1327,28 +1458,28 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
pos = 1;
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1));
|
||||
LOG_D(PHY, "fsize = %i\n", fsize);
|
||||
LOG_D(NR_MAC, "fsize = %i\n", fsize);
|
||||
for (int i = 0; i < fsize; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val >> (fsize - i - 1)) & 1) << (dci_size - pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||
// Time domain assignment 4 bit
|
||||
for (int i = 0; i < 4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val >> (3 - i)) & 1) << (dci_size - pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||
// VRB to PRB mapping 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val & 1) << (dci_size - pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
for (int i = 0; i < 5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs >> (4 - i)) & 1) << (dci_size - pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||
// Redundancy version 2bit
|
||||
for (int i = 0; i < 2; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->rv >> (1 - i)) & 1) << (dci_size - pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||
// System information indicator 1bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->system_info_indicator&1)<<(dci_size-pos++);
|
||||
LOG_D(PHY, "dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||
LOG_D(NR_MAC, "dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator);
|
||||
break;
|
||||
|
||||
case NR_RNTI_TC:
|
||||
@@ -1928,16 +2059,24 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
add_nr_list(&UE_info->list, UE_id);
|
||||
memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t));
|
||||
set_Y(UE_info->Y[UE_id], rntiP);
|
||||
if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated)
|
||||
if (CellGroup &&
|
||||
CellGroup->spCellConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup
|
||||
)
|
||||
compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
memset(sched_ctrl, 0, sizeof(*sched_ctrl));
|
||||
sched_ctrl->set_mcs = TRUE;
|
||||
sched_ctrl->lcid_mask = 0;
|
||||
if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) {
|
||||
sched_ctrl->lcid_mask = 1<<DL_SCH_LCID_DTCH;
|
||||
}
|
||||
sched_ctrl->ta_frame = 0;
|
||||
sched_ctrl->ta_update = 31;
|
||||
sched_ctrl->ta_apply = false;
|
||||
sched_ctrl->ul_rssi = 0;
|
||||
sched_ctrl->maxL = 4;
|
||||
sched_ctrl->pucch_consecutive_dtx_cnt = 0;
|
||||
sched_ctrl->pusch_consecutive_dtx_cnt = 0;
|
||||
sched_ctrl->ul_failure = 0;
|
||||
@@ -1957,12 +2096,9 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
sched_ctrl->search_space = get_searchspace(scc,
|
||||
sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL,
|
||||
target_ss);
|
||||
if (*sched_ctrl->search_space->controlResourceSetId == 0)
|
||||
sched_ctrl->coreset = RC.nrmac[mod_idP]->sched_ctrlCommon->coreset; // this is coreset 0
|
||||
else
|
||||
sched_ctrl->coreset = get_coreset(scc,
|
||||
sched_ctrl->coreset = get_coreset(mod_idP, scc,
|
||||
sched_ctrl->active_bwp ? (void*)sched_ctrl->active_bwp->bwp_Dedicated : NULL,
|
||||
sched_ctrl->search_space, target_ss);
|
||||
sched_ctrl->search_space, target_ss);
|
||||
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL;
|
||||
if (ubwpList) AssertFatal(ubwpList->list.count == 1,
|
||||
"uplinkBWP_ToAddModList has %d BWP!\n",
|
||||
@@ -2079,8 +2215,8 @@ uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
||||
// al values passed to this function are x10
|
||||
int snrx10 = (cqi*5) - 640;
|
||||
if (snrx10 > target + incr) return 0; // decrease 1dB
|
||||
if (snrx10 < target - incr) return 2; // increase 1dB
|
||||
if (snrx10 < target - (3*incr)) return 3; // increase 3dB
|
||||
if (snrx10 < target - incr) return 2; // increase 1dB
|
||||
LOG_D(NR_MAC,"tpc : target %d, snrx10 %d\n",target,snrx10);
|
||||
return 1; // no change
|
||||
}
|
||||
@@ -2203,8 +2339,10 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
int period, offset;
|
||||
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
||||
NR_BWP_Downlink_t *bwp=CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1];
|
||||
|
||||
NR_BWP_Downlink_t *bwp=sched_ctrl->active_bwp;
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_bwp ?
|
||||
&sched_ctrl->active_bwp->bwp_Common->genericParameters:
|
||||
&gNB_mac->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
|
||||
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
|
||||
NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
|
||||
@@ -2212,7 +2350,7 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
|
||||
if((frame*n_slots_frame+slot-offset)%period == 0) {
|
||||
|
||||
LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
|
||||
LOG_D(NR_MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
|
||||
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
@@ -2221,11 +2359,11 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
|
||||
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csirs_pdu_rel15 = &dl_tti_csirs_pdu->csi_rs_pdu.csi_rs_pdu_rel15;
|
||||
|
||||
csirs_pdu_rel15->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
csirs_pdu_rel15->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
csirs_pdu_rel15->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (bwp->bwp_Common->genericParameters.cyclicPrefix)
|
||||
csirs_pdu_rel15->cyclic_prefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
csirs_pdu_rel15->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth,275);
|
||||
csirs_pdu_rel15->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,275);
|
||||
csirs_pdu_rel15->subcarrier_spacing = genericParameters->subcarrierSpacing;
|
||||
if (genericParameters->cyclicPrefix)
|
||||
csirs_pdu_rel15->cyclic_prefix = *genericParameters->cyclicPrefix;
|
||||
else
|
||||
csirs_pdu_rel15->cyclic_prefix = 0;
|
||||
|
||||
@@ -2251,20 +2389,20 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
csirs_pdu_rel15->row = 1;
|
||||
csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
|
||||
csirs_pdu_rel15->row = 2;
|
||||
csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) |
|
||||
((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xff0));
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4:
|
||||
csirs_pdu_rel15->row = 4;
|
||||
csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x07;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other:
|
||||
csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x3f;
|
||||
@@ -2275,18 +2413,18 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
case NR_CSI_RS_ResourceMapping__nrofPorts_p2:
|
||||
csirs_pdu_rel15->row = 3;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__nrofPorts_p4:
|
||||
csirs_pdu_rel15->row = 5;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__nrofPorts_p8:
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) {
|
||||
csirs_pdu_rel15->row = 8;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
}
|
||||
else{
|
||||
int num_k = 0;
|
||||
@@ -2295,12 +2433,12 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
if(num_k==4) {
|
||||
csirs_pdu_rel15->row = 6;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
}
|
||||
else {
|
||||
csirs_pdu_rel15->row = 7;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2308,12 +2446,12 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) {
|
||||
csirs_pdu_rel15->row = 10;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
}
|
||||
else {
|
||||
csirs_pdu_rel15->row = 9;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0);
|
||||
}
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__nrofPorts_p16:
|
||||
@@ -2322,24 +2460,24 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
else
|
||||
csirs_pdu_rel15->row = 11;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0));
|
||||
break;
|
||||
case NR_CSI_RS_ResourceMapping__nrofPorts_p24:
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) {
|
||||
csirs_pdu_rel15->row = 14;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
}
|
||||
else{
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) {
|
||||
csirs_pdu_rel15->row = 15;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (7 << csirs_pdu_rel15->symb_l0);
|
||||
}
|
||||
else {
|
||||
csirs_pdu_rel15->row = 13;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2347,18 +2485,18 @@ void nr_csirs_scheduling(int Mod_idP,
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) {
|
||||
csirs_pdu_rel15->row = 17;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
}
|
||||
else{
|
||||
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) {
|
||||
csirs_pdu_rel15->row = 18;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0);
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (7 << csirs_pdu_rel15->symb_l0);
|
||||
}
|
||||
else {
|
||||
csirs_pdu_rel15->row = 16;
|
||||
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
|
||||
vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2381,10 +2519,15 @@ bool find_free_CCE(module_id_t module_id,
|
||||
int UE_id){
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id];
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
sched_ctrl->maxL);
|
||||
for (int i=0; i<5; i++) {
|
||||
// for now taking the lowest value among the available aggregation levels
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,
|
||||
1<<i);
|
||||
if(nr_of_candidates>0) break;
|
||||
}
|
||||
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
|
||||
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t Y = RC.nrmac[module_id]->UE_info.Y[UE_id][cid][slot];
|
||||
const int m = RC.nrmac[module_id]->UE_info.num_pdcch_cand[UE_id][cid];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,34 +34,7 @@
|
||||
#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] = {
|
||||
0, 10, 14, 20, 28, 38, 53, 74,
|
||||
102, 142, 198, 276, 384, 535, 745, 1038,
|
||||
1446, 2014, 2806, 3909, 5446, 7587, 10570, 14726,
|
||||
20516, 28581, 39818, 55474, 77284, 107669, 150000, 300000
|
||||
};
|
||||
|
||||
//38.321 Table 6.1.3.1-2
|
||||
const uint32_t NR_LONG_BSR_TABLE[256] ={
|
||||
0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26,
|
||||
28, 30, 32, 34, 36, 38, 40, 43, 46, 49, 52, 55, 59, 62, 66, 71,
|
||||
75, 80, 85, 91, 97, 103, 110, 117, 124, 132, 141, 150, 160, 170, 181, 193,
|
||||
205, 218, 233, 248, 264, 281, 299, 318, 339, 361, 384, 409, 436, 464, 494, 526,
|
||||
560, 597, 635, 677, 720, 767, 817, 870, 926, 987, 1051, 1119, 1191, 1269, 1351, 1439,
|
||||
1532, 1631, 1737, 1850, 1970, 2098, 2234, 2379, 2533, 2698, 2873, 3059, 3258, 3469, 3694, 3934,
|
||||
4189, 4461, 4751, 5059, 5387, 5737, 6109, 6506, 6928, 7378, 7857, 8367, 8910, 9488, 10104, 10760,
|
||||
11458, 12202, 12994, 13838, 14736, 15692, 16711, 17795, 18951, 20181, 21491, 22885, 24371, 25953, 27638, 29431,
|
||||
31342, 33376, 35543, 37850, 40307, 42923, 45709, 48676, 51836, 55200, 58784, 62599, 66663, 70990, 75598, 80505,
|
||||
85730, 91295, 97221, 103532, 110252, 117409, 125030, 133146, 141789, 150992, 160793, 171231, 182345, 194182, 206786, 220209,
|
||||
234503, 249725, 265935, 283197, 301579, 321155, 342002, 364202, 387842, 413018, 439827, 468377, 498780, 531156, 565634, 602350,
|
||||
641449, 683087, 727427, 774645, 824928, 878475, 935498, 996222, 1060888, 1129752, 1203085, 1281179, 1364342, 1452903, 1547213, 1647644,
|
||||
1754595, 1868488, 1989774, 2118933, 2256475, 2402946, 2558924, 2725027, 2901912, 3090279, 3290873, 3504487, 3731968, 3974215, 4232186, 4506902,
|
||||
4799451, 5110989, 5442750, 5796046, 6172275, 6572925, 6999582, 7453933, 7937777, 8453028, 9001725, 9586039, 10208280, 10870913, 11576557, 12328006,
|
||||
13128233, 13980403, 14887889, 15854280, 16883401, 17979324, 19146385, 20389201, 21712690, 23122088, 24622972, 26221280, 27923336, 29735875, 31666069, 33721553,
|
||||
35910462, 38241455, 40723756, 43367187, 46182206, 49179951, 52372284, 55771835, 59392055, 63247269, 67352729, 71724679, 76380419, 81338368, 162676736, 4294967295
|
||||
};
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
|
||||
int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
@@ -842,6 +815,14 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if( (frameP!=ra->Msg3_frame) || (slotP!=ra->Msg3_slot))
|
||||
continue;
|
||||
|
||||
// for CFRA (NSA) do not schedule retransmission of msg3
|
||||
if (ra->cfra) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\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);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ra->msg3_round >= MAX_HARQ_ROUNDS - 1) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state);
|
||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||
@@ -888,7 +869,7 @@ bool nr_UE_is_to_be_scheduled(module_id_t mod_id, int CC_id, int UE_id, frame_t
|
||||
* (2) there is a scheduling request
|
||||
* (3) or we did not schedule it in more than 10 frames */
|
||||
const bool has_data = sched_ctrl->estimated_ul_buffer > sched_ctrl->sched_ul_bytes;
|
||||
const bool high_inactivity = diff >= nrmac->ulsch_max_slots_inactivity;
|
||||
const bool high_inactivity = diff >= nrmac->ulsch_max_frame_inactivity * n;
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d UL inactivity %d slots has_data %d SR %d\n",
|
||||
frame,
|
||||
@@ -922,7 +903,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL;
|
||||
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;
|
||||
int rbStart = 0; // wrt BWP start
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = (sched_ctrl->active_bwp || ubwpd) ? 1 : 2;
|
||||
@@ -963,6 +944,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
uint16_t new_rbSize;
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
retInfo->R,
|
||||
1, // layers
|
||||
temp_ps.nrOfSymbols,
|
||||
temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb,
|
||||
retInfo->tb_size,
|
||||
@@ -980,6 +962,9 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
retInfo->rbSize = new_rbSize;
|
||||
retInfo->time_domain_allocation = tda;
|
||||
sched_ctrl->pusch_semi_static = temp_ps;
|
||||
|
||||
// Get previous PUSCH filed info
|
||||
sched_ctrl->sched_pusch = *retInfo;
|
||||
}
|
||||
|
||||
/* Find free CCE */
|
||||
@@ -1058,10 +1043,10 @@ void pf_ul(module_id_t module_id,
|
||||
LOG_D(NR_MAC,"pf_ul: preparing UL scheduling for UE %d\n",UE_id);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
int rbStart = 0; // wrt BWP start
|
||||
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
|
||||
NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL;
|
||||
|
||||
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;
|
||||
@@ -1237,8 +1222,10 @@ void pf_ul(module_id_t module_id,
|
||||
const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0);
|
||||
uint16_t rbSize = 0;
|
||||
uint32_t TBS = 0;
|
||||
|
||||
nr_find_nb_rb(sched_pusch->Qm,
|
||||
sched_pusch->R,
|
||||
1, // layers
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->num_dmrs_symb,
|
||||
B,
|
||||
@@ -1247,8 +1234,8 @@ void pf_ul(module_id_t module_id,
|
||||
&rbSize);
|
||||
sched_pusch->rbSize = rbSize;
|
||||
sched_pusch->tb_size = TBS;
|
||||
LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
|
||||
rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS);
|
||||
LOG_D(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
|
||||
rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS);
|
||||
|
||||
/* Mark the corresponding RBs as used */
|
||||
n_rb_sched -= sched_pusch->rbSize;
|
||||
@@ -1312,6 +1299,10 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
const uint16_t bwpStart = NRRIV2PRBOFFSET(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;
|
||||
@@ -1321,11 +1312,14 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex;
|
||||
|
||||
int st = 0, e = 0, len = 0;
|
||||
for (int i = 0; i < bwpSize; i++)
|
||||
if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=symb;
|
||||
|
||||
for (int i = 0; i < bwpSize; i++) {
|
||||
while ((vrb_map_UL[i] & symb) != 0 && i < bwpSize)
|
||||
while ((vrb_map_UL[bwpStart + i] & symb) != 0 && i < bwpSize)
|
||||
i++;
|
||||
st = i;
|
||||
while ((vrb_map_UL[i] & symb) == 0 && i < bwpSize)
|
||||
while ((vrb_map_UL[bwpStart + i] & symb) == 0 && i < bwpSize)
|
||||
i++;
|
||||
if (i - st > len) {
|
||||
len = i - st;
|
||||
@@ -1334,12 +1328,14 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
}
|
||||
st = e - len + 1;
|
||||
|
||||
LOG_D(NR_MAC,"UL %d.%d : start_prb %d, end PRB %d\n",frame,slot,st,e);
|
||||
|
||||
uint8_t rballoc_mask[bwpSize];
|
||||
|
||||
/* Calculate mask: if any RB in vrb_map_UL is blocked (1), the current RB will be 0 */
|
||||
for (int i = 0; i < bwpSize; i++)
|
||||
rballoc_mask[i] = i >= st && i <= e;
|
||||
|
||||
LOG_D(NR_MAC,"%d.%d : UL start %d, end %d\n",frame,slot,st,e);
|
||||
/* proportional fair scheduling algorithm */
|
||||
pf_ul(module_id,
|
||||
frame,
|
||||
@@ -1481,30 +1477,30 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size;
|
||||
sched_ctrl->last_ul_frame = sched_pusch->frame;
|
||||
sched_ctrl->last_ul_slot = sched_pusch->slot;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n",
|
||||
frame,
|
||||
slot,
|
||||
rnti,
|
||||
sched_pusch->frame,
|
||||
sched_pusch->slot,
|
||||
sched_ctrl->aggregation_level,
|
||||
sched_pusch->rbStart,
|
||||
sched_pusch->rbSize,
|
||||
ps->startSymbolIndex,
|
||||
ps->nrOfSymbols,
|
||||
ps->ul_dmrs_symb_pos,
|
||||
sched_pusch->mcs,
|
||||
sched_pusch->tb_size,
|
||||
harq_id,
|
||||
cur_harq->round,
|
||||
nr_rv_round_map[cur_harq->round],
|
||||
cur_harq->ndi,
|
||||
sched_ctrl->estimated_ul_buffer,
|
||||
sched_ctrl->sched_ul_bytes,
|
||||
sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes,
|
||||
sched_ctrl->tpc0);
|
||||
if (sched_pusch->rbSize > 5)
|
||||
LOG_D(NR_MAC,
|
||||
"ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n",
|
||||
frame,
|
||||
slot,
|
||||
rnti,
|
||||
sched_pusch->frame,
|
||||
sched_pusch->slot,
|
||||
sched_ctrl->aggregation_level,
|
||||
sched_pusch->rbStart,
|
||||
sched_pusch->rbSize,
|
||||
ps->startSymbolIndex,
|
||||
ps->nrOfSymbols,
|
||||
ps->ul_dmrs_symb_pos,
|
||||
sched_pusch->mcs,
|
||||
sched_pusch->tb_size,
|
||||
harq_id,
|
||||
cur_harq->round,
|
||||
nr_rv_round_map[cur_harq->round],
|
||||
cur_harq->ndi,
|
||||
sched_ctrl->estimated_ul_buffer,
|
||||
sched_ctrl->sched_ul_bytes,
|
||||
sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes,
|
||||
sched_ctrl->tpc0);
|
||||
|
||||
|
||||
/* PUSCH in a later slot, but corresponding DCI now! */
|
||||
@@ -1646,7 +1642,7 @@ 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, ss, coreset, scc, genericParameters, NULL);
|
||||
nr_configure_pdcch(nr_mac, pdcch_pdu, ss, coreset, scc, genericParameters, NULL);
|
||||
pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#ifndef __LAYER2_NR_MAC_PROTO_H__
|
||||
#define __LAYER2_NR_MAC_PROTO_H__
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "NR_TAG-Id.h"
|
||||
|
||||
@@ -244,13 +242,14 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
uint16_t O_csi,
|
||||
uint16_t O_ack,
|
||||
uint8_t O_sr,
|
||||
int r_pucch);
|
||||
int r_pucch);
|
||||
|
||||
void find_search_space(int ss_type,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
NR_SearchSpace_t *ss);
|
||||
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
void nr_configure_pdcch(gNB_MAC_INST *gNB_mac,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
@@ -272,7 +271,8 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup,
|
||||
int bwp_id);
|
||||
|
||||
/* find coreset within the search space */
|
||||
NR_ControlResourceSet_t *get_coreset(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_ControlResourceSet_t *get_coreset(module_id_t module_idP,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
void *bwp,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type);
|
||||
@@ -289,7 +289,8 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_BWP_Downlink_t *bwp,
|
||||
const NR_BWP_DownlinkDedicated_t *bwpd0,
|
||||
int tda,
|
||||
const long dci_format,
|
||||
uint8_t layers,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
NR_pdsch_semi_static_t *ps);
|
||||
|
||||
void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
@@ -426,6 +427,13 @@ void find_SSB_and_RO_available(module_id_t module_idP);
|
||||
|
||||
void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps);
|
||||
|
||||
void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
uint8_t *target_mcs,
|
||||
uint8_t mcs_table_idx);
|
||||
|
||||
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp);
|
||||
void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp);
|
||||
|
||||
@@ -433,6 +441,7 @@ bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id);
|
||||
|
||||
bool nr_find_nb_rb(uint16_t Qm,
|
||||
uint16_t R,
|
||||
uint8_t nrOfLayers,
|
||||
uint16_t nb_symb_sch,
|
||||
uint16_t nb_dmrs_prb,
|
||||
uint32_t bytes,
|
||||
@@ -442,5 +451,5 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
|
||||
void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP);
|
||||
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen);
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp);
|
||||
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
|
||||
|
||||
@@ -47,7 +47,7 @@ extern RAN_CONTEXT_t RC;
|
||||
|
||||
#define MACSTATSSTRLEN 16384
|
||||
|
||||
void nrmac_stats_thread(void *arg) {
|
||||
void *nrmac_stats_thread(void *arg) {
|
||||
|
||||
gNB_MAC_INST *gNB = (gNB_MAC_INST *)arg;
|
||||
|
||||
@@ -57,20 +57,21 @@ void nrmac_stats_thread(void *arg) {
|
||||
AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
|
||||
|
||||
while (oai_exit == 0) {
|
||||
dump_mac_stats(gNB,output,MACSTATSSTRLEN);
|
||||
dump_mac_stats(gNB,output,MACSTATSSTRLEN,false);
|
||||
fprintf(fd,"%s\n",output);
|
||||
fflush(fd);
|
||||
usleep(200000);
|
||||
fseek(fd,0,SEEK_SET);
|
||||
}
|
||||
fclose(fd);
|
||||
return (void *)0;
|
||||
}
|
||||
|
||||
void clear_mac_stats(gNB_MAC_INST *gNB) {
|
||||
memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t));
|
||||
}
|
||||
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen)
|
||||
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp)
|
||||
{
|
||||
NR_UE_info_t *UE_info = &gNB->UE_info;
|
||||
int num = 1;
|
||||
@@ -80,47 +81,60 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen)
|
||||
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
|
||||
|
||||
stroff+=sprintf(output+stroff,"UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n",
|
||||
const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
|
||||
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
|
||||
stroff+=sprintf(output+stroff,"UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
|
||||
UE_id,
|
||||
UE_info->rnti[UE_id],
|
||||
num++,
|
||||
UE_info->num_UEs,
|
||||
UE_info->UE_sched_ctrl[UE_id].ph,
|
||||
UE_info->UE_sched_ctrl[UE_id].pcmax);
|
||||
sched_ctrl->ph,
|
||||
sched_ctrl->pcmax,
|
||||
avg_rsrp,
|
||||
stats->num_rsrp_meas);
|
||||
stroff+=sprintf(output+stroff,"UE %d: CQI %d, RI %d, PMI (%d,%d)\n",
|
||||
UE_id,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.ri+1,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
|
||||
UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
|
||||
|
||||
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;
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, pucch0_DTX %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,
|
||||
stats->pucch0_DTX,
|
||||
avg_rsrp, stats->num_rsrp_meas);
|
||||
stats->num_rsrp_meas = 0;
|
||||
stats->cumul_rsrp = 0 ;
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
|
||||
stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n",
|
||||
UE_id,
|
||||
stats->dlsch_rounds[0], stats->dlsch_rounds[1],
|
||||
stats->dlsch_rounds[2], stats->dlsch_rounds[3],
|
||||
stats->dlsch_errors,
|
||||
stats->pucch0_DTX,
|
||||
sched_ctrl->dl_bler_stats.bler,
|
||||
sched_ctrl->dl_bler_stats.mcs);
|
||||
if (reset_rsrp) {
|
||||
stats->num_rsrp_meas = 0;
|
||||
stats->cumul_rsrp = 0;
|
||||
}
|
||||
stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %"PRIu64"\n", UE_id, stats->dlsch_total_bytes);
|
||||
stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", ulsch_DTX %d, ulsch_errors %"PRIu64"\n",
|
||||
UE_id,
|
||||
stats->ulsch_rounds[0], stats->ulsch_rounds[1],
|
||||
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
|
||||
stats->ulsch_DTX,
|
||||
stats->ulsch_errors);
|
||||
stroff+=sprintf(output+stroff,
|
||||
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
|
||||
"UE %d: ulsch_total_bytes_scheduled %"PRIu64", ulsch_total_bytes_received %"PRIu64"\n",
|
||||
UE_id,
|
||||
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
|
||||
for (int lc_id = 0; lc_id < 63; lc_id++) {
|
||||
if (stats->lc_bytes_tx[lc_id] > 0) {
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %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]);
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
|
||||
}
|
||||
if (stats->lc_bytes_rx[lc_id] > 0) {
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %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]);
|
||||
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL);
|
||||
print_meas_log(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL, output+stroff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -145,6 +145,8 @@ typedef struct {
|
||||
uint8_t msg3_first_rb;
|
||||
/// Msg3 number of RB
|
||||
uint8_t msg3_nb_rb;
|
||||
/// Msg3 BWP start
|
||||
uint8_t msg3_bwp_start;
|
||||
/// Msg3 TPC command
|
||||
uint8_t msg3_TPC;
|
||||
/// Msg3 ULdelay command
|
||||
@@ -365,7 +367,8 @@ typedef struct NR_sched_pusch {
|
||||
typedef struct NR_pdsch_semi_static {
|
||||
int time_domain_allocation;
|
||||
uint8_t numDmrsCdmGrpsNoData;
|
||||
|
||||
uint8_t frontloaded_symb;
|
||||
int mapping_type;
|
||||
int startSymbolIndex;
|
||||
int nrOfSymbols;
|
||||
uint8_t nrOfLayers;
|
||||
@@ -420,6 +423,13 @@ typedef struct NR_UE_harq {
|
||||
|
||||
//! fixme : need to enhace for the multiple TB CQI report
|
||||
|
||||
typedef struct NR_DL_bler_stats {
|
||||
frame_t last_frame_slot;
|
||||
float bler;
|
||||
float rd2_bler;
|
||||
uint8_t mcs;
|
||||
uint64_t dlsch_rounds[8];
|
||||
} NR_DL_bler_stats_t;
|
||||
|
||||
//
|
||||
/*! As per spec 38.214 section 5.2.1.4.2
|
||||
@@ -444,6 +454,7 @@ struct CRI_RI_LI_PMI_CQI {
|
||||
uint8_t pmi_x2;
|
||||
uint8_t wb_cqi_1tb;
|
||||
uint8_t wb_cqi_2tb;
|
||||
uint8_t cqi_table;
|
||||
};
|
||||
|
||||
typedef struct CRI_SSB_RSRP {
|
||||
@@ -454,11 +465,8 @@ typedef struct CRI_SSB_RSRP {
|
||||
} CRI_SSB_RSRP_t;
|
||||
|
||||
struct CSI_Report {
|
||||
NR_CSI_Report_Config_PR present;
|
||||
union Config_CSI_Report {
|
||||
struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report;
|
||||
struct CRI_SSB_RSRP ssb_cri_report;
|
||||
} choice;
|
||||
struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report;
|
||||
struct CRI_SSB_RSRP ssb_cri_report;
|
||||
};
|
||||
|
||||
#define MAX_SR_BITLEN 8
|
||||
@@ -471,12 +479,13 @@ typedef struct {
|
||||
}L1_RSRP_bitlen_t;
|
||||
|
||||
typedef struct{
|
||||
uint8_t ri_restriction;
|
||||
uint8_t cri_bitlen;
|
||||
uint8_t ri_bitlen;
|
||||
uint8_t li_bitlen;
|
||||
uint8_t pmi_x1_bitlen;
|
||||
uint8_t pmi_x2_bitlen;
|
||||
uint8_t cqi_bitlen;
|
||||
uint8_t li_bitlen[8];
|
||||
uint8_t pmi_x1_bitlen[8];
|
||||
uint8_t pmi_x2_bitlen[8];
|
||||
uint8_t cqi_bitlen[8];
|
||||
} CSI_Meas_bitlen_t;
|
||||
|
||||
typedef struct nr_csi_report {
|
||||
@@ -563,6 +572,9 @@ typedef struct {
|
||||
/// per-LC status data
|
||||
mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID];
|
||||
|
||||
/// Estimation of HARQ from BLER
|
||||
NR_DL_bler_stats_t dl_bler_stats;
|
||||
|
||||
int lcid_mask;
|
||||
int lcid_to_schedule;
|
||||
uint16_t ta_frame;
|
||||
@@ -578,9 +590,9 @@ typedef struct {
|
||||
int pusch_consecutive_dtx_cnt;
|
||||
int pucch_consecutive_dtx_cnt;
|
||||
int ul_failure;
|
||||
struct CSI_Report CSI_report[MAX_CSI_REPORTS];
|
||||
struct CSI_Report CSI_report;
|
||||
bool SR;
|
||||
|
||||
bool set_mcs;
|
||||
/// information about every HARQ process
|
||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||
/// HARQ processes that are free
|
||||
@@ -606,19 +618,19 @@ typedef struct {
|
||||
} NRUEcontext_t;
|
||||
|
||||
typedef struct {
|
||||
int lc_bytes_tx[64];
|
||||
int lc_bytes_rx[64];
|
||||
int dlsch_rounds[8];
|
||||
int dlsch_errors;
|
||||
int dlsch_total_bytes;
|
||||
uint64_t lc_bytes_tx[64];
|
||||
uint64_t lc_bytes_rx[64];
|
||||
uint64_t dlsch_rounds[8];
|
||||
uint64_t dlsch_errors;
|
||||
uint64_t dlsch_total_bytes;
|
||||
int dlsch_current_bytes;
|
||||
int ulsch_rounds[8];
|
||||
int ulsch_errors;
|
||||
int ulsch_DTX;
|
||||
int ulsch_total_bytes_scheduled;
|
||||
int ulsch_total_bytes_rx;
|
||||
uint64_t ulsch_rounds[8];
|
||||
uint64_t ulsch_errors;
|
||||
uint32_t ulsch_DTX;
|
||||
uint64_t ulsch_total_bytes_scheduled;
|
||||
uint64_t ulsch_total_bytes_rx;
|
||||
int ulsch_current_bytes;
|
||||
int pucch0_DTX;
|
||||
uint32_t pucch0_DTX;
|
||||
int cumul_rsrp;
|
||||
uint8_t num_rsrp_meas;
|
||||
} NR_mac_stats_t;
|
||||
@@ -633,7 +645,6 @@ typedef struct {
|
||||
NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB];
|
||||
NR_list_t list;
|
||||
int num_UEs;
|
||||
|
||||
bool active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB];
|
||||
@@ -682,7 +693,8 @@ typedef struct gNB_MAC_INST_s {
|
||||
NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
|
||||
/// current PDU index (BCH,DLSCH)
|
||||
uint16_t pdu_index[NFAPI_CC_MAX];
|
||||
|
||||
int num_ulprbbl;
|
||||
int ulprbbl[275];
|
||||
/// NFAPI Config Request Structure
|
||||
nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX];
|
||||
/// NFAPI DL Config Request Structure
|
||||
@@ -747,7 +759,7 @@ typedef struct gNB_MAC_INST_s {
|
||||
int *preferred_ul_tda[MAX_NUM_BWP];
|
||||
|
||||
/// maximum number of slots before a UE will be scheduled ULSCH automatically
|
||||
uint32_t ulsch_max_slots_inactivity;
|
||||
uint32_t ulsch_max_frame_inactivity;
|
||||
|
||||
/// DL preprocessor for differentiated scheduling
|
||||
nr_pp_impl_dl pre_processor_dl;
|
||||
@@ -755,9 +767,15 @@ typedef struct gNB_MAC_INST_s {
|
||||
nr_pp_impl_ul pre_processor_ul;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrlCommon;
|
||||
uint16_t cset0_bwp_start;
|
||||
uint16_t cset0_bwp_size;
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64];
|
||||
|
||||
bool first_MIB;
|
||||
double dl_bler_target_upper;
|
||||
double dl_bler_target_lower;
|
||||
double dl_rd2_bler_threshold;
|
||||
uint8_t dl_max_mcs;
|
||||
} gNB_MAC_INST;
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
||||
|
||||
@@ -67,9 +67,7 @@ typedef struct {
|
||||
} pdcp_params_t;
|
||||
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
#define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT)
|
||||
#endif
|
||||
#define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT)
|
||||
#define LINK_ENB_PDCP_TO_IP_DRIVER ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_IP_DRIVER_BIT)
|
||||
#define LINK_ENB_PDCP_TO_GTPV1U ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_GTPV1U_BIT)
|
||||
#define UE_NAS_USE_TUN ( get_pdcp_optmask() & UE_NAS_USE_TUN_BIT)
|
||||
@@ -501,7 +499,6 @@ typedef struct {
|
||||
#define REORDERING_WINDOW_SN_7BIT 64
|
||||
#define REORDERING_WINDOW_SN_12BIT 2048
|
||||
|
||||
extern signed int pdcp_2_nas_irq;
|
||||
extern pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB];
|
||||
extern pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];
|
||||
|
||||
|
||||
@@ -603,7 +603,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
|
||||
//int optval;
|
||||
int bytes_received;
|
||||
sidelink_pc5s_element *sl_pc5s_msg_send = NULL;
|
||||
pc5s_header_t *pc5s_header = NULL;
|
||||
pc5s_header_t *pc5s_header = NULL;
|
||||
rb_id_t rab_id = 0;
|
||||
//TTN for D2D (PC5S)
|
||||
// receive a message from ProSe App
|
||||
@@ -704,6 +704,12 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
|
||||
pc5s_header->rb_id,
|
||||
rab_id,
|
||||
pc5s_header->data_size);
|
||||
/* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure
|
||||
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
|
||||
* gcc, from v9, now warns about it. fix these warnings by using local variables
|
||||
*/
|
||||
uint32_t sourceL2Id = pc5s_header->sourceL2Id;
|
||||
uint32_t destinationL2Id = pc5s_header->destinationL2Id;
|
||||
pdcp_data_req(
|
||||
&ctxt,
|
||||
SRB_FLAG_NO,
|
||||
@@ -713,9 +719,11 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
|
||||
pc5s_header->data_size,
|
||||
(unsigned char *)receive_buf,
|
||||
PDCP_TRANSMISSION_MODE_DATA,
|
||||
&pc5s_header->sourceL2Id,
|
||||
&pc5s_header->destinationL2Id
|
||||
&sourceL2Id,
|
||||
&destinationL2Id
|
||||
);
|
||||
pc5s_header->sourceL2Id = sourceL2Id;
|
||||
pc5s_header->destinationL2Id=destinationL2Id;
|
||||
} else { /* else of h_rc == HASH_TABLE_OK */
|
||||
MSC_LOG_RX_DISCARDED_MESSAGE(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
@@ -759,6 +767,12 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
|
||||
pc5s_header->rb_id,
|
||||
DEFAULT_RAB_ID,
|
||||
pc5s_header->data_size);
|
||||
/* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure
|
||||
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
|
||||
* gcc, from v9, now warns about it. fix these warnings by using local variables
|
||||
*/
|
||||
uint32_t sourceL2Id = pc5s_header->sourceL2Id;
|
||||
uint32_t destinationL2Id = pc5s_header->destinationL2Id;
|
||||
pdcp_data_req (
|
||||
&ctxt,
|
||||
SRB_FLAG_NO,
|
||||
@@ -768,9 +782,11 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
|
||||
pc5s_header->data_size,
|
||||
(unsigned char *)receive_buf,
|
||||
PDCP_TRANSMISSION_MODE_DATA,
|
||||
&pc5s_header->sourceL2Id,
|
||||
&pc5s_header->destinationL2Id
|
||||
&sourceL2Id,
|
||||
&destinationL2Id
|
||||
);
|
||||
pc5s_header->sourceL2Id = sourceL2Id;
|
||||
pc5s_header->destinationL2Id=destinationL2Id;
|
||||
}
|
||||
} /* end of !ctxt.enb_flag */
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
# include "rlc_tm_entity.h"
|
||||
# include "mem_block.h"
|
||||
//# include "rrm_config_structs.h"
|
||||
# include "rlc_tm_structs.h"
|
||||
//# include "rlc.h"
|
||||
# include "platform_types.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "rlc_um.h"
|
||||
#include "rlc_primitives.h"
|
||||
#include "list.h"
|
||||
#include "rrm_config_structs.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
# include "rlc_um_entity.h"
|
||||
# include "mem_block.h"
|
||||
# include "rrm_config_structs.h"
|
||||
# include "rlc_um_structs.h"
|
||||
# include "rlc_um_constants.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "pdcp.h"
|
||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include "openair2/SDAP/nr_sdap/nr_sdap_gnb.h"
|
||||
|
||||
#define TODO do { \
|
||||
printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \
|
||||
@@ -447,10 +448,18 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
|
||||
if(IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN){
|
||||
LOG_D(PDCP, "IP packet received, to be sent to TUN interface");
|
||||
len = write(nas_sock_fd[0], buf, size);
|
||||
|
||||
if(entity->has_sdapDLheader){
|
||||
size -= SDAP_HDR_LENGTH;
|
||||
len = write(nas_sock_fd[0], &buf[SDAP_HDR_LENGTH], size);
|
||||
} else {
|
||||
len = write(nas_sock_fd[0], buf, size);
|
||||
}
|
||||
|
||||
if (len != size) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
for (i = 0; i < 5; i++) {
|
||||
@@ -480,7 +489,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
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_D(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
|
||||
if (offset==1) {
|
||||
LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
|
||||
sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -828,10 +840,6 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
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) {
|
||||
@@ -903,9 +911,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list)
|
||||
//struct NR_RLC_Config *rlc_Config)
|
||||
@@ -952,7 +958,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
if (kRRCint != NULL) {
|
||||
/* todo */
|
||||
}
|
||||
|
||||
|
||||
if (drb2release_list != NULL) {
|
||||
// TODO
|
||||
}
|
||||
@@ -975,9 +981,7 @@ boolean_t rrc_pdcp_config_asn1_req(
|
||||
uint8_t *const kRRCenc,
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
,rb_id_t *const defaultDRB)
|
||||
{
|
||||
return 0;
|
||||
@@ -1240,10 +1244,8 @@ boolean_t pdcp_data_req(
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t mode
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,const uint32_t *const sourceL2Id
|
||||
,const uint32_t *const destinationL2Id
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (srb_flagP) {
|
||||
|
||||
@@ -270,7 +270,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
|
||||
+ buf_stat.retx_size
|
||||
+ buf_stat.tx_size;
|
||||
} else {
|
||||
if (!(frameP%128)) //to supress this warning message
|
||||
if (!(frameP%128)) //to suppress this warning message
|
||||
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP);
|
||||
ret.bytes_in_buffer = 0;
|
||||
}
|
||||
@@ -334,6 +334,8 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
|
||||
+ buf_stat.retx_size
|
||||
+ buf_stat.tx_size;
|
||||
} else {
|
||||
if (!(frameP%128)) //to suppress this warning message
|
||||
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
@@ -953,16 +955,16 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
|
||||
if ((drb2add_listP != NULL) && (rlc_bearer2add_list != NULL)) {
|
||||
for (i = 0; i < drb2add_listP->list.count; 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]);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,264 +362,5 @@ int dump_eNB_l2_stats(char *buffer, int length) {
|
||||
|
||||
return len + 1 /* SR: for trailing \0 */;
|
||||
}
|
||||
#ifdef PROC
|
||||
int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) {
|
||||
int len = 0,fg,Overhead, Sign;
|
||||
unsigned int i,j,k,kk;
|
||||
unsigned int Mod_id = 0,CH_index;
|
||||
unsigned int tx_pdcp_sdu;
|
||||
unsigned int tx_pdcp_sdu_discarded;
|
||||
unsigned int tx_retransmit_pdu_unblock;
|
||||
unsigned int tx_retransmit_pdu_by_status;
|
||||
unsigned int tx_retransmit_pdu;
|
||||
unsigned int tx_data_pdu;
|
||||
unsigned int tx_control_pdu;
|
||||
unsigned int rx_sdu;
|
||||
unsigned int rx_error_pdu;
|
||||
unsigned int rx_data_pdu;
|
||||
unsigned int rx_data_pdu_out_of_window;
|
||||
unsigned int rx_control_pdu;
|
||||
|
||||
// if (mac_xface->is_cluster_head == 0) {
|
||||
for (k=0; k<NB_INST; k++) {
|
||||
if (Mac_rlc_xface->Is_cluster_head[k] == 0) {
|
||||
#ifndef PHY_EMUL_ONE_MACHINE
|
||||
Mod_id=k-NB_CH_INST;
|
||||
len+=sprintf(&buffer[len],"UE TTI: %d\n",Mac_rlc_xface->frame);
|
||||
|
||||
for (CH_index = 0; CH_index<NB_CNX_UE; CH_index++) {
|
||||
if (UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Active==1) {
|
||||
len+=sprintf(&buffer[len],"CH %u: Wideband SINR %d dB---\n",
|
||||
CH_index,UE_mac_inst[Mod_id].Def_meas[CH_index].Wideband_sinr);
|
||||
len+=sprintf(&buffer[len],"CH %u: Subband SINR (dB) :",
|
||||
CH_index);
|
||||
|
||||
for (fg=0; fg<NUMBER_OF_MEASUREMENT_SUBBANDS; fg++) {
|
||||
len+=sprintf(&buffer[len],"%d ",UE_mac_inst[Mod_id].Def_meas[CH_index].Sinr_meas[0][fg]);
|
||||
}
|
||||
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
len+=sprintf(&buffer[len],"BCCH %d, NB_RX_MAC = %d (%d errors)\n",
|
||||
UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.Lchan_id.Index,
|
||||
UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.NB_RX,
|
||||
UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
|
||||
len+=sprintf(&buffer[len],"CCCH %d, NB_RX_MAC = %d (%d errors)\n",
|
||||
UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.Lchan_id.Index,
|
||||
UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.NB_RX,
|
||||
UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
|
||||
len+=sprintf(&buffer[len],"LCHAN %d (DCCH), NB_TX_MAC = %d (%d bits/TTI, %d kbits/sec), NB_RX_MAC = %d (%d errors)\n",
|
||||
UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.Lchan_id.Index,
|
||||
UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_TX,
|
||||
UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.output_rate,
|
||||
(10*UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.output_rate)>>5,
|
||||
UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_RX,
|
||||
UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
|
||||
|
||||
for(i=1; i<NB_RAB_MAX; i++) {
|
||||
if (UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Active==1) {
|
||||
Overhead=UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate - Pdcp_stats_tx_rate[k][CH_index][i];
|
||||
|
||||
if(Overhead<0) {
|
||||
Overhead=-Overhead;
|
||||
Sign=-1;
|
||||
} else {
|
||||
Sign=1;
|
||||
}
|
||||
|
||||
len+=sprintf(&buffer[len],
|
||||
"[PDCP]LCHAN %d: NB_TX = %d ,Tx_rate =(%d bits/TTI ,%d Kbits/s), NB_RX = %d ,Rx_rate =(%d bits/TTI ,%d Kbits/s) , LAYER2 TX OVERHEAD: %d Kbits/s\n",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
Pdcp_stats_tx[k][CH_index][i],
|
||||
Pdcp_stats_tx_rate[k][CH_index][i],
|
||||
(10*Pdcp_stats_tx_rate[k][CH_index][i])>>5,
|
||||
Pdcp_stats_rx[k][CH_index][i],
|
||||
Pdcp_stats_rx_rate[k][CH_index][i],
|
||||
(10*Pdcp_stats_rx_rate[k][CH_index][i])>>5,
|
||||
Sign*(10*Overhead)>>5);
|
||||
int status = rlc_stat_req (k,
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
&tx_pdcp_sdu,
|
||||
&tx_pdcp_sdu_discarded,
|
||||
&tx_retransmit_pdu_unblock,
|
||||
&tx_retransmit_pdu_by_status,
|
||||
&tx_retransmit_pdu,
|
||||
&tx_data_pdu,
|
||||
&tx_control_pdu,
|
||||
&rx_sdu,
|
||||
&rx_error_pdu,
|
||||
&rx_data_pdu,
|
||||
&rx_data_pdu_out_of_window,
|
||||
&rx_control_pdu) ;
|
||||
|
||||
if (status == RLC_OP_STATUS_OK) {
|
||||
len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_SDU_TO_TX = %u\tNB_SDU_DISC %u\tNB_RX_SDU %u\n",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
tx_pdcp_sdu,
|
||||
tx_pdcp_sdu_discarded,
|
||||
rx_sdu);
|
||||
len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_TB_TX_DATA = %u\tNB_TB_TX_CONTROL %u\tNB_TX_TB_RETRANS %u",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
tx_data_pdu,
|
||||
tx_control_pdu,
|
||||
tx_retransmit_pdu);
|
||||
len+=sprintf(&buffer[len],"\tRLC LCHAN %d, NB_TX_TB_RETRANS_BY_STATUS = %u\tNB_TX_TB_RETRANS_PADD %u\n",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
tx_retransmit_pdu_by_status,
|
||||
tx_retransmit_pdu_unblock);
|
||||
len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_RX_DATA = %u\tNB_RX_TB_OUT_WIN %u\tNB_RX_TB_CORRUPT %u\n",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
rx_data_pdu,
|
||||
rx_data_pdu_out_of_window,
|
||||
rx_error_pdu);
|
||||
}
|
||||
|
||||
len+=sprintf(&buffer[len],"[MAC]: LCHAN %d, NB_TX_MAC = %d (%d bits/TTI, %d kbits/s), NB_RX_MAC = %d (%d errors)\n",
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_TX,
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate,
|
||||
(10*UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate)>>5,
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX,
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_ERRORS);
|
||||
len+=sprintf(&buffer[len]," TX per TB: ");
|
||||
|
||||
for(kk=0; kk<MAX_NUMBER_TB_PER_LCHAN/2; kk++) {
|
||||
len+=sprintf(&buffer[len],"%d . ",UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_TX_TB[kk]);
|
||||
}
|
||||
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
len+=sprintf(&buffer[len]," RXerr per TB: ");
|
||||
|
||||
for(kk=0; kk<MAX_NUMBER_TB_PER_LCHAN/2; kk++)
|
||||
len+=sprintf(&buffer[len],"%d/%d . ",UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_ERRORS_TB[kk],
|
||||
UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_TB[kk]);
|
||||
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //PHY_EMUL_ONE_MACHINE
|
||||
} else if(Mac_rlc_xface->Is_cluster_head[k] ==1) {
|
||||
Mod_id=k;
|
||||
len+=sprintf(&buffer[len],
|
||||
"------------------------------------------------------------------- TTI: %d------------------------------------------------------------------\n",
|
||||
Mac_rlc_xface->frame);
|
||||
|
||||
for(i=1; i<=NB_CNX_CH; i++) {
|
||||
if (CH_mac_inst[Mod_id].Dcch_lchan[i].Active==1) {
|
||||
len+=sprintf(&buffer[len],"\nMR index %u: DL SINR (feedback) %d dB, CQI: %s\n\n",
|
||||
i,//CH_rrc_inst[Mod_id].Info.UE_info[i].L2_id[0],
|
||||
CH_mac_inst[Mod_id].Def_meas[i].Wideband_sinr,
|
||||
print_cqi(CH_mac_inst[Mod_id].Def_meas[i].cqi));
|
||||
len+=sprintf(&buffer[len],
|
||||
"[MAC] LCHAN %d (DCCH), NB_TX_MAC= %d (%d bits/TTI, %d kbits/s), NB_RX_MAC= %d (errors %d, sacch errors %d, sach errors %d, sach_missing %d)\n\n",
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.Lchan_id.Index,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_TX,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.output_rate,
|
||||
(10*CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.output_rate)>>5,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACCH_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACH_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACH_MISSING);
|
||||
|
||||
for(j=0; j<NB_RAB_MAX; j++) {
|
||||
if (CH_mac_inst[Mod_id].Dtch_lchan[j][i].Active==1) {
|
||||
Overhead=CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate - Pdcp_stats_tx_rate[k][i][j];
|
||||
|
||||
if(Overhead<0) {
|
||||
Overhead=-Overhead;
|
||||
Sign=-1;
|
||||
} else {
|
||||
Sign=1;
|
||||
}
|
||||
|
||||
len+=sprintf(&buffer[len],
|
||||
"[PDCP]LCHAN %d: NB_TX = %d ,Tx_rate =(%d bits/TTI ,%d Kbits/s), NB_RX = %d ,Rx_rate =(%d bits/TTI ,%d Kbits/s), LAYER2 TX OVERHEAD= %d Kbits/s\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
Pdcp_stats_tx[k][i][j],
|
||||
Pdcp_stats_tx_rate[k][i][j],
|
||||
(10*Pdcp_stats_tx_rate[k][i][j])>>5,
|
||||
Pdcp_stats_rx[k][i][j],
|
||||
Pdcp_stats_rx_rate[k][i][j],
|
||||
(10*Pdcp_stats_rx_rate[k][i][j])>>5,
|
||||
Sign*(10*Overhead)>>5);
|
||||
int status = rlc_stat_req (k,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
&tx_pdcp_sdu,
|
||||
&tx_pdcp_sdu_discarded,
|
||||
&tx_retransmit_pdu_unblock,
|
||||
&tx_retransmit_pdu_by_status,
|
||||
&tx_retransmit_pdu,
|
||||
&tx_data_pdu,
|
||||
&tx_control_pdu,
|
||||
&rx_sdu,
|
||||
&rx_error_pdu,
|
||||
&rx_data_pdu,
|
||||
&rx_data_pdu_out_of_window,
|
||||
&rx_control_pdu) ;
|
||||
/*
|
||||
if (status == RLC_OP_STATUS_OK) {
|
||||
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_SDU_TO_TX = %d\tNB_SDU_DISC %d\tNB_RX_SDU %d\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
tx_pdcp_sdu,
|
||||
tx_pdcp_sdu_discarded,
|
||||
rx_sdu);
|
||||
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TB_TX_DATA = %d\tNB_TB_TX_CONTROL %d\tNB_TX_TB_RETRANS %\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
tx_data_pdu,
|
||||
tx_control_pdu,
|
||||
tx_retransmit_pdu);
|
||||
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TX_TB_RETRANS_BY_STATUS = %d\tNB_TX_TB_RETRANS_PADD %d\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
tx_retransmit_pdu_by_status,
|
||||
tx_retransmit_pdu_unblock);
|
||||
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_RX_DATA = %d\tNB_RX_TB_OUT_WIN %d\tNB_RX_TB_CORRUPT %d\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
rx_data_pdu,
|
||||
rx_data_pdu_out_of_window,
|
||||
rx_error_pdu);
|
||||
}
|
||||
*/
|
||||
len+=sprintf(&buffer[len],
|
||||
"[MAC]LCHAN %d (CNX %u,RAB %u), NB_TX_MAC= %d (%d bits/TTI, %d kbit/s), NB_RX_MAC= %d (errors %d, sacch_errors %d, sach_errors %d, sach_missing %d)\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
|
||||
i,j,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_TX,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate,
|
||||
(10*CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate)>>5,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACCH_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACH_ERRORS,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACH_MISSING);
|
||||
len+=sprintf(&buffer[len],"[MAC][SCHEDULER] TX Arrival Rate %d, TX Service Rate %d, RX Arrival rate %d, RX Service rate %d, NB_BW_REQ_RX %d\n\n",
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Arrival_rate,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Tx_rate,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Req_rate,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Rx_rate,
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_BW_REQ_RX);
|
||||
/*
|
||||
len+=sprintf(&buffer[len]," TX per TB: ");
|
||||
for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
|
||||
len+=sprintf(&buffer[len],"%d.",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_TX_TB[kk]);
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
len+=sprintf(&buffer[len]," RXerr per TB: ");
|
||||
for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
|
||||
len+=sprintf(&buffer[len],"%d/%d . ",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_ERRORS_TB[kk],
|
||||
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_TB[kk]);
|
||||
len+=sprintf(&buffer[len],"\n");
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -389,36 +389,19 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
pdcph.sourceL2Id = 0;
|
||||
pdcph.destinationL2Id = 0;
|
||||
|
||||
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
bytes_wrote = nas_netlink_send((char *)&pdcph,NAS_PDCPH_SIZE);
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("[NAS] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",
|
||||
bytes_wrote,skb->len);
|
||||
#endif
|
||||
#else
|
||||
bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("[NAS] Wrote %d bytes (header for %d byte skb) to PDCP fifo\n",
|
||||
bytes_wrote,skb->len);
|
||||
#endif
|
||||
#endif //PDCP_USE_NETLINK
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_SEND: problem while writing PDCP's header (bytes wrote = %d )\n",bytes_wrote);
|
||||
printk("rb_id %ld, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
#endif //PDCP_USE_NETLINK
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
bytes_wrote += nas_netlink_send((char *)skb->data,skb->len);
|
||||
#else
|
||||
bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
|
||||
#endif //PDCP_USE_NETLINK
|
||||
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %ld: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
|
||||
@@ -427,9 +410,6 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
bytes_wrote,
|
||||
skb->len,
|
||||
NAS_PDCPH_SIZE); // congestion
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
#endif //PDCP_USE_NETLINK
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,69 +429,6 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_COMMON_QOS_receive()
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t sapi;
|
||||
struct pdcp_data_ind_header_s pdcph;
|
||||
unsigned char data_buffer[2048];
|
||||
struct classifier_entity *rclass;
|
||||
struct nas_priv *priv;
|
||||
int bytes_read;
|
||||
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - begin \n");
|
||||
#endif
|
||||
|
||||
// End debug information
|
||||
|
||||
bytes_read = rtf_get(PDCP2PDCP_USE_RT_FIFO,&pdcph, NAS_PDCPH_SIZE);
|
||||
|
||||
while (bytes_read>0) {
|
||||
if (bytes_read != NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_RECEIVE: problem while reading PDCP header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
priv=netdev_priv(nasdev[pdcph.inst]);
|
||||
rclass = nas_COMMON_search_class_for_rb(pdcph.rb_id,priv);
|
||||
|
||||
bytes_read+= rtf_get(PDCP2PDCP_USE_RT_FIFO,
|
||||
data_buffer,
|
||||
pdcph.data_size);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - Got header for RB %d, Inst %d \n",
|
||||
pdcph.rb_id,
|
||||
pdcph.inst);
|
||||
#endif
|
||||
|
||||
if (rclass) {
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Found corresponding connection in classifier for RAB\n");
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
nas_COMMON_receive(pdcph.data_size,
|
||||
(void *)data_buffer,
|
||||
pdcph.inst,
|
||||
rclass,
|
||||
pdcph.rb_id);
|
||||
}
|
||||
|
||||
bytes_read = rtf_get(PDCP2PDCP_USE_RT_FIFO, &pdcph, NAS_PDCPH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - end \n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
{
|
||||
|
||||
@@ -542,7 +459,6 @@ void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
}
|
||||
|
||||
}
|
||||
#endif //PDCP_USE_NETLINK
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_priv *priv)
|
||||
|
||||
@@ -53,10 +53,8 @@
|
||||
|
||||
struct net_device *nasdev[NB_INSTANCES_MAX];
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
extern void nas_netlink_release(void);
|
||||
extern int nas_netlink_init(void);
|
||||
#endif
|
||||
|
||||
//int bytes_wrote;
|
||||
//int bytes_read;
|
||||
@@ -82,38 +80,6 @@ int find_inst(struct net_device *dev)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
//void interrupt(void){
|
||||
void *nas_interrupt(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
|
||||
// struct nas_priv *priv=netdev_priv(dev_id);
|
||||
// unsigned int flags;
|
||||
|
||||
// priv->lock = SPIN_LOCK_UNLOCKED;
|
||||
|
||||
#ifdef DEBUG_INTERRUPT
|
||||
printk("INTERRUPT - begin\n");
|
||||
#endif
|
||||
// spin_lock_irqsave(&priv->lock,flags);
|
||||
cxi=0;
|
||||
// mesh_GC_receive();
|
||||
// mesh_DC_receive(naspriv->cx+cxi);
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
nas_COMMON_QOS_receive();
|
||||
#endif
|
||||
// spin_unlock_irqrestore(&priv->lock,flags);
|
||||
#ifdef DEBUG_INTERRUPT
|
||||
printk("INTERRUPT: end\n");
|
||||
#endif
|
||||
// return 0;
|
||||
return NULL;
|
||||
}
|
||||
#endif //NETLINK
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is activated by ifconfig
|
||||
int nas_open(struct net_device *dev)
|
||||
{
|
||||
@@ -121,15 +87,6 @@ int nas_open(struct net_device *dev)
|
||||
printk("OPEN: begin\n");
|
||||
// MOD_INC_USE_COUNT;
|
||||
// Address has already been set at init
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
|
||||
if (pdcp_2_nas_irq==-EBUSY) {
|
||||
printk("OPEN: irq failure\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#endif //PDCP_USE_NETLINK
|
||||
|
||||
/*
|
||||
netif_start_queue(dev);
|
||||
//
|
||||
@@ -449,16 +406,6 @@ int init_module (void)
|
||||
|
||||
printk("Starting NASMESH, number of IMEI paramters %d, IMEI %X%X\n",m_arg,nas_IMEI[0],nas_IMEI[1]);
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
|
||||
if (pdcp_2_nas_irq == -EBUSY || pdcp_2_nas_irq == -EINVAL) {
|
||||
printk("[NAS][INIT] No interrupt resource available\n");
|
||||
return -EBUSY;
|
||||
} else
|
||||
printk("[NAS][INIT]: Interrupt %d\n", pdcp_2_nas_irq);
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
|
||||
printk("[NAS][INIT] nasmesh_init_module: begin init instance %d\n",inst);
|
||||
|
||||
@@ -493,15 +440,11 @@ int init_module (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
|
||||
if ((err=nas_netlink_init()) == -1)
|
||||
printk("[NAS][INIT] NETLINK failed\n");
|
||||
|
||||
printk("[NAS][INIT] NETLINK INIT\n");
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
@@ -516,22 +459,6 @@ void cleanup_module(void)
|
||||
|
||||
printk("[NAS][CLEANUP]nasmesh_cleanup_module: begin\n");
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
|
||||
if (pdcp_2_nas_irq!=-EBUSY) {
|
||||
pdcp_2_nas_irq=0;
|
||||
// Start IRQ linux
|
||||
// free_irq(priv->irq, NULL);
|
||||
// End IRQ linux
|
||||
|
||||
}
|
||||
|
||||
#else // NETLINK
|
||||
|
||||
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("nasmesh_cleanup_module: unregister and free net device instance %d\n",inst);
|
||||
@@ -541,9 +468,7 @@ void cleanup_module(void)
|
||||
free_netdev(nasdev[inst]);
|
||||
}
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
nas_netlink_release();
|
||||
#endif //PDCP_USE_NETLINK
|
||||
printk("nasmesh_cleanup_module: end\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -178,10 +178,4 @@ extern struct net_device *nasdev[NB_INSTANCES_MAX];
|
||||
|
||||
extern uint8_t NAS_NULL_IMEI[14];
|
||||
|
||||
//global variables shared with RRC
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
extern int pdcp_2_nas_irq;
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -293,10 +293,6 @@ int nas_mesh_DC_send_cx_establish_request(struct cx_entity *cx,struct nas_priv *
|
||||
nas_tool_print_buffer((char *)p,p->length);
|
||||
#endif
|
||||
++cx->retry;
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
|
||||
#endif
|
||||
cx->countimer=gpriv->timer_establishment;
|
||||
|
||||
if (bytes_wrote==p->length) {
|
||||
@@ -353,11 +349,6 @@ int nas_mesh_DC_send_cx_release_request(struct cx_entity *cx,
|
||||
p->length = NAS_TL_SIZE + sizeof(struct NASConnReleaseReq);
|
||||
p->nasUEDCPrimitive.conn_release_req.localConnectionRef = cx->lcr;
|
||||
p->nasUEDCPrimitive.conn_release_req.releaseCause = NAS_CX_RELEASE_UNDEF_CAUSE;
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
|
||||
#else
|
||||
// bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
|
||||
#endif
|
||||
|
||||
if (bytes_wrote==p->length) {
|
||||
cx->state=NAS_IDLE;
|
||||
@@ -441,22 +432,12 @@ void nas_mesh_DC_send_sig_data_request(struct sk_buff *skb,
|
||||
p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
|
||||
p->nasUEDCPrimitive.data_transfer_req.priority = 3; // TBD
|
||||
p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (skb->len)+1; //adds category character
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
|
||||
#endif
|
||||
|
||||
if (bytes_wrote!=p->length) {
|
||||
printk("NAS_MESH_DC_SEND_SIG: Header sent failure in DC-FIFO\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], &data_type, 1);
|
||||
// bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], skb->data, skb->len);
|
||||
#endif
|
||||
|
||||
if (bytes_wrote != p->length + skb->len + 1) {
|
||||
printk("NAS_MESH_DC_SEND_SIG: Data sent failure in DC-FIFO\n");
|
||||
return;
|
||||
@@ -511,22 +492,12 @@ void nas_mesh_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_ca
|
||||
p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
|
||||
p->nasUEDCPrimitive.data_transfer_req.priority = 3; // TBD
|
||||
p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (nas_length)+1; //adds category character
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
|
||||
#endif
|
||||
|
||||
if (bytes_wrote!=p->length) {
|
||||
printk("NAS_MESH_DC_PEER_SEND_SIG: Header sent failure in DC-FIFO\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], &data_type, 1);
|
||||
// bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], (char *)nas_data, nas_length);
|
||||
#endif
|
||||
|
||||
if (bytes_wrote != p->length + nas_length + 1) {
|
||||
printk("NAS_MESH_DC_PEER_SEND_SIG: Data sent failure in DC-FIFO\n");
|
||||
return;
|
||||
@@ -665,9 +636,6 @@ void nas_mesh_DC_decode_sig_data_ind(struct cx_entity *cx, struct nas_ue_dc_elem
|
||||
}
|
||||
|
||||
// End debug information
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
// nas_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, cx->sap[NAS_DC_OUTPUT_SAPI]);
|
||||
#endif
|
||||
#ifdef NAS_DEBUG_DC
|
||||
printk("NAS_MESH_DC_RECEIVE: DATA_TRANSFER_IND reception\n");
|
||||
printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.data_transfer_ind.localConnectionRef);
|
||||
@@ -842,20 +810,12 @@ int nas_mesh_DC_receive(struct cx_entity *cx,struct nas_priv *gpriv)
|
||||
}
|
||||
|
||||
// End debug information
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_read = rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI] , gpriv->rbuffer, NAS_TL_SIZE);
|
||||
#endif
|
||||
|
||||
if (bytes_read>0) {
|
||||
struct nas_ue_dc_element *p;
|
||||
|
||||
p= (struct nas_ue_dc_element *)(gpriv->rbuffer);
|
||||
//get the rest of the primitive
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
|
||||
#endif
|
||||
|
||||
if (bytes_read!=p->length) {
|
||||
printk("NAS_MESH_DC_RECEIVE: Problem while reading primitive header\n");
|
||||
@@ -982,19 +942,11 @@ int nas_mesh_GC_receive(struct nas_priv *gpriv)
|
||||
#ifdef NAS_DEBUG_GC
|
||||
printk("NAS_MESH_GC_RECEIVE - begin \n");
|
||||
#endif
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_read = rtf_get(gpriv->sap[NAS_GC_SAPI], gpriv->rbuffer, NAS_TL_SIZE);
|
||||
#endif
|
||||
|
||||
if (bytes_read>0) {
|
||||
struct nas_ue_gc_element *p;
|
||||
p= (struct nas_ue_gc_element *)(gpriv->rbuffer);
|
||||
//get the rest of the primitive
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
|
||||
#endif
|
||||
|
||||
if (bytes_read!=p->length) {
|
||||
printk("NAS_MESH_GC_RECEIVE: Problem while reading primitive's header\n");
|
||||
@@ -1004,10 +956,6 @@ int nas_mesh_GC_receive(struct nas_priv *gpriv)
|
||||
// start decoding message
|
||||
switch (p->type) {
|
||||
case INFO_BROADCAST_IND :
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
#else
|
||||
// bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+p->length, p->nasUEGCPrimitive.broadcast_ind.nasDataLength);
|
||||
#endif
|
||||
if (bytes_read!=p->length+p->nasUEGCPrimitive.broadcast_ind.nasDataLength) {
|
||||
printk("NAS_MESH_GC_RECEIVE: INFO_BROADCAST_IND reception, Problem while reading primitive's data\n");
|
||||
return bytes_read;
|
||||
|
||||
@@ -110,14 +110,6 @@ void nas_COMMON_del_send(struct sk_buff *skb,
|
||||
struct cx_entity *cx,
|
||||
struct classifier_entity *gc,int inst, struct nas_priv *gpriv);
|
||||
|
||||
#ifndef PDCP_USE_NETLINK
|
||||
/**
|
||||
\fn void nas_COMMON_QOS_receive()
|
||||
\brief Retrieve PDU from PDCP for connection
|
||||
*/
|
||||
void nas_COMMON_QOS_receive(void);
|
||||
#endif //PDCP_USE_NETLINK
|
||||
|
||||
/**
|
||||
\fn struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos)
|
||||
\brief Add a radio-bearer descriptor
|
||||
@@ -168,7 +160,6 @@ struct classifier_entity
|
||||
*/
|
||||
void nas_COMMON_flush_rb(struct cx_entity *cx);
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
/**
|
||||
\fn int nas_netlink_send(unsigned char *data,unsigned int len)
|
||||
\brief Request the transfer of data by PDCP via netlink socket
|
||||
@@ -185,7 +176,6 @@ int nas_netlink_send(unsigned char *data,unsigned int len);
|
||||
*/
|
||||
void nas_COMMON_QOS_receive(struct nlmsghdr *nlh);
|
||||
|
||||
#endif //PDCP_USE_NETLINK
|
||||
//nasmesh.c
|
||||
|
||||
/**
|
||||
@@ -305,13 +295,10 @@ void nas_tool_print_buffer(char * buffer,int length);
|
||||
void nas_print_rb_entity(struct rb_entity *rb);
|
||||
void nas_print_classifier(struct classifier_entity *gc);
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
// nas_netlink.c
|
||||
|
||||
void nas_netlink_release(void);
|
||||
int nas_netlink_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -97,35 +97,6 @@ rrc_init_global_param(
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
//#ifdef USER_MODE
|
||||
// Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE));
|
||||
//#endif //USRE_MODE
|
||||
|
||||
// Rrc_xface->openair_rrc_top_init = openair_rrc_top_init;
|
||||
// Rrc_xface->openair_rrc_eNB_init = openair_rrc_eNB_init;
|
||||
// Rrc_xface->openair_rrc_UE_init = openair_rrc_ue_init;
|
||||
// Rrc_xface->mac_rrc_data_ind = mac_rrc_data_ind;
|
||||
//Rrc_xface->mac_rrc_data_req = mac_rrc_data_req;
|
||||
// Rrc_xface->rrc_data_indP = (void *)rlcrrc_data_ind;
|
||||
// Rrc_xface->rrc_rx_tx = rrc_rx_tx;
|
||||
// Rrc_xface->mac_rrc_meas_ind = mac_rrc_meas_ind;
|
||||
// Rrc_xface->get_rrc_status = get_rrc_status;
|
||||
|
||||
//Rrc_xface->rrc_get_status = ...
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind=mac_out_of_sync_ind;
|
||||
|
||||
#ifndef NO_RRM
|
||||
// Rrc_xface->fn_rrc=fn_rrc;
|
||||
#endif
|
||||
// LOG_D(RRC, "[RRC]INIT_GLOBAL_PARAM: Mac_rlc_xface %p, rrc_rlc_register %p,rlcrrc_data_ind%p\n",Mac_rlc_xface,Mac_rlc_xface->rrc_rlc_register_rrc,rlcrrc_data_ind);
|
||||
/*
|
||||
if((Mac_rlc_xface==NULL) || (Mac_rlc_xface->rrc_rlc_register_rrc==NULL) ||
|
||||
(rlcrrc_data_ind==NULL)) {
|
||||
LOG_E(RRC,"Data structured is not initialized \n");
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
|
||||
|
||||
DCCH_LCHAN_DESC.transport_block_size = 4;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
* \email: raymond.knopp@eurecom.fr ,navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
|
||||
*/
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h> /* for atoi(3) */
|
||||
@@ -36,9 +35,6 @@
|
||||
#include <string.h> /* for strerror(3) */
|
||||
#include <sysexits.h> /* for EX_* exit codes */
|
||||
#include <errno.h> /* for errno */
|
||||
#else
|
||||
#include <linux/module.h> /* Needed by all modules */
|
||||
#endif
|
||||
|
||||
#include <asn_application.h>
|
||||
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
|
||||
|
||||
@@ -1,522 +0,0 @@
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_codecs_prim.c patch_dir/asn_codecs_prim.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_codecs_prim.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/asn_codecs_prim.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 4,10 ****
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_codecs_prim.h>
|
||||
- #include <errno.h>
|
||||
|
||||
/*
|
||||
* Decode an always-primitive type.
|
||||
--- 4,9 ----
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_internal.h patch_dir/asn_internal.h
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_internal.h 2011-03-31 10:22:57.000000000 +0200
|
||||
--- patch_dir/asn_internal.h 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 10,20 ****
|
||||
--- 10,31 ----
|
||||
#define _ASN_INTERNAL_H_
|
||||
|
||||
#include "asn_application.h" /* Application-visible API */
|
||||
+ #ifndef USER_MODE
|
||||
+ #include <rtai.h>
|
||||
+ #include <rtai_malloc.h>
|
||||
+ #include "rtai_mem.h"
|
||||
+ #endif
|
||||
|
||||
#ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */
|
||||
#include <assert.h> /* for assert() macro */
|
||||
#endif
|
||||
|
||||
+ #ifndef USER_MODE
|
||||
+ #ifndef assert
|
||||
+ #define assert(expr) ((expr) ? (void) 0 : printk("Assertion failed in %s:%d\n", __FILE__, __LINE__))
|
||||
+ #endif
|
||||
+ #endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
***************
|
||||
*** 23,32 ****
|
||||
--- 34,51 ----
|
||||
#define ASN1C_ENVIRONMENT_VERSION 922 /* Compile-time version */
|
||||
int get_asn1c_environment_version(void); /* Run-time version */
|
||||
|
||||
+ #ifdef USER_MODE
|
||||
#define CALLOC(nmemb, size) calloc(nmemb, size)
|
||||
#define MALLOC(size) malloc(size)
|
||||
#define REALLOC(oldptr, size) realloc(oldptr, size)
|
||||
#define FREEMEM(ptr) free(ptr)
|
||||
+ #else
|
||||
+ #define CALLOC(nmemb, size) rt_calloc(nmemb,size)
|
||||
+ #define MALLOC(size) rt_malloc(size)
|
||||
+ #define REALLOC(oldptr, size) rt_realloc(oldptr, size)
|
||||
+ #define FREEMEM(ptr) rt_free(ptr);
|
||||
+ #endif
|
||||
+
|
||||
|
||||
/*
|
||||
* A macro for debugging the ASN.1 internals.
|
||||
***************
|
||||
*** 38,45 ****
|
||||
#ifdef ASN_THREAD_SAFE
|
||||
#define asn_debug_indent 0
|
||||
#else /* !ASN_THREAD_SAFE */
|
||||
! int asn_debug_indent;
|
||||
#endif /* ASN_THREAD_SAFE */
|
||||
#define ASN_DEBUG(fmt, args...) do { \
|
||||
int adi = asn_debug_indent; \
|
||||
while(adi--) fprintf(stderr, " "); \
|
||||
--- 57,65 ----
|
||||
#ifdef ASN_THREAD_SAFE
|
||||
#define asn_debug_indent 0
|
||||
#else /* !ASN_THREAD_SAFE */
|
||||
! extern int asn_debug_indent;
|
||||
#endif /* ASN_THREAD_SAFE */
|
||||
+ #ifdef USER_MODE
|
||||
#define ASN_DEBUG(fmt, args...) do { \
|
||||
int adi = asn_debug_indent; \
|
||||
while(adi--) fprintf(stderr, " "); \
|
||||
***************
|
||||
*** 47,52 ****
|
||||
--- 67,81 ----
|
||||
fprintf(stderr, " (%s:%d)\n", \
|
||||
__FILE__, __LINE__); \
|
||||
} while(0)
|
||||
+ #else
|
||||
+ #define ASN_DEBUG(fmt, args...) do { \
|
||||
+ int adi = asn_debug_indent; \
|
||||
+ while(adi--) printk(" "); \
|
||||
+ printk(fmt, ##args); \
|
||||
+ printk(" (%s:%d)\n", \
|
||||
+ __FILE__, __LINE__); \
|
||||
+ } while(0)
|
||||
+ #endif
|
||||
#else /* !__GNUC__ */
|
||||
void ASN_DEBUG_f(const char *fmt, ...);
|
||||
#define ASN_DEBUG ASN_DEBUG_f
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_SET_OF.c patch_dir/asn_SET_OF.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_SET_OF.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/asn_SET_OF.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 4,10 ****
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_SET_OF.h>
|
||||
- #include <errno.h>
|
||||
|
||||
/*
|
||||
* Add another element into the set.
|
||||
--- 4,9 ----
|
||||
***************
|
||||
*** 21,26 ****
|
||||
--- 20,27 ----
|
||||
/*
|
||||
* Make sure there's enough space to insert an element.
|
||||
*/
|
||||
+ ASN_DEBUG("SET ADD: count %d, size %d",as->count,as->size);
|
||||
+
|
||||
if(as->count == as->size) {
|
||||
int _newsize = as->size ? (as->size << 1) : 4;
|
||||
void *_new_arr;
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_system.h patch_dir/asn_system.h
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/asn_system.h 2011-03-31 10:22:57.000000000 +0200
|
||||
--- patch_dir/asn_system.h 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 13,25 ****
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
! #include <stdio.h> /* For snprintf(3) */
|
||||
! #include <stdlib.h> /* For *alloc(3) */
|
||||
! #include <string.h> /* For memcpy(3) */
|
||||
! #include <sys/types.h> /* For size_t */
|
||||
! #include <limits.h> /* For LONG_MAX */
|
||||
! #include <stdarg.h> /* For va_start */
|
||||
! #include <stddef.h> /* for offsetof and ptrdiff_t */
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
--- 13,39 ----
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
! #ifdef USER_MODE
|
||||
! #include <stdio.h> // For snprintf(3)
|
||||
! #include <stdlib.h> // For *alloc(3)
|
||||
! #include <string.h> // For memcpy(3)
|
||||
! #include <sys/types.h> // For size_t
|
||||
! #include <limits.h> // For LONG_MAX
|
||||
! #include <stdarg.h> // For va_start
|
||||
! #include <stddef.h> // for offsetof and ptrdiff_t
|
||||
! #include <errno.h> // For errno
|
||||
! #else
|
||||
! typedef char FILE;
|
||||
! #include <linux/types.h>
|
||||
! #include <linux/slab.h> // For snprintf
|
||||
! #include <linux/sort.h> // For sort
|
||||
! #define qsort(base,num,size,cmp_func) sort(base,num,size,cmp_func,NULL)
|
||||
! #include <linux/errno.h>// For errno
|
||||
! #ifndef errno
|
||||
! extern int errno;
|
||||
! #endif
|
||||
! #include "bsearch.h"
|
||||
! #endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
***************
|
||||
*** 63,69 ****
|
||||
#include <types/vxTypes.h>
|
||||
#else /* !defined(__vxworks) */
|
||||
|
||||
! #include <inttypes.h> /* C99 specifies this file */
|
||||
/*
|
||||
* 1. Earlier FreeBSD version didn't have <stdint.h>,
|
||||
* but <inttypes.h> was present.
|
||||
--- 77,85 ----
|
||||
#include <types/vxTypes.h>
|
||||
#else /* !defined(__vxworks) */
|
||||
|
||||
! #ifdef USER_MODE
|
||||
! #include <inttypes.h> /*C99 specifies this file */
|
||||
! #endif
|
||||
/*
|
||||
* 1. Earlier FreeBSD version didn't have <stdint.h>,
|
||||
* but <inttypes.h> was present.
|
||||
***************
|
||||
*** 81,91 ****
|
||||
#define inline
|
||||
#endif /* __GNUC__ */
|
||||
#else
|
||||
! #include <stdint.h> /* SUSv2+ and C99 specify this file, for uintXX_t */
|
||||
#endif /* defined(sun) */
|
||||
#endif
|
||||
|
||||
! #include <netinet/in.h> /* for ntohl() */
|
||||
#define sys_ntohl(foo) ntohl(foo)
|
||||
|
||||
#endif /* defined(__vxworks) */
|
||||
--- 97,109 ----
|
||||
#define inline
|
||||
#endif /* __GNUC__ */
|
||||
#else
|
||||
! #ifdef USER_MODE
|
||||
! #include <stdint.h> /*SUSv2+ and C99 specify this file, for uintXX_t */
|
||||
! #endif
|
||||
#endif /* defined(sun) */
|
||||
#endif
|
||||
|
||||
! /*#include <netinet/in.h> for ntohl() */
|
||||
#define sys_ntohl(foo) ntohl(foo)
|
||||
|
||||
#endif /* defined(__vxworks) */
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/ber_tlv_tag.c patch_dir/ber_tlv_tag.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/ber_tlv_tag.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/ber_tlv_tag.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 4,10 ****
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <ber_tlv_tag.h>
|
||||
- #include <errno.h>
|
||||
|
||||
ssize_t
|
||||
ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
|
||||
--- 4,9 ----
|
||||
***************
|
||||
*** 57,63 ****
|
||||
return 0; /* Want more */
|
||||
}
|
||||
|
||||
!
|
||||
ssize_t
|
||||
ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) {
|
||||
char buf[sizeof("[APPLICATION ]") + 32];
|
||||
--- 56,62 ----
|
||||
return 0; /* Want more */
|
||||
}
|
||||
|
||||
! #ifdef USER_MODE
|
||||
ssize_t
|
||||
ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) {
|
||||
char buf[sizeof("[APPLICATION ]") + 32];
|
||||
***************
|
||||
*** 71,76 ****
|
||||
--- 70,76 ----
|
||||
|
||||
return fwrite(buf, 1, ret, f);
|
||||
}
|
||||
+ #endif
|
||||
|
||||
ssize_t
|
||||
ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) {
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constraints.c patch_dir/constraints.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constraints.c 2011-03-31 10:22:57.000000000 +0200
|
||||
--- patch_dir/constraints.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 1,4 ****
|
||||
! #include "asn_internal.h"
|
||||
#include "constraints.h"
|
||||
|
||||
int
|
||||
--- 1,4 ----
|
||||
! #include <asn_internal.h>
|
||||
#include "constraints.h"
|
||||
|
||||
int
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constr_TYPE.c patch_dir/constr_TYPE.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/constr_TYPE.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/constr_TYPE.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 4,10 ****
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <constr_TYPE.h>
|
||||
- #include <errno.h>
|
||||
|
||||
/*
|
||||
* Version of the ASN.1 infrastructure shipped with compiler.
|
||||
--- 4,9 ----
|
||||
***************
|
||||
*** 29,34 ****
|
||||
--- 28,34 ----
|
||||
return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0);
|
||||
}
|
||||
|
||||
+ #ifdef USER_MODE
|
||||
/*
|
||||
* Print the target language's structure in human readable form.
|
||||
*/
|
||||
***************
|
||||
*** 75,77 ****
|
||||
--- 75,78 ----
|
||||
fprintf(stderr, "\n");
|
||||
va_end(ap);
|
||||
}
|
||||
+ #endif
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/der_encoder.c patch_dir/der_encoder.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/der_encoder.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/der_encoder.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 3,9 ****
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
- #include <errno.h>
|
||||
|
||||
static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len,
|
||||
asn_app_consume_bytes_f *cb, void *app_key, int constructed);
|
||||
--- 3,8 ----
|
||||
***************
|
||||
*** 81,89 ****
|
||||
--- 80,90 ----
|
||||
asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
ber_tlv_tag_t *tags; /* Copy of tags stream */
|
||||
+ ber_tlv_tag_t tags_array[8];
|
||||
int tags_count; /* Number of tags */
|
||||
size_t overall_length;
|
||||
ssize_t *lens;
|
||||
+ ssize_t lens_array[8];
|
||||
int i;
|
||||
|
||||
ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)",
|
||||
***************
|
||||
*** 102,111 ****
|
||||
* and initialize it appropriately.
|
||||
*/
|
||||
int stag_offset;
|
||||
! tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
|
||||
if(!tags) { /* Can fail on !x86 */
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
}
|
||||
tags_count = sd->tags_count
|
||||
+ 1 /* EXPLICIT or IMPLICIT tag is given */
|
||||
--- 103,121 ----
|
||||
* and initialize it appropriately.
|
||||
*/
|
||||
int stag_offset;
|
||||
! //tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
|
||||
! tags = &(tags_array[0]);
|
||||
! if ((sd->tags_count + 1)>=8) {
|
||||
! #ifdef USER_MODE
|
||||
! printf("der_encoder.c: ERROR tags array too small. Increase size!\n");
|
||||
! exit(-1);
|
||||
! #endif
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
! }
|
||||
if(!tags) { /* Can fail on !x86 */
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
}
|
||||
tags_count = sd->tags_count
|
||||
+ 1 /* EXPLICIT or IMPLICIT tag is given */
|
||||
***************
|
||||
*** 124,135 ****
|
||||
if(tags_count == 0)
|
||||
return 0;
|
||||
|
||||
! lens = (ssize_t *)alloca(tags_count * sizeof(lens[0]));
|
||||
if(!lens) {
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
}
|
||||
!
|
||||
/*
|
||||
* Array of tags is initialized.
|
||||
* Now, compute the size of the TLV pairs, from right to left.
|
||||
--- 134,154 ----
|
||||
if(tags_count == 0)
|
||||
return 0;
|
||||
|
||||
! //lens = (ssize_t *)alloca(tags_count * sizeof(lens[0]));
|
||||
! lens = &(lens_array[0]);
|
||||
! if (tags_count>=8) {
|
||||
! #ifdef USER_MODE
|
||||
! printf("der_encoder.c: ERROR lens array too small. Increase size!\n");
|
||||
! exit(-1);
|
||||
! #endif
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
! }
|
||||
if(!lens) {
|
||||
! errno = ENOMEM;
|
||||
! return -1;
|
||||
}
|
||||
!
|
||||
/*
|
||||
* Array of tags is initialized.
|
||||
* Now, compute the size of the TLV pairs, from right to left.
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/INTEGER.c patch_dir/INTEGER.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/INTEGER.c 2011-03-31 10:22:56.000000000 +0200
|
||||
--- patch_dir/INTEGER.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 6,12 ****
|
||||
#include <asn_internal.h>
|
||||
#include <INTEGER.h>
|
||||
#include <asn_codecs_prim.h> /* Encoder and decoder of a primitive type */
|
||||
- #include <errno.h>
|
||||
|
||||
/*
|
||||
* INTEGER basic type description.
|
||||
--- 6,11 ----
|
||||
***************
|
||||
*** 103,109 ****
|
||||
static ssize_t
|
||||
INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
! char scratch[32]; /* Enough for 64-bit integer */
|
||||
uint8_t *buf = st->buf;
|
||||
uint8_t *buf_end = st->buf + st->size;
|
||||
signed long accum;
|
||||
--- 102,108 ----
|
||||
static ssize_t
|
||||
INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
! char scratch[128];
|
||||
uint8_t *buf = st->buf;
|
||||
uint8_t *buf_end = st->buf + st->size;
|
||||
signed long accum;
|
||||
***************
|
||||
*** 142,149 ****
|
||||
--- 141,152 ----
|
||||
|
||||
el = INTEGER_map_value2enum(specs, accum);
|
||||
if(el) {
|
||||
+ scrsize = sizeof(scratch);
|
||||
+ scr = scratch;
|
||||
+ /* cannot use alloca in kernel
|
||||
scrsize = el->enum_len + 32;
|
||||
scr = (char *)alloca(scrsize);
|
||||
+ */
|
||||
if(plainOrXER == 0)
|
||||
ret = snprintf(scr, scrsize,
|
||||
"%ld (%s)", accum, el->enum_name);
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/NativeEnumerated.c patch_dir/NativeEnumerated.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/NativeEnumerated.c 2011-03-31 10:22:57.000000000 +0200
|
||||
--- patch_dir/NativeEnumerated.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 46,51 ****
|
||||
--- 46,52 ----
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er;
|
||||
+ char scratch[128];
|
||||
const long *native = (const long *)sptr;
|
||||
const asn_INTEGER_enum_map_t *el;
|
||||
|
||||
***************
|
||||
*** 57,63 ****
|
||||
el = INTEGER_map_value2enum(specs, *native);
|
||||
if(el) {
|
||||
size_t srcsize = el->enum_len + 5;
|
||||
! char *src = (char *)alloca(srcsize);
|
||||
|
||||
er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name);
|
||||
assert(er.encoded > 0 && (size_t)er.encoded < srcsize);
|
||||
--- 58,64 ----
|
||||
el = INTEGER_map_value2enum(specs, *native);
|
||||
if(el) {
|
||||
size_t srcsize = el->enum_len + 5;
|
||||
! char *src = (char *)scratch; //alloca(srcsize);
|
||||
|
||||
er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name);
|
||||
assert(er.encoded > 0 && (size_t)er.encoded < srcsize);
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/OCTET_STRING.c patch_dir/OCTET_STRING.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/OCTET_STRING.c 2011-03-31 10:22:55.000000000 +0200
|
||||
--- patch_dir/OCTET_STRING.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 6,12 ****
|
||||
#include <asn_internal.h>
|
||||
#include <OCTET_STRING.h>
|
||||
#include <BIT_STRING.h> /* for .bits_unused member */
|
||||
- #include <errno.h>
|
||||
|
||||
/*
|
||||
* OCTET STRING basic type description.
|
||||
--- 6,11 ----
|
||||
diff -cB /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/xer_encoder.c patch_dir/xer_encoder.c
|
||||
*** /homes/kaltenbe/Devel/openair/openair_branches/openair_lte/openair2/RRC/LITE/MESSAGES/asn1c/asn1c/skeletons/xer_encoder.c 2011-04-11 18:03:26.000000000 +0200
|
||||
--- patch_dir/xer_encoder.c 2011-05-31 10:28:26.000000000 +0200
|
||||
***************
|
||||
*** 3,10 ****
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
! #include <stdio.h>
|
||||
! #include <errno.h>
|
||||
|
||||
/*
|
||||
* The XER encoder of any type. May be invoked by the application.
|
||||
--- 3,10 ----
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
! //#include <stdio.h>
|
||||
! //#include <errno.h>
|
||||
|
||||
/*
|
||||
* The XER encoder of any type. May be invoked by the application.
|
||||
***************
|
||||
*** 41,46 ****
|
||||
--- 41,47 ----
|
||||
* This is a helper function for xer_fprint, which directs all incoming data
|
||||
* into the provided file descriptor.
|
||||
*/
|
||||
+ #ifdef USER_MODE
|
||||
static int
|
||||
xer__print2fp(const void *buffer, size_t size, void *app_key) {
|
||||
FILE *stream = (FILE *)app_key;
|
||||
***************
|
||||
*** 65,67 ****
|
||||
--- 66,69 ----
|
||||
|
||||
return fflush(stream);
|
||||
}
|
||||
+ #endif
|
||||
@@ -393,15 +393,7 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
|
||||
init_SI_UE(&ctxt,eNB_index);
|
||||
LOG_D(RRC,PROTOCOL_RRC_CTXT_FMT" INIT: phy_sync_2_ch_ind\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(&ctxt));
|
||||
#ifndef NO_RRM
|
||||
send_msg(&S_rrc,msg_rrc_phy_synch_to_CH_ind(ctxt.module_id,eNB_index,UE_rrc_inst[ctxt.module_id].Mac_id));
|
||||
#endif
|
||||
#ifndef NO_RRM
|
||||
send_msg(&S_rrc,msg_rrc_phy_synch_to_CH_ind(ctxt.module_id,eNB_index,UE_rrc_inst[ctxt.module_id].Mac_id));
|
||||
#endif
|
||||
#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH
|
||||
openair_rrc_on_ue(&ctxt);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2249,9 +2241,6 @@ rrc_ue_decode_dcch(
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_RRM
|
||||
send_msg(&S_rrc,msg_rrc_end_scan_req(ctxt_pP->module_id,eNB_indexP));
|
||||
#endif
|
||||
}
|
||||
|
||||
const char siWindowLength[9][5] = {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","80ms","ERR"};
|
||||
@@ -2530,14 +2519,6 @@ int decode_BCCH_MBMS_DLSCH_Message(
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
/*if ((rrc_get_sub_state(ctxt_pP->module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE)
|
||||
#if defined(ENABLE_USE_MME)
|
||||
&& (UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL)
|
||||
#endif
|
||||
) {
|
||||
rrc_ue_generate_RRCConnectionRequest(ctxt_pP, 0);
|
||||
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING );
|
||||
}*/
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT );
|
||||
return 0;
|
||||
}
|
||||
@@ -2969,6 +2950,12 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength];
|
||||
LOG_I( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
|
||||
ctxt_pP->module_id, eNB_index, ctxt_pP->module_id );
|
||||
/* pointers to SIperiod inthe Info struct points to a packed structure
|
||||
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
|
||||
* gcc, from v9, now warns about it. fix these warnings by removing the indirection on data
|
||||
* Not sure if SiPeriod can be modified, reassign after function call for security
|
||||
*/
|
||||
uint16_t Aligned_SIperiod = UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod;
|
||||
rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index,
|
||||
(LTE_RadioResourceConfigCommonSIB_t *)NULL,
|
||||
(struct LTE_PhysicalConfigDedicated *)NULL,
|
||||
@@ -2981,7 +2968,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
|
||||
UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config,
|
||||
(LTE_MobilityControlInfo_t *) NULL,
|
||||
&UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize,
|
||||
&UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod,
|
||||
&Aligned_SIperiod,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -2995,6 +2982,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
|
||||
(struct LTE_NonMBSFN_SubframeConfig_r14 *)NULL,
|
||||
(LTE_MBSFN_AreaInfoList_r9_t *)NULL
|
||||
);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod=Aligned_SIperiod;
|
||||
LOG_I(RRC,"Setting SIStatus bit 0 to 1\n");
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = sib1->systemInfoValueTag;
|
||||
|
||||
@@ -173,13 +173,6 @@ extern pthread_mutex_t slrb_mutex;
|
||||
//the thread function
|
||||
void *send_UE_status_notification(void *);
|
||||
|
||||
|
||||
|
||||
//#include "COMMON/openair_defs.h"
|
||||
#ifndef USER_MODE
|
||||
//#include <rtai.h>
|
||||
#endif
|
||||
|
||||
#include "LTE_SystemInformationBlockType1.h"
|
||||
#include "LTE_SystemInformation.h"
|
||||
#include "LTE_RRCConnectionReconfiguration.h"
|
||||
@@ -217,12 +210,6 @@ void *send_UE_status_notification(void *);
|
||||
#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE
|
||||
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
|
||||
|
||||
#ifndef NO_RRM
|
||||
#include "L3_rrc_interface.h"
|
||||
#include "rrc_rrm_msg.h"
|
||||
#include "rrc_rrm_interface.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
@@ -364,7 +351,7 @@ typedef struct UE_RRC_INFO_s {
|
||||
uint8_t SIwindowsize_MBMS; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
|
||||
uint8_t handoverTarget;
|
||||
HO_STATE_t ho_state;
|
||||
uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120
|
||||
uint16_t SIperiod ; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120
|
||||
uint16_t SIperiod_MBMS; //!< Corresponds to the SIB1-MBMS si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 TODO
|
||||
unsigned short UE_index;
|
||||
uint32_t T300_active;
|
||||
|
||||
@@ -3293,6 +3293,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
|
||||
|
||||
if (rrc_inst->nr_scg_ssb_freq > 2016666) //FR2
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz120;
|
||||
else
|
||||
@@ -3618,9 +3619,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
, (LTE_PMCH_InfoList_r9_t *) NULL
|
||||
#endif
|
||||
, NULL);
|
||||
|
||||
/* Refresh SRBs/DRBs */
|
||||
@@ -3629,11 +3628,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
||||
*SRB_configList2, // NULL,
|
||||
*DRB_configList,
|
||||
NULL
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
, (LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
0,
|
||||
0
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6331,9 +6328,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
, (LTE_PMCH_InfoList_r9_t *) NULL
|
||||
#endif
|
||||
, NULL);
|
||||
|
||||
/* Refresh SRBs/DRBs */
|
||||
@@ -6342,11 +6337,9 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
|
||||
*SRB_configList2, // NULL,
|
||||
*DRB_configList,
|
||||
NULL
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
, (LTE_PMCH_InfoList_r9_t *) NULL,
|
||||
0,
|
||||
0
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7287,9 +7280,6 @@ rrc_eNB_decode_ccch(
|
||||
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
|
||||
ue_context_p->ue_context.reestablishment_cause);
|
||||
#ifndef NO_RRM
|
||||
send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
|
||||
#else
|
||||
ue_context_p->ue_context.primaryCC_id = CC_id;
|
||||
//LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
|
||||
Idx = DCCH;
|
||||
@@ -7343,7 +7333,6 @@ rrc_eNB_decode_ccch(
|
||||
);
|
||||
}
|
||||
|
||||
#endif //NO_RRM
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -7532,9 +7521,6 @@ rrc_eNB_decode_ccch(
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_RRM
|
||||
send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
|
||||
#else
|
||||
ue_context_p->ue_context.primaryCC_id = CC_id;
|
||||
//LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
|
||||
Idx = DCCH;
|
||||
@@ -7587,7 +7573,6 @@ rrc_eNB_decode_ccch(
|
||||
);
|
||||
}
|
||||
|
||||
#endif //NO_RRM
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*!
|
||||
*******************************************************************************
|
||||
|
||||
\file rrm_sock.c
|
||||
|
||||
\brief RRM (Radio Ressource Manager ) Socket: communication withe other medium:
|
||||
- RRC ,
|
||||
- CMM ,
|
||||
- PUSU
|
||||
|
||||
\author BURLOT Pascal
|
||||
|
||||
\date 10/07/08
|
||||
|
||||
|
||||
\par Historique:
|
||||
P.BURLOT 2009-01-20
|
||||
+ send a message via fifo:
|
||||
- sending header
|
||||
- and data if any
|
||||
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef RRC_RRM_FIFOS_XFACE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#else
|
||||
|
||||
#include<rtai_fifos.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "rrc_rrm_interface.h"
|
||||
#include "defs.h"
|
||||
//! \brief Taille maximale de la charge utile
|
||||
#define SIZE_MAX_PAYLOAD 2048
|
||||
//! \brief PID de l'espace utilisateur (Netlink mode)
|
||||
//#define PID_USERSPACE 0xAA
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef RRC_RRM_FIFOS_XFACE
|
||||
|
||||
/*!
|
||||
*******************************************************************************
|
||||
\brief This function opens a unix socket for the rrm communication
|
||||
\return The return value is a socket handle
|
||||
*/
|
||||
int open_socket(
|
||||
sock_rrm_t *s, ///< socket descriptor
|
||||
char *path_local, ///< local socket path if unix socket
|
||||
char *path_dest, ///< host Socket path if unix socket
|
||||
int rrm_inst ///< instance of the rrm entity
|
||||
) {
|
||||
/* Unix socket */
|
||||
int socket_fd ;
|
||||
int len ;
|
||||
|
||||
if ((socket_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
|
||||
perror("unix socket");
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
memset(&(s->un_local_addr), 0, sizeof(struct sockaddr_un));
|
||||
s->un_local_addr.sun_family = AF_UNIX;
|
||||
sprintf(s->un_local_addr.sun_path,"%s%d", path_local, rrm_inst );
|
||||
unlink(s->un_local_addr.sun_path);
|
||||
msg("local %s\n",s->un_local_addr.sun_path);
|
||||
len = strlen((s->un_local_addr).sun_path) + sizeof((s->un_local_addr).sun_family);
|
||||
|
||||
if (bind(socket_fd, (struct sockaddr *)&(s->un_local_addr), len) == -1) {
|
||||
perror("bind");
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
memset(&(s->un_dest_addr), 0, sizeof(struct sockaddr_un));
|
||||
s->un_dest_addr.sun_family = AF_UNIX;
|
||||
sprintf(s->un_dest_addr.sun_path,"%s%d", path_dest, rrm_inst );
|
||||
msg("Dest %s\n",s->un_dest_addr.sun_path);
|
||||
s->s = socket_fd ;
|
||||
return socket_fd ;
|
||||
}
|
||||
/*!
|
||||
*******************************************************************************
|
||||
\brief This function closes a RRM socket
|
||||
\return none
|
||||
*/
|
||||
void close_socket(
|
||||
sock_rrm_t *sock ///< the socket handle
|
||||
) {
|
||||
shutdown(sock->s, SHUT_RDWR);
|
||||
close(sock->s);
|
||||
}
|
||||
|
||||
/*!
|
||||
*******************************************************************************
|
||||
\brief This function send a buffer message to the unix socket
|
||||
\return if OK then "0" is returned else "-1"
|
||||
*/
|
||||
char BUFF[2048];
|
||||
int send_msg_sock(
|
||||
sock_rrm_t *s, ///< socket descriptor
|
||||
msg_t *smsg ///< the message to send
|
||||
) {
|
||||
/* Unix socket */
|
||||
int ret = 0 ;
|
||||
// char *buf = NULL;
|
||||
struct msghdr msghd ;
|
||||
struct iovec iov;
|
||||
int taille = sizeof(msg_head_t) ;
|
||||
|
||||
if ( smsg == NULL ) {
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
if ( smsg->data != NULL ) {
|
||||
taille += smsg->head.size ;
|
||||
}
|
||||
|
||||
//buf = RRM_MALLOC(char, taille);
|
||||
//if (buf ==NULL)
|
||||
//return -1 ;
|
||||
memcpy( BUFF, &(smsg->head), sizeof(msg_head_t) ) ;
|
||||
memcpy( BUFF+sizeof(msg_head_t), smsg->data, smsg->head.size ) ;
|
||||
iov.iov_base = (void *)BUFF;
|
||||
iov.iov_len = taille ;
|
||||
msghd.msg_name = (void *)&(s->un_dest_addr);
|
||||
msghd.msg_namelen = sizeof(s->un_dest_addr);
|
||||
msghd.msg_iov = &iov;
|
||||
msghd.msg_iovlen = 1;
|
||||
msghd.msg_control = NULL ;
|
||||
msghd.msg_controllen = 0 ;
|
||||
|
||||
if ( sendmsg(s->s, &msghd, 0) < 0 ) {
|
||||
ret = -1;
|
||||
msg("socket %d, dest %s\n",s->s,s->un_dest_addr.sun_path);
|
||||
perror("sendmsg:unix socket");
|
||||
}
|
||||
|
||||
//RRM_FREE(buf) ;
|
||||
//RRM_FREE(msg->data) ;
|
||||
//RRM_FREE(msg) ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
/*!
|
||||
*******************************************************************************
|
||||
\brief This function read a buffer from a unix socket
|
||||
\return the function returns a message pointer. If the pointeur is NULL, a error
|
||||
is happened.
|
||||
*/
|
||||
char *recv_msg(
|
||||
sock_rrm_t *s ///< socket descriptor
|
||||
) {
|
||||
/* Unix socket */
|
||||
char *buf = NULL;
|
||||
char *smsg = NULL;
|
||||
struct msghdr msghd ;
|
||||
struct iovec iov;
|
||||
int size_msg ;
|
||||
msg_head_t *head ;
|
||||
int ret ;
|
||||
int taille = SIZE_MAX_PAYLOAD ;
|
||||
buf = RRM_CALLOC( char,taille);
|
||||
|
||||
if ( buf == NULL ) {
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
iov.iov_base = (void *)buf;
|
||||
iov.iov_len = taille ;
|
||||
msghd.msg_name = (void *)&(s->un_dest_addr);
|
||||
msghd.msg_namelen = sizeof(s->un_dest_addr);
|
||||
msghd.msg_iov = &iov;
|
||||
msghd.msg_iovlen = 1;
|
||||
msghd.msg_control = NULL ;
|
||||
msghd.msg_controllen= 0 ;
|
||||
ret = recvmsg(s->s, &msghd, 0 ) ;
|
||||
|
||||
if ( ret <= 0 ) {
|
||||
// non-blocking socket
|
||||
// perror("PB recvmsg_un");
|
||||
RRM_FREE(buf);
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
if (msghd.msg_flags != 0 ) {
|
||||
fprintf(stderr,"error recvmsg_un: 0x%02x\n", msghd.msg_flags) ;
|
||||
RRM_FREE(buf);
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
head = (msg_head_t *) buf ;
|
||||
size_msg = sizeof(msg_head_t) + head->size ;
|
||||
smsg = RRM_CALLOC(char, size_msg ) ;
|
||||
|
||||
if ( smsg != NULL ) {
|
||||
memcpy( smsg, buf, size_msg ) ;
|
||||
}
|
||||
|
||||
RRM_FREE( buf ) ;
|
||||
return smsg ;
|
||||
}
|
||||
|
||||
#else //XFACE
|
||||
|
||||
int send_msg_fifo(int *s, msg_t *fmsg) {
|
||||
int ret = 0, ret1;
|
||||
int taille = sizeof(msg_head_t) ;
|
||||
msg("write on fifos %d, msg %p\n",*s,fmsg);
|
||||
|
||||
if ( fmsg == NULL ) {
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
// envoi le header
|
||||
ret1 = rtf_put (*s,(char *) &(fmsg->head), taille);
|
||||
|
||||
if(ret1 <0) {
|
||||
msg("rtf_put H ERR %d\n",ret1);
|
||||
rtf_reset(*s);
|
||||
return ret1;
|
||||
}
|
||||
|
||||
ret=ret1;
|
||||
|
||||
// envoi les datas si elles sont definis
|
||||
if ( fmsg->data != NULL ) {
|
||||
ret1 += rtf_put (*s,(char *) fmsg->data, fmsg->head.size);
|
||||
|
||||
if(ret1 <0) {
|
||||
msg("rtf_put D ERR %d\n",ret1);
|
||||
rtf_reset(*s);
|
||||
return ret1;
|
||||
}
|
||||
}
|
||||
|
||||
ret+=ret1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif //XFACE
|
||||
|
||||
int send_msg(void *s, msg_t *smsg) {
|
||||
send_msg_sock((sock_rrm_t *)s, smsg);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ nr_rrc_data_req(
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
}
|
||||
|
||||
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
int mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
@@ -286,7 +286,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, rnti %x\n",rnti);
|
||||
char payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
|
||||
int payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
|
||||
|
||||
// check if data is there for MAC
|
||||
if (payload_size > 0) {
|
||||
@@ -366,10 +366,10 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
|
||||
}
|
||||
|
||||
void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP) {
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP) {
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
ue_context_p = rrc_gNB_get_ue_context(
|
||||
RC.nrrrc[Mod_instP],
|
||||
|
||||
@@ -72,6 +72,8 @@
|
||||
#include "NR_RRCReestablishmentRequest.h"
|
||||
#include "NR_UE-CapabilityRequestFilterNR.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#if defined(NR_Rel16)
|
||||
#include "NR_SCS-SpecificCarrier.h"
|
||||
#include "NR_TDD-UL-DL-ConfigCommon.h"
|
||||
@@ -133,18 +135,6 @@
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
//#include "PHY/defs.h"
|
||||
/*#ifndef USER_MODE
|
||||
#define msg printk
|
||||
#ifndef errno
|
||||
int errno;
|
||||
#endif
|
||||
#else
|
||||
# if !defined (msg)
|
||||
# define msg printf
|
||||
# endif
|
||||
#endif*/
|
||||
|
||||
//#define XER_PRINT
|
||||
|
||||
typedef struct xer_sprint_string_s {
|
||||
@@ -1002,6 +992,8 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
rrc_gNB_carrier_data_t *carrier) {
|
||||
|
||||
int uid=rnti&15;
|
||||
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
|
||||
SpCellConfig->servCellIndex = NULL;
|
||||
SpCellConfig->reconfigurationWithSync = NULL;
|
||||
SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL;
|
||||
@@ -1017,6 +1009,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList));
|
||||
pucch_Config->resourceSetToReleaseList = NULL;
|
||||
NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0));
|
||||
NR_PUCCH_ResourceSet_t *pucchresset1=calloc(1,sizeof(*pucchresset1));
|
||||
pucchresset0->pucch_ResourceSetId = 0;
|
||||
NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0));
|
||||
*pucchresset0id0=0;
|
||||
@@ -1024,13 +1017,22 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
pucchresset0->maxPayloadSize=NULL;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0);
|
||||
|
||||
pucchresset1->pucch_ResourceSetId = 1;
|
||||
NR_PUCCH_ResourceId_t *pucchresset1id0=calloc(1,sizeof(*pucchresset1id0));
|
||||
*pucchresset1id0=1;
|
||||
ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0);
|
||||
pucchresset1->maxPayloadSize=NULL;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1);
|
||||
|
||||
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->startingPRB=0;
|
||||
pucchres0->startingPRB=(8+rnti) % curr_bwp;
|
||||
LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp);
|
||||
pucchres0->intraSlotFrequencyHopping=NULL;
|
||||
pucchres0->secondHopPRB=NULL;
|
||||
pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0;
|
||||
@@ -1039,6 +1041,50 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
pucchres0->format.choice.format0->nrofSymbols=1;
|
||||
pucchres0->format.choice.format0->startingSymbolIndex=13;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0);
|
||||
|
||||
NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2));
|
||||
pucchres2->pucch_ResourceId=1;
|
||||
pucchres2->startingPRB=0;
|
||||
pucchres2->intraSlotFrequencyHopping=NULL;
|
||||
pucchres2->secondHopPRB=NULL;
|
||||
pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2;
|
||||
pucchres2->format.choice.format2=calloc(1,sizeof(*pucchres2->format.choice.format2));
|
||||
pucchres2->format.choice.format2->nrofPRBs=8;
|
||||
pucchres2->format.choice.format2->nrofSymbols=1;
|
||||
pucchres2->format.choice.format2->startingSymbolIndex=13;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2);
|
||||
|
||||
pucch_Config->format2=calloc(1,sizeof(*pucch_Config->format2));
|
||||
pucch_Config->format2->present=NR_SetupRelease_PUCCH_FormatConfig_PR_setup;
|
||||
NR_PUCCH_FormatConfig_t *pucchfmt2 = calloc(1,sizeof(*pucchfmt2));
|
||||
pucch_Config->format2->choice.setup = pucchfmt2;
|
||||
pucchfmt2->interslotFrequencyHopping=NULL;
|
||||
pucchfmt2->additionalDMRS=NULL;
|
||||
pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate));
|
||||
*pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot35;
|
||||
pucchfmt2->nrofSlots=NULL;
|
||||
pucchfmt2->pi2BPSK=NULL;
|
||||
pucchfmt2->simultaneousHARQ_ACK_CSI=calloc(1,sizeof(*pucchfmt2->simultaneousHARQ_ACK_CSI));
|
||||
*pucchfmt2->simultaneousHARQ_ACK_CSI=NR_PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
|
||||
|
||||
pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
|
||||
NR_PUCCH_SpatialRelationInfo_t *pucchspatial = calloc(1,sizeof(*pucchspatial));
|
||||
pucchspatial->pucch_SpatialRelationInfoId = 1;
|
||||
pucchspatial->servingCellId = NULL;
|
||||
if(carrier->do_CSIRS) {
|
||||
pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index;
|
||||
pucchspatial->referenceSignal.choice.csi_RS_Index = 0;
|
||||
}
|
||||
else {
|
||||
pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_ssb_Index;
|
||||
pucchspatial->referenceSignal.choice.ssb_Index = 0;
|
||||
}
|
||||
pucchspatial->pucch_PathlossReferenceRS_Id = 0;
|
||||
pucchspatial->p0_PUCCH_Id = 1;
|
||||
pucchspatial->closedLoopIndex = NR_PUCCH_SpatialRelationInfo__closedLoopIndex_i0;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial);
|
||||
|
||||
|
||||
initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config));
|
||||
initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup;
|
||||
NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config));
|
||||
@@ -1167,31 +1213,28 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index=0;
|
||||
ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0);
|
||||
|
||||
|
||||
|
||||
if (0) {
|
||||
// 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 3 UEs on this resource (1 1/2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 7,8,9).
|
||||
// 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 = 8+(10*((rnti>>1)&3)) + (rnti&1);
|
||||
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
|
||||
*schedulingRequestResourceConfig->resource = 0;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
|
||||
}
|
||||
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 3 UEs on this resource (1 1/2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 7,8,9).
|
||||
// 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 = 8;
|
||||
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
|
||||
*schedulingRequestResourceConfig->resource = 0;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
|
||||
|
||||
pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK));
|
||||
long *delay[8];
|
||||
for (int i=0;i<8;i++) {
|
||||
@@ -1218,7 +1261,6 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
// options are 24, 48 or 96
|
||||
coreset->frequencyDomainResources.buf = calloc(1,6);
|
||||
if (0) {
|
||||
int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
if (curr_bwp < 48)
|
||||
coreset->frequencyDomainResources.buf[0] = 0xf0;
|
||||
else
|
||||
@@ -1317,6 +1359,234 @@ void fill_initial_SpCellConfig(rnti_t rnti,
|
||||
NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1,sizeof(*pdsch_servingcellconfig));
|
||||
SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup;
|
||||
SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig;
|
||||
|
||||
if (carrier->do_CSIRS) {
|
||||
|
||||
SpCellConfig->spCellConfigDedicated->csi_MeasConfig=calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->csi_MeasConfig));
|
||||
SpCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup;
|
||||
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1,sizeof(*csi_MeasConfig));
|
||||
SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig;
|
||||
|
||||
if (carrier->pdsch_AntennaPorts > 1) {
|
||||
csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList));
|
||||
NR_CSI_IM_Resource_t *imres0 = calloc(1,sizeof(*imres0));
|
||||
imres0->csi_IM_ResourceId = 0;
|
||||
imres0->csi_IM_ResourceElementPattern = calloc(1,sizeof(*imres0->csi_IM_ResourceElementPattern));
|
||||
imres0->csi_IM_ResourceElementPattern->present = NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern1;
|
||||
imres0->csi_IM_ResourceElementPattern->choice.pattern1 = calloc(1,sizeof(*imres0->csi_IM_ResourceElementPattern->choice.pattern1));
|
||||
imres0->csi_IM_ResourceElementPattern->choice.pattern1->subcarrierLocation_p1 = NR_CSI_IM_Resource__csi_IM_ResourceElementPattern__pattern1__subcarrierLocation_p1_s4;
|
||||
imres0->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1 = 6;
|
||||
imres0->freqBand = calloc(1,sizeof(*imres0->freqBand));
|
||||
imres0->freqBand->startingRB = 0;
|
||||
imres0->freqBand->nrofRBs = 108;
|
||||
imres0->periodicityAndOffset = calloc(1,sizeof(*imres0->periodicityAndOffset));
|
||||
imres0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320;
|
||||
imres0->periodicityAndOffset->choice.slots320 = 0;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceToAddModList->list,imres0);
|
||||
csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList));
|
||||
NR_CSI_IM_ResourceSet_t *imset0 = calloc(1,sizeof(*imset0));
|
||||
imset0->csi_IM_ResourceSetId = 0;
|
||||
NR_CSI_IM_ResourceId_t *res0 = calloc(1,sizeof(*res0));
|
||||
*res0 = 0;
|
||||
ASN_SEQUENCE_ADD(&imset0->csi_IM_Resources,res0);
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceSetToAddModList->list,imset0);
|
||||
}
|
||||
else {
|
||||
csi_MeasConfig->csi_IM_ResourceToAddModList = NULL;
|
||||
csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL;
|
||||
}
|
||||
|
||||
csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL;
|
||||
csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL;
|
||||
|
||||
csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList));
|
||||
NR_NZP_CSI_RS_ResourceSet_t *nzpcsirs0 = calloc(1,sizeof(*nzpcsirs0));
|
||||
nzpcsirs0->nzp_CSI_ResourceSetId = 0;
|
||||
NR_NZP_CSI_RS_ResourceId_t *nzpid0 = calloc(1,sizeof(*nzpid0));
|
||||
*nzpid0 = 0;
|
||||
ASN_SEQUENCE_ADD(&nzpcsirs0->nzp_CSI_RS_Resources,nzpid0);
|
||||
nzpcsirs0->repetition = NULL;
|
||||
nzpcsirs0->aperiodicTriggeringOffset = NULL;
|
||||
nzpcsirs0->trs_Info = NULL;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpcsirs0);
|
||||
|
||||
csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL;
|
||||
|
||||
config_csirs(scc, csi_MeasConfig,carrier->pdsch_AntennaPorts,curr_bwp,carrier->do_CSIRS);
|
||||
|
||||
csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList));
|
||||
csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL;
|
||||
|
||||
NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0));
|
||||
ssbresset0->csi_SSB_ResourceSetId=0;
|
||||
|
||||
uint64_t bitmap=0;
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
bitmap = ((uint64_t) scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0])<<56;
|
||||
break;
|
||||
case 2 :
|
||||
bitmap = ((uint64_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0])<<56;
|
||||
break;
|
||||
case 3 :
|
||||
for (int i=0; i<8; i++) {
|
||||
bitmap |= (((uint64_t) scc->ssb_PositionsInBurst->choice.longBitmap.buf[i])<<((7-i)*8));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present);
|
||||
}
|
||||
|
||||
NR_SSB_Index_t *ssbresset[64];
|
||||
for (int i=0;i<64;i++) {
|
||||
if ((bitmap>>(63-i))&0x01){
|
||||
ssbresset[i]=calloc(1,sizeof(*ssbresset[i]));
|
||||
*ssbresset[i] = i;
|
||||
ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset[i]);
|
||||
}
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0);
|
||||
|
||||
csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList));
|
||||
|
||||
csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL;
|
||||
NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0));
|
||||
csires0->csi_ResourceConfigId=0;
|
||||
csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
|
||||
csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
|
||||
csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
|
||||
NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1,sizeof(*nzp0));
|
||||
*nzp0 = 0;
|
||||
ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,nzp0);
|
||||
csires0->bwp_Id = 0;
|
||||
csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0);
|
||||
|
||||
|
||||
NR_CSI_ResourceConfig_t *csires1 = calloc(1,sizeof(*csires1));
|
||||
csires1->csi_ResourceConfigId=1;
|
||||
csires1->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
|
||||
csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
|
||||
csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList));
|
||||
NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00));
|
||||
*ssbres00 = 0;
|
||||
ASN_SEQUENCE_ADD(&csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00);
|
||||
csires1->bwp_Id = 0;
|
||||
csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires1);
|
||||
|
||||
if (carrier->pdsch_AntennaPorts > 1) {
|
||||
NR_CSI_ResourceConfig_t *csires2 = calloc(1,sizeof(*csires2));
|
||||
csires2->csi_ResourceConfigId=2;
|
||||
csires2->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList;
|
||||
csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList = calloc(1,sizeof(*csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList));
|
||||
NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1,sizeof(*csiim00));
|
||||
*csiim00 = 0;
|
||||
ASN_SEQUENCE_ADD(&csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list,csiim00);
|
||||
csires2->bwp_Id=0;
|
||||
csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2);
|
||||
}
|
||||
|
||||
NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1));
|
||||
pucchcsires1->uplinkBandwidthPartId=0;
|
||||
pucchcsires1->pucch_Resource=1;
|
||||
csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList));
|
||||
csi_MeasConfig->csi_ReportConfigToReleaseList = NULL;
|
||||
if (carrier->pdsch_AntennaPorts > 1) {
|
||||
LOG_I(NR_RRC,"Filling CSI Report Config for RI_PMI_CQI\n");
|
||||
NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1));
|
||||
csirep1->reportConfigId=0;
|
||||
csirep1->carrier=NULL;
|
||||
csirep1->resourcesForChannelMeasurement=0;
|
||||
csirep1->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep1->csi_IM_ResourcesForInterference));
|
||||
*csirep1->csi_IM_ResourcesForInterference=2;
|
||||
csirep1->nzp_CSI_RS_ResourcesForInterference=NULL;
|
||||
csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic;
|
||||
csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic));
|
||||
csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320;
|
||||
csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 8 + (20 * uid) % 320;
|
||||
ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1);
|
||||
csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI;
|
||||
csirep1->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0;
|
||||
csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration));
|
||||
csirep1->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->cqi_FormatIndicator));
|
||||
*csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI;
|
||||
csirep1->reportFreqConfiguration->pmi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->pmi_FormatIndicator));
|
||||
*csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI;
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand = NULL;
|
||||
/*calloc(1,sizeof(*csirep1->reportFreqConfiguration->csi_ReportingBand));
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand->present = NR_CSI_ReportConfig__reportFreqConfiguration__csi_ReportingBand_PR_subbands7;
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.size=1;
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.bits_unused=1;
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf=malloc(1);
|
||||
csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf[0]=254;*/
|
||||
csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_notConfigured;
|
||||
csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_notConfigured;
|
||||
csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig));
|
||||
csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1;
|
||||
csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1));
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel));
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=
|
||||
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two=
|
||||
calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two));
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1);
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1);
|
||||
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0x03;
|
||||
csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1;
|
||||
csirep1->dummy = NULL;
|
||||
csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled;
|
||||
csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled));
|
||||
//csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS));
|
||||
//*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1;
|
||||
csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table));
|
||||
*csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1;
|
||||
csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value2;
|
||||
csirep1->non_PMI_PortIndication = NULL;
|
||||
csirep1->ext1 = NULL;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1);
|
||||
}
|
||||
|
||||
LOG_I(NR_RRC,"Filling CSI Report Config for CRI_RSRP\n");
|
||||
NR_CSI_ReportConfig_t *csirep2 = calloc(1,sizeof(*csirep2));
|
||||
csirep2->reportConfigId=1;
|
||||
csirep2->carrier=NULL;
|
||||
csirep2->resourcesForChannelMeasurement=0;
|
||||
csirep2->csi_IM_ResourcesForInterference=NULL;
|
||||
csirep2->nzp_CSI_RS_ResourcesForInterference=NULL;
|
||||
csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic;
|
||||
csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic));
|
||||
csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320;
|
||||
csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 28 + (20 * uid) % 320;
|
||||
ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1);
|
||||
csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP;
|
||||
csirep2->reportQuantity.choice.cri_RSRP=(NULL_t)0;
|
||||
csirep2->reportFreqConfiguration = calloc(1,sizeof(*csirep2->reportFreqConfiguration));
|
||||
csirep2->reportFreqConfiguration->cqi_FormatIndicator = NULL;
|
||||
csirep2->reportFreqConfiguration->pmi_FormatIndicator=NULL;
|
||||
csirep2->reportFreqConfiguration->csi_ReportingBand=NULL;
|
||||
csirep2->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured;
|
||||
csirep2->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured;
|
||||
csirep2->codebookConfig=NULL;
|
||||
csirep2->dummy = NULL;
|
||||
csirep2->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled;
|
||||
csirep2->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled));
|
||||
csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS));
|
||||
*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1;
|
||||
csirep2->cqi_Table = NULL;
|
||||
csirep2->subbandSize = NR_CSI_ReportConfig__subbandSize_value1;
|
||||
csirep2->non_PMI_PortIndication = NULL;
|
||||
csirep2->ext1 = NULL;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep2);
|
||||
}
|
||||
pdsch_servingcellconfig->codeBlockGroupTransmission = NULL;
|
||||
pdsch_servingcellconfig->xOverhead = NULL;
|
||||
pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = calloc(1, sizeof(*pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH));
|
||||
@@ -1519,7 +1789,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
OCTET_STRING_t *masterCellGroup_from_DU,
|
||||
@@ -1534,7 +1804,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
NR_SRB_ToAddMod_t *SRB1_config = NULL;
|
||||
NR_PDCP_Config_t *pdcp_Config = NULL;
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
char masterCellGroup_buf[1000];
|
||||
char masterCellGroup_buf[3000];
|
||||
|
||||
AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n");
|
||||
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
||||
@@ -1597,7 +1867,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
masterCellGroup_buf,
|
||||
1000);
|
||||
3000);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
@@ -1628,7 +1898,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
|
||||
LOG_I(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
|
||||
enc_rval.encoded,(enc_rval.encoded+7)/8);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
|
||||
|
||||
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,
|
||||
int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
OCTET_STRING_t *masterCellGroup_from_DU,
|
||||
|
||||
@@ -213,7 +213,7 @@ typedef struct HANDOVER_INFO_NR_s {
|
||||
typedef struct {
|
||||
char Payload[NR_RRC_BUFFER_SIZE_MAX];
|
||||
char Header[NR_RRC_HEADER_SIZE_MAX];
|
||||
char payload_size;
|
||||
int payload_size;
|
||||
} NR_RRC_BUFFER;
|
||||
|
||||
#define NR_RRC_BUFFER_SIZE sizeof(RRC_BUFFER_NR)
|
||||
@@ -286,10 +286,10 @@ typedef struct gNB_RRC_UE_s {
|
||||
NR_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
|
||||
uint8_t DRB_active[8];
|
||||
|
||||
SRB_INFO SI;
|
||||
SRB_INFO Srb0;
|
||||
SRB_INFO_TABLE_ENTRY Srb1;
|
||||
SRB_INFO_TABLE_ENTRY Srb2;
|
||||
NR_SRB_INFO SI;
|
||||
NR_SRB_INFO Srb0;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb1;
|
||||
NR_SRB_INFO_TABLE_ENTRY Srb2;
|
||||
NR_MeasConfig_t *measConfig;
|
||||
HANDOVER_INFO *handover_info;
|
||||
NR_MeasResults_t *measResults;
|
||||
@@ -455,7 +455,6 @@ typedef struct {
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
|
||||
NR_SRB_INFO SI;
|
||||
NR_SRB_INFO Srb0;
|
||||
int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS];
|
||||
int p_gNB;
|
||||
|
||||
} rrc_gNB_carrier_data_t;
|
||||
|
||||
@@ -47,7 +47,7 @@ void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
|
||||
uint8_t Lchan_type,
|
||||
uint8_t Role);
|
||||
|
||||
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
int mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
@@ -80,10 +80,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
int servCellIndex,
|
||||
int dl_antenna_ports,
|
||||
int do_csirs,
|
||||
int initial_csi_index,
|
||||
int uid);
|
||||
|
||||
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int dl_antenna_ports, int do_csirs);
|
||||
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
int dl_antenna_ports,
|
||||
int curr_bwp,
|
||||
int do_csirs);
|
||||
|
||||
void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
@@ -91,7 +94,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
int dl_antenna_ports,
|
||||
int do_csirs,
|
||||
int initial_csi_index,
|
||||
int uid);
|
||||
|
||||
void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig,
|
||||
|
||||
+16
-97
@@ -106,9 +106,7 @@ extern boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
@@ -1010,7 +1008,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
|
||||
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
|
||||
sdap_config->pdu_Session = ue_context_pP->ue_context.pduSession[i].param.pdusession_id;
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent;
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present;
|
||||
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent;
|
||||
sdap_config->defaultDRB = TRUE;
|
||||
sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
|
||||
@@ -1043,7 +1041,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
DRB_config->pdcp_Config->moreThanOneRLC = NULL;
|
||||
|
||||
DRB_config->pdcp_Config->t_Reordering = calloc(1, sizeof(*DRB_config->pdcp_Config->t_Reordering));
|
||||
*DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms750;
|
||||
*DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
|
||||
DRB_config->pdcp_Config->ext1 = NULL;
|
||||
|
||||
if (rrc->security.do_drb_integrity) {
|
||||
@@ -1305,51 +1303,22 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
|
||||
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
|
||||
|
||||
#ifndef PHYSIM
|
||||
uint8_t *k_kdf = NULL;
|
||||
/* Derive the keys from kgnb */
|
||||
if (DRB_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;
|
||||
&kUPenc);
|
||||
nr_derive_key_up_int(ue_context_pP->ue_context.integrity_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&k_kdf);
|
||||
/* kUPint: last 128 bits of key derivation function which returns 256 bits */
|
||||
kUPint = malloc(16);
|
||||
if (kUPint == NULL) exit(1);
|
||||
memcpy(kUPint, k_kdf+16, 16);
|
||||
free(k_kdf);
|
||||
&kUPint);
|
||||
}
|
||||
|
||||
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;
|
||||
&kRRCenc);
|
||||
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
|
||||
&kRRCint);
|
||||
/* Refresh SRBs/DRBs */
|
||||
MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
@@ -3096,20 +3065,20 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
ctxt_pP->rnti = ue_context_p->ue_id_rnti;
|
||||
|
||||
if (fd) {
|
||||
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
|
||||
fprintf(fd,"NR RRC UE rnti %x: S-TMSI %x failure timer %d/8\n",
|
||||
if (fd) {
|
||||
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
|
||||
fprintf(fd,"NR RRC UE rnti %x: S-TMSI %x failure timer %d/8\n",
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
} else {
|
||||
fprintf(fd,"NR RRC UE rnti %x failure timer %d/8\n",
|
||||
} else {
|
||||
fprintf(fd,"NR RRC UE rnti %x failure timer %d/8\n",
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
}
|
||||
}
|
||||
|
||||
if (ue_context_p->ue_context.UE_Capability_nr) {
|
||||
fprintf(fd,"NR RRC UE cap: BW DL %x. BW UL %x, 256 QAM DL %s, 256 QAM UL %s, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n",
|
||||
if (ue_context_p->ue_context.UE_Capability_nr) {
|
||||
fprintf(fd,"NR RRC UE cap: BW DL %x. BW UL %x, 256 QAM DL %s, 256 QAM UL %s, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n",
|
||||
get_dl_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
|
||||
get_ul_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
|
||||
is_dl_256QAM_supported(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr) == 1 ? "yes" : "no",
|
||||
@@ -3117,7 +3086,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
get_dl_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
|
||||
get_ul_mimo_layersCB(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
|
||||
get_ul_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ul_failure_timer > 0) {
|
||||
ue_context_p->ue_context.ul_failure_timer++;
|
||||
@@ -3178,6 +3147,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
|
||||
if (fd) fclose(fd);
|
||||
|
||||
|
||||
/* send a tick to x2ap */
|
||||
if (is_x2ap_enabled()){
|
||||
msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_SUBFRAME_PROCESS);
|
||||
@@ -3305,57 +3275,6 @@ void *rrc_gnb_task(void *args_p) {
|
||||
case GTPV1U_GNB_DELETE_TUNNEL_RESP:
|
||||
break;
|
||||
|
||||
/*
|
||||
#if defined(ENABLE_USE_MME)
|
||||
|
||||
// Messages from S1AP
|
||||
case S1AP_DOWNLINK_NAS:
|
||||
rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_gNB_mui);
|
||||
break;
|
||||
|
||||
case S1AP_INITIAL_CONTEXT_SETUP_REQ:
|
||||
rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_UE_CTXT_MODIFICATION_REQ:
|
||||
rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_PAGING_IND:
|
||||
LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p);
|
||||
rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_SETUP_REQ:
|
||||
rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance);
|
||||
LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p);
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_MODIFY_REQ:
|
||||
rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_RELEASE_COMMAND:
|
||||
rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_UE_CONTEXT_RELEASE_REQ:
|
||||
rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case S1AP_UE_CONTEXT_RELEASE_COMMAND:
|
||||
rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance);
|
||||
break;
|
||||
|
||||
case GTPV1U_ENB_DELETE_TUNNEL_RESP:
|
||||
///Nothing to do. Apparently everything is done in S1AP processing
|
||||
//LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n",
|
||||
//instance, msg_name_p);
|
||||
AssertFatal(false, "Removed double mechanism for same feature: now delete_tunnel() function should be called\n");
|
||||
break;
|
||||
|
||||
#endif
|
||||
*/
|
||||
/* Messages from gNB app */
|
||||
case NRRRC_CONFIGURATION_REQ:
|
||||
LOG_I(NR_RRC, "[gNB %ld] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p));
|
||||
|
||||
@@ -308,43 +308,19 @@ nr_rrc_pdcp_config_security(
|
||||
uint8_t *kUPenc = NULL;
|
||||
static int print_keys= 1;
|
||||
|
||||
#ifndef PHYSIM
|
||||
|
||||
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);
|
||||
&kUPenc);
|
||||
}
|
||||
|
||||
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;
|
||||
&kRRCenc);
|
||||
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
|
||||
&kRRCint);
|
||||
if (!IS_SOFTMODEM_IQPLAYER) {
|
||||
SET_LOG_DUMP(DEBUG_SECURITY) ;
|
||||
}
|
||||
@@ -603,20 +579,9 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
|
||||
NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key);
|
||||
|
||||
/* configure only integrity, ciphering comes after receiving SecurityModeComplete */
|
||||
nr_rrc_pdcp_config_security(
|
||||
&ctxt,
|
||||
ue_context_p,
|
||||
0);
|
||||
nr_rrc_pdcp_config_security(&ctxt, ue_context_p, 0);
|
||||
|
||||
uint8_t send_security_mode_command = TRUE;
|
||||
|
||||
if (send_security_mode_command) {
|
||||
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p);
|
||||
send_security_mode_command = FALSE;
|
||||
} else {
|
||||
/* rrc_gNB_generate_UECapabilityEnquiry */
|
||||
rrc_gNB_generate_UECapabilityEnquiry(&ctxt, ue_context_p);
|
||||
}
|
||||
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p);
|
||||
|
||||
// in case, send the S1SP initial context response if it is not sent with the attach complete message
|
||||
if (ue_context_p->ue_context.StatusRrc == NR_RRC_RECONFIGURED) {
|
||||
|
||||
@@ -52,9 +52,7 @@ extern boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
@@ -153,7 +151,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
|
||||
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
|
||||
ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
|
||||
carrier->initial_csi_index[ue_context_p->local_uid + 1] = 0;
|
||||
ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
|
||||
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){
|
||||
fill_default_rbconfig(ue_context_p->ue_context.rb_config,
|
||||
@@ -215,25 +212,12 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
LOG_I(RRC, "selecting integrity algorithm %d\n", ue_context_p->ue_context.integrity_algorithm);
|
||||
|
||||
/* derive UP security key */
|
||||
unsigned char *kUPenc_kdf;
|
||||
nr_derive_key_up_enc(ue_context_p->ue_context.ciphering_algorithm,
|
||||
ue_context_p->ue_context.kgnb,
|
||||
&kUPenc_kdf);
|
||||
/* kUPenc: last 128 bits of key derivation function which returns 256 bits */
|
||||
kUPenc = malloc(16);
|
||||
if (kUPenc == NULL) exit(1);
|
||||
memcpy(kUPenc, kUPenc_kdf+16, 16);
|
||||
free(kUPenc_kdf);
|
||||
|
||||
unsigned char *kUPint_kdf;
|
||||
&kUPenc);
|
||||
nr_derive_key_up_int(ue_context_p->ue_context.integrity_algorithm,
|
||||
ue_context_p->ue_context.kgnb,
|
||||
&kUPint_kdf);
|
||||
/* kUPint: last 128 bits of key derivation function which returns 256 bits */
|
||||
kUPint = malloc(16);
|
||||
if (kUPint == NULL) exit(1);
|
||||
memcpy(kUPint, kUPint_kdf+16, 16);
|
||||
free(kUPint_kdf);
|
||||
&kUPint);
|
||||
|
||||
e_NR_CipheringAlgorithm cipher_algo;
|
||||
switch (ue_context_p->ue_context.ciphering_algorithm) {
|
||||
@@ -257,7 +241,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
ue_context_p->ue_context.secondaryCellGroup,
|
||||
carrier->pdsch_AntennaPorts,
|
||||
carrier->do_CSIRS,
|
||||
carrier->initial_csi_index[ue_context_p->local_uid + 1],
|
||||
ue_context_p->local_uid);
|
||||
} else {
|
||||
fill_default_reconfig(carrier->servingcellconfigcommon,
|
||||
@@ -266,7 +249,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
ue_context_p->ue_context.secondaryCellGroup,
|
||||
carrier->pdsch_AntennaPorts,
|
||||
carrier->do_CSIRS,
|
||||
carrier->initial_csi_index[ue_context_p->local_uid + 1],
|
||||
ue_context_p->local_uid);
|
||||
}
|
||||
ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
|
||||
@@ -45,116 +45,10 @@
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
|
||||
#define false 0
|
||||
#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));
|
||||
*bwp->bwp_Common = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP;
|
||||
}
|
||||
|
||||
void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0,
|
||||
NR_MIB_t *mib,
|
||||
int ssb_subcarrier_offset,
|
||||
int ssbSubcarrierSpacing,
|
||||
int ssb_start_symbol,
|
||||
int frequency_range,
|
||||
int ssboffset_pointa,
|
||||
int physCellId) {
|
||||
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||
int num_slot_per_frame = 10*(1<<ssbSubcarrierSpacing);
|
||||
LOG_I(NR_RRC,"num_slot_per_frame %d, ssb_subcarrier_offset %d,ssb_start_symbol %d, ssbSubcarrierSpacing %d, frequency_range %d, ssboffset_pointa %d\n",
|
||||
num_slot_per_frame,ssb_subcarrier_offset,ssb_start_symbol,ssbSubcarrierSpacing,frequency_range,ssboffset_pointa);
|
||||
get_type0_PDCCH_CSS_config_parameters(&type0_PDCCH_CSS_config,
|
||||
0,
|
||||
mib,
|
||||
num_slot_per_frame,
|
||||
ssb_subcarrier_offset,
|
||||
ssb_start_symbol,
|
||||
ssbSubcarrierSpacing,
|
||||
frequency_range,
|
||||
0,
|
||||
ssboffset_pointa);
|
||||
|
||||
coreset0->controlResourceSetId = 0;
|
||||
|
||||
if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||
|
||||
coreset0->frequencyDomainResources.buf[0] = type0_PDCCH_CSS_config.num_rbs==48 ? 0xff : 0xf0;
|
||||
coreset0->frequencyDomainResources.buf[1] = 0;
|
||||
coreset0->frequencyDomainResources.buf[2] = 0;
|
||||
coreset0->frequencyDomainResources.buf[3] = 0;
|
||||
coreset0->frequencyDomainResources.buf[4] = 0;
|
||||
coreset0->frequencyDomainResources.buf[5] = 0;
|
||||
coreset0->frequencyDomainResources.size = 6;
|
||||
coreset0->frequencyDomainResources.bits_unused = 3;
|
||||
|
||||
int firstrb_cs0 = ssboffset_pointa-type0_PDCCH_CSS_config.rb_offset;
|
||||
|
||||
LOG_I(RRC,"CS0: ssboffset_pointa %d, first_cs0_rb %d, num_cs0_rbs %d, cs0_duration %d: %x\n",ssboffset_pointa,firstrb_cs0,type0_PDCCH_CSS_config.num_rbs,type0_PDCCH_CSS_config.num_symbols,
|
||||
coreset0->frequencyDomainResources.buf[0]);
|
||||
|
||||
coreset0->duration = type0_PDCCH_CSS_config.num_symbols;
|
||||
|
||||
coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved));
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex));
|
||||
*coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = physCellId;
|
||||
coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||
|
||||
if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*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(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||
}
|
||||
coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||
coreset0->tci_PresentInDCI = NULL;
|
||||
coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||
|
||||
}
|
||||
|
||||
void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) {
|
||||
|
||||
if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId));
|
||||
if(ss0->monitoringSymbolsWithinSlot == NULL) ss0->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss0->monitoringSymbolsWithinSlot));
|
||||
if(ss0->monitoringSymbolsWithinSlot->buf == NULL) ss0->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||
if(ss0->nrofCandidates == NULL) ss0->nrofCandidates = calloc(1,sizeof(*ss0->nrofCandidates));
|
||||
if(ss0->searchSpaceType == NULL) ss0->searchSpaceType = calloc(1,sizeof(*ss0->searchSpaceType));
|
||||
if(ss0->searchSpaceType->choice.common == NULL) ss0->searchSpaceType->choice.common=calloc(1,sizeof(*ss0->searchSpaceType->choice.common));
|
||||
if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
|
||||
ss0->searchSpaceId = 0;
|
||||
*ss0->controlResourceSetId = 0;
|
||||
ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset));
|
||||
ss0->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
|
||||
ss0->duration=NULL;
|
||||
|
||||
// should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed
|
||||
ss0->monitoringSymbolsWithinSlot->buf[1] = 0;
|
||||
ss0->monitoringSymbolsWithinSlot->buf[0] = (1<<7);
|
||||
ss0->monitoringSymbolsWithinSlot->size = 2;
|
||||
ss0->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
|
||||
ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
|
||||
ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
|
||||
ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2;
|
||||
ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
|
||||
ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
|
||||
|
||||
ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||
}
|
||||
|
||||
*/
|
||||
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
@@ -162,8 +56,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
int servCellIndex,
|
||||
int dl_antenna_ports,
|
||||
int do_csirs,
|
||||
int initial_csi_index,
|
||||
int uid) {
|
||||
|
||||
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
|
||||
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
|
||||
|
||||
@@ -659,7 +553,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
}
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL;
|
||||
|
||||
if (dl_antenna_ports > 1)// for MIMO, we use DMRS Config Type 2
|
||||
if ((get_softmodem_params()->do_ra ||
|
||||
get_softmodem_params()->phy_test) &&
|
||||
dl_antenna_ports > 1) // for MIMO, we use DMRS Config Type 2 but only with OAI UE
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type));
|
||||
else
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
|
||||
@@ -1040,7 +936,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
schedulingRequestResourceConfig->schedulingRequestID = 0;
|
||||
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
|
||||
schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10;
|
||||
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl10 = 2;
|
||||
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl10 = 7;
|
||||
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
|
||||
*schedulingRequestResourceConfig->resource = 1;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
|
||||
@@ -1138,7 +1034,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
pdsch_servingcellconfig->pucch_Cell= NULL;
|
||||
pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1));
|
||||
pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers));
|
||||
*pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2;
|
||||
*pdsch_servingcellconfig->ext1->maxMIMO_Layers = dl_antenna_ports;
|
||||
pdsch_servingcellconfig->ext1->processingType2Enabled = NULL;
|
||||
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=NULL;
|
||||
@@ -1159,7 +1055,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
imres0->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1 = 6;
|
||||
imres0->freqBand = calloc(1,sizeof(*imres0->freqBand));
|
||||
imres0->freqBand->startingRB = 0;
|
||||
imres0->freqBand->nrofRBs = 108;
|
||||
imres0->freqBand->nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2;
|
||||
imres0->periodicityAndOffset = calloc(1,sizeof(*imres0->periodicityAndOffset));
|
||||
imres0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320;
|
||||
imres0->periodicityAndOffset->choice.slots320 = 0;
|
||||
@@ -1178,7 +1074,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
}
|
||||
|
||||
csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL;
|
||||
csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL;
|
||||
csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL;
|
||||
|
||||
if (do_csirs) {
|
||||
@@ -1198,7 +1093,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
|
||||
csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL;
|
||||
|
||||
config_csirs(servingcellconfigcommon, csi_MeasConfig,dl_antenna_ports,do_csirs);
|
||||
config_csirs(servingcellconfigcommon, csi_MeasConfig,dl_antenna_ports,curr_bwp,do_csirs);
|
||||
|
||||
csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList));
|
||||
csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL;
|
||||
@@ -1253,6 +1148,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1,sizeof(*csiim00));
|
||||
*csiim00 = 0;
|
||||
ASN_SEQUENCE_ADD(&csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list,csiim00);
|
||||
csires2->bwp_Id = 1;
|
||||
csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2);
|
||||
}
|
||||
|
||||
@@ -1397,7 +1294,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
}
|
||||
|
||||
|
||||
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int dl_antenna_ports, int do_csirs) {
|
||||
void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig,
|
||||
int dl_antenna_ports,
|
||||
int curr_bwp,
|
||||
int do_csirs) {
|
||||
|
||||
if (do_csirs) {
|
||||
csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList));
|
||||
@@ -1432,7 +1333,7 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_
|
||||
resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one;
|
||||
resourceMapping.density.choice.one = (NULL_t)0;
|
||||
resourceMapping.freqBand.startingRB = 0;
|
||||
resourceMapping.freqBand.nrofRBs = 108;
|
||||
resourceMapping.freqBand.nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2;
|
||||
nzpcsi0->resourceMapping = resourceMapping;
|
||||
nzpcsi0->powerControlOffset = 0;
|
||||
nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS));
|
||||
@@ -1441,7 +1342,8 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_
|
||||
nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset));
|
||||
nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320;
|
||||
nzpcsi0->periodicityAndOffset->choice.slots320 = 0;
|
||||
nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL;
|
||||
nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS));
|
||||
*nzpcsi0->qcl_InfoPeriodicCSI_RS=0;
|
||||
ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0);
|
||||
}
|
||||
else
|
||||
@@ -1455,7 +1357,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
int dl_antenna_ports,
|
||||
int do_csirs,
|
||||
int initial_csi_index,
|
||||
int uid) {
|
||||
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
|
||||
AssertFatal(reconfig!=NULL,"reconfig is null\n");
|
||||
@@ -1470,7 +1371,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
|
||||
1,
|
||||
dl_antenna_ports,
|
||||
do_csirs,
|
||||
initial_csi_index,
|
||||
uid);
|
||||
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
|
||||
|
||||
+85
-63
@@ -187,9 +187,7 @@ extern boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
@@ -1661,45 +1659,40 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
|
||||
uint8_t *kRRCenc = NULL;
|
||||
uint8_t *kUPenc = NULL;
|
||||
uint8_t *kRRCint = NULL;
|
||||
pdcp_t *pdcp_p = NULL;
|
||||
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
|
||||
hashtable_rc_t h_rc;
|
||||
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);
|
||||
nr_derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb,
|
||||
&kUPenc);
|
||||
nr_derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb,
|
||||
&kRRCenc);
|
||||
nr_derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb,
|
||||
&kRRCint);
|
||||
LOG_I(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB="
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x\n",
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]);
|
||||
|
||||
if (h_rc == HASH_TABLE_OK) {
|
||||
LOG_D(NR_RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key);
|
||||
LOG_D(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB="
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x\n",
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27],
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]);
|
||||
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
|
||||
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
|
||||
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
|
||||
|
||||
if (securityMode != 0xff) {
|
||||
pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm
|
||||
| (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
|
||||
kRRCenc, kRRCint, kUPenc);
|
||||
} else {
|
||||
LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", securityMode);
|
||||
}
|
||||
if (securityMode != 0xff) {
|
||||
pdcp_config_set_security(ctxt_pP, NULL, DCCH, DCCH+2,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm
|
||||
| (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
|
||||
kRRCenc, kRRCint, kUPenc);
|
||||
} else {
|
||||
LOG_I(NR_RRC, "Could not get PDCP instance where key=0x%ld\n", key);
|
||||
LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", securityMode);
|
||||
}
|
||||
|
||||
if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) {
|
||||
@@ -2044,21 +2037,12 @@ nr_rrc_ue_establish_srb2(
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *k_kdf = NULL;
|
||||
uint8_t *kRRCenc = NULL;
|
||||
uint8_t *kRRCint = NULL;
|
||||
nr_derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &k_kdf);
|
||||
kRRCenc = malloc(16);
|
||||
if (kRRCenc == NULL) exit(1);
|
||||
memcpy(kRRCenc, k_kdf + 16, 16);
|
||||
free(k_kdf);
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
|
||||
nr_derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &k_kdf);
|
||||
kRRCint = malloc(16);
|
||||
if (kRRCint == NULL) exit(1);
|
||||
memcpy(kRRCint, k_kdf + 16, 16);
|
||||
free(k_kdf);
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
|
||||
|
||||
// Refresh SRBs
|
||||
nr_rrc_pdcp_config_asn1_req(ctxt_pP,
|
||||
@@ -2100,6 +2084,7 @@ nr_rrc_ue_establish_srb2(
|
||||
|
||||
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n",
|
||||
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
|
||||
nr_rrc_mac_config_req_ue_logicalChannelBearer(ctxt_pP->module_id,0,gNB_index,1,true); //todo handle mac_LogicalChannelConfig
|
||||
// rrc_mac_config_req_ue
|
||||
}
|
||||
} else {
|
||||
@@ -2115,6 +2100,7 @@ nr_rrc_ue_establish_srb2(
|
||||
|
||||
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n",
|
||||
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
|
||||
nr_rrc_mac_config_req_ue_logicalChannelBearer(ctxt_pP->module_id,0,gNB_index,2,true); //todo handle mac_LogicalChannelConfig
|
||||
// rrc_mac_config_req_ue
|
||||
}
|
||||
} // srb2
|
||||
@@ -2135,28 +2121,33 @@ nr_rrc_ue_establish_srb2(
|
||||
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1],
|
||||
radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t));
|
||||
} else {
|
||||
LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]);
|
||||
//LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]);
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt];
|
||||
int j;
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list = NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList;
|
||||
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(DRB_id == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){
|
||||
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (DRB lcid %ld gNB %d) --->][MAC_UE][MOD %02d][]\n",
|
||||
ctxt_pP->frame, ctxt_pP->module_id, rlc_bearer2add_list->list.array[j]->logicalChannelIdentity, 0, ctxt_pP->module_id);
|
||||
nr_rrc_mac_config_req_ue_logicalChannelBearer(ctxt_pP->module_id,0,0,rlc_bearer2add_list->list.array[j]->logicalChannelIdentity,true); //todo handle mac_LogicalChannelConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *k_kdf = NULL;
|
||||
uint8_t *kUPenc = NULL;
|
||||
uint8_t *kUPint = NULL;
|
||||
|
||||
nr_derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &k_kdf);
|
||||
kUPenc = malloc(16);
|
||||
if (kUPenc == NULL) exit(1);
|
||||
memcpy(kUPenc, k_kdf + 16, 16);
|
||||
free(k_kdf);
|
||||
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
|
||||
nr_derive_key_up_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &k_kdf);
|
||||
kUPint = malloc(16);
|
||||
if (kUPint == NULL) exit(1);
|
||||
memcpy(kUPint, k_kdf + 16, 16);
|
||||
free(k_kdf);
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPint);
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_RRC_UE,
|
||||
@@ -2199,6 +2190,15 @@ nr_rrc_ue_establish_srb2(
|
||||
}
|
||||
}
|
||||
|
||||
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToReleaseList != NULL) {
|
||||
for (i = 0; i < NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToReleaseList->list.count; i++) {
|
||||
NR_LogicalChannelIdentity_t lcid = *NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToReleaseList->list.array[i];
|
||||
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (RB lcid %ld gNB %d release) --->][MAC_UE][MOD %02d][]\n",
|
||||
ctxt_pP->frame, ctxt_pP->module_id, lcid, 0, ctxt_pP->module_id);
|
||||
nr_rrc_mac_config_req_ue_logicalChannelBearer(ctxt_pP->module_id,0,0,lcid,false); //todo handle mac_LogicalChannelConfig
|
||||
}
|
||||
}
|
||||
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED;
|
||||
LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index);
|
||||
}
|
||||
@@ -2511,6 +2511,28 @@ nr_rrc_ue_establish_srb2(
|
||||
NR_RRC_DCCH_DATA_IND (msg_p).gNB_index);
|
||||
break;
|
||||
|
||||
case NAS_KENB_REFRESH_REQ:
|
||||
memcpy((void *)NR_UE_rrc_inst[ue_mod_id].kgnb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(NR_UE_rrc_inst[ue_mod_id].kgnb));
|
||||
LOG_D(RRC, "[UE %d] Received %s: refreshed RRC::KgNB = "
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x\n",
|
||||
ue_mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[0], NR_UE_rrc_inst[ue_mod_id].kgnb[1], NR_UE_rrc_inst[ue_mod_id].kgnb[2], NR_UE_rrc_inst[ue_mod_id].kgnb[3],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[4], NR_UE_rrc_inst[ue_mod_id].kgnb[5], NR_UE_rrc_inst[ue_mod_id].kgnb[6], NR_UE_rrc_inst[ue_mod_id].kgnb[7],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[8], NR_UE_rrc_inst[ue_mod_id].kgnb[9], NR_UE_rrc_inst[ue_mod_id].kgnb[10], NR_UE_rrc_inst[ue_mod_id].kgnb[11],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[12], NR_UE_rrc_inst[ue_mod_id].kgnb[13], NR_UE_rrc_inst[ue_mod_id].kgnb[14], NR_UE_rrc_inst[ue_mod_id].kgnb[15],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[16], NR_UE_rrc_inst[ue_mod_id].kgnb[17], NR_UE_rrc_inst[ue_mod_id].kgnb[18], NR_UE_rrc_inst[ue_mod_id].kgnb[19],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[20], NR_UE_rrc_inst[ue_mod_id].kgnb[21], NR_UE_rrc_inst[ue_mod_id].kgnb[22], NR_UE_rrc_inst[ue_mod_id].kgnb[23],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[24], NR_UE_rrc_inst[ue_mod_id].kgnb[25], NR_UE_rrc_inst[ue_mod_id].kgnb[26], NR_UE_rrc_inst[ue_mod_id].kgnb[27],
|
||||
NR_UE_rrc_inst[ue_mod_id].kgnb[28], NR_UE_rrc_inst[ue_mod_id].kgnb[29], NR_UE_rrc_inst[ue_mod_id].kgnb[30], NR_UE_rrc_inst[ue_mod_id].kgnb[31]);
|
||||
break;
|
||||
|
||||
case NAS_UPLINK_DATA_REQ: {
|
||||
uint32_t length;
|
||||
uint8_t *buffer;
|
||||
|
||||
@@ -111,4 +111,4 @@
|
||||
#define RRC_LIST_ENTRY(list, i) \
|
||||
list.entries[i]
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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_sdap_gnb.h"
|
||||
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
|
||||
|
||||
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id
|
||||
) {
|
||||
if(sdu_buffer == NULL) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL sdu_buffer \n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(sdu_buffer_size == 0) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL or 0 sdu_buffer_size \n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uint8_t *sdap_buf = (uint8_t *)malloc(sdu_buffer_size+SDAP_HDR_LENGTH);
|
||||
nr_sdap_dl_hdr_t sdap_hdr;
|
||||
sdap_hdr.RDI = 0; // SDAP_Hardcoded -
|
||||
sdap_hdr.RQI = 0; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
|
||||
sdap_hdr.QFI = 1; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
|
||||
memcpy(&sdap_buf[0], &sdap_hdr, 1);
|
||||
memcpy(&sdap_buf[1], sdu_buffer, sdu_buffer_size);
|
||||
rb_id_t sdap_drb_id = rb_id; // SDAP_Hardcoded - Should get this info from QFI to DRB mapping table
|
||||
boolean_t ret = pdcp_data_req(ctxt_p,
|
||||
srb_flag,
|
||||
sdap_drb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size+1,
|
||||
sdap_buf,
|
||||
pt_mode,
|
||||
sourceL2Id,
|
||||
destinationL2Id);
|
||||
|
||||
if(!ret) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - PDCP DL refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
free(sdap_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(sdap_buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr) {
|
||||
nr_sdap_ul_hdr_t *sdap_hdr_ul = (nr_sdap_ul_hdr_t *)&sdap_gnb_ul_hdr;
|
||||
|
||||
switch (sdap_hdr_ul->DC) {
|
||||
case SDAP_HDR_UL_DATA_PDU:
|
||||
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - UL Received SDAP Data PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
break;
|
||||
|
||||
case SDAP_HDR_UL_CTRL_PDU:
|
||||
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - Received SDAP Control PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
#ifndef _NR_SDAP_GNB_
|
||||
#define _NR_SDAP_GNB_
|
||||
|
||||
#include "openair2/COMMON/platform_types.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
#define SDAP_BITMASK_DC (0x80)
|
||||
#define SDAP_BITMASK_R (0x40)
|
||||
#define SDAP_BITMASK_QFI (0x3F)
|
||||
#define SDAP_HDR_UL_DATA_PDU (1)
|
||||
#define SDAP_HDR_UL_CTRL_PDU (0)
|
||||
#define SDAP_HDR_LENGTH (1)
|
||||
|
||||
typedef struct nr_sdap_dl_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t RQI:1;
|
||||
uint8_t RDI:1;
|
||||
} __attribute__((packed)) nr_sdap_dl_hdr_t;
|
||||
|
||||
typedef struct nr_sdap_ul_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t R:1;
|
||||
uint8_t DC:1;
|
||||
} __attribute__((packed)) nr_sdap_ul_hdr_t;
|
||||
|
||||
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id
|
||||
);
|
||||
|
||||
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr);
|
||||
|
||||
#endif
|
||||
@@ -60,10 +60,6 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
#ifndef OPENAIR2
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#endif
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
include $(OPENAIR_TARGETS)/Makefile.common
|
||||
ifdef TEST_OMG
|
||||
|
||||
CC= gcc
|
||||
|
||||
OBJstatic = OMG.c common.c static.c
|
||||
OBJrwp = OMG.c common.c job.c rwp.c
|
||||
OBJrwalk = OMG.c common.c job.c rwalk.c
|
||||
OBJtrace = OMG.c common.c job.c trace.c mobility_parser.c hashtable.c
|
||||
OBJsumo = OMG.c common.c sumo.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
|
||||
|
||||
OBJ = OMG.c common.c static.c job.c rwp.c rwalk.c trace.c sumo.c mobility_parser.c hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
|
||||
|
||||
CFLAGS += -m32 -DTEST_OMG
|
||||
|
||||
.PHONY: help staticOMG rwpOMG clean
|
||||
|
||||
help:
|
||||
@echo ' "make staticOMG" to compile the STATIC version'
|
||||
@echo ' "make rwpOMG" to compile the RWP version'
|
||||
@echo ' "make rwalkOMG" to compile the RWALK version'
|
||||
@echo ' "make traceOMG" to compile the TRACE version'
|
||||
@echo ' "make sumoOMG" to compile the SUMO version'
|
||||
@echo ' "make clean" to remove the generated files and restore the original distribution'
|
||||
@echo ' "make OMG" to compile the complete version'
|
||||
|
||||
|
||||
staticOMG: ${OBJstatic}
|
||||
${CC} ${OBJstatic} -o staticOMG $(CFLAGS)
|
||||
|
||||
|
||||
rwpOMG: ${OBJrwp}
|
||||
${CC} ${OBJrwp} -lm -o rwpOMG $(CFLAGS)
|
||||
@#-lm: used to link to math lib
|
||||
|
||||
traceOMG:${OBJtrace}
|
||||
${CC} ${OBJtrace} -lm -o traceOMG $(CFLAGS)
|
||||
|
||||
rwalkOMG: ${OBJrwalk}
|
||||
${CC} ${OBJrwalk} -lm -o rwalkOMG $(CFLAGS)
|
||||
|
||||
sumoOMG: ${OBJsumo}
|
||||
${CC} ${OBJsumo} -lm -o rwalkOMG $(CFLAGS)
|
||||
|
||||
OMG: ${OBJ}
|
||||
${CC} ${OBJ} -lm -o OMG $(CFLAGS)
|
||||
|
||||
clean:
|
||||
@echo "Cleaning"
|
||||
@rm OMG
|
||||
@#rm rwpOMG
|
||||
@#rm rwalkOMG
|
||||
@#rm traceOMG
|
||||
@#rm staticOMG
|
||||
@#rm OMG
|
||||
|
||||
else
|
||||
|
||||
TOP_DIR = ../..
|
||||
OPENAIR1_TOP = ../..
|
||||
OPENAIR2_TOP = ../../../openair2
|
||||
OPENAIR3_TOP = ../../../openair3
|
||||
OPENAIR3 = $(OPENAIR3_DIR)
|
||||
|
||||
CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
|
||||
|
||||
|
||||
CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
|
||||
|
||||
#CFLAGS += -DXFORMS
|
||||
|
||||
ifdef DEBUG_PHY
|
||||
CFLAGS += -DDEBUG_PHY
|
||||
endif
|
||||
|
||||
ifdef PDCP_USE_NETLINK
|
||||
CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
|
||||
endif
|
||||
|
||||
include $(OPENAIR1_DIR)/PHY/Makefile.inc
|
||||
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
|
||||
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
|
||||
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
|
||||
|
||||
SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_channel.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/rf.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/adc.o
|
||||
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/dac.o
|
||||
|
||||
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS)
|
||||
|
||||
all: physim
|
||||
|
||||
|
||||
$(OBJ) : %.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -o $@ $<
|
||||
|
||||
$(L2_OBJS) : %.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -o $@ $<
|
||||
|
||||
physim : $(OBJ) $(L2_OBJS) OMG.c common.c static.c job.c rwp.c rwalk.c hashtable.c mobility_parser.c trace.c -I$(TOP_DIR) $(L2_incl) -o physim $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lforms -L/usr/local/lib -lforms -lX11 -L/usr/X11R6/lib -lXpm -lblas -lpthread
|
||||
|
||||
clean:
|
||||
rm -f physim
|
||||
rm -f $(OBJ)
|
||||
rm -f $(L2_OBJS)
|
||||
rm -f *.o
|
||||
rm -f *.exe*
|
||||
|
||||
cleanl1:
|
||||
rm -f physim
|
||||
rm -f $(OBJ)
|
||||
rm -f *.o
|
||||
rm -f *.exe
|
||||
cleanl2:
|
||||
rm -f $(L2_OBJS)
|
||||
|
||||
endif
|
||||
|
||||
@@ -121,6 +121,8 @@ int nr_derive_key(algorithm_type_dist_t alg_type, uint8_t alg_id,
|
||||
string[6] = 0x01;
|
||||
|
||||
kdf(string, 7, key, 32, out, 32);
|
||||
// in NR, we use the last 16 bytes, ignoring the first 16 ones
|
||||
memcpy(*out, *out+16, 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ unsigned int start_log_GP=0;
|
||||
unsigned int start_log_GP_bg=0;
|
||||
unsigned int start_log_jitter=0;
|
||||
|
||||
#include"otg_kpi.h"
|
||||
#include"otg_externs.h"
|
||||
#include "otg_kpi.h"
|
||||
#include "otg_externs.h"
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifndef __OTG_RX_SOCKET_H__
|
||||
#define __OTG_RX_SOCKET_H__
|
||||
|
||||
#include"otg.h"
|
||||
#include "otg.h"
|
||||
|
||||
|
||||
//-----------------------begin func proto-------------------
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include"otg_tx_socket.h"
|
||||
#include "otg_tx_socket.h"
|
||||
#include "otg_vars.h"
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include"otg.h"
|
||||
#include"otg_tx.h"
|
||||
#include "otg.h"
|
||||
#include "otg_tx.h"
|
||||
|
||||
|
||||
//-----------------------begin func proto-------------------
|
||||
|
||||
@@ -57,6 +57,17 @@ int x2ap_eNB_handle_x2_setup_response (instance_t instance,
|
||||
uint32_t stream,
|
||||
X2AP_X2AP_PDU_t *pdu);
|
||||
static
|
||||
int x2ap_eNB_handle_x2_reset_request (instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
X2AP_X2AP_PDU_t *pdu);
|
||||
static
|
||||
int x2ap_eNB_handle_x2_reset_response (instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
X2AP_X2AP_PDU_t *pdu);
|
||||
|
||||
static
|
||||
int x2ap_eNB_handle_x2_setup_failure (instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
@@ -166,7 +177,7 @@ x2ap_message_decoded_callback x2ap_messages_callback[][3] = {
|
||||
{ 0, 0, 0 }, /* snStatusTransfer */
|
||||
{ x2ap_eNB_handle_ue_context_release, 0, 0 }, /* uEContextRelease */
|
||||
{ x2ap_eNB_handle_x2_setup_request, x2ap_eNB_handle_x2_setup_response, x2ap_eNB_handle_x2_setup_failure }, /* x2Setup */
|
||||
{ 0, 0, 0 }, /* reset */
|
||||
{ x2ap_eNB_handle_x2_reset_request, x2ap_eNB_handle_x2_reset_response, 0 }, /* reset */
|
||||
{ 0, 0, 0 }, /* eNBConfigurationUpdate */
|
||||
{ 0, 0, 0 }, /* resourceStatusReportingInitiation */
|
||||
{ 0, 0, 0 }, /* resourceStatusReporting */
|
||||
@@ -501,6 +512,163 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
|
||||
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
|
||||
}
|
||||
|
||||
const char *X2AP_cause_str1[4]={"radioNetwork","transport","protocol","misc"};
|
||||
const char *X2AP_case_str_radio[50]={" X2AP_CauseRadioNetwork_handover_desirable_for_radio_reasons",
|
||||
"X2AP_CauseRadioNetwork_time_critical_handover",
|
||||
"X2AP_CauseRadioNetwork_resource_optimisation_handover",
|
||||
"X2AP_CauseRadioNetwork_reduce_load_in_serving_cell",
|
||||
"X2AP_CauseRadioNetwork_partial_handover",
|
||||
"X2AP_CauseRadioNetwork_unknown_new_eNB_UE_X2AP_ID",
|
||||
"X2AP_CauseRadioNetwork_unknown_old_eNB_UE_X2AP_ID",
|
||||
"X2AP_CauseRadioNetwork_unknown_pair_of_UE_X2AP_ID",
|
||||
"X2AP_CauseRadioNetwork_ho_target_not_allowed",
|
||||
"X2AP_CauseRadioNetwork_tx2relocoverall_expiry",
|
||||
"X2AP_CauseRadioNetwork_trelocprep_expiry",
|
||||
"X2AP_CauseRadioNetwork_cell_not_available",
|
||||
"X2AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell",
|
||||
"X2AP_CauseRadioNetwork_invalid_MME_GroupID",
|
||||
"X2AP_CauseRadioNetwork_unknown_MME_Code",
|
||||
"X2AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported",
|
||||
"X2AP_CauseRadioNetwork_reportCharacteristicsEmpty",
|
||||
"X2AP_CauseRadioNetwork_noReportPeriodicity",
|
||||
"X2AP_CauseRadioNetwork_existingMeasurementID",
|
||||
"X2AP_CauseRadioNetwork_unknown_eNB_Measurement_ID",
|
||||
"X2AP_CauseRadioNetwork_measurement_temporarily_not_available",
|
||||
"X2AP_CauseRadioNetwork_unspecified",
|
||||
"X2AP_CauseRadioNetwork_load_balancing",
|
||||
"X2AP_CauseRadioNetwork_handover_optimisation",
|
||||
"X2AP_CauseRadioNetwork_value_out_of_allowed_range",
|
||||
"X2AP_CauseRadioNetwork_multiple_E_RAB_ID_instances",
|
||||
"X2AP_CauseRadioNetwork_switch_off_ongoing",
|
||||
"X2AP_CauseRadioNetwork_not_supported_QCI_value",
|
||||
"X2AP_CauseRadioNetwork_measurement_not_supported_for_the_object",
|
||||
"X2AP_CauseRadioNetwork_tDCoverall_expiry",
|
||||
"X2AP_CauseRadioNetwork_tDCprep_expiry",
|
||||
"X2AP_CauseRadioNetwork_action_desirable_for_radio_reasons",
|
||||
"X2AP_CauseRadioNetwork_reduce_load",
|
||||
"X2AP_CauseRadioNetwork_resource_optimisation",
|
||||
"X2AP_CauseRadioNetwork_time_critical_action",
|
||||
"X2AP_CauseRadioNetwork_target_not_allowed",
|
||||
"X2AP_CauseRadioNetwork_no_radio_resources_available",
|
||||
"X2AP_CauseRadioNetwork_invalid_QoS_combination",
|
||||
"X2AP_CauseRadioNetwork_encryption_algorithms_not_supported",
|
||||
"X2AP_CauseRadioNetwork_procedure_cancelled",
|
||||
"X2AP_CauseRadioNetwork_rRM_purpose",
|
||||
"X2AP_CauseRadioNetwork_improve_user_bit_rate",
|
||||
"X2AP_CauseRadioNetwork_user_inactivity",
|
||||
"X2AP_CauseRadioNetwork_radio_connection_with_UE_lost",
|
||||
"X2AP_CauseRadioNetwork_bearer_option_not_supported",
|
||||
"X2AP_CauseRadioNetwork_mCG_Mobility",
|
||||
"X2AP_CauseRadioNetwork_sCG_Mobility",
|
||||
"X2AP_CauseRadioNetwork_count_reaches_max_value",
|
||||
"X2AP_CauseRadioNetwork_unknown_old_en_gNB_UE_X2AP_ID",
|
||||
"X2AP_CauseRadioNetwork_pDCP_Overload"};
|
||||
|
||||
const char *X2AP_cause_str_radio[2]={"X2AP_CauseTransport_transport_resource_unavailable",
|
||||
"X2AP_CauseTransport_unspecified"};
|
||||
const char *X2AP_cause_str_protocol[7]={" X2AP_CauseProtocol_transfer_syntax_error",
|
||||
"X2AP_CauseProtocol_abstract_syntax_error_reject",
|
||||
"X2AP_CauseProtocol_abstract_syntax_error_ignore_and_notify",
|
||||
"X2AP_CauseProtocol_message_not_compatible_with_receiver_state",
|
||||
"X2AP_CauseProtocol_semantic_error",
|
||||
"X2AP_CauseProtocol_unspecified",
|
||||
"X2AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message"};
|
||||
const char *X2AP_cause_str_misc[5]={"X2AP_CauseMisc_control_processing_overload",
|
||||
"X2AP_CauseMisc_hardware_failure",
|
||||
"X2AP_CauseMisc_om_intervention",
|
||||
"X2AP_CauseMisc_not_enough_user_plane_processing_resources",
|
||||
"X2AP_CauseMisc_unspecified"};
|
||||
|
||||
|
||||
int
|
||||
x2ap_eNB_handle_x2_reset_response(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
X2AP_X2AP_PDU_t *pdu)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
x2ap_eNB_handle_x2_reset_request(instance_t instance,
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
X2AP_X2AP_PDU_t *pdu)
|
||||
{
|
||||
|
||||
X2AP_ResetRequest_t *ResetRequest;
|
||||
X2AP_ResetRequest_IEs_t *ie;
|
||||
|
||||
x2ap_eNB_instance_t *instance_p;
|
||||
x2ap_eNB_data_t *x2ap_eNB_data;
|
||||
MessageDef *msg;
|
||||
uint32_t eNB_id = 0;
|
||||
|
||||
DevAssert (pdu != NULL);
|
||||
ResetRequest = &pdu->choice.initiatingMessage.value.choice.ResetRequest;
|
||||
|
||||
X2AP_DEBUG("Received a new X2 reset request\n");
|
||||
|
||||
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_ResetRequest_IEs_t, ie, ResetRequest,
|
||||
X2AP_ProtocolIE_ID_id_Cause, true);
|
||||
if (ie == NULL ) {
|
||||
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
|
||||
return -1;
|
||||
} else {
|
||||
AssertFatal(ie->value.present <= X2AP_Cause_PR_misc && ie->value.present > 0,"Cause value %d, is impossible\n",ie->value.present);
|
||||
LOG_I(X2AP,"Received X2AP Reset Request with Cause Type %s\n",X2AP_cause_str1[ie->value.present-1]);
|
||||
}
|
||||
|
||||
X2AP_DEBUG("Adding eNB to the list of associated eNBs\n");
|
||||
|
||||
if ((x2ap_eNB_data = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) {
|
||||
/*
|
||||
* eNB has not been found in list of associated eNB,
|
||||
* * * * Add it to the tail of list and initialize data
|
||||
*/
|
||||
if ((x2ap_eNB_data = x2ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) {
|
||||
/*
|
||||
* ??
|
||||
*/
|
||||
return -1;
|
||||
} else {
|
||||
x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
|
||||
x2ap_eNB_data->eNB_id = eNB_id;
|
||||
}
|
||||
} else {
|
||||
x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
|
||||
/*
|
||||
* eNB has been found in list, consider the x2 setup request as a reset connection,
|
||||
* * * * reseting any previous UE state if sctp association is != than the previous one
|
||||
*/
|
||||
if (x2ap_eNB_data->assoc_id != assoc_id) {
|
||||
/*
|
||||
* ??: Send an overload cause...
|
||||
*/
|
||||
X2AP_ERROR("Reset Request: eNB id %d is already associated to an active sctp association" "Previous known: %d, new one: %d\n", eNB_id, x2ap_eNB_data->assoc_id, assoc_id);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* TODO: call the reset procedure
|
||||
*/
|
||||
}
|
||||
|
||||
msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_RESET_REQ);
|
||||
|
||||
X2AP_RESET_REQ(msg).cause = ie->value.present;
|
||||
|
||||
|
||||
instance_p = x2ap_eNB_get_instance(instance);
|
||||
DevAssert(instance_p != NULL);
|
||||
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
|
||||
|
||||
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int x2ap_eNB_handle_x2_setup_response(instance_t instance,
|
||||
|
||||
Reference in New Issue
Block a user