Hi, Ferruh, Thanks for your advice. I will move the header info into rte_ether.h. It could be better.
-----Original Message----- From: Yigit, Ferruh Sent: Saturday, October 19, 2019 2:50 AM To: Xu, Ting <ting...@intel.com>; dev@dpdk.org Cc: Lu, Wenzhuo <wenzhuo...@intel.com>; Wu, Jingjing <jingjing...@intel.com>; Iremonger, Bernard <bernard.iremon...@intel.com>; Zhang, Qi Z <qi.z.zh...@intel.com> Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: enable GTP header parse and Tx checksum offload On 10/18/2019 5:08 PM, Ting Xu wrote: > This patch enables testpmd to forward GTP packet in csum fwd mode. > GTP header structure (without optional fields and extension header) > and parser function are added. GTPU and GTPC packets are both > supported, with respective UDP destination port and GTP message type. > > Signed-off-by: Ting Xu <ting...@intel.com> > <...> > +/* > + * Parse a GTP protocol header. > + * No optional fields and next extension header type. > + */ > +struct rte_gtp_hdr { > + uint8_t gtp_hdr_info; > + uint8_t msg_type; > + uint16_t msg_len; > + uint32_t teid; > +} __attribute__((__packed__)); > + > +/* GTP header length */ > +#define RTE_ETHER_GTP_HLEN \ > + (sizeof(struct rte_udp_hdr) + sizeof(struct rte_gtp_hdr)) > +/* GTP next protocal type */ > +#define RTE_GTP_TYPE_IPV4 0x40 > +#define RTE_GTP_TYPE_IPV6 0x60 > + > +static void > +parse_gtp(struct rte_udp_hdr *udp_hdr, > + struct testpmd_offload_info *info) { > + struct rte_ipv4_hdr *ipv4_hdr; > + struct rte_ipv6_hdr *ipv6_hdr; > + struct rte_gtp_hdr *gtp_hdr; > + uint8_t gtp_len = sizeof(*gtp_hdr); > + uint8_t ip_ver; > + /* GTP destination port number */ > + uint16_t gtpc_udp_port = 2123; > + uint16_t gtpu_udp_port = 2152; What do you think about moving GTP related information into a gtp header file in net library?