Commit cf30f61e authored by athanassopoulos's avatar athanassopoulos

Changes to SDAP code

1. Removed SDAP struct from protocol context.
2. Added configuration for the SDAP.
3. SDAP doesn't use pdcp_entities, the values come from function arguements.
4. Make nr_pdcp_ue_manager accessible from SDAP.
5. Avoid using the PDCP locking mechanism in SDAP.
6. Removed nr_pdcp_find_entity_sdap function.
7. Rename dummy eNB function to make GTP compile (no SDAP).
8. Fix: Regression issues with LTE
9. Fix: Regression issues with NR CU/DU
parent 30f14c7e
...@@ -234,19 +234,11 @@ typedef uint8_t pdusessionid_t; ...@@ -234,19 +234,11 @@ typedef uint8_t pdusessionid_t;
// may be ITTI not enabled, but type instance is useful also for OTG, // may be ITTI not enabled, but type instance is useful also for OTG,
typedef intptr_t instance_t; typedef intptr_t instance_t;
typedef struct sdap_protocol_ctxt_s {
boolean_t rqi;
uint8_t qfi;
boolean_t dc;
int pdusession_id;
} sdap_protocol_ctxt_t;
typedef struct protocol_ctxt_s { typedef struct protocol_ctxt_s {
module_id_t module_id; /*!< \brief Virtualized module identifier */ module_id_t module_id; /*!< \brief Virtualized module identifier */
eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */
instance_t instance; /*!< \brief ITTI or OTG module identifier */ instance_t instance; /*!< \brief ITTI or OTG module identifier */
rnti_t rnti; rnti_t rnti;
sdap_protocol_ctxt_t sdap;
frame_t frame; /*!< \brief LTE frame number.*/ frame_t frame; /*!< \brief LTE frame number.*/
sub_frame_t subframe; /*!< \brief LTE sub frame number.*/ sub_frame_t subframe; /*!< \brief LTE sub frame number.*/
eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */ eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */
......
...@@ -427,6 +427,7 @@ typedef struct NRRrcConfigurationReq_s { ...@@ -427,6 +427,7 @@ typedef struct NRRrcConfigurationReq_s {
bool force_256qam_off; bool force_256qam_off;
int pusch_TargetSNRx10; int pusch_TargetSNRx10;
int pucch_TargetSNRx10; int pucch_TargetSNRx10;
bool enable_sdap;
} gNB_RrcConfigurationReq; } gNB_RrcConfigurationReq;
typedef struct NRDuDlReq_s { typedef struct NRDuDlReq_s {
......
...@@ -32,7 +32,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, ...@@ -32,7 +32,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
abort(); abort();
} }
boolean_t sdap_gnb_data(protocol_ctxt_t *ctxt_p, boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
const srb_flag_t srb_flag, const srb_flag_t srb_flag,
const rb_id_t rb_id, const rb_id_t rb_id,
const mui_t mui, const mui_t mui,
...@@ -41,6 +41,9 @@ boolean_t sdap_gnb_data(protocol_ctxt_t *ctxt_p, ...@@ -41,6 +41,9 @@ boolean_t sdap_gnb_data(protocol_ctxt_t *ctxt_p,
unsigned char *const sdu_buffer, unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode, const pdcp_transmission_mode_t pt_mode,
const uint32_t *sourceL2Id, const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id) { const uint32_t *destinationL2Id,
const uint8_t qfi,
const boolean_t rqi,
const int pdusession_id) {
abort(); abort();
} }
...@@ -1192,7 +1192,9 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -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"); 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).scc = scc;
NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; 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++) }//End for (k=0; k <num_gnbs ; k++)
memcpy(&rrc->configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p))); memcpy(&rrc->configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p)));
......
...@@ -125,7 +125,8 @@ typedef enum { ...@@ -125,7 +125,8 @@ typedef enum {
#define GNB_CONFIG_STRING_MINRXTXTIME "min_rxtxtime" #define GNB_CONFIG_STRING_MINRXTXTIME "min_rxtxtime"
#define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist" #define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist"
#define GNB_CONFIG_STRING_FORCE256QAMOFF "force_256qam_off" #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" #define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support"
...@@ -159,7 +160,8 @@ typedef enum { ...@@ -159,7 +160,8 @@ typedef enum {
{GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ {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_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_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 #define GNB_GNB_ID_IDX 0
...@@ -188,6 +190,7 @@ typedef enum { ...@@ -188,6 +190,7 @@ typedef enum {
#define GNB_MINRXTXTIME_IDX 23 #define GNB_MINRXTXTIME_IDX 23
#define GNB_ULPRBBLACKLIST_IDX 24 #define GNB_ULPRBBLACKLIST_IDX 24
#define GNB_FORCE256QAMOFF_IDX 25 #define GNB_FORCE256QAMOFF_IDX 25
#define GNB_ENABLE_SDAP_IDX 26
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
#define GNBPARAMS_CHECK { \ #define GNBPARAMS_CHECK { \
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include <openair3/ocp-gtpu/gtp_itf.h> #include <openair3/ocp-gtpu/gtp_itf.h>
#include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "openair2/SDAP/nr_sdap/nr_sdap.h"
#include "nr_pdcp_oai_api.h"
#define TODO do { \ #define TODO do { \
printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \ printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \
...@@ -439,13 +438,13 @@ static void *enb_tun_read_thread(void *_) ...@@ -439,13 +438,13 @@ static void *enb_tun_read_thread(void *_)
ctxt.rnti = rnti; ctxt.rnti = rnti;
ctxt.sdap.qfi = 7; uint8_t qfi = 7;
ctxt.sdap.rqi = 0; boolean_t rqi = 0;
ctxt.sdap.pdusession_id = 10; int pdusession_id = 10;
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, 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; return NULL;
...@@ -486,13 +485,13 @@ static void *ue_tun_read_thread(void *_) ...@@ -486,13 +485,13 @@ static void *ue_tun_read_thread(void *_)
ctxt.rnti = rnti; ctxt.rnti = rnti;
ctxt.sdap.dc = SDAP_HDR_UL_DATA_PDU; boolean_t dc = SDAP_HDR_UL_DATA_PDU;
ctxt.sdap.qfi = 7; uint8_t qfi = 7;
ctxt.sdap.pdusession_id = 10; int pdusession_id = 10;
sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, 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; return NULL;
...@@ -622,7 +621,14 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -622,7 +621,14 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) { if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) {
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE rnti: %d\n", size, ue->rnti); 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, ue->rnti, buf, size); sdap_data_ind(entity->rb_id,
entity->is_gnb,
entity->has_sdap,
entity->has_sdapULheader,
entity->pdusession_id,
ue->rnti,
buf,
size);
} }
else{ else{
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
...@@ -639,7 +645,14 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -639,7 +645,14 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
rb_found: rb_found:
{ {
LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size); LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size);
sdap_data_ind(entity, ue->rnti, buf, 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);
} }
} }
} }
...@@ -950,9 +963,9 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -950,9 +963,9 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
exit(-1); exit(-1);
} }
pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session; 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_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_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; 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]; mappedQFIs2Add = (NR_QFI_t*)s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.array[0];
mappedQFIs2AddCount = s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.count; mappedQFIs2AddCount = s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.count;
...@@ -989,7 +1002,8 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -989,7 +1002,8 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
new_nr_sdap_entity(rnti, new_nr_sdap_entity(has_sdap,
rnti,
pdusession_id, pdusession_id,
is_sdap_DefaultDRB, is_sdap_DefaultDRB,
drb_id, drb_id,
...@@ -1438,11 +1452,9 @@ void nr_pdcp_tick(int frame, int subframe) ...@@ -1438,11 +1452,9 @@ void nr_pdcp_tick(int frame, int subframe)
} }
} }
nr_pdcp_entity_t *nr_pdcp_find_entity_sdap(int rnti, uint8_t sdap_drb_id){ /*
nr_pdcp_ue_t *ue; * For the SDAP API
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); */
if(ue->drb[sdap_drb_id-1]) nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(){
return ue->drb[sdap_drb_id-1]; return nr_pdcp_ue_manager;
return NULL;
} }
#include "openair2/COMMON/platform_types.h"
nr_pdcp_entity_t *nr_pdcp_find_entity_sdap(int rnti, uint8_t sdap_drb_id);
...@@ -868,8 +868,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -868,8 +868,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t)); sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
memset(sdap_config, 0, 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->pdu_Session = ue_context_pP->ue_context.pduSession[i].param.pdusession_id;
sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_present; if (rrc->configuration.enable_sdap) {
sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present; 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->defaultDRB = TRUE;
sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); 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)); memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd));
......
...@@ -30,12 +30,15 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p, ...@@ -30,12 +30,15 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
unsigned char *const sdu_buffer, unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode, const pdcp_transmission_mode_t pt_mode,
const uint32_t *sourceL2Id, const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id) { const uint32_t *destinationL2Id,
const uint8_t qfi,
const boolean_t rqi,
const int pdusession_id) {
nr_sdap_entity_t *sdap_entity; nr_sdap_entity_t *sdap_entity;
sdap_entity = nr_sdap_get_entity(ctxt_p->rnti, ctxt_p->sdap.pdusession_id); sdap_entity = nr_sdap_get_entity(ctxt_p->rnti, pdusession_id);
if(sdap_entity == NULL) { 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, ctxt_p->sdap.pdusession_id); 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; return 0;
} }
...@@ -49,16 +52,22 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p, ...@@ -49,16 +52,22 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
sdu_buffer, sdu_buffer,
pt_mode, pt_mode,
sourceL2Id, sourceL2Id,
destinationL2Id); destinationL2Id,
qfi,
rqi);
return ret; return ret;
} }
void sdap_data_ind(nr_pdcp_entity_t *pdcp_entity, void sdap_data_ind(rb_id_t pdcp_entity,
int is_gnb,
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti, int rnti,
char *buf, char *buf,
int size) { int size) {
nr_sdap_entity_t *sdap_entity; nr_sdap_entity_t *sdap_entity;
sdap_entity = nr_sdap_get_entity(rnti, pdcp_entity->pdusession_id); sdap_entity = nr_sdap_get_entity(rnti, pdusession_id);
if(sdap_entity == NULL) { if(sdap_entity == NULL) {
LOG_E(SDAP, "%s:%d:%s: Entity not found\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(SDAP, "%s:%d:%s: Entity not found\n", __FILE__, __LINE__, __FUNCTION__);
...@@ -67,6 +76,10 @@ void sdap_data_ind(nr_pdcp_entity_t *pdcp_entity, ...@@ -67,6 +76,10 @@ void sdap_data_ind(nr_pdcp_entity_t *pdcp_entity,
sdap_entity->rx_entity(sdap_entity, sdap_entity->rx_entity(sdap_entity,
pdcp_entity, pdcp_entity,
is_gnb,
has_sdap,
has_sdapULheader,
pdusession_id,
rnti, rnti,
buf, buf,
size); size);
......
...@@ -41,7 +41,10 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p, ...@@ -41,7 +41,10 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
unsigned char *const sdu_buffer, unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode, const pdcp_transmission_mode_t pt_mode,
const uint32_t *sourceL2Id, const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id const uint32_t *destinationL2Id,
const uint8_t qfi,
const boolean_t rqi,
const int pdusession_id
); );
/* /*
...@@ -50,7 +53,11 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p, ...@@ -50,7 +53,11 @@ boolean_t sdap_data_req(protocol_ctxt_t *ctxt_p,
* Uplink - gNB * Uplink - gNB
* Downlink - nrUE * Downlink - nrUE
*/ */
void sdap_data_ind(nr_pdcp_entity_t *pdcp_entity, void sdap_data_ind(rb_id_t pdcp_entity,
int is_gnb,
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti, int rnti,
char *buf, char *buf,
int size int size
......
This diff is collapsed.
...@@ -62,19 +62,26 @@ typedef struct nr_sdap_ul_hdr_s { ...@@ -62,19 +62,26 @@ typedef struct nr_sdap_ul_hdr_s {
uint8_t DC:1; uint8_t DC:1;
} __attribute__((packed)) nr_sdap_ul_hdr_t; } __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 { typedef struct nr_sdap_entity_s {
uint16_t rnti; uint16_t rnti;
nr_pdcp_entity_t *default_drb; rb_id_t default_drb;
int pdusession_id; int pdusession_id;
nr_pdcp_entity_t *qfi2drb_table[SDAP_MAX_QFI]; qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];
void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, uint8_t qfi, uint8_t drb); 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); void (*qfi2drb_map_delete)(struct nr_sdap_entity_s *entity, uint8_t qfi);
nr_pdcp_entity_t *(*qfi2drb_map)(struct nr_sdap_entity_s *entity, uint8_t qfi, long upper_layer_rb_id); 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); nr_sdap_ul_hdr_t (*sdap_construct_ctrl_pdu)(uint8_t qfi);
nr_pdcp_entity_t *(*sdap_map_ctrl_pdu)(struct nr_sdap_entity_s *entity, nr_pdcp_entity_t *pdcp_entity, int map_type, uint8_t dl_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, nr_pdcp_entity_t *sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); 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, boolean_t (*tx_entity)(struct nr_sdap_entity_s *entity,
...@@ -87,10 +94,17 @@ typedef struct nr_sdap_entity_s { ...@@ -87,10 +94,17 @@ typedef struct nr_sdap_entity_s {
unsigned char *const sdu_buffer, unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode, const pdcp_transmission_mode_t pt_mode,
const uint32_t *sourceL2Id, const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id); const uint32_t *destinationL2Id,
const uint8_t qfi,
const boolean_t rqi
);
void (*rx_entity)(struct nr_sdap_entity_s *entity, void (*rx_entity)(struct nr_sdap_entity_s *entity,
nr_pdcp_entity_t *pdcp_entity, rb_id_t pdcp_entity,
int is_gnb,
int has_sdap,
int has_sdapULheader,
int pdusession_id,
int rnti, int rnti,
char *buf, char *buf,
int size); int size);
...@@ -100,7 +114,7 @@ typedef struct nr_sdap_entity_s { ...@@ -100,7 +114,7 @@ typedef struct nr_sdap_entity_s {
} nr_sdap_entity_t; } nr_sdap_entity_t;
/* QFI to DRB Mapping Related Function */ /* QFI to DRB Mapping Related Function */
void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, uint8_t drb); 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 */ /* QFI to DRB Mapping Related Function */
void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi); void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi);
...@@ -114,7 +128,7 @@ void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi); ...@@ -114,7 +128,7 @@ void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi);
* 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 * 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. * else, map the SDAP SDU to the DRB according to the stored QoS flow to DRB mapping rule.
*/ */
nr_pdcp_entity_t *nr_sdap_qfi2drb_map(nr_sdap_entity_t *entity, uint8_t qfi, long upper_layer_rb_id); 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 * TS 37.324 5.3 QoS flow to DRB Mapping
...@@ -128,20 +142,20 @@ nr_sdap_ul_hdr_t nr_sdap_construct_ctrl_pdu(uint8_t qfi); ...@@ -128,20 +142,20 @@ nr_sdap_ul_hdr_t nr_sdap_construct_ctrl_pdu(uint8_t qfi);
* 1.) default DRB or * 1.) default DRB or
* 2.) DRB according to the stored QoS flow to DRB mapping rule * 2.) DRB according to the stored QoS flow to DRB mapping rule
*/ */
nr_pdcp_entity_t *nr_sdap_map_ctrl_pdu(nr_sdap_entity_t *entity, nr_pdcp_entity_t *pdcp_entity, int map_type, uint8_t dl_qfi); 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 * TS 37.324 5.3 QoS flow to DRB Mapping
* Submit the end-marker control PDU to the lower layer. * Submit the end-marker control PDU to the lower layer.
*/ */
void nr_sdap_submit_ctrl_pdu(int rnti, nr_pdcp_entity_t *sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); 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 * TS 37.324 5.3 QoS flow to DRB Mapping
* 5.3.1 Configuration Procedures * 5.3.1 Configuration Procedures
*/ */
void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity,
nr_pdcp_entity_t *pdcp_entity, rb_id_t pdcp_entity,
uint16_t rnti, uint16_t rnti,
NR_QFI_t *mapped_qfi_2_add, NR_QFI_t *mapped_qfi_2_add,
uint8_t mappedQFIs2AddCount, uint8_t mappedQFIs2AddCount,
...@@ -151,7 +165,8 @@ void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, ...@@ -151,7 +165,8 @@ void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity,
* TS 37.324 4.4 5.1.1 SDAP entity establishment * TS 37.324 4.4 5.1.1 SDAP entity establishment
* Establish an SDAP entity. * Establish an SDAP entity.
*/ */
nr_sdap_entity_t *new_nr_sdap_entity(uint16_t rnti, nr_sdap_entity_t *new_nr_sdap_entity(int has_sdap,
uint16_t rnti,
int pdusession_id, int pdusession_id,
boolean_t is_defaultDRB, boolean_t is_defaultDRB,
uint8_t default_DRB, uint8_t default_DRB,
......
...@@ -20,6 +20,8 @@ extern "C" { ...@@ -20,6 +20,8 @@ extern "C" {
#include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "openair2/SDAP/nr_sdap/nr_sdap.h"
//#include <openair1/PHY/phy_extern.h> //#include <openair1/PHY/phy_extern.h>
static boolean_t is_gnb = false;
#pragma pack(1) #pragma pack(1)
typedef struct Gtpv1uMsgHeader { typedef struct Gtpv1uMsgHeader {
...@@ -92,6 +94,7 @@ typedef struct { ...@@ -92,6 +94,7 @@ typedef struct {
rnti_t rnti; rnti_t rnti;
ebi_t incoming_rb_id; ebi_t incoming_rb_id;
gtpCallback callBack; gtpCallback callBack;
gtpCallbackSDAP callBackSDAP;
int pdusession_id; int pdusession_id;
} rntiData_t; } rntiData_t;
...@@ -476,6 +479,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer ...@@ -476,6 +479,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer
inst->te2ue_mapping[incoming_teid].incoming_rb_id= incoming_bearer_id; inst->te2ue_mapping[incoming_teid].incoming_rb_id= incoming_bearer_id;
inst->te2ue_mapping[incoming_teid].callBack=callBack; inst->te2ue_mapping[incoming_teid].callBack=callBack;
inst->te2ue_mapping[incoming_teid].callBackSDAP = sdap_data_req;
inst->te2ue_mapping[incoming_teid].pdusession_id = (uint8_t)outgoing_bearer_id; inst->te2ue_mapping[incoming_teid].pdusession_id = (uint8_t)outgoing_bearer_id;
...@@ -597,14 +602,14 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, ...@@ -597,14 +602,14 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
create_tunnel_req->num_tunnels, create_tunnel_req->num_tunnels,
create_tunnel_req->outgoing_teid[0]); create_tunnel_req->outgoing_teid[0]);
tcp_udp_port_t dstport=globGtp.instances[compatInst(instance)].get_dstport(); tcp_udp_port_t dstport=globGtp.instances[compatInst(instance)].get_dstport();
is_gnb = true;
for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { for (int i = 0; i < create_tunnel_req->num_tunnels; i++) {
teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti,
create_tunnel_req->incoming_rb_id[i], create_tunnel_req->incoming_rb_id[i],
create_tunnel_req->pdusession_id[i], create_tunnel_req->pdusession_id[i],
create_tunnel_req->outgoing_teid[i], create_tunnel_req->outgoing_teid[i],
create_tunnel_req->dst_addr[i], dstport, create_tunnel_req->dst_addr[i], dstport,
sdap_data_req); pdcp_data_req);
create_tunnel_resp->status=0; create_tunnel_resp->status=0;
create_tunnel_resp->rnti=create_tunnel_req->rnti; create_tunnel_resp->rnti=create_tunnel_req->rnti;
create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels;
...@@ -876,9 +881,6 @@ static int Gtpv1uHandleGpdu(int h, ...@@ -876,9 +881,6 @@ static int Gtpv1uHandleGpdu(int h,
ctxt.enb_flag = 1; ctxt.enb_flag = 1;
ctxt.instance = inst->addr.originInstance; ctxt.instance = inst->addr.originInstance;
ctxt.rnti = tunnel->second.rnti; ctxt.rnti = tunnel->second.rnti;
ctxt.sdap.qfi = qfi;
ctxt.sdap.rqi = rqi;
ctxt.sdap.pdusession_id = tunnel->second.pdusession_id;
ctxt.frame = 0; ctxt.frame = 0;
ctxt.subframe = 0; ctxt.subframe = 0;
ctxt.eNB_index = 0; ctxt.eNB_index = 0;
...@@ -894,17 +896,34 @@ static int Gtpv1uHandleGpdu(int h, ...@@ -894,17 +896,34 @@ static int Gtpv1uHandleGpdu(int h,
const uint32_t destinationL2Id=0; const uint32_t destinationL2Id=0;
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
if ( !tunnel->second.callBack(&ctxt, if(is_gnb && qfi){
srb_flag, if ( !tunnel->second.callBackSDAP(&ctxt,
rb_id, srb_flag,
mui, rb_id,
confirm, mui,
sdu_buffer_size, confirm,
sdu_buffer, sdu_buffer_size,
mode, sdu_buffer,
&sourceL2Id, mode,
&destinationL2Id) ) &sourceL2Id,
LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); &destinationL2Id,
qfi,
rqi,
tunnel->second.pdusession_id) )
LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h);
} else {
if ( !tunnel->second.callBack(&ctxt,
srb_flag,
rb_id,
mui,
confirm,
sdu_buffer_size,
sdu_buffer,
mode,
&sourceL2Id,
&destinationL2Id) )
LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h);
}
LOG_D(GTPU,"[%d] Received a %d bytes packet for: teid:%x\n", h, LOG_D(GTPU,"[%d] Received a %d bytes packet for: teid:%x\n", h,
msgBufLen-offset, msgBufLen-offset,
......
...@@ -20,6 +20,21 @@ typedef boolean_t (*gtpCallback)( ...@@ -20,6 +20,21 @@ typedef boolean_t (*gtpCallback)(
const uint32_t *sourceL2Id, const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id); const uint32_t *destinationL2Id);
typedef boolean_t (*gtpCallbackSDAP)(
protocol_ctxt_t *ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP,
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP,
const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id,
const uint8_t qfi,
const boolean_t rqi,
const int pdusession_id);
typedef struct openAddr_s { typedef struct openAddr_s {
char originHost[HOST_NAME_MAX]; char originHost[HOST_NAME_MAX];
char originService[HOST_NAME_MAX]; char originService[HOST_NAME_MAX];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment