RRC/E1AP: Fix SDAP header mapping in E1AP and test callback header handling

This commit fixes two related issues:

1. SDAP Header Mapping Bug (cucp_cuup_handler.c):
   The original code incorrectly mapped SDAP header configuration from
   internal E1AP representation to ASN.1 enum values. The internal
   representation (`bearer_context_sdap_config_t`) uses true=present/false=absent,
   while ASN.1 enum (`E1AP_SDAP_Configuration_t`) uses
   0=present/1=absent. The fix correctly inverts the mapping:
   - Internal true (1) → ASN.1 0 (present)
   - Internal false (0) → ASN.1 1 (absent)

The commit also clarifies internal representation in the stack.

2. Test Overhead Adjustment (nr-cuup-load-test.c):
   The change in (1) led to a failure in nr_cuup_functional_test
   with assertion: "size % 4 == 0" in recv_ng()

   - Changed UL packet overhead from 3 bytes to 2 bytes in sender_thread()
   - Before the SDAP fix, the test incorrectly accounted for 3 bytes:
     * 2 bytes PDCP header (correct)
     * 1 byte SDAP header (incorrectly included)
   - After the SDAP fix, SDAP headers are correctly set to absent, so
     only 2 bytes (PDCP header) are needed

   This ensures the test sends packets with the correct header size,
   matching what CU-UP expects after the SDAP configuration fix.

The load test does not enable SDAP headers, therefore the original 3-byte
overhead was possibly a workaround for the SDAP header bug.
With the bug fixed, the test correctly uses 2-byte overhead (PDCP header).
This commit is contained in:
Guido Casati
2026-02-09 13:19:02 +01:00
parent 53c0d2d306
commit 2923e50ed0
5 changed files with 18 additions and 13 deletions
@@ -192,8 +192,8 @@ static E1AP_SDAP_Configuration_t e1_encode_sdap_config(const bearer_context_sdap
{
E1AP_SDAP_Configuration_t out = {0};
out.defaultDRB = in->defaultDRB ? E1AP_DefaultDRB_true : E1AP_DefaultDRB_false;
out.sDAP_Header_UL = in->sDAP_Header_UL;
out.sDAP_Header_DL = in->sDAP_Header_DL;
out.sDAP_Header_UL = in->sDAP_Header_UL ? E1AP_SDAP_Header_UL_present : E1AP_SDAP_Header_UL_absent;
out.sDAP_Header_DL = in->sDAP_Header_DL ? E1AP_SDAP_Header_DL_present : E1AP_SDAP_Header_DL_absent;
return out;
}
@@ -201,8 +201,8 @@ static E1AP_SDAP_Configuration_t e1_encode_sdap_config(const bearer_context_sdap
static bool e1_decode_sdap_config(bearer_context_sdap_config_t *out, const E1AP_SDAP_Configuration_t *in)
{
out->defaultDRB = in->defaultDRB == E1AP_DefaultDRB_true;
out->sDAP_Header_UL = in->sDAP_Header_UL;
out->sDAP_Header_DL = in->sDAP_Header_DL;
out->sDAP_Header_UL = in->sDAP_Header_UL == E1AP_SDAP_Header_UL_present;
out->sDAP_Header_DL = in->sDAP_Header_DL == E1AP_SDAP_Header_DL_present;
return true;
}
@@ -212,8 +212,8 @@ static bool e1_decode_sdap_config(bearer_context_sdap_config_t *out, const E1AP_
static bool eq_sdap_config(const bearer_context_sdap_config_t *a, const bearer_context_sdap_config_t *b)
{
_E1_EQ_CHECK_LONG(a->defaultDRB, b->defaultDRB);
_E1_EQ_CHECK_LONG(a->sDAP_Header_UL, b->sDAP_Header_UL);
_E1_EQ_CHECK_LONG(a->sDAP_Header_DL, b->sDAP_Header_DL);
_E1_EQ_CHECK_INT(a->sDAP_Header_UL, b->sDAP_Header_UL);
_E1_EQ_CHECK_INT(a->sDAP_Header_DL, b->sDAP_Header_DL);
return true;
}