Commit e67d1c88 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Replace RNTI with UE ID in GTP files

(half done. Laurent to change ctxt_t)
parent 7a141e8e
...@@ -133,39 +133,39 @@ typedef struct gtpv1u_enb_data_forwarding_req_s { ...@@ -133,39 +133,39 @@ typedef struct gtpv1u_enb_data_forwarding_req_s {
} gtpv1u_enb_data_forwarding_req_t; } gtpv1u_enb_data_forwarding_req_t;
typedef struct gtpv1u_enb_data_forwarding_ind_s { typedef struct gtpv1u_enb_data_forwarding_ind_s {
uint32_t frame; uint32_t frame;
uint8_t enb_flag; uint8_t enb_flag;
rb_id_t rb_id; rb_id_t rb_id;
uint32_t muip; uint32_t muip;
uint32_t confirmp; uint32_t confirmp;
uint32_t sdu_size; uint32_t sdu_size;
uint8_t *sdu_p; uint8_t *sdu_p;
uint8_t mode; uint8_t mode;
uint16_t rnti; uint16_t rnti;
uint8_t module_id; uint8_t module_id;
uint8_t eNB_index; uint8_t eNB_index;
} gtpv1u_enb_data_forwarding_ind_t; } gtpv1u_enb_data_forwarding_ind_t;
typedef struct gtpv1u_enb_end_marker_req_s { typedef struct gtpv1u_enb_end_marker_req_s {
uint8_t *buffer; uint8_t *buffer;
uint32_t length; uint32_t length;
uint32_t offset; ///< start of message offset in buffer uint32_t offset; ///< start of message offset in buffer
rnti_t rnti; rnti_t rnti;
rb_id_t rab_id; rb_id_t rab_id;
} gtpv1u_enb_end_marker_req_t; } gtpv1u_enb_end_marker_req_t;
typedef struct gtpv1u_enb_end_marker_ind_s { typedef struct gtpv1u_enb_end_marker_ind_s {
uint32_t frame; uint32_t frame;
uint8_t enb_flag; uint8_t enb_flag;
rb_id_t rb_id; rb_id_t rb_id;
uint32_t muip; uint32_t muip;
uint32_t confirmp; uint32_t confirmp;
uint32_t sdu_size; uint32_t sdu_size;
uint8_t *sdu_p; uint8_t *sdu_p;
uint8_t mode; uint8_t mode;
uint16_t rnti; uint16_t rnti;
uint8_t module_id; uint8_t module_id;
uint8_t eNB_index; uint8_t eNB_index;
} gtpv1u_enb_end_marker_ind_t; } gtpv1u_enb_end_marker_ind_t;
typedef struct { typedef struct {
...@@ -177,7 +177,7 @@ typedef struct { ...@@ -177,7 +177,7 @@ typedef struct {
typedef struct gtpv1u_gnb_create_tunnel_req_s { typedef struct gtpv1u_gnb_create_tunnel_req_s {
rnti_t rnti; ue_id_t ue_id;
int num_tunnels; int num_tunnels;
//teid_t upf_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier //teid_t upf_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier
teid_t outgoing_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; teid_t outgoing_teid[NR_GTPV1U_MAX_BEARERS_PER_UE];
...@@ -191,20 +191,20 @@ typedef struct gtpv1u_gnb_create_tunnel_req_s { ...@@ -191,20 +191,20 @@ typedef struct gtpv1u_gnb_create_tunnel_req_s {
typedef struct gtpv1u_gnb_create_tunnel_resp_s { typedef struct gtpv1u_gnb_create_tunnel_resp_s {
uint8_t status; ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0) uint8_t status; ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0)
rnti_t rnti; ue_id_t ue_id;
int num_tunnels; int num_tunnels;
teid_t gnb_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier teid_t gnb_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier
pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE];
transport_layer_addr_t gnb_addr; transport_layer_addr_t gnb_addr;
} gtpv1u_gnb_create_tunnel_resp_t; } gtpv1u_gnb_create_tunnel_resp_t;
typedef struct gtpv1u_gnb_delete_tunnel_req_s { typedef struct gtpv1u_gnb_delete_tunnel_req_s {
rnti_t rnti; ue_id_t ue_id;
uint8_t num_pdusession; uint8_t num_pdusession;
pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE];
} gtpv1u_gnb_delete_tunnel_req_t; } gtpv1u_gnb_delete_tunnel_req_t;
typedef struct gtpv1u_gnb_delete_tunnel_resp_s { typedef struct gtpv1u_gnb_delete_tunnel_resp_s {
rnti_t rnti; ue_id_t ue_id;
uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0) uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0)
teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted
} gtpv1u_gnb_delete_tunnel_resp_t; } gtpv1u_gnb_delete_tunnel_resp_t;
...@@ -212,13 +212,13 @@ typedef struct gtpv1u_gnb_tunnel_data_req_s { ...@@ -212,13 +212,13 @@ typedef struct gtpv1u_gnb_tunnel_data_req_s {
uint8_t *buffer; uint8_t *buffer;
uint32_t length; uint32_t length;
uint32_t offset; ///< start of message offset in buffer uint32_t offset; ///< start of message offset in buffer
rnti_t rnti; ue_id_t ue_id;
pdusessionid_t pdusession_id; pdusessionid_t pdusession_id;
} gtpv1u_gnb_tunnel_data_req_t; } gtpv1u_gnb_tunnel_data_req_t;
typedef struct gtpv1u_DU_buffer_report_req_s { typedef struct gtpv1u_DU_buffer_report_req_s {
uint32_t buffer_availability; uint32_t buffer_availability;
rnti_t rnti; ue_id_t ue_id;
pdusessionid_t pdusession_id; pdusessionid_t pdusession_id;
} gtpv1u_DU_buffer_report_req_t; } gtpv1u_DU_buffer_report_req_t;
......
...@@ -49,7 +49,7 @@ typedef uint32_t slot_t; ...@@ -49,7 +49,7 @@ typedef uint32_t slot_t;
typedef uint16_t module_id_t; typedef uint16_t module_id_t;
typedef uint8_t slice_id_t; typedef uint8_t slice_id_t;
typedef uint8_t eNB_index_t; typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t; typedef uint64_t ue_id_t;
typedef int16_t smodule_id_t; typedef int16_t smodule_id_t;
typedef long rb_id_t; typedef long rb_id_t;
typedef long srb_id_t; typedef long srb_id_t;
......
...@@ -113,13 +113,13 @@ typedef struct { ...@@ -113,13 +113,13 @@ typedef struct {
} teidData_t; } teidData_t;
typedef struct { typedef struct {
rnti_t rnti; ue_id_t ue_id;
ebi_t incoming_rb_id; ebi_t incoming_rb_id;
gtpCallback callBack; gtpCallback callBack;
teid_t outgoing_teid; teid_t outgoing_teid;
gtpCallbackSDAP callBackSDAP; gtpCallbackSDAP callBackSDAP;
int pdusession_id; int pdusession_id;
} rntiData_t; } ueidData_t;
class gtpEndPoint { class gtpEndPoint {
public: public:
...@@ -127,8 +127,8 @@ class gtpEndPoint { ...@@ -127,8 +127,8 @@ class gtpEndPoint {
uint8_t foundAddr[20]; uint8_t foundAddr[20];
int foundAddrLen; int foundAddrLen;
int ipVersion; int ipVersion;
map<int,teidData_t> ue2te_mapping; map<uint64_t,teidData_t> ue2te_mapping;
map<int,rntiData_t> te2ue_mapping; map<uint64_t,ueidData_t> te2ue_mapping;
// we use the same port number for source and destination address // we use the same port number for source and destination address
// this allow using non standard gtp port number (different from 2152) // this allow using non standard gtp port number (different from 2152)
// and so, for example tu run 4G and 5G cores on one system // and so, for example tu run 4G and 5G cores on one system
...@@ -141,7 +141,7 @@ class gtpEndPoints { ...@@ -141,7 +141,7 @@ class gtpEndPoints {
public: public:
pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER;
// the instance id will be the Linux socket handler, as this is uniq // the instance id will be the Linux socket handler, as this is uniq
map<int, gtpEndPoint> instances; map<uint64_t, gtpEndPoint> instances;
~gtpEndPoints() { ~gtpEndPoints() {
// automatically close all sockets on quit // automatically close all sockets on quit
...@@ -317,22 +317,22 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b ...@@ -317,22 +317,22 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b
static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) {
uint8_t *buffer=req->buffer+req->offset; uint8_t *buffer=req->buffer+req->offset;
size_t length=req->length; size_t length=req->length;
rnti_t rnti=req->rnti; ue_id_t ue_id=req->ue_id;
int rab_id=req->pdusession_id; int rab_id=req->pdusession_id;
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetVoid(compatInst(instance)); getInstRetVoid(compatInst(instance));
getRntiRetVoid(inst, rnti); getRntiRetVoid(inst, ue_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) { if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant UE ID:RAB: %lu/%x\n", instance, ue_id, rab_id);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} }
LOG_D(GTPU,"[%ld] GTP-U sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", LOG_D(GTPU,"[%ld] GTP-U sending a packet to UE ID:RAB:teid %lu/%x/%x, len %lu, oldseq %d, oldnum %d\n",
instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); instance, ue_id, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum );
if(seqNumFlag) if(seqNumFlag)
ptr2->second.seqNum++; ptr2->second.seqNum++;
...@@ -404,16 +404,16 @@ static void fillDlDeliveryStatusReport(extensionHeader_t *extensionHeader, uint3 ...@@ -404,16 +404,16 @@ static void fillDlDeliveryStatusReport(extensionHeader_t *extensionHeader, uint3
} }
static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_report_req_t *req){ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_report_req_t *req){
rnti_t rnti=req->rnti; ue_id_t ue_id=req->ue_id;
int rab_id=req->pdusession_id; int rab_id=req->pdusession_id;
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetVoid(compatInst(instance)); getInstRetVoid(compatInst(instance));
getRntiRetVoid(inst, rnti); getRntiRetVoid(inst, ue_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) { if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant UE ID:RAB: %lu/%x\n", instance, ue_id, rab_id);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} }
...@@ -422,8 +422,8 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep ...@@ -422,8 +422,8 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep
extensionHeader = (extensionHeader_t *) calloc(1, sizeof(extensionHeader_t)); extensionHeader = (extensionHeader_t *) calloc(1, sizeof(extensionHeader_t));
fillDlDeliveryStatusReport(extensionHeader, req->buffer_availability,0); fillDlDeliveryStatusReport(extensionHeader, req->buffer_availability,0);
LOG_I(GTPU,"[%ld] GTP-U sending DL Data Delivery status to RNTI:RAB:teid %x/%x/%x, oldseq %d, oldnum %d\n", LOG_I(GTPU,"[%ld] GTP-U sending DL Data Delivery status to UE ID:RAB:teid %lu/%x/%x, oldseq %d, oldnum %d\n",
instance, rnti, rab_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum ); instance, ue_id, rab_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum );
// copy to release the mutex // copy to release the mutex
gtpv1u_bearer_t tmp=ptr2->second; gtpv1u_bearer_t tmp=ptr2->second;
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
...@@ -579,15 +579,15 @@ instance_t gtpv1Init(openAddr_t context) { ...@@ -579,15 +579,15 @@ instance_t gtpv1Init(openAddr_t context) {
return id; return id;
} }
void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid) { void GtpuUpdateTunnelOutgoingTeid(instance_t instance, ue_id_t ue_id, ebi_t bearer_id, teid_t newOutgoingTeid) {
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetVoid(compatInst(instance)); getInstRetVoid(compatInst(instance));
getRntiRetVoid(inst, rnti); getRntiRetVoid(inst, ue_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) { if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id); LOG_E(GTPU,"[%ld] Update tunnel for a existing ue id %lu, but wrong bearer_id %u\n", instance, ue_id, bearer_id);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} }
...@@ -599,7 +599,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer ...@@ -599,7 +599,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer
} }
teid_t newGtpuCreateTunnel(instance_t instance, teid_t newGtpuCreateTunnel(instance_t instance,
rnti_t rnti, ue_id_t ue_id,
int incoming_bearer_id, int incoming_bearer_id,
int outgoing_bearer_id, int outgoing_bearer_id,
teid_t outgoing_teid, teid_t outgoing_teid,
...@@ -610,10 +610,10 @@ teid_t newGtpuCreateTunnel(instance_t instance, ...@@ -610,10 +610,10 @@ teid_t newGtpuCreateTunnel(instance_t instance,
gtpCallbackSDAP callBackSDAP) { gtpCallbackSDAP callBackSDAP) {
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetInt(compatInst(instance)); getInstRetInt(compatInst(instance));
auto it=inst->ue2te_mapping.find(rnti); auto it=inst->ue2te_mapping.find(ue_id);
if ( it != inst->ue2te_mapping.end() && it->second.bearers.find(outgoing_bearer_id) != it->second.bearers.end()) { if ( it != inst->ue2te_mapping.end() && it->second.bearers.find(outgoing_bearer_id) != it->second.bearers.end()) {
LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti); LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (ue id %lu)\n", instance, ue_id);
inst->ue2te_mapping.erase(it); inst->ue2te_mapping.erase(it);
} }
...@@ -624,7 +624,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, ...@@ -624,7 +624,7 @@ teid_t newGtpuCreateTunnel(instance_t instance,
incoming_teid=gtpv1uNewTeid(); incoming_teid=gtpv1uNewTeid();
}; };
inst->te2ue_mapping[incoming_teid].rnti=rnti; inst->te2ue_mapping[incoming_teid].ue_id=ue_id;
inst->te2ue_mapping[incoming_teid].incoming_rb_id= incoming_bearer_id; inst->te2ue_mapping[incoming_teid].incoming_rb_id= incoming_bearer_id;
...@@ -636,7 +636,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, ...@@ -636,7 +636,7 @@ teid_t newGtpuCreateTunnel(instance_t instance,
inst->te2ue_mapping[incoming_teid].pdusession_id = (uint8_t)outgoing_bearer_id; inst->te2ue_mapping[incoming_teid].pdusession_id = (uint8_t)outgoing_bearer_id;
gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[ue_id].bearers[outgoing_bearer_id];
int addrs_length_in_bytes = remoteAddr.length / 8; int addrs_length_in_bytes = remoteAddr.length / 8;
...@@ -667,9 +667,9 @@ teid_t newGtpuCreateTunnel(instance_t instance, ...@@ -667,9 +667,9 @@ teid_t newGtpuCreateTunnel(instance_t instance,
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
char ip4[INET_ADDRSTRLEN]; char ip4[INET_ADDRSTRLEN];
char ip6[INET6_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN];
LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", LOG_I(GTPU, "[%ld] Created tunnel for UE ID %lu, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n",
instance, instance,
rnti, ue_id,
tmp->teid_incoming, tmp->teid_incoming,
tmp->teid_outgoing, tmp->teid_outgoing,
inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ),
...@@ -680,9 +680,9 @@ teid_t newGtpuCreateTunnel(instance_t instance, ...@@ -680,9 +680,9 @@ teid_t newGtpuCreateTunnel(instance_t instance,
int gtpv1u_create_s1u_tunnel(instance_t instance, int gtpv1u_create_s1u_tunnel(instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, 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) {
LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", LOG_D(GTPU, "[%ld] Start create tunnels for UE ID %lu, num_tunnels %d, sgw_S1u_teid %x\n",
instance, instance,
create_tunnel_req->rnti, create_tunnel_req->ue_id,
create_tunnel_req->num_tunnels, create_tunnel_req->num_tunnels,
create_tunnel_req->sgw_S1u_teid[0]); create_tunnel_req->sgw_S1u_teid[0]);
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
...@@ -699,7 +699,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, ...@@ -699,7 +699,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance,
create_tunnel_req->eps_bearer_id[i]); create_tunnel_req->eps_bearer_id[i]);
int incoming_rb_id=create_tunnel_req->eps_bearer_id[i]-4; int incoming_rb_id=create_tunnel_req->eps_bearer_id[i]-4;
teid_t teid = newGtpuCreateTunnel(compatInst(instance), teid_t teid = newGtpuCreateTunnel(compatInst(instance),
create_tunnel_req->rnti, create_tunnel_req->ue_id,
incoming_rb_id, incoming_rb_id,
create_tunnel_req->eps_bearer_id[i], create_tunnel_req->eps_bearer_id[i],
create_tunnel_req->sgw_S1u_teid[i], create_tunnel_req->sgw_S1u_teid[i],
...@@ -709,7 +709,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, ...@@ -709,7 +709,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance,
pdcp_data_req, pdcp_data_req,
NULL); NULL);
create_tunnel_resp->status=0; create_tunnel_resp->status=0;
create_tunnel_resp->rnti=create_tunnel_req->rnti; create_tunnel_resp->ue_id=create_tunnel_req->ue_id;
create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels;
create_tunnel_resp->enb_S1u_teid[i]=teid; create_tunnel_resp->enb_S1u_teid[i]=teid;
create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i];
...@@ -722,8 +722,8 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, ...@@ -722,8 +722,8 @@ int gtpv1u_create_s1u_tunnel(instance_t instance,
int gtpv1u_update_s1u_tunnel( int gtpv1u_update_s1u_tunnel(
const instance_t instance, const instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req,
const rnti_t prior_rnti const rnti prior_rnti
) { ) {
LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n",
instance, instance,
...@@ -743,7 +743,7 @@ int gtpv1u_update_s1u_tunnel( ...@@ -743,7 +743,7 @@ int gtpv1u_update_s1u_tunnel(
auto it=inst->ue2te_mapping.find(prior_rnti); auto it=inst->ue2te_mapping.find(prior_rnti);
if ( it != inst->ue2te_mapping.end() ) { if ( it != inst->ue2te_mapping.end() ) {
LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new ue id %lu, old ue id %lu)\n", instance, create_tunnel_req->rnti, prior_rnti);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
gtpv1u_enb_create_tunnel_resp_t tmp; gtpv1u_enb_create_tunnel_resp_t tmp;
(void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); (void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp);
...@@ -759,9 +759,9 @@ int gtpv1u_update_s1u_tunnel( ...@@ -759,9 +759,9 @@ int gtpv1u_update_s1u_tunnel(
int gtpv1u_create_ngu_tunnel( const instance_t instance, int gtpv1u_create_ngu_tunnel( const instance_t instance,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req,
gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) {
LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", LOG_D(GTPU, "[%ld] Start create tunnels for ue id %lu, num_tunnels %d, sgw_S1u_teid %x\n",
instance, instance,
create_tunnel_req->rnti, create_tunnel_req->ue_id,
create_tunnel_req->num_tunnels, create_tunnel_req->num_tunnels,
create_tunnel_req->outgoing_teid[0]); create_tunnel_req->outgoing_teid[0]);
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
...@@ -773,7 +773,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, ...@@ -773,7 +773,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { for (int i = 0; i < create_tunnel_req->num_tunnels; i++) {
teid_t teid = newGtpuCreateTunnel(instance, teid_t teid = newGtpuCreateTunnel(instance,
create_tunnel_req->rnti, create_tunnel_req->ue_id,
create_tunnel_req->incoming_rb_id[i], create_tunnel_req->incoming_rb_id[i],
create_tunnel_req->pdusession_id[i], create_tunnel_req->pdusession_id[i],
create_tunnel_req->outgoing_teid[i], create_tunnel_req->outgoing_teid[i],
...@@ -783,7 +783,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, ...@@ -783,7 +783,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
pdcp_data_req, pdcp_data_req,
sdap_data_req); sdap_data_req);
create_tunnel_resp->status=0; create_tunnel_resp->status=0;
create_tunnel_resp->rnti=create_tunnel_req->rnti; create_tunnel_resp->ue_id=create_tunnel_req->ue_id;
create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels;
create_tunnel_resp->gnb_NGu_teid[i]=teid; create_tunnel_resp->gnb_NGu_teid[i]=teid;
memcpy(create_tunnel_resp->gnb_addr.buffer,addr,sizeof(addr)); memcpy(create_tunnel_resp->gnb_addr.buffer,addr,sizeof(addr));
...@@ -796,7 +796,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, ...@@ -796,7 +796,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
int gtpv1u_update_ngu_tunnel( int gtpv1u_update_ngu_tunnel(
const instance_t instanceP, const instance_t instanceP,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
const rnti_t prior_rnti const ue_id_t prior_ue_id;
) { ) {
AssertFatal( false, "to be developped\n"); AssertFatal( false, "to be developped\n");
return GTPNOK; return GTPNOK;
...@@ -809,12 +809,12 @@ int gtpv1u_create_x2u_tunnel( ...@@ -809,12 +809,12 @@ int gtpv1u_create_x2u_tunnel(
AssertFatal( false, "to be developped\n"); AssertFatal( false, "to be developped\n");
} }
int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) {
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n",
instance, rnti); instance, ue_id);
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetInt(compatInst(instance)); getInstRetInt(compatInst(instance));
getRntiRetInt(inst, rnti); getRntiRetInt(inst, ue_id);
int nb=0; int nb=0;
...@@ -827,30 +827,30 @@ int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { ...@@ -827,30 +827,30 @@ int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) {
inst->ue2te_mapping.erase(ptrRnti); inst->ue2te_mapping.erase(ptrRnti);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); LOG_I(GTPU, "[%ld] Deleted all tunnels for ue id %x (%d tunnels deleted)\n", instance, ue_id, nb);
return !GTPNOK; return !GTPNOK;
} }
// Legacy delete tunnel finish by deleting all the rnti // Legacy delete tunnel finish by deleting all the ue id
// so the list of bearer provided is only a design bug // so the list of bearer provided is only a design bug
int gtpv1u_delete_s1u_tunnel( const instance_t instance, int gtpv1u_delete_s1u_tunnel( const instance_t instance,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return newGtpuDeleteAllTunnels(instance, req_pP->rnti); return newGtpuDeleteAllTunnels(instance, req_pP->rnti);
} }
int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id) { int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id) {
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n",
instance, rnti); instance, ue_id);
pthread_mutex_lock(&globGtp.gtp_lock); pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetInt(compatInst(instance)); getInstRetInt(compatInst(instance));
getRntiRetInt(inst, rnti); getRntiRetInt(inst, ue_id);
int nb=0; int nb=0;
for (int i=0; i<nbTunnels; i++) { for (int i=0; i<nbTunnels; i++) {
auto ptr2=ptrRnti->second.bearers.find(pdusession_id[i]); auto ptr2=ptrRnti->second.bearers.find(pdusession_id[i]);
if ( ptr2 == ptrRnti->second.bearers.end() ) { if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n", instance, rnti,pdusession_id[i]); LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel UE ID:RAB: %x/%x\n", instance, ud_id, pdusession_id[i]);
} else { } else {
inst->te2ue_mapping.erase(ptr2->second.teid_incoming); inst->te2ue_mapping.erase(ptr2->second.teid_incoming);
nb++; nb++;
...@@ -858,11 +858,11 @@ int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pduses ...@@ -858,11 +858,11 @@ int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pduses
} }
if (ptrRnti->second.bearers.size() == 0 ) if (ptrRnti->second.bearers.size() == 0 )
// no tunnels on this rnti, erase the ue entry // no tunnels on this ue id, erase the ue entry
inst->ue2te_mapping.erase(ptrRnti); inst->ue2te_mapping.erase(ptrRnti);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); LOG_I(GTPU, "[%ld] Deleted all tunnels for ue id %lu (%d tunnels deleted)\n", instance, ue_id, nb);
return !GTPNOK; return !GTPNOK;
} }
...@@ -874,7 +874,7 @@ int gtpv1u_delete_x2u_tunnel( const instance_t instanceP, ...@@ -874,7 +874,7 @@ int gtpv1u_delete_x2u_tunnel( const instance_t instanceP,
int gtpv1u_delete_ngu_tunnel( const instance_t instance, int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req) { gtpv1u_gnb_delete_tunnel_req_t *req) {
return newGtpuDeleteTunnels(instance, req->rnti, req->num_pdusession, req->pdusession_id); return newGtpuDeleteTunnels(instance, req->ue_id, req->num_pdusession, req->pdusession_id);
} }
static int Gtpv1uHandleEchoReq(int h, static int Gtpv1uHandleEchoReq(int h,
......
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