table of contents
rte_ip.h(3) | DPDK | rte_ip.h(3) |
NAME¶
rte_ip.h
SYNOPSIS¶
#include <stdint.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <rte_byteorder.h>
#include <rte_mbuf.h>
Data Structures¶
struct rte_ipv4_hdr
struct rte_ipv6_hdr
struct rte_ipv6_routing_ext
Macros¶
#define RTE_IPV4(a, b, c, d)
#define RTE_IPV4_MAX_PKT_LEN 65535
#define RTE_IPV4_HDR_IHL_MASK (0x0f)
#define RTE_IPV4_IHL_MULTIPLIER (4)
#define RTE_IPV4_ANY ((uint32_t)0x00000000)
#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001)
#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000)
#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001)
#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002)
#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff)
#define RTE_IPV4_MIN_MCAST RTE_IPV4(224, 0, 0, 0)
#define RTE_IPV4_MAX_MCAST RTE_IPV4(239, 255, 255, 255)
#define RTE_IS_IPV4_MCAST(x) ((x) >= RTE_IPV4_MIN_MCAST
&& (x) <= RTE_IPV4_MAX_MCAST)
#define RTE_IPV6_MIN_MTU 1280
#define RTE_IPV6_EHDR_MF_SHIFT 0
Functions¶
static uint8_t rte_ipv4_hdr_len (const struct
rte_ipv4_hdr *ipv4_hdr)
static uint16_t rte_raw_cksum (const void *buf, size_t len)
static int rte_raw_cksum_mbuf (const struct rte_mbuf *m,
uint32_t off, uint32_t len, uint16_t *cksum)
static uint16_t rte_ipv4_cksum (const struct rte_ipv4_hdr
*ipv4_hdr)
static uint16_t rte_ipv4_phdr_cksum (const struct rte_ipv4_hdr
*ipv4_hdr, uint64_t ol_flags)
static uint16_t rte_ipv4_udptcp_cksum (const struct rte_ipv4_hdr
*ipv4_hdr, const void *l4_hdr)
static uint16_t rte_ipv4_udptcp_cksum_mbuf (const struct
rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, uint16_t
l4_off)
static int rte_ipv4_udptcp_cksum_verify (const struct
rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
static int rte_ipv4_udptcp_cksum_mbuf_verify (const struct
rte_mbuf *m, const struct rte_ipv4_hdr *ipv4_hdr, uint16_t
l4_off)
static uint16_t rte_ipv6_phdr_cksum (const struct rte_ipv6_hdr
*ipv6_hdr, uint64_t ol_flags)
static uint16_t rte_ipv6_udptcp_cksum (const struct rte_ipv6_hdr
*ipv6_hdr, const void *l4_hdr)
static uint16_t rte_ipv6_udptcp_cksum_mbuf (const struct
rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, uint16_t
l4_off)
static int rte_ipv6_udptcp_cksum_verify (const struct
rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
static int rte_ipv6_udptcp_cksum_mbuf_verify (const struct
rte_mbuf *m, const struct rte_ipv6_hdr *ipv6_hdr, uint16_t
l4_off)
static int rte_ipv6_get_next_ext (const uint8_t *p, int proto, size_t
*ext_len)
Detailed Description¶
IP-related defines
Definition in file rte_ip.h.
Macro Definition Documentation¶
#define RTE_IPV4(a, b, c, d)¶
Value:
((uint32_t)(((a) & 0xff) << 24) | (((b) & 0xff) << 16) | (((c) & 0xff) << 8) | ((d) & 0xff))Create IPv4 address
Definition at line 67 of file rte_ip.h.
#define RTE_IPV4_MAX_PKT_LEN 65535¶
Maximal IPv4 packet length (including a header)
Definition at line 73 of file rte_ip.h.
#define RTE_IPV4_HDR_IHL_MASK (0x0f)¶
Internet header length mask for version_ihl field
Definition at line 76 of file rte_ip.h.
#define RTE_IPV4_IHL_MULTIPLIER (4)¶
Internet header length field multiplier (IHL field specifies overall header length in number of 4-byte words)
Definition at line 81 of file rte_ip.h.
#define RTE_IPV4_ANY ((uint32_t)0x00000000)¶
0.0.0.0
Definition at line 109 of file rte_ip.h.
#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001)¶
127.0.0.1
Definition at line 110 of file rte_ip.h.
#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000)¶
224.0.0.0
Definition at line 111 of file rte_ip.h.
#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001)¶
224.0.0.1
Definition at line 112 of file rte_ip.h.
#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002)¶
224.0.0.2
Definition at line 113 of file rte_ip.h.
#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff)¶
224.0.0.255
Definition at line 114 of file rte_ip.h.
#define RTE_IPV4_MIN_MCAST RTE_IPV4(224, 0, 0, 0)¶
Minimal IPv4-multicast address
Definition at line 119 of file rte_ip.h.
#define RTE_IPV4_MAX_MCAST RTE_IPV4(239, 255, 255, 255)¶
Maximum IPv4 multicast address
Definition at line 121 of file rte_ip.h.
#define RTE_IS_IPV4_MCAST(x) ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST)¶
check if IPv4 address is multicast
Definition at line 124 of file rte_ip.h.
#define RTE_IPV6_MIN_MTU 1280¶
Minimum MTU for IPv6, see RFC 8200.
Definition at line 566 of file rte_ip.h.
#define RTE_IPV6_EHDR_MF_SHIFT 0¶
IPv6 fragment extension header.
Definition at line 771 of file rte_ip.h.
Function Documentation¶
static uint8_t rte_ipv4_hdr_len (const struct rte_ipv4_hdr * ipv4_hdr) [inline], [static]¶
Get the length of an IPv4 header.
Parameters:
Returns:
Definition at line 143 of file rte_ip.h.
static uint16_t rte_raw_cksum (const void * buf, size_t len) [inline], [static]¶
Process the non-complemented checksum of a buffer.
Parameters:
len Length of the buffer.
Returns:
Definition at line 214 of file rte_ip.h.
static int rte_raw_cksum_mbuf (const struct rte_mbuf * m, uint32_t off, uint32_t len, uint16_t * cksum) [inline], [static]¶
Compute the raw (non complemented) checksum of a packet.
Parameters:
off The offset in bytes to start the checksum.
len The length in bytes of the data to checksum.
cksum A pointer to the checksum, filled on success.
Returns:
Definition at line 237 of file rte_ip.h.
static uint16_t rte_ipv4_cksum (const struct rte_ipv4_hdr * ipv4_hdr) [inline], [static]¶
Process the IPv4 checksum of an IPv4 header.
The checksum field must be set to 0 by the caller.
Parameters:
Returns:
Definition at line 307 of file rte_ip.h.
static uint16_t rte_ipv4_phdr_cksum (const struct rte_ipv4_hdr * ipv4_hdr, uint64_t ol_flags) [inline], [static]¶
Process the pseudo-header checksum of an IPv4 header.
The checksum field must be set to 0 by the caller.
Depending on the ol_flags, the pseudo-header checksum expected by the drivers is not the same. For instance, when TSO is enabled, the IP payload length must not be included in the packet.
When ol_flags is 0, it computes the standard pseudo-header checksum.
Parameters:
ol_flags The ol_flags of the associated mbuf.
Returns:
Definition at line 333 of file rte_ip.h.
static uint16_t rte_ipv4_udptcp_cksum (const struct rte_ipv4_hdr * ipv4_hdr, const void * l4_hdr) [inline], [static]¶
Process the IPv4 UDP or TCP checksum.
The layer 4 checksum must be set to 0 in the L4 header by the caller.
Parameters:
l4_hdr The pointer to the beginning of the L4 header.
Returns:
Definition at line 397 of file rte_ip.h.
static uint16_t rte_ipv4_udptcp_cksum_mbuf (const struct rte_mbuf * m, const struct rte_ipv4_hdr * ipv4_hdr, uint16_t l4_off) [inline], [static]¶
Compute the IPv4 UDP/TCP checksum of a packet.
Parameters:
ipv4_hdr The pointer to the contiguous IPv4 header.
l4_off The offset in bytes to start L4 checksum.
Returns:
Definition at line 451 of file rte_ip.h.
static int rte_ipv4_udptcp_cksum_verify (const struct rte_ipv4_hdr * ipv4_hdr, const void * l4_hdr) [inline], [static]¶
Validate the IPv4 UDP or TCP checksum.
In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0 (i.e. no checksum).
Parameters:
l4_hdr The pointer to the beginning of the L4 header.
Returns:
Definition at line 483 of file rte_ip.h.
static int rte_ipv4_udptcp_cksum_mbuf_verify (const struct rte_mbuf * m, const struct rte_ipv4_hdr * ipv4_hdr, uint16_t l4_off) [inline], [static]¶
Verify the IPv4 UDP/TCP checksum of a packet.
In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0 (i.e. no checksum).
Parameters:
ipv4_hdr The pointer to the contiguous IPv4 header.
l4_off The offset in bytes to start L4 checksum.
Returns:
Definition at line 510 of file rte_ip.h.
static uint16_t rte_ipv6_phdr_cksum (const struct rte_ipv6_hdr * ipv6_hdr, uint64_t ol_flags) [inline], [static]¶
Process the pseudo-header checksum of an IPv6 header.
Depending on the ol_flags, the pseudo-header checksum expected by the drivers is not the same. For instance, when TSO is enabled, the IPv6 payload length must not be included in the packet.
When ol_flags is 0, it computes the standard pseudo-header checksum.
Parameters:
ol_flags The ol_flags of the associated mbuf.
Returns:
Definition at line 585 of file rte_ip.h.
static uint16_t rte_ipv6_udptcp_cksum (const struct rte_ipv6_hdr * ipv6_hdr, const void * l4_hdr) [inline], [static]¶
Process the IPv6 UDP or TCP checksum.
The IPv6 header must not be followed by extension headers. The layer 4 checksum must be set to 0 in the L4 header by the caller.
Parameters:
l4_hdr The pointer to the beginning of the L4 header.
Returns:
Definition at line 640 of file rte_ip.h.
static uint16_t rte_ipv6_udptcp_cksum_mbuf (const struct rte_mbuf * m, const struct rte_ipv6_hdr * ipv6_hdr, uint16_t l4_off) [inline], [static]¶
Process the IPv6 UDP or TCP checksum of a packet.
The IPv6 header must not be followed by extension headers. The layer 4 checksum must be set to 0 in the L4 header by the caller.
Parameters:
ipv6_hdr The pointer to the contiguous IPv6 header.
l4_off The offset in bytes to start L4 checksum.
Returns:
Definition at line 697 of file rte_ip.h.
static int rte_ipv6_udptcp_cksum_verify (const struct rte_ipv6_hdr * ipv6_hdr, const void * l4_hdr) [inline], [static]¶
Validate the IPv6 UDP or TCP checksum.
In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0: this is either invalid or means no checksum in some situations. See 8.1 (Upper-Layer Checksums) in RFC 8200.
Parameters:
l4_hdr The pointer to the beginning of the L4 header.
Returns:
Definition at line 730 of file rte_ip.h.
static int rte_ipv6_udptcp_cksum_mbuf_verify (const struct rte_mbuf * m, const struct rte_ipv6_hdr * ipv6_hdr, uint16_t l4_off) [inline], [static]¶
Validate the IPv6 UDP or TCP checksum of a packet.
In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0: this is either invalid or means no checksum in some situations. See 8.1 (Upper-Layer Checksums) in RFC 8200.
Parameters:
ipv6_hdr The pointer to the contiguous IPv6 header.
l4_off The offset in bytes to start L4 checksum.
Returns:
Definition at line 758 of file rte_ip.h.
static int rte_ipv6_get_next_ext (const uint8_t * p, int proto, size_t * ext_len) [inline], [static]¶
Parse next IPv6 header extension
This function checks if proto number is an IPv6 extensions and parses its data if so, providing information on next header and extension length.
Parameters:
proto Protocol number extracted from the 'next header' field from the IPv6 header or the previous extension.
ext_len Extension data length.
Returns:
Definition at line 812 of file rte_ip.h.
Author¶
Generated automatically by Doxygen for DPDK from the source code.
Thu May 23 2024 | Version 23.11.0 |