DPDK  22.03.0
rte_ip.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 1982, 1986, 1990, 1993
3  * The Regents of the University of California.
4  * Copyright(c) 2010-2014 Intel Corporation.
5  * Copyright(c) 2014 6WIND S.A.
6  * All rights reserved.
7  */
8 
9 #ifndef _RTE_IP_H_
10 #define _RTE_IP_H_
11 
18 #include <stdint.h>
19 
20 #ifdef RTE_EXEC_ENV_WINDOWS
21 #include <ws2tcpip.h>
22 #else
23 #include <sys/socket.h>
24 #include <sys/types.h>
25 #include <netinet/in.h>
26 #include <arpa/inet.h>
27 #include <netinet/ip.h>
28 #include <netinet/ip6.h>
29 #endif
30 
31 #include <rte_byteorder.h>
32 #include <rte_mbuf.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 struct rte_ipv4_hdr {
42  __extension__
43  union {
44  uint8_t version_ihl;
45  struct {
46 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
47  uint8_t ihl:4;
48  uint8_t version:4;
49 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
50  uint8_t version:4;
51  uint8_t ihl:4;
52 #endif
53  };
54  };
55  uint8_t type_of_service;
59  uint8_t time_to_live;
60  uint8_t next_proto_id;
64 } __rte_packed;
65 
67 #define RTE_IPV4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \
68  (((b) & 0xff) << 16) | \
69  (((c) & 0xff) << 8) | \
70  ((d) & 0xff))
71 
73 #define RTE_IPV4_MAX_PKT_LEN 65535
74 
76 #define RTE_IPV4_HDR_IHL_MASK (0x0f)
77 
81 #define RTE_IPV4_IHL_MULTIPLIER (4)
82 
83 /* Type of Service fields */
84 #define RTE_IPV4_HDR_DSCP_MASK (0xfc)
85 #define RTE_IPV4_HDR_ECN_MASK (0x03)
86 #define RTE_IPV4_HDR_ECN_CE RTE_IPV4_HDR_ECN_MASK
87 
88 /* Fragment Offset * Flags. */
89 #define RTE_IPV4_HDR_DF_SHIFT 14
90 #define RTE_IPV4_HDR_MF_SHIFT 13
91 #define RTE_IPV4_HDR_FO_SHIFT 3
92 
93 #define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT)
94 #define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT)
95 
96 #define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1)
97 
98 #define RTE_IPV4_HDR_OFFSET_UNITS 8
99 
100 /*
101  * IPv4 address types
102  */
103 #define RTE_IPV4_ANY ((uint32_t)0x00000000)
104 #define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001)
105 #define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000)
106 #define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001)
107 #define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002)
108 #define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff)
110 /*
111  * IPv4 Multicast-related macros
112  */
113 #define RTE_IPV4_MIN_MCAST \
114  RTE_IPV4(224, 0, 0, 0)
115 #define RTE_IPV4_MAX_MCAST \
116  RTE_IPV4(239, 255, 255, 255)
118 #define RTE_IS_IPV4_MCAST(x) \
119  ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST)
120 
122 /* IPv4 default fields values */
123 #define RTE_IPV4_MIN_IHL (0x5)
124 #define RTE_IPV4_VHL_DEF ((IPVERSION << 4) | RTE_IPV4_MIN_IHL)
125 
134 static inline uint8_t
135 rte_ipv4_hdr_len(const struct rte_ipv4_hdr *ipv4_hdr)
136 {
137  return (uint8_t)((ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) *
139 }
140 
154 static inline uint32_t
155 __rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
156 {
157  /* extend strict-aliasing rules */
158  typedef uint16_t __attribute__((__may_alias__)) u16_p;
159  const u16_p *u16_buf = (const u16_p *)buf;
160  const u16_p *end = u16_buf + len / sizeof(*u16_buf);
161 
162  for (; u16_buf != end; ++u16_buf)
163  sum += *u16_buf;
164 
165  /* if length is odd, keeping it byte order independent */
166  if (unlikely(len % 2)) {
167  uint16_t left = 0;
168  *(unsigned char *)&left = *(const unsigned char *)end;
169  sum += left;
170  }
171 
172  return sum;
173 }
174 
184 static inline uint16_t
185 __rte_raw_cksum_reduce(uint32_t sum)
186 {
187  sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
188  sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
189  return (uint16_t)sum;
190 }
191 
202 static inline uint16_t
203 rte_raw_cksum(const void *buf, size_t len)
204 {
205  uint32_t sum;
206 
207  sum = __rte_raw_cksum(buf, len, 0);
208  return __rte_raw_cksum_reduce(sum);
209 }
210 
225 static inline int
226 rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
227  uint16_t *cksum)
228 {
229  const struct rte_mbuf *seg;
230  const char *buf;
231  uint32_t sum, tmp;
232  uint32_t seglen, done;
233 
234  /* easy case: all data in the first segment */
235  if (off + len <= rte_pktmbuf_data_len(m)) {
237  const char *, off), len);
238  return 0;
239  }
240 
241  if (unlikely(off + len > rte_pktmbuf_pkt_len(m)))
242  return -1; /* invalid params, return a dummy value */
243 
244  /* else browse the segment to find offset */
245  seglen = 0;
246  for (seg = m; seg != NULL; seg = seg->next) {
247  seglen = rte_pktmbuf_data_len(seg);
248  if (off < seglen)
249  break;
250  off -= seglen;
251  }
252  RTE_ASSERT(seg != NULL);
253  if (seg == NULL)
254  return -1;
255  seglen -= off;
256  buf = rte_pktmbuf_mtod_offset(seg, const char *, off);
257  if (seglen >= len) {
258  /* all in one segment */
259  *cksum = rte_raw_cksum(buf, len);
260  return 0;
261  }
262 
263  /* hard case: process checksum of several segments */
264  sum = 0;
265  done = 0;
266  for (;;) {
267  tmp = __rte_raw_cksum(buf, seglen, 0);
268  if (done & 1)
269  tmp = rte_bswap16((uint16_t)tmp);
270  sum += tmp;
271  done += seglen;
272  if (done == len)
273  break;
274  seg = seg->next;
275  buf = rte_pktmbuf_mtod(seg, const char *);
276  seglen = rte_pktmbuf_data_len(seg);
277  if (seglen > len - done)
278  seglen = len - done;
279  }
280 
281  *cksum = __rte_raw_cksum_reduce(sum);
282  return 0;
283 }
284 
295 static inline uint16_t
296 rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr)
297 {
298  uint16_t cksum;
299  cksum = rte_raw_cksum(ipv4_hdr, rte_ipv4_hdr_len(ipv4_hdr));
300  return (uint16_t)~cksum;
301 }
302 
321 static inline uint16_t
322 rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
323 {
324  struct ipv4_psd_header {
325  uint32_t src_addr; /* IP address of source host. */
326  uint32_t dst_addr; /* IP address of destination host. */
327  uint8_t zero; /* zero. */
328  uint8_t proto; /* L4 protocol type. */
329  uint16_t len; /* L4 length. */
330  } psd_hdr;
331 
332  uint32_t l3_len;
333 
334  psd_hdr.src_addr = ipv4_hdr->src_addr;
335  psd_hdr.dst_addr = ipv4_hdr->dst_addr;
336  psd_hdr.zero = 0;
337  psd_hdr.proto = ipv4_hdr->next_proto_id;
338  if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
339  psd_hdr.len = 0;
340  } else {
341  l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
342  psd_hdr.len = rte_cpu_to_be_16((uint16_t)(l3_len -
343  rte_ipv4_hdr_len(ipv4_hdr)));
344  }
345  return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
346 }
347 
351 static inline uint16_t
352 __rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
353 {
354  uint32_t cksum;
355  uint32_t l3_len, l4_len;
356  uint8_t ip_hdr_len;
357 
358  ip_hdr_len = rte_ipv4_hdr_len(ipv4_hdr);
359  l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
360  if (l3_len < ip_hdr_len)
361  return 0;
362 
363  l4_len = l3_len - ip_hdr_len;
364 
365  cksum = rte_raw_cksum(l4_hdr, l4_len);
366  cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);
367 
368  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
369 
370  return (uint16_t)cksum;
371 }
372 
385 static inline uint16_t
386 rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
387 {
388  uint16_t cksum = __rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr);
389 
390  cksum = ~cksum;
391 
392  /*
393  * Per RFC 768: If the computed checksum is zero for UDP,
394  * it is transmitted as all ones
395  * (the equivalent in one's complement arithmetic).
396  */
397  if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
398  cksum = 0xffff;
399 
400  return cksum;
401 }
402 
406 static inline uint16_t
407 __rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m,
408  const struct rte_ipv4_hdr *ipv4_hdr,
409  uint16_t l4_off)
410 {
411  uint16_t raw_cksum;
412  uint32_t cksum;
413 
414  if (l4_off > m->pkt_len)
415  return 0;
416 
417  if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum))
418  return 0;
419 
420  cksum = raw_cksum + rte_ipv4_phdr_cksum(ipv4_hdr, 0);
421 
422  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
423 
424  return (uint16_t)cksum;
425 }
426 
442 __rte_experimental
443 static inline uint16_t
444 rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m,
445  const struct rte_ipv4_hdr *ipv4_hdr, uint16_t l4_off)
446 {
447  uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off);
448 
449  cksum = ~cksum;
450 
451  /*
452  * Per RFC 768: If the computed checksum is zero for UDP,
453  * it is transmitted as all ones
454  * (the equivalent in one's complement arithmetic).
455  */
456  if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
457  cksum = 0xffff;
458 
459  return cksum;
460 }
461 
475 __rte_experimental
476 static inline int
477 rte_ipv4_udptcp_cksum_verify(const struct rte_ipv4_hdr *ipv4_hdr,
478  const void *l4_hdr)
479 {
480  uint16_t cksum = __rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr);
481 
482  if (cksum != 0xffff)
483  return -1;
484 
485  return 0;
486 }
487 
506 __rte_experimental
507 static inline uint16_t
509  const struct rte_ipv4_hdr *ipv4_hdr,
510  uint16_t l4_off)
511 {
512  uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off);
513 
514  if (cksum != 0xffff)
515  return -1;
516 
517  return 0;
518 }
519 
523 struct rte_ipv6_hdr {
524  rte_be32_t vtc_flow;
525  rte_be16_t payload_len;
526  uint8_t proto;
527  uint8_t hop_limits;
528  uint8_t src_addr[16];
529  uint8_t dst_addr[16];
532 /* IPv6 vtc_flow: IPv / TC / flow_label */
533 #define RTE_IPV6_HDR_FL_SHIFT 0
534 #define RTE_IPV6_HDR_TC_SHIFT 20
535 #define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
536 #define RTE_IPV6_HDR_TC_MASK (0xff << RTE_IPV6_HDR_TC_SHIFT)
537 #define RTE_IPV6_HDR_DSCP_MASK (0xfc << RTE_IPV6_HDR_TC_SHIFT)
538 #define RTE_IPV6_HDR_ECN_MASK (0x03 << RTE_IPV6_HDR_TC_SHIFT)
539 #define RTE_IPV6_HDR_ECN_CE RTE_IPV6_HDR_ECN_MASK
540 
541 #define RTE_IPV6_MIN_MTU 1280
559 static inline uint16_t
560 rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
561 {
562  uint32_t sum;
563  struct {
564  rte_be32_t len; /* L4 length. */
565  rte_be32_t proto; /* L4 protocol - top 3 bytes must be zero */
566  } psd_hdr;
567 
568  psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
569  if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
570  psd_hdr.len = 0;
571  } else {
572  psd_hdr.len = ipv6_hdr->payload_len;
573  }
574 
575  sum = __rte_raw_cksum(ipv6_hdr->src_addr,
576  sizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr),
577  0);
578  sum = __rte_raw_cksum(&psd_hdr, sizeof(psd_hdr), sum);
579  return __rte_raw_cksum_reduce(sum);
580 }
581 
585 static inline uint16_t
586 __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
587 {
588  uint32_t cksum;
589  uint32_t l4_len;
590 
591  l4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);
592 
593  cksum = rte_raw_cksum(l4_hdr, l4_len);
594  cksum += rte_ipv6_phdr_cksum(ipv6_hdr, 0);
595 
596  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
597 
598  return (uint16_t)cksum;
599 }
600 
614 static inline uint16_t
615 rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
616 {
617  uint16_t cksum = __rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr);
618 
619  cksum = ~cksum;
620 
621  /*
622  * Per RFC 768: If the computed checksum is zero for UDP,
623  * it is transmitted as all ones
624  * (the equivalent in one's complement arithmetic).
625  */
626  if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
627  cksum = 0xffff;
628 
629  return cksum;
630 }
631 
635 static inline uint16_t
636 __rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m,
637  const struct rte_ipv6_hdr *ipv6_hdr,
638  uint16_t l4_off)
639 {
640  uint16_t raw_cksum;
641  uint32_t cksum;
642 
643  if (l4_off > m->pkt_len)
644  return 0;
645 
646  if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum))
647  return 0;
648 
649  cksum = raw_cksum + rte_ipv6_phdr_cksum(ipv6_hdr, 0);
650 
651  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
652 
653  return (uint16_t)cksum;
654 }
655 
674 __rte_experimental
675 static inline uint16_t
676 rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m,
677  const struct rte_ipv6_hdr *ipv6_hdr, uint16_t l4_off)
678 {
679  uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off);
680 
681  cksum = ~cksum;
682 
683  /*
684  * Per RFC 768: If the computed checksum is zero for UDP,
685  * it is transmitted as all ones
686  * (the equivalent in one's complement arithmetic).
687  */
688  if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
689  cksum = 0xffff;
690 
691  return cksum;
692 }
693 
708 __rte_experimental
709 static inline int
710 rte_ipv6_udptcp_cksum_verify(const struct rte_ipv6_hdr *ipv6_hdr,
711  const void *l4_hdr)
712 {
713  uint16_t cksum = __rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr);
714 
715  if (cksum != 0xffff)
716  return -1;
717 
718  return 0;
719 }
720 
740 __rte_experimental
741 static inline int
743  const struct rte_ipv6_hdr *ipv6_hdr,
744  uint16_t l4_off)
745 {
746  uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off);
747 
748  if (cksum != 0xffff)
749  return -1;
750 
751  return 0;
752 }
753 
755 #define RTE_IPV6_EHDR_MF_SHIFT 0
756 #define RTE_IPV6_EHDR_MF_MASK 1
757 #define RTE_IPV6_EHDR_FO_SHIFT 3
758 #define RTE_IPV6_EHDR_FO_MASK (~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
759 #define RTE_IPV6_EHDR_FO_ALIGN (1 << RTE_IPV6_EHDR_FO_SHIFT)
760 
761 #define RTE_IPV6_FRAG_USED_MASK (RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
762 
763 #define RTE_IPV6_GET_MF(x) ((x) & RTE_IPV6_EHDR_MF_MASK)
764 #define RTE_IPV6_GET_FO(x) ((x) >> RTE_IPV6_EHDR_FO_SHIFT)
765 
766 #define RTE_IPV6_SET_FRAG_DATA(fo, mf) \
767  (((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
768 
769 struct rte_ipv6_fragment_ext {
770  uint8_t next_header;
771  uint8_t reserved;
772  rte_be16_t frag_data;
773  rte_be32_t id;
774 } __rte_packed;
775 
776 /* IPv6 fragment extension header size */
777 #define RTE_IPV6_FRAG_HDR_SIZE sizeof(struct rte_ipv6_fragment_ext)
778 
795 __rte_experimental
796 static inline int
797 rte_ipv6_get_next_ext(const uint8_t *p, int proto, size_t *ext_len)
798 {
799  int next_proto;
800 
801  switch (proto) {
802  case IPPROTO_AH:
803  next_proto = *p++;
804  *ext_len = (*p + 2) * sizeof(uint32_t);
805  break;
806 
807  case IPPROTO_HOPOPTS:
808  case IPPROTO_ROUTING:
809  case IPPROTO_DSTOPTS:
810  next_proto = *p++;
811  *ext_len = (*p + 1) * sizeof(uint64_t);
812  break;
813 
814  case IPPROTO_FRAGMENT:
815  next_proto = *p;
816  *ext_len = RTE_IPV6_FRAG_HDR_SIZE;
817  break;
818 
819  default:
820  return -EINVAL;
821  }
822 
823  return next_proto;
824 }
825 
826 #ifdef __cplusplus
827 }
828 #endif
829 
830 #endif /* _RTE_IP_H_ */
static uint8_t rte_ipv4_hdr_len(const struct rte_ipv4_hdr *ipv4_hdr)
Definition: rte_ip.h:137
struct rte_mbuf * next
#define __rte_packed
Definition: rte_common.h:86
static int rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, uint16_t *cksum)
Definition: rte_ip.h:228
static uint16_t rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
Definition: rte_ip.h:388
uint32_t rte_be32_t
uint8_t dst_addr[16]
Definition: rte_ip.h:531
rte_be16_t fragment_offset
Definition: rte_ip.h:58
uint8_t version_ihl
Definition: rte_ip.h:44
static uint16_t rte_bswap16(uint16_t _x)
static __rte_experimental int rte_ipv6_udptcp_cksum_verify(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
Definition: rte_ip.h:712
rte_be32_t dst_addr
Definition: rte_ip.h:63
static __rte_experimental uint16_t rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, uint16_t l4_off)
Definition: rte_ip.h:446
rte_be32_t src_addr
Definition: rte_ip.h:62
static __rte_experimental uint16_t rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, uint16_t l4_off)
Definition: rte_ip.h:678
uint8_t src_addr[16]
Definition: rte_ip.h:530
static __rte_experimental int rte_ipv6_get_next_ext(const uint8_t *p, int proto, size_t *ext_len)
Definition: rte_ip.h:799
#define rte_pktmbuf_mtod_offset(m, t, o)
static __rte_experimental int rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, uint16_t l4_off)
Definition: rte_ip.h:744
static rte_be16_t rte_cpu_to_be_16(uint16_t x)
#define unlikely(x)
static uint16_t rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
Definition: rte_ip.h:324
static uint16_t rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
Definition: rte_ip.h:562
#define rte_pktmbuf_mtod(m, t)
#define rte_pktmbuf_pkt_len(m)
Definition: rte_mbuf.h:1522
uint8_t type_of_service
Definition: rte_ip.h:55
uint8_t time_to_live
Definition: rte_ip.h:59
uint8_t proto
Definition: rte_ip.h:528
rte_be16_t packet_id
Definition: rte_ip.h:57
static uint16_t rte_raw_cksum(const void *buf, size_t len)
Definition: rte_ip.h:205
uint64_t ol_flags
uint32_t pkt_len
#define rte_pktmbuf_data_len(m)
Definition: rte_mbuf.h:1532
#define RTE_MBUF_F_TX_TCP_SEG
uint8_t next_proto_id
Definition: rte_ip.h:60
rte_be16_t payload_len
Definition: rte_ip.h:527
rte_be16_t total_length
Definition: rte_ip.h:56
uint8_t ihl
Definition: rte_ip.h:47
uint16_t rte_be16_t
#define RTE_IPV4_HDR_IHL_MASK
Definition: rte_ip.h:76
static uint16_t rte_be_to_cpu_16(rte_be16_t x)
static __rte_experimental int rte_ipv4_udptcp_cksum_verify(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
Definition: rte_ip.h:479
rte_be16_t hdr_checksum
Definition: rte_ip.h:61
static uint16_t rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr)
Definition: rte_ip.h:298
static __rte_experimental uint16_t rte_ipv4_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, uint16_t l4_off)
Definition: rte_ip.h:510
uint8_t version
Definition: rte_ip.h:48
static uint16_t rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
Definition: rte_ip.h:617
#define RTE_IPV4_IHL_MULTIPLIER
Definition: rte_ip.h:81