diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c index 0fbc78fe7996bd03e3d271fb877745deaa4b57a0..8b2e11edb07410cad5ff7cee399d870b5dc289d7 100644 --- a/openair-cn/GTPV1-U/gtpv1u_eNB.c +++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c @@ -57,37 +57,47 @@ Address : EURECOM, #include "COMMON/platform_constants.h" -extern boolean_t pdcp_data_req( - module_id_t enb_idP, - module_id_t UE_id, - frame_t frame, - eNB_flag_t eNB_flag, - rb_id_t rb_id, - mui_t muiP, - confirm_t confirmP, \ - sdu_size_t sdu_buffer_size, - unsigned char* sdu_buffer, - pdcp_transmission_mode_t mode); - - -static int gtpv1u_eNB_send_init_udp( +extern boolean_t + pdcp_data_req( + module_id_t enb_idP, + module_id_t UE_id, + frame_t frame, + eNB_flag_t eNB_flag, + rb_id_t rb_id, + mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_buffer_size, + unsigned char* sdu_buffer, + pdcp_transmission_mode_t mode); + + +static int + gtpv1u_eNB_send_init_udp( uint16_t port_number); -NwGtpv1uRcT gtpv1u_eNB_log_request( - NwGtpv1uLogMgrHandleT hLogMgr, - NwU32T logLevel, - NwCharT *file, - NwU32T line, - NwCharT *logStr); -NwGtpv1uRcT gtpv1u_eNB_send_udp_msg( - NwGtpv1uUdpHandleT udpHandle, - NwU8T *buffer, - NwU32T buffer_len, - NwU32T peerIpAddr, - NwU16T peerPort); -NwGtpv1uRcT gtpv1u_eNB_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi); -int data_recv_callback( + +NwGtpv1uRcT + gtpv1u_eNB_log_request( + NwGtpv1uLogMgrHandleT hLogMgr, + NwU32T logLevel, + NwCharT *file, + NwU32T line, + NwCharT *logStr); + +NwGtpv1uRcT + gtpv1u_eNB_send_udp_msg( + NwGtpv1uUdpHandleT udpHandle, + NwU8T *buffer, + NwU32T buffer_len, + NwU32T peerIpAddr, + NwU16T peerPort); + +NwGtpv1uRcT + gtpv1u_eNB_process_stack_req( + NwGtpv1uUlpHandleT hUlp, + NwGtpv1uUlpApiT *pUlpApi); + +int + data_recv_callback( uint16_t portP, uint32_t address, uint8_t *buffer, @@ -100,22 +110,27 @@ int data_recv_callback( // uint8_t rab_idP, // char *sgw_ip_addr_pP, // uint16_t portP); -static NwGtpv1uRcT gtpv1u_start_timer_wrapper( +static NwGtpv1uRcT + gtpv1u_start_timer_wrapper( NwGtpv1uTimerMgrHandleT tmrMgrHandle, NwU32T timeoutSec, NwU32T timeoutUsec, NwU32T tmrType, void *timeoutArg, NwGtpv1uTimerHandleT *hTmr); -static NwGtpv1uRcT gtpv1u_stop_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr); + +static NwGtpv1uRcT + gtpv1u_stop_timer_wrapper( + NwGtpv1uTimerMgrHandleT tmrMgrHandle, + NwGtpv1uTimerHandleT hTmr); + int gtpv1u_initial_req( gtpv1u_data_t *gtpv1u_data_pP, teid_t teidP, tcp_udp_port_t portP, uint32_t address); + int gtpv1u_new_data_req( uint8_t enb_idP, @@ -123,12 +138,20 @@ gtpv1u_new_data_req( uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP); + static int gtpv1u_create_s1u_tunnel( gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP); -static int gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP); -static int gtpv1u_eNB_init(void); -void *gtpv1u_eNB_task(void *args); + +static int + gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP); + +static int + gtpv1u_eNB_init(void); + +void * + gtpv1u_eNB_task(void *args); + static gtpv1u_data_t gtpv1u_data_g; static int gtpv1u_eNB_send_init_udp(uint16_t port_number) @@ -219,26 +242,26 @@ 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) { GTPU_DEBUG("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); + teid, + buffer_len, + gtpv1u_teid_data_p->enb_id, + gtpv1u_teid_data_p->ue_id, + gtpv1u_teid_data_p->eps_bearer_id); result = pdcp_data_req( - gtpv1u_teid_data_p->enb_id, - gtpv1u_teid_data_p->ue_id, - 0, // frame TO DO - ENB_FLAG_YES, - gtpv1u_teid_data_p->eps_bearer_id, - 0, // mui - 0, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA); + gtpv1u_teid_data_p->enb_id, + gtpv1u_teid_data_p->ue_id, + 0, // frame TO DO + ENB_FLAG_YES, + gtpv1u_teid_data_p->eps_bearer_id, + 0, // mui + 0, // confirm + buffer_len, + buffer, + PDCP_TRANSMISSION_MODE_DATA); AssertError (result == TRUE, return NW_GTPV1U_FAILURE ,"PDCP data request failed!\n"); } else { - GTPU_ERROR("Received T-PDU from gtpv1u stack teid %u unknown", teid, buffer_len); + GTPU_ERROR("Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len); } } break; diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c index 9e70af57daba8f63f83820db4cb083d01a3b9a41..2c615af56ab34a3f9c3919702197c299a4a14293 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c @@ -45,6 +45,8 @@ #include "NwGtpv1uIe.h" #include "NwGtpv1uLog.h" +#include "UTIL/LOG/log.h" + #ifdef __cplusplus extern "C" { #endif @@ -274,7 +276,7 @@ nwGtpv1uPeerRspTimeout(void *arg) NwGtpv1uTrxnT *thiz; NwGtpv1uTimeoutInfoT *timeoutInfo = arg; - printf("Retransmission timer expired\n"); + LOG_W(GTPU, "Retransmission timer expired\n"); thiz = ((NwGtpv1uTrxnT *)timeoutInfo->timeoutArg); rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp, @@ -330,7 +332,7 @@ NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz, pTunnelEndPoint); if(pCollision) { - NW_LOG(thiz, NW_LOG_LEVEL_ERRO, + LOG_E(GTPU, "Tunnel end-point cannot be created for teid 0x%x. " "Tunnel already exists", teid); rc = nwGtpTunnelEndPointDestroy(thiz, pTunnelEndPoint); @@ -343,7 +345,7 @@ NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz, pTunnelEndPoint = RB_FIND(NwGtpv1uTunnelEndPointIdentifierMap, &(thiz->teidMap), pTunnelEndPoint); NW_ASSERT(pTunnelEndPoint); - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, + LOG_D(GTPU, "Tunnel end-point 0x%x creation successful for teid 0x%x %u(dec)", (unsigned int)pTunnelEndPoint, teid, teid); } @@ -373,7 +375,7 @@ nwGtpv1uDestroyTunnelEndPoint( NwGtpv1uStackT *thiz, NwGtpv1uTunnelEndPointT *pRemovedTeid; if(pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle) { - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Destroying Tunnel end-point '%x'", + LOG_D(GTPU, "Destroying Tunnel end-point '%x'", pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); pRemovedTeid = RB_REMOVE(NwGtpv1uTunnelEndPointIdentifierMap, &(thiz->teidMap), (NwGtpv1uTunnelEndPointT *)( @@ -386,7 +388,7 @@ nwGtpv1uDestroyTunnelEndPoint( NwGtpv1uStackT *thiz, (NwGtpv1uTunnelEndPointT *) pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); } else { - NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Non-existent Tunnel end-point handle '%x'", + LOG_W(GTPU, "Non-existent Tunnel end-point handle '%x'", pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); } @@ -500,13 +502,13 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, if(NW_GTPV1U_OK == rc) { NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, + LOG_D(GTPU, "Received T-PDU over tunnel end-point '%x' of size %u from "NW_IPV4_ADDR, ntohl(msgHdr->teid), pMsg->msgLen, NW_IPV4_ADDR_FORMAT((peerIp))); rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); } } else { - NW_LOG(thiz, NW_LOG_LEVEL_ERRO, + LOG_E(GTPU, "Received T-PDU over non-existent tunnel end-point '%x' from "NW_IPV4_ADDR, ntohl(msgHdr->teid), NW_IPV4_ADDR_FORMAT((peerIp))); } @@ -557,7 +559,7 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, */ rc = nwGtpv1uMsgAddIeTV1(hMsg, NW_GTPV1U_IE_RECOVERY, 0x00); - NW_LOG(thiz, NW_LOG_LEVEL_INFO, + LOG_I(GTPU, "Sending NW_GTP_ECHO_RSP message to %x:%x with seq %u", peerIp, peerPort, seqNum); @@ -752,13 +754,12 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, switch(msgType) { case NW_GTP_ECHO_REQ: - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "NW_GTP_ECHO_REQ"); + LOG_D(GTPU, "NW_GTP_ECHO_REQ"); ret = nwGtpv1uHandleEchoReq( thiz, udpData, udpDataLen, peerPort, peerIp); break; case NW_GTP_ERROR_INDICATION: - - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "NW_GTP_ERROR_INDICATION"); + LOG_D(GTPU, "NW_GTP_ERROR_INDICATION"); ret = nwGtpv1uSendUlpMessageIndication( thiz, 0, NW_GTPV1U_ULP_API_RECV_MSG, @@ -769,16 +770,15 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, udpDataLen); NW_ASSERT(ret == NW_GTPV1U_OK); - break; case NW_GTP_ECHO_RSP: - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "NW_GTP_ECHO_RSP"); + LOG_D(GTPU, "NW_GTP_ECHO_RSP"); ret = NW_GTPV1U_OK; break; case NW_GTP_GPDU: - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "NW_GTP_GPDU"); + LOG_D(GTPU, "NW_GTP_GPDU"); ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp); break; @@ -811,7 +811,7 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, switch(pUlpReq->apiType) { case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT: { - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Received NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT from ulp"); + LOG_D(GTPU, "Received NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT from ulp"); rc = NwGtpv1uCreateTunnelEndPoint(thiz, pUlpReq->apiInfo.createTunnelEndPointInfo.teid, pUlpReq->apiInfo.createTunnelEndPointInfo.hUlpSession, @@ -820,25 +820,25 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, break; case NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT: { - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Received destroy session req from ulp"); + LOG_D(GTPU, "Received destroy session req from ulp"); rc = nwGtpv1uDestroyTunnelEndPoint(thiz, pUlpReq); } break; case NW_GTPV1U_ULP_API_INITIAL_REQ: { - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Received initial req from ulp"); + LOG_D(GTPU, "Received initial req from ulp"); rc = nwGtpv1uInitialReq(thiz, pUlpReq); } break; case NW_GTPV1U_ULP_API_SEND_TPDU: { - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Received send tpdu req from ulp"); + LOG_D(GTPU, "Received send tpdu req from ulp"); rc = nwGtpv1uSendto(thiz, pUlpReq); } break; default: - NW_LOG(thiz, NW_LOG_LEVEL_ERRO, "Unsupported API received from ulp"); + LOG_D(GTPU, "Unsupported API received from ulp"); rc = NW_GTPV1U_FAILURE; break; } @@ -865,7 +865,7 @@ nwGtpv1uProcessTimeout(void *timeoutInfo) NW_ASSERT(thiz != NULL); NW_ENTER(thiz); - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, + LOG_D(GTPU, "Received timeout event from ULP with timeoutInfo %x!", (unsigned int)timeoutInfo);