Merge remote-tracking branch 'origin/nr-ip-over-LTE-stack' into integration_develop-nr_2019w42
Conflicts: executables/nr-softmodem.c executables/nr-softmodem.h targets/ARCH/rfsimulator/simulator.c
This commit is contained in:
@@ -134,5 +134,7 @@ void nr_ue_process_mac_pdu(
|
||||
|
||||
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
|
||||
|
||||
void nr_ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP, uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index);
|
||||
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
//#include "defs.h"
|
||||
#include "mac_proto.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
|
||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||
|
||||
@@ -45,6 +46,14 @@ nr_l2_init_ue(void)
|
||||
//init mac here
|
||||
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST);
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rlc_module_init() != 0) {
|
||||
LOG_I(RLC, "Problem at RLC initiation \n");
|
||||
}
|
||||
pdcp_layer_init();
|
||||
nr_ip_over_LTE_DRB_preconfiguration();
|
||||
}
|
||||
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -36,10 +36,27 @@
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "openair2/LAYER2/MAC/mac.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
|
||||
extern void mac_rlc_data_ind (
|
||||
const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP);
|
||||
|
||||
|
||||
uint32_t get_ssb_slot(uint32_t ssb_index){
|
||||
// this function now only support f <= 3GHz
|
||||
return ssb_index & 0x3 ;
|
||||
@@ -81,7 +98,9 @@ int8_t nr_ue_process_dlsch(module_id_t module_id,
|
||||
// First we need to verify if DCI ind contains a ul-sch to be perfomred. If it does, we will handle a PUSCH in the UL_CONFIG_REQ.
|
||||
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH;
|
||||
for (int i=0; i<10; i++) {
|
||||
if (dci_ind->dci_list[i].dci_format < 2) ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||
if(dci_ind!=NULL){
|
||||
if (dci_ind->dci_list[i].dci_format < 2) ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||
}
|
||||
}
|
||||
if (ul_config->ul_config_list[ul_config->number_pdus].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) {
|
||||
// fill in the elements in config request inside P5 message
|
||||
@@ -2182,3 +2201,213 @@ void nr_ue_process_mac_pdu(
|
||||
AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
unsigned char *parse_header(unsigned char *mac_header,
|
||||
unsigned char *num_ce,
|
||||
unsigned char *num_sdu,
|
||||
unsigned char *rx_ces,
|
||||
unsigned char *rx_lcids,
|
||||
unsigned short *rx_lengths,
|
||||
unsigned short tb_length)
|
||||
{
|
||||
|
||||
unsigned char not_done = 1, num_ces = 0, num_cont_res =
|
||||
0, num_padding = 0, num_sdus = 0, lcid, num_sdu_cnt;
|
||||
unsigned char *mac_header_ptr = mac_header;
|
||||
unsigned short length, ce_len = 0;
|
||||
|
||||
while (not_done == 1) {
|
||||
|
||||
if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
|
||||
// printf("E=0\n");
|
||||
not_done = 0;
|
||||
}
|
||||
|
||||
lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
|
||||
|
||||
if (lcid < UE_CONT_RES) {
|
||||
//printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
|
||||
if (not_done == 0) { // last MAC SDU, length is implicit
|
||||
mac_header_ptr++;
|
||||
length =
|
||||
tb_length - (mac_header_ptr - mac_header) - ce_len;
|
||||
|
||||
for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus;
|
||||
num_sdu_cnt++) {
|
||||
length -= rx_lengths[num_sdu_cnt];
|
||||
}
|
||||
} else {
|
||||
if (((SCH_SUBHEADER_LONG *) mac_header_ptr)->F == 1) {
|
||||
length =
|
||||
((((SCH_SUBHEADER_LONG *) mac_header_ptr)->
|
||||
L_MSB & 0x7f)
|
||||
<< 8) | (((SCH_SUBHEADER_LONG *) mac_header_ptr)->
|
||||
L_LSB & 0xff);
|
||||
mac_header_ptr += 3;
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] parse long sdu, size %x \n", length);
|
||||
#endif
|
||||
|
||||
} else { //if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
|
||||
length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
|
||||
mac_header_ptr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] sdu %d lcid %d length %d (offset now %ld)\n",
|
||||
num_sdus, lcid, length, mac_header_ptr - mac_header);
|
||||
#endif
|
||||
rx_lcids[num_sdus] = lcid;
|
||||
rx_lengths[num_sdus] = length;
|
||||
num_sdus++;
|
||||
} else { // This is a control element subheader
|
||||
if (lcid == SHORT_PADDING) {
|
||||
num_padding++;
|
||||
mac_header_ptr++;
|
||||
} else {
|
||||
rx_ces[num_ces] = lcid;
|
||||
num_ces++;
|
||||
mac_header_ptr++;
|
||||
|
||||
if (lcid == TIMING_ADV_CMD) {
|
||||
ce_len++;
|
||||
} else if (lcid == UE_CONT_RES) {
|
||||
|
||||
// FNA: check MAC Header is one of thoses defined in Annex B of 36.321
|
||||
// Check there is only 1 Contention Resolution
|
||||
if (num_cont_res) {
|
||||
LOG_W(MAC,
|
||||
"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
|
||||
// exit parsing
|
||||
return NULL;
|
||||
|
||||
}
|
||||
// UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
|
||||
if ((not_done == 0)
|
||||
&& ((num_sdus) || (num_ces > 1) || (num_padding))) {
|
||||
LOG_W(MAC,
|
||||
"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",
|
||||
num_ces, num_sdus, num_padding);
|
||||
// exit parsing
|
||||
return NULL;
|
||||
}
|
||||
num_cont_res++;
|
||||
ce_len += 6;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] ce %d lcid %d (offset now %ld)\n", num_ces,
|
||||
lcid, mac_header_ptr - mac_header);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
*num_ce = num_ces;
|
||||
*num_sdu = num_sdus;
|
||||
|
||||
return (mac_header_ptr);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
nr_ue_send_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP,
|
||||
uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr;
|
||||
unsigned char rx_lcids[NB_RB_MAX];
|
||||
unsigned short rx_lengths[NB_RB_MAX];
|
||||
|
||||
|
||||
//LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
|
||||
|
||||
|
||||
payload_ptr =
|
||||
parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
|
||||
sdu_len);
|
||||
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC,
|
||||
"[UE %d] ue_send_sdu : Frame %d eNB_index %d : num_ce %d num_sdu %d\n",
|
||||
module_idP, frameP, eNB_index, num_ce, num_sdu);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
LOG_T(MAC, "%x.", sdu[i]);
|
||||
}
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
|
||||
if (payload_ptr != NULL) {
|
||||
|
||||
for (i = 0; i < num_ce; i++) {
|
||||
// printf("ce %d : %d\n",i,rx_ces[i]);
|
||||
switch (rx_ces[i]) {
|
||||
case UE_CONT_RES:
|
||||
|
||||
break;
|
||||
|
||||
case TIMING_ADV_CMD:
|
||||
|
||||
break;
|
||||
|
||||
case DRX_CMD:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_sdu; i++) {
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_I(MAC, "[UE] SDU %d : LCID %d, length %d\n", i,
|
||||
rx_lcids[i], rx_lengths[i]);
|
||||
#endif
|
||||
if ((rx_lcids[i] < NB_RB_MAX) && (rx_lcids[i] > DCCH1)) {
|
||||
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n",
|
||||
module_idP, frameP, rx_lcids[i], eNB_index,
|
||||
rx_lengths[i]);
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing MAC PDU contents at slot: %d \n", subframeP);
|
||||
int j;
|
||||
for (j = 0; j < 20; j++) //rx_lengths[i]
|
||||
LOG_I(MAC, "%x.", (unsigned char) payload_ptr[j]);
|
||||
LOG_I(MAC, "\n");
|
||||
#endif
|
||||
mac_rlc_data_ind(module_idP,
|
||||
4660, //UE_mac_inst[module_idP].crnti //hardcode value corresponding to the one from the eNB
|
||||
eNB_index,
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
rx_lcids[i],
|
||||
(char *) payload_ptr, rx_lengths[i], 1,
|
||||
NULL);
|
||||
} else {
|
||||
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (eNB %d)\n",
|
||||
module_idP, frameP, rx_lcids[i], eNB_index);
|
||||
}
|
||||
payload_ptr += rx_lengths[i];
|
||||
}
|
||||
} // end if (payload_ptr != NULL)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ extern uint8_t nfapi_mode;
|
||||
|
||||
uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
int CC_idP,
|
||||
frame_t frameP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP){
|
||||
|
||||
nfapi_nr_dl_config_request_t *DL_req = &gNB->DL_req[0];
|
||||
@@ -102,10 +102,10 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
}
|
||||
}
|
||||
/*
|
||||
void check_nr_ul_failure(module_id_t module_idP,
|
||||
int CC_id,
|
||||
void check_nr_ul_failure(module_id_t module_idP,
|
||||
int CC_id,
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP) {
|
||||
|
||||
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
@@ -191,13 +191,13 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
|
||||
uint8_t TSFC;
|
||||
uint16_t deltaTSFC; // bitmap
|
||||
uint8_t srs_SubframeConfig;
|
||||
|
||||
|
||||
// table for TSFC (Period) and deltaSFC (offset)
|
||||
const uint16_t deltaTSFCTabType1[15][2] = { {1, 1}, {1, 2}, {2, 2}, {1, 5}, {2, 5}, {4, 5}, {8, 5}, {3, 5}, {12, 5}, {1, 10}, {2, 10}, {4, 10}, {8, 10}, {351, 10}, {383, 10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD
|
||||
const uint16_t deltaTSFCTabType2[14][2] = { {2, 5}, {6, 5}, {10, 5}, {18, 5}, {14, 5}, {22, 5}, {26, 5}, {30, 5}, {70, 10}, {74, 10}, {194, 10}, {326, 10}, {586, 10}, {210, 10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD
|
||||
|
||||
|
||||
uint16_t srsPeriodicity, srsOffset;
|
||||
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
soundingRS_UL_ConfigCommon = &cc[CC_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon;
|
||||
// check if SRS is enabled in this frame/subframe
|
||||
@@ -212,7 +212,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
|
||||
}
|
||||
// Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC
|
||||
uint16_t tmp = (subframeP % TSFC);
|
||||
|
||||
|
||||
if ((1 << tmp) & deltaTSFC) {
|
||||
// This is an SRS subframe, loop over UEs
|
||||
for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) {
|
||||
@@ -220,11 +220,11 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
|
||||
ul_req = &RC.nrmac[module_idP]->UL_req[CC_id].ul_config_request_body;
|
||||
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
|
||||
if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
|
||||
|
||||
|
||||
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
|
||||
"physicalConfigDedicated is null for UE %d\n",
|
||||
UE_id);
|
||||
|
||||
|
||||
if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) {
|
||||
if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
get_srs_pos(&cc[CC_id],
|
||||
@@ -256,7 +256,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
|
||||
} // if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL)
|
||||
} // for (UE_id ...
|
||||
} // if((1<<tmp) & deltaTSFC)
|
||||
|
||||
|
||||
} // SRS config
|
||||
}
|
||||
}
|
||||
@@ -290,7 +290,7 @@ void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
}
|
||||
}
|
||||
|
||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP){
|
||||
protocol_ctxt_t ctxt;
|
||||
@@ -331,13 +331,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
coreset,
|
||||
frameP,
|
||||
slotP,
|
||||
*cfg))
|
||||
*cfg)){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP);
|
||||
}
|
||||
|
||||
rnti = UE_RNTI(module_idP, i);
|
||||
CC_id = UE_PCCID(module_idP, i);
|
||||
//int spf = get_spf(cfg);
|
||||
|
||||
|
||||
if (((frameP&127) == 0) && (slotP == 0)) {
|
||||
LOG_I(MAC,
|
||||
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
|
||||
@@ -349,32 +350,32 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
|
||||
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
|
||||
}
|
||||
|
||||
|
||||
RC.gNB[module_idP][CC_id]->pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)] = -63;
|
||||
|
||||
|
||||
if (i == UE_list->head)
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.gNB[module_idP][CC_id]->
|
||||
pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)]);
|
||||
|
||||
|
||||
// increment this, it is cleared when we receive an sdu
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
|
||||
|
||||
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n",
|
||||
i,
|
||||
|
||||
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n",
|
||||
i,
|
||||
rnti,
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer,
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
|
||||
|
||||
|
||||
//check_nr_ul_failure(module_idP, CC_id, i, frameP, subframeP);
|
||||
|
||||
|
||||
if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
|
||||
|
||||
|
||||
if(RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
|
||||
|
||||
|
||||
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_GNB; ue_id_l++) {
|
||||
if (reestablish_rnti_map[ue_id_l][0] == rnti) {
|
||||
// clear currentC-RNTI from map
|
||||
@@ -383,10 +384,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Note: This should not be done in the MAC!
|
||||
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
|
||||
NR_gNB_ULSCH_t *ulsch = RC.gNB[module_idP][CC_id]->ulsch[ii][0];
|
||||
NR_gNB_ULSCH_t *ulsch = RC.gNB[module_idP][CC_id]->ulsch[ii][0];
|
||||
if((ulsch != NULL) && (ulsch->rnti == rnti)){
|
||||
LOG_W(MAC, "TODO: clean_eNb_ulsch UE %x \n", rnti);
|
||||
clean_gNB_ulsch(ulsch);
|
||||
@@ -400,7 +401,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
clean_gNB_dlsch(dlsch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int j = 0; j < 10; j++){
|
||||
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
|
||||
ul_req_tmp = &RC.nrmac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body;
|
||||
@@ -422,9 +423,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
} //END if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0)
|
||||
} //END if (UE_list->active[i])
|
||||
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
|
||||
|
||||
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frameP, slotP,module_idP);
|
||||
|
||||
|
||||
pdcp_run(&ctxt);
|
||||
|
||||
//rrc_rx_tx(&ctxt, CC_id);
|
||||
@@ -439,8 +440,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
/*if (slotP==2)
|
||||
nr_schedule_css_dlsch_phytest(module_idP, frameP, slotP);*/
|
||||
|
||||
if (slotP==1)
|
||||
if (slotP==1){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP);
|
||||
}
|
||||
|
||||
/*
|
||||
// Allocate CCEs for good after scheduling is done
|
||||
@@ -449,6 +451,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
*/
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
#include "mac_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
|
||||
/*Scheduling of DLSCH with associated DCI in common search space
|
||||
* current version has only a DCI for type 1 PDCCH for C_RNTI*/
|
||||
@@ -103,7 +105,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
pdu_rel15->vrb_to_prb_mapping = 1;
|
||||
pdu_rel15->mcs = 9;
|
||||
pdu_rel15->tb_scaling = 1;
|
||||
|
||||
|
||||
pdu_rel15->ra_preamble_index = 25;
|
||||
pdu_rel15->format_indicator = 1;
|
||||
pdu_rel15->ndi = 1;
|
||||
@@ -168,147 +170,346 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*Scheduling of DLSCH with associated DCI in user specific search space
|
||||
* current version has only a DCI for type 1 PDCCH for C_RNTI*/
|
||||
int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *TX_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
int16_t pdu_index){
|
||||
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
|
||||
int TBS;
|
||||
uint16_t rnti = 0x1234;
|
||||
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
|
||||
|
||||
|
||||
dl_config_dci_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void*)dl_config_dci_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
|
||||
dl_config_dci_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DCI_DL_PDU_TYPE;
|
||||
dl_config_dci_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dci_dl_pdu));
|
||||
|
||||
dl_config_dlsch_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu+1];
|
||||
memset((void*)dl_config_dlsch_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
|
||||
dl_config_dlsch_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_dlsch_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dlsch_pdu));
|
||||
|
||||
nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &dl_config_dci_pdu->dci_dl_pdu.dci_dl_pdu_rel15;
|
||||
nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &dl_config_dci_pdu->dci_dl_pdu.pdcch_params_rel15;
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu_rel15 = &dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15;
|
||||
|
||||
dlsch_pdu_rel15->start_prb = 0;
|
||||
dlsch_pdu_rel15->n_prb = 50;
|
||||
dlsch_pdu_rel15->start_symbol = 2;
|
||||
dlsch_pdu_rel15->nb_symbols = 9;
|
||||
dlsch_pdu_rel15->rnti = rnti;
|
||||
dlsch_pdu_rel15->nb_layers =1;
|
||||
dlsch_pdu_rel15->nb_codewords = 1;
|
||||
dlsch_pdu_rel15->mcs_idx = 9;
|
||||
dlsch_pdu_rel15->ndi = 1;
|
||||
dlsch_pdu_rel15->redundancy_version = 0;
|
||||
|
||||
nr_configure_dci_from_pdcch_config(params_rel15,
|
||||
coreset,
|
||||
search_space,
|
||||
*cfg,
|
||||
dl_carrier_bandwidth);
|
||||
|
||||
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
|
||||
pdu_rel15->time_domain_assignment = 3; // row index used here instead of SLIV;
|
||||
pdu_rel15->vrb_to_prb_mapping = 1;
|
||||
pdu_rel15->mcs = 9;
|
||||
pdu_rel15->tb_scaling = 1;
|
||||
|
||||
pdu_rel15->ra_preamble_index = 25;
|
||||
pdu_rel15->format_indicator = 1;
|
||||
pdu_rel15->ndi = 1;
|
||||
pdu_rel15->rv = 0;
|
||||
pdu_rel15->harq_pid = 0;
|
||||
pdu_rel15->dai = 2;
|
||||
pdu_rel15->tpc = 2;
|
||||
pdu_rel15->pucch_resource_indicator = 7;
|
||||
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
|
||||
|
||||
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
pdu_rel15->frequency_domain_assignment,
|
||||
pdu_rel15->time_domain_assignment,
|
||||
pdu_rel15->vrb_to_prb_mapping,
|
||||
pdu_rel15->mcs,
|
||||
pdu_rel15->tb_scaling,
|
||||
pdu_rel15->ndi,
|
||||
pdu_rel15->rv);
|
||||
|
||||
params_rel15->rnti = rnti;
|
||||
params_rel15->rnti_type = NFAPI_NR_RNTI_C;
|
||||
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
|
||||
|
||||
//params_rel15->aggregation_level = 1;
|
||||
LOG_D(MAC, "DCI params: rnti %d, rnti_type %d, dci_format %d, config type %d\n \
|
||||
coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \
|
||||
ss params : first symb %d, ss type %d\n",
|
||||
params_rel15->rnti,
|
||||
params_rel15->rnti_type,
|
||||
params_rel15->config_type,
|
||||
params_rel15->dci_format,
|
||||
params_rel15->mux_pattern,
|
||||
params_rel15->n_rb,
|
||||
params_rel15->n_symb,
|
||||
params_rel15->rb_offset,
|
||||
params_rel15->first_symbol,
|
||||
params_rel15->search_space_type);
|
||||
nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
|
||||
// Hardcode it for now
|
||||
TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
|
||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
|
||||
dlsch_pdu_rel15->start_prb,
|
||||
dlsch_pdu_rel15->n_prb,
|
||||
dlsch_pdu_rel15->start_symbol,
|
||||
dlsch_pdu_rel15->nb_symbols,
|
||||
dlsch_pdu_rel15->nb_layers,
|
||||
dlsch_pdu_rel15->nb_codewords,
|
||||
dlsch_pdu_rel15->mcs_idx,
|
||||
TBS);
|
||||
|
||||
dl_req->number_dci++;
|
||||
dl_req->number_pdsch_rnti++;
|
||||
dl_req->number_pdu+=2;
|
||||
|
||||
TX_req->pdu_length = dlsch_pdu_rel15->transport_block_size/8;
|
||||
TX_req->pdu_index = pdu_index++;
|
||||
TX_req->num_segments = 1;
|
||||
|
||||
return TBS/8; //Return TBS in bytes
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP)
|
||||
{
|
||||
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest \n");
|
||||
uint8_t CC_id;
|
||||
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
//NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||
nfapi_nr_dl_config_request_body_t *dl_req;
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
|
||||
nfapi_tx_request_pdu_t *TX_req;
|
||||
|
||||
nfapi_nr_config_request_t *cfg = &nr_mac->config[0];
|
||||
uint16_t rnti = 0x1234;
|
||||
|
||||
nfapi_nr_config_request_t *cfg = &nr_mac->config[0];
|
||||
|
||||
uint16_t sfn_sf = frameP << 7 | slotP;
|
||||
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
|
||||
|
||||
// everything here is hard-coded to 30 kHz
|
||||
//int scs = get_dlscs(cfg);
|
||||
//int slots_per_frame = get_spf(cfg);
|
||||
|
||||
int TBS;
|
||||
int TBS_bytes;
|
||||
int lcid;
|
||||
int ta_len = 0;
|
||||
int header_length_total=0;
|
||||
int header_length_last;
|
||||
int sdu_length_total = 0;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
uint16_t sdu_lengths[NB_RB_MAX];
|
||||
int num_sdus = 0;
|
||||
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
|
||||
int offset;
|
||||
int UE_id = 0;
|
||||
unsigned char sdu_lcids[NB_RB_MAX];
|
||||
int padding = 0, post_padding = 0;
|
||||
UE_list_t *UE_list = &nr_mac->UE_list;
|
||||
|
||||
DLSCH_PDU DLSCH_pdu;
|
||||
//DLSCH_PDU *DLSCH_pdu = (DLSCH_PDU*) malloc(sizeof(DLSCH_PDU));
|
||||
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
|
||||
|
||||
nfapi_nr_coreset_t* coreset = &nr_mac->coreset[CC_id][1];
|
||||
nfapi_nr_search_space_t* search_space = &nr_mac->search_space[CC_id][1];
|
||||
LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
|
||||
|
||||
dl_req = &nr_mac->DL_req[CC_id].dl_config_request_body;
|
||||
dl_config_dci_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void*)dl_config_dci_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
|
||||
dl_config_dci_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DCI_DL_PDU_TYPE;
|
||||
dl_config_dci_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dci_dl_pdu));
|
||||
dl_req = &nr_mac->DL_req[CC_id].dl_config_request_body;
|
||||
TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
|
||||
dl_config_dlsch_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu+1];
|
||||
memset((void*)dl_config_dlsch_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
|
||||
dl_config_dlsch_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_dlsch_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dlsch_pdu));
|
||||
//The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving
|
||||
//through the LTE stack
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
|
||||
nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &dl_config_dci_pdu->dci_dl_pdu.dci_dl_pdu_rel15;
|
||||
nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &dl_config_dci_pdu->dci_dl_pdu.pdcch_params_rel15;
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu_rel15 = &dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15;
|
||||
memset(&DLSCH_pdu, 0, sizeof(DLSCH_pdu));
|
||||
int ta_update = 31;
|
||||
ta_len = 0;
|
||||
|
||||
dlsch_pdu_rel15->start_prb = 0;
|
||||
dlsch_pdu_rel15->n_prb = 50;
|
||||
dlsch_pdu_rel15->start_symbol = 2;
|
||||
dlsch_pdu_rel15->nb_symbols = 9;
|
||||
dlsch_pdu_rel15->rnti = rnti;
|
||||
dlsch_pdu_rel15->nb_layers =1;
|
||||
dlsch_pdu_rel15->nb_codewords = 1;
|
||||
dlsch_pdu_rel15->mcs_idx = 9;
|
||||
dlsch_pdu_rel15->ndi = 1;
|
||||
dlsch_pdu_rel15->redundancy_version = 0;
|
||||
// Hardcode it for now
|
||||
TBS = 6784/8; //TBS in bytes
|
||||
//nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
|
||||
//TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
|
||||
|
||||
nr_configure_dci_from_pdcch_config(params_rel15,
|
||||
coreset,
|
||||
search_space,
|
||||
*cfg,
|
||||
dl_carrier_bandwidth);
|
||||
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
|
||||
// TODO: check if the lcid is active
|
||||
|
||||
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
|
||||
pdu_rel15->time_domain_assignment = 3; // row index used here instead of SLIV;
|
||||
pdu_rel15->vrb_to_prb_mapping = 1;
|
||||
pdu_rel15->mcs = 9;
|
||||
pdu_rel15->tb_scaling = 1;
|
||||
LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
|
||||
module_idP, frameP, lcid, TBS,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3);
|
||||
|
||||
pdu_rel15->ra_preamble_index = 25;
|
||||
pdu_rel15->format_indicator = 1;
|
||||
pdu_rel15->ndi = 1;
|
||||
pdu_rel15->rv = 0;
|
||||
pdu_rel15->harq_pid = 0;
|
||||
pdu_rel15->dai = 2;
|
||||
pdu_rel15->tpc = 2;
|
||||
pdu_rel15->pucch_resource_indicator = 7;
|
||||
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
|
||||
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
|
||||
rlc_status = mac_rlc_status_ind(module_idP,
|
||||
rnti,
|
||||
module_idP,
|
||||
frameP,
|
||||
slotP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,0, 0
|
||||
//#endif
|
||||
);
|
||||
|
||||
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
pdu_rel15->frequency_domain_assignment,
|
||||
pdu_rel15->time_domain_assignment,
|
||||
pdu_rel15->vrb_to_prb_mapping,
|
||||
pdu_rel15->mcs,
|
||||
pdu_rel15->tb_scaling,
|
||||
pdu_rel15->ndi,
|
||||
pdu_rel15->rv);
|
||||
if (rlc_status.bytes_in_buffer > 0) {
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d), TBS: %d \n \n",
|
||||
module_idP, frameP,
|
||||
TBS - ta_len - header_length_total - sdu_length_total - 3,
|
||||
lcid,
|
||||
header_length_total,
|
||||
TBS);
|
||||
|
||||
params_rel15->rnti = rnti;
|
||||
params_rel15->rnti_type = NFAPI_NR_RNTI_C;
|
||||
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid,
|
||||
TBS,
|
||||
(char *)&dlsch_buffer[sdu_length_total]
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,0, 0
|
||||
//#endif
|
||||
);
|
||||
|
||||
//params_rel15->aggregation_level = 1;
|
||||
LOG_D(MAC, "DCI params: rnti %d, rnti_type %d, dci_format %d, config type %d\n \
|
||||
coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \
|
||||
ss params : first symb %d, ss type %d\n",
|
||||
params_rel15->rnti,
|
||||
params_rel15->rnti_type,
|
||||
params_rel15->config_type,
|
||||
params_rel15->dci_format,
|
||||
params_rel15->mux_pattern,
|
||||
params_rel15->n_rb,
|
||||
params_rel15->n_symb,
|
||||
params_rel15->rb_offset,
|
||||
params_rel15->first_symbol,
|
||||
params_rel15->search_space_type);
|
||||
nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
|
||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d\n",
|
||||
dlsch_pdu_rel15->start_prb,
|
||||
dlsch_pdu_rel15->n_prb,
|
||||
dlsch_pdu_rel15->start_symbol,
|
||||
dlsch_pdu_rel15->nb_symbols,
|
||||
dlsch_pdu_rel15->nb_layers,
|
||||
dlsch_pdu_rel15->nb_codewords,
|
||||
dlsch_pdu_rel15->mcs_idx);
|
||||
|
||||
dl_req->number_dci++;
|
||||
dl_req->number_pdsch_rnti++;
|
||||
dl_req->number_pdu+=2;
|
||||
|
||||
TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = dlsch_pdu_rel15->transport_block_size;
|
||||
TX_req->pdu_index = nr_mac->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",
|
||||
module_idP, sdu_lengths[num_sdus], lcid);
|
||||
|
||||
// HOT FIX for all zero pdu problem
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
for(int i = 0; i < dlsch_pdu_rel15->transport_block_size/8; i++) {
|
||||
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
sdu_lcids[num_sdus] = lcid;
|
||||
sdu_length_total += sdu_lengths[num_sdus];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus];
|
||||
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
TX_req->segments[0].segment_length = dlsch_pdu_rel15->transport_block_size+2;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
|
||||
header_length_total += header_length_last;
|
||||
|
||||
}
|
||||
num_sdus++;
|
||||
|
||||
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
|
||||
}
|
||||
} else {
|
||||
// no TBS left
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// last header does not have length field
|
||||
if (header_length_total) {
|
||||
header_length_total -= header_length_last;
|
||||
header_length_total++;
|
||||
}
|
||||
|
||||
|
||||
if (ta_len + sdu_length_total + header_length_total > 0) {
|
||||
|
||||
|
||||
if (TBS - header_length_total - sdu_length_total - ta_len <= 2) {
|
||||
padding = TBS - header_length_total - sdu_length_total - ta_len;
|
||||
post_padding = 0;
|
||||
} else {
|
||||
padding = 0;
|
||||
post_padding = 1;
|
||||
}
|
||||
|
||||
offset = generate_dlsch_header((unsigned char *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0], //DLSCH_pdu.payload[0],
|
||||
num_sdus, //num_sdus
|
||||
sdu_lengths, //
|
||||
sdu_lcids, 255, // no drx
|
||||
ta_update, // timing advance
|
||||
NULL, // contention res id
|
||||
padding, post_padding);
|
||||
LOG_D(MAC, "Offset bits: %d \n", offset);
|
||||
|
||||
// Probably there should be other actions done before that
|
||||
// cycle through SDUs and place in dlsch_buffer
|
||||
|
||||
//memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
|
||||
memcpy(&nr_mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
|
||||
|
||||
|
||||
// fill remainder of DLSCH with 0
|
||||
for (int j = 0; j < (TBS - sdu_length_total - offset); j++) {
|
||||
//UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
|
||||
nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0][offset + sdu_length_total + j] = 0;
|
||||
}
|
||||
|
||||
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, , TBS size: %d \n \n", frameP, slotP, TBS_bytes);
|
||||
for(int i = 0; i < 10; i++) { // TBS_bytes dlsch_pdu_rel15->transport_block_size/8 6784/8
|
||||
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
//TX_req->segments[0].segment_length = 8;
|
||||
TX_req->segments[0].segment_length = TBS_bytes +2;
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
|
||||
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
} //if (ta_len + sdu_length_total + header_length_total > 0)
|
||||
} //if (IS_SOFTMODEM_NOS1)
|
||||
|
||||
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
|
||||
//occur every time that the current function is called (dlsch phytest mode)
|
||||
else{
|
||||
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
|
||||
// HOT FIX for all zero pdu problem
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
for(int i = 0; i < TBS_bytes; i++) { //
|
||||
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
|
||||
//LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
}
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
if (frameP%100 == 0){
|
||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//TX_req->segments[0].segment_length = 8;
|
||||
TX_req->segments[0].segment_length = TBS_bytes +2;
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
}
|
||||
} //for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP);
|
||||
|
||||
int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *TX_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
int16_t pdu_index);
|
||||
|
||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -82,34 +83,34 @@ void mac_top_init_gNB(void)
|
||||
LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst);
|
||||
|
||||
if (RC.nb_nr_macrlc_inst > 0) {
|
||||
|
||||
|
||||
RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *));
|
||||
|
||||
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
|
||||
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
|
||||
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
|
||||
|
||||
|
||||
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) {
|
||||
RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST));
|
||||
|
||||
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
|
||||
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
|
||||
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
|
||||
|
||||
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);
|
||||
|
||||
bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
|
||||
|
||||
RC.nrmac[i]->Mod_id = i;
|
||||
|
||||
|
||||
|
||||
for (j = 0; j < MAX_NUM_CCs; j++) {
|
||||
RC.nrmac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list = RC.nrmac[i]->dl_config_pdu_list[j];
|
||||
RC.nrmac[i]->UL_req[j].ul_config_request_body.ul_config_pdu_list = RC.nrmac[i]->ul_config_pdu_list[j];
|
||||
|
||||
|
||||
for (int k = 0; k < 10; k++)
|
||||
RC.nrmac[i]->UL_req_tmp[j][k].ul_config_request_body.ul_config_pdu_list =RC.nrmac[i]->ul_config_pdu_list_tmp[j][k];
|
||||
|
||||
|
||||
RC.nrmac[i]->HI_DCI0_req[j].hi_dci0_request_body.hi_dci0_pdu_list = RC.nrmac[i]->hi_dci0_pdu_list[j];
|
||||
RC.nrmac[i]->TX_req[j].tx_request_body.tx_pdu_list = RC.nrmac[i]->tx_request_pdu[j];
|
||||
RC.nrmac[i]->ul_handle = 0;
|
||||
@@ -118,7 +119,7 @@ void mac_top_init_gNB(void)
|
||||
nr_init_coreset(&RC.nrmac[i]->coreset[j][1]);
|
||||
nr_init_search_space(&RC.nrmac[i]->search_space[j][1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||
|
||||
@@ -127,6 +128,9 @@ void mac_top_init_gNB(void)
|
||||
// These should be out of here later
|
||||
pdcp_layer_init();
|
||||
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
nr_ip_over_LTE_DRB_preconfiguration();
|
||||
|
||||
rrc_init_nr_global_param();
|
||||
|
||||
}else {
|
||||
@@ -135,7 +139,7 @@ void mac_top_init_gNB(void)
|
||||
|
||||
// Initialize Linked-List for Active UEs
|
||||
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) {
|
||||
|
||||
|
||||
nrmac = RC.nrmac[i];
|
||||
nrmac->if_inst = NR_IF_Module_init(i);
|
||||
|
||||
@@ -152,6 +156,11 @@ void mac_top_init_gNB(void)
|
||||
|
||||
UE_list->next[list_el] = -1;
|
||||
UE_list->next_ul[list_el] = -1;
|
||||
/*memset(UE_list->DLSCH_pdu, 0, sizeof(UE_list->DLSCH_pdu));
|
||||
memset(UE_list->UE_template, 0, sizeof(UE_list->UE_template));
|
||||
memset(UE_list->eNB_UE_stats, 0, sizeof(UE_list->eNB_UE_stats));
|
||||
memset(UE_list->UE_sched_ctrl, 0, sizeof(UE_list->UE_sched_ctrl));
|
||||
memset(UE_list->active, 0, sizeof(UE_list->active));*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -358,7 +358,16 @@ boolean_t pdcp_data_req(
|
||||
LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
|
||||
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) {
|
||||
// The check on nos1 is done only for the use case of LTE stack running over 5g-nr PHY. This should be changed
|
||||
// before future merge of develop with develop-nr and instead of a check of IS_SOFTMODEM_NOS1, we should use a check
|
||||
// with a new execution option capturing the nr-ip-over-LTE-stack use case.
|
||||
ngran_node_t node_type;
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
node_type = ngran_gNB;
|
||||
else
|
||||
node_type = RC.rrc[ctxt_pP->module_id]->node_type;
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(node_type)) { //RC.rrc[ctxt_pP->module_id]->node_type
|
||||
LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
|
||||
ret=FALSE;
|
||||
} else {
|
||||
@@ -510,6 +519,7 @@ pdcp_data_ind(
|
||||
hashtable_rc_t h_rc;
|
||||
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 :0;
|
||||
uint16_t pdcp_uid=0;
|
||||
|
||||
MessageDef *message_p = NULL;
|
||||
uint8_t *gtpu_buffer_p = NULL;
|
||||
uint32_t rx_hfn_for_count;
|
||||
@@ -518,6 +528,8 @@ pdcp_data_ind(
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
|
||||
LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
|
||||
"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
|
||||
|
||||
|
||||
#if T_TRACER
|
||||
|
||||
if (ctxt_pP->enb_flag != ENB_FLAG_NO)
|
||||
@@ -1040,6 +1052,13 @@ pdcp_data_ind(
|
||||
memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)],
|
||||
&sdu_buffer_pP->data[payload_offset],
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
|
||||
LOG_I(PDCP, "Printing first bytes of PDCP SDU before adding it to the list: \n");
|
||||
for (int i=0; i<30; i++){
|
||||
LOG_I(PDCP, "%x", sdu_buffer_pP->data[i]);
|
||||
}
|
||||
#endif
|
||||
list_add_tail_eurecom (new_sdu_p, sdu_list_p);
|
||||
}
|
||||
|
||||
@@ -1062,6 +1081,7 @@ pdcp_data_ind(
|
||||
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
|
||||
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
|
||||
Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
@@ -1772,6 +1792,7 @@ pdcp_config_req_asn1 (
|
||||
uint8_t *const kUPenc_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
switch (actionP) {
|
||||
case CONFIG_ACTION_ADD:
|
||||
DevAssert(pdcp_pP != NULL);
|
||||
@@ -2170,6 +2191,9 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
|
||||
if(UE_NAS_USE_TUN) {
|
||||
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )?MAX_NUMBER_NETIF:1;
|
||||
netlink_init_tun("ue",num_if);
|
||||
//Add --nr-ip-over-lte option check for next line
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
nas_config(1, 1, 2, "ue");
|
||||
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
||||
} else if(ENB_NAS_USE_TUN) {
|
||||
netlink_init_tun("enb",1);
|
||||
@@ -2217,6 +2241,103 @@ void pdcp_module_cleanup (void)
|
||||
{
|
||||
}
|
||||
|
||||
void nr_ip_over_LTE_DRB_preconfiguration(void){
|
||||
|
||||
// Addition for the use-case of 4G stack on top of 5G-NR.
|
||||
// We need to configure pdcp and rlc instances without having an actual
|
||||
// UE RRC Connection. In order to be able to test the NR PHY with some injected traffic
|
||||
// on top of the LTE stack.
|
||||
protocol_ctxt_t ctxt;
|
||||
LTE_DRB_ToAddModList_t* DRB_configList=NULL;
|
||||
DRB_configList = CALLOC(1, sizeof(LTE_DRB_ToAddModList_t));
|
||||
struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL;
|
||||
struct LTE_RLC_Config *DRB_rlc_config = NULL;
|
||||
struct LTE_PDCP_Config *DRB_pdcp_config = NULL;
|
||||
struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
|
||||
|
||||
struct LTE_DRB_ToAddMod *DRB_config = NULL;
|
||||
struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL;
|
||||
long *logicalchannelgroup_drb;
|
||||
|
||||
|
||||
//Static preconfiguration of DRB
|
||||
DRB_config = CALLOC(1, sizeof(*DRB_config));
|
||||
|
||||
DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
|
||||
// allowed value 5..15, value : x+4
|
||||
*(DRB_config->eps_BearerIdentity) = 1; //ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation
|
||||
// DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
|
||||
// 1 + drb_identiy_index;
|
||||
DRB_config->drb_Identity = 1;
|
||||
DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
|
||||
*(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
|
||||
|
||||
DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
|
||||
DRB_config->rlc_Config = DRB_rlc_config;
|
||||
|
||||
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
|
||||
DRB_config->pdcp_Config = DRB_pdcp_config;
|
||||
DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
|
||||
*DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
|
||||
DRB_pdcp_config->rlc_AM = NULL;
|
||||
DRB_pdcp_config->rlc_UM = NULL;
|
||||
|
||||
DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
|
||||
DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
|
||||
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
|
||||
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
|
||||
// PDCP
|
||||
PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
|
||||
DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
|
||||
PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
|
||||
|
||||
DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
|
||||
|
||||
DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
|
||||
DRB_config->logicalChannelConfig = DRB_lchan_config;
|
||||
DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
|
||||
DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
|
||||
|
||||
DRB_ul_SpecificParameters->priority= 4;
|
||||
|
||||
DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
|
||||
//LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
DRB_ul_SpecificParameters->bucketSizeDuration =
|
||||
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
|
||||
|
||||
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
|
||||
*logicalchannelgroup_drb = 1;//(i+1) % 3;
|
||||
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
|
||||
|
||||
ASN_SEQUENCE_ADD(&DRB_configList->list,DRB_config);
|
||||
|
||||
if (ENB_NAS_USE_TUN){
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, 0x1234, 0, 0,0);
|
||||
}
|
||||
else{
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
|
||||
}
|
||||
|
||||
rrc_pdcp_config_asn1_req(&ctxt,
|
||||
(LTE_SRB_ToAddModList_t *) NULL,
|
||||
DRB_configList,
|
||||
(LTE_DRB_ToReleaseList_t *) NULL,
|
||||
0xff, NULL, NULL, NULL
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
, (LTE_PMCH_InfoList_r9_t *) NULL
|
||||
//#endif
|
||||
,NULL);
|
||||
|
||||
rrc_rlc_config_asn1_req(&ctxt,
|
||||
(LTE_SRB_ToAddModList_t*)NULL,
|
||||
DRB_configList,
|
||||
(LTE_DRB_ToReleaseList_t*)NULL
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
,(LTE_PMCH_InfoList_r9_t *)NULL
|
||||
, 0, 0
|
||||
//#endif
|
||||
);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void pdcp_layer_init(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -92,6 +92,8 @@ extern int pdcp_instance_cnt;
|
||||
#define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
|
||||
(pDCP_Pp->is_srb) ? "SRB" : "DRB",\
|
||||
pDCP_Pp->rb_id
|
||||
//#define ENABLE_PDCP_PAYLOAD_DEBUG 1
|
||||
|
||||
int init_pdcp_thread(void);
|
||||
void cleanup_pdcp_thread(void);
|
||||
|
||||
@@ -397,6 +399,7 @@ void pdcp_run (
|
||||
const protocol_ctxt_t *const ctxt_pP);
|
||||
uint64_t pdcp_module_init (uint64_t pdcp_optmask);
|
||||
void pdcp_module_cleanup (void);
|
||||
void nr_ip_over_LTE_DRB_preconfiguration (void);
|
||||
void pdcp_layer_init (void);
|
||||
void pdcp_layer_cleanup (void);
|
||||
#define PDCP2NW_DRIVER_FIFO 21
|
||||
|
||||
@@ -111,7 +111,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
||||
int ret=0;
|
||||
|
||||
while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) {
|
||||
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
|
||||
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
|
||||
int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
|
||||
int sizeToWrite= sizeof (pdcp_data_ind_header_t) +
|
||||
((pdcp_data_ind_header_t *) sdu_p->data)->data_size;
|
||||
@@ -135,6 +135,13 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
||||
} // PDCP_USE_NETLINK
|
||||
|
||||
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
||||
|
||||
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
|
||||
LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n");
|
||||
for (int i=0; i<30; i++){
|
||||
LOG_I(PDCP, "%x", sdu_p->data[i]);
|
||||
}
|
||||
#endif
|
||||
list_remove_head (&pdcp_sdu_list);
|
||||
free_mem_block (sdu_p, __func__);
|
||||
pdcp_nb_sdu_sent ++;
|
||||
@@ -166,7 +173,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
|
||||
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
|
||||
ctxt.enb_flag=ENB_FLAG_YES;
|
||||
ctxt.module_id=0;
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_YES);
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||
}
|
||||
|
||||
@@ -276,12 +283,13 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||
|
||||
if (h_rc == HASH_TABLE_OK) {
|
||||
LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
|
||||
LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d for rnti: %d \n",
|
||||
ctxt.frame,
|
||||
pdcp_read_header_g.inst,
|
||||
len,
|
||||
nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
|
||||
pdcp_read_header_g.rb_id);
|
||||
pdcp_read_header_g.rb_id,
|
||||
ctxt.rnti);
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
|
||||
|
||||
@@ -723,7 +723,6 @@ void rlc_um_check_timer_dar_time_out(
|
||||
signed int in_window;
|
||||
rlc_usn_t old_vr_ur;
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_IN);
|
||||
|
||||
if ((rlc_pP->t_reordering.running)) {
|
||||
@@ -1130,12 +1129,12 @@ rlc_um_receive_process_dar (
|
||||
if (in_window < 0) {
|
||||
in_window = in_window + rlc_pP->rx_sn_modulo;
|
||||
}
|
||||
|
||||
rlc_um_try_reassembly(ctxt_pP, rlc_pP, rlc_pP->vr_ur, in_window);
|
||||
}
|
||||
|
||||
|
||||
if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) < 0) {
|
||||
//LOG_I(RLC, "[rlc_um_receive_process_dar] Problematic case 4 \n");
|
||||
#if TRACE_RLC_UM_DAR
|
||||
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR) %d OUTSIDE REORDERING WINDOW SET TO VR(UH) – UM_Window_Size = %d\n",
|
||||
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
|
||||
@@ -1158,9 +1157,8 @@ rlc_um_receive_process_dar (
|
||||
do {
|
||||
rlc_pP->vr_ur = (rlc_pP->vr_ur+1) % rlc_pP->rx_sn_modulo;
|
||||
} while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh));
|
||||
|
||||
rlc_um_try_reassembly(ctxt_pP, rlc_pP, sn, rlc_pP->vr_ur);
|
||||
}
|
||||
}
|
||||
|
||||
// -if t-Reordering is running:
|
||||
// -if VR(UX) <= VR(UR); or
|
||||
|
||||
@@ -597,7 +597,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst) {
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("[NAS][CLASS][SEND] Got packet from kernel:\n");
|
||||
|
||||
for (i=0; i<256; i++)
|
||||
for (int i=0; i<256; i++)
|
||||
printk("%2x ",((unsigned char *)skb->data)[i]);
|
||||
|
||||
printk("\n");
|
||||
|
||||
@@ -386,6 +386,11 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
pdcph.data_size = skb->len;
|
||||
pdcph.rb_id = (gc->rb)->rab_id;
|
||||
pdcph.inst = inst;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
pdcph.sourceL2Id = 0;
|
||||
pdcph.destinationL2Id = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
|
||||
@@ -161,7 +161,7 @@ int nas_netlink_send(unsigned char *data,unsigned int len)
|
||||
int status;
|
||||
|
||||
|
||||
// printk("[NAS][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len));
|
||||
//printk("[NAS][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len));
|
||||
skb_put(nl_skb, NLMSG_SPACE(len));
|
||||
memcpy(NLMSG_DATA(nlh),data,len);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "assertions.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_extern.h"
|
||||
#include "SCHED_NR_UE/fapi_nr_ue_l1.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -70,8 +71,14 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr
|
||||
|
||||
}
|
||||
// L2 Abstraction Layer
|
||||
int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, uint8_t *pduP, uint32_t pdu_len){
|
||||
int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, uint8_t *pduP, uint32_t pdu_len, frame_t frame, int slot){
|
||||
|
||||
LOG_I(MAC, "handle_dlsch at MAC layer \n");
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
nr_ue_send_sdu(module_id, 0, frame, slot,
|
||||
pduP,
|
||||
pdu_len,
|
||||
0);
|
||||
return 0;
|
||||
/*
|
||||
return nr_ue_process_dlsch( module_id,
|
||||
@@ -209,7 +216,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
|
||||
}
|
||||
|
||||
if(dl_info->rx_ind != NULL){
|
||||
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND]\n");
|
||||
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
for(i=0; i<dl_info->rx_ind->number_pdus; ++i){
|
||||
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
@@ -220,6 +227,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], MIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
/*ret_mask |= (handle_bcch_bch( dl_info->proc,
|
||||
dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
dl_info->rx_ind->rx_indication_body[i].mib_pdu.pdu,
|
||||
dl_info->rx_ind->rx_indication_body[i].mib_pdu.additional_bits,
|
||||
dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_index,
|
||||
dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_length,
|
||||
dl_info->rx_ind->rx_indication_body[i].mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;*/
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_SIB:
|
||||
ret_mask |= (handle_bcch_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
@@ -231,8 +246,21 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
|
||||
// ret_mask |= (0) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length, dl_info->frame, dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
|
||||
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], DLSCH case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
|
||||
/*
|
||||
// dl_config structure just stores what was received - not really needed
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
*/
|
||||
|
||||
/*ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind,
|
||||
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu,
|
||||
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length, dl_info->frame, dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
|
||||
returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR);
|
||||
|
||||
if(!returnValue)
|
||||
bringInterfaceUp(interfaceName, 1);
|
||||
returnValue=bringInterfaceUp(interfaceName, 1);
|
||||
|
||||
if(!returnValue)
|
||||
LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n",
|
||||
|
||||
Reference in New Issue
Block a user