mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-19 07:30:31 +00:00
Compare commits
28 Commits
sl-eurecom
...
eurecom/sl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b900b38448 | ||
|
|
35f918effd | ||
|
|
af49a21e95 | ||
|
|
093b212878 | ||
|
|
b7e2cb3c93 | ||
|
|
396d8f6eb5 | ||
|
|
12c1fb2069 | ||
|
|
07e1e3a968 | ||
|
|
cc7c0b7968 | ||
|
|
bb35caebed | ||
|
|
9588e10de0 | ||
|
|
d2475e0dd6 | ||
|
|
c584baf9e1 | ||
|
|
4e2b8ddb92 | ||
|
|
e8ca12049a | ||
|
|
e9ff59611d | ||
|
|
fb6baf3f76 | ||
|
|
18e9694f31 | ||
|
|
183e029c8c | ||
|
|
da97a8f016 | ||
|
|
1a470d5af6 | ||
|
|
c4250dcd2b | ||
|
|
c534570eec | ||
|
|
9642a70e6d | ||
|
|
1c84699e00 | ||
|
|
9879c13cd4 | ||
|
|
813b600305 | ||
|
|
9f9dadf621 |
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user