Commit ec60fd81 authored by Robert Schmidt's avatar Robert Schmidt

E1 bearer modification: harmonize code

parent 380151fa
......@@ -109,6 +109,7 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB
}
void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) { abort(); }
void e1_bearer_context_modif(const e1ap_bearer_setup_req_t *req) { abort(); }
int8_t nr_rrc_RA_succeeded(const module_id_t mod_id, const uint8_t gNB_index) {
return 0;
......
......@@ -105,6 +105,7 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB
}
void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) { abort(); }
void e1_bearer_context_modif(const e1ap_bearer_setup_req_t *req) { abort(); }
int8_t nr_rrc_RA_succeeded(const module_id_t mod_id, const uint8_t gNB_index) {
return 0;
......
......@@ -33,4 +33,4 @@ MESSAGE_DEF(E1AP_BEARER_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED , e1ap_bearer_s
MESSAGE_DEF(E1AP_BEARER_CONTEXT_SETUP_RESP , MESSAGE_PRIORITY_MED , e1ap_bearer_setup_resp_t , e1ap_bearer_setup_resp)
MESSAGE_DEF(E1AP_BEARER_CONTEXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED , e1ap_bearer_setup_req_t , e1ap_bearer_mod_req)
MESSAGE_DEF(E1AP_BEARER_CONTEXT_MODIFICATION_RESP, MESSAGE_PRIORITY_MED, e1ap_bearer_modif_resp_t, e1ap_bearer_modif_resp)
......@@ -47,6 +47,7 @@
#define E1AP_BEARER_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_setup_req
#define E1AP_BEARER_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_setup_resp
#define E1AP_BEARER_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_setup_req
#define E1AP_BEARER_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_modif_resp
typedef f1ap_net_ip_address_t e1ap_net_ip_address_t;
......@@ -204,6 +205,10 @@ typedef struct DRB_nGRAN_setup_s {
qos_flow_setup_t qosFlows[E1AP_MAX_NUM_QOS_FLOWS];
} DRB_nGRAN_setup_t;
typedef struct DRB_nGRAN_modified_s {
long id;
} DRB_nGRAN_modified_t;
typedef struct DRB_nGRAN_failed_s {
long id;
long cause_type;
......@@ -220,6 +225,13 @@ typedef struct pdu_session_setup_s {
DRB_nGRAN_failed_t DRBnGRanFailedList[E1AP_MAX_NUM_NGRAN_DRB];
} pdu_session_setup_t;
typedef struct pdu_session_modif_s {
long id;
// setup as part of PDU session modification not supported yet
int numDRBModified;
DRB_nGRAN_modified_t DRBnGRanModList[E1AP_MAX_NUM_NGRAN_DRB];
} pdu_session_modif_t;
typedef struct e1ap_bearer_setup_resp_s {
uint32_t gNB_cu_cp_ue_id;
uint32_t gNB_cu_up_ue_id;
......@@ -227,4 +239,11 @@ typedef struct e1ap_bearer_setup_resp_s {
pdu_session_setup_t pduSession[E1AP_MAX_NUM_PDU_SESSIONS];
} e1ap_bearer_setup_resp_t;
typedef struct e1ap_bearer_modif_resp_s {
uint32_t gNB_cu_cp_ue_id;
uint32_t gNB_cu_up_ue_id;
int numPDUSessionsMod;
pdu_session_modif_t pduSessionMod[E1AP_MAX_NUM_PDU_SESSIONS];
} e1ap_bearer_modif_resp_t;
#endif /* E1AP_MESSAGES_TYPES_H */
......@@ -1283,7 +1283,8 @@ int e1apCUUP_handle_BEARER_CONTEXT_MODIFICATION_REQUEST(sctp_assoc_t assoc_id, e
e1ap_bearer_setup_req_t bearerCxt = {0};
extract_BEARER_CONTEXT_MODIFICATION_REQUEST(pdu, &bearerCxt);
CUUP_process_bearer_context_mod_req(e1_inst->instance, &bearerCxt);
e1_bearer_context_modif(&bearerCxt);
return 0;
}
......@@ -1778,6 +1779,14 @@ void *E1AP_CUUP_task(void *arg) {
e1apCUUP_send_BEARER_CONTEXT_SETUP_RESPONSE(inst->cuup.assoc_id, resp);
} break;
case E1AP_BEARER_CONTEXT_MODIFICATION_RESP: {
//const e1ap_bearer_modif_resp_t *resp = &E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg);
const e1ap_upcp_inst_t *inst = getCxtE1(myInstance);
AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance);
LOG_W(E1AP, "E1AP_BEARER_CONTEXT_MODIFICATION_RESP lost!\n");
//e1apCUUP_send_BEARER_CONTEXT_MODIFICATION_RESPONSE
} break;
default:
LOG_E(E1AP, "Unknown message received in TASK_CUUP_E1\n");
break;
......
......@@ -34,15 +34,6 @@
#include "e1ap_common.h"
#include "e1ap.h"
void CUUP_process_bearer_context_mod_req(instance_t instance, e1ap_bearer_setup_req_t *const req)
{
e1ap_upcp_inst_t *inst = getCxtE1(instance);
AssertFatal(inst, "");
// assume we receive modification of F1-U but it is wrong, we can also get modification of N3 when HO will occur
CU_update_UP_DL_tunnel(req, inst->gtpInstF1U, req->gNB_cu_cp_ue_id);
// TODO: send bearer cxt mod response
}
void CUUP_process_bearer_release_command(instance_t instance, e1ap_bearer_release_cmd_t *const cmd)
{
e1ap_upcp_inst_t *inst = getCxtE1(instance);
......
......@@ -28,7 +28,6 @@
#include "openair2/COMMON/e1ap_messages_types.h"
#include "openair2/E1AP/e1ap_common.h"
void cuup_init_n3(instance_t instance);
void CUUP_process_bearer_context_mod_req(instance_t, e1ap_bearer_setup_req_t *const req);
void CUUP_process_bearer_release_command(instance_t, e1ap_bearer_release_cmd_t *const cmd);
#endif
......@@ -219,3 +219,41 @@ void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req)
get_e1_if()->bearer_setup_response(&resp);
}
void e1_bearer_context_modif(const e1ap_bearer_setup_req_t *req)
{
AssertFatal(req->numPDUSessionsMod > 0, "need at least one PDU session to modify\n");
e1ap_bearer_modif_resp_t modif = {
.gNB_cu_cp_ue_id = req->gNB_cu_cp_ue_id,
.gNB_cu_up_ue_id = req->gNB_cu_up_ue_id,
.numPDUSessionsMod = req->numPDUSessionsMod,
};
instance_t f1inst = get_f1_gtp_instance();
for (int i=0; i < req->numPDUSessionsMod; i++) {
LOG_I(E1AP,
"UE %d: updating PDU session ID %ld (%ld bearers)\n",
req->gNB_cu_up_ue_id,
req->pduSessionMod[i].sessionId,
req->pduSessionMod[i].numDRB2Modify);
modif.pduSessionMod[i].id = req->pduSessionMod[i].sessionId;
modif.pduSessionMod[i].numDRBModified = req->pduSessionMod[i].numDRB2Modify;
for (int j=0; j < req->pduSessionMod[i].numDRB2Modify; j++) {
const DRB_nGRAN_to_setup_t *to_modif = &req->pduSessionMod[i].DRBnGRanModList[j];
DRB_nGRAN_modified_t *modified = &modif.pduSessionMod[i].DRBnGRanModList[j];
modified->id = to_modif->id;
if (f1inst < 0) // no F1-U?
continue; // nothing to do
in_addr_t addr = {0};
memcpy(&addr, &to_modif->DlUpParamList[0].tlAddress, sizeof(in_addr_t));
GtpuUpdateTunnelOutgoingAddressAndTeid(f1inst, req->gNB_cu_cp_ue_id, to_modif->id, addr, to_modif->DlUpParamList[0].teId);
}
}
get_e1_if()->bearer_modif_response(&modif);
}
......@@ -28,5 +28,6 @@ void nr_pdcp_e1_if_init(bool uses_e1);
struct e1ap_bearer_setup_req_s;
void e1_bearer_context_setup(const struct e1ap_bearer_setup_req_s *req);
void e1_bearer_context_modif(const struct e1ap_bearer_setup_req_s *req);
#endif /* CUCP_CUUP_HANDLER_H */
......@@ -31,7 +31,16 @@ static void bearer_setup_response_direct(const e1ap_bearer_setup_resp_t *resp)
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void bearer_modif_response_direct(const e1ap_bearer_modif_resp_t *resp)
{
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, E1AP_BEARER_CONTEXT_MODIFICATION_RESP);
e1ap_bearer_modif_resp_t *msg_resp = &E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg);
*msg_resp = *resp;
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
void cuup_cucp_init_direct(e1_if_t *iface)
{
iface->bearer_setup_response = bearer_setup_response_direct;
iface->bearer_modif_response = bearer_modif_response_direct;
}
......@@ -31,7 +31,16 @@ static void bearer_setup_response_e1ap(const e1ap_bearer_setup_resp_t *resp)
itti_send_msg_to_task (TASK_CUUP_E1, 0, msg_p);
}
static void bearer_modif_response_e1ap(const e1ap_bearer_modif_resp_t *resp)
{
MessageDef *msg_p = itti_alloc_new_message(TASK_CUUP_E1, 0, E1AP_BEARER_CONTEXT_MODIFICATION_RESP);
e1ap_bearer_modif_resp_t *modif_resp = &E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg_p);
*modif_resp = *resp;
itti_send_msg_to_task (TASK_CUUP_E1, 0, msg_p);
}
void cuup_cucp_init_e1ap(e1_if_t *iface)
{
iface->bearer_setup_response = bearer_setup_response_e1ap;
iface->bearer_modif_response = bearer_modif_response_e1ap;
}
......@@ -25,10 +25,13 @@
#include <stdbool.h>
struct e1ap_bearer_setup_resp_s;
struct e1ap_bearer_modif_resp_s;
typedef void (*e1_bearer_setup_response_func_t)(const struct e1ap_bearer_setup_resp_s *resp);
typedef void (*e1_bearer_modif_response_func_t)(const struct e1ap_bearer_modif_resp_s *resp);
typedef struct e1_if_t {
e1_bearer_setup_response_func_t bearer_setup_response;
e1_bearer_modif_response_func_t bearer_modif_response;
} e1_if_t;
e1_if_t *get_e1_if(void);
......
......@@ -19,28 +19,11 @@
* contact@openairinterface.org
*/
#include <arpa/inet.h>
#include "cucp_cuup_if.h"
#include "platform_types.h"
#include "nr_rrc_defs.h"
#include "softmodem-common.h"
#include "nr_rrc_proto.h"
#include "nr_rrc_extern.h"
#include "nr_rrc_defs.h"
#include "openair2/COMMON/e1ap_messages_types.h"
#include "openair3/SECU/key_nas_deriver.h"
#include "nr_pdcp/nr_pdcp_entity.h"
#include "openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include "openair3/ocp-gtpu/gtp_itf.h"
#include "rrc_gNB_GTPV1U.h"
#include "common/ran_context.h"
#include "openair2/F1AP/f1ap_common.h"
#include "openair2/E1AP/e1ap_common.h"
extern RAN_CONTEXT_t RC;
static void cucp_cuup_bearer_context_setup_direct(sctp_assoc_t assoc_id, const e1ap_bearer_setup_req_t *req)
{
......@@ -48,34 +31,13 @@ static void cucp_cuup_bearer_context_setup_direct(sctp_assoc_t assoc_id, const e
e1_bearer_context_setup(req);
}
void CU_update_UP_DL_tunnel(e1ap_bearer_setup_req_t *const req, instance_t instance, ue_id_t ue_id) {
for (int i=0; i < req->numPDUSessionsMod; i++) {
for (int j=0; j < req->pduSessionMod[i].numDRB2Modify; j++) {
DRB_nGRAN_to_setup_t *drb_p = req->pduSessionMod[i].DRBnGRanModList + j;
in_addr_t addr = {0};
memcpy(&addr, &drb_p->DlUpParamList[0].tlAddress, sizeof(in_addr_t));
GtpuUpdateTunnelOutgoingAddressAndTeid(instance,
(ue_id & 0xFFFF),
(ebi_t)drb_p->id,
addr,
drb_p->DlUpParamList[0].teId);
}
}
}
static void cucp_cuup_bearer_context_mod_direct(sctp_assoc_t assoc_id, e1ap_bearer_setup_req_t *const req)
static void cucp_cuup_bearer_context_modif_direct(sctp_assoc_t assoc_id, const e1ap_bearer_setup_req_t *req)
{
AssertFatal(assoc_id == -1, "illegal assoc_id %d, impossible for integrated CU\n", assoc_id);
// only update GTP tunnels if it is really a CU
if (!NODE_IS_CU(RC.nrrrc[0]->node_type))
return;
instance_t gtpInst = getCxt(0)->gtpInst;
CU_update_UP_DL_tunnel(req, gtpInst, req->gNB_cu_cp_ue_id);
e1_bearer_context_modif(req);
}
void cucp_cuup_message_transfer_direct_init(gNB_RRC_INST *rrc) {
rrc->cucp_cuup.bearer_context_setup = cucp_cuup_bearer_context_setup_direct;
rrc->cucp_cuup.bearer_context_mod = cucp_cuup_bearer_context_mod_direct;
rrc->cucp_cuup.bearer_context_mod = cucp_cuup_bearer_context_modif_direct;
}
......@@ -20,9 +20,6 @@
*/
#include "cucp_cuup_if.h"
#include <arpa/inet.h>
#include "platform_types.h"
#include "nr_rrc_defs.h"
#include "nr_rrc_proto.h"
......@@ -40,7 +37,7 @@ static void cucp_cuup_bearer_context_setup_e1ap(sctp_assoc_t assoc_id, const e1a
itti_send_msg_to_task (TASK_CUCP_E1, 0, msg_p);
}
static void cucp_cuup_bearer_context_mod_e1ap(sctp_assoc_t assoc_id, e1ap_bearer_setup_req_t *const req)
static void cucp_cuup_bearer_context_mod_e1ap(sctp_assoc_t assoc_id, const e1ap_bearer_setup_req_t *req)
{
AssertFatal(assoc_id > 0, "illegal assoc_id %d\n", assoc_id);
MessageDef *msg = itti_alloc_new_message(TASK_CUCP_E1, 0, E1AP_BEARER_CONTEXT_MODIFICATION_REQ);
......
......@@ -35,11 +35,5 @@ typedef void (*cucp_cuup_bearer_context_setup_func_t)(sctp_assoc_t assoc_id, con
struct gNB_RRC_INST_s;
void cucp_cuup_message_transfer_direct_init(struct gNB_RRC_INST_s *rrc);
void cucp_cuup_message_transfer_e1ap_init(struct gNB_RRC_INST_s *rrc);
void fill_e1ap_bearer_setup_resp(struct e1ap_bearer_setup_resp_s *resp,
struct e1ap_bearer_setup_req_s *const req,
instance_t gtpInst,
ue_id_t ue_id,
int remote_port,
in_addr_t my_addr);
void CU_update_UP_DL_tunnel(struct e1ap_bearer_setup_req_s *const req, instance_t instance, ue_id_t ue_id);
#endif
......@@ -2056,10 +2056,13 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i
if (resp->drbs_to_be_setup_length > 0) {
e1ap_bearer_setup_req_t req = {0};
// TODO: bug: we receive the DRBs, but we don't associate to a PDU session
// -> we are not sure which PDU session this is, and fill "all"
req.numPDUSessionsMod = UE->nb_of_pdusessions;
req.gNB_cu_cp_ue_id = UE->rrc_ue_id;
req.gNB_cu_up_ue_id = UE->rrc_ue_id;
for (int i = 0; i < req.numPDUSessionsMod; i++) {
req.pduSessionMod[i].sessionId = UE->pduSession[i].param.pdusession_id;
req.pduSessionMod[i].numDRB2Modify = resp->drbs_to_be_setup_length;
for (int j = 0; j < resp->drbs_to_be_setup_length; j++) {
f1ap_drb_to_be_setup_t *drb_f1 = resp->drbs_to_be_setup + j;
......@@ -2392,6 +2395,22 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
rrc->mac_rrc.ue_context_modification_request(&ue_context_modif_req);
}
void rrc_gNB_process_e1_bearer_context_modif_resp(const e1ap_bearer_modif_resp_t *resp)
{
gNB_RRC_INST *rrc = RC.nrrrc[0];
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(rrc, resp->gNB_cu_cp_ue_id);
if (ue_context_p == NULL) {
LOG_E(RRC, "no UE with CU-CP UE ID %d found\n", resp->gNB_cu_cp_ue_id);
return;
}
// there is not really anything to do here as of now
for (int i = 0; i < resp->numPDUSessionsMod; ++i) {
const pdu_session_modif_t *pdu = &resp->pduSessionMod[i];
LOG_I(RRC, "UE %d: PDU session ID %ld modified %d bearers\n", resp->gNB_cu_cp_ue_id, pdu->id, pdu->numDRBModified);
}
}
static void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, sctp_assoc_t assoc_id)
{
AssertFatal(rrc->du != NULL, "no DU connected, cannot received F1 lost connection\n");
......@@ -2671,6 +2690,10 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_e1_bearer_context_setup_resp(&E1AP_BEARER_CONTEXT_SETUP_RESP(msg_p), instance);
break;
case E1AP_BEARER_CONTEXT_MODIFICATION_RESP:
rrc_gNB_process_e1_bearer_context_modif_resp(&E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg_p));
break;
case NGAP_PAGING_IND:
rrc_gNB_process_PAGING_IND(msg_p, instance);
break;
......
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