Commit 1edb0a09 authored by Guido Casati's avatar Guido Casati

fix (sdap): select RX/TX SDAP headers on per-DRB RRC role

A DRB may have an uplink SDAP header but no downlink header (valid TS 38.331).
The old entity->enable_sdap flag was true if either direction had a header, so UE
downlink wrongly read byte 0 as QFI. IPv4 payloads start with 0x45 -> bogus QFI 5
and dropped traffic before the TUN (PR !158).

Header presence must follow TS 37.324 §5.2.1/§5.2.2 per DRB and direction, not a
single PDU-session-wide enable-sdap.

Also, store the default DRB as a `qfi2drb_t` mapping in the SDAP entity and use
it directly for fallback paths.

Changes:
- Add nr_sdap_drb_lookup() to return first qfi2drb_table row for a DRB
- nr_sdap_rx_entity(): parse QFI only when the receiving direction has a header,
  drop if the DRB has no table row
- nr_sdap_tx_entity(): UL/DL TX header bits from qfi2drb_map() (drb_id + entity_role),
  including default-DRB fallback
- nr_sdap_qfi2drb(): const qfi2drb_t *, remove SDAP_MAP_RULE_EMPTY
- nr_sdap_map_ctrl_pdu(): handle NULL from qfi2drb_map
- nr_sdap_qfi2drb_map_update(): sync entity_role on
  all QFIs for the DRB. At most one DRB when both headers absent.
- nr_sdap_entity_update_qos_flows(): keep per-DRB role from nr_sdap_drb_lookup(),
  skip update when DRB has no row
- Cleanup entity->enable_sdap
- nr_sdap.c: remove TUN-thread QFI drop, tx_entity owns unmappable-QFI handling
- replace default_drb with qfi2drb_t default_drb in SDAP entity and init
  default DRB id+role at SDAP entity creation

Refs:
- PR #158
- TS 37.324 §5.2.1, §5.2.2, §6.2.2.1
- TS 38.331 SDAP-Config (sdap-HeaderUL / sdap-HeaderDL)
Signed-off-by: default avatarGuido Casati <guido.casati@openairinterface.org>
parent 09c9bb99
...@@ -213,14 +213,6 @@ static void *sdap_tun_read_thread(void *arg) ...@@ -213,14 +213,6 @@ static void *sdap_tun_read_thread(void *arg)
LOG_D(SDAP, "read data of size %d\n", len); LOG_D(SDAP, "read data of size %d\n", len);
if (!entity->is_gnb && entity->enable_sdap && (entity->qfi < 0 || entity->qfi >= SDAP_MAX_QFI)) {
LOG_W(SDAP,
"Dropping UL SDU for UE %ld PDU session %d: no QoS rule QFI available for SDAP header\n",
entity->ue_id,
entity->pdusession_id);
continue;
}
protocol_ctxt_t ctxt = {.enb_flag = entity->is_gnb, .rntiMaybeUEid = entity->ue_id}; protocol_ctxt_t ctxt = {.enb_flag = entity->is_gnb, .rntiMaybeUEid = entity->ue_id};
bool dc = entity->is_gnb ? false : SDAP_HDR_UL_DATA_PDU; bool dc = entity->is_gnb ? false : SDAP_HDR_UL_DATA_PDU;
......
This diff is collapsed.
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#define SDAP_HDR_UL_CTRL_PDU (0) #define SDAP_HDR_UL_CTRL_PDU (0)
#define SDAP_HDR_LENGTH (1) #define SDAP_HDR_LENGTH (1)
#define SDAP_MAX_QFI (64) #define SDAP_MAX_QFI (64)
#define SDAP_MAP_RULE_EMPTY (0)
#define SDAP_NO_MAPPING_RULE (0) #define SDAP_NO_MAPPING_RULE (0)
#define SDAP_REFLECTIVE_MAPPING (1) #define SDAP_REFLECTIVE_MAPPING (1)
#define SDAP_RQI_HANDLING (1) #define SDAP_RQI_HANDLING (1)
...@@ -78,17 +77,16 @@ typedef struct sdap_configuration_s { ...@@ -78,17 +77,16 @@ typedef struct sdap_configuration_s {
typedef struct nr_sdap_entity_s { typedef struct nr_sdap_entity_s {
ue_id_t ue_id; ue_id_t ue_id;
int default_drb;
/// sdap_tun_read_thread needs to know if we are gNB/UE, so for noS1 mode, /// sdap_tun_read_thread needs to know if we are gNB/UE, so for noS1 mode,
/// store which one we are /// store which one we are
bool is_gnb; bool is_gnb;
bool enable_sdap;
int pdusession_id; int pdusession_id;
int pdusession_sock; int pdusession_sock;
pthread_t pdusession_thread; pthread_t pdusession_thread;
bool stop_thread; bool stop_thread;
int qfi; int qfi;
qfi2drb_t default_drb;
qfi2drb_t qfi2drb_table[SDAP_MAX_QFI]; qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];
void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, const sdap_config_t *sdap); void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, const sdap_config_t *sdap);
...@@ -97,7 +95,7 @@ typedef struct nr_sdap_entity_s { ...@@ -97,7 +95,7 @@ typedef struct nr_sdap_entity_s {
const uint8_t qfi, const uint8_t qfi,
const uint8_t drb_id, const uint8_t drb_id,
const uint8_t role); const uint8_t role);
int (*qfi2drb_map)(struct nr_sdap_entity_s *entity, uint8_t qfi); const qfi2drb_t *(*qfi2drb_map)(const struct nr_sdap_entity_s *entity, uint8_t qfi);
nr_sdap_ul_hdr_t (*sdap_construct_ctrl_pdu)(uint8_t qfi); nr_sdap_ul_hdr_t (*sdap_construct_ctrl_pdu)(uint8_t qfi);
int (*sdap_map_ctrl_pdu)(struct nr_sdap_entity_s *entity, int map_type, uint8_t dl_qfi); int (*sdap_map_ctrl_pdu)(struct nr_sdap_entity_s *entity, int map_type, uint8_t dl_qfi);
......
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