Commit b78fd6df authored by Lionel Gauthier's avatar Lionel Gauthier

added msc messages

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7200 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a9135b89
......@@ -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.
*/
......
......@@ -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(&gtpv1u_data_g.gtpv1u_stack)) != NW_GTPV1U_OK) {
if ((rc = nwGtpv1uInitialize(&gtpv1u_data_g.gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) {
LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc);
return -1;
}
......
......@@ -601,7 +601,7 @@ int gtpv1u_init(const mme_config_t *mme_config_p)
}
/* Initializing GTPv1-U stack */
if ((rc = nwGtpv1uInitialize(&gtpv1u_sgw_data.gtpv1u_stack)) != NW_GTPV1U_OK) {
if ((rc = nwGtpv1uInitialize(&gtpv1u_sgw_data.gtpv1u_stack, GTPU_STACK_SGW)) != NW_GTPV1U_OK) {
GTPU_ERROR("Failed to setup nwGtpv1u stack %x\n", rc);
return -1;
}
......
......@@ -79,6 +79,7 @@ extern "C" {
*/
typedef struct NwGtpv1uStack {
NwU32T stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */
NwU32T id;
NwU32T seq;
NwGtpv1uUlpEntityT ulp;
......
......@@ -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
......
......@@ -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;
......@@ -656,6 +688,7 @@ nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle)
if(thiz) {
thiz->id = (NwU32T) thiz;
thiz->stackType = (NwU32T) stackType;
thiz->seq = (NwU16T) ((NwU32T)thiz) ;
RB_INIT(&(thiz->outstandingTxSeqNumMap));
RB_INIT(&(thiz->outstandingRxSeqNumMap));
......
......@@ -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,
......
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