From 4b5a4c29fe123ca2aa5b0a86eba4eeb22e640211 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Mon, 18 Mar 2019 18:07:33 +0100 Subject: [PATCH] net: add rte prefix to ip defines 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-acl/main.c | 2 +- app/test-pmd/cmdline_flow.c | 4 +- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 +++++++++--------- app/test/test_efd.c | 20 +-- app/test/test_flow_classify.c | 8 +- app/test/test_hash.c | 20 +-- app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_lpm.c | 76 +++++------ app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 +-- app/test/test_sched.c | 2 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 10 +- .../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_tcf.c | 16 +-- 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/ipsec-secgw/sa.c | 4 +- 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 +-- .../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 +- 50 files changed, 358 insertions(+), 358 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 648525af56..4bf533cc07 100644 --- a/app/test-acl/main.c +++ b/app/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/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 607d3cf67c..bd8e7744e6 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3521,12 +3521,12 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, memcpy(&ipv6_mask_tos, &rte_flow_item_ipv6_mask, sizeof(ipv6_mask_tos)); ipv6_mask_tos.hdr.vtc_flow |= - RTE_BE32(0xfful << IPV6_HDR_TC_SHIFT); + RTE_BE32(0xfful << RTE_IPV6_HDR_TC_SHIFT); ipv6_mask_tos.hdr.hop_limits = 0xff; action_vxlan_encap_data->item_ipv6.hdr.vtc_flow |= rte_cpu_to_be_32 ((uint32_t)vxlan_encap_conf.ip_tos << - IPV6_HDR_TC_SHIFT); + RTE_IPV6_HDR_TC_SHIFT); action_vxlan_encap_data->item_ipv6.hdr.hop_limits = vxlan_encap_conf.ip_ttl; action_vxlan_encap_data->items[2].mask = diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 45a5e13e0b..46fd6e41fd 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 e401efbdf1..56a796494b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -473,8 +473,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" @@ -490,8 +490,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/app/test/test_acl.c b/app/test/test_acl.c index b1f75d1bc7..8663ff0318 100644 --- a/app/test/test_acl.c +++ b/app/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/app/test/test_acl.h b/app/test/test_acl.h index bbb0447a89..b071f47c34 100644 --- a/app/test/test_acl.h +++ b/app/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/app/test/test_efd.c b/app/test/test_efd.c index ced091aab6..0f90c923ac 100644 --- a/app/test/test_efd.c +++ b/app/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/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 96e3716917..ad6c481fe7 100644 --- a/app/test/test_flow_classify.c +++ b/app/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/app/test/test_hash.c b/app/test/test_hash.c index fe607fadf2..782491a25c 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -100,32 +100,32 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* 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/app/test/test_ipsec.c b/app/test/test_ipsec.c index 2cad4096c2..343d933a92 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -536,11 +536,11 @@ const char null_encrypted_data[] = struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | - sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, + sizeof(ipv4_outer) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, - .src_addr = IPv4(192, 168, 1, 100), - .dst_addr = IPv4(192, 168, 2, 100), + .src_addr = RTE_IPv4(192, 168, 1, 100), + .dst_addr = RTE_IPv4(192, 168, 2, 100), }; static struct rte_mbuf * diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index fba629d43d..4968cd91cf 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/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/app/test/test_lpm.c b/app/test/test_lpm.c index 5d697dd0f6..0f24631ac8 100644 --- a/app/test/test_lpm.c +++ b/app/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/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 3b98ce0c84..b54650367f 100644 --- a/app/test/test_lpm_perf.c +++ b/app/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/app/test/test_member.c b/app/test/test_member.c index e2a3932f2e..53287fcaf3 100644 --- a/app/test/test_member.c +++ b/app/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/app/test/test_sched.c b/app/test/test_sched.c index 4781c23070..628cf147dc 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -92,7 +92,7 @@ prepare_pkt(struct rte_sched_port *port, 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(port, mbuf, SUBPORT, PIPE, TC, QUEUE, diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index 33e2f6ee64..a851deaaca 100644 --- a/app/test/test_table_acl.c +++ b/app/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/app/test/test_thash.c b/app/test/test_thash.c index bf332c9e95..3724ea5bee 100644 --- a/app/test/test_thash.c +++ b/app/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}, }; diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc66..010ec045dd 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 2583f0c3d0..49ba0d8bc6 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 a628b63cb8..99dcd9556e 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 46c9204331..ea7902b2db 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 0974950c2a..aa84248266 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -858,8 +858,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 99b0fc8ca9..d86cbd1d9c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2158,7 +2158,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 eab4514471..e4b5bbb2d6 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 1838b43e52..4d1481e8b0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4537,7 +4537,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_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index dd5a090aff..743ae8546b 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -552,7 +552,7 @@ static const struct { }, .ipv6.hdr = { .proto = 0xff, - .vtc_flow = RTE_BE32(0xfful << IPV6_HDR_FL_SHIFT), + .vtc_flow = RTE_BE32(0xfful << RTE_IPV6_HDR_FL_SHIFT), .hop_limits = 0xff, .src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff" @@ -1426,7 +1426,7 @@ flow_tcf_validate_vxlan_encap_ipv6(const struct rte_flow_item *item, " vxlan encapsulation"); } msk6 = (rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6 && msk6 != 0xff) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM_MASK, mask, @@ -2551,7 +2551,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -2639,7 +2639,7 @@ flow_tcf_vxlan_encap_size(const struct rte_flow_action *action) if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -3037,11 +3037,11 @@ flow_tcf_parse_vxlan_encap_ipv6(const struct rte_flow_item_ipv6 *spec, FLOW_TCF_ENCAP_IPV6_DST; if (mask) { if ((rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff) { + RTE_IPV6_HDR_TC_SHIFT) & 0xff) { encap->mask |= FLOW_TCF_ENCAP_IP_TOS; encap->ip_tos = (rte_be_to_cpu_32 (spec->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; } if (mask->hdr.hop_limits) { encap->mask |= FLOW_TCF_ENCAP_IP_TTL; @@ -3590,11 +3590,11 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, mask.ipv6->hdr.hop_limits); } msk6 = (rte_be_to_cpu_32(mask.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6) { tos6 = (rte_be_to_cpu_32 (spec.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; mnl_attr_put_u8 (nlh, tunnel_outer ? TCA_FLOWER_KEY_ENC_IP_TOS : diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 42738246ca..7857ae32be 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -474,17 +474,17 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow, 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 2b1dba15b7..531569b125 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 7749458e4b..949798c39a 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -684,8 +684,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 c75a410f4f..e68d0f694b 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 9c8a0a9b93..ba6e29c319 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -168,14 +168,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 00a95e07a7..97c4994255 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/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 2faa7dc6cd..08fbdea48b 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -936,7 +936,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) if (rc6 >= 0) { RTE_LOG(ERR, IPSEC, "%s: SPI %u used simultaeously by " - "IPv4(%d) and IPv6 (%d) SP rules\n", + "RTE_IPv4(%d) and IPv6 (%d) SP rules\n", __func__, spi, rc4, rc6); return -EINVAL; } else @@ -1025,7 +1025,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) struct rte_ipsec_sa_prm prm; struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | - sizeof(v4) / IPV4_IHL_MULTIPLIER, + sizeof(v4) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, .src_addr = lsa->src.ip.ip4, diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 259c0d19e3..6bad6a92da 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 \ @@ -315,7 +315,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 821112f8c0..d57cd47433 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -403,8 +403,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 b0e933e031..bad6aae8cb 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 0d267e9b27..03beeb1cfc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -258,10 +258,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[] = { @@ -300,14 +300,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 ebb2378dd0..5e3809b8d2 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 fb55e196d7..b0e08f842e 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 881b0c7c0b..de9fd9ab3d 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 da5c662039..9b5684ea68 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 c37b4ef3e4..20f2ea7e68 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -239,7 +239,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 a9bdf1d723..d26aa95b40 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -347,11 +347,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 5f2adc8337..13c9aeea80 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 60c0300e84..73cf553be6 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -308,8 +308,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 2c781724a9..f7c956ee18 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 97da607eda..b7b92ed285 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -75,7 +75,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; @@ -109,8 +109,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; 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 */ @@ -118,7 +118,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 = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len; IP_FRAG_LOG(DEBUG, "%s:%d:\n" diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index a1431ee904..75dfb528d2 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. @@ -349,10 +349,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 b01cacb9c7..7123834842 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -315,7 +315,7 @@ l3: 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; @@ -446,8 +446,8 @@ l3: 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 2e807e8050..0d02f97e5f 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)) -- 2.20.1