X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_gso%2Fgso_common.h;h=145ea495335e7a9f6a6b0ca32d4e5bec7a984131;hb=da4ff1c39854d1c2d922c4959aac1c6fd6c182b1;hp=a8ad638ef24baf8071705fb9bfcddb17b2d601aa;hpb=119583797b6ae44990934d7b965e76463530ca7a;p=dpdk.git diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index a8ad638ef2..145ea49533 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -39,6 +39,7 @@ #include #include #include +#include #define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) @@ -49,6 +50,35 @@ #define IS_IPV4_TCP(flag) (((flag) & (PKT_TX_TCP_SEG | PKT_TX_IPV4)) == \ (PKT_TX_TCP_SEG | PKT_TX_IPV4)) +#define IS_IPV4_VXLAN_TCP4(flag) (((flag) & (PKT_TX_TCP_SEG | PKT_TX_IPV4 | \ + PKT_TX_OUTER_IPV4 | PKT_TX_TUNNEL_VXLAN)) == \ + (PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \ + PKT_TX_TUNNEL_VXLAN)) + +#define IS_IPV4_GRE_TCP4(flag) (((flag) & (PKT_TX_TCP_SEG | PKT_TX_IPV4 | \ + PKT_TX_OUTER_IPV4 | PKT_TX_TUNNEL_GRE)) == \ + (PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \ + PKT_TX_TUNNEL_GRE)) + +/** + * Internal function which updates the UDP header of a packet, following + * segmentation. This is required to update the header's datagram length field. + * + * @param pkt + * The packet containing the UDP header. + * @param udp_offset + * The offset of the UDP header from the start of the packet. + */ +static inline void +update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) +{ + struct udp_hdr *udp_hdr; + + udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_offset); + udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); +} + /** * Internal function which updates the TCP header of a packet, following * segmentation. This is required to update the header's 'sent' sequence