From 70a2c4ca763c55c6e20d9573c19c4d64fbdfde50 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Mon, 1 Dec 2014 11:01:18 +0000 Subject: [PATCH] Removed logs for better RT behaviour git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6131 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/GTPV1-U/gtpv1u_eNB.c | 16 +++--- openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c | 50 ++++++++++++++++--- .../GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c | 4 ++ 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c index 9a9560234a..f0943a25bd 100644 --- a/openair-cn/GTPV1-U/gtpv1u_eNB.c +++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c @@ -56,7 +56,7 @@ #include "UTIL/LOG/vcd_signal_dumper.h" -#define GTP_DUMP_SOCKET 0 +#undef GTP_DUMP_SOCKET extern boolean_t pdcp_data_req( @@ -158,7 +158,7 @@ void * static gtpv1u_data_t gtpv1u_data_g; -#if defined(GTP_DUMP_SOCKET) +#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 #include <linux/if.h> static int gtpv1u_dump_socket_g; @@ -200,7 +200,7 @@ static void gtpv1u_eNB_write_dump_socket(uint8_t *buffer_pP, uint32_t buffer_len sin.sin_addr.s_addr = INADDR_LOOPBACK; if (sendto(gtpv1u_dump_socket_g, buffer_pP, (size_t)buffer_lengthP, 0, (struct sockaddr *)&sin, sizeof(struct sockaddr)) < 0) { - LOG_E(GTPU, "%s:%s:%d setsockopt SO_BINDTODEVICE %d:%s\n", + LOG_E(GTPU, "%s:%s:%d sendto %d:%s\n", __FILE__, __FUNCTION__, __LINE__, errno, strerror(errno)); } } @@ -256,7 +256,9 @@ NwGtpv1uRcT gtpv1u_eNB_send_udp_msg( message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_DATA_REQ); if (message_p) { +#if defined(LOG_GTPU) && LOG_GTPU > 0 LOG_D(GTPU, "Sending UDP_DATA_REQ length %u offset %u", buffer_len, buffer_offset); +#endif udp_data_req_p = &message_p->ittiMsg.udp_data_req; udp_data_req_p->peer_address = peerIpAddr; udp_data_req_p->peer_port = peerPort; @@ -298,7 +300,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( LOG_E(GTPU, "Error while retrieving T-PDU"); } itti_free(TASK_UDP, ((NwGtpv1uMsgT*)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); -#if defined(GTP_DUMP_SOCKET) +#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 gtpv1u_eNB_write_dump_socket(buffer,buffer_len); #endif @@ -307,12 +309,14 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( //----------------------- hash_rc = hashtable_get(gtpv1u_data_g.teid_mapping, teid, (void**)>pv1u_teid_data_p); if (hash_rc == HASH_TABLE_OK) { +#if defined(LOG_GTPU) && LOG_GTPU > 0 LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> enb module id %u ue module id %u rab id %u\n", teid, buffer_len, gtpv1u_teid_data_p->enb_id, gtpv1u_teid_data_p->ue_id, gtpv1u_teid_data_p->eps_bearer_id); +#endif #warning "LG eps bearer mapping to DRB id to do (offset -4)" @@ -887,7 +891,7 @@ static int gtpv1u_eNB_init(void) return -1; } -#if defined(GTP_DUMP_SOCKET) +#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 if ((ret = gtpv1u_eNB_create_dump_socket()) < 0) { return -1; } @@ -957,7 +961,7 @@ void *gtpv1u_eNB_task(void *args) data_req_p = >PV1U_ENB_TUNNEL_DATA_REQ(received_message_p); //ipv4_send_data(ipv4_data_p->sd, data_ind_p->buffer, data_ind_p->length); -#if defined(GTP_DUMP_SOCKET) +#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 gtpv1u_eNB_write_dump_socket(&data_req_p->buffer[data_req_p->offset],data_req_p->length); #endif memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c index 90743c8918..5c1cd07bdf 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c @@ -196,7 +196,9 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort, NW_ASSERT(thiz); NW_ASSERT(pMsg); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif msgHdr = &pMsg->msgBuf[pMsg->msgBufOffset]; NW_ASSERT(msgHdr != NULL); @@ -213,10 +215,12 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort, *((NwU32T *) msgHdr) = htonl(pMsg->teid); msgHdr += 4; +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_DEBUG("nwGtpv1uCreateAndSendMsg to teid %u length %d offset %d\n", pMsg->teid, pMsg->msgLen, pMsg->msgBufOffset); +#endif if(pMsg->seqNumFlag || pMsg->extHdrFlag || pMsg->npduNumFlag) { *((NwU16T *) msgHdr) = (pMsg->seqNumFlag ? htons(pMsg->seqNum) : 0x0000); @@ -260,7 +264,9 @@ nwGtpv1uSendUlpMessageIndication( NW_IN NwGtpv1uStackT *thiz, NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NwGtpv1uUlpApiT ulpApi; +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif ulpApi.apiType = apiType; ulpApi.apiInfo.recvMsgInfo.msgType = msgType; @@ -277,7 +283,9 @@ nwGtpv1uSendUlpMessageIndication( NW_IN NwGtpv1uStackT *thiz, rc = thiz->ulp.ulpReqCallback(thiz->ulp.hUlp, &ulpApi); NW_ASSERT(rc == NW_GTPV1U_OK); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); +#endif return rc; } @@ -332,8 +340,9 @@ NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz, NwGtpv1uTunnelEndPointT *pTunnelEndPoint; NwGtpv1uTunnelEndPointT *pCollision; +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); - +#endif pTunnelEndPoint = nwGtpTunnelEndPointNew(thiz); if(pTunnelEndPoint) { @@ -367,7 +376,9 @@ NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz, rc = NW_GTPV1U_FAILURE; } +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); +#endif return rc; } @@ -421,8 +432,9 @@ nwGtpv1uInitialReq( NW_IN NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NwGtpv1uTrxnT *pTrxn; +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); - +#endif /* Create New Transaction */ rc = nwGtpv1uTrxnNew(thiz, &pTrxn); @@ -443,8 +455,9 @@ nwGtpv1uInitialReq( NW_IN NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) } } +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); - +#endif return rc; } @@ -462,7 +475,9 @@ nwGtpv1uSendto( NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NW_ASSERT(thiz); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif (void) nwGtpv1uMsgSetTeid(pUlpReq->apiInfo.sendtoInfo.hMsg, pUlpReq->apiInfo.sendtoInfo.teid); @@ -472,7 +487,9 @@ nwGtpv1uSendto( NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) 2152, (NwGtpv1uMsgT *) (NwGtpv1uMsgT *) pUlpReq->apiInfo.sendtoInfo.hMsg); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); +#endif return rc; } @@ -497,7 +514,9 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, NwGtpv1uTunnelEndPointT tunnelEndPointKey; NwU16T hdr_len = 0; +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif // no buffer offset msgHdr = (NwGtpv1uMsgHeaderT *) gpdu; @@ -521,17 +540,19 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, */ if(NW_GTPV1U_OK == rc) { NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; +#if defined(LOG_GTPU) && LOG_GTPU > 0 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 rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); } } else { 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))); } +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); - +#endif return rc; } @@ -577,11 +598,12 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, */ rc = nwGtpv1uMsgAddIeTV1(hMsg, NW_GTPV1U_IE_RECOVERY, 0x00); +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_INFO("Sending NW_GTP_ECHO_RSP message to %x:%x with seq %u\n", peerIp, peerPort, seqNum); - +#endif rc = nwGtpv1uCreateAndSendMsg( thiz, peerIp, @@ -798,7 +820,9 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, break; case NW_GTP_GPDU: +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_DEBUG("NW_GTP_GPDU: DATA COMING FROM UDP\n"); +#endif ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp); break; @@ -808,7 +832,9 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, break; } +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); +#endif return ret; } @@ -827,7 +853,9 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, NW_ASSERT(thiz); NW_ASSERT(pUlpReq != NULL); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif switch(pUlpReq->apiType) { case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT: { @@ -852,7 +880,9 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, break; case NW_GTPV1U_ULP_API_SEND_TPDU: { +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_DEBUG("Received send tpdu req from ulp\n"); +#endif rc = nwGtpv1uSendto(thiz, pUlpReq); } break; @@ -863,8 +893,9 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, break; } +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); - +#endif return rc; } @@ -884,14 +915,17 @@ nwGtpv1uProcessTimeout(void *timeoutInfo) NW_ASSERT(thiz != NULL); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_ENTER(thiz); +#endif GTPU_DEBUG("Received timeout event from ULP with timeoutInfo %x!\n", (unsigned int)timeoutInfo); rc = (((NwGtpv1uTimeoutInfoT *) timeoutInfo)->timeoutCallbackFunc) (timeoutInfo); +#if defined(LOG_GTPU) && LOG_GTPU > 0 NW_LEAVE(thiz); - +#endif return rc; } diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c index f78f44540c..1ea33cebb4 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -143,9 +143,11 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, pMsg->msgBuf = tpdu; pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE; pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE); +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_DEBUG("MSG length %u, offset %u -> length %u offset %u\n", tpduLength, tpduOffset, pMsg->msgBufLen, pMsg->msgBufOffset); +#endif // Version field: This field is used to determine the version of the GTP-U protocol. // The version number shall be set to '1'. @@ -271,8 +273,10 @@ nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, pMsg->msgBufOffset = (NwU32T)(pBuf - pMsg->msgBuf); pMsg->msgBufLen = bufLen - pMsg->msgBufOffset; pMsg->msgLen = bufLen; +#if defined(LOG_GTPU) && LOG_GTPU > 0 GTPU_DEBUG("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ", pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset); +#endif *phMsg = (NwGtpv1uMsgHandleT) pMsg; return NW_GTPV1U_OK; } -- GitLab