From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 12A045B2A for ; Wed, 24 Oct 2018 10:19:02 +0200 (CEST) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 1EB9C208A9C for ; Wed, 24 Oct 2018 10:15:08 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Date: Wed, 24 Oct 2018 10:18:30 +0200 Message-Id: <20181024081833.21432-12-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181024081833.21432-1-olivier.matz@6wind.com> References: <20181024081833.21432-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2018 08:19:02 -0000 Add 'RTE_' prefix to defines: - rename IPv4( as RTE_IPv4(. - rename IPV4_MAX_PKT_LEN as RTE_IPV4_MAX_PKT_LEN. - rename IPV4_HDR_IHL_MASK as RTE_IPV4_HDR_IHL_MASK. - rename IPV4_IHL_MULTIPLIER as RTE_IPV4_IHL_MULTIPLIER. - rename IPV4_HDR_DF_SHIFT as RTE_IPV4_HDR_DF_SHIFT. - rename IPV4_HDR_MF_SHIFT as RTE_IPV4_HDR_MF_SHIFT. - rename IPV4_HDR_FO_SHIFT as RTE_IPV4_HDR_FO_SHIFT. - rename IPV4_HDR_DF_FLAG as RTE_IPV4_HDR_DF_FLAG. - rename IPV4_HDR_MF_FLAG as RTE_IPV4_HDR_MF_FLAG. - rename IPV4_HDR_OFFSET_MASK as RTE_IPV4_HDR_OFFSET_MASK. - rename IPV4_HDR_OFFSET_UNITS as RTE_IPV4_HDR_OFFSET_UNITS. - rename IPV4_ANY as RTE_IPV4_ANY. - rename IPV4_LOOPBACK as RTE_IPV4_LOOPBACK. - rename IPV4_BROADCAST as RTE_IPV4_BROADCAST. - rename IPV4_ALLHOSTS_GROUP as RTE_IPV4_ALLHOSTS_GROUP. - rename IPV4_ALLRTRS_GROUP as RTE_IPV4_ALLRTRS_GROUP. - rename IPV4_MAX_LOCAL_GROUP as RTE_IPV4_MAX_LOCAL_GROUP. - rename IPV4_MIN_MCAST as RTE_IPV4_MIN_MCAST. - rename IPV4_MAX_MCAST as RTE_IPV4_MAX_MCAST. - rename IS_IPV4_MCAST as RTE_IS_IPV4_MCAST. - rename IPV6_HDR_FL_SHIFT as RTE_IPV6_HDR_FL_SHIFT. - rename IPV6_HDR_TC_SHIFT as RTE_IPV6_HDR_TC_SHIFT. - rename IPV6_HDR_FL_MASK as RTE_IPV6_HDR_FL_MASK. - rename IPV6_HDR_TC_MASK as RTE_IPV6_HDR_TC_MASK. Signed-off-by: Olivier Matz --- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- .../prog_guide/packet_classif_access_ctrl.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +-- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +-- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/i40e/i40e_flow.c | 4 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +-- drivers/net/tap/tap_bpf_program.c | 6 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- examples/flow_classify/flow_classify.c | 2 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_reassembly/main.c | 16 +-- examples/ipv4_multicast/main.c | 32 +++--- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 24 ++-- examples/l3fwd-vf/main.c | 24 ++-- examples/l3fwd/l3fwd_em.c | 20 ++-- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/performance-thread/l3fwd-thread/main.c | 32 +++--- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 4 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_ip_frag/rte_ip_frag.h | 4 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 16 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 +- lib/librte_net/rte_ip.h | 50 ++++----- lib/librte_net/rte_net.c | 6 +- lib/librte_port/rte_port_ras.c | 4 +- test/test-acl/main.c | 2 +- test/test/test_acl.c | 8 +- test/test/test_acl.h | 122 ++++++++++----------- test/test/test_efd.c | 20 ++-- test/test/test_flow_classify.c | 8 +- test/test/test_hash.c | 20 ++-- test/test/test_link_bonding_mode4.c | 4 +- test/test/test_lpm.c | 76 ++++++------- test/test/test_lpm_perf.c | 10 +- test/test/test_member.c | 20 ++-- test/test/test_sched.c | 2 +- test/test/test_table_acl.c | 8 +- test/test/test_thash.c | 10 +- 46 files changed, 343 insertions(+), 343 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index e62601541..0405fe9b6 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -72,8 +72,8 @@ /* hardcoded configuration (for now) */ static unsigned cfg_n_flows = 1024; -static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); -static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); +static uint32_t cfg_ip_src = RTE_IPv4(10, 254, 0, 0); +static uint32_t cfg_ip_dst = RTE_IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; static struct rte_ether_addr cfg_ether_src = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6b02c0c10..2576387a5 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -454,8 +454,8 @@ struct vxlan_encap_conf vxlan_encap_conf = { .vni = "\x00\x00\x00", .udp_src = 0, .udp_dst = RTE_BE16(4789), - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" @@ -469,8 +469,8 @@ struct nvgre_encap_conf nvgre_encap_conf = { .select_ipv4 = 1, .select_vlan = 0, .tni = "\x00\x00\x00", - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc6..010ec045d 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -419,7 +419,7 @@ Classify with Multiple Categories .data = {.userdata = 1, .category_mask = 3, .priority = 1}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,0,0),. mask_range.u32 = 16,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,0,0),. mask_range.u32 = 16,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -433,7 +433,7 @@ Classify with Multiple Categories .data = {.userdata = 2, .category_mask = 1, .priority = 2}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,1,0),. mask_range.u32 = 24,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,1,0),. mask_range.u32 = 24,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -447,7 +447,7 @@ Classify with Multiple Categories .data = {.userdata = 3, .category_mask = 2, .priority = 3}, /* source IPv4 */ - .field[1] = {.value.u32 = IPv4(10,1,1,1),. mask_range.u32 = 32,}, + .field[1] = {.value.u32 = RTE_IPv4(10,1,1,1),. mask_range.u32 = 32,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, diff --git a/doc/guides/sample_app_ug/ip_frag.rst b/doc/guides/sample_app_ug/ip_frag.rst index 7914a977a..222bdd748 100644 --- a/doc/guides/sample_app_ug/ip_frag.rst +++ b/doc/guides/sample_app_ug/ip_frag.rst @@ -104,14 +104,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst index 18912cd2f..db303d362 100644 --- a/doc/guides/sample_app_ug/ip_reassembly.rst +++ b/doc/guides/sample_app_ug/ip_reassembly.rst @@ -107,14 +107,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 0d89be96e..a6175b3eb 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -155,7 +155,7 @@ if the routing table has any ports assigned to the destination address: .. code-block:: c - if (!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 2aa94d7c2..dd7d3fb20 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -856,8 +856,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) { ip_hdr_offset = (ipv4_hdr->version_ihl - & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 6cf4259fe..eaeed9fee 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1970,7 +1970,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); - if ((frag_field & IPV4_HDR_DF_FLAG) != 0) { + if ((frag_field & RTE_IPV4_HDR_DF_FLAG) != 0) { m->packet_type |= RTE_PTYPE_L4_NONFRAG; /* If IPv4 header has DF flag enabled and TSO support is diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d7a1000d8..7d08078a6 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2607,8 +2607,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, /* Check if it is fragment. */ frag_off = ipv4_spec->hdr.fragment_offset; frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & IPV4_HDR_OFFSET_MASK || - frag_off & IPV4_HDR_MF_FLAG) + if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || + frag_off & RTE_IPV4_HDR_MF_FLAG) pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; /* Get the filter info */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 46f3f5d5d..6d9224d4f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4488,7 +4488,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */ uint16_t maxdesc = - IPV4_MAX_PKT_LEN / + RTE_IPV4_MAX_PKT_LEN / (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); if (maxdesc >= 16) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 4de4759e7..925e17157 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -370,17 +370,17 @@ flow_verbs_translate_item_ipv6(const struct rte_flow_item *item, vtc_flow_val = rte_be_to_cpu_32(spec->hdr.vtc_flow); vtc_flow_mask = rte_be_to_cpu_32(mask->hdr.vtc_flow); ipv6.val.flow_label = - rte_cpu_to_be_32((vtc_flow_val & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_val & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.val.traffic_class = (vtc_flow_val & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.val.next_hdr = spec->hdr.proto; ipv6.val.hop_limit = spec->hdr.hop_limits; ipv6.mask.flow_label = - rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_mask & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.mask.traffic_class = (vtc_flow_mask & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.mask.next_hdr = mask->hdr.proto; ipv6.mask.hop_limit = mask->hdr.hop_limits; /* Remove unwanted bits from values. */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index db3ed8798..0886b0fb2 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -19,7 +19,7 @@ #include "tap_rss.h" /** Create IPv4 address */ -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr); __u8 *src_dst_port = data + off + sizeof(struct iphdr); struct ipv4_l3_l4_tuple v4_tuple = { - .src_addr = IPv4(*(src_dst_addr + 0), + .src_addr = RTE_IPv4(*(src_dst_addr + 0), *(src_dst_addr + 1), *(src_dst_addr + 2), *(src_dst_addr + 3)), - .dst_addr = IPv4(*(src_dst_addr + 4), + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), *(src_dst_addr + 5), *(src_dst_addr + 6), *(src_dst_addr + 7)), diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 9f22d273c..3bbf9adf7 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -682,8 +682,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, - sizeof(struct tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); - hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index c75a410f4..e68d0f694 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -379,7 +379,7 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len) if (get_cb_field(&in, &m, 0, sizeof(uint32_t) * CHAR_BIT, 0)) return -EINVAL; - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 42b1d2cb0..6585323a2 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -160,14 +160,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 00a95e07a..97c499425 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -190,14 +190,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index c97c11e75..34306aebe 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -138,21 +138,21 @@ struct mcast_group_params { }; static struct mcast_group_params mcast_group_table[] = { - {IPv4(224,0,0,101), 0x1}, - {IPv4(224,0,0,102), 0x2}, - {IPv4(224,0,0,103), 0x3}, - {IPv4(224,0,0,104), 0x4}, - {IPv4(224,0,0,105), 0x5}, - {IPv4(224,0,0,106), 0x6}, - {IPv4(224,0,0,107), 0x7}, - {IPv4(224,0,0,108), 0x8}, - {IPv4(224,0,0,109), 0x9}, - {IPv4(224,0,0,110), 0xA}, - {IPv4(224,0,0,111), 0xB}, - {IPv4(224,0,0,112), 0xC}, - {IPv4(224,0,0,113), 0xD}, - {IPv4(224,0,0,114), 0xE}, - {IPv4(224,0,0,115), 0xF}, + {RTE_IPv4(224,0,0,101), 0x1}, + {RTE_IPv4(224,0,0,102), 0x2}, + {RTE_IPv4(224,0,0,103), 0x3}, + {RTE_IPv4(224,0,0,104), 0x4}, + {RTE_IPv4(224,0,0,105), 0x5}, + {RTE_IPv4(224,0,0,106), 0x6}, + {RTE_IPv4(224,0,0,107), 0x7}, + {RTE_IPv4(224,0,0,108), 0x8}, + {RTE_IPv4(224,0,0,109), 0x9}, + {RTE_IPv4(224,0,0,110), 0xA}, + {RTE_IPv4(224,0,0,111), 0xB}, + {RTE_IPv4(224,0,0,112), 0xC}, + {RTE_IPv4(224,0,0,113), 0xD}, + {RTE_IPv4(224,0,0,114), 0xE}, + {RTE_IPv4(224,0,0,115), 0xF}, }; #define N_MCAST_GROUPS \ @@ -325,7 +325,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) * Check that it is a valid multicast address and * we have some active ports assigned to it. */ - if(!IS_IPV4_MCAST(dest_addr) || + if(!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 7dac6de2d..1fd6482b0 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -400,8 +400,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); - ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) - * IPV4_IHL_MULTIPLIER; + ipdata_offset += (ip_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) + * RTE_IPV4_IHL_MULTIPLIER; /* Zero pad data to be crypto'd so it is block aligned */ diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index b0e933e03..bad6aae8c 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -897,7 +897,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index abbfcc29f..f78aeab53 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -236,10 +236,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -278,14 +278,14 @@ struct ipv4_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define IPV4_L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index ebb2378dd..5e3809b8d 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -201,10 +201,10 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; typedef struct rte_hash lookup_struct_t; @@ -234,14 +234,14 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fb55e196d..b0e08f842 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -99,10 +99,10 @@ struct ipv6_l3fwd_em_route { }; static struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[] = { @@ -424,19 +424,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_em_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_em_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_em_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_em_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); @@ -574,8 +574,8 @@ em_parse_ptype(struct rte_mbuf *m) 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 rte_ipv4_hdr *)l3; - hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hdr_len = (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 881b0c7c0..de9fd9ab3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -40,14 +40,14 @@ struct ipv6_l3fwd_lpm_route { }; static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = { diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index da5c66203..9b5684ea6 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -380,10 +380,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -503,14 +503,14 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -3134,19 +3134,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 1c2fe713c..3ed8cda02 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -231,7 +231,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 4426d82ad..80d2d5288 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -339,11 +339,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(outer_ipv4_hdr->fragment_offset); - outer_is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + outer_is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; outer_ip_id = outer_is_atomic ? 0 : rte_be_to_cpu_16(outer_ipv4_hdr->packet_id); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index ecce5da06..e5c8d83e7 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include #include -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 148507a4d..28ba33dac 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -299,8 +299,8 @@ 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); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 2c781724a..f7c956ee1 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -12,22 +12,22 @@ #include "ip_frag_common.h" /* Fragment Offset */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_MASK (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_MASK (1 << IPV4_HDR_MF_SHIFT) +#define IPV4_HDR_DF_MASK (1 << RTE_IPV4_HDR_DF_SHIFT) +#define IPV4_HDR_MF_MASK (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) +#define IPV4_HDR_FO_ALIGN (1 << RTE_IPV4_HDR_FO_SHIFT) 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)); - fofs = (uint16_t)(fofs + (dofs >> IPV4_HDR_FO_SHIFT)); - fofs = (uint16_t)(fofs | mf << IPV4_HDR_MF_SHIFT); + fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); + fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); dst->fragment_offset = rte_cpu_to_be_16(fofs); dst->total_length = rte_cpu_to_be_16(len); dst->hdr_checksum = 0; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 35f7d85cd..97af349bb 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -72,7 +72,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); + rte_cpu_to_be_16(RTE_IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; return m; @@ -106,8 +106,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, uint16_t flag_offset, ip_ofs, ip_flag; flag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ @@ -115,7 +115,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; - ip_ofs *= IPV4_HDR_OFFSET_UNITS; + ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len); diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 986fd137c..e57932120 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -42,52 +42,52 @@ struct rte_ipv4_hdr { } __attribute__((__packed__)); /** Create IPv4 address */ -#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ -#define IPV4_MAX_PKT_LEN 65535 +#define RTE_IPV4_MAX_PKT_LEN 65535 /** Internet header length mask for version_ihl field */ -#define IPV4_HDR_IHL_MASK (0x0f) +#define RTE_IPV4_HDR_IHL_MASK (0x0f) /** * Internet header length field multiplier (IHL field specifies overall header * length in number of 4-byte words) */ -#define IPV4_IHL_MULTIPLIER (4) +#define RTE_IPV4_IHL_MULTIPLIER (4) /* Fragment Offset * Flags. */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT) +#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT) +#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1) +#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1) -#define IPV4_HDR_OFFSET_UNITS 8 +#define RTE_IPV4_HDR_OFFSET_UNITS 8 /* * IPv4 address types */ -#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ -#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ -#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ -#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ -#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ -#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ +#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ +#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ +#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ +#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ +#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ +#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ /* * IPv4 Multicast-related macros */ -#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ -#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ +#define RTE_IPV4_MIN_MCAST RTE_IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ +#define RTE_IPV4_MAX_MCAST RTE_IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ -#define IS_IPV4_MCAST(x) \ - ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +#define RTE_IS_IPV4_MCAST(x) \ + ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ /** * @internal Calculate a sum of all words in the buffer. @@ -345,10 +345,10 @@ struct rte_ipv6_hdr { } __attribute__((__packed__)); /* IPv6 vtc_flow: IPv / TC / flow_label */ -#define IPV6_HDR_FL_SHIFT 0 -#define IPV6_HDR_TC_SHIFT 20 -#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1) -#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT) +#define RTE_IPV6_HDR_FL_SHIFT 0 +#define RTE_IPV6_HDR_TC_SHIFT 20 +#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1) +#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT) /** * Process the pseudo-header checksum of an IPv6 header. diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index dc2a66725..617395fe6 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -296,7 +296,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (ip4h->fragment_offset & rte_cpu_to_be_16( - IPV4_HDR_OFFSET_MASK | IPV4_HDR_MF_FLAG)) { + RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_L4_FRAG; hdr_lens->l4_len = 0; return pkt_type; @@ -427,8 +427,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L4_MASK) == 0) return pkt_type; if (ip4h->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_OFFSET_MASK | - IPV4_HDR_MF_FLAG)) { + rte_cpu_to_be_16(RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_INNER_L4_FRAG; hdr_lens->inner_l4_len = 0; return pkt_type; diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 2e807e805..0d02f97e5 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -155,8 +155,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); - uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); - uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); + uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK); + uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG); /* If it is a fragmented packet, then try to reassemble */ if ((frag_flag == 0) && (frag_offset == 0)) diff --git a/test/test-acl/main.c b/test/test-acl/main.c index 648525af5..4bf533cc0 100644 --- a/test/test-acl/main.c +++ b/test/test-acl/main.c @@ -624,7 +624,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/test/test/test_acl.c b/test/test/test_acl.c index b1f75d1bc..8663ff031 100644 --- a/test/test/test_acl.c +++ b/test/test/test_acl.c @@ -515,15 +515,15 @@ test_build_ports_range(void) static struct ipv4_7tuple test_data[] = { { .proto = 6, - .ip_src = IPv4(10, 1, 1, 1), - .ip_dst = IPv4(192, 168, 0, 33), + .ip_src = RTE_IPv4(10, 1, 1, 1), + .ip_dst = RTE_IPv4(192, 168, 0, 33), .port_dst = 53, .allow = 1, }, { .proto = 6, - .ip_src = IPv4(127, 84, 33, 1), - .ip_dst = IPv4(1, 2, 3, 4), + .ip_src = RTE_IPv4(127, 84, 33, 1), + .ip_dst = RTE_IPv4(1, 2, 3, 4), .port_dst = 65281, .allow = 1, }, diff --git a/test/test/test_acl.h b/test/test/test_acl.h index bbb0447a8..b071f47c3 100644 --- a/test/test/test_acl.h +++ b/test/test/test_acl.h @@ -82,13 +82,13 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { { .data = {.userdata = 1, .category_mask = 1, .priority = 1}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 24, }, { .data = {.userdata = 2, .category_mask = 1, .priority = 1}, - .dst_addr = IPv4(10,0,0,0), + .dst_addr = RTE_IPv4(10,0,0,0), .dst_mask_len = 24, }, /* test src and dst ports */ @@ -124,8 +124,8 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { * results using the wrong data layout. */ struct ipv4_7tuple invalid_layout_data[] = { - {.ip_src = IPv4(10,0,1,0)}, /* should not match */ - {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ + {.ip_src = RTE_IPv4(10,0,1,0)}, /* should not match */ + {.ip_src = RTE_IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ {.port_src = 100, .allow = 4}, /* should match 4 */ {.port_dst = 0xf, .allow = 6}, /* should match 6 */ }; @@ -142,7 +142,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,0,0), + .dst_addr = RTE_IPv4(192,168,0,0), .dst_mask_len = 16, .src_port_low = 0, .src_port_high = 0xffff, @@ -153,7 +153,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK, .priority = 330}, - .dst_addr = IPv4(192,168,1,0), + .dst_addr = RTE_IPv4(192,168,1,0), .dst_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -164,7 +164,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 3, .category_mask = ACL_DENY_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,1,50), + .dst_addr = RTE_IPv4(192,168,1,50), .dst_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -177,7 +177,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK, .priority = 240}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 8, .src_port_low = 0, .src_port_high = 0xffff, @@ -188,7 +188,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK, .priority = 340}, - .src_addr = IPv4(10,1,1,0), + .src_addr = RTE_IPv4(10,1,1,0), .src_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -199,7 +199,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 6, .category_mask = ACL_DENY_MASK, .priority = 240}, - .src_addr = IPv4(10,1,1,1), + .src_addr = RTE_IPv4(10,1,1,1), .src_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -393,9 +393,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK, .priority = 400}, /** make sure that unmasked bytes don't fail! */ - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 16, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 24, .proto = 0x5, .proto_mask = 0xff, @@ -411,9 +411,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 25, .category_mask = ACL_DENY_MASK, .priority = 400}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 24, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 16, .proto = 0x5, .proto_mask = 0xff, @@ -429,9 +429,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK, .priority = 500}, - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 8, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 32, .proto = 0x5, .proto_mask = 0xff, @@ -445,9 +445,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 27, .category_mask = ACL_DENY_MASK, .priority = 500}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 32, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 8, .proto = 0x5, .proto_mask = 0xff, @@ -463,20 +463,20 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { /* data for ACL unit test */ struct ipv4_7tuple acl_test_data[] = { /* testing single rule aspects */ - {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ - {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ - {.ip_src = IPv4(10,1,1,1), .allow = 5, + {.ip_src = RTE_IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ + {.ip_src = RTE_IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ + {.ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 6}, /* should match 5, 6 */ - {.ip_dst = IPv4(10,0,0,0)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,2)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,1)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,0,0,0)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,2)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,1)}, /* should not match */ - {.ip_src = IPv4(192,168,2,50)}, /* should not match */ - {.ip_src = IPv4(192,168,1,2)}, /* should not match */ - {.ip_src = IPv4(192,168,1,50)}, /* should not match */ - {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ - {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ - {.ip_dst = IPv4(192,168,1,50), .allow = 2, + {.ip_src = RTE_IPv4(192,168,2,50)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,2)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,50)}, /* should not match */ + {.ip_dst = RTE_IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ + {.ip_dst = RTE_IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ + {.ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 3}, /* should match 2, 3 */ {.vlan = 0x64, .allow = 7}, /* should match 7 */ @@ -515,20 +515,20 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .allow = 22, .deny = 23}, /* should match 22, 23 */ /* testing matching multiple rules at once */ - {.vlan = 0x5, .ip_src = IPv4(10,1,1,1), + {.vlan = 0x5, .ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 9}, /* should match 5, 9 */ - {.vlan = 0x5, .ip_src = IPv4(192,168,2,50), + {.vlan = 0x5, .ip_src = RTE_IPv4(192,168,2,50), .allow = 8, .deny = 9}, /* should match 8, 9 */ - {.vlan = 0x55, .ip_src = IPv4(192,168,1,49), + {.vlan = 0x55, .ip_src = RTE_IPv4(192,168,1,49), .allow = 8}, /* should match 8 */ {.port_dst = 80, .port_src = 1024, .allow = 13, .deny = 20}, /* should match 13,20 */ {.port_dst = 79, .port_src = 1024, .allow = 14, .deny = 20}, /* should match 14,20 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,2,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,2,50), .allow = 1, .deny = 23}, /* should match 1, 23 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,1,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 23}, /* should match 2, 23 */ {.vlan = 0x64, .domain = 0x5, .allow = 11, .deny = 12}, /* should match 11, 12 */ @@ -537,16 +537,16 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .port_dst = 80, .allow = 13, .deny = 23}, /* should match 13, 23 */ {.proto = 0x51, .port_src = 5000}, /* should not match */ - {.ip_src = IPv4(192,168,1,50), - .ip_dst = IPv4(10,0,0,0), + {.ip_src = RTE_IPv4(192,168,1,50), + .ip_dst = RTE_IPv4(10,0,0,0), .proto = 0x51, .port_src = 5000, .port_dst = 5000}, /* should not match */ /* test full packet rules */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -556,8 +556,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 24 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -567,8 +567,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 25 }, /* should match 13, 25 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -577,8 +577,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 26 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -587,8 +587,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 27 }, /* should match 13, 27 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -597,8 +597,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 13, 23 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -610,8 +610,8 @@ struct ipv4_7tuple acl_test_data[] = { /* visual separator! */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x55, .vlan = 0x8000, .domain = 0x6464, @@ -620,8 +620,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x55, .vlan = 0x8100, .domain = 0x6464, @@ -630,8 +630,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -639,8 +639,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -648,8 +648,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -657,8 +657,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x50, .vlan = 0x6466, .port_src = 12345, diff --git a/test/test/test_efd.c b/test/test/test_efd.c index ced091aab..0f90c923a 100644 --- a/test/test/test_efd.c +++ b/test/test/test_efd.c @@ -60,36 +60,36 @@ static void print_key_info(__attribute__((unused)) const char *msg, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 96e371691..ad6c481fe 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -95,7 +95,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, RTE_IPv4(2, 2, 2, 3), RTE_IPv4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { .hdr = { @@ -131,7 +131,7 @@ static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, RTE_IPv4(1, 2, 3, 4), RTE_IPv4(5, 6, 7, 8)} }; static struct rte_flow_item_tcp tcp_spec_1 = { @@ -149,8 +149,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPv4(11, 12, 13, 14), + RTE_IPv4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/test/test/test_hash.c b/test/test/test_hash.c index b3db9fd10..2ba79b749 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -106,32 +106,32 @@ static void print_key_info(__attribute__((unused)) const char *msg, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index fba629d43..4968cd91c 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -728,8 +728,8 @@ generate_packets(struct rte_ether_addr *src_mac, uint16_t src_port = 10, dst_port = 20; - uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; - uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; + uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = RTE_IPv4(192, 168, 0, 1) }; + uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; diff --git a/test/test/test_lpm.c b/test/test/test_lpm.c index 5d697dd0f..0f24631ac 100644 --- a/test/test/test_lpm.c +++ b/test/test/test_lpm.c @@ -165,7 +165,7 @@ test3(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop = 100; uint8_t depth = 24; int32_t status = 0; @@ -203,7 +203,7 @@ test4(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0); + uint32_t ip = RTE_IPv4(0, 0, 0, 0); uint8_t depth = 24; int32_t status = 0; @@ -242,7 +242,7 @@ test5(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_return = 0; int32_t status = 0; /* rte_lpm_lookup: lpm == NULL */ @@ -276,7 +276,7 @@ test6(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 24; int32_t status = 0; @@ -315,7 +315,7 @@ test7(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 32; int32_t status = 0; @@ -366,7 +366,7 @@ test8(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0); + uint32_t ip1 = RTE_IPv4(127, 255, 255, 255), ip2 = RTE_IPv4(128, 0, 0, 0); uint32_t next_hop_add, next_hop_return; uint8_t depth; int32_t status = 0; @@ -457,7 +457,7 @@ test9(void) int32_t status = 0; /* Add & lookup to hit invalid TBL24 entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -479,7 +479,7 @@ test9(void) rte_lpm_delete_all(lpm); /* Add & lookup to hit valid TBL24 entry not extended */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 23; next_hop_add = 100; @@ -515,7 +515,7 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with invalid TBL8 * entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -525,7 +525,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 5); + ip = RTE_IPv4(128, 0, 0, 5); depth = 32; next_hop_add = 101; @@ -541,7 +541,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -558,11 +558,11 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with valid TBL8 * entry */ - ip_1 = IPv4(128, 0, 0, 0); + ip_1 = RTE_IPv4(128, 0, 0, 0); depth_1 = 25; next_hop_add_1 = 101; - ip_2 = IPv4(128, 0, 0, 5); + ip_2 = RTE_IPv4(128, 0, 0, 5); depth_2 = 32; next_hop_add_2 = 102; @@ -629,7 +629,7 @@ test10(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 16; next_hop_add = 100; @@ -647,7 +647,7 @@ test10(void) rte_lpm_delete_all(lpm); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 25; next_hop_add = 100; @@ -665,14 +665,14 @@ test10(void) /* Add rule that extends a TBL24 valid entry & lookup for both rules * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -682,13 +682,13 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -697,7 +697,7 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -711,7 +711,7 @@ test10(void) /* Add rule that updates the next hop in TBL24 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -740,7 +740,7 @@ test10(void) /* Add rule that updates the next hop in TBL8 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -768,7 +768,7 @@ test10(void) /* Delete a rule that is not present in the TBL24 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -781,7 +781,7 @@ test10(void) /* Delete a rule that is not present in the TBL8 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -818,14 +818,14 @@ test11(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -835,13 +835,13 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -850,7 +850,7 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -889,7 +889,7 @@ test12(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -944,7 +944,7 @@ test13(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add_1 = 100; @@ -1014,10 +1014,10 @@ test14(void) depth = 32; next_hop_add = 100; - ip = IPv4(0, 0, 0, 0); + ip = RTE_IPv4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= IPv4(0, 0, 255, 0); ip += 256) { + for (; ip <= RTE_IPv4(0, 0, 255, 0); ip += 256) { status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); @@ -1028,7 +1028,7 @@ test14(void) /* All tbl8 extensions have been used above. Try to add one more and * we get a fail */ - ip = IPv4(1, 0, 0, 0); + ip = RTE_IPv4(1, 0, 0, 0); depth = 32; status = rte_lpm_add(lpm, ip, depth, next_hop_add); @@ -1125,9 +1125,9 @@ test17(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - const uint32_t ip_10_32 = IPv4(10, 10, 10, 2); - const uint32_t ip_10_24 = IPv4(10, 10, 10, 0); - const uint32_t ip_20_25 = IPv4(10, 10, 20, 2); + const uint32_t ip_10_32 = RTE_IPv4(10, 10, 10, 2); + const uint32_t ip_10_24 = RTE_IPv4(10, 10, 10, 0); + const uint32_t ip_20_25 = RTE_IPv4(10, 10, 20, 2); const uint8_t d_ip_10_32 = 32, d_ip_10_24 = 24, d_ip_20_25 = 25; @@ -1221,7 +1221,7 @@ test18(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(192, 168, 100, 100); + ip = RTE_IPv4(192, 168, 100, 100); depth = 28; next_hop = 1; rte_lpm_add(lpm, ip, depth, next_hop); diff --git a/test/test/test_lpm_perf.c b/test/test/test_lpm_perf.c index 3b98ce0c8..b54650367 100644 --- a/test/test/test_lpm_perf.c +++ b/test/test/test_lpm_perf.c @@ -285,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPv4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPv4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 129, 124), 32); } static void diff --git a/test/test/test_member.c b/test/test/test_member.c index e2a3932f2..53287fcaf 100644 --- a/test/test/test_member.c +++ b/test/test/test_member.c @@ -41,36 +41,36 @@ struct flow_key { /* Keys used by unit test functions */ static struct flow_key keys[NUM_SAMPLES] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_sched.c b/test/test/test_sched.c index 1611fc64c..8b063d2e3 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -92,7 +92,7 @@ prepare_pkt(struct rte_mbuf *mbuf) vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); - ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); + ip_hdr->dst_addr = RTE_IPv4(0,0,TC,QUEUE); rte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW); diff --git a/test/test/test_table_acl.c b/test/test/test_table_acl.c index 33e2f6ee6..a851deaac 100644 --- a/test/test/test_table_acl.c +++ b/test/test/test_table_acl.c @@ -6,7 +6,7 @@ #include "test_table.h" #include "test_table_acl.h" -#define IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -115,7 +115,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; @@ -661,8 +661,8 @@ test_pipeline_single_filter(int expected_count) sizeof(struct ipv4_5tuple)); five_tuple.proto = j; - five_tuple.ip_src = rte_bswap32(IPv4(192, 168, j, 1)); - five_tuple.ip_dst = rte_bswap32(IPv4(10, 4, j, 1)); + five_tuple.ip_src = rte_bswap32(RTE_IPv4(192, 168, j, 1)); + five_tuple.ip_dst = rte_bswap32(RTE_IPv4(10, 4, j, 1)); five_tuple.port_src = rte_bswap16(100 + j); five_tuple.port_dst = rte_bswap16(200 + j); diff --git a/test/test/test_thash.c b/test/test/test_thash.c index bf332c9e9..3724ea5be 100644 --- a/test/test/test_thash.c +++ b/test/test/test_thash.c @@ -59,15 +59,15 @@ struct test_thash_v6 { /*From 82599 Datasheet 7.1.2.8.3 RSS Verification Suite*/ struct test_thash_v4 v4_tbl[] = { -{IPv4(161, 142, 100, 80), IPv4(66, 9, 149, 187), +{RTE_IPv4(161, 142, 100, 80), RTE_IPv4(66, 9, 149, 187), 1766, 2794, 0x323e8fc2, 0x51ccc178}, -{IPv4(65, 69, 140, 83), IPv4(199, 92, 111, 2), +{RTE_IPv4(65, 69, 140, 83), RTE_IPv4(199, 92, 111, 2), 4739, 14230, 0xd718262a, 0xc626b0ea}, -{IPv4(12, 22, 207, 184), IPv4(24, 19, 198, 95), +{RTE_IPv4(12, 22, 207, 184), RTE_IPv4(24, 19, 198, 95), 38024, 12898, 0xd2d0a5de, 0x5c2b394a}, -{IPv4(209, 142, 163, 6), IPv4(38, 27, 205, 30), +{RTE_IPv4(209, 142, 163, 6), RTE_IPv4(38, 27, 205, 30), 2217, 48228, 0x82989176, 0xafc7327f}, -{IPv4(202, 188, 127, 2), IPv4(153, 39, 163, 191), +{RTE_IPv4(202, 188, 127, 2), RTE_IPv4(153, 39, 163, 191), 1303, 44251, 0x5d1809c5, 0x10e828a2}, }; -- 2.11.0