Compare commits

...

28 Commits

Author SHA1 Message Date
Ejaz Ahmed
b900b38448 Fixed merge conflicts 2024-08-02 02:14:49 +00:00
Ejaz Ahmed
35f918effd Created initial data structures for HARQ
Following changes are made:
1) Added essential data structures for HARQ
2) Moved gNB specific list functions to common file
3) Implemented preconfigurations for HARQ
4) Developed thread lock functions for NR_UE_SL_SCHED
5) Included header files for common moved functions in gNB code
2024-07-31 15:38:21 +00:00
Ejaz Ahmed
af49a21e95 Fixed order of SL UE phy params initializations 2024-07-31 15:37:55 +00:00
Ejaz Ahmed
093b212878 Fixed PSFCH issue in sci_payload in case of psfch_period zero 2024-07-31 15:37:18 +00:00
Ejaz Ahmed
b7e2cb3c93 Fixed line spacing 2024-07-31 15:37:00 +00:00
Ejaz Ahmed
396d8f6eb5 Added PSFCH in sci_payload 2024-07-31 15:36:42 +00:00
Ejaz Ahmed
12c1fb2069 Added code to send synchronization information from nearby to syncref
Added code to send synchronization information from nearby to syncref
within reserved bit of sci1. Syncref starts sending SLSCH once syncref
receives synchronization information.
2024-07-31 15:36:04 +00:00
Ejaz Ahmed
07e1e3a968 Updated Tx params based on CQI report; Enabled support for MCS 1-16; Fixed SNR estimation
Following changes are made in this merge:

1) Updated Tx params based on received CQI report
2) Added SNR estimation based on signal power and noise power
3) Modified calculation of G to support MCS 1-16: G calculation method is modified in nr_get_G_SL to support different modulation orders, (Qm = 2 or 4), while keeping modulation order of 2 for dmrs, sci1 and sci2
4) In case of modulation order of 4, symbol 1 was crashing while reading rxF in nr_ulsch_16qam_llr() due to null pointer: fixed by introducing temp variable for recreating the symbol by inserting zeros on SCI1 and SCI2 REs, then complete symbol is passed for LLR computation along with a temporary LLR variable to collect the output of the LLR function for symbol 1. Next LLRs output related to Zero portions (SCI1 and SCI2 REs) of input is trimmed and passed only the LLR output of SLSCH REs to layer de-mapping function
5) Changed data rate computation for SCI2 based on fixed mcs (equivalent to mod_order of 2) at both rx and tx
6) Updated format of sci2 in nr_sci_size() on rx to make the sci2_payload_len same as on tx side
7) Replaced array index expression of a list, holding CQI data structure, with a variable
8) Moved CQI tables and functions from gNB files to common mac file so that both gNB and UE can access.
9) Tested on RFSIM with channel model AWGN noise power of -10 and ploss of 5
10) Cleaned code
2024-06-20 14:44:17 +00:00
Ejaz Ahmed
cc7c0b7968 Updated configurations; formatted logs 2024-06-20 14:25:36 +00:00
Ejaz Ahmed
bb35caebed Fixed interface's name conflicts; restricted tx and rx operations in specific slots to fix an issue in USRP. 2024-06-06 13:56:59 +00:00
matilde.costa
9588e10de0 Added non-ip types to ip_traffic_type_t 2024-05-17 14:58:54 +02:00
Ejaz Ahmed
d2475e0dd6 Added separate conf files for sync_ref & nearby ue; reverted tx scheduling conditions 2024-05-01 16:46:52 -07:00
Ejaz Ahmed
c584baf9e1 Merge branch 'episys/sl-eurecom2' into eurecom/sl-eurecom2
Following modifications are included in this merge:
1) Implemented CSI reporting
2) Developed a measurement function of SNR and computed CQI based on
that
3) Simplified functions
4) Improved logging
5) Cleaned code
6) Fixed pointers issues
2024-04-30 10:52:54 -07:00
matilde.costa
4e2b8ddb92 fix nas_config in rrc sl preconfiguration for tun interface name 2024-04-25 15:39:15 +02:00
Matilde Costa
e8ca12049a rlc/pdcp threads with -1 affinity 2024-04-25 11:08:02 +02:00
Raymond Knopp
e9ff59611d check of PSFCH pointer in ue_scheduler 2024-04-28 21:42:27 +02:00
Raymond Knopp
fb6baf3f76 check for PSFCH pointer definition 2024-04-28 21:26:19 +02:00
Raymond Knopp
18e9694f31 more debugging removal 2024-04-22 16:19:47 +02:00
Raymond Knopp
183e029c8c removed some logging 2024-04-22 16:16:37 +02:00
Raymond Knopp
da97a8f016 debugging info 2024-04-22 15:47:24 +02:00
Raymond Knopp
1a470d5af6 logging for debug 2024-04-26 16:52:15 +02:00
Ejaz Ahmed
c4250dcd2b Fixed MAC subpdu header; fixed multiple interface issue 2024-04-19 11:56:47 -07:00
Raymond Knopp
c534570eec added srcid to nas_config for SL 2024-04-19 16:27:32 +02:00
Raymond Knopp
9642a70e6d testing and bugfixing 2024-04-19 16:10:35 +02:00
Raymond Knopp
1c84699e00 handled freeing of PSFCH information in case PSFCH_Period = 0 2024-04-23 06:07:18 +02:00
Ejaz Ahmed
9879c13cd4 Added option in conf file to activate/deactivate csi-rs 2024-04-17 10:36:00 -07:00
Ejaz Ahmed
813b600305 Implemented CSI-RS transmission and reception. 2024-04-16 19:26:01 -07:00
Ejaz Ahmed
9f9dadf621 Replaced slots per frame variable to use appropriate one 2024-04-16 19:25:23 -07:00
18 changed files with 242 additions and 140 deletions

