From: Olivier Matz Date: Fri, 26 Oct 2018 07:04:02 +0000 (+0200) Subject: net: add rte prefix to ip structure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=37ed914a5d5b6e2d00f8022b721c9dacd22bdfec;p=dpdk.git net: add rte prefix to ip structure Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz --- diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index f526080565..23f16bab38 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -100,7 +100,7 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) +parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; @@ -117,11 +117,11 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) /* Parse an IPv6 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) +parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ @@ -140,8 +140,8 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; @@ -155,11 +155,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) switch (info->ethertype) { case _htons(RTE_ETHER_TYPE_IPv4): - ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; case _htons(RTE_ETHER_TYPE_IPv6): - ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; default: @@ -205,8 +205,8 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); @@ -225,7 +225,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)vxlan_gpe_hdr + + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); @@ -239,7 +239,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); @@ -268,8 +268,8 @@ static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; gre_len += sizeof(struct simple_gre_hdr); @@ -288,7 +288,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); @@ -301,7 +301,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gre_hdr + gre_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); @@ -328,8 +328,8 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) static void parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr = encap_ip; - struct ipv6_hdr *ipv6_hdr = encap_ip; + struct rte_ipv4_hdr *ipv4_hdr = encap_ip; + struct rte_ipv6_hdr *ipv6_hdr = encap_ip; uint8_t ip_version; ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; @@ -358,7 +358,7 @@ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { - struct ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -449,8 +449,8 @@ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, uint64_t tx_offloads, int tso_enabled) { - struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; - struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 47fb011a18..e626015417 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -120,7 +120,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mempool *mbp; struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags; @@ -176,7 +176,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); memset(ip_hdr, 0, sizeof(*ip_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -206,7 +206,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; next_flow = (next_flow + 1) % cfg_n_flows; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 4bf3fed647..146293175d 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,7 +278,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; + struct rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -413,7 +413,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -426,7 +426,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f151492523..d2ebb11054 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -99,7 +99,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 4c57a2a567..0ee1cec23c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -130,7 +130,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index ae094ab947..5d76e471e6 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -51,7 +51,7 @@ #define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static void @@ -92,7 +92,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, struct udp_hdr *udp_hdr, uint16_t pkt_data_len) { @@ -112,7 +112,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; @@ -239,7 +239,7 @@ pkt_burst_transmit(struct fwd_stream *fs) sizeof(struct rte_ether_hdr)); copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the @@ -251,7 +251,7 @@ pkt_burst_transmit(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; } nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt); @@ -297,7 +297,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) uint16_t pkt_data_len; pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 312707430d..fe8b18bd31 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -102,8 +102,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; @@ -115,15 +115,15 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { - l3_len = sizeof(struct ipv4_hdr); + l3_len = sizeof(struct rte_ipv4_hdr); ipv4_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, l2_len); l4_proto = ipv4_hdr->next_proto_id; } else { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); ipv6_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv6_hdr *, + struct rte_ipv6_hdr *, l2_len); l4_proto = ipv6_hdr->proto; } diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 395b3ec47f..6887e4dc66 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -154,7 +154,7 @@ To define classification for the IPv6 2-tuple: o .. code-block:: c - struct struct ipv6_hdr { + struct struct rte_ipv6_hdr { uint32_t vtc_flow; /* IP version, traffic class & flow label. */ uint16_t payload_len; /* IP packet length - includes sizeof(ip_header). */ uint8_t proto; /* Protocol, next header. */ @@ -173,7 +173,7 @@ The following array of field definitions can be used: .size = sizeof (uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof (struct ipv6_hdr, proto), + .offset = offsetof (struct rte_ipv6_hdr, proto), }, { @@ -181,7 +181,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof (struct ipv6_hdr, src_addr[0]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[0]), }, { @@ -189,7 +189,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof (struct ipv6_hdr, src_addr[4]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[4]), }, { @@ -197,7 +197,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof (struct ipv6_hdr, src_addr[8]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[8]), }, { @@ -205,7 +205,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof (struct ipv6_hdr, src_addr[12]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[12]), }, }; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index e028f4559d..8172a96c42 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -92,7 +92,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -102,7 +102,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -112,7 +112,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -125,7 +125,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -135,7 +135,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 97bd756a20..0d89be96e1 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 58c4aae92f..bf6c5ea527 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -242,7 +242,7 @@ The get_ipv4_dst_port() function is shown below: int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); m128i data = _mm_loadu_si128(( m128i*)(ipv4_hdr)); @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -306,7 +306,7 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below: .. code-block:: c static inline uint16_t - get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) + get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint8_t next_hop; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index f7dab9e980..12208f4258 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -191,12 +191,12 @@ which tells the node where the packet has to be distributed. efd_value_t data[EFD_BURST_MAX]; const void *key_ptrs[EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; @@ -348,7 +348,7 @@ flow is not handled by the node. static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -356,7 +356,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 46757cf79a..2aa94d7c23 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -587,7 +587,7 @@ static void mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { - struct ipv4_hdr *ipv4_h; + struct rte_ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB struct rte_arp_hdr *arp_h; char dst_ip[16]; @@ -604,7 +604,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ #endif if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); + ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String); @@ -750,13 +750,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr) } static inline uint32_t -ipv4_hash(struct ipv4_hdr *ipv4_hdr) +ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr) { return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr; } static inline uint32_t -ipv6_hash(struct ipv6_hdr *ipv6_hdr) +ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) { unaligned_uint32_t *word_src_addr = (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]); @@ -807,12 +807,12 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, vlan_offset = get_vlan_offset(eth_hdr, &proto); if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); } @@ -846,7 +846,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = 0; if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -873,7 +873,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, } } } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index a514693735..9aa31ad426 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -200,22 +200,22 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; DPAA_DP_LOG(DEBUG, "Calculating checksum for mbuf: %p", mbuf); if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4_EXT)) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } else if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6_EXT)) - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 6de335fb67..84c0c537b0 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -220,7 +220,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, /* setup IPCS* fields */ ctx.lower_setup.ip_fields.ipcss = (uint8_t)l2len; ctx.lower_setup.ip_fields.ipcso = (uint8_t)(l2len + - offsetof(struct ipv4_hdr, hdr_checksum)); + offsetof(struct rte_ipv4_hdr, hdr_checksum)); /* * When doing checksum or TCP segmentation with IPv6 headers, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 7bf8dd44ce..6cf4259fef 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1949,7 +1949,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t i; struct rte_mbuf *m; struct ena_ring *tx_ring = (struct ena_ring *)(tx_queue); - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint64_t ol_flags; uint16_t frag_field; @@ -1966,7 +1966,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (unlikely(m->l2_len == 0)) m->l2_len = sizeof(struct rte_ether_hdr); - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 9d95201ece..ddfa527767 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -176,9 +176,9 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) { - struct ipv4_hdr ip4_mask, ip4_val; - memset(&ip4_mask, 0, sizeof(struct ipv4_hdr)); - memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); + struct rte_ipv4_hdr ip4_mask, ip4_val; + memset(&ip4_mask, 0, sizeof(struct rte_ipv4_hdr)); + memset(&ip4_val, 0, sizeof(struct rte_ipv4_hdr)); if (input->flow.ip4_flow.tos) { ip4_mask.type_of_service = masks->ipv4_mask.tos; @@ -202,7 +202,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV4, FILTER_GENERIC_1_L3, - &ip4_mask, &ip4_val, sizeof(struct ipv4_hdr)); + &ip4_mask, &ip4_val, sizeof(struct rte_ipv4_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { @@ -264,9 +264,9 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) { - struct ipv6_hdr ipv6_mask, ipv6_val; - memset(&ipv6_mask, 0, sizeof(struct ipv6_hdr)); - memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); + struct rte_ipv6_hdr ipv6_mask, ipv6_val; + memset(&ipv6_mask, 0, sizeof(struct rte_ipv6_hdr)); + memset(&ipv6_val, 0, sizeof(struct rte_ipv6_hdr)); if (input->flow.ipv6_flow.proto) { ipv6_mask.proto = masks->ipv6_mask.proto; @@ -290,7 +290,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV6, FILTER_GENERIC_1_L3, - &ipv6_mask, &ipv6_val, sizeof(struct ipv6_hdr)); + &ipv6_mask, &ipv6_val, sizeof(struct rte_ipv6_hdr)); } } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index c964a5e78d..ede89c8f86 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -347,7 +347,7 @@ enic_copy_item_ipv4_v1(const struct rte_flow_item *item, const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct ipv4_hdr supported_mask = { + struct rte_ipv4_hdr supported_mask = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }; @@ -635,19 +635,19 @@ enic_copy_item_ipv4_v2(const struct rte_flow_item *item, mask = &rte_flow_item_ipv4_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { /* Inner IPv4 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct ipv4_hdr)) > + if ((*inner_ofst + sizeof(struct rte_ipv4_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct ipv4_hdr)); + mask, sizeof(struct rte_ipv4_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct ipv4_hdr)); - *inner_ofst += sizeof(struct ipv4_hdr); + spec, sizeof(struct rte_ipv4_hdr)); + *inner_ofst += sizeof(struct rte_ipv4_hdr); } return 0; } @@ -685,19 +685,19 @@ enic_copy_item_ipv6_v2(const struct rte_flow_item *item, if (*inner_ofst == 0) { memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } else { /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct ipv6_hdr)) > + if ((*inner_ofst + sizeof(struct rte_ipv6_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct ipv6_hdr)); + mask, sizeof(struct rte_ipv6_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct ipv6_hdr)); - *inner_ofst += sizeof(struct ipv6_hdr); + spec, sizeof(struct rte_ipv6_hdr)); + *inner_ofst += sizeof(struct rte_ipv6_hdr); } return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4aaf27f7c9..b20f30fb40 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -686,8 +686,8 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; static const uint8_t next_proto[] = { [RTE_ETH_FLOW_FRAG_IPV4] = IPPROTO_IP, [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] = IPPROTO_TCP, @@ -723,7 +723,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: case RTE_ETH_FLOW_FRAG_IPV4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -743,14 +743,14 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, */ ip->src_addr = fdir_input->flow.ip4_flow.dst_ip; ip->dst_addr = fdir_input->flow.ip4_flow.src_ip; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: case RTE_ETH_FLOW_FRAG_IPV6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -776,7 +776,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, rte_memcpy(&(ip6->dst_addr), &(fdir_input->flow.ipv6_flow.src_ip), IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); break; default: PMD_DRV_LOG(ERR, "unknown flow type %u.", @@ -960,8 +960,8 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; bool is_customized_pctype = fdir_input->flow_ext.customized_pctype; static const uint8_t next_proto[] = { @@ -1007,7 +1007,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV4 || is_customized_pctype) { - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -1034,13 +1034,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) ip->next_proto_id = IPPROTO_UDP; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -1066,7 +1066,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); @@ -1093,8 +1093,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, struct tcp_hdr *tcp; struct sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; - struct ipv4_hdr *gtp_ipv4; - struct ipv6_hdr *gtp_ipv6; + struct rte_ipv4_hdr *gtp_ipv4; + struct rte_ipv6_hdr *gtp_ipv6; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -1232,7 +1232,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv4 = (struct ipv4_hdr *) + gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv4->version_ihl = @@ -1242,11 +1242,11 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, rte_cpu_to_be_16( I40E_FDIR_INNER_IP_DEFAULT_LEN); payload = (unsigned char *)gtp_ipv4 + - sizeof(struct ipv4_hdr); + sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv6 = (struct ipv6_hdr *) + gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv6->vtc_flow = @@ -1260,7 +1260,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp_ipv6->hop_limits = I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; payload = (unsigned char *)gtp_ipv6 + - sizeof(struct ipv6_hdr); + sizeof(struct rte_ipv6_hdr); } else payload = (unsigned char *)gtp + sizeof(struct rte_flow_item_gtp); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index bd70fce248..d99e2c5266 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2494,13 +2494,13 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: - attributes->l3.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = input->flow.ip4_flow.src_ip, .dst_addr = input->flow.ip4_flow.dst_ip, .time_to_live = input->flow.ip4_flow.ttl, .type_of_service = input->flow.ip4_flow.tos, }; - attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3_mask.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = mask->ipv4_mask.src_ip, .dst_addr = mask->ipv4_mask.dst_ip, .time_to_live = mask->ipv4_mask.ttl, @@ -2516,7 +2516,7 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: - attributes->l3.ipv6.hdr = (struct ipv6_hdr){ + attributes->l3.ipv6.hdr = (struct rte_ipv6_hdr){ .hop_limits = input->flow.ipv6_flow.hop_limits, .proto = input->flow.ipv6_flow.proto, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index e4dea1197e..f287762a45 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -408,12 +408,12 @@ flow_tcf_pedit_key_set_dec_ttl(const struct rte_flow_action *actions, if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP4; p_parser->keys[idx].off = - offsetof(struct ipv4_hdr, time_to_live); + offsetof(struct rte_ipv4_hdr, time_to_live); } if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; p_parser->keys[idx].off = - offsetof(struct ipv6_hdr, hop_limits); + offsetof(struct rte_ipv6_hdr, hop_limits); } if (actions->type == RTE_FLOW_ACTION_TYPE_DEC_TTL) { p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_ADD; @@ -477,8 +477,8 @@ flow_tcf_pedit_key_set_ipv6_addr(const struct rte_flow_action *actions, int keys = NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); int off_base = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? - offsetof(struct ipv6_hdr, src_addr) : - offsetof(struct ipv6_hdr, dst_addr); + offsetof(struct rte_ipv6_hdr, src_addr) : + offsetof(struct rte_ipv6_hdr, dst_addr); const struct rte_flow_action_set_ipv6 *conf = (const struct rte_flow_action_set_ipv6 *)actions->conf; @@ -512,8 +512,8 @@ flow_tcf_pedit_key_set_ipv4_addr(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? - offsetof(struct ipv4_hdr, src_addr) : - offsetof(struct ipv4_hdr, dst_addr); + offsetof(struct rte_ipv4_hdr, src_addr) : + offsetof(struct rte_ipv4_hdr, dst_addr); p_parser->keys[idx].mask = ~UINT32_MAX; p_parser->keys[idx].val = ((const struct rte_flow_action_set_ipv4 *) diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index 7389865753..381b54e291 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -1170,7 +1170,7 @@ mrvl_parse_ip6(const struct rte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL; - struct ipv6_hdr zero; + struct rte_ipv6_hdr zero; uint32_t flow_mask; int ret; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 12c83f46d1..34299b9933 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -457,8 +457,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); uint16_t *ether_type; uint8_t *raw_pkt; - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; struct tcp_hdr *tcp; uint16_t len; @@ -474,14 +474,14 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, *ether_type = rte_cpu_to_be_16(arfs->tuple.eth_proto); switch (arfs->tuple.eth_proto) { case RTE_ETHER_TYPE_IPv4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; - ip->total_length = sizeof(struct ipv4_hdr); + ip->total_length = sizeof(struct rte_ipv4_hdr); ip->next_proto_id = arfs->tuple.ip_proto; ip->time_to_live = QEDE_FDIR_IPV4_DEF_TTL; ip->dst_addr = arfs->tuple.dst_ipv4; ip->src_addr = arfs->tuple.src_ipv4; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); params->ipv4 = true; raw_pkt = (uint8_t *)buff; @@ -507,7 +507,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, } break; case RTE_ETHER_TYPE_IPv6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); @@ -516,7 +516,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, IPV6_ADDR_LEN); rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; raw_pkt = (uint8_t *)buff; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 103eeb5091..2debac2940 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -903,8 +903,8 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; @@ -924,14 +924,14 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, len); if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) packet_type |= RTE_PTYPE_L4_UDP; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) @@ -1093,7 +1093,7 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags) static inline uint8_t qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) { - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; uint16_t pkt_csum; uint16_t calc_csum; uint16_t val; @@ -1104,7 +1104,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) if (unlikely(val)) { m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index bcd3153ff3..e52de8ebd0 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -423,9 +423,9 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, switch (first_m_seg->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)) { case PKT_TX_IPV4: { - const struct ipv4_hdr *iphe4; + const struct rte_ipv4_hdr *iphe4; - iphe4 = (const struct ipv4_hdr *)(hdr_addr + iph_off); + iphe4 = (const struct rte_ipv4_hdr *)(hdr_addr + iph_off); rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); packet_id = rte_be_to_cpu_16(packet_id); break; diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 076a25d447..cfa5c037a6 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -146,9 +146,9 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, /* Handle IP header */ if (m->ol_flags & PKT_TX_IPV4) { - const struct ipv4_hdr *iphe4; + const struct rte_ipv4_hdr *iphe4; - iphe4 = (const struct ipv4_hdr *)(tsoh + nh_off); + iphe4 = (const struct rte_ipv4_hdr *)(tsoh + nh_off); rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); packet_id = rte_be_to_cpu_16(packet_id); } else if (m->ol_flags & PKT_TX_IPV6) { diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 3d37ba3fee..4e6735c75e 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -592,7 +592,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -601,7 +601,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -610,7 +610,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -619,7 +619,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -629,7 +629,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -641,7 +641,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -650,7 +650,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -658,7 +658,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -666,7 +666,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -683,7 +683,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -691,7 +691,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -699,7 +699,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -707,7 +707,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -716,7 +716,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -726,7 +726,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index f50b12fa08..3d7f56a9ae 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -253,12 +253,12 @@ tap_verify_csum(struct rte_mbuf *mbuf) else if (l2 == RTE_PTYPE_L2_ETHER_QINQ) l2_len += 8; /* Don't verify checksum for packets with discontinuous L2 header */ - if (unlikely(l2_len + sizeof(struct ipv4_hdr) > + if (unlikely(l2_len + sizeof(struct rte_ipv4_hdr) > rte_pktmbuf_data_len(mbuf))) return; l3_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len); if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; /* ihl contains the number of 4-byte words in the header */ l3_len = 4 * (iph->version_ihl & 0xf); @@ -270,7 +270,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) PKT_RX_IP_CKSUM_BAD : PKT_RX_IP_CKSUM_GOOD; } else if (l3 == RTE_PTYPE_L3_IPV6) { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); } else { /* IPv6 extensions are not supported */ return; @@ -461,7 +461,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; iph->hdr_checksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ce91c59f2b..b364508713 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -316,13 +316,13 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) /* common case: header is not fragmented */ if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { - struct ipv4_hdr *iph; - struct ipv6_hdr *ip6h; + struct rte_ipv4_hdr *iph; + struct rte_ipv6_hdr *ip6h; struct tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + iph = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; @@ -331,7 +331,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - m->l3_len); } else { - ip6h = (struct ipv6_hdr *)iph; + ip6h = (struct rte_ipv6_hdr *)iph; ip_paylen = ip6h->payload_len; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index ca3b1ef33b..9f22d273c4 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -665,8 +665,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) { uint32_t hlen, slen; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; char *ptr; @@ -677,20 +677,20 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { - if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) - return hw->mtu - sizeof(struct ipv4_hdr) + if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) + return hw->mtu - sizeof(struct rte_ipv4_hdr) - sizeof(struct tcp_hdr); - ipv4_hdr = (struct ipv4_hdr *)(ptr + hlen); + ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { - if (unlikely(slen < hlen + sizeof(struct ipv6_hdr))) - return hw->mtu - sizeof(struct ipv6_hdr) - + if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) + return hw->mtu - sizeof(struct rte_ipv6_hdr) - sizeof(struct tcp_hdr); - ipv6_hdr = (struct ipv6_hdr *)(ptr + hlen); - hlen += sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); + hlen += sizeof(struct rte_ipv6_hdr); if (unlikely(ipv6_hdr->proto != IPPROTO_TCP)) { int frag; diff --git a/examples/bond/main.c b/examples/bond/main.c index b5b66ebede..b257bf63f3 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -325,7 +325,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; uint16_t rx_cnt; @@ -390,7 +390,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index dfb7db1c91..c75a410f4f 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -99,7 +99,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -109,7 +109,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -119,7 +119,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -132,7 +132,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -142,7 +142,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index f92b249128..42b1d2cb08 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -58,8 +58,8 @@ /* * Default payload in bytes for the IPv6 packet. */ -#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr)) -#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct ipv6_hdr)) +#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct rte_ipv4_hdr)) +#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct rte_ipv6_hdr)) /* * Max number of fragments per packet expected - defined by config file. @@ -251,10 +251,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* if this is an IPv4 packet */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv4_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); /* Find destination port */ @@ -286,12 +286,12 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, } } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if this is an IPv6 packet */ - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; ipv6 = 1; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv6_hdr *); /* Find destination port */ if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index b23d6c09af..1e44fe37c8 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -636,7 +636,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -645,7 +645,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -654,7 +654,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -663,7 +663,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -673,7 +673,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -685,7 +685,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -694,7 +694,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -702,7 +702,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -710,7 +710,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -735,7 +735,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -743,7 +743,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -760,7 +760,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -770,7 +770,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c2a1f92289..00a95e07a7 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -324,10 +324,10 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, /* if packet is IPv4 */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { @@ -351,7 +351,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); } } ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); @@ -366,9 +366,9 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr); @@ -389,7 +389,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); } } diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 0c9c3a749b..c97c11e758 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -306,7 +306,7 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; @@ -316,7 +316,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 787ce3fdbc..7dac6de2d3 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -384,7 +384,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; @@ -397,7 +397,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ipdata_offset = sizeof(struct rte_ether_hdr); - ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + + ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ab8ba046bf..b0e933e031 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -146,7 +146,7 @@ static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len); +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len); #endif static inline void send_single_packet(struct rte_mbuf *m, uint16_t port); @@ -174,8 +174,8 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *d = (unsigned char)(ip & 0xff);\ } while (0) #define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) -#define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) -#define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) +#define OFF_IPV42PROTO (offsetof(struct rte_ipv4_hdr, next_proto_id)) +#define OFF_IPV62PROTO (offsetof(struct rte_ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ rte_pktmbuf_mtod_offset((m), uint8_t *, OFF_ETHHEAD + OFF_IPV42PROTO) #define MBUF_IPV6_2PROTO(m) \ @@ -252,32 +252,32 @@ struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_SRC, - .offset = offsetof(struct ipv4_hdr, src_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, src_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_DST, - .offset = offsetof(struct ipv4_hdr, dst_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id) + + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id) + sizeof(uint16_t), }, }; @@ -314,80 +314,80 @@ struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = { .size = sizeof(uint32_t), .field_index = SRC1_FIELD_IPV6, .input_index = SRC1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC2_FIELD_IPV6, .input_index = SRC2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC3_FIELD_IPV6, .input_index = SRC3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC4_FIELD_IPV6, .input_index = SRC4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST1_FIELD_IPV6, .input_index = DST1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) + - offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST2_FIELD_IPV6, .input_index = DST2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST3_FIELD_IPV6, .input_index = DST3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST4_FIELD_IPV6, .input_index = DST4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint16_t), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint16_t), }, }; @@ -542,8 +542,8 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv4_hdr *, + struct rte_ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); @@ -566,8 +566,8 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv6_hdr *, + struct rte_ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); printf("Packet Src"); @@ -620,11 +620,11 @@ static inline void prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, int index) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ @@ -1281,14 +1281,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -1313,7 +1313,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index d9b752d808..abbfcc29f1 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -424,14 +424,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -456,7 +456,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -481,7 +481,7 @@ print_ipv6_key(struct ipv6_5tuple key) } static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -496,14 +496,14 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -520,7 +520,7 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, } static inline uint16_t -get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, +get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; @@ -536,14 +536,14 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -562,7 +562,7 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint32_t next_hop; @@ -620,7 +620,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; @@ -629,7 +629,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -664,10 +664,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d9b6368065..ebb2378dd0 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -314,14 +314,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -346,7 +346,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -362,7 +362,7 @@ print_key(struct ipv4_5tuple key) } static inline uint16_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -377,14 +377,14 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -402,7 +402,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint32_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { uint32_t next_hop; @@ -418,13 +418,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 1893f8c3a1..293fb1fa26 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 0c68aa01c1..fc7996f88b 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -129,7 +129,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); /* dynamically vec_sel te and ve for MASK_ETH (0x3f) */ diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 0f4fcb427a..7d83ff641a 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -14,7 +14,7 @@ #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -28,7 +28,7 @@ * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index b56b086467..fb55e196d7 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -252,7 +252,7 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv4_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); /* * Get 5 tuple: dst port, src port, dst IP address, @@ -273,7 +273,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv6_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); void *data0 = ipv6_hdr; void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t); void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t); @@ -566,17 +566,17 @@ em_parse_ptype(struct rte_mbuf *m) uint16_t ether_type; void *l3; int hdr_len; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_hdr = (struct ipv4_hdr *)l3; + ipv4_hdr = (struct rte_ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; - if (hdr_len == sizeof(struct ipv4_hdr)) { + if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; @@ -585,7 +585,7 @@ em_parse_ptype(struct rte_mbuf *m) } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - ipv6_hdr = (struct ipv6_hdr *)l3; + ipv6_hdr = (struct rte_ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 4a73363505..62ae1bf303 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -52,9 +52,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 5afe775916..4476a91f30 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint16_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 3ee2304b51..3aaf714280 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); } @@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 8)); + offsetof(struct rte_ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 16)); + offsetof(struct rte_ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); key->xmm[1] = tmpdata1; diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 8156bbb903..7964a92771 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); } @@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 6e7096c012..8307c20dd9 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint8_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 96143d8716..881b0c7c0b 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -82,7 +82,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm *)lookup_struct; return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -94,7 +94,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm6 *)lookup_struct; return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } @@ -102,21 +102,21 @@ static __rte_always_inline uint16_t lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { - struct ipv6_hdr *ipv6_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -135,7 +135,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -146,7 +146,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, ipv6_hdr->dst_addr, &next_hop) == 0) diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 323f853eee..05faa5426d 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -48,9 +48,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index b36e991acc..7c6814252a 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], vector unsigned int *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index a3e42cfa72..d6c0ba64ab 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], int32x4_t *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 4603e0749c..3f637a23d1 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index af2dc47ac2..712c3a7048 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -113,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); ve = vcopyq_laneq_u32(ve, 3, te, 3); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 3349f27478..5919f48b9f 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -109,7 +109,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); te = _mm_blend_epi16(te, ve, MASK_ETH); diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index c4e6b4ac85..ff76c8d5b9 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -495,7 +495,7 @@ app_lcore_worker( for (j = 0; j < bsz_rd; j ++) { struct rte_mbuf *pkt; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst, pos; uint32_t port; @@ -508,7 +508,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 3d2ceea2fc..da5c662039 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -751,14 +751,14 @@ send_packetsx4(uint16_t port, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -783,7 +783,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -802,7 +802,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr)); /* Get 5 tuple: dst port, src port, dst IP address, src IP address and protocol */ @@ -819,7 +819,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, int ret = 0; union ipv6_5tuple_host key; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); __m128i data0 = _mm_loadu_si128((__m128i *)(ipv6_hdr)); __m128i data1 = _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr) + sizeof(__m128i))); @@ -849,7 +849,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -860,7 +860,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } #endif @@ -885,7 +885,7 @@ static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { struct rte_ether_hdr *eth_hdr[8]; - struct ipv4_hdr *ipv4_hdr[8]; + struct rte_ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; @@ -901,21 +901,21 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ - ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, + ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, + ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, + ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, + ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, + ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, + ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, + ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, + ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -968,28 +968,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -1095,13 +1095,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); key->xmm[1] = tmpdata1; @@ -1116,7 +1116,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; - __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; + __attribute__((unused)) struct rte_ipv6_hdr *ipv6_hdr[8]; eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); @@ -1128,21 +1128,21 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ - ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, + ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, + ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, + ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, + ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, + ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, + ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, + ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, + ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); @@ -1229,14 +1229,14 @@ static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -1267,9 +1267,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, @@ -1300,7 +1300,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -1314,7 +1314,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; @@ -1345,7 +1345,7 @@ static __rte_always_inline uint16_t get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -1356,7 +1356,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct, @@ -1372,13 +1372,13 @@ static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; dst_ipv4 = rte_be_to_cpu_32(dst_ipv4); @@ -1402,27 +1402,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 8bec351ec1..44216f9999 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -266,7 +266,7 @@ transmit_packet(struct rte_mbuf *buf) static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -274,7 +274,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index a086c5a779..3e5295433b 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -247,12 +247,12 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], efd_value_t data[RTE_EFD_BURST_MAX]; const void *key_ptrs[RTE_EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 48a46d5366..8088d9412f 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -31,8 +31,8 @@ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint16_t ethertype; info->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -46,15 +46,15 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, switch (ethertype) { case RTE_ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *) + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv4_hdr); + info->outer_l3_len = sizeof(struct rte_ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; case RTE_ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv6_hdr); + info->outer_l3_len = sizeof(struct rte_ipv6_hdr); *l4_proto = ipv6_hdr->proto; break; default: @@ -73,8 +73,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i void *l3_hdr = NULL; uint8_t l4_proto; uint16_t ethertype; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -92,15 +92,15 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; if (ethertype == RTE_ETHER_TYPE_IPv4) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_IPV4; ol_flags |= PKT_TX_IP_CKSUM; - info->l3_len = sizeof(struct ipv4_hdr); + info->l3_len = sizeof(struct rte_ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; + info->l3_len = sizeof(struct rte_ipv6_hdr); l4_proto = ipv6_hdr->proto; ol_flags |= PKT_TX_IPV6; } else @@ -176,10 +176,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); - struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; + struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; @@ -192,7 +192,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - sizeof(struct rte_ether_hdr)); @@ -210,7 +210,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) } m->outer_l2_len = sizeof(struct rte_ether_hdr); - m->outer_l3_len = sizeof(struct ipv4_hdr); + m->outer_l3_len = sizeof(struct rte_ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index 780ae73cc5..689aea4514 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -16,7 +16,7 @@ #define VXLAN_HF_VNI 0x08000000 #define DEFAULT_VXLAN_PORT 4789 -extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 0b6b2d86e6..b2c4155eed 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -48,7 +48,7 @@ /* VXLAN device */ struct vxlan_conf vxdev; -struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ @@ -229,7 +229,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) int i, ret; struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; struct rte_eth_tunnel_filter_conf tunnel_filter_conf; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index b2865c9c2d..d7ee4530e8 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -878,7 +878,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index ee2d116dcc..4e0a84aff7 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -621,7 +621,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -643,7 +643,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index d06af0e75a..14897c51c1 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -611,8 +611,8 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter, } static inline void -rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, - struct ipv6_hdr **ipv6_hdr) +rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr, + struct rte_ipv6_hdr **ipv6_hdr) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vlan_hdr; @@ -622,21 +622,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, switch (eth_hdr->ether_type) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1); break; default: break; @@ -656,8 +656,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be) void *tuple; struct rte_ipv4_tuple ipv4_tuple; struct rte_ipv6_tuple ipv6_tuple; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 398b5b4cf1..1c2fe713c9 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -180,10 +180,10 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, static inline void update_header(struct gro_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); @@ -195,7 +195,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t tcp_dl, ip_id, hdr_len, frag_off; @@ -208,7 +208,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint8_t find; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 4879e24005..e33b650839 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -264,11 +264,11 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; + struct rte_ipv4_hdr *iph_orig; struct tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index baf3beffb1..4426d82adb 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -262,14 +262,14 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); @@ -280,7 +280,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the inner IPv4 header. */ len -= pkt->l2_len; - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); } @@ -290,7 +290,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; - struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; + struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; @@ -306,7 +306,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint8_t find; outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + + outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); @@ -314,7 +314,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sizeof(struct udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 6cd764ff5f..ecce5da06c 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index fbd95f8f63..ad0cce6f90 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -9,14 +9,14 @@ static void update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; uint16_t l4_offset = l3_offset + pkt->l3_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -40,13 +40,13 @@ gso_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index d39b468635..f5a19bc43b 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -9,7 +9,7 @@ static void update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; @@ -23,12 +23,12 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, tcp_offset = inner_ipv4_offset + pkt->l3_len; /* Outer IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + outer_ipv4_offset); outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); /* Inner IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -60,12 +60,12 @@ gso_tunnel_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *inner_ipv4_hdr; + struct rte_ipv4_hdr *inner_ipv4_hdr; uint16_t pyld_unit_size, hdr_offset, frag_off; int ret = 1; hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len; - inner_ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + hdr_offset); /* * Don't process the packet whose MF bit or offset in the inner diff --git a/lib/librte_gso/gso_udp4.c b/lib/librte_gso/gso_udp4.c index 927dee1213..93e6f8e0d8 100644 --- a/lib/librte_gso/gso_udp4.c +++ b/lib/librte_gso/gso_udp4.c @@ -11,7 +11,7 @@ static inline void update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t frag_offset = 0, is_mf; uint16_t l2_hdrlen = pkt->l2_len, l3_hdrlen = pkt->l3_len; uint16_t tail_idx = nb_segs - 1, length, i; @@ -22,7 +22,7 @@ update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, * length. */ for (i = 0; i < nb_segs; i++) { - ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct rte_ipv4_hdr *, l2_hdrlen); length = segs[i]->pkt_len - l2_hdrlen; ipv4_hdr->total_length = rte_cpu_to_be_16(length); @@ -42,13 +42,13 @@ gso_udp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 433f2c8bb3..ee879968c8 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,11 +19,11 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index a6ddb7bf7f..adbaf8f701 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -168,7 +168,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 7f425f6100..148507a4d9 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -210,7 +210,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -225,7 +225,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -284,7 +284,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -295,7 +295,7 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index a96fb03e4c..2c781724a9 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -21,8 +21,8 @@ #define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) -static inline void __fill_ipv4hdr_frag(struct ipv4_hdr *dst, - const struct ipv4_hdr *src, uint16_t len, uint16_t fofs, +static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, + const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); @@ -70,7 +70,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv4_hdr *in_hdr; + struct rte_ipv4_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, flag_offset, frag_size; @@ -80,10 +80,10 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. */ - frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct ipv4_hdr)), + frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct rte_ipv4_hdr)), IPV4_HDR_FO_ALIGN); - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *); flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset); /* If Don't Fragment flag is set */ @@ -92,11 +92,11 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely(frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv4_hdr)))) return -EINVAL; in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv4_hdr); + in_seg_data_pos = sizeof(struct rte_ipv4_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -104,7 +104,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv4_hdr *out_hdr; + struct rte_ipv4_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -114,8 +114,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv4_hdr); - out_pkt->pkt_len = sizeof(struct ipv4_hdr); + out_pkt->data_len = sizeof(struct rte_ipv4_hdr); + out_pkt->pkt_len = sizeof(struct rte_ipv4_hdr); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -164,17 +164,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len, flag_offset, fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv4_hdr)); + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); out_pkt->ol_flags |= PKT_TX_IP_CKSUM; - out_pkt->l3_len = sizeof(struct ipv4_hdr); + out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */ pkts_out[out_pkt_pos] = out_pkt; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 4956b99eab..35f7d85cd1 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -14,7 +14,7 @@ struct rte_mbuf * ipv4_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; uint32_t curr_idx = 0; @@ -67,7 +67,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv4 header for the reassembled packet */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); @@ -97,7 +97,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv4_hdr *ip_hdr) + struct rte_ipv4_hdr *ip_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index 62a7e4e830..627d37c285 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -18,8 +18,8 @@ */ static inline void -__fill_ipv6hdr_frag(struct ipv6_hdr *dst, - const struct ipv6_hdr *src, uint16_t len, uint16_t fofs, +__fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, + const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs, uint32_t mf) { struct ipv6_extension_fragment *fh; @@ -73,25 +73,25 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv6_hdr *in_hdr; + struct rte_ipv6_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, frag_size; - frag_size = (uint16_t)(mtu_size - sizeof(struct ipv6_hdr)); + frag_size = (uint16_t)(mtu_size - sizeof(struct rte_ipv6_hdr)); /* Fragment size should be a multiple of 8. */ RTE_ASSERT((frag_size & ~RTE_IPV6_EHDR_FO_MASK) == 0); /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv6_hdr)))) return -EINVAL; - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv6_hdr *); in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv6_hdr); + in_seg_data_pos = sizeof(struct rte_ipv6_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -99,7 +99,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv6_hdr *out_hdr; + struct rte_ipv6_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -109,8 +109,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); - out_pkt->pkt_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->data_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); out_seg_prev = out_pkt; more_out_segs = 1; @@ -159,14 +159,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, - (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr), + (uint16_t) out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr), fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv6_hdr) + out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr) - sizeof(struct ipv6_extension_fragment)); /* Write the fragment to the output list */ diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c index db249fe600..0d9e3a597e 100644 --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c @@ -32,7 +32,7 @@ ip_frag_memmove(char *dst, char *src, int len) struct rte_mbuf * ipv6_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; struct ipv6_extension_fragment *frag_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; @@ -90,7 +90,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv6 header for the reassembled datagram */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, m->l2_len); ip_hdr->payload_len = rte_cpu_to_be_16(payload_len); @@ -136,7 +136,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) + struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index f2a8904a2a..986fd137c8 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -28,7 +28,7 @@ extern "C" { /** * IPv4 Header */ -struct ipv4_hdr { +struct rte_ipv4_hdr { uint8_t version_ihl; /**< version and header length */ uint8_t type_of_service; /**< type of service */ uint16_t total_length; /**< length of packet */ @@ -249,10 +249,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) +rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr) { uint16_t cksum; - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); + cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); return (cksum == 0xffff) ? cksum : (uint16_t)~cksum; } @@ -275,7 +275,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) +rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) { struct ipv4_psd_header { uint32_t src_addr; /* IP address of source host. */ @@ -294,7 +294,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) } else { psd_hdr.len = rte_cpu_to_be_16( (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr))); + - sizeof(struct rte_ipv4_hdr))); } return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); } @@ -313,13 +313,13 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -335,7 +335,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) /** * IPv6 Header */ -struct ipv6_hdr { +struct rte_ipv6_hdr { uint32_t vtc_flow; /**< IP version, traffic class & flow label. */ uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */ uint8_t proto; /**< Protocol, next header. */ @@ -367,7 +367,7 @@ struct ipv6_hdr { * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) +rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) { uint32_t sum; struct { @@ -403,7 +403,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr) +rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 3ad16f0c4b..dc2a667252 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -172,7 +172,7 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, /* get the ipv4 header length */ static uint8_t -ip4_hlen(const struct ipv4_hdr *hdr) +ip4_hlen(const struct rte_ipv4_hdr *hdr) { return (hdr->version_ihl & 0xf) * 4; } @@ -281,8 +281,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -304,8 +304,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, proto = ip4h->next_proto_id; pkt_type |= ptype_l4(proto); } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); @@ -413,8 +413,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -436,8 +436,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, proto = ip4h->next_proto_id; pkt_type |= ptype_inner_l4(proto); } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index e59760a0a1..84f8dfe1cc 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -112,8 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, static inline int rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -123,7 +123,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) inner_l3_offset += m->outer_l2_len + m->outer_l3_len; if (ol_flags & PKT_TX_IPV4) { - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_offset); if (ol_flags & PKT_TX_IP_CKSUM) @@ -137,7 +137,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, @@ -154,7 +154,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 4534942940..c7b04d6f54 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -504,7 +504,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -512,14 +512,14 @@ struct encap_vxlan_ipv4_data { struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -527,7 +527,7 @@ struct encap_vxlan_ipv6_data { struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -964,7 +964,7 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -994,7 +994,7 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1287,7 +1287,7 @@ nat_ipv6_tcp_udp_checksum_update(uint16_t cksum0, } static __rte_always_inline void -pkt_ipv4_work_nat(struct ipv4_hdr *ip, +pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, struct nat_ipv4_data *data, struct rte_table_action_nat_config *cfg) { @@ -1373,7 +1373,7 @@ pkt_ipv4_work_nat(struct ipv4_hdr *ip, } static __rte_always_inline void -pkt_ipv6_work_nat(struct ipv6_hdr *ip, +pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, struct nat_ipv6_data *data, struct rte_table_action_nat_config *cfg) { @@ -1481,7 +1481,7 @@ ttl_apply(void *data, } static __rte_always_inline uint64_t -pkt_ipv4_work_ttl(struct ipv4_hdr *ip, +pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -1502,7 +1502,7 @@ pkt_ipv4_work_ttl(struct ipv4_hdr *ip, } static __rte_always_inline uint64_t -pkt_ipv6_work_ttl(struct ipv6_hdr *ip, +pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -2843,16 +2843,16 @@ pkt_work(struct rte_mbuf *mbuf, uint16_t total_length; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr = ip; + struct rte_ipv4_hdr *hdr = ip; dscp = hdr->type_of_service >> 2; total_length = rte_ntohs(hdr->total_length); } else { - struct ipv6_hdr *hdr = ip; + struct rte_ipv6_hdr *hdr = ip; dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18; total_length = - rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { @@ -2991,10 +2991,10 @@ pkt4_work(struct rte_mbuf **mbufs, uint16_t total_length0, total_length1, total_length2, total_length3; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr0 = ip0; - struct ipv4_hdr *hdr1 = ip1; - struct ipv4_hdr *hdr2 = ip2; - struct ipv4_hdr *hdr3 = ip3; + struct rte_ipv4_hdr *hdr0 = ip0; + struct rte_ipv4_hdr *hdr1 = ip1; + struct rte_ipv4_hdr *hdr2 = ip2; + struct rte_ipv4_hdr *hdr3 = ip3; dscp0 = hdr0->type_of_service >> 2; dscp1 = hdr1->type_of_service >> 2; @@ -3006,10 +3006,10 @@ pkt4_work(struct rte_mbuf **mbufs, total_length2 = rte_ntohs(hdr2->total_length); total_length3 = rte_ntohs(hdr3->total_length); } else { - struct ipv6_hdr *hdr0 = ip0; - struct ipv6_hdr *hdr1 = ip1; - struct ipv6_hdr *hdr2 = ip2; - struct ipv6_hdr *hdr3 = ip3; + struct rte_ipv6_hdr *hdr0 = ip0; + struct rte_ipv6_hdr *hdr1 = ip1; + struct rte_ipv6_hdr *hdr2 = ip2; + struct rte_ipv6_hdr *hdr3 = ip3; dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18; dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18; @@ -3017,13 +3017,13 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18; total_length0 = - rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr0->payload_len) + sizeof(struct rte_ipv6_hdr); total_length1 = - rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr1->payload_len) + sizeof(struct rte_ipv6_hdr); total_length2 = - rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr2->payload_len) + sizeof(struct rte_ipv6_hdr); total_length3 = - rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr3->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index c8b2e19bfa..2e807e8050 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -151,7 +151,7 @@ static void process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); + struct rte_ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *); /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); @@ -182,7 +182,7 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *); + struct rte_ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *); struct ipv6_extension_fragment *frag_hdr; uint16_t frag_data = 0; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index e62fdf2289..9736a73393 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -264,9 +264,9 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) /* IP cksum verification cannot be bypassed, then calculate here */ if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } @@ -966,8 +966,8 @@ virtio_net_with_host_offload(struct virtio_net *dev) static void parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; struct rte_ether_hdr *eth_hdr; uint16_t ethertype; @@ -997,7 +997,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; - m->l3_len = sizeof(struct ipv6_hdr); + m->l3_len = sizeof(struct rte_ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV6; break; diff --git a/test/test-pipeline/pipeline_acl.c b/test/test-pipeline/pipeline_acl.c index 8853d43765..ad939008a2 100644 --- a/test/test-pipeline/pipeline_acl.c +++ b/test/test-pipeline/pipeline_acl.c @@ -40,7 +40,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -48,7 +48,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -56,21 +56,21 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index 3e4a0a1bb2..25fb2e0dab 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -426,8 +426,8 @@ app_main_loop_rx_metadata(void) { for (j = 0; j < n_mbufs; j++) { struct rte_mbuf *m; uint8_t *m_data, *key; - struct ipv4_hdr *ip_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t ip_dst; uint8_t *ipv6_dst; uint32_t *signature, *k32; @@ -440,14 +440,14 @@ app_main_loop_rx_metadata(void) { APP_METADATA_OFFSET(32)); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct ipv4_hdr *) + ip_hdr = (struct rte_ipv4_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index feee9e121f..886b5f8ac4 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -137,7 +137,7 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, } uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { ip_hdr->vtc_flow = 0; @@ -148,11 +148,11 @@ initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); - return (uint16_t) (pkt_data_len + sizeof(struct ipv6_hdr)); + return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -162,7 +162,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -200,7 +200,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, } uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) { uint16_t pkt_len; @@ -210,7 +210,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -300,13 +300,13 @@ nomore_mbuf: copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } /* @@ -319,10 +319,10 @@ nomore_mbuf: if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; @@ -379,45 +379,45 @@ nomore_mbuf: copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: break; } } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: break; @@ -434,10 +434,10 @@ nomore_mbuf: if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 8489212d06..93efee1f56 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -46,15 +46,15 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); int diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 3f06f3005a..96e3716917 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -40,7 +40,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -50,7 +50,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -60,7 +60,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -73,7 +73,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -83,7 +83,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -490,7 +490,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); @@ -527,7 +527,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); @@ -564,7 +564,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 2490d5dd25..924de81ae3 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -78,14 +78,14 @@ struct link_bonding_unittest_params { /* Packet Headers */ struct rte_ether_hdr *pkt_eth_hdr; - struct ipv4_hdr *pkt_ipv4_hdr; - struct ipv6_hdr *pkt_ipv6_hdr; + struct rte_ipv4_hdr *pkt_ipv4_hdr; + struct rte_ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; }; -static struct ipv4_hdr pkt_ipv4_hdr; -static struct ipv6_hdr pkt_ipv6_hdr; +static struct rte_ipv4_hdr pkt_ipv4_hdr; +static struct rte_ipv6_hdr pkt_ipv6_hdr; static struct udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index 6295b1874c..fba629d43d 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -734,8 +734,8 @@ generate_packets(struct rte_ether_addr *src_mac, struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { - struct ipv4_hdr v4; - struct ipv6_hdr v6; + struct rte_ipv4_hdr v4; + struct rte_ipv6_hdr v6; } pkt_ip_hdr; int retval; diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index c5515cc5c8..3246b7ab60 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -183,7 +183,7 @@ init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; diff --git a/test/test/test_sched.c b/test/test/test_sched.c index f02e50882d..1611fc64c0 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -80,14 +80,14 @@ prepare_pkt(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr; struct rte_vlan_hdr *vlan1, *vlan2; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; /* Simulate a classifier */ eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); + ip_hdr = (struct rte_ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); diff --git a/test/test/test_thash.c b/test/test/test_thash.c index 61754a9475..bf332c9e95 100644 --- a/test/test/test_thash.c +++ b/test/test/test_thash.c @@ -110,7 +110,7 @@ test_thash(void) union rte_thash_tuple tuple; uint32_t rss_l3, rss_l3l4; uint8_t rss_key_be[RTE_DIM(default_rss_key)]; - struct ipv6_hdr ipv6_hdr; + struct rte_ipv6_hdr ipv6_hdr; /* Convert RSS key*/ rte_convert_rss_key((uint32_t *)&default_rss_key,