sdap: pass sdap_config_t through E1 QoS-flow remap

E1 DRB-To-Modify already carries the new QFI list. The old
nr_sdap_entity_update_qos_flows() duplicated that as a bare qfi[] plus other params
while map_update expects a full sdap_config_t (add/release lists and per-DRB
role). Route the E1 path through one struct instead.

Changes:
- nr_sdap_entity_update_qos_flows(): take sdap_config_t *, caller fills the struct,
  function sets role and defaultDRB from qfi2drb_table, builds mappedQFIs2Release
  for QFIs dropped from the DRB, then calls qfi2drb_map_update()
- cucp_cuup_handler.c: build stack sdap_config_t from E1 qosFlows[] and call
  the new API

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
This commit is contained in:
Guido Casati
2026-06-29 17:22:33 +02:00
parent 1edb0a09bb
commit 96dc20010e
3 changed files with 30 additions and 36 deletions

View File

@@ -427,9 +427,15 @@ void e1_bearer_context_modif(const e1ap_bearer_mod_req_t *req)
DevAssert(to_modif->numQosFlowsMod <= E1AP_MAX_NUM_QOS_FLOWS);
modified->numQosFlowSetup = to_modif->numQosFlowsMod;
uint8_t qfi_list[E1AP_MAX_NUM_QOS_FLOWS];
sdap_config_t sdap = {
.pdusession_id = req_pdu_mod->sessionId,
.drb_id = to_modif->id,
.mappedQFIs2AddCount = to_modif->numQosFlowsMod,
};
for (int q = 0; q < to_modif->numQosFlowsMod; q++) {
modified->qosFlows[q].qfi = qfi_list[q] = to_modif->qosFlows[q].qfi;
sdap.mappedQFIs2Add[q] = to_modif->qosFlows[q].qfi;
modified->qosFlows[q].qfi = to_modif->qosFlows[q].qfi;
}
LOG_D(NR_RRC,
@@ -438,11 +444,7 @@ void e1_bearer_context_modif(const e1ap_bearer_mod_req_t *req)
req_pdu_mod->sessionId,
to_modif->id,
to_modif->numQosFlowsMod);
nr_sdap_entity_update_qos_flows(req->gNB_cu_up_ue_id,
req_pdu_mod->sessionId,
to_modif->id,
qfi_list,
to_modif->numQosFlowsMod);
nr_sdap_entity_update_qos_flows(req->gNB_cu_up_ue_id, &sdap);
}
if (to_modif->pdcp_config && to_modif->pdcp_config->pDCP_Reestablishment) {

View File

@@ -681,54 +681,46 @@ void nr_sdap_release_drb(ue_id_t ue_id, int drb_id, int pdusession_id)
* On E1 Bearer Context Modification (CP to UP), Flow Mapping Information in DRB To Modify
* carries the QoS Flow QoS Parameters List for that DRB. Per TS 38.463, when present the
* CU-UP replaces the previous mapping for that DRB.
* Remove every QFI currently mapped to the DRB that is absent from the list of QFIs to be mapped.
* @param qfis[] list of QFIs to be mapped to the DRB
* @param n_qfis number of QFIs in the list
* @param drb_id the DRB ID to be mapped */
void nr_sdap_entity_update_qos_flows(ue_id_t ue_id, int pdusession_id, int drb_id, const uint8_t *qfis, int n_qfis)
* @param sdap mapped QoS flows to add */
void nr_sdap_entity_update_qos_flows(ue_id_t ue_id, sdap_config_t *sdap)
{
nr_sdap_entity_t *entity = nr_sdap_get_entity(ue_id, pdusession_id);
DevAssert(sdap);
nr_sdap_entity_t *entity = nr_sdap_get_entity(ue_id, sdap->pdusession_id);
if (!entity) {
LOG_W(SDAP, "gNB SDAP: no entity for UE %lu PDU session %d when updating QoS flows for DRB %d\n", ue_id, pdusession_id, drb_id);
LOG_W(SDAP, "No entity when updating QoS flows for DRB %d (pdu_session=%d)\n", sdap->drb_id, sdap->pdusession_id);
return;
}
const qfi2drb_t *drb_map = nr_sdap_drb_lookup(entity, drb_id);
const qfi2drb_t *drb_map = nr_sdap_drb_lookup(entity, sdap->drb_id);
if (!drb_map) {
LOG_W(SDAP, "DRB %d: no qfi2drb_table entry, skip QoS-flow mapping update (pdu_session=%d)\n", drb_id, pdusession_id);
LOG_E(SDAP, "DRB %d: no qfi2drb_table entry, skip QoS-flow mapping update (pdu_session=%d)\n", sdap->drb_id, sdap->pdusession_id);
return;
}
sdap_config_t sdap = {.pdusession_id = pdusession_id,
.drb_id = drb_id,
.role = drb_map->entity_role,
.defaultDRB = (entity->default_drb.drb_id == drb_id),
.mappedQFIs2AddCount = n_qfis};
/* TS 38.331: sdap-HeaderUL/DL cannot change after DRB establishment */
sdap->role = drb_map->entity_role;
sdap->defaultDRB = (entity->default_drb.drb_id == sdap->drb_id);
/* Build list of QFIs to be released */
/* TS 37.324 clause 5.3.1 mappedQoS-FlowsToRelease: QFIs on this DRB not in the new list */
for (int q = 0; q < SDAP_MAX_QFI; q++) {
if (entity->qfi2drb_table[q].drb_id != drb_id)
if (entity->qfi2drb_table[q].drb_id != sdap->drb_id)
continue;
bool keep = false;
for (int i = 0; i < n_qfis; i++) {
if (qfis[i] == q) {
for (int i = 0; i < sdap->mappedQFIs2AddCount; i++) {
if (sdap->mappedQFIs2Add[i] == q) {
keep = true;
break;
}
}
if (!keep) {
DevAssert(sdap.mappedQFIs2ReleaseCount < SDAP_MAX_QFI);
sdap.mappedQFIs2Release[sdap.mappedQFIs2ReleaseCount++] = q;
LOG_I(SDAP, "gNB SDAP mapping update: UE %lu pduSession %d DRB %d release_qfi=%d\n", ue_id, pdusession_id, drb_id, q);
DevAssert(sdap->mappedQFIs2ReleaseCount < SDAP_MAX_QFI);
sdap->mappedQFIs2Release[sdap->mappedQFIs2ReleaseCount++] = q;
LOG_I(SDAP, "Update: release QFI %d from DRB %d (pdu_session=%d)\n", q, sdap->drb_id, sdap->pdusession_id);
}
}
/* Build list of QFIs to be added */
for (int i = 0; i < n_qfis; i++)
sdap.mappedQFIs2Add[i] = qfis[i];
LOG_I(SDAP, "gNB SDAP mapping update: UE %lu pduSession %d DRB %d n_qfis=%d\n", ue_id, pdusession_id, drb_id, n_qfis);
entity->qfi2drb_map_update(entity, &sdap);
LOG_I(SDAP, "Update: add %d QFIs to DRB %d (pdu_session=%d)\n", sdap->mappedQFIs2AddCount, sdap->drb_id, sdap->pdusession_id);
/* TS 37.324 clause 5.3.1: mappedQoS-FlowsToAdd and apply mapping on the DRB */
entity->qfi2drb_map_update(entity, sdap);
}
bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id)

View File

@@ -180,7 +180,7 @@ bool nr_sdap_delete_ue_entities(ue_id_t ue_id);
*/
void nr_reconfigure_sdap_entity(NR_SDAP_Config_t *sdap_config, ue_id_t ue_id, int pdusession_id, int drb_id);
void nr_sdap_entity_update_qos_flows(ue_id_t ue_id, int pdusession_id, int drb_id, const uint8_t *qfis, int n_qfis);
void nr_sdap_entity_update_qos_flows(ue_id_t ue_id, sdap_config_t *sdap);
void set_qfi(uint8_t qfi, uint8_t pduid, ue_id_t ue_id);
#endif