diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.c b/openair2/SDAP/nr_sdap/nr_sdap_entity.c index 389213986e..9056c6e733 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c @@ -210,15 +210,20 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, { /* The offset of the SDAP header, it might be 0 if has_sdap_rx is not true in the pdcp entity. */ int offset=0; - uint8_t qfi = buf[0] & 0x3F; // QFI is always the first 6 bits in the first octet - if (qfi >= SDAP_MAX_QFI) { - LOG_E(SDAP, "Invalid QFI %d received in SDAP header\n", qfi); - return; + bool sdap_ul_rx = false; + bool sdap_dl_rx = false; + /* If SDAP header is disabled for this entity, bypass header parsing */ + if (entity->enable_sdap) { + uint8_t qfi = buf[0] & 0x3F; // QFI is always the first 6 bits in the first octet + if (qfi >= SDAP_MAX_QFI) { + LOG_E(SDAP, "Invalid QFI %d received in SDAP header\n", qfi); + return; + } + // Fetch entity role from the qfi2drb_table + sdap_ul_rx = entity->qfi2drb_table[qfi].entity_role & SDAP_UL_RX; // gNB RX entity + sdap_dl_rx = entity->qfi2drb_table[qfi].entity_role & SDAP_DL_RX; // UE RX entity } - // Fetch entity role from the qfi2drb_table - bool sdap_ul_rx = entity->qfi2drb_table[qfi].entity_role & SDAP_UL_RX; // gNB RX entity - bool sdap_dl_rx = entity->qfi2drb_table[qfi].entity_role & SDAP_DL_RX; // UE RX entity if (is_gnb) { // gNB if (sdap_ul_rx) { // UL Data/Control PDU with SDAP header @@ -495,6 +500,7 @@ static void nr_sdap_add_entity(const int is_gnb, const ue_id_t ue_id, const sdap sdap_entity->ue_id = ue_id; sdap_entity->pdusession_id = sdap->pdusession_id; sdap_entity->is_gnb = is_gnb; + sdap_entity->enable_sdap = (sdap->role != NO_SDAP_HEADER); // rx/tx entities sdap_entity->tx_entity = nr_sdap_tx_entity; diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.h b/openair2/SDAP/nr_sdap/nr_sdap_entity.h index e96836ac79..9f85ac21cf 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h @@ -99,6 +99,7 @@ typedef struct nr_sdap_entity_s { /// sdap_tun_read_thread needs to know if we are gNB/UE, so for noS1 mode, /// store which one we are bool is_gnb; + bool enable_sdap; int pdusession_id; int pdusession_sock; pthread_t pdusession_thread;