DPDK  22.07.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 /* IPv4 options */
101 #define RTE_IPV4_HDR_OPT_EOL 0
102 #define RTE_IPV4_HDR_OPT_NOP 1
103 #define RTE_IPV4_HDR_OPT_COPIED(v) ((v) & 0x80)
104 #define RTE_IPV4_HDR_OPT_MAX_LEN 40
105 
106 /*
107  * IPv4 address types
108  */
109 #define RTE_IPV4_ANY ((uint32_t)0x00000000)
110 #define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001)
111 #define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000)
112 #define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001)
113 #define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002)
114 #define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff)
116 /*
117  * IPv4 Multicast-related macros
118  */
119 #define RTE_IPV4_MIN_MCAST \
120  RTE_IPV4(224, 0, 0, 0)
121 #define RTE_IPV4_MAX_MCAST \
122  RTE_IPV4(239, 255, 255, 255)
124 #define RTE_IS_IPV4_MCAST(x) \
125  ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST)
126 
128 /* IPv4 default fields values */
129 #define RTE_IPV4_MIN_IHL (0x5)
130 #define RTE_IPV4_VHL_DEF ((IPVERSION << 4) | RTE_IPV4_MIN_IHL)
131 
140 static inline uint8_t
141 rte_ipv4_hdr_len(const struct rte_ipv4_hdr *ipv4_hdr)
142 {
143  return (uint8_t)((ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) *
145 }
146 
160 static inline uint32_t
161 __rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
162 {
163  /* extend strict-aliasing rules */
164  typedef uint16_t __attribute__((__may_alias__)) u16_p;
165  const u16_p *u16_buf = (const u16_p *)buf;
166  const u16_p *end = u16_buf + len / sizeof(*u16_buf);
167 
168  for (; u16_buf != end; ++u16_buf)
169  sum += *u16_buf;
170 
171  /* if length is odd, keeping it byte order independent */
172  if (unlikely(len % 2)) {
173  uint16_t left = 0;
174  *(unsigned char *)&left = *(const unsigned char *)end;
175  sum += left;
176  }
177 
178  return sum;
179 }
180 
190 static inline uint16_t
191 __rte_raw_cksum_reduce(uint32_t sum)
192 {
193  sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
194  sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
195  return (uint16_t)sum;
196 }
197 
208 static inline uint16_t
209 rte_raw_cksum(const void *buf, size_t len)
210 {
211  uint32_t sum;
212 
213  sum = __rte_raw_cksum(buf, len, 0);
214  return __rte_raw_cksum_reduce(sum);
215 }
216 
231 static inline int
232 rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
233  uint16_t *cksum)
234 {
235  const struct rte_mbuf *seg;
236  const char *buf;
237  uint32_t sum, tmp;
238  uint32_t seglen, done;
239 
240  /* easy case: all data in the first segment */
241  if (off + len <= rte_pktmbuf_data_len(m)) {
243  const char *, off), len);
244  return 0;
245  }
246 
247  if (unlikely(off + len > rte_pktmbuf_pkt_len(m)))
248  return -1; /* invalid params, return a dummy value */
249 
250  /* else browse the segment to find offset */
251  seglen = 0;
252  for (seg = m; seg != NULL; seg = seg->next) {
253  seglen = rte_pktmbuf_data_len(seg);
254  if (off < seglen)
255  break;
256  off -= seglen;
257  }
258  RTE_ASSERT(seg != NULL);
259  if (seg == NULL)
260  return -1;
261  seglen -= off;
262  buf = rte_pktmbuf_mtod_offset(seg, const char *, off);
263  if (seglen >= len) {
264  /* all in one segment */
265  *cksum = rte_raw_cksum(buf, len);
266  return 0;
267  }
268 
269  /* hard case: process checksum of several segments */
270  sum = 0;
271  done = 0;
272  for (;;) {
273  tmp = __rte_raw_cksum(buf, seglen, 0);
274  if (done & 1)
275  tmp = rte_bswap16((uint16_t)tmp);
276  sum += tmp;
277  done += seglen;
278  if (done == len)
279  break;
280  seg = seg->next;
281  buf = rte_pktmbuf_mtod(seg, const char *);
282  seglen = rte_pktmbuf_data_len(seg);
283  if (seglen > len - done)
284  seglen = len - done;
285  }
286 
287  *cksum = __rte_raw_cksum_reduce(sum);
288  return 0;
289 }
290 
301 static inline uint16_t
302 rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr)
303 {
304  uint16_t cksum;
305  cksum = rte_raw_cksum(ipv4_hdr, rte_ipv4_hdr_len(ipv4_hdr));
306  return (uint16_t)~cksum;
307 }
308 
327 static inline uint16_t
328 rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
329 {
330  struct ipv4_psd_header {
331  uint32_t src_addr; /* IP address of source host. */
332  uint32_t dst_addr; /* IP address of destination host. */
333  uint8_t zero; /* zero. */
334  uint8_t proto; /* L4 protocol type. */
335  uint16_t len; /* L4 length. */
336  } psd_hdr;
337 
338  uint32_t l3_len;
339 
340  psd_hdr.src_addr = ipv4_hdr->src_addr;
341  psd_hdr.dst_addr = ipv4_hdr->dst_addr;
342  psd_hdr.zero = 0;
343  psd_hdr.proto = ipv4_hdr->next_proto_id;
344  if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
345  psd_hdr.len = 0;
346  } else {
347  l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
348  psd_hdr.len = rte_cpu_to_be_16((uint16_t)(l3_len -
349  rte_ipv4_hdr_len(ipv4_hdr)));
350  }
351  return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
352 }
353 
357 static inline uint16_t
358 __rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
359 {
360  uint32_t cksum;
361  uint32_t l3_len, l4_len;
362  uint8_t ip_hdr_len;
363 
364  ip_hdr_len = rte_ipv4_hdr_len(ipv4_hdr);
365  l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
366  if (l3_len < ip_hdr_len)
367  return 0;
368 
369  l4_len = l3_len - ip_hdr_len;
370 
371  cksum = rte_raw_cksum(l4_hdr, l4_len);
372  cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);
373 
374  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
375 
376  return (uint16_t)cksum;
377 }
378 
391 static inline uint16_t
392 rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
393 {
394  uint16_t cksum = __rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr);
395 
396  cksum = ~cksum;
397 
398  /*
399  * Per RFC 768: If the computed checksum is zero for UDP,
400  * it is transmitted as all ones
401  * (the equivalent in one's complement arithmetic).
402  */
403  if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
404  cksum = 0xffff;
405 
406  return cksum;
407 }
408 
412 static inline uint16_t
413 __rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m,
414  const struct rte_ipv4_hdr *ipv4_hdr,
415  uint16_t l4_off)
416 {
417  uint16_t raw_cksum;
418  uint32_t cksum;
419 
420  if (l4_off > m->pkt_len)
421  return 0;
422 
423  if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum))
424  return 0;
425 
426  cksum = raw_cksum + rte_ipv4_phdr_cksum(ipv4_hdr, 0);
427 
428  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
429 
430  return (uint16_t)cksum;
431 }
432 
448 __rte_experimental
449 static inline uint16_t
450 rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m,
451  const struct rte_ipv4_hdr *ipv4_hdr, uint16_t l4_off)
452 {
453  uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off);
454 
455  cksum = ~cksum;
456 
457  /*
458  * Per RFC 768: If the computed checksum is zero for UDP,
459  * it is transmitted as all ones
460  * (the equivalent in one's complement arithmetic).
461  */
462  if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
463  cksum = 0xffff;
464 
465  return cksum;
466 }
467 
481 __rte_experimental
482 static inline int
483 rte_ipv4_udptcp_cksum_verify(const struct rte_ipv4_hdr *ipv4_hdr,
484  const void *l4_hdr)
485 {
486  uint16_t cksum = __rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr);
487 
488  if (cksum != 0xffff)
489  return -1;
490 
491  return 0;
492 }
493 
512 __rte_experimental
513 static inline uint16_t
515  const struct rte_ipv4_hdr *ipv4_hdr,
516  uint16_t l4_off)
517 {
518  uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off);
519 
520  if (cksum != 0xffff)
521  return -1;
522 
523  return 0;
524 }
525 
529 struct rte_ipv6_hdr {
530  rte_be32_t vtc_flow;
531  rte_be16_t payload_len;
532  uint8_t proto;
533  uint8_t hop_limits;
534  uint8_t src_addr[16];
535  uint8_t dst_addr[16];
538 /* IPv6 vtc_flow: IPv / TC / flow_label */
539 #define RTE_IPV6_HDR_FL_SHIFT 0
540 #define RTE_IPV6_HDR_TC_SHIFT 20
541 #define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
542 #define RTE_IPV6_HDR_TC_MASK (0xff << RTE_IPV6_HDR_TC_SHIFT)
543 #define RTE_IPV6_HDR_DSCP_MASK (0xfc << RTE_IPV6_HDR_TC_SHIFT)
544 #define RTE_IPV6_HDR_ECN_MASK (0x03 << RTE_IPV6_HDR_TC_SHIFT)
545 #define RTE_IPV6_HDR_ECN_CE RTE_IPV6_HDR_ECN_MASK
546 
547 #define RTE_IPV6_MIN_MTU 1280
565 static inline uint16_t
566 rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
567 {
568  uint32_t sum;
569  struct {
570  rte_be32_t len; /* L4 length. */
571  rte_be32_t proto; /* L4 protocol - top 3 bytes must be zero */
572  } psd_hdr;
573 
574  psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
575  if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
576  psd_hdr.len = 0;
577  } else {
578  psd_hdr.len = ipv6_hdr->payload_len;
579  }
580 
581  sum = __rte_raw_cksum(ipv6_hdr->src_addr,
582  sizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr),
583  0);
584  sum = __rte_raw_cksum(&psd_hdr, sizeof(psd_hdr), sum);
585  return __rte_raw_cksum_reduce(sum);
586 }
587 
591 static inline uint16_t
592 __rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
593 {
594  uint32_t cksum;
595  uint32_t l4_len;
596 
597  l4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);
598 
599  cksum = rte_raw_cksum(l4_hdr, l4_len);
600  cksum += rte_ipv6_phdr_cksum(ipv6_hdr, 0);
601 
602  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
603 
604  return (uint16_t)cksum;
605 }
606 
620 static inline uint16_t
621 rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
622 {
623  uint16_t cksum = __rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr);
624 
625  cksum = ~cksum;
626 
627  /*
628  * Per RFC 768: If the computed checksum is zero for UDP,
629  * it is transmitted as all ones
630  * (the equivalent in one's complement arithmetic).
631  */
632  if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
633  cksum = 0xffff;
634 
635  return cksum;
636 }
637 
641 static inline uint16_t
642 __rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m,
643  const struct rte_ipv6_hdr *ipv6_hdr,
644  uint16_t l4_off)
645 {
646  uint16_t raw_cksum;
647  uint32_t cksum;
648 
649  if (l4_off > m->pkt_len)
650  return 0;
651 
652  if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum))
653  return 0;
654 
655  cksum = raw_cksum + rte_ipv6_phdr_cksum(ipv6_hdr, 0);
656 
657  cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
658 
659  return (uint16_t)cksum;
660 }
661 
680 __rte_experimental
681 static inline uint16_t
682 rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m,
683  const struct rte_ipv6_hdr *ipv6_hdr, uint16_t l4_off)
684 {
685  uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off);
686 
687  cksum = ~cksum;
688 
689  /*
690  * Per RFC 768: If the computed checksum is zero for UDP,
691  * it is transmitted as all ones
692  * (the equivalent in one's complement arithmetic).
693  */
694  if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
695  cksum = 0xffff;
696 
697  return cksum;
698 }
699 
714 __rte_experimental
715 static inline int
716 rte_ipv6_udptcp_cksum_verify(const struct rte_ipv6_hdr *ipv6_hdr,
717  const void *l4_hdr)
718 {
719  uint16_t cksum = __rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr);
720 
721  if (cksum != 0xffff)
722  return -1;
723 
724  return 0;
725 }
726 
746 __rte_experimental
747 static inline int
749  const struct rte_ipv6_hdr *ipv6_hdr,
750  uint16_t l4_off)
751 {
752  uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off);
753 
754  if (cksum != 0xffff)
755  return -1;
756 
757  return 0;
758 }
759 
761 #define RTE_IPV6_EHDR_MF_SHIFT 0
762 #define RTE_IPV6_EHDR_MF_MASK 1
763 #define RTE_IPV6_EHDR_FO_SHIFT 3
764 #define RTE_IPV6_EHDR_FO_MASK (~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
765 #define RTE_IPV6_EHDR_FO_ALIGN (1 << RTE_IPV6_EHDR_FO_SHIFT)
766 
767 #define RTE_IPV6_FRAG_USED_MASK (RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
768 
769 #define RTE_IPV6_GET_MF(x) ((x) & RTE_IPV6_EHDR_MF_MASK)
770 #define RTE_IPV6_GET_FO(x) ((x) >> RTE_IPV6_EHDR_FO_SHIFT)
771 
772 #define RTE_IPV6_SET_FRAG_DATA(fo, mf) \
773  (((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
774 
775 struct rte_ipv6_fragment_ext {
776  uint8_t next_header;
777  uint8_t reserved;
778  rte_be16_t frag_data;
779  rte_be32_t id;
780 } __rte_packed;
781 
782 /* IPv6 fragment extension header size */
783 #define RTE_IPV6_FRAG_HDR_SIZE sizeof(struct rte_ipv6_fragment_ext)
784 
801 __rte_experimental
802 static inline int
803 rte_ipv6_get_next_ext(const uint8_t *p, int proto, size_t *ext_len)
804 {
805  int next_proto;
806 
807  switch (proto) {
808  case IPPROTO_AH:
809  next_proto = *p++;
810  *ext_len = (*p + 2) * sizeof(uint32_t);
811  break;
812 
813  case IPPROTO_HOPOPTS:
814  case IPPROTO_ROUTING:
815  case IPPROTO_DSTOPTS:
816  next_proto = *p++;
817  *ext_len = (*p + 1) * sizeof(uint64_t);
818  break;
819 
820  case IPPROTO_FRAGMENT:
821  next_proto = *p;
822  *ext_len = RTE_IPV6_FRAG_HDR_SIZE;
823  break;
824 
825  default:
826  return -EINVAL;
827  }
828 
829  return next_proto;
830 }
831 
832 #ifdef __cplusplus
833 }
834 #endif
835 
836 #endif /* _RTE_IP_H_ */
static uint8_t rte_ipv4_hdr_len(const struct rte_ipv4_hdr *ipv4_hdr)
Definition: rte_ip.h:143
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:234
static uint16_t rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
Definition: rte_ip.h:394
uint32_t rte_be32_t
uint8_t dst_addr[16]
Definition: rte_ip.h:537
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:718
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:452
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:684
uint8_t src_addr[16]
Definition: rte_ip.h:536
static __rte_experimental int rte_ipv6_get_next_ext(const uint8_t *p, int proto, size_t *ext_len)
Definition: rte_ip.h:805
#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:750
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:330
static uint16_t rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
Definition: rte_ip.h:568
#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:534
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:211
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:533
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:485
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:304
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:516
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:623
#define RTE_IPV4_IHL_MULTIPLIER
Definition: rte_ip.h:81