merge develop, no test
This commit is contained in:
@@ -233,6 +233,7 @@ typedef uint8_t pdusessionid_t;
|
||||
//-----------------------------------------------------------------------------
|
||||
// may be ITTI not enabled, but type instance is useful also for OTG,
|
||||
typedef intptr_t instance_t;
|
||||
|
||||
typedef struct protocol_ctxt_s {
|
||||
module_id_t module_id; /*!< \brief Virtualized module identifier */
|
||||
eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */
|
||||
|
||||
@@ -427,6 +427,7 @@ typedef struct NRRrcConfigurationReq_s {
|
||||
bool force_256qam_off;
|
||||
int pusch_TargetSNRx10;
|
||||
int pucch_TargetSNRx10;
|
||||
bool enable_sdap;
|
||||
} gNB_RrcConfigurationReq;
|
||||
|
||||
typedef struct NRDuDlReq_s {
|
||||
|
||||
+13
-11
@@ -32,16 +32,18 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
|
||||
abort();
|
||||
}
|
||||
|
||||
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id
|
||||
) {
|
||||
boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id,
|
||||
const uint8_t qfi,
|
||||
const boolean_t rqi,
|
||||
const int pdusession_id) {
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -1192,7 +1192,9 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
LOG_I(RRC, "256 QAM: %s\n", NRRRC_CONFIGURATION_REQ (msg_p).force_256qam_off ? "force off" : "may be on");
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).scc = scc;
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).scd = scd;
|
||||
|
||||
NRRRC_CONFIGURATION_REQ (msg_p).enable_sdap = *GNBParamList.paramarray[i][GNB_ENABLE_SDAP_IDX].iptr;
|
||||
LOG_I(GNB_APP, "SDAP layer is %s\n", NRRRC_CONFIGURATION_REQ (msg_p).enable_sdap ? "enabled" : "disabled");
|
||||
|
||||
}//
|
||||
}//End for (k=0; k <num_gnbs ; k++)
|
||||
memcpy(&rrc->configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p)));
|
||||
|
||||
@@ -125,7 +125,8 @@ typedef enum {
|
||||
#define GNB_CONFIG_STRING_MINRXTXTIME "min_rxtxtime"
|
||||
#define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist"
|
||||
#define GNB_CONFIG_STRING_FORCE256QAMOFF "force_256qam_off"
|
||||
|
||||
#define GNB_CONFIG_STRING_ENABLE_SDAP "enable_sdap"
|
||||
#define GNB_CONFIG_HLP_STRING_ENABLE_SDAP "enable the SDAP layer\n"
|
||||
|
||||
#define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support"
|
||||
|
||||
@@ -159,7 +160,8 @@ typedef enum {
|
||||
{GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \
|
||||
{GNB_CONFIG_STRING_MINRXTXTIME, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_FORCE256QAMOFF, GNB_CONFIG_HLP_FORCE256QAMOFF, PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0} \
|
||||
{GNB_CONFIG_STRING_FORCE256QAMOFF, GNB_CONFIG_HLP_FORCE256QAMOFF, PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0}, \
|
||||
{GNB_CONFIG_STRING_ENABLE_SDAP, GNB_CONFIG_HLP_STRING_ENABLE_SDAP, PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0}, \
|
||||
}
|
||||
|
||||
#define GNB_GNB_ID_IDX 0
|
||||
@@ -188,6 +190,7 @@ typedef enum {
|
||||
#define GNB_MINRXTXTIME_IDX 23
|
||||
#define GNB_ULPRBBLACKLIST_IDX 24
|
||||
#define GNB_FORCE256QAMOFF_IDX 25
|
||||
#define GNB_ENABLE_SDAP_IDX 26
|
||||
|
||||
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
|
||||
#define GNBPARAMS_CHECK { \
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "NR_SubcarrierSpacing.h"
|
||||
#include "openair1/SCHED_NR_UE/harq_nr.h"
|
||||
|
||||
#define NR_SHORT_BSR_TABLE_SIZE 32
|
||||
#define NR_LONG_BSR_TABLE_SIZE 256
|
||||
@@ -275,14 +276,29 @@ typedef struct {
|
||||
uint8_t nbits;
|
||||
} dci_field_t;
|
||||
|
||||
typedef struct {
|
||||
/* The active harq sfn/slot field was created to save the
|
||||
scheduled SFN/Slot transmission for the ACK/NAK. If we
|
||||
do not save it, then we have to calculate it again as the
|
||||
NRUE MAC layer already does in get_downlink_ack(). */
|
||||
int active_dl_harq_sfn;
|
||||
int active_dl_harq_slot;
|
||||
int active_ul_harq_sfn_slot;
|
||||
bool active;
|
||||
} emul_l1_harq_t;
|
||||
|
||||
typedef struct {
|
||||
bool expected_sib;
|
||||
bool index_has_sib[16];
|
||||
bool index_has_sib[NR_MAX_HARQ_PROCESSES];
|
||||
bool expected_rar;
|
||||
bool index_has_rar[16];
|
||||
bool index_has_rar[NR_MAX_HARQ_PROCESSES];
|
||||
bool expected_dci;
|
||||
bool index_has_dci[16];
|
||||
int active_harq_sfn_slot;
|
||||
bool index_has_dci[NR_MAX_HARQ_PROCESSES];
|
||||
emul_l1_harq_t harq[NR_MAX_HARQ_PROCESSES];
|
||||
int active_uci_sfn_slot;
|
||||
int num_srs;
|
||||
int num_harqs;
|
||||
int num_csi_reports;
|
||||
} nr_emulated_l1_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -432,7 +432,7 @@ typedef struct {
|
||||
|
||||
// Defined for abstracted mode
|
||||
nr_downlink_indication_t dl_info;
|
||||
NR_UE_HARQ_STATUS_t dl_harq_info[16];
|
||||
NR_UE_HARQ_STATUS_t dl_harq_info[NR_MAX_HARQ_PROCESSES];
|
||||
|
||||
nr_emulated_l1_t nr_ue_emul_l1;
|
||||
|
||||
|
||||
@@ -1368,10 +1368,18 @@ void set_harq_status(NR_UE_MAC_INST_t *mac,
|
||||
// FIXME k0 != 0 currently not taken into consideration
|
||||
current_harq->dl_frame = frame;
|
||||
current_harq->dl_slot = slot;
|
||||
mac->nr_ue_emul_l1.active_harq_sfn_slot = NFAPI_SFNSLOT2HEX(frame, (slot + data_toul_fb));
|
||||
if (get_softmodem_params()->emulate_l1) {
|
||||
int scs = get_softmodem_params()->numerology;
|
||||
int slots_per_frame = nr_slots_per_frame[scs];
|
||||
slot += data_toul_fb;
|
||||
if (slot >= slots_per_frame) {
|
||||
frame = (frame + 1) % 1024;
|
||||
slot %= slots_per_frame;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(NR_PHY,"Setting harq_status for harq_id %d, dl %d.%d, sched ul %d.%d\n",
|
||||
harq_id, frame, slot, frame, (slot + data_toul_fb));
|
||||
harq_id, current_harq->dl_frame, current_harq->dl_slot, frame, slot);
|
||||
}
|
||||
|
||||
|
||||
@@ -1853,7 +1861,8 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, int uci_size) {
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL)) {
|
||||
if (uci_size <= 2) {
|
||||
// PUCCH with format0 can be up to 3 bits (2 ack/nacks + 1 sr is 3 max bits)
|
||||
if (uci_size <= 3) {
|
||||
pucch_resource_set_id = 0;
|
||||
return (pucch_resource_set_id);
|
||||
break;
|
||||
@@ -2054,11 +2063,17 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
|
||||
sched_frame = current_harq->dl_frame;
|
||||
if (sched_slot>=slots_per_frame){
|
||||
sched_slot %= slots_per_frame;
|
||||
sched_frame++;
|
||||
sched_frame = (sched_frame + 1) % 1024;
|
||||
}
|
||||
AssertFatal(sched_slot < slots_per_frame, "sched_slot was calculated incorrect %d\n", sched_slot);
|
||||
LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d\n",dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul,current_harq->is_common);
|
||||
/* check if current tx slot should transmit downlink acknowlegment */
|
||||
if (sched_frame == frame && sched_slot == slot) {
|
||||
if (get_softmodem_params()->emulate_l1) {
|
||||
mac->nr_ue_emul_l1.harq[dl_harq_pid].active = true;
|
||||
mac->nr_ue_emul_l1.harq[dl_harq_pid].active_dl_harq_sfn = frame;
|
||||
mac->nr_ue_emul_l1.harq[dl_harq_pid].active_dl_harq_slot = slot;
|
||||
}
|
||||
|
||||
if (current_harq->dai > NR_DL_MAX_DAI) {
|
||||
LOG_E(MAC,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
|
||||
@@ -1079,6 +1079,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
else
|
||||
{
|
||||
dl_config->number_pdus = 0;
|
||||
}
|
||||
}
|
||||
} else if (ul_info) {
|
||||
|
||||
@@ -2251,26 +2255,27 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
|
||||
int O_CSI = 0;
|
||||
int N_UCI = 0;
|
||||
|
||||
PUCCH_sched_t *pucch = calloc(1,sizeof(*pucch));
|
||||
pucch->resource_indicator = -1;
|
||||
pucch->initial_pucch_id = -1;
|
||||
PUCCH_sched_t pucch = {
|
||||
.resource_indicator = -1,
|
||||
.initial_pucch_id = -1
|
||||
};
|
||||
uint16_t rnti = mac->crnti; //FIXME not sure this is valid for all pucch instances
|
||||
|
||||
// SR
|
||||
if(trigger_periodic_scheduling_request(mac, pucch, frameP, slotP)) {
|
||||
if (trigger_periodic_scheduling_request(mac, &pucch, frameP, slotP)) {
|
||||
O_SR = 1;
|
||||
/* sr_payload = 1 means that this is a positive SR, sr_payload = 0 means that it is a negative SR */
|
||||
pucch->sr_payload = nr_ue_get_SR(module_idP,
|
||||
pucch.sr_payload = nr_ue_get_SR(module_idP,
|
||||
frameP,
|
||||
slotP);
|
||||
}
|
||||
|
||||
// CSI
|
||||
if (mac->ra.ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test == 1)
|
||||
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, pucch);
|
||||
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, &pucch);
|
||||
|
||||
// ACKNACK
|
||||
O_ACK = get_downlink_ack(mac, frameP, slotP, pucch);
|
||||
O_ACK = get_downlink_ack(mac, frameP, slotP, &pucch);
|
||||
|
||||
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
|
||||
NR_PUCCH_Config_t *pucch_Config = NULL;
|
||||
@@ -2300,35 +2305,39 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
|
||||
pucch_Config->format2 &&
|
||||
(pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI == NULL)) {
|
||||
O_CSI = 0;
|
||||
pucch->csi_part1_payload = 0;
|
||||
pucch->csi_part2_payload = 0;
|
||||
pucch.csi_part1_payload = 0;
|
||||
pucch.csi_part2_payload = 0;
|
||||
}
|
||||
|
||||
N_UCI = O_SR + O_ACK + O_CSI;
|
||||
mac->nr_ue_emul_l1.num_srs = O_SR;
|
||||
mac->nr_ue_emul_l1.num_harqs = O_ACK;
|
||||
mac->nr_ue_emul_l1.num_csi_reports = O_CSI;
|
||||
|
||||
// do no transmit pucch if only SR scheduled and it is negative
|
||||
if ((O_ACK + O_CSI) == 0 && pucch->sr_payload == 0)
|
||||
if ((O_ACK + O_CSI) == 0 && pucch.sr_payload == 0)
|
||||
return;
|
||||
|
||||
if (N_UCI > 0) {
|
||||
LOG_D(NR_MAC,"%d.%d configure pucch, O_SR %d, O_ACK %d, O_CSI %d\n",frameP,slotP,O_SR,O_ACK,O_CSI);
|
||||
pucch->resource_set_id = find_pucch_resource_set(mac, O_ACK + O_CSI);
|
||||
select_pucch_resource(mac, pucch);
|
||||
pucch.resource_set_id = find_pucch_resource_set(mac, O_ACK + O_CSI);
|
||||
select_pucch_resource(mac, &pucch);
|
||||
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
|
||||
pthread_mutex_lock(&ul_config->mutex_ul_config);
|
||||
AssertFatal(ul_config->number_pdus<FAPI_NR_UL_CONFIG_LIST_NUM, "ul_config->number_pdus %d out of bounds\n",ul_config->number_pdus);
|
||||
fapi_nr_ul_config_pucch_pdu *pucch_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pucch_config_pdu;
|
||||
|
||||
fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PUCCH);
|
||||
mac->nr_ue_emul_l1.active_uci_sfn_slot = NFAPI_SFNSLOT2HEX(frameP, slotP);
|
||||
pthread_mutex_unlock(&ul_config->mutex_ul_config);
|
||||
|
||||
nr_ue_configure_pucch(mac,
|
||||
slotP,
|
||||
rnti,
|
||||
pucch,
|
||||
&pucch,
|
||||
pucch_pdu,
|
||||
O_SR, O_ACK, O_CSI);
|
||||
LOG_D(NR_MAC,"Configuring pucch, is_common = %d\n",pucch->is_common);
|
||||
LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common);
|
||||
nr_scheduled_response_t scheduled_response;
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
|
||||
@@ -300,6 +300,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
|
||||
(RA_sfn_index + slot_index) * N_t_slot * fdm + td_index * fdm + fdm_index;
|
||||
|
||||
if((prach_occasion_id < cc->total_prach_occasions) && (td_index == 0)){
|
||||
AssertFatal(UL_tti_req->n_pdus < sizeof(UL_tti_req->pdus_list) / sizeof(UL_tti_req->pdus_list[0]),
|
||||
"Invalid UL_tti_req->n_pdus %d\n", UL_tti_req->n_pdus);
|
||||
|
||||
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE;
|
||||
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_prach_pdu_t);
|
||||
@@ -803,6 +805,9 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
future_ul_tti_req->Slot,
|
||||
sched_frame,
|
||||
sched_slot);
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
|
||||
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu;
|
||||
|
||||
@@ -85,7 +85,9 @@ void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id, int
|
||||
void nr_fill_nfapi_srs(int module_id, int CC_id, int UE_id, sub_frame_t slot, NR_SRS_Resource_t *srs_resource) {
|
||||
|
||||
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][slot];
|
||||
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
|
||||
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE;
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_srs_pdu_t);
|
||||
nfapi_nr_srs_pdu_t *srs_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].srs_pdu;
|
||||
|
||||
@@ -56,6 +56,9 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
future_ul_tti_req->Slot,
|
||||
pucch->frame,
|
||||
pucch->ul_slot);
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
|
||||
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE;
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t);
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pucch_pdu;
|
||||
|
||||
@@ -272,20 +272,34 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
||||
|
||||
case UL_SCH_LCID_L_BSR:
|
||||
case UL_SCH_LCID_L_TRUNCATED_BSR:
|
||||
//38.321 section 6.1.3.1
|
||||
//variable length
|
||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
||||
/* Extract long BSR value */
|
||||
ce_ptr = &pduP[mac_subheader_len];
|
||||
NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr;
|
||||
sched_ctrl->estimated_ul_buffer = 0;
|
||||
|
||||
n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 +
|
||||
bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0;
|
||||
//38.321 section 6.1.3.1
|
||||
//variable length
|
||||
/* Several checks have been added to this function to
|
||||
ensure that the casting of the pduP is possible. There seems
|
||||
to be a partial PDU at the end of this buffer, so here
|
||||
we gracefully ignore that by returning 0. See:
|
||||
https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||
return 0;
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||
return 0;
|
||||
mac_ce_len= ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
/* Extract long BSR value */
|
||||
ce_ptr = &pduP[mac_subheader_len];
|
||||
NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr;
|
||||
sched_ctrl->estimated_ul_buffer = 0;
|
||||
|
||||
LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n",
|
||||
bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4,
|
||||
bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0);
|
||||
n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 +
|
||||
bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0;
|
||||
|
||||
LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n",
|
||||
bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4,
|
||||
bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0);
|
||||
|
||||
for (int n = 0; n < n_Lcg; n++){
|
||||
LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d",
|
||||
@@ -346,11 +360,34 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
||||
break;
|
||||
|
||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
||||
// varialbe length
|
||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
||||
//Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
||||
//38.321 section 6.1.3.9
|
||||
// varialbe length
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||
return 0;
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||
return 0;
|
||||
mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
||||
break;
|
||||
|
||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
||||
//38.321 section 6.1.3.9
|
||||
// varialbe length
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||
return 0;
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||
return 0;
|
||||
mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
||||
break;
|
||||
|
||||
@@ -361,7 +398,19 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
||||
|
||||
case UL_SCH_LCID_SRB1:
|
||||
case UL_SCH_LCID_SRB2:
|
||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||
return 0;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||
return 0;
|
||||
mac_subheader_len = 3;
|
||||
mac_sdu_len = ntohs(NR_MAC_SUBHEADER_LONG *) pduP)->L);
|
||||
} else {
|
||||
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
rnti_t crnti = UE_info->rnti[UE_id];
|
||||
int UE_idx = UE_id;
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
@@ -436,7 +485,21 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
||||
break;
|
||||
|
||||
case UL_SCH_LCID_DTCH:
|
||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
||||
// check if LCID is valid at current time.
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||
return 0;
|
||||
if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) {
|
||||
// mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
|
||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||
return 0;
|
||||
mac_subheader_len = 3;
|
||||
mac_sdu_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
||||
|
||||
} else {
|
||||
mac_sdu_len = (NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
|
||||
__func__,
|
||||
module_idP,
|
||||
@@ -1732,6 +1795,9 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
future_ul_tti_req->Slot,
|
||||
sched_pusch->frame,
|
||||
sched_pusch->slot);
|
||||
AssertFatal(future_ul_tti_req->n_pdus <
|
||||
sizeof(future_ul_tti_req->pdus_list) / sizeof(future_ul_tti_req->pdus_list[0]),
|
||||
"Invalid future_ul_tti_req->n_pdus %d\n", future_ul_tti_req->n_pdus);
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
|
||||
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu;
|
||||
|
||||
@@ -51,7 +51,12 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
|
||||
|
||||
if (entity->type != NR_PDCP_SRB && !(buffer[0] & 0x80)) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
/* TODO: This is something of a hack. The most significant bit
|
||||
in buffer[0] should be 1 if the packet is a data packet. We are
|
||||
processing malformed data packets if the most significant bit
|
||||
is 0. Rather than exit(1), this hack allows us to continue for now.
|
||||
We need to investigate why this hack is neccessary. */
|
||||
buffer[0] |= 128;
|
||||
}
|
||||
|
||||
if (entity->sn_size == 12) {
|
||||
@@ -368,8 +373,8 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
|
||||
ret->set_security = nr_pdcp_entity_set_security;
|
||||
ret->set_time = nr_pdcp_entity_set_time;
|
||||
|
||||
ret->delete = nr_pdcp_entity_delete;
|
||||
|
||||
ret->delete_entity = nr_pdcp_entity_delete;
|
||||
|
||||
ret->deliver_sdu = deliver_sdu;
|
||||
ret->deliver_sdu_data = deliver_sdu_data;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct nr_pdcp_entity_t {
|
||||
void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size);
|
||||
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
|
||||
int sdu_id);
|
||||
void (*delete)(struct nr_pdcp_entity_t *entity);
|
||||
void (*delete_entity)(struct nr_pdcp_entity_t *entity);
|
||||
|
||||
/* set_security: pass -1 to integrity_algorithm / ciphering_algorithm
|
||||
* to keep the current algorithm
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "pdcp.h"
|
||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include "openair2/SDAP/nr_sdap/nr_sdap_gnb.h"
|
||||
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
|
||||
|
||||
#define TODO do { \
|
||||
printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \
|
||||
@@ -438,9 +438,13 @@ static void *enb_tun_read_thread(void *_)
|
||||
|
||||
ctxt.rnti = rnti;
|
||||
|
||||
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
|
||||
uint8_t qfi = 7;
|
||||
boolean_t rqi = 0;
|
||||
int pdusession_id = 10;
|
||||
|
||||
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
|
||||
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
|
||||
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
|
||||
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, qfi, rqi, pdusession_id);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -481,9 +485,13 @@ static void *ue_tun_read_thread(void *_)
|
||||
|
||||
ctxt.rnti = rnti;
|
||||
|
||||
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
|
||||
boolean_t dc = SDAP_HDR_UL_DATA_PDU;
|
||||
uint8_t qfi = 7;
|
||||
int pdusession_id = 10;
|
||||
|
||||
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
|
||||
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
|
||||
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
|
||||
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, qfi, dc, pdusession_id);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -607,28 +615,20 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
|
||||
static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
char *buf, int size)
|
||||
{
|
||||
extern int nas_sock_fd[];
|
||||
int len;
|
||||
nr_pdcp_ue_t *ue = _ue;
|
||||
MessageDef *message_p;
|
||||
uint8_t *gtpu_buffer_p;
|
||||
int rb_id;
|
||||
int i;
|
||||
|
||||
if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) {
|
||||
LOG_D(PDCP, "IP packet received, to be sent to TUN interface");
|
||||
|
||||
if(entity->has_sdapDLheader){
|
||||
size -= SDAP_HDR_LENGTH;
|
||||
len = write(nas_sock_fd[0], &buf[SDAP_HDR_LENGTH], size);
|
||||
} else {
|
||||
len = write(nas_sock_fd[0], buf, size);
|
||||
}
|
||||
|
||||
if (len != size) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal error %d: %s\n", __FILE__, __LINE__, __FUNCTION__, errno, strerror(errno));
|
||||
}
|
||||
|
||||
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE rnti: %d\n", size, ue->rnti);
|
||||
sdap_data_ind(entity->rb_id,
|
||||
entity->is_gnb,
|
||||
entity->has_sdap,
|
||||
entity->has_sdapULheader,
|
||||
entity->pdusession_id,
|
||||
ue->rnti,
|
||||
buf,
|
||||
size);
|
||||
}
|
||||
else{
|
||||
for (i = 0; i < 5; i++) {
|
||||
@@ -644,31 +644,16 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
|
||||
rb_found:
|
||||
{
|
||||
int offset=0;
|
||||
if (entity->has_sdap == 1 && entity->has_sdapULheader == 1)
|
||||
offset = 1; // this is the offset of the SDAP header in bytes
|
||||
|
||||
message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0,
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ,
|
||||
sizeof(gtpv1u_gnb_tunnel_data_req_t) + size
|
||||
+ GTPU_HEADER_OVERHEAD_MAX - offset);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
|
||||
gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p);
|
||||
gtpu_buffer_p = (uint8_t*)(req+1);
|
||||
memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, buf+offset, size-offset);
|
||||
req->buffer = gtpu_buffer_p;
|
||||
req->length = size-offset;
|
||||
req->offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
req->rnti = ue->rnti;
|
||||
req->pdusession_id = entity->pdusession_id;
|
||||
if (offset==1) {
|
||||
LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
|
||||
sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header
|
||||
}
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset);
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
}
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size);
|
||||
sdap_data_ind(rb_id,
|
||||
ue->drb[rb_id-1]->is_gnb,
|
||||
ue->drb[rb_id-1]->has_sdap,
|
||||
ue->drb[rb_id-1]->has_sdapULheader,
|
||||
ue->drb[rb_id-1]->pdusession_id,
|
||||
ue->rnti,
|
||||
buf,
|
||||
size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,6 +952,9 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
int has_sdap = 0;
|
||||
int has_sdapULheader=0;
|
||||
int has_sdapDLheader=0;
|
||||
boolean_t is_sdap_DefaultDRB = false;
|
||||
NR_QFI_t *mappedQFIs2Add = NULL;
|
||||
uint8_t mappedQFIs2AddCount=0;
|
||||
if (s->cnAssociation->present == NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity)
|
||||
pdusession_id = s->cnAssociation->choice.eps_BearerIdentity;
|
||||
else {
|
||||
@@ -975,9 +963,13 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
exit(-1);
|
||||
}
|
||||
pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session;
|
||||
has_sdap = 1;
|
||||
has_sdapULheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderUL == NR_SDAP_Config__sdap_HeaderUL_present ? 1 : 0;
|
||||
has_sdapDLheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderDL == NR_SDAP_Config__sdap_HeaderDL_present ? 1 : 0;
|
||||
has_sdap = has_sdapULheader | has_sdapDLheader;
|
||||
is_sdap_DefaultDRB = s->cnAssociation->choice.sdap_Config->defaultDRB == true ? 1 : 0;
|
||||
mappedQFIs2Add = (NR_QFI_t*)s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.array[0];
|
||||
mappedQFIs2AddCount = s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.count;
|
||||
LOG_D(SDAP, "Captured mappedQoS_FlowsToAdd from RRC: %ld \n", *mappedQFIs2Add);
|
||||
}
|
||||
/* TODO(?): accept different UL and DL SN sizes? */
|
||||
if (sn_size_ul != sn_size_dl) {
|
||||
@@ -1009,6 +1001,15 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
|
||||
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
|
||||
|
||||
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
|
||||
|
||||
new_nr_sdap_entity(has_sdap,
|
||||
rnti,
|
||||
pdusession_id,
|
||||
is_sdap_DefaultDRB,
|
||||
drb_id,
|
||||
mappedQFIs2Add,
|
||||
mappedQFIs2AddCount);
|
||||
LOG_D(SDAP, "Added SDAP entity to ue rnti %x with pdusession_id %d\n", rnti, pdusession_id);
|
||||
}
|
||||
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
|
||||
}
|
||||
@@ -1140,7 +1141,7 @@ void nr_DRB_preconfiguration(uint16_t crnti)
|
||||
NR_DRB_ToAddMod_t *drb_ToAddMod = calloc(1,sizeof(*drb_ToAddMod));
|
||||
drb_ToAddMod->cnAssociation = calloc(1,sizeof(*drb_ToAddMod->cnAssociation));
|
||||
drb_ToAddMod->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity;
|
||||
drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity= 5;
|
||||
drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity= 10;
|
||||
drb_ToAddMod->drb_Identity = 1;
|
||||
drb_ToAddMod->reestablishPDCP = NULL;
|
||||
drb_ToAddMod->recoverPDCP = NULL;
|
||||
@@ -1450,3 +1451,10 @@ void nr_pdcp_tick(int frame, int subframe)
|
||||
nr_pdcp_wakeup_timer_thread(nr_pdcp_current_time);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For the SDAP API
|
||||
*/
|
||||
nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(){
|
||||
return nr_pdcp_ue_manager;
|
||||
}
|
||||
|
||||
@@ -127,11 +127,11 @@ void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, int rnti)
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
if (ue->srb[j] != NULL)
|
||||
ue->srb[j]->delete(ue->srb[j]);
|
||||
ue->srb[j]->delete_entity(ue->srb[j]);
|
||||
|
||||
for (j = 0; j < 5; j++)
|
||||
if (ue->drb[j] != NULL)
|
||||
ue->drb[j]->delete(ue->drb[j]);
|
||||
ue->drb[j]->delete_entity(ue->drb[j]);
|
||||
|
||||
free(ue);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,15 +41,44 @@
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
|
||||
#define NR_NUM_MCS 29
|
||||
#define NUM_SINR 100
|
||||
#define NUM_BLER_COL 13
|
||||
#define NUM_NFAPI_SLOT 20
|
||||
#define NR_NUM_LAYER 1
|
||||
|
||||
typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t;
|
||||
|
||||
typedef struct nr_phy_channel_params_t
|
||||
{
|
||||
uint16_t sfn_slot;
|
||||
float sinr;
|
||||
uint16_t message_id;
|
||||
uint16_t nb_of_sinrs;
|
||||
float sinr[NR_NUM_LAYER];
|
||||
// Incomplete, need all channel parameters
|
||||
} nr_phy_channel_params_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t slot;
|
||||
uint16_t rnti[256];
|
||||
uint8_t mcs[256];
|
||||
uint8_t rvIndex[256];
|
||||
float sinr;
|
||||
uint16_t num_pdus;
|
||||
bool drop_flag[256];
|
||||
bool latest;
|
||||
|
||||
} slot_rnti_mcs_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t length;
|
||||
float bler_table[NUM_SINR][NUM_BLER_COL];
|
||||
} nr_bler_struct;
|
||||
|
||||
extern nr_bler_struct nr_bler_data[NR_NUM_MCS];
|
||||
|
||||
typedef enum {
|
||||
ONLY_PUSCH,
|
||||
NOT_PUSCH,
|
||||
@@ -240,6 +269,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
|
||||
nfapi_nr_ul_dci_request_t *ul_dci_request,
|
||||
nfapi_nr_ul_tti_request_t *ul_tti_request);
|
||||
|
||||
bool sfn_slot_matcher(void *wanted, void *candidate);
|
||||
|
||||
/**\brief done free of memory allocation by module_id and release to pointer pool.
|
||||
\param module_id module id*/
|
||||
int nr_ue_if_module_kill(uint32_t module_id);
|
||||
|
||||
@@ -1259,6 +1259,17 @@ void ue_init_standalone_socket(int tx_port, int rx_port)
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t get_message_id(const uint8_t *buffer, ssize_t len)
|
||||
{
|
||||
if (len < 4)
|
||||
return 0;
|
||||
|
||||
// Unpack 2 bytes message_id from buffer.
|
||||
uint16_t v;
|
||||
memcpy(&v, buffer + 2, sizeof(v));
|
||||
return ntohs(v);
|
||||
}
|
||||
|
||||
void *ue_standalone_pnf_task(void *context)
|
||||
{
|
||||
struct sockaddr_in server_address;
|
||||
@@ -1301,7 +1312,7 @@ void *ue_standalone_pnf_task(void *context)
|
||||
abort();
|
||||
}
|
||||
}
|
||||
else if (len == sizeof(phy_channel_params_t))
|
||||
else if (get_message_id((const uint8_t *)buffer, len) == 0x0FFF) // 0x0FFF : channel info identifier.
|
||||
{
|
||||
phy_channel_params_t ch_info;
|
||||
memcpy(&ch_info, buffer, sizeof(phy_channel_params_t));
|
||||
@@ -1314,8 +1325,15 @@ void *ue_standalone_pnf_task(void *context)
|
||||
uint16_t sf = ch_info.sfn_sf & 15;
|
||||
assert(sf < 10);
|
||||
|
||||
sf_rnti_mcs[sf].sinr = ch_info.sinr;
|
||||
LOG_D(MAC, "Received_SINR = %f\n",ch_info.sinr);
|
||||
if (ch_info.nb_of_sinrs > 1)
|
||||
LOG_W(MAC, "Expecting at most one SINR.\n");
|
||||
|
||||
// TODO: Update sinr field of slot_rnti_mcs to be array.
|
||||
for (int i = 0; i < ch_info.nb_of_sinrs; ++i)
|
||||
{
|
||||
sf_rnti_mcs[sf].sinr = ch_info.sinr[i];
|
||||
LOG_D(MAC, "Received_SINR[%d] = %f\n", i, ch_info.sinr[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define NUM_MCS 28
|
||||
#define NUM_SINR 100
|
||||
#define NUM_BLER_COL 13
|
||||
#define LTE_NUM_LAYER 1
|
||||
|
||||
// this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
|
||||
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
|
||||
@@ -126,7 +127,9 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
|
||||
typedef struct phy_channel_params_t
|
||||
{
|
||||
uint16_t sfn_sf;
|
||||
float sinr;
|
||||
uint16_t message_id;
|
||||
uint16_t nb_of_sinrs;
|
||||
float sinr[LTE_NUM_LAYER];
|
||||
// Incomplete, need all channel parameters
|
||||
} phy_channel_params_t;
|
||||
|
||||
|
||||
@@ -821,7 +821,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
uint8_t buffer[RRC_BUF_SIZE];
|
||||
uint16_t size;
|
||||
int qos_flow_index = 0;
|
||||
NR_QFI_t qfi = 0;
|
||||
int pdu_sessions_done = 0;
|
||||
int i;
|
||||
NR_CellGroupConfig_t *cellGroupConfig;
|
||||
@@ -872,15 +871,21 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
|
||||
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
|
||||
sdap_config->pdu_Session = ue_context_pP->ue_context.pduSession[i].param.pdusession_id;
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present;
|
||||
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent;
|
||||
if (rrc->configuration.enable_sdap) {
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present;
|
||||
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present;
|
||||
} else {
|
||||
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent;
|
||||
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent;
|
||||
}
|
||||
sdap_config->defaultDRB = TRUE;
|
||||
sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
|
||||
memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
|
||||
|
||||
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pduSession[i].param.nb_qos; qos_flow_index++) {
|
||||
qfi = ue_context_pP->ue_context.pduSession[i].param.qos[qos_flow_index].qfi;
|
||||
ASN_SEQUENCE_ADD(&sdap_config->mappedQoS_FlowsToAdd->list, &qfi);
|
||||
NR_QFI_t *qfi = calloc(1, sizeof(NR_QFI_t));
|
||||
*qfi = ue_context_pP->ue_context.pduSession[i].param.qos[qos_flow_index].qfi;
|
||||
ASN_SEQUENCE_ADD(&sdap_config->mappedQoS_FlowsToAdd->list, qfi);
|
||||
}
|
||||
sdap_config->mappedQoS_FlowsToRelease = NULL;
|
||||
DRB_config->cnAssociation->choice.sdap_Config = sdap_config;
|
||||
|
||||
@@ -2795,7 +2795,6 @@ void start_oai_nrue_threads()
|
||||
init_queue(&nr_tx_req_queue);
|
||||
init_queue(&nr_ul_dci_req_queue);
|
||||
init_queue(&nr_ul_tti_req_queue);
|
||||
init_queue(&nr_wait_ul_tti_req_queue);
|
||||
|
||||
if (sem_init(&sfn_slot_semaphore, 0, 0) != 0)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,6 @@ extern queue_t nr_dl_tti_req_queue;
|
||||
extern queue_t nr_tx_req_queue;
|
||||
extern queue_t nr_ul_dci_req_queue;
|
||||
extern queue_t nr_ul_tti_req_queue;
|
||||
extern queue_t nr_wait_ul_tti_req_queue;
|
||||
//
|
||||
// main_rrc.c
|
||||
//
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "nr_sdap.h"
|
||||
|
||||
boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id,
|
||||
const uint8_t qfi,
|
||||
const boolean_t rqi,
|
||||
const int pdusession_id) {
|
||||
nr_sdap_entity_t *sdap_entity;
|
||||
sdap_entity = nr_sdap_get_entity(ctxt_p->rnti, pdusession_id);
|
||||
|
||||
if(sdap_entity == NULL) {
|
||||
LOG_E(SDAP, "%s:%d:%s: Entity not found with ue rnti: %x and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ctxt_p->rnti, pdusession_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean_t ret = sdap_entity->tx_entity(sdap_entity,
|
||||
ctxt_p,
|
||||
srb_flag,
|
||||
rb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size,
|
||||
sdu_buffer,
|
||||
pt_mode,
|
||||
sourceL2Id,
|
||||
destinationL2Id,
|
||||
qfi,
|
||||
rqi);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sdap_data_ind(rb_id_t pdcp_entity,
|
||||
int is_gnb,
|
||||
int has_sdap,
|
||||
int has_sdapULheader,
|
||||
int pdusession_id,
|
||||
int rnti,
|
||||
char *buf,
|
||||
int size) {
|
||||
nr_sdap_entity_t *sdap_entity;
|
||||
sdap_entity = nr_sdap_get_entity(rnti, pdusession_id);
|
||||
|
||||
if(sdap_entity == NULL) {
|
||||
LOG_E(SDAP, "%s:%d:%s: Entity not found\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
sdap_entity->rx_entity(sdap_entity,
|
||||
pdcp_entity,
|
||||
is_gnb,
|
||||
has_sdap,
|
||||
has_sdapULheader,
|
||||
pdusession_id,
|
||||
rnti,
|
||||
buf,
|
||||
size);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef _NR_SDAP_GNB_H_
|
||||
#define _NR_SDAP_GNB_H_
|
||||
|
||||
#include "openair2/COMMON/platform_types.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nr_sdap_entity.h"
|
||||
|
||||
/*
|
||||
* TS 37.324 4.4 Functions
|
||||
* Transfer of user plane data
|
||||
* Downlink - gNB
|
||||
* Uplink - nrUE
|
||||
*/
|
||||
boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id,
|
||||
const uint8_t qfi,
|
||||
const boolean_t rqi,
|
||||
const int pdusession_id
|
||||
);
|
||||
|
||||
/*
|
||||
* TS 37.324 4.4 Functions
|
||||
* Transfer of user plane data
|
||||
* Uplink - gNB
|
||||
* Downlink - nrUE
|
||||
*/
|
||||
void sdap_data_ind(rb_id_t pdcp_entity,
|
||||
int is_gnb,
|
||||
int has_sdap,
|
||||
int has_sdapULheader,
|
||||
int pdusession_id,
|
||||
int rnti,
|
||||
char *buf,
|
||||
int size
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,481 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "nr_sdap_entity.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
typedef struct {
|
||||
nr_sdap_entity_t *sdap_entity_llist;
|
||||
} nr_sdap_entity_info;
|
||||
|
||||
static nr_sdap_entity_info sdap_info;
|
||||
|
||||
nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(void);
|
||||
|
||||
void nr_pdcp_submit_sdap_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu){
|
||||
nr_pdcp_ue_t *ue;
|
||||
nr_pdcp_ue_manager_t *nr_pdcp_ue_manager;
|
||||
nr_pdcp_ue_manager = nr_pdcp_sdap_get_ue_manager();
|
||||
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
|
||||
ue->drb[sdap_ctrl_pdu_drb-1]->recv_sdu(ue->drb[sdap_ctrl_pdu_drb-1], (char*)&ctrl_pdu, SDAP_HDR_LENGTH, RLC_MUI_UNDEFINED);
|
||||
return;
|
||||
}
|
||||
|
||||
static boolean_t nr_sdap_tx_entity(nr_sdap_entity_t *entity,
|
||||
protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id,
|
||||
const uint8_t qfi,
|
||||
const boolean_t rqi
|
||||
) {
|
||||
/* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */
|
||||
int offset=0;
|
||||
boolean_t ret=false;
|
||||
/*Hardcode DRB ID given from upper layer (ue/enb_tun_read_thread rb_id), it will change if we have SDAP*/
|
||||
rb_id_t sdap_drb_id = rb_id;
|
||||
int pdcp_ent_has_sdap = 0;
|
||||
|
||||
if(sdu_buffer == NULL) {
|
||||
LOG_E(SDAP, "%s:%d:%s: NULL sdu_buffer \n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uint8_t sdap_buf[SDAP_MAX_PDU];
|
||||
rb_id_t pdcp_entity = entity->qfi2drb_map(entity, qfi, rb_id);
|
||||
|
||||
if(pdcp_entity){
|
||||
sdap_drb_id = pdcp_entity;
|
||||
pdcp_ent_has_sdap = entity->qfi2drb_table[qfi].hasSdap;
|
||||
}
|
||||
|
||||
if(!pdcp_ent_has_sdap){
|
||||
ret = pdcp_data_req(ctxt_p,
|
||||
srb_flag,
|
||||
sdap_drb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size,
|
||||
sdu_buffer,
|
||||
pt_mode,
|
||||
sourceL2Id,
|
||||
destinationL2Id);
|
||||
|
||||
if(!ret)
|
||||
LOG_E(SDAP, "%s:%d:%s: PDCP refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(sdu_buffer_size == 0 || sdu_buffer_size > 8999) {
|
||||
LOG_E(SDAP, "%s:%d:%s: NULL or 0 or exceeded sdu_buffer_size (over max PDCP SDU)\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(ctxt_p->enb_flag) { // gNB
|
||||
offset = SDAP_HDR_LENGTH;
|
||||
/*
|
||||
* TS 37.324 4.4 Functions
|
||||
* marking QoS flow ID in DL packets.
|
||||
*
|
||||
* Construct the DL SDAP data PDU.
|
||||
*/
|
||||
nr_sdap_dl_hdr_t sdap_hdr;
|
||||
sdap_hdr.QFI = qfi;
|
||||
sdap_hdr.RQI = rqi;
|
||||
sdap_hdr.RDI = 0; // SDAP Hardcoded Value
|
||||
/* Add the SDAP DL Header to the buffer */
|
||||
memcpy(&sdap_buf[0], &sdap_hdr, SDAP_HDR_LENGTH);
|
||||
memcpy(&sdap_buf[SDAP_HDR_LENGTH], sdu_buffer, sdu_buffer_size);
|
||||
LOG_D(SDAP, "TX Entity QFI: %u \n", sdap_hdr.QFI);
|
||||
LOG_D(SDAP, "TX Entity RQI: %u \n", sdap_hdr.RQI);
|
||||
LOG_D(SDAP, "TX Entity RDI: %u \n", sdap_hdr.RDI);
|
||||
} else { // nrUE
|
||||
offset = SDAP_HDR_LENGTH;
|
||||
/*
|
||||
* TS 37.324 4.4 Functions
|
||||
* marking QoS flow ID in UL packets.
|
||||
*
|
||||
* 5.2.1 Uplink
|
||||
* construct the UL SDAP data PDU as specified in the subclause 6.2.2.3.
|
||||
*/
|
||||
nr_sdap_ul_hdr_t sdap_hdr;
|
||||
sdap_hdr.QFI = qfi;
|
||||
sdap_hdr.R = 0;
|
||||
sdap_hdr.DC = rqi;
|
||||
/* Add the SDAP UL Header to the buffer */
|
||||
memcpy(&sdap_buf[0], &sdap_hdr, SDAP_HDR_LENGTH);
|
||||
memcpy(&sdap_buf[SDAP_HDR_LENGTH], sdu_buffer, sdu_buffer_size);
|
||||
LOG_D(SDAP, "TX Entity QFI: %u \n", sdap_hdr.QFI);
|
||||
LOG_D(SDAP, "TX Entity R: %u \n", sdap_hdr.R);
|
||||
LOG_D(SDAP, "TX Entity DC: %u \n", sdap_hdr.DC);
|
||||
}
|
||||
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.1 Uplink UE side
|
||||
* submit the constructed UL SDAP data PDU to the lower layers
|
||||
*
|
||||
* Downlink gNB side
|
||||
*/
|
||||
ret = pdcp_data_req(ctxt_p,
|
||||
srb_flag,
|
||||
sdap_drb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size+offset,
|
||||
sdap_buf,
|
||||
pt_mode,
|
||||
sourceL2Id,
|
||||
destinationL2Id);
|
||||
|
||||
if(!ret)
|
||||
LOG_E(SDAP, "%s:%d:%s: PDCP refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
|
||||
rb_id_t pdcp_entity,
|
||||
int is_gnb,
|
||||
int has_sdap,
|
||||
int has_sdapHeader,
|
||||
int pdusession_id,
|
||||
int rnti,
|
||||
char *buf,
|
||||
int size) {
|
||||
/* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */
|
||||
int offset=0;
|
||||
|
||||
if(is_gnb) { // gNB
|
||||
if(has_sdap && has_sdapHeader ) { // Handling the SDAP Header
|
||||
offset = SDAP_HDR_LENGTH;
|
||||
nr_sdap_ul_hdr_t *sdap_hdr = (nr_sdap_ul_hdr_t *)buf;
|
||||
LOG_D(SDAP, "RX Entity Received QFI : %u\n", sdap_hdr->QFI);
|
||||
LOG_D(SDAP, "RX Entity Received Reserved bit : %u\n", sdap_hdr->R);
|
||||
LOG_D(SDAP, "RX Entity Received DC bit : %u\n", sdap_hdr->DC);
|
||||
|
||||
switch (sdap_hdr->DC) {
|
||||
case SDAP_HDR_UL_DATA_PDU:
|
||||
LOG_D(SDAP, "RX Entity Received SDAP Data PDU\n");
|
||||
break;
|
||||
|
||||
case SDAP_HDR_UL_CTRL_PDU:
|
||||
LOG_D(SDAP, "RX Entity Received SDAP Control PDU\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Pushing SDAP SDU to GTP-U Layer
|
||||
MessageDef *message_p;
|
||||
uint8_t *gtpu_buffer_p;
|
||||
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, size + GTPU_HEADER_OVERHEAD_MAX - offset);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf+offset, size-offset);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0 , GTPV1U_GNB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size-offset;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = rnti;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = pdusession_id;
|
||||
LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset);
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
} else { //nrUE
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.2 Downlink
|
||||
* if the DRB from which this SDAP data PDU is received is configured by RRC with the presence of SDAP header.
|
||||
*/
|
||||
if(has_sdap && has_sdapHeader) { // Handling the SDAP Header
|
||||
offset = SDAP_HDR_LENGTH;
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.2 Downlink
|
||||
* retrieve the SDAP SDU from the DL SDAP data PDU as specified in the subclause 6.2.2.2.
|
||||
*/
|
||||
nr_sdap_dl_hdr_t *sdap_hdr = (nr_sdap_dl_hdr_t *)buf;
|
||||
LOG_D(SDAP, "RX Entity Received QFI : %u\n", sdap_hdr->QFI);
|
||||
LOG_D(SDAP, "RX Entity Received RQI : %u\n", sdap_hdr->RQI);
|
||||
LOG_D(SDAP, "RX Entity Received RDI : %u\n", sdap_hdr->RDI);
|
||||
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.2 Downlink
|
||||
* Perform reflective QoS flow to DRB mapping as specified in the subclause 5.3.2.
|
||||
*/
|
||||
if(sdap_hdr->RDI == SDAP_REFLECTIVE_MAPPING) {
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* 5.3.2 Reflective mapping
|
||||
* If there is no stored QoS flow to DRB mapping rule for the QoS flow and a default DRB is configured.
|
||||
*/
|
||||
if(!entity->qfi2drb_table[sdap_hdr->QFI].drb_id && entity->default_drb){
|
||||
nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI);
|
||||
rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, sdap_hdr->QFI);
|
||||
entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
|
||||
}
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB mapping
|
||||
* 5.3.2 Reflective mapping
|
||||
* if the stored QoS flow to DRB mapping rule for the QoS flow
|
||||
* is different from the QoS flow to DRB mapping of the DL SDAP data PDU
|
||||
* and
|
||||
* the DRB according to the stored QoS flow to DRB mapping rule is configured by RRC
|
||||
* with the presence of UL SDAP header
|
||||
*/
|
||||
if( (pdcp_entity != entity->qfi2drb_table[sdap_hdr->QFI].drb_id) &&
|
||||
has_sdapHeader ){
|
||||
nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI);
|
||||
rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, sdap_hdr->QFI);
|
||||
entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
|
||||
}
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* 5.3.2 Reflective mapping
|
||||
* store the QoS flow to DRB mapping of the DL SDAP data PDU as the QoS flow to DRB mapping rule for the UL.
|
||||
*/
|
||||
entity->qfi2drb_table[sdap_hdr->QFI].drb_id = pdcp_entity;
|
||||
}
|
||||
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.2 Downlink
|
||||
* perform RQI handling as specified in the subclause 5.4
|
||||
*/
|
||||
if(sdap_hdr->RQI == SDAP_RQI_HANDLING) {
|
||||
LOG_W(SDAP, "UE - TODD 5.4\n");
|
||||
}
|
||||
} /* else - retrieve the SDAP SDU from the DL SDAP data PDU as specified in the subclause 6.2.2.1 */
|
||||
|
||||
/*
|
||||
* TS 37.324 5.2 Data transfer
|
||||
* 5.2.2 Downlink
|
||||
* deliver the retrieved SDAP SDU to the upper layer.
|
||||
*/
|
||||
extern int nas_sock_fd[];
|
||||
int len = write(nas_sock_fd[0], &buf[offset], size-offset);
|
||||
LOG_D(SDAP, "RX Entity len : %d\n", len);
|
||||
LOG_D(SDAP, "RX Entity size : %d\n", size);
|
||||
LOG_D(SDAP, "RX Entity offset : %d\n", offset);
|
||||
|
||||
if (len != size-offset)
|
||||
LOG_E(SDAP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, boolean_t hasSdap){
|
||||
if(qfi < SDAP_MAX_QFI &&
|
||||
qfi > SDAP_MAP_RULE_EMPTY &&
|
||||
drb > 0 &&
|
||||
drb <= AVLBL_DRB)
|
||||
{
|
||||
entity->qfi2drb_table[qfi].drb_id = drb;
|
||||
entity->qfi2drb_table[qfi].hasSdap = hasSdap;
|
||||
LOG_D(SDAP, "Updated QFI to DRB Map: QFI %u -> DRB %ld \n", qfi, entity->qfi2drb_table[qfi].drb_id);
|
||||
LOG_D(SDAP, "DRB %ld %s\n", entity->qfi2drb_table[qfi].drb_id, hasSdap ? "has SDAP" : "does not have SDAP");
|
||||
}
|
||||
}
|
||||
|
||||
void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi){
|
||||
entity->qfi2drb_table[qfi].drb_id = SDAP_NO_MAPPING_RULE;
|
||||
LOG_D(SDAP, "Deleted QFI to DRB Map for QFI %u \n", qfi);
|
||||
}
|
||||
|
||||
rb_id_t nr_sdap_qfi2drb_map(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t upper_layer_rb_id){
|
||||
rb_id_t pdcp_entity;
|
||||
|
||||
pdcp_entity = entity->qfi2drb_table[qfi].drb_id;
|
||||
|
||||
if(pdcp_entity){
|
||||
return pdcp_entity;
|
||||
} else if(entity->default_drb) {
|
||||
LOG_D(SDAP, "Mapped QFI %u to Default DRB\n", qfi);
|
||||
return entity->default_drb;
|
||||
} else {
|
||||
return SDAP_MAP_RULE_EMPTY;
|
||||
}
|
||||
|
||||
return pdcp_entity;
|
||||
}
|
||||
|
||||
nr_sdap_ul_hdr_t nr_sdap_construct_ctrl_pdu(uint8_t qfi){
|
||||
nr_sdap_ul_hdr_t sdap_end_marker_hdr;
|
||||
sdap_end_marker_hdr.QFI = qfi;
|
||||
sdap_end_marker_hdr.R = 0;
|
||||
sdap_end_marker_hdr.DC = SDAP_HDR_UL_CTRL_PDU;
|
||||
LOG_D(SDAP, "Constructed Control PDU with QFI:%u R:%u DC:%u \n", sdap_end_marker_hdr.QFI,
|
||||
sdap_end_marker_hdr.R,
|
||||
sdap_end_marker_hdr.DC);
|
||||
return sdap_end_marker_hdr;
|
||||
}
|
||||
|
||||
rb_id_t nr_sdap_map_ctrl_pdu(nr_sdap_entity_t *entity, rb_id_t pdcp_entity, int map_type, uint8_t dl_qfi){
|
||||
rb_id_t drb_of_endmarker = 0;
|
||||
if(map_type == SDAP_CTRL_PDU_MAP_DEF_DRB){
|
||||
drb_of_endmarker = entity->default_drb;
|
||||
LOG_D(SDAP, "Mapped Control PDU to default drb\n");
|
||||
}
|
||||
if(map_type == SDAP_CTRL_PDU_MAP_RULE_DRB){
|
||||
drb_of_endmarker = entity->qfi2drb_map(entity, dl_qfi, pdcp_entity);
|
||||
LOG_D(SDAP, "Mapped Control PDU according to the mapping rule, qfi %u \n", dl_qfi);
|
||||
}
|
||||
return drb_of_endmarker;
|
||||
}
|
||||
|
||||
void nr_sdap_submit_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu){
|
||||
if(sdap_ctrl_pdu_drb){
|
||||
nr_pdcp_submit_sdap_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, ctrl_pdu);
|
||||
LOG_D(SDAP, "Sent Control PDU to PDCP Layer.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity,
|
||||
rb_id_t pdcp_entity,
|
||||
uint16_t rnti,
|
||||
NR_QFI_t *mapped_qfi_2_add,
|
||||
uint8_t mappedQFIs2AddCount,
|
||||
uint8_t drb_identity)
|
||||
{
|
||||
uint8_t qfi = 0;
|
||||
|
||||
for(int i = 0; i < mappedQFIs2AddCount; i++){
|
||||
qfi = mapped_qfi_2_add[i];
|
||||
if(existing_sdap_entity->default_drb && existing_sdap_entity->qfi2drb_table[qfi].drb_id == SDAP_NO_MAPPING_RULE){
|
||||
nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi);
|
||||
rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, qfi);
|
||||
existing_sdap_entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
|
||||
}
|
||||
if(existing_sdap_entity->qfi2drb_table[qfi].drb_id != drb_identity && existing_sdap_entity->qfi2drb_table[qfi].hasSdap){
|
||||
nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi);
|
||||
rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, qfi);
|
||||
existing_sdap_entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nr_sdap_entity_t *new_nr_sdap_entity(int has_sdap,
|
||||
uint16_t rnti,
|
||||
int pdusession_id,
|
||||
boolean_t is_defaultDRB,
|
||||
uint8_t drb_identity,
|
||||
NR_QFI_t *mapped_qfi_2_add,
|
||||
uint8_t mappedQFIs2AddCount)
|
||||
{
|
||||
if(nr_sdap_get_entity(rnti, pdusession_id)) {
|
||||
LOG_E(SDAP, "SDAP Entity for UE already exists.\n");
|
||||
nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(rnti, pdusession_id);
|
||||
rb_id_t pdcp_entity = existing_sdap_entity->default_drb;
|
||||
nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, rnti, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity);
|
||||
return existing_sdap_entity;
|
||||
}
|
||||
|
||||
nr_sdap_entity_t *sdap_entity;
|
||||
sdap_entity = calloc(1, sizeof(nr_sdap_entity_t));
|
||||
|
||||
if(sdap_entity == NULL) {
|
||||
LOG_E(SDAP, "SDAP Entity creation failed, out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sdap_entity->rnti = rnti;
|
||||
sdap_entity->pdusession_id = pdusession_id;
|
||||
|
||||
sdap_entity->tx_entity = nr_sdap_tx_entity;
|
||||
sdap_entity->rx_entity = nr_sdap_rx_entity;
|
||||
|
||||
sdap_entity->sdap_construct_ctrl_pdu = nr_sdap_construct_ctrl_pdu;
|
||||
sdap_entity->sdap_map_ctrl_pdu = nr_sdap_map_ctrl_pdu;
|
||||
sdap_entity->sdap_submit_ctrl_pdu = nr_sdap_submit_ctrl_pdu;
|
||||
|
||||
sdap_entity->qfi2drb_map_update = nr_sdap_qfi2drb_map_update;
|
||||
sdap_entity->qfi2drb_map_delete = nr_sdap_qfi2drb_map_del;
|
||||
sdap_entity->qfi2drb_map = nr_sdap_qfi2drb_map;
|
||||
|
||||
if(is_defaultDRB) {
|
||||
sdap_entity->default_drb = drb_identity;
|
||||
LOG_I(SDAP, "Default DRB for the created SDAP entity: %ld \n", sdap_entity->default_drb);
|
||||
|
||||
if(mappedQFIs2AddCount) {
|
||||
for (int i = 0; i < mappedQFIs2AddCount; i++)
|
||||
{
|
||||
LOG_D(SDAP, "Mapped QFI to Add : %ld \n", mapped_qfi_2_add[i]);
|
||||
sdap_entity->qfi2drb_map_update(sdap_entity, mapped_qfi_2_add[i], sdap_entity->default_drb, has_sdap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sdap_entity->next_entity = sdap_info.sdap_entity_llist;
|
||||
sdap_info.sdap_entity_llist = sdap_entity;
|
||||
return sdap_entity;
|
||||
}
|
||||
|
||||
nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id) {
|
||||
nr_sdap_entity_t *sdap_entity;
|
||||
sdap_entity = sdap_info.sdap_entity_llist;
|
||||
|
||||
if(sdap_entity == NULL)
|
||||
return NULL;
|
||||
|
||||
while(sdap_entity->rnti != rnti && sdap_entity->next_entity != NULL) {
|
||||
sdap_entity = sdap_entity->next_entity;
|
||||
}
|
||||
|
||||
if (sdap_entity->rnti == rnti && sdap_entity->pdusession_id == pdusession_id)
|
||||
return sdap_entity;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void delete_nr_sdap_entity(uint16_t rnti) {
|
||||
nr_sdap_entity_t *entityPtr, *entityPrev = NULL;
|
||||
entityPtr = sdap_info.sdap_entity_llist;
|
||||
|
||||
if(entityPtr->rnti == rnti) {
|
||||
sdap_info.sdap_entity_llist = sdap_info.sdap_entity_llist->next_entity;
|
||||
free(entityPtr);
|
||||
} else {
|
||||
while(entityPtr->rnti != rnti && entityPtr->next_entity != NULL) {
|
||||
entityPrev = entityPtr;
|
||||
entityPtr = entityPtr->next_entity;
|
||||
}
|
||||
|
||||
if(entityPtr->rnti != rnti) {
|
||||
entityPrev->next_entity = entityPtr->next_entity;
|
||||
free(entityPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef _NR_SDAP_ENTITY_H_
|
||||
#define _NR_SDAP_ENTITY_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "openair2/COMMON/platform_types.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
|
||||
#include "NR_RadioBearerConfig.h"
|
||||
|
||||
#define SDAP_BITMASK_DC (0x80)
|
||||
#define SDAP_BITMASK_R (0x40)
|
||||
#define SDAP_BITMASK_QFI (0x3F)
|
||||
#define SDAP_BITMASK_RQI (0x40)
|
||||
#define SDAP_HDR_UL_DATA_PDU (1)
|
||||
#define SDAP_HDR_UL_CTRL_PDU (0)
|
||||
#define SDAP_HDR_LENGTH (1)
|
||||
#define SDAP_MAX_QFI (64)
|
||||
#define SDAP_MAP_RULE_EMPTY (0)
|
||||
#define AVLBL_DRB (5)
|
||||
#define SDAP_NO_MAPPING_RULE (0)
|
||||
#define SDAP_REFLECTIVE_MAPPING (1)
|
||||
#define SDAP_RQI_HANDLING (1)
|
||||
#define SDAP_CTRL_PDU_MAP_DEF_DRB (0)
|
||||
#define SDAP_CTRL_PDU_MAP_RULE_DRB (1)
|
||||
#define SDAP_MAX_PDU (9000)
|
||||
|
||||
/*
|
||||
* The values of QoS Flow ID (QFI) and Reflective QoS Indication,
|
||||
* are located in the PDU Session Container, which is conveyed by
|
||||
* the GTP-U Extension Header. Inside the DL PDU SESSION INFORMATION frame.
|
||||
* TS 38.415 Fig. 5.5.2.1-1
|
||||
*/
|
||||
typedef struct nr_sdap_dl_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t RQI:1;
|
||||
uint8_t RDI:1;
|
||||
} __attribute__((packed)) nr_sdap_dl_hdr_t;
|
||||
|
||||
typedef struct nr_sdap_ul_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t R:1;
|
||||
uint8_t DC:1;
|
||||
} __attribute__((packed)) nr_sdap_ul_hdr_t;
|
||||
|
||||
typedef struct qfi2drb_s {
|
||||
rb_id_t drb_id;
|
||||
boolean_t hasSdap;
|
||||
} qfi2drb_t;
|
||||
|
||||
void nr_pdcp_submit_sdap_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu);
|
||||
|
||||
typedef struct nr_sdap_entity_s {
|
||||
uint16_t rnti;
|
||||
rb_id_t default_drb;
|
||||
int pdusession_id;
|
||||
qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];
|
||||
|
||||
void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, uint8_t qfi, rb_id_t drb, boolean_t hasSdap);
|
||||
void (*qfi2drb_map_delete)(struct nr_sdap_entity_s *entity, uint8_t qfi);
|
||||
rb_id_t (*qfi2drb_map)(struct nr_sdap_entity_s *entity, uint8_t qfi, rb_id_t upper_layer_rb_id);
|
||||
|
||||
nr_sdap_ul_hdr_t (*sdap_construct_ctrl_pdu)(uint8_t qfi);
|
||||
rb_id_t (*sdap_map_ctrl_pdu)(struct nr_sdap_entity_s *entity, rb_id_t pdcp_entity, int map_type, uint8_t dl_qfi);
|
||||
void (*sdap_submit_ctrl_pdu)(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu);
|
||||
|
||||
|
||||
boolean_t (*tx_entity)(struct nr_sdap_entity_s *entity,
|
||||
protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id,
|
||||
const uint8_t qfi,
|
||||
const boolean_t rqi
|
||||
);
|
||||
|
||||
void (*rx_entity)(struct nr_sdap_entity_s *entity,
|
||||
rb_id_t pdcp_entity,
|
||||
int is_gnb,
|
||||
int has_sdap,
|
||||
int has_sdapULheader,
|
||||
int pdusession_id,
|
||||
int rnti,
|
||||
char *buf,
|
||||
int size);
|
||||
|
||||
/* List of entities */
|
||||
struct nr_sdap_entity_s *next_entity;
|
||||
} nr_sdap_entity_t;
|
||||
|
||||
/* QFI to DRB Mapping Related Function */
|
||||
void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, boolean_t hasSdap);
|
||||
|
||||
/* QFI to DRB Mapping Related Function */
|
||||
void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi);
|
||||
|
||||
/*
|
||||
* TS 37.324
|
||||
* 4.4 Functions
|
||||
* Mapping between a QoS flow and a DRB for both DL and UL.
|
||||
*
|
||||
* 5.2.1 Uplink
|
||||
* If there is no stored QoS flow to DRB mapping rule for the QoS flow as specified in the subclause 5.3, map the SDAP SDU to the default DRB
|
||||
* else, map the SDAP SDU to the DRB according to the stored QoS flow to DRB mapping rule.
|
||||
*/
|
||||
rb_id_t nr_sdap_qfi2drb_map(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t upper_layer_rb_id);
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* construct an end-marker control PDU, as specified in the subclause 6.2.3, for the QoS flow;
|
||||
*/
|
||||
nr_sdap_ul_hdr_t nr_sdap_construct_ctrl_pdu(uint8_t qfi);
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* map the end-marker control PDU to the
|
||||
* 1.) default DRB or
|
||||
* 2.) DRB according to the stored QoS flow to DRB mapping rule
|
||||
*/
|
||||
rb_id_t nr_sdap_map_ctrl_pdu(nr_sdap_entity_t *entity, rb_id_t pdcp_entity, int map_type, uint8_t dl_qfi);
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* Submit the end-marker control PDU to the lower layer.
|
||||
*/
|
||||
void nr_sdap_submit_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu);
|
||||
|
||||
/*
|
||||
* TS 37.324 5.3 QoS flow to DRB Mapping
|
||||
* 5.3.1 Configuration Procedures
|
||||
*/
|
||||
void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity,
|
||||
rb_id_t pdcp_entity,
|
||||
uint16_t rnti,
|
||||
NR_QFI_t *mapped_qfi_2_add,
|
||||
uint8_t mappedQFIs2AddCount,
|
||||
uint8_t drb_identity);
|
||||
|
||||
/*
|
||||
* TS 37.324 4.4 5.1.1 SDAP entity establishment
|
||||
* Establish an SDAP entity.
|
||||
*/
|
||||
nr_sdap_entity_t *new_nr_sdap_entity(int has_sdap,
|
||||
uint16_t rnti,
|
||||
int pdusession_id,
|
||||
boolean_t is_defaultDRB,
|
||||
uint8_t default_DRB,
|
||||
NR_QFI_t *mapped_qfi_2_add,
|
||||
uint8_t mappedQFIs2AddCount);
|
||||
|
||||
/* Entity Handling Related Functions */
|
||||
nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id);
|
||||
|
||||
/* Entity Handling Related Functions */
|
||||
void delete_nr_sdap_entity(uint16_t rnti);
|
||||
|
||||
#endif
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "nr_sdap_gnb.h"
|
||||
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
|
||||
|
||||
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id
|
||||
) {
|
||||
if(sdu_buffer == NULL) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL sdu_buffer \n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(sdu_buffer_size == 0) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL or 0 sdu_buffer_size \n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uint8_t *sdap_buf = (uint8_t *)malloc(sdu_buffer_size+SDAP_HDR_LENGTH);
|
||||
nr_sdap_dl_hdr_t sdap_hdr;
|
||||
sdap_hdr.RDI = 0; // SDAP_Hardcoded -
|
||||
sdap_hdr.RQI = 0; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
|
||||
sdap_hdr.QFI = 1; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
|
||||
memcpy(&sdap_buf[0], &sdap_hdr, 1);
|
||||
memcpy(&sdap_buf[1], sdu_buffer, sdu_buffer_size);
|
||||
rb_id_t sdap_drb_id = rb_id; // SDAP_Hardcoded - Should get this info from QFI to DRB mapping table
|
||||
boolean_t ret = pdcp_data_req(ctxt_p,
|
||||
srb_flag,
|
||||
sdap_drb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size+1,
|
||||
sdap_buf,
|
||||
pt_mode,
|
||||
sourceL2Id,
|
||||
destinationL2Id);
|
||||
|
||||
if(!ret) {
|
||||
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - PDCP DL refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
free(sdap_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(sdap_buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr) {
|
||||
nr_sdap_ul_hdr_t *sdap_hdr_ul = (nr_sdap_ul_hdr_t *)&sdap_gnb_ul_hdr;
|
||||
|
||||
switch (sdap_hdr_ul->DC) {
|
||||
case SDAP_HDR_UL_DATA_PDU:
|
||||
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - UL Received SDAP Data PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
break;
|
||||
|
||||
case SDAP_HDR_UL_CTRL_PDU:
|
||||
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - Received SDAP Control PDU\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef _NR_SDAP_GNB_
|
||||
#define _NR_SDAP_GNB_
|
||||
|
||||
#include "openair2/COMMON/platform_types.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
#define SDAP_BITMASK_DC (0x80)
|
||||
#define SDAP_BITMASK_R (0x40)
|
||||
#define SDAP_BITMASK_QFI (0x3F)
|
||||
#define SDAP_HDR_UL_DATA_PDU (1)
|
||||
#define SDAP_HDR_UL_CTRL_PDU (0)
|
||||
#define SDAP_HDR_LENGTH (1)
|
||||
|
||||
typedef struct nr_sdap_dl_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t RQI:1;
|
||||
uint8_t RDI:1;
|
||||
} __attribute__((packed)) nr_sdap_dl_hdr_t;
|
||||
|
||||
typedef struct nr_sdap_ul_hdr_s {
|
||||
uint8_t QFI:6;
|
||||
uint8_t R:1;
|
||||
uint8_t DC:1;
|
||||
} __attribute__((packed)) nr_sdap_ul_hdr_t;
|
||||
|
||||
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
|
||||
const srb_flag_t srb_flag,
|
||||
const rb_id_t rb_id,
|
||||
const mui_t mui,
|
||||
const confirm_t confirm,
|
||||
const sdu_size_t sdu_buffer_size,
|
||||
unsigned char *const sdu_buffer,
|
||||
const pdcp_transmission_mode_t pt_mode,
|
||||
const uint32_t *sourceL2Id,
|
||||
const uint32_t *destinationL2Id
|
||||
);
|
||||
|
||||
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr);
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file sdap_gNB.c
|
||||
* \brief sdap tasks for gNB
|
||||
* \author Konstantinos Alexandris <Konstantinos.Alexandris@eurecom.fr>, Cedric Roux <Cedric.Roux@eurecom.fr>, Navid Nikaein <Navid.Nikaein@eurecom.fr>
|
||||
* \date 2018
|
||||
* \version 1.0
|
||||
*/
|
||||
#define SDAP_GNB
|
||||
#define SDAP_GNB_C
|
||||
|
||||
Reference in New Issue
Block a user