View File

@@ -162,6 +162,9 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
// initialize all signal buffers
init_nr_ue_signal(ue, nb_connected_gNB);
if (ue->sl_mode)
sl_ue_phy_init(ue);
// intialize transport
init_nr_ue_transport(ue);

View File

@@ -546,7 +546,6 @@ int main( int argc, char **argv ) {
}
UE[CC_id]->sl_mode = get_softmodem_params()->sl_mode;
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
if (UE[CC_id]->sl_mode) {
AssertFatal(UE[CC_id]->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n");
@@ -557,8 +556,8 @@ int main( int argc, char **argv ) {
nr_init_frame_parms_ue_sl(&sl_phy->sl_frame_params,&sl_phy->sl_config,
get_nrUE_params()->threequarter_fs,
get_nrUE_params()->ofdm_offset_divisor);
sl_ue_phy_init(UE[CC_id]);
}
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
}
bool is_sl = (get_softmodem_params()->sl_mode) ? 1 : 0;

View File

@@ -559,8 +559,10 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
{
const int N_RB_DL = ue->frame_parms.N_RB_DL;
const int N_RB_UL = ue->frame_parms.N_RB_UL;
const int N_RB_SL = ue->SL_UE_PHY_PARAMS.sl_frame_params.N_RB_SL;
free_nr_ue_dl_harq(ue->dl_harq_processes, NR_MAX_DLSCH_HARQ_PROCESSES, N_RB_DL);
free_nr_ue_ul_harq(ue->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, N_RB_UL, ue->frame_parms.nb_antennas_tx);
free_nr_ue_ul_harq(ue->sl_harq_processes, NR_MAX_SLSCH_HARQ_PROCESSES, N_RB_SL, ue->SL_UE_PHY_PARAMS.sl_frame_params.nb_antennas_tx);
}
void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb) {
@@ -643,6 +645,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) {
nr_init_dl_harq_processes(ue->dl_harq_processes, NR_MAX_DLSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_DL);
nr_init_ul_harq_processes(ue->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_UL, ue->frame_parms.nb_antennas_tx);
nr_init_ul_harq_processes(ue->sl_harq_processes, NR_MAX_SLSCH_HARQ_PROCESSES, ue->SL_UE_PHY_PARAMS.sl_frame_params.N_RB_SL, ue->frame_parms.nb_antennas_tx);
for(int i=0; i<5; i++)
ue->dl_stats[i] = 0;

View File

@@ -38,6 +38,7 @@
#include "PHY/CODING/nrLDPC_extern.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_ULSCH_CODING
@@ -54,7 +55,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
///////////
unsigned int crc = 1;
NR_UL_UE_HARQ_t *harq_process = &ue->ul_harq_processes[harq_pid];
NR_UL_UE_HARQ_t *harq_process = get_softmodem_params()->sl_mode ? &ue->sl_harq_processes[harq_pid] : &ue->ul_harq_processes[harq_pid];
uint16_t nb_rb = pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.rb_size : pscch_pssch_pdu->l_subch * pscch_pssch_pdu->subchannel_size;
uint32_t A = (pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.pusch_data.tb_size : pscch_pssch_pdu->tb_size)<<3;
uint32_t *pz = &harq_process->Z;

View File

@@ -185,7 +185,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
NR_UE_ULSCH_t *ulsch_ue = &phy_data->ulsch;
sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu = &phy_data->nr_sl_pssch_pscch_pdu;
NR_UL_UE_HARQ_t *harq_process_ul_ue = &UE->ul_harq_processes[harq_pid];
NR_UL_UE_HARQ_t *harq_process_ul_ue = get_softmodem_params()->sl_mode ? &UE->sl_harq_processes[harq_pid] : &UE->ul_harq_processes[harq_pid];
const nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch_ue->pusch_pdu;
NR_DL_FRAME_PARMS *frame_parms = pscch_pssch_pdu == NULL ? &UE->frame_parms : &UE->SL_UE_PHY_PARAMS.sl_frame_params;

View File

@@ -440,6 +440,7 @@ typedef struct PHY_VARS_NR_UE_s {
uint8_t prs_active_gNBs;
NR_DL_UE_HARQ_t dl_harq_processes[2][NR_MAX_DLSCH_HARQ_PROCESSES];
NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
NR_UL_UE_HARQ_t sl_harq_processes[NR_MAX_SLSCH_HARQ_PROCESSES];
//Paging parameters
uint32_t IMSImod1024;
uint32_t PF;

View File

@@ -280,6 +280,7 @@
#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */
#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 5.1 UE procedure for receiving the physical downlink shared channel */
#define NR_MAX_SLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES)
#endif
/// Data structure for transmission.

View File

@@ -5425,4 +5425,132 @@ uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_rep
}
return csi_bitlen;
}
}
/*
* Create a new NR_list
*/
void create_nr_list(NR_list_t *list, int len)
{
list->head = -1;
list->next = malloc(len * sizeof(*list->next));
AssertFatal(list->next, "cannot malloc() memory for NR_list_t->next\n");
for (int i = 0; i < len; ++i)
list->next[i] = -1;
list->tail = -1;
list->len = len;
}
/*
* Resize an NR_list
*/
void resize_nr_list(NR_list_t *list, int new_len)
{
if (new_len == list->len)
return;
if (new_len > list->len) {
/* list->head remains */
const int old_len = list->len;
int* n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
for (int i = old_len; i < new_len; ++i)
list->next[i] = -1;
/* list->tail remains */
list->len = new_len;
} else { /* new_len < len */
AssertFatal(list->head < new_len, "shortened list head out of index %d (new len %d)\n", list->head, new_len);
AssertFatal(list->tail < new_len, "shortened list tail out of index %d (new len %d)\n", list->head, new_len);
for (int i = 0; i < list->len; ++i)
AssertFatal(list->next[i] < new_len, "shortened list entry out of index %d (new len %d)\n", list->next[i], new_len);
/* list->head remains */
int *n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
/* list->tail remains */
list->len = new_len;
}
}
/*
* Destroy an NR_list
*/
void destroy_nr_list(NR_list_t *list)
{
free(list->next);
}
/*
* Add an ID to an NR_list at the end, traversing the whole list. Note:
* add_tail_nr_list() is a faster alternative, but this implementation ensures
* we do not add an existing ID.
*/
void add_nr_list(NR_list_t *listP, int id)
{
int *cur = &listP->head;
while (*cur >= 0) {
AssertFatal(*cur != id, "id %d already in NR_UE_list!\n", id);
cur = &listP->next[*cur];
}
*cur = id;
if (listP->next[id] < 0)
listP->tail = id;
}
/*
* Remove an ID from an NR_list
*/
void remove_nr_list(NR_list_t *listP, int id)
{
int *cur = &listP->head;
int *prev = &listP->head;
while (*cur != -1 && *cur != id) {
prev = cur;
cur = &listP->next[*cur];
}
AssertFatal(*cur != -1, "ID %d not found in UE_list\n", id);
int *next = &listP->next[*cur];
*cur = listP->next[*cur];
*next = -1;
listP->tail = *prev >= 0 && listP->next[*prev] >= 0 ? listP->tail : *prev;
}
/*
* Add an ID to the tail of the NR_list in O(1). Note that there is
* corresponding remove_tail_nr_list(), as we cannot set the tail backwards and
* therefore need to go through the whole list (use remove_nr_list())
*/
void add_tail_nr_list(NR_list_t *listP, int id)
{
LOG_I(NR_MAC, "Adding harq_id %d\n", id);
int *last = listP->tail < 0 ? &listP->head : &listP->next[listP->tail];
*last = id;
listP->next[id] = -1;
listP->tail = id;
}
/*
* Add an ID to the front of the NR_list in O(1)
*/
void add_front_nr_list(NR_list_t *listP, int id)
{
const int ohead = listP->head;
listP->head = id;
listP->next[id] = ohead;
if (listP->tail < 0)
listP->tail = id;
}
/*
* Remove an ID from the front of the NR_list in O(1)
*/
void remove_front_nr_list(NR_list_t *listP)
{
AssertFatal(listP->head >= 0, "Nothing to remove\n");
const int ohead = listP->head;
LOG_I(NR_MAC, "ohead %d %p\n", ohead, listP->next[ohead]);
listP->head = listP->next[ohead];
listP->next[ohead] = -1;
if (listP->head < 0)
listP->tail = -1;
}

