Commit cdcb4d62 authored by Chenyu's avatar Chenyu

test gtp ok

parent 0b64fedd
...@@ -419,7 +419,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -419,7 +419,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
} }
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) { // if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) {
if (gnb_nb > 0) { if (gnb_nb > 0) {
/* /*
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
...@@ -449,7 +449,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -449,7 +449,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
return -1; return -1;
} }
} }
} //}
if (gnb_nb > 0) { if (gnb_nb > 0) {
......
...@@ -112,6 +112,7 @@ boolean_t pdcp_data_req( ...@@ -112,6 +112,7 @@ boolean_t pdcp_data_req(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
printf("---------liuyu----welcome to pdcp_data_req");
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
uint8_t i = 0; uint8_t i = 0;
uint8_t pdcp_header_len = 0; uint8_t pdcp_header_len = 0;
......
...@@ -475,7 +475,37 @@ static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t ...@@ -475,7 +475,37 @@ static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t
if(liuyu==0) if(liuyu==0)
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf); nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf);
if(liuyu==1) if(liuyu==1)
nr_rrc_data_ind( ctxt_pP, 1, size, buf); {
for (i = 0; i < 5; i++) {
if (entity == ue->drb[i]) {
rb_id = i+1;
goto rb_found;
}
}
LOG_I(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1);
rb_found:
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
size + GTPU_HEADER_OVERHEAD_MAX);
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
memcpy(&gtpu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size);
message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ);
AssertFatal(message_p != NULL, "OUT OF MEMORY");
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = 0x1234;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
//printf("\n");
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
}
//nr_rrc_data_ind( ctxt_pP, 1, size, buf);
liuyu++; liuyu++;
...@@ -500,22 +530,22 @@ static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t ...@@ -500,22 +530,22 @@ static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t
__FILE__, __LINE__, __FUNCTION__, ue->rnti); __FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1); exit(1);
rb_found: // rb_found:
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, // gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
size + GTPU_HEADER_OVERHEAD_MAX); // size + GTPU_HEADER_OVERHEAD_MAX);
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); // AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
memcpy(&gtpu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size); // memcpy(&gtpu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size);
message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ); // message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ);
AssertFatal(message_p != NULL, "OUT OF MEMORY"); // AssertFatal(message_p != NULL, "OUT OF MEMORY");
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; // GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size; // GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; // GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti; // GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; // GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); // LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]); // //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
//printf("\n"); // //printf("\n");
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); // itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
} }
} }
......
...@@ -1316,6 +1316,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { ...@@ -1316,6 +1316,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) {
// DATA TO BE SENT TO UDP // DATA TO BE SENT TO UDP
case GTPV1U_ENB_TUNNEL_DATA_REQ: { case GTPV1U_ENB_TUNNEL_DATA_REQ: {
printf("-------------liuyu--welcome to GTPV1U_ENB_TUNNEL_DATA_REQ----------");
gtpv1u_enb_tunnel_data_req_t *data_req_p = NULL; gtpv1u_enb_tunnel_data_req_t *data_req_p = NULL;
NwGtpv1uUlpApiT stack_req; NwGtpv1uUlpApiT stack_req;
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
...@@ -1332,15 +1333,19 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { ...@@ -1332,15 +1333,19 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) {
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)&gtpv1u_ue_data_p); hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { if(0){// (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); // LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti);
} else { } else {
if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id < max_val_LTE_DRB_Identity)) { if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id < max_val_LTE_DRB_Identity)) {
enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; //enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB;
sgw_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_sgw; enb_s1u_teid = 0x01;
// sgw_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_sgw;
sgw_s1u_teid = 0x01;
stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
stack_req.apiInfo.sendtoInfo.teid = sgw_s1u_teid; stack_req.apiInfo.sendtoInfo.teid = sgw_s1u_teid;
stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr; in_addr_t upf_addr=0xc0a8c7DF;
//stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr;
stack_req.apiInfo.sendtoInfo.ipAddr = upf_addr;
rc = nwGtpv1uGpduMsgNew( rc = nwGtpv1uGpduMsgNew(
RC.gtpv1u_data_g->gtpv1u_stack, RC.gtpv1u_data_g->gtpv1u_stack,
sgw_s1u_teid, sgw_s1u_teid,
......
...@@ -127,6 +127,7 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req( ...@@ -127,6 +127,7 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
* - END-MARKER * - END-MARKER
*/ */
case NW_GTPV1U_ULP_API_RECV_TPDU: { case NW_GTPV1U_ULP_API_RECV_TPDU: {
printf("-----liuyu---welcome NW_GTPV1U_ULP_API_RECV_TPDU-----------\n");
uint8_t buffer[4096]; uint8_t buffer[4096];
uint32_t buffer_len; uint32_t buffer_len;
//uint16_t msgType = NW_GTP_GPDU; //uint16_t msgType = NW_GTP_GPDU;
...@@ -143,19 +144,23 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req( ...@@ -143,19 +144,23 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
LOG_E(GTPU, "Error while retrieving T-PDU"); LOG_E(GTPU, "Error while retrieving T-PDU");
} }
itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); // itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf);
#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 #if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0
gtpv1u_eNB_write_dump_socket(buffer,buffer_len); gtpv1u_eNB_write_dump_socket(buffer,buffer_len);
#endif #endif
rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, //rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack,
pUlpApi->apiInfo.recvMsgInfo.hMsg); // pUlpApi->apiInfo.recvMsgInfo.hMsg);
if (rc != NW_GTPV1U_OK) { //if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); // LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc);
} //}
hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, teid, (void **)&gtpv1u_teid_data_p); //hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, teid, (void **)&gtpv1u_teid_data_p);
hash_rc = HASH_TABLE_OK;
gtpv1u_teid_data_p=(char *)malloc(1024);
gtpv1u_teid_data_p->enb_id=0xe00,
gtpv1u_teid_data_p->ue_id=0,
gtpv1u_teid_data_p->eps_bearer_id=5;
if (hash_rc == HASH_TABLE_OK) { if (hash_rc == HASH_TABLE_OK) {
#if defined(LOG_GTPU) && LOG_GTPU > 0 #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", 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",
...@@ -175,11 +180,16 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req( ...@@ -175,11 +180,16 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
0,0, 0,0,
(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
buffer_len); buffer_len);
ctxt.instance=0;
ctxt.module_id=0;
ctxt.rnti=0x1234;
ctxt.eNB_index=0;
result = pdcp_data_req( result = pdcp_data_req(
&ctxt, &ctxt,
SRB_FLAG_NO, SRB_FLAG_NO,
(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, //(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
1,
0, // mui 0, // mui
SDU_CONFIRM_NO, // confirm SDU_CONFIRM_NO, // confirm
buffer_len, buffer_len,
......
...@@ -540,9 +540,13 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, ...@@ -540,9 +540,13 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
tunnelEndPointKey.teid = ntohl(msgHdr->teid); tunnelEndPointKey.teid = ntohl(msgHdr->teid);
pTunnelEndPoint = RB_FIND(NwGtpv1uTunnelEndPointIdentifierMap, //pTunnelEndPoint = RB_FIND(NwGtpv1uTunnelEndPointIdentifierMap,
&(thiz->teidMap), &tunnelEndPointKey); // &(thiz->teidMap), &tunnelEndPointKey);
pTunnelEndPoint=(char*)malloc(1024);
pTunnelEndPoint->teid=0x01;
pTunnelEndPoint->peerAddr=peerIp;
pTunnelEndPoint->hUlpSession = 0x12;
//pTunnelEndPoint->pStack->ulp.hUlp = 0x34;
if(pTunnelEndPoint) { if(pTunnelEndPoint) {
NwGtpv1uMsgHandleT hMsg; NwGtpv1uMsgHandleT hMsg;
...@@ -550,7 +554,7 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, ...@@ -550,7 +554,7 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
(uint8_t *)gpdu, (uint8_t *)gpdu,
gpduLen, gpduLen,
&hMsg); &hMsg);
rc=NW_GTPV1U_OK;
/* /*
uint8_t* msgBuf; uint8_t* msgBuf;
uint32_t msgBufLen; uint32_t msgBufLen;
...@@ -558,10 +562,13 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, ...@@ -558,10 +562,13 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
*/ */
if(NW_GTPV1U_OK == rc) { if(NW_GTPV1U_OK == rc) {
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
#if defined(LOG_GTPU) && LOG_GTPU > 0 //#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", 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))); ntohl(msgHdr->teid), gpduLen, pMsg->msgLen, pMsg->msgBufLen, NW_IPV4_ADDR_FORMAT((peerIp)));
#endif printf("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( MSC_LOG_RX_MESSAGE(
(thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW,
(thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB,
...@@ -570,7 +577,7 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, ...@@ -570,7 +577,7 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
" G-PDU ltid %u size %u", " G-PDU ltid %u size %u",
tunnelEndPointKey.teid, tunnelEndPointKey.teid,
gpduLen); gpduLen);
//pTunnelEndPoint->pStack->ulp.ulpReqCallback = gtpv1u_gNB_process_stack_req;
rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg);
} }
} else { } else {
...@@ -861,8 +868,8 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, ...@@ -861,8 +868,8 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
#endif #endif
thiz = (NwGtpv1uStackT *) hGtpuStackHandle; thiz = (NwGtpv1uStackT *) hGtpuStackHandle;
NW_ASSERT(thiz);
NW_ASSERT(thiz);
msgType = *((uint8_t *)(udpData + 1)); msgType = *((uint8_t *)(udpData + 1));
switch(msgType) { switch(msgType) {
...@@ -891,10 +898,15 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, ...@@ -891,10 +898,15 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
break; break;
case NW_GTP_GPDU: case NW_GTP_GPDU:
#if defined(LOG_GTPU) && LOG_GTPU > 0 //#if defined(LOG_GTPU) && LOG_GTPU > 0
for(int i =1; i<= udpDataLen; i++){
printf("%02x ", udpData[i-1]);
if(i % 20 == 0)printf("\n");
}
GTPU_DEBUG("NW_GTP_GPDU: DATA COMING FROM UDP\n"); GTPU_DEBUG("NW_GTP_GPDU: DATA COMING FROM UDP\n");
#endif printf("NW_GTP_GPDU: DATA COMING FROM UDP len%d\n,port=%u,address%x",udpDataLen,peerPort,peerIp);
ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp); ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp);
//#endif
break; break;
case NW_GTP_END_MARKER: case NW_GTP_END_MARKER:
......
...@@ -280,10 +280,12 @@ nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, ...@@ -280,10 +280,12 @@ nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
pMsg->msgBufOffset = (uint32_t)(pBuf - pMsg->msgBuf); pMsg->msgBufOffset = (uint32_t)(pBuf - pMsg->msgBuf);
pMsg->msgBufLen = bufLen - pMsg->msgBufOffset; pMsg->msgBufLen = bufLen - pMsg->msgBufOffset;
pMsg->msgLen = bufLen; pMsg->msgLen = bufLen;
#if defined(LOG_GTPU) && LOG_GTPU > 0 //#if defined(LOG_GTPU) && LOG_GTPU > 0
GTPU_DEBUG("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ", GTPU_DEBUG("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ",
pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset); pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset);
#endif printf("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ",
pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset);
//#endif
*phMsg = (NwGtpv1uMsgHandleT) pMsg; *phMsg = (NwGtpv1uMsgHandleT) pMsg;
return NW_GTPV1U_OK; return NW_GTPV1U_OK;
} }
......
...@@ -106,7 +106,9 @@ nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack *pStack, ...@@ -106,7 +106,9 @@ nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack *pStack,
@param[in,out] pTrxn: Pointer to the trxn. @param[in,out] pTrxn: Pointer to the trxn.
@return NW_GTPV1U_OK on success. @return NW_GTPV1U_OK on success.
*/ */
extern NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
NwGtpv1uUlpHandleT hUlp,
NwGtpv1uUlpApiT *pUlpApi);
NwGtpv1uRcT NwGtpv1uRcT
nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz, nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz,
NwGtpv1uMsgT *pMsg) NwGtpv1uMsgT *pMsg)
...@@ -116,13 +118,16 @@ nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz, ...@@ -116,13 +118,16 @@ nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz,
api.apiType = NW_GTPV1U_ULP_API_RECV_TPDU; api.apiType = NW_GTPV1U_ULP_API_RECV_TPDU;
api.apiInfo.recvMsgInfo.hUlpSession = thiz->hUlpSession; api.apiInfo.recvMsgInfo.hUlpSession = thiz->hUlpSession;
api.apiInfo.recvMsgInfo.teid = thiz->teid; api.apiInfo.recvMsgInfo.teid = 0x01;
//api.apiInfo.recvMsgInfo.teid = thiz->teid;
api.apiInfo.recvMsgInfo.hMsg = (NwGtpv1uMsgHandleT)pMsg; api.apiInfo.recvMsgInfo.hMsg = (NwGtpv1uMsgHandleT)pMsg;
//NW_ASSERT(thiz->pStack->ulp.ulpReqCallback != NULL);
NW_ASSERT(thiz->pStack->ulp.ulpReqCallback != NULL); //thiz->pStack->ulp.ulpReqCallback(thiz->pStack->ulp.hUlp, &api);
thiz->pStack = (char *)malloc(100);
thiz->pStack->ulp.ulpReqCallback(thiz->pStack->ulp.hUlp, &api); thiz->pStack->ulp.hUlp=(char *)malloc(1024);
gtpv1u_gNB_process_stack_req(thiz->pStack->ulp.hUlp, &api);
return rc; return rc;
} }
......
...@@ -265,10 +265,10 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP) ...@@ -265,10 +265,10 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
udp_data_ind_p->peer_port = htons(addr.sin_port); udp_data_ind_p->peer_port = htons(addr.sin_port);
udp_data_ind_p->peer_address = addr.sin_addr.s_addr; udp_data_ind_p->peer_address = addr.sin_addr.s_addr;
#if defined(LOG_UDP) && LOG_UDP > 0 //#if defined(LOG_UDP) && LOG_UDP > 0
LOG_I(UDP_, "Msg of length %d received from %s:%u\n", LOG_I(UDP_, "Msg of length %d received from %s:%u\n",
n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
#endif //#endif
/* TODO: this is a hack. Let's accept failures and do nothing when /* TODO: this is a hack. Let's accept failures and do nothing when
* it happens. Since itti_send_msg_to_task crashes when the message * it happens. Since itti_send_msg_to_task crashes when the message
...@@ -336,6 +336,7 @@ void *udp_eNB_task(void *args_p) ...@@ -336,6 +336,7 @@ void *udp_eNB_task(void *args_p)
#if defined(LOG_UDP) && LOG_UDP > 0 #if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "Received UDP_DATA_REQ\n"); LOG_D(UDP_, "Received UDP_DATA_REQ\n");
#endif #endif
printf("Received UDP_DATA_REQ\n");
int udp_sd = -1; int udp_sd = -1;
ssize_t bytes_written; ssize_t bytes_written;
...@@ -349,8 +350,8 @@ void *udp_eNB_task(void *args_p) ...@@ -349,8 +350,8 @@ void *udp_eNB_task(void *args_p)
peer_addr.sin_family = AF_INET; peer_addr.sin_family = AF_INET;
peer_addr.sin_port = htons(udp_data_req_p->peer_port); peer_addr.sin_port = htons(udp_data_req_p->peer_port);
peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address; //peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address;
peer_addr.sin_addr.s_addr = htonl(udp_data_req_p->peer_address);
pthread_mutex_lock(&udp_socket_list_mutex); pthread_mutex_lock(&udp_socket_list_mutex);
udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p)); udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p));
...@@ -372,7 +373,12 @@ void *udp_eNB_task(void *args_p) ...@@ -372,7 +373,12 @@ void *udp_eNB_task(void *args_p)
pthread_mutex_unlock(&udp_socket_list_mutex); pthread_mutex_unlock(&udp_socket_list_mutex);
//#if defined(LOG_UDP) && LOG_UDP > 0 //#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n", LOG_I(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n",
udp_sd,
udp_data_req_p->buffer_length,
IPV4_ADDR_FORMAT(udp_data_req_p->peer_address),
udp_data_req_p->peer_port);
printf("[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n",
udp_sd, udp_sd,
udp_data_req_p->buffer_length, udp_data_req_p->buffer_length,
IPV4_ADDR_FORMAT(udp_data_req_p->peer_address), IPV4_ADDR_FORMAT(udp_data_req_p->peer_address),
...@@ -387,7 +393,7 @@ void *udp_eNB_task(void *args_p) ...@@ -387,7 +393,7 @@ void *udp_eNB_task(void *args_p)
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
if (bytes_written != udp_data_req_p->buffer_length) { if (bytes_written != udp_data_req_p->buffer_length) {
LOG_E(UDP_, "There was an error while writing to socket %d rc %zd" LOG_I(UDP_, "There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n", "(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n",
udp_sd, bytes_written, errno, strerror(errno)); udp_sd, bytes_written, errno, strerror(errno));
} }
......
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