X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcu_stub%2Fcu_stub_egtp.h;h=4decfda12bf77a100e3c64a735b655d0adf2d87b;hb=c449cf0b0cc8794c2e2d28dcc4c9bd8b9534e697;hp=ba0c1316a02e0eeb7131e7f257db1bec0283e118;hpb=3235ecfc7414aa0b72d0ad50db63ae8b5626045b;p=o-du%2Fl2.git diff --git a/src/cu_stub/cu_stub_egtp.h b/src/cu_stub/cu_stub_egtp.h index ba0c1316a..4decfda12 100644 --- a/src/cu_stub/cu_stub_egtp.h +++ b/src/cu_stub/cu_stub_egtp.h @@ -21,14 +21,7 @@ #ifndef __CU_STUB_EGTP_H__ #define __CU_STUB_EGTP_H__ -#include "cu_stub.h" -#include "cm_inet.h" -#include "cm_tpt.h" - -#include "cm_inet.x" -#include "cm_tpt.x" - -#define EGTP_DFLT_PORT 2152 +#define EGTP_RECVR_PORT 2152 /* As per the spec 29.281, the registered port number for GTP-U is 2152 */ #define EGTP_TNL_MGMT_ADD 1 #define EGTP_TNL_MGMT_MOD 2 #define EGTP_TNL_MGMT_DEL 3 @@ -47,8 +40,15 @@ #define EGTP_MASK_BIT7 0x40 #define EGTP_MASK_BIT8 0x80 -U8 sockType; -U8 protType; +/*VALID Tunnel ID*/ +#define MIN_TEID 1 /*[Spec 29.281,Sec 5.1]: All Zero TEIDs are never assigned for setting up GTP-U Tunnel*/ +#define MAX_TEID MAX_NUM_DRB * MAX_NUM_UE /*[Spec 29.281]: Max limit is not mentioned but as per GTP-U Header Format, TEID occupies 4 octets */ + +#define NUM_TUNNEL_TO_PUMP_DATA 4 +#define NUM_DL_PACKETS 1 + +uint8_t sockType; +uint8_t protType; typedef enum egtpMsgType { @@ -65,18 +65,18 @@ typedef enum egtpMsgType /*Extension Header */ typedef struct egtpExtHdr { - TknU16 udpPort; /**< UDP Port */ - TknU16 pdcpNmb; /**< PDCP Number */ + TknUInt16 udpPort; /**< UDP Port */ + TknUInt16 pdcpNmb; /**< PDCP Number */ }EgtpExtHdr; /*Structure for MsgHdr */ typedef struct egtpMsgHdr { - TknU8 nPdu; /**< N-PDU Number */ - TknU32 seqNum; /**< Sequence Number */ + TknUInt8 nPdu; /**< N-PDU Number */ + TknUInt32 seqNum; /**< Sequence Number */ EgtpExtHdr extHdr; /**< Extension headers present flag */ - U32 teId; /**< Tunnel Endpoint Id */ - U8 msgType; /**< eGTP-U Message Type */ + uint32_t teId; /**< Tunnel Endpoint Id */ + uint8_t msgType; /**< eGTP-U Message Type */ }EgtpMsgHdr; typedef struct egtpMsg @@ -87,9 +87,9 @@ typedef struct egtpMsg typedef struct egtpTnlEvt { - U8 action; - U32 lclTeid; - U32 remTeid; + uint8_t action; + uint32_t lclTeid; + uint32_t remTeid; }EgtpTnlEvt; typedef struct egtpTptSrvr @@ -100,45 +100,65 @@ typedef struct egtpTptSrvr typedef struct EgtpTeIdCb { - U32 teId; /* Local tunnel id */ - U32 remTeId; /* Remote tunnel id */ + uint32_t teId; /* Local tunnel id */ + uint32_t remTeId; /* Remote tunnel id */ struct { - U8 hdr[EGTP_MAX_HDR_LEN]; - U8 cnt; + uint8_t hdr[EGTP_MAX_HDR_LEN]; + uint8_t cnt; }preEncodedHdr; /* Pre-encoded header for PDUs on this tunnel */ }EgtpTeIdCb; typedef struct egtpDstCb { + uint32_t duId; CmInetIpAddr dstIp; /* destination IP */ - U16 dstPort; /* Remote port that sends data */ + uint16_t dstPort; /* Remote port that sends data */ EgtpTptSrvr sendTptSrvr; /* Transport server for sending UDP msg to */ - U32 numTunn; /* Number of tunnels */ + uint32_t numTunn; /* Number of tunnels */ CmHashListCp teIdLst; /* Tunnel Id list for this destination */ }EgtpDstCb; +typedef struct egtpAssoc +{ + SctpIpAddr localIp; + uint16_t localPort; + SctpIpAddr destIp; + uint16_t destPort; +}EgtpAssoc; + +typedef struct cuEgtpParams +{ + uint32_t currTunnelId; + uint32_t minTunnelId; + uint32_t maxTunnelId; + uint8_t numDu; + EgtpAssoc egtpAssoc[MAX_DU_SUPPORTED]; +}CuEgtpParams; + typedef struct egtpGlobalCb { - EgtpParams egtpCfg; /* EGTP configuration */ + CuEgtpParams egtpCfg; /* EGTP configuration */ EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */ - EgtpDstCb dstCb; /* Destination endpoint */ + uint8_t numDu; + EgtpDstCb dstCb[MAX_DU_SUPPORTED]; /* Destination endpoint */ + uint8_t gCntPdu[MAX_TEID+1]; /* Maintaining PDU count for each bearer */ }EgtpGlobalCb; -extern EgtpGlobalCb egtpCb; /* EGTP global control block */ +EgtpGlobalCb egtpCb; /* EGTP global control block */ S16 egtpActvInit(); S16 cuEgtpCfgReq(); S16 cuEgtpSrvOpenReq(); -S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt); -S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt); -S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt); -S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt); -S16 cuEgtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx); +S16 cuEgtpTnlMgmtReq(uint32_t duId,EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlAdd(uint32_t duId, EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlMod(uint32_t duId,EgtpTnlEvt tnlEvt); +S16 cuEgtpTnlDel(uint32_t duId,EgtpTnlEvt tnlEvt); +S16 cuEgtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrIdx); S16 cuEgtpHdlRecvMsg(Buffer *mBuf); -S16 cuEgtpDatReq(); -S16 BuildAppMsg(EgtpMsg *egtpMsg); -S16 BuildEgtpMsg(EgtpMsg *egtpMsg); -S16 cuEgtpSendMsg(Buffer *mBuf); +uint16_t cuEgtpDatReq(uint32_t duId, uint8_t teId); +S16 BuildAppMsg(uint32_t duId, EgtpMsg *egtpMsg); +S16 BuildEgtpMsg(uint32_t duId, EgtpMsg *egtpMsg); +S16 cuEgtpSendMsg(uint32_t duId, Buffer *mBuf); S16 cuEgtpDecodeHdr(Buffer *mBuf); #endif