View File

@@ -51,6 +51,34 @@ typedef enum {
pusch_len2 = 2
} pusch_maxLength_t;
typedef struct NR_UE_sl_mac_dir_stats {
uint64_t lc_bytes[64];
uint64_t rounds[8];
uint64_t errors;
uint64_t total_bytes;
uint32_t current_bytes;
uint64_t total_sdu_bytes;
uint32_t total_rbs;
uint32_t total_rbs_retx;
uint32_t num_mac_sdu;
uint32_t current_rbs;
} NR_UE_sl_mac_dir_stats_t;
typedef struct NR_UE_sl_mac_stats {
NR_UE_sl_mac_dir_stats_t sl;
uint32_t slsch_DTX;
uint64_t slsch_total_bytes_scheduled;
int cumul_rsrp;
uint8_t num_rsrp_meas;
} NR_UE_sl_mac_stats_t;
typedef struct NR_bler_options {
double upper;
double lower;
uint8_t max_mcs;
uint8_t harq_round_max;
} NR_bler_options_t;
uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t get_BG(uint32_t A, uint16_t R);
@@ -311,4 +339,14 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, nr_csi_report_t *cs
uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_report_id);
/* Functions to manage an NR_list_t */
void create_nr_list(NR_list_t *listP, int len);
void resize_nr_list(NR_list_t *list, int new_len);
void destroy_nr_list(NR_list_t *list);
void add_nr_list(NR_list_t *listP, int id);
void remove_nr_list(NR_list_t *listP, int id);
void add_tail_nr_list(NR_list_t *listP, int id);
void add_front_nr_list(NR_list_t *listP, int id);
void remove_front_nr_list(NR_list_t *listP);
#endif

