Commit 2ec8fefb authored by Cédric Roux's avatar Cédric Roux

Merge branch 'integration_2024_w33' into 'develop'

Integration: `2024.w33`

See merge request oai/openairinterface5g!2911

- !2784 Reworking beam structures at NR MAC gNB
- !2889 Fix delta for PUSCH DMRS type 2 
- !2908 NR MAC UE CSI improvements
- !2896 Fix for llr functions reading/writing outside buffers
- !2902 nr rlc: reduce "SDU rejected" logging
- !2884 NR UE: Cleanup global variables used for command line parameter storage
- !2910 NR gNB DMRS symbol race
- CI: Update phytest-timing test threshold
parents 871078a6 736c0fd3
...@@ -1152,6 +1152,10 @@ add_library(PHY_NR_COMMON ${PHY_NR_SRC_COMMON}) ...@@ -1152,6 +1152,10 @@ add_library(PHY_NR_COMMON ${PHY_NR_SRC_COMMON})
add_library(PHY_NR ${PHY_NR_SRC}) add_library(PHY_NR ${PHY_NR_SRC})
target_link_libraries(PHY_NR nr_phy_common nr_common) target_link_libraries(PHY_NR nr_phy_common nr_common)
add_library(PHY_NR_NO_AVX_256 ${PHY_NR_SRC})
target_link_libraries(PHY_NR_NO_AVX_256 nr_phy_common nr_common)
target_compile_definitions(PHY_NR_NO_AVX_256 PUBLIC USE_128BIT)
add_library(PHY_NR_UE ${PHY_NR_UE_SRC}) add_library(PHY_NR_UE ${PHY_NR_UE_SRC})
target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common) target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common)
......
...@@ -14,7 +14,7 @@ Ref : ...@@ -14,7 +14,7 @@ Ref :
L1 Tx processing : 400.0 L1 Tx processing : 400.0
DLSCH encoding : 177.0 DLSCH encoding : 177.0
L1 Rx processing : 345.0 L1 Rx processing : 345.0
PUSCH inner-receiver : 210.0 PUSCH inner-receiver : 200.0
Schedule Response : 3.0 Schedule Response : 3.0
DL & UL scheduling timing : 13.0 DL & UL scheduling timing : 13.0
UL Indication : 3.0 UL Indication : 3.0
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n" #define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_DISABLETIMECORR "disable UE timing correction\n" #define CONFIG_HLP_DISABLETIMECORR "disable UE timing correction\n"
#define CONFIG_HLP_RRC_CFG_PATH "path for RRC configuration\n"
#define CONFIG_HLP_RE_CFG_FILE "filename for reconfig.raw in phy-test mode\n" #define CONFIG_HLP_RE_CFG_FILE "filename for reconfig.raw in phy-test mode\n"
#define CONFIG_HLP_RB_CFG_FILE "filename for rbconfig.raw in phy-test mode\n" #define CONFIG_HLP_RB_CFG_FILE "filename for rbconfig.raw in phy-test mode\n"
#define CONFIG_HLP_UECAP_FILE "path for UE Capabilities file\n" #define CONFIG_HLP_UECAP_FILE "path for UE Capabilities file\n"
......
...@@ -89,7 +89,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -89,7 +89,7 @@ unsigned short config_frames[4] = {2,9,11,13};
extern const char *duplex_mode[]; extern const char *duplex_mode[];
THREAD_STRUCT thread_struct; THREAD_STRUCT thread_struct;
nrUE_params_t nrUE_params; nrUE_params_t nrUE_params = {0};
// Thread variables // Thread variables
pthread_cond_t nfapi_sync_cond; pthread_cond_t nfapi_sync_cond;
...@@ -113,31 +113,12 @@ int oai_exit = 0; ...@@ -113,31 +113,12 @@ int oai_exit = 0;
static int tx_max_power[MAX_NUM_CCs] = {0}; static int tx_max_power[MAX_NUM_CCs] = {0};
int vcdflag = 0;
double rx_gain_off = 0.0; double rx_gain_off = 0.0;
char *usrp_args = NULL;
char *tx_subdev = NULL;
char *rx_subdev = NULL;
char *rrc_config_path = NULL;
char *reconfig_file = NULL;
char *rbconfig_file = NULL;
char *uecap_file = NULL;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
uint64_t sidelink_frequency[MAX_NUM_CCs][4]; uint64_t sidelink_frequency[MAX_NUM_CCs][4];
#if MAX_NUM_CCs == 1
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0}};
#else
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain},{max_gain,max_gain,max_gain,max_gain}};
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
#endif
// UE and OAI config variables // UE and OAI config variables
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
...@@ -221,10 +202,7 @@ static void get_options(configmodule_interface_t *cfg) ...@@ -221,10 +202,7 @@ static void get_options(configmodule_interface_t *cfg)
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ; paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
int numparams = sizeofArray(cmdline_params); int numparams = sizeofArray(cmdline_params);
config_get(cfg, cmdline_params, numparams, NULL); config_get(cfg, cmdline_params, numparams, NULL);
if (nrUE_params.vcdflag > 0)
AssertFatal(rrc_config_path == NULL, "the option \"rrc_config_path\" is deprecated. Please use --reconfig-file and --rbconfig-file separately to point to files reconfig.raw and rbconfig.raw\n");
if (vcdflag > 0)
ouput_vcd = 1; ouput_vcd = 1;
} }
...@@ -232,15 +210,10 @@ static void get_options(configmodule_interface_t *cfg) ...@@ -232,15 +210,10 @@ static void get_options(configmodule_interface_t *cfg)
void set_options(int CC_id, PHY_VARS_NR_UE *UE){ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
NR_DL_FRAME_PARMS *fp = &UE->frame_parms; NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
// Init power variables
tx_max_power[CC_id] = tx_max_power[0];
rx_gain[0][CC_id] = rx_gain[0][0];
tx_gain[0][CC_id] = tx_gain[0][0];
// Set UE variables // Set UE variables
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE->rx_total_gain_dB = (int)nrUE_params.rx_gain + rx_gain_off;
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0]; UE->tx_total_gain_dB = (int)nrUE_params.tx_gain;
UE->tx_power_max_dBm = tx_max_power[CC_id]; UE->tx_power_max_dBm = nrUE_params.tx_max_power;
UE->rf_map.card = 0; UE->rf_map.card = 0;
UE->rf_map.chain = CC_id + 0; UE->rf_map.chain = CC_id + 0;
UE->max_ldpc_iterations = nrUE_params.max_ldpc_iterations; UE->max_ldpc_iterations = nrUE_params.max_ldpc_iterations;
...@@ -317,9 +290,9 @@ void init_openair0() ...@@ -317,9 +290,9 @@ void init_openair0()
openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file; openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file;
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args; if (get_nrUE_params()->usrp_args) openair0_cfg[card].sdr_addrs = get_nrUE_params()->usrp_args;
if (tx_subdev) openair0_cfg[card].tx_subdev = tx_subdev; if (get_nrUE_params()->tx_subdev) openair0_cfg[card].tx_subdev = get_nrUE_params()->tx_subdev;
if (rx_subdev) openair0_cfg[card].rx_subdev = rx_subdev; if (get_nrUE_params()->rx_subdev) openair0_cfg[card].rx_subdev = get_nrUE_params()->rx_subdev;
} }
} }
...@@ -483,7 +456,7 @@ int main(int argc, char **argv) ...@@ -483,7 +456,7 @@ int main(int argc, char **argv)
else else
init_pdcp(mode_offset + ue_id_g); init_pdcp(mode_offset + ue_id_g);
init_NR_UE(NB_UE_INST, uecap_file, reconfig_file, rbconfig_file); init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file);
if (get_softmodem_params()->emulate_l1) { if (get_softmodem_params()->emulate_l1) {
RCconfig_nr_ue_macrlc(); RCconfig_nr_ue_macrlc();
......
...@@ -30,27 +30,26 @@ ...@@ -30,27 +30,26 @@
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off // clang-format off
#define CMDLINE_NRUEPARAMS_DESC { \ #define CMDLINE_NRUEPARAMS_DESC { \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&usrp_args, .defstrval="type=b200", TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&nrUE_params.usrp_args, .defstrval="type=b200", TYPE_STRING, 0}, \
{"tx_subdev", CONFIG_HLP_TX_SUBDEV, 0, .strptr=&tx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \ {"tx_subdev", CONFIG_HLP_TX_SUBDEV, 0, .strptr=&nrUE_params.tx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \
{"rx_subdev", CONFIG_HLP_RX_SUBDEV, 0, .strptr=&rx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \ {"rx_subdev", CONFIG_HLP_RX_SUBDEV, 0, .strptr=&nrUE_params.rx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \ {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \
{"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, .uptr=&nrUE_params.ofdm_offset_divisor, .defuintval=8, TYPE_UINT32, 0}, \ {"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, .uptr=&nrUE_params.ofdm_offset_divisor, .defuintval=8, TYPE_UINT32, 0}, \
{"max-ldpc-iterations", CONFIG_HLP_MAX_LDPC_ITERATIONS, 0, .iptr=&nrUE_params.max_ldpc_iterations, .defuintval=8, TYPE_UINT8, 0}, \ {"max-ldpc-iterations", CONFIG_HLP_MAX_LDPC_ITERATIONS, 0, .iptr=&nrUE_params.max_ldpc_iterations, .defuintval=8, TYPE_UINT8, 0}, \
{"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, PARAMFLAG_BOOL, .iptr=&(nrUE_params.ldpc_offload_flag), .defintval=0, TYPE_INT, 0}, \ {"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, PARAMFLAG_BOOL, .iptr=&(nrUE_params.ldpc_offload_flag), .defintval=0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, .iptr=&vcdflag, .defintval=0, TYPE_INT, 0}, \ {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, .iptr=&nrUE_params.vcdflag, .defintval=0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&nrUE_params.uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH, 0, .strptr=&rrc_config_path, .defstrval=NULL, TYPE_STRING, 0}, \ {"reconfig-file", CONFIG_HLP_RE_CFG_FILE, 0, .strptr=&nrUE_params.reconfig_file, .defstrval="./reconfig.raw", TYPE_STRING, 0}, \
{"reconfig-file", CONFIG_HLP_RE_CFG_FILE, 0, .strptr=&reconfig_file, .defstrval="./reconfig.raw", TYPE_STRING, 0}, \ {"rbconfig-file", CONFIG_HLP_RB_CFG_FILE, 0, .strptr=&nrUE_params.rbconfig_file, .defstrval="./rbconfig.raw", TYPE_STRING, 0}, \
{"rbconfig-file", CONFIG_HLP_RB_CFG_FILE, 0, .strptr=&rbconfig_file, .defstrval="./rbconfig.raw", TYPE_STRING, 0}, \ {"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \
{"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \ {"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&nrUE_params.rx_gain, .defdblval=110, TYPE_DOUBLE, 0}, \
{"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&(rx_gain[0][0]), .defdblval=110, TYPE_DOUBLE, 0}, \ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&nrUE_params.rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \ {"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&nrUE_params.tx_gain, .defdblval=0, TYPE_DOUBLE, 0}, \
{"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&(tx_gain[0][0]), .defdblval=0, TYPE_DOUBLE, 0}, \
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, .iptr=&(nrUE_params.nb_antennas_rx), .defuintval=1, TYPE_UINT8, 0}, \ {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, .iptr=&(nrUE_params.nb_antennas_rx), .defuintval=1, TYPE_UINT8, 0}, \
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, .iptr=&(nrUE_params.nb_antennas_tx), .defuintval=1, TYPE_UINT8, 0}, \ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, .iptr=&(nrUE_params.nb_antennas_tx), .defuintval=1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_scan_carrier), .defintval=0, TYPE_INT, 0}, \ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_scan_carrier), .defintval=0, TYPE_INT, 0}, \
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_fo_compensation), .defintval=0, TYPE_INT, 0}, \ {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_fo_compensation), .defintval=0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, .iptr=&(tx_max_power[0]), .defintval=90, TYPE_INT, 0}, \ {"ue-max-power", NULL, 0, .iptr=&(nrUE_params.tx_max_power), .defintval=90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB_SA, 0, .iptr=&(nrUE_params.N_RB_DL), .defintval=106, TYPE_UINT, 0}, \ {"r" , CONFIG_HLP_PRB_SA, 0, .iptr=&(nrUE_params.N_RB_DL), .defintval=106, TYPE_UINT, 0}, \
{"ssb", CONFIG_HLP_SSC, 0, .iptr=&(nrUE_params.ssb_start_subcarrier), .defintval=516, TYPE_UINT16, 0}, \ {"ssb", CONFIG_HLP_SSC, 0, .iptr=&(nrUE_params.ssb_start_subcarrier), .defintval=516, TYPE_UINT16, 0}, \
{"if_freq" , CONFIG_HLP_IF_FREQ, 0, .u64ptr=&(nrUE_params.if_freq), .defuintval=0, TYPE_UINT64, 0}, \ {"if_freq" , CONFIG_HLP_IF_FREQ, 0, .u64ptr=&(nrUE_params.if_freq), .defuintval=0, TYPE_UINT64, 0}, \
...@@ -67,25 +66,36 @@ ...@@ -67,25 +66,36 @@
// clang-format on // clang-format on
typedef struct { typedef struct {
uint64_t optmask; //mask to store boolean config options uint64_t optmask; // mask to store boolean config options
uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol
int max_ldpc_iterations; // number of maximum LDPC iterations int max_ldpc_iterations; // number of maximum LDPC iterations
tpool_t Tpool; // thread pool tpool_t Tpool; // thread pool
int UE_scan_carrier; int UE_scan_carrier;
int UE_fo_compensation; int UE_fo_compensation;
uint64_t if_freq; uint64_t if_freq;
int if_freq_off; int if_freq_off;
int chest_freq; int chest_freq;
int chest_time; int chest_time;
int no_timing_correction; int no_timing_correction;
int nb_antennas_rx; int nb_antennas_rx;
int nb_antennas_tx; int nb_antennas_tx;
int N_RB_DL; int N_RB_DL;
int ssb_start_subcarrier; int ssb_start_subcarrier;
int ldpc_offload_flag; int ldpc_offload_flag;
unsigned int ntn_koffset; unsigned int ntn_koffset;
double ntn_ta_common; double ntn_ta_common;
int agc; int agc;
char *usrp_args;
char *tx_subdev;
char *rx_subdev;
char *reconfig_file;
char *rbconfig_file;
char *uecap_file;
double tx_gain;
double rx_gain;
double rx_gain_off;
int vcdflag;
int tx_max_power;
} nrUE_params_t; } nrUE_params_t;
extern uint64_t get_nrUE_optmask(void); extern uint64_t get_nrUE_optmask(void);
extern uint64_t set_nrUE_optmask(uint64_t bitmask); extern uint64_t set_nrUE_optmask(uint64_t bitmask);
......
...@@ -54,7 +54,7 @@ typedef struct { ...@@ -54,7 +54,7 @@ typedef struct {
uint32_t rsrp; uint32_t rsrp;
int rsrp_dBm; int rsrp_dBm;
uint8_t rank_indicator; uint8_t rank_indicator;
uint8_t i1; uint16_t i1;
uint8_t i2; uint8_t i2;
uint8_t cqi; uint8_t cqi;
rlm_t radiolink_monitoring; rlm_t radiolink_monitoring;
......
add_subdirectory(nr_phy_common) add_subdirectory(nr_phy_common)
add_subdirectory(TOOLS) add_subdirectory(TOOLS)
add_subdirectory(NR_TRANSPORT)
...@@ -299,7 +299,7 @@ uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_ ...@@ -299,7 +299,7 @@ uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_
int8_t get_next_dmrs_symbol_in_slot(uint16_t ul_dmrs_symb_pos, uint8_t counter, uint8_t end_symbol) int8_t get_next_dmrs_symbol_in_slot(uint16_t ul_dmrs_symb_pos, uint8_t counter, uint8_t end_symbol)
{ {
for(uint8_t symbol = counter; symbol < end_symbol; symbol++) { for(uint8_t symbol = counter; symbol < end_symbol; symbol++) {
if((ul_dmrs_symb_pos >> symbol) & 0x01 ) { if((ul_dmrs_symb_pos >> symbol) & 0x01) {
return symbol; return symbol;
} }
} }
...@@ -318,23 +318,23 @@ uint8_t get_dmrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t nb_symb, uint8 ...@@ -318,23 +318,23 @@ uint8_t get_dmrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t nb_symb, uint8
} }
/* return the position of valid dmrs symbol in a slot for channel compensation */ /* return the position of valid dmrs symbol in a slot for channel compensation */
int8_t get_valid_dmrs_idx_for_channel_est(uint16_t dmrs_symb_pos, uint8_t counter) int8_t get_valid_dmrs_idx_for_channel_est(uint16_t dmrs_symb_pos, uint8_t counter)
{ {
int8_t symbIdx = -1; int8_t symbIdx = -1;
/* if current symbol is DMRS then return this index */ /* if current symbol is DMRS then return this index */
if(is_dmrs_symbol(counter, dmrs_symb_pos ) ==1) { if(is_dmrs_symbol(counter, dmrs_symb_pos) == 1) {
return counter; return counter;
} }
/* find previous DMRS symbol */ /* find previous DMRS symbol */
for(int8_t symbol = counter;symbol >=0 ; symbol--) { for(int8_t symbol = counter; symbol >= 0 ; symbol--) {
if((1<<symbol & dmrs_symb_pos)> 0) { if((1 << symbol & dmrs_symb_pos) > 0) {
symbIdx = symbol; symbIdx = symbol;
break; break;
} }
} }
/* if there is no previous dmrs available then find the next possible*/ /* if there is no previous dmrs available then find the next possible*/
if(symbIdx == -1) { if(symbIdx == -1) {
symbIdx = get_next_dmrs_symbol_in_slot(dmrs_symb_pos,counter,15); symbIdx = get_next_dmrs_symbol_in_slot(dmrs_symb_pos, counter, 15);
} }
return symbIdx; return symbIdx;
} }
......
...@@ -41,10 +41,8 @@ ...@@ -41,10 +41,8 @@
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h" #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
// Table 6.4.1.1.3-1/2 from TS 38.211 // Table 6.4.1.1.3-1/2 from TS 38.211
static const int delta1[8] = {0, 0, 1, 1, 0, 0, 1, 1};
static const int wf1[8][2] = {{1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}}; static const int wf1[8][2] = {{1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}};
static const int wt1[8][2] = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, -1}, {1, -1}, {1, -1}, {1, -1}}; static const int wt1[8][2] = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, -1}, {1, -1}, {1, -1}, {1, -1}};
static const int delta2[12] = {0, 0, 2, 2, 4, 4, 0, 0, 2, 2, 4, 4};
static const int wf2[12][2] = static const int wf2[12][2] =
{{1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}}; {{1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}, {1, 1}, {1, -1}};
static const int wt2[12][2] = static const int wt2[12][2] =
...@@ -56,14 +54,6 @@ static const c16_t nr_rx_mod_table[7] = ...@@ -56,14 +54,6 @@ static const c16_t nr_rx_mod_table[7] =
static const c16_t nr_rx_nmod_table[7] = static const c16_t nr_rx_nmod_table[7] =
{{0, 0}, {-23170, 23170}, {23170, -23170}, {-23170, 23170}, {-23170, -23170}, {23170, 23170}, {23170, -23170}}; {{0, 0}, {-23170, 23170}, {23170, -23170}, {-23170, 23170}, {-23170, -23170}, {23170, 23170}, {23170, -23170}};
int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p) {
if (dmrs_config_type == pusch_dmrs_type1) {
return delta1[p];
} else {
return delta2[p];
}
}
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
unsigned int Ns, unsigned int Ns,
const uint32_t *nr_gold_pusch, const uint32_t *nr_gold_pusch,
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "openair1/PHY/NR_REFSIG/nr_refsig_common.h" #include "openair1/PHY/NR_REFSIG/nr_refsig_common.h"
int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p);
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
unsigned int Ns, unsigned int Ns,
const uint32_t *nr_gold_pusch, const uint32_t *nr_gold_pusch,
......
if (ENABLE_TESTS)
add_subdirectory(tests)
endif()
add_executable(test_llr test_llr.cpp)
target_link_libraries(test_llr PRIVATE PHY_NR GTest::gtest minimal_lib)
add_dependencies(tests test_llr)
add_test(NAME test_llr
COMMAND ./test_llr)
add_executable(test_llr_no_avx_256 test_llr.cpp)
target_link_libraries(test_llr_no_avx_256 PRIVATE PHY_NR_NO_AVX_256 GTest::gtest minimal_lib)
add_dependencies(tests test_llr_no_avx_256)
add_test(NAME test_llr_no_avx_256
COMMAND ./test_llr_no_avx_256)
This diff is collapsed.
...@@ -1402,6 +1402,7 @@ void NFAPI_NR_DMRS_TYPE2_average_prb(NR_DL_FRAME_PARMS *frame_parms, ...@@ -1402,6 +1402,7 @@ void NFAPI_NR_DMRS_TYPE2_average_prb(NR_DL_FRAME_PARMS *frame_parms,
c16multaddVectRealComplex(filt8_avlip6, &ch, dl_ch, 8); c16multaddVectRealComplex(filt8_avlip6, &ch, dl_ch, 8);
#endif #endif
} }
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
const UE_nr_rxtx_proc_t *proc, const UE_nr_rxtx_proc_t *proc,
int nl, int nl,
......
...@@ -877,7 +877,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, ...@@ -877,7 +877,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
LOG_I(NR_PHY, "csirs_config_pdu->power_control_offset_ss = %i\n", csirs_config_pdu->power_control_offset_ss); LOG_I(NR_PHY, "csirs_config_pdu->power_control_offset_ss = %i\n", csirs_config_pdu->power_control_offset_ss);
#endif #endif
if(csirs_config_pdu->measurement_bitmap == 0) { if(csirs_config_pdu->csi_type == 0) {
LOG_E(NR_PHY, "Handling of CSI-RS for tracking not handled yet at PHY\n"); LOG_E(NR_PHY, "Handling of CSI-RS for tracking not handled yet at PHY\n");
return; return;
} }
......
...@@ -357,8 +357,6 @@ typedef struct { ...@@ -357,8 +357,6 @@ typedef struct {
/// - first index: ? [0..3] (hard coded) /// - first index: ? [0..3] (hard coded)
/// - first index: ? [0..1179743] (hard coded) /// - first index: ? [0..1179743] (hard coded)
int16_t **llr_layers; int16_t **llr_layers;
/// DMRS symbol index, to be updated every DMRS symbol within a slot.
uint8_t dmrs_symbol;
// PTRS symbol index, to be updated every PTRS symbol within a slot. // PTRS symbol index, to be updated every PTRS symbol within a slot.
uint8_t ptrs_symbol_index; uint8_t ptrs_symbol_index;
/// bit mask of PT-RS ofdm symbol indicies /// bit mask of PT-RS ofdm symbol indicies
......
...@@ -51,10 +51,12 @@ ...@@ -51,10 +51,12 @@
* *
*********************************************************************/ *********************************************************************/
int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg,
int mu, int mu,
int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofDownlinkSlots,
int nrofUplinkSlots, int nrofUplinkSymbols) int nrofDownlinkSymbols,
int nrofUplinkSlots,
int nrofUplinkSymbols)
{ {
int slot_number = 0; int slot_number = 0;
......
...@@ -153,6 +153,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -153,6 +153,7 @@ void nr_dlsim_preprocessor(module_id_t module_id,
/* CC_id = */ 0, /* CC_id = */ 0,
sched_ctrl->aggregation_level, sched_ctrl->aggregation_level,
nr_of_candidates, nr_of_candidates,
0,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
sched_ctrl->coreset, sched_ctrl->coreset,
Y); Y);
......
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
#define CONFIG_STRING_MACRLC_MIN_GRANT_PRB "min_grant_prb" #define CONFIG_STRING_MACRLC_MIN_GRANT_PRB "min_grant_prb"
#define CONFIG_STRING_MACRLC_MIN_GRANT_MCS "min_grant_mcs" #define CONFIG_STRING_MACRLC_MIN_GRANT_MCS "min_grant_mcs"
#define CONFIG_STRING_MACRLC_IDENTITY_PM "identity_precoding_matrix" #define CONFIG_STRING_MACRLC_IDENTITY_PM "identity_precoding_matrix"
#define CONFIG_STRING_MACRLC_ANALOG_BEAMFORMING "set_analog_beamforming"
#define CONFIG_STRING_MACRLC_BEAM_DURATION "beam_duration"
#define CONFIG_STRING_MACRLC_BEAMS_PERIOD "beams_per_period"
#define HLP_MACRLC_UL_PRBBLACK "SNR threshold to decide whether a PRB will be blacklisted or not" #define HLP_MACRLC_UL_PRBBLACK "SNR threshold to decide whether a PRB will be blacklisted or not"
#define HLP_MACRLC_DL_BLER_UP "Upper threshold of BLER to decrease DL MCS" #define HLP_MACRLC_DL_BLER_UP "Upper threshold of BLER to decrease DL MCS"
...@@ -85,6 +88,9 @@ ...@@ -85,6 +88,9 @@
#define HLP_MACRLC_MIN_GRANT_PRB "Minimal Periodic ULSCH Grant PRBs" #define HLP_MACRLC_MIN_GRANT_PRB "Minimal Periodic ULSCH Grant PRBs"
#define HLP_MACRLC_MIN_GRANT_MCS "Minimal Periodic ULSCH Grant MCS" #define HLP_MACRLC_MIN_GRANT_MCS "Minimal Periodic ULSCH Grant MCS"
#define HLP_MACRLC_IDENTITY_PM "Flag to use only identity matrix in DL precoding" #define HLP_MACRLC_IDENTITY_PM "Flag to use only identity matrix in DL precoding"
#define HLP_MACRLC_AB "Flag to enable analog beamforming"
#define HLP_MACRLC_BEAM_DURATION "number of consecutive slots for a given set of beams"
#define HLP_MACRLC_BEAMS_PERIOD "set of beams that can be simultaneously allocated in a period"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* MacRLC configuration parameters */ /* MacRLC configuration parameters */
...@@ -127,6 +133,9 @@ ...@@ -127,6 +133,9 @@
{CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS_F1U, NULL, 0, .strptr=NULL, .defstrval=NULL, TYPE_STRING, 0}, \ {CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS_F1U, NULL, 0, .strptr=NULL, .defstrval=NULL, TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_S_SHM_PREFIX, NULL, 0, .strptr=NULL, .defstrval="nvipc", TYPE_STRING, 0}, \ {CONFIG_STRING_MACRLC_TRANSPORT_S_SHM_PREFIX, NULL, 0, .strptr=NULL, .defstrval="nvipc", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_S_POLL_CORE, NULL, 0, .i8ptr=NULL, .defintval=-1, TYPE_INT8, 0}, \ {CONFIG_STRING_MACRLC_TRANSPORT_S_POLL_CORE, NULL, 0, .i8ptr=NULL, .defintval=-1, TYPE_INT8, 0}, \
{CONFIG_STRING_MACRLC_ANALOG_BEAMFORMING, HLP_MACRLC_AB, PARAMFLAG_BOOL, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_BEAM_DURATION, HLP_MACRLC_BEAM_DURATION, 0, .u8ptr=NULL, .defintval=1, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_BEAMS_PERIOD, HLP_MACRLC_BEAMS_PERIOD, 0, .u8ptr=NULL, .defintval=1, TYPE_UINT8, 0}, \
} }
// clang-format off // clang-format off
...@@ -165,6 +174,9 @@ ...@@ -165,6 +174,9 @@
#define MACRLC_LOCAL_N_ADDRESS_F1U_IDX 32 #define MACRLC_LOCAL_N_ADDRESS_F1U_IDX 32
#define MACRLC_TRANSPORT_S_SHM_PREFIX 33 #define MACRLC_TRANSPORT_S_SHM_PREFIX 33
#define MACRLC_TRANSPORT_S_POLL_CORE 34 #define MACRLC_TRANSPORT_S_POLL_CORE 34
#define MACRLC_ANALOG_BEAMFORMING_IDX 35
#define MACRLC_ANALOG_BEAM_DURATION_IDX 36
#define MACRLC_ANALOG_BEAMS_PERIOD_IDX 37
#define MACRLCPARAMS_CHECK { \ #define MACRLCPARAMS_CHECK { \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
...@@ -202,6 +214,9 @@ ...@@ -202,6 +214,9 @@
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s2 = { NULL } }, \ { .s2 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
} }
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
......
...@@ -1405,6 +1405,15 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) ...@@ -1405,6 +1405,15 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
RC.nrmac[j]->identity_pm = *(MacRLC_ParamList.paramarray[j][MACRLC_IDENTITY_PM_IDX].u8ptr); RC.nrmac[j]->identity_pm = *(MacRLC_ParamList.paramarray[j][MACRLC_IDENTITY_PM_IDX].u8ptr);
RC.nrmac[j]->num_ulprbbl = num_prbbl; RC.nrmac[j]->num_ulprbbl = num_prbbl;
memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0]));
bool ab = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAMFORMING_IDX].u8ptr;
if (ab) {
NR_beam_info_t *beam_info = &RC.nrmac[j]->beam_info;
int beams_per_period = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAMS_PERIOD_IDX].u8ptr;
beam_info->beam_allocation = malloc16(beams_per_period * sizeof(int *));
beam_info->beam_duration = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAM_DURATION_IDX].u8ptr;
beam_info->beams_per_period = beams_per_period;
beam_info->beam_allocation_size = -1; // to be initialized once we have information on frame configuration
}
} // for (j=0;j<RC.nb_nr_macrlc_inst;j++) } // for (j=0;j<RC.nb_nr_macrlc_inst;j++)
uint64_t gnb_du_id = 0; uint64_t gnb_du_id = 0;
......
...@@ -1787,8 +1787,8 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1787,8 +1787,8 @@ int get_nr_prach_info_from_index(uint8_t index,
uint8_t *N_dur, uint8_t *N_dur,
uint16_t *RA_sfn_index, uint16_t *RA_sfn_index,
uint8_t *N_RA_slot, uint8_t *N_RA_slot,
uint8_t *config_period) { uint8_t *config_period)
{
int x,y; int x,y;
int64_t s_map; int64_t s_map;
uint8_t format2 = 0xff; uint8_t format2 = 0xff;
...@@ -1800,20 +1800,20 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1800,20 +1800,20 @@ int get_nr_prach_info_from_index(uint8_t index,
y = table_6_3_3_2_4_prachConfig_Index[index][3]; y = table_6_3_3_2_4_prachConfig_Index[index][3];
y2 = table_6_3_3_2_4_prachConfig_Index[index][4]; y2 = table_6_3_3_2_4_prachConfig_Index[index][4];
// checking n_sfn mod x = y // checking n_sfn mod x = y
if ( (frame%x)==y || (frame%x)==y2 ) { if ((frame % x) == y || (frame % x) == y2) {
slot_60khz = slot >> (mu-2); // in table slots are numbered wrt 60kHz slot_60khz = slot >> (mu - 2); // in table slots are numbered wrt 60kHz
s_map = table_6_3_3_2_4_prachConfig_Index[index][5]; s_map = table_6_3_3_2_4_prachConfig_Index[index][5];
if ((s_map >> slot_60khz) & 0x01 ) { if ((s_map >> slot_60khz) & 0x01) {
for(int i = 0; i <= slot_60khz ;i++) { for(int i = 0; i <= slot_60khz ;i++) {
if ( (s_map >> i) & 0x01) { if ((s_map >> i) & 0x01) {
(*RA_sfn_index)++; (*RA_sfn_index)++;
} }
} }
} }
if ( ((s_map>>slot_60khz)&0x01) ) { if (((s_map >> slot_60khz) & 0x01)) {
*N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe *N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe
if (mu == 3) { if (mu == 3) {
if ( (*N_RA_slot == 1) && (slot%2 == 0) ) if ((*N_RA_slot == 1) && (slot % 2 == 0) )
return 0; // no prach in even slots @ 120kHz for 1 prach per 60khz slot return 0; // no prach in even slots @ 120kHz for 1 prach per 60khz slot
} }
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){
...@@ -1850,23 +1850,23 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1850,23 +1850,23 @@ int get_nr_prach_info_from_index(uint8_t index,
if (unpaired) { if (unpaired) {
x = table_6_3_3_2_3_prachConfig_Index[index][2]; x = table_6_3_3_2_3_prachConfig_Index[index][2];
y = table_6_3_3_2_3_prachConfig_Index[index][3]; y = table_6_3_3_2_3_prachConfig_Index[index][3];
if ( (frame%x)==y ) { if ((frame % x) == y) {
subframe = slot >> mu; subframe = slot >> mu;
s_map = table_6_3_3_2_3_prachConfig_Index[index][4]; s_map = table_6_3_3_2_3_prachConfig_Index[index][4];
if ((s_map >> subframe) & 0x01 ) { if ((s_map >> subframe) & 0x01) {
for(int i = 0; i <= subframe ;i++) { for(int i = 0; i <= subframe ;i++) {
if ( (s_map >> i) & 0x01) { if ((s_map >> i) & 0x01) {
(*RA_sfn_index)++; (*RA_sfn_index)++;
} }
} }
} }
if ( (s_map>>subframe)&0x01 ) { if ((s_map >> subframe) & 0x01 ) {
*N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe *N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe
if (mu == 1 && index >= 67) { if (mu == 1 && index >= 67) {
if ( (*N_RA_slot <= 1) && (slot%2 == 0) ) if ((*N_RA_slot <= 1) && (slot % 2 == 0))
return 0; // no prach in even slots @ 30kHz for 1 prach per subframe return 0; // no prach in even slots @ 30kHz for 1 prach per subframe
} }
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL) {
*config_period = x; *config_period = x;
*start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5]; *start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5];
*N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7]; *N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7];
...@@ -1874,17 +1874,19 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1874,17 +1874,19 @@ int get_nr_prach_info_from_index(uint8_t index,
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1)
format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1]; format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1];
*format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8); *format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8);
LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame, LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n",
slot, frame,
index, table_6_3_3_2_3_prachConfig_Index[index][6], slot,
pointa, index,
mu, table_6_3_3_2_3_prachConfig_Index[index][6],
unpaired, pointa,
*start_symbol, mu,
*N_t_slot, unpaired,
*N_dur, *start_symbol,
*N_RA_slot, *N_t_slot,
*RA_sfn_index); *N_dur,
*N_RA_slot,
*RA_sfn_index);
} }
return 1; return 1;
} }
...@@ -1897,10 +1899,10 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1897,10 +1899,10 @@ int get_nr_prach_info_from_index(uint8_t index,
else { // FDD else { // FDD
x = table_6_3_3_2_2_prachConfig_Index[index][2]; x = table_6_3_3_2_2_prachConfig_Index[index][2];
y = table_6_3_3_2_2_prachConfig_Index[index][3]; y = table_6_3_3_2_2_prachConfig_Index[index][3];
if ( (frame%x)==y ) { if ((frame % x) == y) {
subframe = slot >> mu; subframe = slot >> mu;
s_map = table_6_3_3_2_2_prachConfig_Index[index][4]; s_map = table_6_3_3_2_2_prachConfig_Index[index][4];
if ( (s_map>>subframe)&0x01 ) { if ((s_map>>subframe) & 0x01) {
*N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; // Number of RACH slots within a subframe *N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; // Number of RACH slots within a subframe
if (mu == 1) { if (mu == 1) {
if ((*N_RA_slot <= 1) && (slot % 2 == 0)){ if ((*N_RA_slot <= 1) && (slot % 2 == 0)){
...@@ -1908,7 +1910,7 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1908,7 +1910,7 @@ int get_nr_prach_info_from_index(uint8_t index,
} }
} }
for(int i = 0; i <= subframe ; i++) { for(int i = 0; i <= subframe ; i++) {
if ( (s_map >> i) & 0x01) { if ((s_map >> i) & 0x01) {
(*RA_sfn_index)++; (*RA_sfn_index)++;
} }
} }
......
...@@ -2628,7 +2628,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) ...@@ -2628,7 +2628,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot)
uint16_t bwp_size = current_DL_BWP->BWPSize; uint16_t bwp_size = current_DL_BWP->BWPSize;
uint16_t bwp_start = current_DL_BWP->BWPStart; uint16_t bwp_start = current_DL_BWP->BWPStart;
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++) {
NR_NZP_CSI_RS_Resource_t *nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; NR_NZP_CSI_RS_Resource_t *nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
int period, offset; int period, offset;
csi_period_offset(NULL, nzpcsi->periodicityAndOffset, &period, &offset); csi_period_offset(NULL, nzpcsi->periodicityAndOffset, &period, &offset);
...@@ -2644,7 +2644,10 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) ...@@ -2644,7 +2644,10 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot)
csirs_config_pdu->subcarrier_spacing = mu; csirs_config_pdu->subcarrier_spacing = mu;
csirs_config_pdu->cyclic_prefix = current_DL_BWP->cyclicprefix ? *current_DL_BWP->cyclicprefix : 0; csirs_config_pdu->cyclic_prefix = current_DL_BWP->cyclicprefix ? *current_DL_BWP->cyclicprefix : 0;
csirs_config_pdu->csi_type = 1; // NZP-CSI-RS if (csi_res_id > NR_maxNrofCSI_ResourceConfigurations)
csirs_config_pdu->csi_type = 0; // TRS
else
csirs_config_pdu->csi_type = 1; // NZP-CSI-RS
csirs_config_pdu->scramb_id = nzpcsi->scramblingID; csirs_config_pdu->scramb_id = nzpcsi->scramblingID;
csirs_config_pdu->power_control_offset = nzpcsi->powerControlOffset + 8; csirs_config_pdu->power_control_offset = nzpcsi->powerControlOffset + 8;
......
...@@ -587,20 +587,31 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant ...@@ -587,20 +587,31 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
AssertFatal(periods_per_frame > 0, "TDD configuration cannot be configured\n"); AssertFatal(periods_per_frame > 0, "TDD configuration cannot be configured\n");
if (frequency_range == FR2) {
LOG_I(NR_MAC, "Configuring TDD beam association to default\n");
nrmac->tdd_beam_association = malloc16(periods_per_frame * sizeof(int16_t));
for (int i = 0; i < periods_per_frame; ++i)
nrmac->tdd_beam_association[i] = -1; /* default: beams not configured */
} else {
nrmac->tdd_beam_association = NULL; /* default: no beams */
}
} }
// precoding matrix configuration (to be improved) // precoding matrix configuration (to be improved)
cfg->pmi_list = init_DL_MIMO_codebook(nrmac, pdsch_AntennaPorts); cfg->pmi_list = init_DL_MIMO_codebook(nrmac, pdsch_AntennaPorts);
} }
static void initialize_beam_information(NR_beam_info_t *beam_info, int mu, int slots_per_frame)
{
if(!beam_info->beam_allocation)
return;
int size = mu == 0 ? slots_per_frame << 1 : slots_per_frame;
// slots in beam duration gives the number of consecutive slots tied the the same beam
AssertFatal(size % beam_info->beam_duration == 0,
"Beam duration %d should be divider of number of slots per frame %d\n",
beam_info->beam_duration,
slots_per_frame);
beam_info->beam_allocation_size = size / beam_info->beam_duration;
for (int i = 0; i < beam_info->beams_per_period; i++) {
beam_info->beam_allocation[i] = malloc16(beam_info->beam_allocation_size * sizeof(int));
for (int j = 0; j < beam_info->beam_allocation_size; j++)
beam_info->beam_allocation[i][j] = -1;
}
}
void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config)
{ {
DevAssert(nrmac != NULL); DevAssert(nrmac != NULL);
...@@ -614,16 +625,23 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c ...@@ -614,16 +625,23 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
const int NTN_gNB_Koffset = get_NTN_Koffset(scc); const int NTN_gNB_Koffset = get_NTN_Koffset(scc);
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const int size = n << (int)ceil(log2((NTN_gNB_Koffset + 13) / n + 1)); // 13 is upper limit for max_fb_time const int size = n << (int)ceil(log2((NTN_gNB_Koffset + 13) / n + 1)); // 13 is upper limit for max_fb_time
nrmac->vrb_map_UL_size = size; nrmac->vrb_map_UL_size = size;
nrmac->common_channels[0].vrb_map_UL = calloc(size * MAX_BWP_SIZE, sizeof(uint16_t));
AssertFatal(nrmac->common_channels[0].vrb_map_UL, int num_beams = 1;
"could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n"); if(nrmac->beam_info.beam_allocation)
num_beams = nrmac->beam_info.beams_per_period;
for (int i = 0; i < num_beams; i++) {
nrmac->common_channels[0].vrb_map_UL[i] = calloc(size * MAX_BWP_SIZE, sizeof(uint16_t));
AssertFatal(nrmac->common_channels[0].vrb_map_UL[i],
"could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL[%d]\n", i);
}
nrmac->UL_tti_req_ahead_size = size; nrmac->UL_tti_req_ahead_size = size;
nrmac->UL_tti_req_ahead[0] = calloc(size, sizeof(nfapi_nr_ul_tti_request_t)); nrmac->UL_tti_req_ahead[0] = calloc(size, sizeof(nfapi_nr_ul_tti_request_t));
AssertFatal(nrmac->UL_tti_req_ahead[0], "could not allocate memory for nrmac->UL_tti_req_ahead[0]\n"); AssertFatal(nrmac->UL_tti_req_ahead[0], "could not allocate memory for nrmac->UL_tti_req_ahead[0]\n");
initialize_beam_information(&nrmac->beam_info, *scc->ssbSubcarrierSpacing, n);
LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n");
config_common(nrmac, config->pdsch_AntennaPorts, config->pusch_AntennaPorts, scc); config_common(nrmac, config->pdsch_AntennaPorts, config->pusch_AntennaPorts, scc);
......
...@@ -146,6 +146,24 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB, ...@@ -146,6 +146,24 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
TX_req[CC_idP].Number_of_PDUs = 0; TX_req[CC_idP].Number_of_PDUs = 0;
} }
void clear_beam_information(NR_beam_info_t *beam_info, int frame, int slot, int mu)
{
// for now we use the same logic of UL_tti_req_ahead
// reset after 1 frame with the exception of 15kHz
if(!beam_info->beam_allocation)
return;
// initialization done only once
const int slots_per_frame = nr_slots_per_frame[mu];
AssertFatal(beam_info->beam_allocation_size >= 0, "Beam information not initialized\n");
int idx_to_clear = (frame * slots_per_frame + slot) / beam_info->beam_duration;
idx_to_clear = (idx_to_clear + beam_info->beam_allocation_size - 1) % beam_info->beam_allocation_size;
if (slot % beam_info->beam_duration == 0) {
// resetting previous period allocation
for (int i = 0; i < beam_info->beams_per_period; i++)
beam_info->beam_allocation[i][idx_to_clear] = -1;
}
}
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) {
return (bitmap >> (slot % 64)) & 0x01; return (bitmap >> (slot % 64)) & 0x01;
} }
...@@ -195,19 +213,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ ...@@ -195,19 +213,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
gNB_MAC_INST *gNB = RC.nrmac[module_idP]; gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = gNB->common_channels; NR_COMMON_channels_t *cc = gNB->common_channels;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_SCHED_LOCK(&gNB->sched_lock); NR_SCHED_LOCK(&gNB->sched_lock);
if (slot==0 && (*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]>=257)) { clear_beam_information(&gNB->beam_info, frame, slot, *scc->ssbSubcarrierSpacing);
//FR2
const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
AssertFatal(tdd,"Dynamic TDD not handled yet\n");
const int nb_periods_per_frame = get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
// re-initialization of tdd_beam_association at beginning of frame
for (int i=0; i<nb_periods_per_frame; i++)
gNB->tdd_beam_association[i] = -1;
}
gNB->frame = frame; gNB->frame = frame;
start_meas(&gNB->eNB_scheduler); start_meas(&gNB->eNB_scheduler);
...@@ -224,17 +234,20 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ ...@@ -224,17 +234,20 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
} }
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
//mbsfn_status[CC_id] = 0; int num_beams = 1;
if(gNB->beam_info.beam_allocation)
num_beams = gNB->beam_info.beams_per_period;
// clear vrb_maps // clear vrb_maps
memset(cc[CC_id].vrb_map, 0, sizeof(uint16_t) * MAX_BWP_SIZE); for (int i = 0; i < num_beams; i++)
memset(cc[CC_id].vrb_map[i], 0, sizeof(uint16_t) * MAX_BWP_SIZE);
// clear last scheduled slot's content (only)! // clear last scheduled slot's content (only)!
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const int size = gNB->vrb_map_UL_size; const int size = gNB->vrb_map_UL_size;
const int prev_slot = frame * num_slots + slot + size - 1; const int prev_slot = frame * num_slots + slot + size - 1;
uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL; for (int i = 0; i < num_beams; i++) {
memcpy(&vrb_map_UL[prev_slot % size * MAX_BWP_SIZE], &gNB->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE); uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL[i];
memcpy(&vrb_map_UL[prev_slot % size * MAX_BWP_SIZE], &gNB->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE);
}
clear_nr_nfapi_information(gNB, CC_id, frame, slot, &sched_info->DL_req, &sched_info->TX_req, &sched_info->UL_dci_req); clear_nr_nfapi_information(gNB, CC_id, frame, slot, &sched_info->DL_req, &sched_info->TX_req, &sched_info->UL_dci_req);
} }
......
...@@ -543,10 +543,14 @@ static bool allocate_dl_retransmission(module_id_t module_id, ...@@ -543,10 +543,14 @@ static bool allocate_dl_retransmission(module_id_t module_id,
retInfo->tda_info = temp_tda; retInfo->tda_info = temp_tda;
} }
// TODO properly set the beam index (currently only done for RA)
int beam = 0;
/* Find a free CCE */ /* Find a free CCE */
int CCEIndex = get_cce_index(nr_mac, int CCEIndex = get_cce_index(nr_mac,
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
beam,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -565,8 +569,8 @@ static bool allocate_dl_retransmission(module_id_t module_id, ...@@ -565,8 +569,8 @@ static bool allocate_dl_retransmission(module_id_t module_id,
int alloc = -1; int alloc = -1;
if (!get_FeedbackDisabled(UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, current_harq_pid)) { if (!get_FeedbackDisabled(UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, current_harq_pid)) {
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex); int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex);
alloc = nr_acknack_scheduling(nr_mac, UE, frame, slot, r_pucch, 0); alloc = nr_acknack_scheduling(nr_mac, UE, frame, slot, beam, r_pucch, 0);
if (alloc<0) { if (alloc < 0) {
LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI retransmission\n", LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI retransmission\n",
UE->rnti, UE->rnti,
frame, frame,
...@@ -580,7 +584,8 @@ static bool allocate_dl_retransmission(module_id_t module_id, ...@@ -580,7 +584,8 @@ static bool allocate_dl_retransmission(module_id_t module_id,
/* CC_id = */ 0, /* CC_id = */ 0,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
beam);
/* just reuse from previous scheduling opportunity, set new start RB */ /* just reuse from previous scheduling opportunity, set new start RB */
sched_ctrl->sched_pdsch = *retInfo; sched_ctrl->sched_pdsch = *retInfo;
sched_ctrl->sched_pdsch.rbStart = rbStart; sched_ctrl->sched_pdsch.rbStart = rbStart;
...@@ -736,9 +741,13 @@ static void pf_dl(module_id_t module_id, ...@@ -736,9 +741,13 @@ static void pf_dl(module_id_t module_id,
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
sched_pdsch->dl_harq_pid = sched_ctrl->available_dl_harq.head; sched_pdsch->dl_harq_pid = sched_ctrl->available_dl_harq.head;
// TODO properly set the beam index (currently only done for RA)
int beam = 0;
int CCEIndex = get_cce_index(mac, int CCEIndex = get_cce_index(mac,
CC_id, slot, iterator->UE->rnti, CC_id, slot, iterator->UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
beam,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -758,8 +767,8 @@ static void pf_dl(module_id_t module_id, ...@@ -758,8 +767,8 @@ static void pf_dl(module_id_t module_id,
int alloc = -1; int alloc = -1;
if (!get_FeedbackDisabled(iterator->UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, sched_pdsch->dl_harq_pid)) { if (!get_FeedbackDisabled(iterator->UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, sched_pdsch->dl_harq_pid)) {
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex); int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex);
alloc = nr_acknack_scheduling(mac, iterator->UE, frame, slot, r_pucch, 0); alloc = nr_acknack_scheduling(mac, iterator->UE, frame, slot, beam, r_pucch, 0);
if (alloc<0) { if (alloc < 0) {
LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI\n", LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI\n",
rnti, rnti,
frame, frame,
...@@ -774,7 +783,8 @@ static void pf_dl(module_id_t module_id, ...@@ -774,7 +783,8 @@ static void pf_dl(module_id_t module_id,
/* CC_id = */ 0, /* CC_id = */ 0,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
beam);
/* MCS has been set above */ /* MCS has been set above */
sched_pdsch->time_domain_allocation = get_dl_tda(mac, scc, slot); sched_pdsch->time_domain_allocation = get_dl_tda(mac, scc, slot);
...@@ -874,7 +884,8 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -874,7 +884,8 @@ static void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_
const uint16_t BWPStart = current_BWP->BWPStart; const uint16_t BWPStart = current_BWP->BWPStart;
const uint16_t slbitmap = SL_to_bitmap(startSymbolIndex, nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(startSymbolIndex, nrOfSymbols);
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; // TODO improve handling of beam in vrb_map (for now just using 0)
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map[0];
uint16_t rballoc_mask[bwpSize]; uint16_t rballoc_mask[bwpSize];
int n_rb_sched = 0; int n_rb_sched = 0;
......
...@@ -85,11 +85,14 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -85,11 +85,14 @@ void nr_preprocessor_phytest(module_id_t module_id,
const int bwpSize = dl_bwp->BWPSize; const int bwpSize = dl_bwp->BWPSize;
const int BWPStart = dl_bwp->BWPStart; const int BWPStart = dl_bwp->BWPStart;
// TODO implement beam procedures for phy-test mode
int beam = 0;
int rbStart = 0; int rbStart = 0;
int rbSize = 0; int rbSize = 0;
if (target_dl_bw>bwpSize) if (target_dl_bw>bwpSize)
target_dl_bw = bwpSize; target_dl_bw = bwpSize;
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map[beam];
/* loop ensures that we allocate exactly target_dl_bw, or return */ /* loop ensures that we allocate exactly target_dl_bw, or return */
while (true) { while (true) {
/* advance to first free RB */ /* advance to first free RB */
...@@ -133,6 +136,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -133,6 +136,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
int CCEIndex = get_cce_index(RC.nrmac[module_id], int CCEIndex = get_cce_index(RC.nrmac[module_id],
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
beam,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -149,11 +153,10 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -149,11 +153,10 @@ void nr_preprocessor_phytest(module_id_t module_id,
int alloc = -1; int alloc = -1;
if (!get_FeedbackDisabled(UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, sched_pdsch->dl_harq_pid)) { if (!get_FeedbackDisabled(UE->sc_info.downlinkHARQ_FeedbackDisabled_r17, sched_pdsch->dl_harq_pid)) {
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, UE->current_UL_BWP.pucch_Config, CCEIndex); int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, UE->current_UL_BWP.pucch_Config, CCEIndex);
alloc = nr_acknack_scheduling(RC.nrmac[module_id], UE, frame, slot, r_pucch, 0); alloc = nr_acknack_scheduling(RC.nrmac[module_id], UE, frame, slot, 0, r_pucch, 0);
if (alloc < 0) { if (alloc < 0) {
LOG_D(MAC, LOG_D(MAC,
"%s(): could not find PUCCH for UE %04x@%d.%d\n", "Could not find PUCCH for UE %04x@%d.%d\n",
__func__,
rnti, rnti,
frame, frame,
slot); slot);
...@@ -167,7 +170,8 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -167,7 +170,8 @@ void nr_preprocessor_phytest(module_id_t module_id,
CC_id, CC_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
beam);
//AssertFatal(alloc, //AssertFatal(alloc,
// "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n", // "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n",
...@@ -283,8 +287,12 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -283,8 +287,12 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
return false; return false;
sched_ctrl->sched_pusch.tda_info = tda_info; sched_ctrl->sched_pusch.tda_info = tda_info;
sched_ctrl->sched_pusch.time_domain_allocation = tda; sched_ctrl->sched_pusch.time_domain_allocation = tda;
// TODO implement beam procedures for phy-test mode
int beam = 0;
const int buffer_index = ul_buffer_index(sched_frame, sched_slot, mu, nr_mac->vrb_map_UL_size); const int buffer_index = ul_buffer_index(sched_frame, sched_slot, mu, nr_mac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &nr_mac->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE]; uint16_t *vrb_map_UL = &nr_mac->common_channels[CC_id].vrb_map_UL[beam][buffer_index * MAX_BWP_SIZE];
for (int i = rbStart; i < rbStart + rbSize; ++i) { for (int i = rbStart; i < rbStart + rbSize; ++i) {
if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) != 0) { if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) != 0) {
LOG_E(MAC, "%4d.%2d RB %d is already reserved, cannot schedule UE\n", frame, slot, i); LOG_E(MAC, "%4d.%2d RB %d is already reserved, cannot schedule UE\n", frame, slot, i);
...@@ -298,6 +306,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -298,6 +306,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
int CCEIndex = get_cce_index(nr_mac, int CCEIndex = get_cce_index(nr_mac,
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
beam,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -349,7 +358,8 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -349,7 +358,8 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
CC_id, CC_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
beam);
for (int rb = rbStart; rb < rbStart + rbSize; rb++) for (int rb = rbStart; rb < rbStart + rbSize; rb++)
vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols); vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
......
...@@ -501,11 +501,12 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac, ...@@ -501,11 +501,12 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac,
int cc_id, int cc_id,
int aggregation, int aggregation,
int nr_of_candidates, int nr_of_candidates,
int beam_idx,
const NR_sched_pdcch_t *pdcch, const NR_sched_pdcch_t *pdcch,
const NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
uint32_t Y) uint32_t Y)
{ {
const uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map; const uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map[beam_idx];
const int N_ci = 0; const int N_ci = 0;
const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol
...@@ -546,6 +547,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac, ...@@ -546,6 +547,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
uint8_t *aggregation_level, uint8_t *aggregation_level,
int beam_idx,
const NR_SearchSpace_t *ss, const NR_SearchSpace_t *ss,
const NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
NR_sched_pdcch_t *sched_pdcch, NR_sched_pdcch_t *sched_pdcch,
...@@ -567,6 +569,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac, ...@@ -567,6 +569,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac,
CC_id, CC_id,
*aggregation_level, *aggregation_level,
nr_of_candidates, nr_of_candidates,
beam_idx,
sched_pdcch, sched_pdcch,
coreset, coreset,
Y); Y);
...@@ -577,9 +580,10 @@ void fill_pdcch_vrb_map(gNB_MAC_INST *mac, ...@@ -577,9 +580,10 @@ void fill_pdcch_vrb_map(gNB_MAC_INST *mac,
int CC_id, int CC_id,
NR_sched_pdcch_t *pdcch, NR_sched_pdcch_t *pdcch,
int first_cce, int first_cce,
int aggregation){ int aggregation,
int beam)
uint16_t *vrb_map = mac->common_channels[CC_id].vrb_map; {
uint16_t *vrb_map = mac->common_channels[CC_id].vrb_map[beam];
int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol
int L = pdcch->RegBundleSize; int L = pdcch->RegBundleSize;
...@@ -2725,7 +2729,9 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo ...@@ -2725,7 +2729,9 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo
NR_SCHED_ENSURE_LOCKED(&gNB_mac->sched_lock); NR_SCHED_ENSURE_LOCKED(&gNB_mac->sched_lock);
uint16_t *vrb_map = gNB_mac->common_channels[CC_id].vrb_map; // TODO implement beam procedures
int beam = 0;
uint16_t *vrb_map = gNB_mac->common_channels[CC_id].vrb_map[beam];
UE_info->sched_csirs = 0; UE_info->sched_csirs = 0;
...@@ -3110,6 +3116,43 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t ...@@ -3110,6 +3116,43 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t
} }
} }
static inline int get_beam_index(const NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame)
{
return ((frame * slots_per_frame + slot) / beam_info->beam_duration) % beam_info->beam_allocation_size;
}
NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame)
{
// if no beam allocation for analog beamforming we always return beam index 0 (no multiple beams)
if (!beam_info->beam_allocation)
return (NR_beam_alloc_t) {.new_beam = false, .idx = 0};
const int index = get_beam_index(beam_info, frame, slot, beam_index, slots_per_frame);
for (int i = 0; i < beam_info->beams_per_period; i++) {
NR_beam_alloc_t beam_struct = {.new_beam = false, .idx = i};
int *beam = &beam_info->beam_allocation[i][index];
if (*beam == -1) {
beam_struct.new_beam = true;
*beam = beam_index;
}
if (*beam == beam_index)
return beam_struct;
}
return (NR_beam_alloc_t) {.new_beam = false, .idx = -1};
}
void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame, bool new_beam)
{
if(!new_beam) // need to reset only if the beam was allocated specifically for this instance
return;
const int index = get_beam_index(beam_info, frame, slot, beam_index, slots_per_frame);
for (int i = 0; i < beam_info->beams_per_period; i++) {
if (beam_info->beam_allocation[i][index] == beam_index)
beam_info->beam_allocation[i][index] = -1;
}
}
void send_initial_ul_rrc_message(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data) void send_initial_ul_rrc_message(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data)
{ {
gNB_MAC_INST *mac = RC.nrmac[0]; gNB_MAC_INST *mac = RC.nrmac[0];
......
...@@ -470,7 +470,8 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, ...@@ -470,7 +470,8 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
srs_pdu->beamforming.prg_size = 1; srs_pdu->beamforming.prg_size = 1;
} }
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE]; // TODO properly use beam allocation
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[0][buffer_index * MAX_BWP_SIZE];
uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols); uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols);
for (int i = 0; i < srs_pdu->bwp_size; ++i) for (int i = 0; i < srs_pdu->bwp_size; ++i)
vrb_map_UL[i + srs_pdu->bwp_start] |= mask; vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
......
...@@ -279,8 +279,9 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -279,8 +279,9 @@ void nr_csi_meas_reporting(int Mod_idP,
int bwp_start = ul_bwp->BWPStart; int bwp_start = ul_bwp->BWPStart;
// going through the list of PUCCH resources to find the one indexed by resource_id // going through the list of PUCCH resources to find the one indexed by resource_id
int beam_idx = 0; // TODO proper beam allocation
const int index = ul_buffer_index(sched_frame, sched_slot, ul_bwp->scs, nrmac->vrb_map_UL_size); const int index = ul_buffer_index(sched_frame, sched_slot, ul_bwp->scs, nrmac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &nrmac->common_channels[0].vrb_map_UL[index * MAX_BWP_SIZE]; uint16_t *vrb_map_UL = &nrmac->common_channels[0].vrb_map_UL[beam_idx][index * MAX_BWP_SIZE];
const int m = pucch_Config->resourceToAddModList->list.count; const int m = pucch_Config->resourceToAddModList->list.count;
for (int j = 0; j < m; j++) { for (int j = 0; j < m; j++) {
NR_PUCCH_Resource_t *pucchres = pucch_Config->resourceToAddModList->list.array[j]; NR_PUCCH_Resource_t *pucchres = pucch_Config->resourceToAddModList->list.array[j];
...@@ -1239,6 +1240,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -1239,6 +1240,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
NR_UE_info_t *UE, NR_UE_info_t *UE,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot,
int beam_index,
int r_pucch, int r_pucch,
int is_common) int is_common)
{ {
...@@ -1328,15 +1330,27 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -1328,15 +1330,27 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
else { // unoccupied occasion else { // unoccupied occasion
// checking if in ul_slot the resources potentially to be assigned to this PUCCH are available // checking if in ul_slot the resources potentially to be assigned to this PUCCH are available
set_pucch_allocation(ul_bwp, r_pucch, bwp_size, curr_pucch); set_pucch_allocation(ul_bwp, r_pucch, bwp_size, curr_pucch);
NR_beam_alloc_t beam = beam_allocation_procedure(&mac->beam_info, pucch_frame, pucch_slot, beam_index, n_slots_frame);
if (beam.idx < 0) {
LOG_D(NR_MAC,
"DL %4d.%2d, UL_ACK %4d.%2d beam resources for this occasion are already occupied, move to the following occasion\n",
frame,
slot,
pucch_frame,
pucch_slot);
continue;
}
const int index = ul_buffer_index(pucch_frame, pucch_slot, ul_bwp->scs, mac->vrb_map_UL_size); const int index = ul_buffer_index(pucch_frame, pucch_slot, ul_bwp->scs, mac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &mac->common_channels[CC_id].vrb_map_UL[index * MAX_BWP_SIZE]; uint16_t *vrb_map_UL = &mac->common_channels[CC_id].vrb_map_UL[beam.idx][index * MAX_BWP_SIZE];
bool ret = test_pucch0_vrb_occupation(curr_pucch, bool ret = test_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start, bwp_size);
vrb_map_UL,
bwp_start,
bwp_size);
if(!ret) { if(!ret) {
LOG_D(NR_MAC, "DL %4d.%2d, UL_ACK %4d.%2d PRB resources for this occasion are already occupied, move to the following occasion\n", LOG_D(NR_MAC,
frame, slot, pucch_frame, pucch_slot); "DL %4d.%2d, UL_ACK %4d.%2d PRB resources for this occasion are already occupied, move to the following occasion\n",
frame,
slot,
pucch_frame,
pucch_slot);
reset_beam_status(&mac->beam_info, pucch_frame, pucch_slot, beam_index, n_slots_frame, beam.new_beam);
continue; continue;
} }
// allocating a new PUCCH structure for this occasion // allocating a new PUCCH structure for this occasion
...@@ -1428,8 +1442,9 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) ...@@ -1428,8 +1442,9 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
continue; continue;
} }
else { else {
int beam_idx = 0; // TODO proper beam allocation
const int index = ul_buffer_index(SFN, slot, ul_bwp->scs, nrmac->vrb_map_UL_size); const int index = ul_buffer_index(SFN, slot, ul_bwp->scs, nrmac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &nrmac->common_channels[CC_id].vrb_map_UL[index * MAX_BWP_SIZE]; uint16_t *vrb_map_UL = &nrmac->common_channels[CC_id].vrb_map_UL[beam_idx][index * MAX_BWP_SIZE];
const int bwp_start = ul_bwp->BWPStart; const int bwp_start = ul_bwp->BWPStart;
const int bwp_size = ul_bwp->BWPSize; const int bwp_size = ul_bwp->BWPSize;
set_pucch_allocation(ul_bwp, -1, bwp_size, curr_pucch); set_pucch_allocation(ul_bwp, -1, bwp_size, curr_pucch);
......
...@@ -1708,6 +1708,7 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1708,6 +1708,7 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
int CCEIndex = get_cce_index(nrmac, int CCEIndex = get_cce_index(nrmac,
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
0, // TODO use beam index
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -1725,7 +1726,8 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1725,7 +1726,8 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
CC_id, CC_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
0); // TODO use beam index when implemented
/* frame/slot in sched_pusch has been set previously. In the following, we /* frame/slot in sched_pusch has been set previously. In the following, we
* overwrite the information in the retransmission information before storing * overwrite the information in the retransmission information before storing
...@@ -1866,6 +1868,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1866,6 +1868,7 @@ static void pf_ul(module_id_t module_id,
int CCEIndex = get_cce_index(nrmac, int CCEIndex = get_cce_index(nrmac,
CC_id, slot, UE->rnti, CC_id, slot, UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
0, // TODO use beam index
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -1912,7 +1915,8 @@ static void pf_ul(module_id_t module_id, ...@@ -1912,7 +1915,8 @@ static void pf_ul(module_id_t module_id,
CC_id, CC_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
0); // TODO use beam index);
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
sched_pusch->mcs = min(nrmac->min_grant_mcs, sched_pusch->mcs); sched_pusch->mcs = min(nrmac->min_grant_mcs, sched_pusch->mcs);
...@@ -1983,6 +1987,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1983,6 +1987,7 @@ static void pf_ul(module_id_t module_id,
int CCEIndex = get_cce_index(nrmac, int CCEIndex = get_cce_index(nrmac,
CC_id, slot, iterator->UE->rnti, CC_id, slot, iterator->UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
0, // TODO use beam index
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
...@@ -2089,7 +2094,8 @@ static void pf_ul(module_id_t module_id, ...@@ -2089,7 +2094,8 @@ static void pf_ul(module_id_t module_id,
CC_id, CC_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level,
0); // TODO use beam index);
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
...@@ -2155,7 +2161,8 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -2155,7 +2161,8 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_
* vrb_map_UL) overlap with the "default" tda and exclude those RBs. * vrb_map_UL) overlap with the "default" tda and exclude those RBs.
* Calculate largest contiguous RBs */ * Calculate largest contiguous RBs */
const int index = ul_buffer_index(sched_frame, sched_slot, mu, nr_mac->vrb_map_UL_size); const int index = ul_buffer_index(sched_frame, sched_slot, mu, nr_mac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &nr_mac->common_channels[CC_id].vrb_map_UL[index * MAX_BWP_SIZE]; // TODO improve handling of beam in vrb_map (for now just using 0)
uint16_t *vrb_map_UL = &nr_mac->common_channels[CC_id].vrb_map_UL[0][index * MAX_BWP_SIZE];
const uint16_t bwpSize = current_BWP->BWPSize; const uint16_t bwpSize = current_BWP->BWPSize;
const uint16_t bwpStart = current_BWP->BWPStart; const uint16_t bwpStart = current_BWP->BWPStart;
......
...@@ -175,6 +175,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -175,6 +175,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
NR_UE_info_t *UE, NR_UE_info_t *UE,
frame_t frameP, frame_t frameP,
sub_frame_t slotP, sub_frame_t slotP,
int beam_index,
int r_pucch, int r_pucch,
int do_common); int do_common);
...@@ -214,6 +215,7 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac, ...@@ -214,6 +215,7 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac,
int cc_id, int cc_id,
int aggregation, int aggregation,
int nr_of_candidates, int nr_of_candidates,
int beam_idx,
const NR_sched_pdcch_t *pdcch, const NR_sched_pdcch_t *pdcch,
const NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
uint32_t Y); uint32_t Y);
...@@ -222,7 +224,8 @@ void fill_pdcch_vrb_map(gNB_MAC_INST *mac, ...@@ -222,7 +224,8 @@ void fill_pdcch_vrb_map(gNB_MAC_INST *mac,
int CC_id, int CC_id,
NR_sched_pdcch_t *pdcch, NR_sched_pdcch_t *pdcch,
int first_cce, int first_cce,
int aggregation); int aggregation,
int beam);
void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo, void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo,
const NR_UE_DL_BWP_t *current_DL_BWP, const NR_UE_DL_BWP_t *current_DL_BWP,
...@@ -396,6 +399,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac, ...@@ -396,6 +399,7 @@ int get_cce_index(const gNB_MAC_INST *nrmac,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
uint8_t *aggregation_level, uint8_t *aggregation_level,
int beam_idx,
const NR_SearchSpace_t *ss, const NR_SearchSpace_t *ss,
const NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
NR_sched_pdcch_t *sched_pdcch, NR_sched_pdcch_t *sched_pdcch,
...@@ -420,9 +424,11 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options, ...@@ -420,9 +424,11 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
frame_t frame); frame_t frame);
int ul_buffer_index(int frame, int slot, int scs, int size); int ul_buffer_index(int frame, int slot, int scs, int size);
void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t frameP, int slotP); void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t frameP, int slotP);
NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame);
void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame, bool new_beam);
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP); void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP);
size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp); size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp);
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
#define MAX_NUM_OF_SSB 64 #define MAX_NUM_OF_SSB 64
#define MAX_NUM_NR_PRACH_PREAMBLES 64 #define MAX_NUM_NR_PRACH_PREAMBLES 64
#define MIN_NUM_PRBS_TO_SCHEDULE 5 #define MIN_NUM_PRBS_TO_SCHEDULE 5
#define MAX_NUM_BEAM_PERIODS 4
extern const uint8_t nr_rv_round_map[4]; extern const uint8_t nr_rv_round_map[4];
...@@ -120,8 +121,15 @@ typedef enum { ...@@ -120,8 +121,15 @@ typedef enum {
nrRA_Msg4 = 4, nrRA_Msg4 = 4,
nrRA_WAIT_Msg4_ACK = 5, nrRA_WAIT_Msg4_ACK = 5,
} RA_gNB_state_t; } RA_gNB_state_t;
static const char *const nrra_text[] = static const char *const nrra_text[] =
{"IDLE", "Msg2", "WAIT_Msg3", "Msg3_retransmission", "Msg3_dcch_dtch", "Msg4", "WAIT_Msg4_ACK"}; {"IDLE", "Msg2", "WAIT_Msg3", "Msg3_retransmission", "Msg3_dcch_dtch", "Msg4", "WAIT_Msg4_ACK"};
typedef struct {
int idx;
bool new_beam;
} NR_beam_alloc_t;
typedef struct nr_pdsch_AntennaPorts_t { typedef struct nr_pdsch_AntennaPorts_t {
int N1; int N1;
int N2; int N2;
...@@ -203,6 +211,8 @@ typedef struct { ...@@ -203,6 +211,8 @@ typedef struct {
frame_t Msg3_frame; frame_t Msg3_frame;
/// Msg3 time domain allocation index /// Msg3 time domain allocation index
int Msg3_tda_id; int Msg3_tda_id;
/// Msg3 beam matrix index
NR_beam_alloc_t Msg3_beam;
/// harq_pid used for Msg4 transmission /// harq_pid used for Msg4 transmission
uint8_t harq_pid; uint8_t harq_pid;
/// UE RNTI allocated during RAR /// UE RNTI allocated during RAR
...@@ -261,10 +271,10 @@ typedef struct { ...@@ -261,10 +271,10 @@ typedef struct {
/// Template for RA computations /// Template for RA computations
NR_RA_t ra[NR_NB_RA_PROC_MAX]; NR_RA_t ra[NR_NB_RA_PROC_MAX];
/// VRB map for common channels /// VRB map for common channels
uint16_t vrb_map[275]; uint16_t vrb_map[MAX_NUM_BEAM_PERIODS][275];
/// VRB map for common channels and PUSCH, dynamically allocated because /// VRB map for common channels and PUSCH, dynamically allocated because
/// length depends on number of slots and RBs /// length depends on number of slots and RBs
uint16_t *vrb_map_UL; uint16_t *vrb_map_UL[MAX_NUM_BEAM_PERIODS];
///Number of active SSBs ///Number of active SSBs
int num_active_ssb; int num_active_ssb;
//Total available prach occasions per configuration period //Total available prach occasions per configuration period
...@@ -742,6 +752,14 @@ typedef struct { ...@@ -742,6 +752,14 @@ typedef struct {
uid_allocator_t uid_allocator; uid_allocator_t uid_allocator;
} NR_UEs_t; } NR_UEs_t;
typedef struct {
/// list of allocated beams per period
int **beam_allocation;
int beam_duration; // in slots
int beams_per_period;
int beam_allocation_size;
} NR_beam_info_t;
#define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++))) #define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++)))
typedef void (*nr_pp_impl_dl)(module_id_t mod_id, typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
...@@ -841,8 +859,8 @@ typedef struct gNB_MAC_INST_s { ...@@ -841,8 +859,8 @@ typedef struct gNB_MAC_INST_s {
time_stats_t rx_ulsch_sdu; // include rlc_data_ind time_stats_t rx_ulsch_sdu; // include rlc_data_ind
/// processing time of eNB PCH scheduler /// processing time of eNB PCH scheduler
time_stats_t schedule_pch; time_stats_t schedule_pch;
/// list of allocated beams per period
int16_t *tdd_beam_association; NR_beam_info_t beam_info;
/// bitmap of DLSCH slots, can hold up to 160 slots /// bitmap of DLSCH slots, can hold up to 160 slots
uint64_t dlsch_slot_bitmap[3]; uint64_t dlsch_slot_bitmap[3];
......
...@@ -1765,9 +1765,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, ...@@ -1765,9 +1765,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity,
/* log SDUs rejected, at most once per second */ /* log SDUs rejected, at most once per second */
if (entity->sdu_rejected != 0 if (entity->sdu_rejected != 0
&& entity->t_current > entity->t_log_buffer_full + 1000) { && entity->t_current > entity->t_log_buffer_full + 1000) {
LOG_E(RLC, "%s:%d:%s: warning: %d SDU rejected, SDU buffer full\n", LOG_E(RLC, "%d SDU rejected, SDU buffer full\n", entity->sdu_rejected);
__FILE__, __LINE__, __FUNCTION__,
entity->sdu_rejected);
entity->sdu_rejected = 0; entity->sdu_rejected = 0;
entity->t_log_buffer_full = entity->t_current; entity->t_log_buffer_full = entity->t_current;
} }
......
...@@ -136,9 +136,16 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity, ...@@ -136,9 +136,16 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity,
exit(1); exit(1);
} }
/* log SDUs rejected, at most once per second */
if (entity->sdu_rejected != 0
&& entity->t_current > entity->t_log_buffer_full + 1000) {
LOG_E(RLC, "%d SDU rejected, SDU buffer full\n", entity->sdu_rejected);
entity->sdu_rejected = 0;
entity->t_log_buffer_full = entity->t_current;
}
if (entity->tx_size + size > entity->tx_maxsize) { if (entity->tx_size + size > entity->tx_maxsize) {
LOG_D(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", entity->sdu_rejected++;
__FILE__, __LINE__, __FUNCTION__);
entity->common.stats.rxsdu_dd_pkts++; entity->common.stats.rxsdu_dd_pkts++;
entity->common.stats.rxsdu_dd_bytes += size; entity->common.stats.rxsdu_dd_bytes += size;
...@@ -181,6 +188,11 @@ void nr_rlc_entity_tm_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id) ...@@ -181,6 +188,11 @@ void nr_rlc_entity_tm_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id)
static void clear_entity(nr_rlc_entity_tm_t *entity) static void clear_entity(nr_rlc_entity_tm_t *entity)
{ {
entity->t_current = 0;
entity->t_log_buffer_full = 0;
entity->sdu_rejected = 0;
nr_rlc_free_sdu_segment_list(entity->tx_list); nr_rlc_free_sdu_segment_list(entity->tx_list);
entity->tx_list = NULL; entity->tx_list = NULL;
......
...@@ -31,6 +31,10 @@ typedef struct { ...@@ -31,6 +31,10 @@ typedef struct {
/* set to the latest know time by the user of the module. Unit: ms */ /* set to the latest know time by the user of the module. Unit: ms */
uint64_t t_current; uint64_t t_current;
/* deal with logging of buffer full */
uint64_t t_log_buffer_full;
int sdu_rejected;
/* tx management */ /* tx management */
nr_rlc_sdu_segment_t *tx_list; nr_rlc_sdu_segment_t *tx_list;
nr_rlc_sdu_segment_t *tx_end; nr_rlc_sdu_segment_t *tx_end;
......
...@@ -575,9 +575,16 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, ...@@ -575,9 +575,16 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity,
exit(1); exit(1);
} }
/* log SDUs rejected, at most once per second */
if (entity->sdu_rejected != 0
&& entity->t_current > entity->t_log_buffer_full + 1000) {
LOG_E(RLC, "%d SDU rejected, SDU buffer full\n", entity->sdu_rejected);
entity->sdu_rejected = 0;
entity->t_log_buffer_full = entity->t_current;
}
if (entity->tx_size + size > entity->tx_maxsize) { if (entity->tx_size + size > entity->tx_maxsize) {
LOG_W(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", entity->sdu_rejected++;
__FILE__, __LINE__, __FUNCTION__);
entity->common.stats.rxsdu_dd_pkts++; entity->common.stats.rxsdu_dd_pkts++;
entity->common.stats.rxsdu_dd_bytes += size; entity->common.stats.rxsdu_dd_bytes += size;
...@@ -712,11 +719,13 @@ static void clear_entity(nr_rlc_entity_um_t *entity) ...@@ -712,11 +719,13 @@ static void clear_entity(nr_rlc_entity_um_t *entity)
entity->rx_next_reassembly = 0; entity->rx_next_reassembly = 0;
entity->rx_timer_trigger = 0; entity->rx_timer_trigger = 0;
entity->tx_next = 0; entity->tx_next = 0;
entity->t_current = 0; entity->t_current = 0;
entity->t_log_buffer_full = 0;
entity->sdu_rejected = 0;
entity->t_reassembly_start = 0; entity->t_reassembly_start = 0;
cur_rx = entity->rx_list; cur_rx = entity->rx_list;
......
...@@ -47,6 +47,10 @@ typedef struct { ...@@ -47,6 +47,10 @@ typedef struct {
/* set to the latest know time by the user of the module. Unit: ms */ /* set to the latest know time by the user of the module. Unit: ms */
uint64_t t_current; uint64_t t_current;
/* deal with logging of buffer full */
uint64_t t_log_buffer_full;
int sdu_rejected;
/* timers (stores the TTI of activation, 0 means not active) */ /* timers (stores the TTI of activation, 0 means not active) */
uint64_t t_reassembly_start; uint64_t t_reassembly_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment