GTP PDCP change rnti to ue id
This commit is contained in:
committed by
laurent
parent
a97dfedb78
commit
ec21db63eb
+115
-132
@@ -108,18 +108,18 @@ typedef struct gtpv1u_bearer_s {
|
||||
} gtpv1u_bearer_t;
|
||||
|
||||
typedef struct {
|
||||
map<int, gtpv1u_bearer_t> bearers;
|
||||
map<ue_id_t, gtpv1u_bearer_t> bearers;
|
||||
teid_t outgoing_teid;
|
||||
} teidData_t;
|
||||
|
||||
typedef struct {
|
||||
rnti_t rnti;
|
||||
ue_id_t ue_id;
|
||||
ebi_t incoming_rb_id;
|
||||
gtpCallback callBack;
|
||||
teid_t outgoing_teid;
|
||||
gtpCallbackSDAP callBackSDAP;
|
||||
int pdusession_id;
|
||||
} rntiData_t;
|
||||
} ueidData_t;
|
||||
|
||||
class gtpEndPoint {
|
||||
public:
|
||||
@@ -127,8 +127,8 @@ class gtpEndPoint {
|
||||
uint8_t foundAddr[20];
|
||||
int foundAddrLen;
|
||||
int ipVersion;
|
||||
map<int,teidData_t> ue2te_mapping;
|
||||
map<int,rntiData_t> te2ue_mapping;
|
||||
map<uint64_t,teidData_t> ue2te_mapping;
|
||||
map<uint64_t,ueidData_t> te2ue_mapping;
|
||||
// we use the same port number for source and destination address
|
||||
// this allow using non standard gtp port number (different from 2152)
|
||||
// and so, for example tu run 4G and 5G cores on one system
|
||||
@@ -141,7 +141,7 @@ class gtpEndPoints {
|
||||
public:
|
||||
pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER;
|
||||
// the instance id will be the Linux socket handler, as this is uniq
|
||||
map<int, gtpEndPoint> instances;
|
||||
map<uint64_t, gtpEndPoint> instances;
|
||||
|
||||
~gtpEndPoints() {
|
||||
// automatically close all sockets on quit
|
||||
@@ -184,20 +184,20 @@ instance_t legacyInstanceMapping=0;
|
||||
gtpEndPoint * inst=&instChk->second;
|
||||
|
||||
|
||||
#define getRntiRetVoid(insT, RnTi) \
|
||||
auto ptrRnti=insT->ue2te_mapping.find(RnTi); \
|
||||
#define getUeRetVoid(insT, Ue) \
|
||||
auto ptrUe=insT->ue2te_mapping.find(Ue); \
|
||||
\
|
||||
if ( ptrRnti==insT->ue2te_mapping.end() ) { \
|
||||
LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \
|
||||
if ( ptrUe==insT->ue2te_mapping.end() ) { \
|
||||
LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue id %ld in hashtable ue_mapping\n", instance, ue_id); \
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define getRntiRetInt(insT, RnTi) \
|
||||
auto ptrRnti=insT->ue2te_mapping.find(RnTi); \
|
||||
#define getUeRetInt(insT, Ue) \
|
||||
auto ptrUe=insT->ue2te_mapping.find(Ue); \
|
||||
\
|
||||
if ( ptrRnti==insT->ue2te_mapping.end() ) { \
|
||||
LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \
|
||||
if ( ptrUe==insT->ue2te_mapping.end() ) { \
|
||||
LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue id %ld in hashtable ue_mapping\n", instance, ue_id); \
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock); \
|
||||
return GTPNOK; \
|
||||
}
|
||||
@@ -281,58 +281,25 @@ static int gtpv1uCreateAndSendMsg(int h,
|
||||
return !GTPNOK;
|
||||
}
|
||||
|
||||
static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) {
|
||||
static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) {
|
||||
uint8_t *buffer=req->buffer+req->offset;
|
||||
size_t length=req->length;
|
||||
rnti_t rnti=req->rnti;
|
||||
int rab_id=req->rab_id;
|
||||
ue_id_t ue_id=req->ue_id;
|
||||
int bearer_id=req->bearer_id;
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetVoid(compatInst(instance));
|
||||
getRntiRetVoid(inst, rnti);
|
||||
getUeRetVoid(inst, ue_id);
|
||||
|
||||
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
|
||||
auto ptr2=ptrUe->second.bearers.find(bearer_id);
|
||||
|
||||
if ( ptr2 == ptrRnti->second.bearers.end() ) {
|
||||
LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id);
|
||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
||||
LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id);
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_D(GTPU,"[%ld] sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n",
|
||||
instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum );
|
||||
|
||||
if(seqNumFlag)
|
||||
ptr2->second.seqNum++;
|
||||
|
||||
if(npduNumFlag)
|
||||
ptr2->second.npduNum++;
|
||||
|
||||
// copy to release the mutex
|
||||
gtpv1u_bearer_t tmp=ptr2->second;
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
gtpv1uCreateAndSendMsg(
|
||||
compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, GTP_GPDU, tmp.teid_outgoing, buffer, length, seqNumFlag, npduNumFlag, tmp.seqNum, tmp.npduNum, NO_MORE_EXT_HDRS, NULL, 0);
|
||||
}
|
||||
|
||||
static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) {
|
||||
uint8_t *buffer=req->buffer+req->offset;
|
||||
size_t length=req->length;
|
||||
rnti_t rnti=req->rnti;
|
||||
int rab_id=req->pdusession_id;
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetVoid(compatInst(instance));
|
||||
getRntiRetVoid(inst, rnti);
|
||||
|
||||
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
|
||||
|
||||
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);
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_D(GTPU,"[%ld] GTP-U sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n",
|
||||
instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum );
|
||||
LOG_D(GTPU,"[%ld] sending a packet to UE:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n",
|
||||
instance, ue_id, bearer_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum );
|
||||
|
||||
if(seqNumFlag)
|
||||
ptr2->second.seqNum++;
|
||||
@@ -404,16 +371,16 @@ static void fillDlDeliveryStatusReport(extensionHeader_t *extensionHeader, uint3
|
||||
}
|
||||
|
||||
static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_report_req_t *req){
|
||||
rnti_t rnti=req->rnti;
|
||||
int rab_id=req->pdusession_id;
|
||||
ue_id_t ue_id=req->ue_id;
|
||||
int bearer_id=req->pdusession_id;
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetVoid(compatInst(instance));
|
||||
getRntiRetVoid(inst, rnti);
|
||||
getUeRetVoid(inst, ue_id);
|
||||
|
||||
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
|
||||
auto ptr2=ptrUe->second.bearers.find(bearer_id);
|
||||
|
||||
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);
|
||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
||||
LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant UE ID:RAB: %lu/%x\n", instance, ue_id, bearer_id);
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
return;
|
||||
}
|
||||
@@ -422,8 +389,8 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep
|
||||
extensionHeader = (extensionHeader_t *) calloc(1, sizeof(extensionHeader_t));
|
||||
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",
|
||||
instance, rnti, rab_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum );
|
||||
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, ue_id, bearer_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum );
|
||||
// copy to release the mutex
|
||||
gtpv1u_bearer_t tmp=ptr2->second;
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
@@ -431,23 +398,23 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep
|
||||
compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, GTP_GPDU, tmp.teid_outgoing, NULL, 0, false, false, 0, 0, NR_RAN_CONTAINER, extensionHeader->buffer, extensionHeader->length);
|
||||
}
|
||||
|
||||
static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req) {
|
||||
rnti_t rnti=req->rnti;
|
||||
int rab_id=req->rab_id;
|
||||
static void gtpv1uEndTunnel(instance_t instance, gtpv1u_tunnel_data_req_t *req) {
|
||||
ue_id_t ue_id=req->ue_id;
|
||||
int bearer_id=req->bearer_id;
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetVoid(compatInst(instance));
|
||||
getRntiRetVoid(inst, rnti);
|
||||
getUeRetVoid(inst, ue_id);
|
||||
|
||||
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
|
||||
auto ptr2=ptrUe->second.bearers.find(bearer_id);
|
||||
|
||||
if ( ptr2 == ptrRnti->second.bearers.end() ) {
|
||||
LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id);
|
||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
||||
LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id);
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n",
|
||||
instance, rnti, rab_id,ptr2->second.teid_outgoing);
|
||||
LOG_D(GTPU,"[%ld] sending a end packet packet to UE:RAB:teid %lx/%x/%x\n",
|
||||
instance, ue_id, bearer_id,ptr2->second.teid_outgoing);
|
||||
gtpv1u_bearer_t tmp=ptr2->second;
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
Gtpv1uMsgHeaderT msgHdr;
|
||||
@@ -579,15 +546,15 @@ instance_t gtpv1Init(openAddr_t context) {
|
||||
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);
|
||||
getInstRetVoid(compatInst(instance));
|
||||
getRntiRetVoid(inst, rnti);
|
||||
getUeRetVoid(inst, ue_id);
|
||||
|
||||
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id);
|
||||
auto ptr2=ptrUe->second.bearers.find(bearer_id);
|
||||
|
||||
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);
|
||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@@ -599,7 +566,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer
|
||||
}
|
||||
|
||||
teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
rnti_t rnti,
|
||||
ue_id_t ue_id,
|
||||
int incoming_bearer_id,
|
||||
int outgoing_bearer_id,
|
||||
teid_t outgoing_teid,
|
||||
@@ -610,10 +577,10 @@ teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
gtpCallbackSDAP callBackSDAP) {
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
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()) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -624,7 +591,7 @@ teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
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;
|
||||
|
||||
@@ -636,7 +603,7 @@ teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
|
||||
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;
|
||||
|
||||
@@ -652,7 +619,7 @@ teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
|
||||
case 20:
|
||||
memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4);
|
||||
memcpy(&tmp->outgoing_ip6_addr.s6_addr,
|
||||
memcpy(tmp->outgoing_ip6_addr.s6_addr,
|
||||
remoteAddr.buffer+4,
|
||||
16);
|
||||
|
||||
@@ -667,9 +634,9 @@ teid_t newGtpuCreateTunnel(instance_t instance,
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
char ip4[INET_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,
|
||||
rnti,
|
||||
ue_id,
|
||||
tmp->teid_incoming,
|
||||
tmp->teid_outgoing,
|
||||
inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ),
|
||||
@@ -680,7 +647,7 @@ 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) {
|
||||
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 %u, num_tunnels %d, sgw_S1u_teid %x\n",
|
||||
instance,
|
||||
create_tunnel_req->rnti,
|
||||
create_tunnel_req->num_tunnels,
|
||||
@@ -722,7 +689,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance,
|
||||
|
||||
int gtpv1u_update_s1u_tunnel(
|
||||
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
|
||||
) {
|
||||
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",
|
||||
@@ -743,7 +710,7 @@ 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 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 %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);
|
||||
@@ -759,9 +726,9 @@ int gtpv1u_update_s1u_tunnel(
|
||||
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) {
|
||||
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,
|
||||
create_tunnel_req->rnti,
|
||||
create_tunnel_req->ue_id,
|
||||
create_tunnel_req->num_tunnels,
|
||||
create_tunnel_req->outgoing_teid[0]);
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
@@ -773,7 +740,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
for (int i = 0; i < create_tunnel_req->num_tunnels; i++) {
|
||||
teid_t teid = newGtpuCreateTunnel(instance,
|
||||
create_tunnel_req->rnti,
|
||||
create_tunnel_req->ue_id,
|
||||
create_tunnel_req->incoming_rb_id[i],
|
||||
create_tunnel_req->pdusession_id[i],
|
||||
create_tunnel_req->outgoing_teid[i],
|
||||
@@ -783,7 +750,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
|
||||
pdcp_data_req,
|
||||
sdap_data_req);
|
||||
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->gnb_NGu_teid[i]=teid;
|
||||
memcpy(create_tunnel_resp->gnb_addr.buffer,addr,sizeof(addr));
|
||||
@@ -796,7 +763,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
|
||||
int gtpv1u_update_ngu_tunnel(
|
||||
const instance_t instanceP,
|
||||
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
|
||||
const rnti_t prior_rnti
|
||||
const ue_id_t prior_ueid
|
||||
) {
|
||||
AssertFatal( false, "to be developped\n");
|
||||
return GTPNOK;
|
||||
@@ -809,60 +776,60 @@ int gtpv1u_create_x2u_tunnel(
|
||||
AssertFatal( false, "to be developped\n");
|
||||
}
|
||||
|
||||
int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) {
|
||||
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n",
|
||||
instance, rnti);
|
||||
int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) {
|
||||
LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n",
|
||||
instance, ue_id);
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetInt(compatInst(instance));
|
||||
getRntiRetInt(inst, rnti);
|
||||
getUeRetInt(inst, ue_id);
|
||||
|
||||
int nb=0;
|
||||
|
||||
for (auto j=ptrRnti->second.bearers.begin();
|
||||
j!=ptrRnti->second.bearers.end();
|
||||
for (auto j=ptrUe->second.bearers.begin();
|
||||
j!=ptrUe->second.bearers.end();
|
||||
++j) {
|
||||
inst->te2ue_mapping.erase(j->second.teid_incoming);
|
||||
nb++;
|
||||
}
|
||||
|
||||
inst->ue2te_mapping.erase(ptrRnti);
|
||||
inst->ue2te_mapping.erase(ptrUe);
|
||||
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 %ld (%d tunnels deleted)\n", instance, ue_id, nb);
|
||||
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
|
||||
int gtpv1u_delete_s1u_tunnel( const instance_t instance,
|
||||
const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
|
||||
return newGtpuDeleteAllTunnels(instance, req_pP->rnti);
|
||||
}
|
||||
|
||||
int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id) {
|
||||
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n",
|
||||
instance, rnti);
|
||||
int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id) {
|
||||
LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n",
|
||||
instance, ue_id);
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetInt(compatInst(instance));
|
||||
getRntiRetInt(inst, rnti);
|
||||
getUeRetInt(inst, ue_id);
|
||||
int nb=0;
|
||||
|
||||
for (int i=0; i<nbTunnels; i++) {
|
||||
auto ptr2=ptrRnti->second.bearers.find(pdusession_id[i]);
|
||||
auto ptr2=ptrUe->second.bearers.find(pdusession_id[i]);
|
||||
|
||||
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]);
|
||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
||||
LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel UE ID:RAB: %ld/%x\n", instance, ue_id, pdusession_id[i]);
|
||||
} else {
|
||||
inst->te2ue_mapping.erase(ptr2->second.teid_incoming);
|
||||
nb++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptrRnti->second.bearers.size() == 0 )
|
||||
// no tunnels on this rnti, erase the ue entry
|
||||
inst->ue2te_mapping.erase(ptrRnti);
|
||||
if (ptrUe->second.bearers.size() == 0 )
|
||||
// no tunnels on this ue id, erase the ue entry
|
||||
inst->ue2te_mapping.erase(ptrUe);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -874,7 +841,7 @@ int gtpv1u_delete_x2u_tunnel( const instance_t instanceP,
|
||||
|
||||
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
|
||||
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,
|
||||
@@ -954,7 +921,7 @@ static int Gtpv1uHandleEndMarker(int h,
|
||||
ctxt.module_id = 0;
|
||||
ctxt.enb_flag = 1;
|
||||
ctxt.instance = inst->addr.originInstance;
|
||||
ctxt.rnti = tunnel->second.rnti;
|
||||
ctxt.rnti = tunnel->second.ue_id;
|
||||
ctxt.frame = 0;
|
||||
ctxt.subframe = 0;
|
||||
ctxt.eNB_index = 0;
|
||||
@@ -1087,7 +1054,7 @@ static int Gtpv1uHandleGpdu(int h,
|
||||
ctxt.module_id = 0;
|
||||
ctxt.enb_flag = 1;
|
||||
ctxt.instance = inst->addr.originInstance;
|
||||
ctxt.rnti = tunnel->second.rnti;
|
||||
ctxt.rnti = tunnel->second.ue_id;
|
||||
ctxt.frame = 0;
|
||||
ctxt.subframe = 0;
|
||||
ctxt.eNB_index = 0;
|
||||
@@ -1105,11 +1072,33 @@ static int Gtpv1uHandleGpdu(int h,
|
||||
|
||||
if (sdu_buffer_size > 0) {
|
||||
if (qfi != -1 && tunnel->second.callBackSDAP) {
|
||||
if (!tunnel->second.callBackSDAP(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id, qfi, rqi, tunnel->second.pdusession_id))
|
||||
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
||||
if ( !tunnel->second.callBackSDAP(&ctxt,
|
||||
tunnel->second.ue_id,
|
||||
srb_flag,
|
||||
rb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size,
|
||||
sdu_buffer,
|
||||
mode,
|
||||
&sourceL2Id,
|
||||
&destinationL2Id,
|
||||
qfi,
|
||||
rqi,
|
||||
tunnel->second.pdusession_id) )
|
||||
LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h);
|
||||
} else {
|
||||
if (!tunnel->second.callBack(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id))
|
||||
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
||||
if ( !tunnel->second.callBack(&ctxt,
|
||||
srb_flag,
|
||||
rb_id,
|
||||
mui,
|
||||
confirm,
|
||||
sdu_buffer_size,
|
||||
sdu_buffer,
|
||||
mode,
|
||||
&sourceL2Id,
|
||||
&destinationL2Id) )
|
||||
LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1231,16 +1220,10 @@ void *gtpv1uTask(void *args) {
|
||||
|
||||
switch (ITTI_MSG_ID(message_p)) {
|
||||
// DATA TO BE SENT TO UDP
|
||||
case GTPV1U_ENB_TUNNEL_DATA_REQ: {
|
||||
gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
|
||||
>PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false);
|
||||
itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
case GTPV1U_GNB_TUNNEL_DATA_REQ: {
|
||||
gtpv1uSend2(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
|
||||
>PV1U_GNB_TUNNEL_DATA_REQ(message_p), false, false);
|
||||
case GTPV1U_TUNNEL_DATA_REQ: {
|
||||
gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
|
||||
>PV1U_TUNNEL_DATA_REQ(message_p), false, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1259,8 +1242,8 @@ void *gtpv1uTask(void *args) {
|
||||
|
||||
case GTPV1U_ENB_END_MARKER_REQ:
|
||||
gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
|
||||
>PV1U_ENB_TUNNEL_DATA_REQ(message_p));
|
||||
itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
|
||||
>PV1U_TUNNEL_DATA_REQ(message_p));
|
||||
itti_free(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_REQ(message_p).buffer);
|
||||
break;
|
||||
|
||||
case GTPV1U_ENB_DATA_FORWARDING_REQ:
|
||||
|
||||
Reference in New Issue
Block a user