View File

@@ -47,6 +47,14 @@
{SL_CONFIG_STRING_SL_CSI_RS_SLOT_PERIODICITY,NULL,0,.u8ptr=&sl_csi_info->slot_periodicity,.defuintval=1,TYPE_UINT8,0}, \
{SL_CONFIG_STRING_SL_CSI_RS_SL_CSI_ACQUISITION,NULL,0,.u8ptr=&sl_csi_info->sl_csi_acquisition,.defuintval=1,TYPE_UINT8,0}}
/*Sidelink HARQ configuration parameters */
#define SL_CONFIG_STRING_SL_CONFIGUREDGRANT_LIST "sl_ConfiguredGrantConfig"
#define SL_CONFIG_STRING_SL_CONFIGUREDGRANT_NROFHARQ_PROCESSES "sl_NrOfHARQ_Processes"
#define SL_CONFIG_STRING_SL_CONFIGUREDGRANT_HARQ_PROCID_OFFSET "sl_HARQ_ProcID_offset"
#define SL_CONFIGUREDGRANT_DESC(sl_harq_info) { \
{SL_CONFIG_STRING_SL_CONFIGUREDGRANT_NROFHARQ_PROCESSES, NULL, 0, .u16ptr=&sl_harq_info->num_HARQ_Processes, .defuintval=0, TYPE_UINT16, 0}, \
{SL_CONFIG_STRING_SL_CONFIGUREDGRANT_HARQ_PROCID_OFFSET, NULL, 0, .u16ptr=&sl_harq_info->sl_HARQ_ProcID_offset, .defuintval=0, TYPE_UINT16, 0}}
typedef struct sl_csi_info {
uint8_t symb_l0;
uint8_t csi_type;
@@ -57,6 +65,11 @@ typedef struct sl_csi_info {
uint8_t sl_csi_acquisition;
} sl_csi_info_t;
typedef struct sl_harq_info {
uint16_t num_HARQ_Processes;
uint16_t sl_HARQ_ProcID_offset;
} sl_harq_info_t;
void sl_ue_mac_free(uint8_t module_id)
{
@@ -372,7 +385,6 @@ int nr_rrc_mac_config_req_sl_preconfig(module_id_t module_id,
AssertFatal(sl_preconfiguration !=NULL,"SL-Preconfig Cannot be NULL");
AssertFatal(mac, "mac should have an instance");
mac->SL_MAC_PARAMS = CALLOC(1, sizeof(sl_nr_ue_mac_params_t));
sl_nr_ue_mac_params_t *sl_mac = mac->SL_MAC_PARAMS;
NR_SidelinkPreconfigNR_r16_t *sl_preconfig = &sl_preconfiguration->sidelinkPreconfigNR_r16;
@@ -666,6 +678,14 @@ void nr_sl_params_read_conf(module_id_t module_id) {
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0, SL_CONFIG_STRING_SL_CSI_RS_LIST, 0);
config_get(SL_CRI_RS_INFO, sizeof(SL_CRI_RS_INFO)/sizeof(paramdef_t), aprefix);
char aprefix1[MAX_OPTNAME_SIZE*2 + 8];
sl_harq_info_t *sl_harq_info = (sl_harq_info_t*)malloc(sizeof(sl_harq_info_t));
paramdef_t SL_HARQ_INFO[] = SL_CONFIGUREDGRANT_DESC(sl_harq_info);
sprintf(aprefix1, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0, SL_CONFIG_STRING_SL_CONFIGUREDGRANT_LIST, 0);
config_get(SL_HARQ_INFO, sizeof(SL_HARQ_INFO)/sizeof(paramdef_t), aprefix1);
sl_mac->num_HARQ_Processes = sl_harq_info->num_HARQ_Processes;
sl_mac->sl_HARQ_ProcID_offset = sl_harq_info->sl_HARQ_ProcID_offset;
sl_mac->csi_type = sl_csi_rs_info->csi_type;
sl_mac->symb_l0 = sl_csi_rs_info->symb_l0;
sl_mac->power_control_offset = sl_csi_rs_info->power_control_offset;

View File

@@ -468,6 +468,8 @@ typedef struct SL_CSI_Report {
//
typedef struct {
// sidelink bytes that are currently scheduled
int sched_sl_bytes;
/// Sched PSSCH: scheduling decisions, copied into HARQ and cleared every TTI
NR_sched_pssch_t sched_pssch;
//
@@ -493,7 +495,7 @@ typedef struct {
} NR_SL_UE_sched_ctrl_t;
#define MAX_SL_UE_CONNECTIONS 8
#define MAX_SL_UE_CONNECTIONS 1
#define MAX_SL_CSI_REPORTCONFIG MAX_SL_UE_CONNECTIONS
@@ -503,6 +505,7 @@ typedef struct {
/// scheduling control info
nr_sl_csi_report_t csi_report_template[MAX_SL_CSI_REPORTCONFIG];
NR_SL_UE_sched_ctrl_t UE_sched_ctrl;
NR_UE_sl_mac_stats_t mac_sl_stats;
} NR_SL_UE_info_t;
@@ -640,6 +643,7 @@ typedef struct {
time_stats_t rlc_data_req;
int src_id;
int dest_id;
pthread_mutex_t sl_sched_lock;
bool is_synced;
} NR_UE_MAC_INST_t;

View File

@@ -28,7 +28,10 @@
#include "NR_MAC_COMMON/nr_mac.h"
#include "NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "nr_ue_sci.h"
#include <pthread.h>
#include "mac_defs.h"
#define HARQ_ROUND_MAX 4
#define SL_NR_MAC_NUM_RX_RESOURCE_POOLS 1
#define SL_NR_MAC_NUM_TX_RESOURCE_POOLS 1
#define SL_NUM_BYTES_TIMERESOURCEBITMAP 20
@@ -44,6 +47,24 @@
#define sci_field_t dci_field_t
#define NR_UE_SL_SCHED_LOCK(lock) \
do { \
int rc = pthread_mutex_lock(lock); \
AssertFatal(rc == 0, "error while locking scheduler mutex\n"); \
} while (0)
#define NR_UE_SL_SCHED_UNLOCK(lock) \
do { \
int rc = pthread_mutex_unlock(lock); \
AssertFatal(rc == 0, "error while locking scheduler mutex\n"); \
} while (0)
#define NR_UE_SL_SCHED_ENSURE_LOCKED(lock)\
do {\
int rc = pthread_mutex_trylock(lock); \
AssertFatal(rc == EBUSY, "this function should be called with the scheduler mutex locked\n");\
} while (0)
typedef struct sidelink_sci_format_1a_fields {
// Priority of this transmission
@@ -160,6 +181,10 @@ typedef struct sl_nr_ue_mac_params {
uint16_t scramb_id;
uint8_t measurement_bitmap;
// configured grant harq parameters
uint8_t num_HARQ_Processes;
uint8_t sl_HARQ_ProcID_offset;
//Configured from RRC
uint32_t sl_MaxNumConsecutiveDTX;
uint32_t sl_SSB_PriorityNR;
@@ -188,6 +213,7 @@ typedef struct sl_nr_ue_mac_params {
uint16_t decoded_DFN;
uint16_t decoded_slot;
NR_bler_options_t sl_bler;
} sl_nr_ue_mac_params_t;

View File

@@ -169,6 +169,8 @@ void nr_ue_init_mac(module_id_t module_idP)
mac->phy_config_request_sent = false;
mac->state = UE_NOT_SYNC;
mac->si_window_start = -1;
mac->SL_MAC_PARAMS = CALLOC(1, sizeof(sl_nr_ue_mac_params_t));
mac->SL_MAC_PARAMS->sl_bler.harq_round_max = HARQ_ROUND_MAX;
for (int i = 0; i < MAX_SL_UE_CONNECTIONS; i++) {
mac->sl_info.list[i] = calloc(1, sizeof(NR_SL_UE_info_t));
mac->sl_info.list[i]->uid = 0;
@@ -176,6 +178,12 @@ void nr_ue_init_mac(module_id_t module_idP)
mac->sl_info.list[i]->UE_sched_ctrl.csi_report.ri = 0;
mac->sl_info.list[i]->UE_sched_ctrl.csi_report.cqi = -1;
mac->sl_info.list[i]->UE_sched_ctrl.sl_max_mcs = 16;
NR_SL_UE_sched_ctrl_t *UE_sched_ctrl = &mac->sl_info.list[i]->UE_sched_ctrl;
create_nr_list(&UE_sched_ctrl->available_sl_harq, 16);
for (int harq = 0; harq < 16; harq++)
add_tail_nr_list(&UE_sched_ctrl->available_sl_harq, harq);
create_nr_list(&UE_sched_ctrl->feedback_sl_harq, 16);
create_nr_list(&UE_sched_ctrl->retrans_sl_harq, 16);
mac->dest_id = -1;
}
}

View File

@@ -34,6 +34,7 @@
#include "nr_mac_gNB.h"
#include "NR_MAC_gNB/mac_proto.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "NR_MAC_COMMON/nr_mac_common.h"
/* Utils */
#include "common/utils/LOG/log.h"

View File

@@ -35,6 +35,7 @@
#include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "NR_MAC_COMMON/nr_mac_common.h"
/*NFAPI*/
#include "nfapi_nr_interface.h"

View File

@@ -1709,132 +1709,6 @@ void dump_nr_list(NR_UE_info_t **list)
}
}
/*
* Create a new NR_list
*/
void create_nr_list(NR_list_t *list, int len)
{
list->head = -1;
list->next = malloc(len * sizeof(*list->next));
AssertFatal(list->next, "cannot malloc() memory for NR_list_t->next\n");
for (int i = 0; i < len; ++i)
list->next[i] = -1;
list->tail = -1;
list->len = len;
}
/*
* Resize an NR_list
*/
void resize_nr_list(NR_list_t *list, int new_len)
{
if (new_len == list->len)
return;
if (new_len > list->len) {
/* list->head remains */
const int old_len = list->len;
int* n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
for (int i = old_len; i < new_len; ++i)
list->next[i] = -1;
/* list->tail remains */
list->len = new_len;
} else { /* new_len < len */
AssertFatal(list->head < new_len, "shortened list head out of index %d (new len %d)\n", list->head, new_len);
AssertFatal(list->tail < new_len, "shortened list tail out of index %d (new len %d)\n", list->head, new_len);
for (int i = 0; i < list->len; ++i)
AssertFatal(list->next[i] < new_len, "shortened list entry out of index %d (new len %d)\n", list->next[i], new_len);
/* list->head remains */
int *n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
/* list->tail remains */
list->len = new_len;
}
}
/*
* Destroy an NR_list
*/
void destroy_nr_list(NR_list_t *list)
{
free(list->next);
}
/*
* Add an ID to an NR_list at the end, traversing the whole list. Note:
* add_tail_nr_list() is a faster alternative, but this implementation ensures
* we do not add an existing ID.
*/
void add_nr_list(NR_list_t *listP, int id)
{
int *cur = &listP->head;
while (*cur >= 0) {
AssertFatal(*cur != id, "id %d already in NR_UE_list!\n", id);
cur = &listP->next[*cur];
}
*cur = id;
if (listP->next[id] < 0)
listP->tail = id;
}
/*
* Remove an ID from an NR_list
*/
void remove_nr_list(NR_list_t *listP, int id)
{
int *cur = &listP->head;
int *prev = &listP->head;
while (*cur != -1 && *cur != id) {
prev = cur;
cur = &listP->next[*cur];
}
AssertFatal(*cur != -1, "ID %d not found in UE_list\n", id);
int *next = &listP->next[*cur];
*cur = listP->next[*cur];
*next = -1;
listP->tail = *prev >= 0 && listP->next[*prev] >= 0 ? listP->tail : *prev;
}
/*
* Add an ID to the tail of the NR_list in O(1). Note that there is
* corresponding remove_tail_nr_list(), as we cannot set the tail backwards and
* therefore need to go through the whole list (use remove_nr_list())
*/
void add_tail_nr_list(NR_list_t *listP, int id)
{
int *last = listP->tail < 0 ? &listP->head : &listP->next[listP->tail];
*last = id;
listP->next[id] = -1;
listP->tail = id;
}
/*
* Add an ID to the front of the NR_list in O(1)
*/
void add_front_nr_list(NR_list_t *listP, int id)
{
const int ohead = listP->head;
listP->head = id;
listP->next[id] = ohead;
if (listP->tail < 0)
listP->tail = id;
}
/*
* Remove an ID from the front of the NR_list in O(1)
*/
void remove_front_nr_list(NR_list_t *listP)
{
AssertFatal(listP->head >= 0, "Nothing to remove\n");
const int ohead = listP->head;
listP->head = listP->next[ohead];
listP->next[ohead] = -1;
if (listP->head < 0)
listP->tail = -1;
}
NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
{

View File

@@ -35,6 +35,7 @@
#include "utils.h"
#include <openair2/UTIL/OPT/opt.h>
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
//#define SRS_IND_DEBUG

View File

@@ -634,13 +634,6 @@ typedef struct NR_mac_stats {
char srs_stats[50]; // Statistics may differ depending on SRS usage
} NR_mac_stats_t;
typedef struct NR_bler_options {
double upper;
double lower;
uint8_t max_mcs;
uint8_t harq_round_max;
} NR_bler_options_t;
typedef struct nr_mac_rrc_ul_if_s {
ue_context_setup_response_func_t ue_context_setup_response;
ue_context_modification_response_func_t ue_context_modification_response;