diff --git a/openair-cn/GTPV1-U/gtpv1u.h b/openair-cn/GTPV1-U/gtpv1u.h index 109ffb5b7b..3409505158 100644 --- a/openair-cn/GTPV1-U/gtpv1u.h +++ b/openair-cn/GTPV1-U/gtpv1u.h @@ -36,6 +36,9 @@ #ifndef GTPV1_U_H_ #define GTPV1_U_H_ +#define GTPU_STACK_ENB 0 +#define GTPU_STACK_SGW 1 + /* When gtpv1u is compiled for eNB use MACRO from UTILS/log.h, * otherwise use standard fprintf as logger. */ diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c index ee877087f1..820569a7d3 100644 --- a/openair-cn/GTPV1-U/gtpv1u_eNB.c +++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c @@ -675,6 +675,16 @@ gtpv1u_create_s1u_tunnel( in_addr_t in_addr; int addrs_length_in_bytes= 0; + + MSC_LOG_RX_MESSAGE( + MSC_GTPU_ENB, + MSC_RRC_ENB, + NULL,0, + MSC_AS_TIME_FMT" CREATE_TUNNEL_REQ RNTI %"PRIx16" inst %u ntuns %u ebid %u sgw-s1u teid %u", + 0,0,create_tunnel_req_pP->rnti, instanceP, + create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->eps_bearer_id[0], + create_tunnel_req_pP->sgw_S1u_teid[0]); + message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP); GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).rnti = create_tunnel_req_pP->rnti; GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0; @@ -891,7 +901,7 @@ static int gtpv1u_eNB_init(void) gtpv1u_data_g.restart_counter = 0; /* Initializing GTPv1-U stack */ - if ((rc = nwGtpv1uInitialize(>pv1u_data_g.gtpv1u_stack)) != NW_GTPV1U_OK) { + if ((rc = nwGtpv1uInitialize(>pv1u_data_g.gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) { LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc); return -1; } diff --git a/openair-cn/GTPV1-U/gtpv1u_task.c b/openair-cn/GTPV1-U/gtpv1u_task.c index 6acdeaa940..efb849c5ea 100644 --- a/openair-cn/GTPV1-U/gtpv1u_task.c +++ b/openair-cn/GTPV1-U/gtpv1u_task.c @@ -601,7 +601,7 @@ int gtpv1u_init(const mme_config_t *mme_config_p) } /* Initializing GTPv1-U stack */ - if ((rc = nwGtpv1uInitialize(>pv1u_sgw_data.gtpv1u_stack)) != NW_GTPV1U_OK) { + if ((rc = nwGtpv1uInitialize(>pv1u_sgw_data.gtpv1u_stack, GTPU_STACK_SGW)) != NW_GTPV1U_OK) { GTPU_ERROR("Failed to setup nwGtpv1u stack %x\n", rc); return -1; } diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h index 2dca5aa212..3afd953a92 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h +++ b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h @@ -79,6 +79,7 @@ extern "C" { */ typedef struct NwGtpv1uStack { + NwU32T stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */ NwU32T id; NwU32T seq; NwGtpv1uUlpEntityT ulp; diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h index 4c2eef2255..7c8efab478 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h +++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h @@ -381,10 +381,11 @@ extern "C" { Initialize the nw-gtpv1u stack. @param[in,out] phGtpv1uStackHandle : Pointer to stack handle + @param[in] stackType : GTPU_STACK_ENB or GTPU_STACK_SGW */ NwGtpv1uRcT -nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle); +nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle, NwU32T stackType); /*--------------------------------------------------------------------------- * Destructor diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c index 0b4485f425..54b1dc23f8 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c @@ -47,6 +47,7 @@ #include "assertions.h" #include "intertask_interface.h" +#include "msc.h" #include "gtpv1u.h" #if defined(ENB_MODE) @@ -556,9 +557,26 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, GTPU_DEBUG("Received T-PDU over tunnel end-point '%x' of size %u (%u) (decapsulated %u)from "NW_IPV4_ADDR"\n", ntohl(msgHdr->teid), gpduLen, pMsg->msgLen, pMsg->msgBufLen, NW_IPV4_ADDR_FORMAT((peerIp))); #endif + MSC_LOG_RX_MESSAGE( + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, + NULL, + 0, + " G-PDU ltid %u size %u", + tunnelEndPointKey.teid, + gpduLen); + rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); } } else { + MSC_LOG_RX_DISCARDED_MESSAGE( + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, + NULL, + 0, + " G-PDU ltid %u size %u", + tunnelEndPointKey.teid, + gpduLen); GTPU_ERROR("Received T-PDU over non-existent tunnel end-point '%x' from "NW_IPV4_ADDR"\n", ntohl(msgHdr->teid), NW_IPV4_ADDR_FORMAT((peerIp))); } @@ -590,6 +608,13 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, seqNum = ntohs(*(NwU16T *) (msgBuf + (((*msgBuf) & 0x02) ? 8 : 4))); + MSC_LOG_RX_MESSAGE( + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" ECHO-REQ seq %u size %u", + 0,0,seqNum, msgBufLen); /* Send Echo Response */ rc = nwGtpv1uMsgNew( (NwGtpv1uStackHandleT)thiz, @@ -625,6 +650,13 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, peerPort, seqNum); #endif + MSC_LOG_TX_MESSAGE( + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, + (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" ECHO-RSP seq %u", + 0,0,seqNum); rc = nwGtpv1uCreateAndSendMsg( thiz, peerIp, @@ -646,7 +678,7 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, *--------------------------------------------------------------------------*/ NwGtpv1uRcT -nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle) +nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, NwU32T stackType) { NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NwGtpv1uStackT *thiz; @@ -655,7 +687,8 @@ nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle) memset(thiz, 0, sizeof(NwGtpv1uStackT)); if(thiz) { - thiz->id = (NwU32T) thiz; + thiz->id = (NwU32T) thiz; + thiz->stackType = (NwU32T) stackType; thiz->seq = (NwU16T) ((NwU32T)thiz) ; RB_INIT(&(thiz->outstandingTxSeqNumMap)); RB_INIT(&(thiz->outstandingRxSeqNumMap)); diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c index 48adc540f9..faf490a743 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) * Create GTPv1u Stack Instance *--------------------------------------------------------------------------*/ - rc = nwGtpv1uInitialize(&hGtpv1uStack); + rc = nwGtpv1uInitialize(&hGtpv1uStack, GTPU_STACK_ENB); if(rc != NW_GTPV1U_OK) { NW_LOG(NW_LOG_LEVEL_ERRO,