Commit d1fc95a8 authored by Robert Schmidt's avatar Robert Schmidt

GTP: when creating a tunnel, tell which functions to use

The GTP module is common for 4G and 5G. It hardcodes the functions to
call when creating S1U and NGU tunnels. The S1U case is both applicable
for LTE and NR (NSA), which until now was not a problem as the PDCP data
forwarding functions where called pdcp_data_req. The issue is that in this
branch, the NR PDCP functions have changed to nr_pdcp_data_req_drb().

When setting up a GTP tunnel, we now pass the PDCP data forwarding
functions into GTP, since the caller knows whether it is in 4G or 5G,
but GTP itself does not.
parent 6529d875
......@@ -112,9 +112,7 @@ static int drb_config_N3gtpu_create(e1ap_bearer_setup_req_t * const req,
create_tunnel_req.ue_id = (req->gNB_cu_cp_ue_id & 0xFFFF);
// Create N3 tunnel
int ret = gtpv1u_create_ngu_tunnel(instance,
&create_tunnel_req,
create_tunnel_resp);
int ret = gtpv1u_create_ngu_tunnel(instance, &create_tunnel_req, create_tunnel_resp, nr_pdcp_data_req_drb, sdap_data_req);
if (ret != 0) {
LOG_E(NR_RRC,"rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE id %ld\n",
create_tunnel_req.ue_id);
......
......@@ -921,10 +921,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above
// create_tunnel_req.num_tunnels = i;
ret = gtpv1u_create_s1u_tunnel(
instance,
&create_tunnel_req,
&create_tunnel_resp);
ret = gtpv1u_create_s1u_tunnel(instance, &create_tunnel_req, &create_tunnel_resp, pdcp_data_req);
if ( ret != 0 ) {
LOG_E(RRC,"rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ : gtpv1u_create_s1u_tunnel failed,start to release UE %x\n",ue_context_p->ue_context.rnti);
......@@ -1234,10 +1231,7 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above
create_tunnel_req.num_tunnels = e_rab_done;
// NN: not sure if we should create a new tunnel: need to check teid, etc.
ret = gtpv1u_create_s1u_tunnel(
instance,
&create_tunnel_req,
&create_tunnel_resp);
ret = gtpv1u_create_s1u_tunnel(instance, &create_tunnel_req, &create_tunnel_resp, pdcp_data_req);
if ( ret != 0 ) {
LOG_E(RRC,"rrc_eNB_process_S1AP_E_RAB_SETUP_REQ : gtpv1u_create_s1u_tunnel failed,start to release UE %x\n",ue_context_p->ue_context.rnti);
......@@ -1908,14 +1902,8 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP,
S1AP_PATH_SWITCH_REQ (msg_p).nb_of_e_rabs = e_rabs_done;
create_tunnel_req.rnti = ue_context_pP->ue_context.rnti;
create_tunnel_req.num_tunnels = e_rabs_done;
gtpv1u_create_s1u_tunnel(
ctxt_pP->instance,
&create_tunnel_req,
&create_tunnel_resp);
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
ctxt_pP,
&create_tunnel_resp,
&inde_list[0]);
gtpv1u_create_s1u_tunnel(ctxt_pP->instance, &create_tunnel_req, &create_tunnel_resp, pdcp_data_req);
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(ctxt_pP, &create_tunnel_resp, &inde_list[0]);
for (e_rab = 0; e_rab < e_rabs_done; e_rab++) {
S1AP_PATH_SWITCH_REQ (msg_p).e_rabs_tobeswitched[e_rab].e_rab_id = create_tunnel_resp.eps_bearer_id[e_rab];
......
......@@ -120,7 +120,11 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
}
create_tunnel_req.num_tunnels = UE->nb_of_pdusessions;
create_tunnel_req.ue_id = UE->rnti;
int ret = gtpv1u_create_ngu_tunnel(getCxtE1(instance)->gtpInstN3, &create_tunnel_req, &create_tunnel_resp);
int ret = gtpv1u_create_ngu_tunnel(getCxtE1(instance)->gtpInstN3,
&create_tunnel_req,
&create_tunnel_resp,
nr_pdcp_data_req_drb,
sdap_data_req);
if (ret != 0) {
LOG_E(NR_RRC,"rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE rnti %ld\n",
......
......@@ -38,6 +38,7 @@
#include "intertask_interface.h"
#include "nr_pdcp/nr_pdcp_oai_api.h"
#include "pdcp_primitives.h"
#include "SDAP/nr_sdap/nr_sdap.h"
#include "openair3/ocp-gtpu/gtp_itf.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
......@@ -391,7 +392,7 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t
}
create_tunnel_req.ue_id = UE->rnti;
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp = {0};
int ret = gtpv1u_create_ngu_tunnel(instance, &create_tunnel_req, &create_tunnel_resp);
int ret = gtpv1u_create_ngu_tunnel(instance, &create_tunnel_req, &create_tunnel_resp, nr_pdcp_data_req_drb, sdap_data_req);
if (ret != 0) {
LOG_E(NR_RRC, "rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE %x\n", UE->rnti);
UE->ue_release_timer_ng = 1;
......
......@@ -282,10 +282,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp));
if (!IS_SOFTMODEM_NOS1) {
LOG_D(RRC, "Calling gtpv1u_create_s1u_tunnel()\n");
gtpv1u_create_s1u_tunnel(
ctxt.instance,
&create_tunnel_req,
&create_tunnel_resp);
gtpv1u_create_s1u_tunnel(ctxt.instance, &create_tunnel_req, &create_tunnel_resp, nr_pdcp_data_req_drb);
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
......
......@@ -648,7 +648,9 @@ teid_t newGtpuCreateTunnel(instance_t instance,
int gtpv1u_create_s1u_tunnel(instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) {
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp,
gtpCallback callBack)
{
LOG_D(GTPU, "[%ld] Start create tunnels for UE ID %u, num_tunnels %d, sgw_S1u_teid %x\n",
instance,
create_tunnel_req->rnti,
......@@ -675,7 +677,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance,
-1, // no pdu session in 4G
create_tunnel_req->sgw_addr[i],
dstport,
pdcp_data_req,
callBack,
NULL);
create_tunnel_resp->status=0;
create_tunnel_resp->rnti=create_tunnel_req->rnti;
......@@ -712,10 +714,10 @@ int gtpv1u_update_s1u_tunnel(
auto it=inst->ue2te_mapping.find(prior_rnti);
if ( it != inst->ue2te_mapping.end() ) {
LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new ue id %u, old ue id %u)\n", instance, create_tunnel_req->rnti, prior_rnti);
pthread_mutex_unlock(&globGtp.gtp_lock);
gtpv1u_enb_create_tunnel_resp_t tmp;
(void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp);
AssertFatal(false, "logic bug: update of non-existing tunnel (new ue id %u, old ue id %u)\n", create_tunnel_req->rnti, prior_rnti);
/* we don't know if we need 4G or 5G PDCP and can therefore not create a
* new tunnel */
return 0;
}
......@@ -725,9 +727,12 @@ int gtpv1u_update_s1u_tunnel(
return 0;
}
int gtpv1u_create_ngu_tunnel( const instance_t instance,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req,
gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) {
int gtpv1u_create_ngu_tunnel(const instance_t instance,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req,
gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp,
gtpCallback callBack,
gtpCallbackSDAP callBackSDAP)
{
LOG_D(GTPU, "[%ld] Start create tunnels for ue id %lu, num_tunnels %d, sgw_S1u_teid %x\n",
instance,
create_tunnel_req->ue_id,
......@@ -749,8 +754,8 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
create_tunnel_req->outgoing_qfi[i],
create_tunnel_req->dst_addr[i],
dstport,
nr_pdcp_data_req_drb,
sdap_data_req);
callBack,
callBackSDAP);
create_tunnel_resp->status=0;
create_tunnel_resp->ue_id=create_tunnel_req->ue_id;
create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels;
......
......@@ -51,8 +51,10 @@ extern "C" {
// the parameter originInstance will be sent back in each message from gtp to the creator
void gtpv1uReceiver(int h);
void gtpv1uProcessTimeout(int handle,void *arg);
int gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp);
int gtpv1u_create_s1u_tunnel(const instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp,
gtpCallback callBack);
int gtpv1u_update_s1u_tunnel(const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP,
const rnti_t prior_rnti
......@@ -66,12 +68,12 @@ extern "C" {
int gtpv1u_delete_x2u_tunnel( const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
int
gtpv1u_create_ngu_tunnel(
const instance_t instanceP,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP);
int gtpv1u_create_ngu_tunnel(const instance_t instanceP,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP,
gtpCallback callBack,
gtpCallbackSDAP callBackSDAP);
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req);
......
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