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;
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 =
/* 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 =
.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"
.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"
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,
},
{
.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 */
* 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 */
};
{
.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,
{
.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,
{
.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,
{
.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,
{
.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,
{
.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,
.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,
{
.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,
{
.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,
{
.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,
/* 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 */
{.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 */
{.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,
.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,
.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,
.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,
.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,
.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,
/* 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,
.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,
.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,
.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,
.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,
.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,
/* 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,
* 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 = {
* 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 = {
* 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 = {
/* 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,
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 *
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;
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;
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;
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 */
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;
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;
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;
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;
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;
/* 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;
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;
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;
/* 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;
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;
rte_lpm_delete_all(lpm);
- ip = IPv4(128, 0, 0, 0);
+ ip = RTE_IPv4(128, 0, 0, 0);
depth = 25;
next_hop_add = 100;
/* 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;
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);
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);
/* 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;
/* 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;
/* 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);
/* 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);
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;
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);
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);
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;
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;
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);
/* 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);
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;
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);
* 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
/* 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,
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,
#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))
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;
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);
/*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},
};
.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,},
.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,},
.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,},
.. 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:
.. 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:
.. 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);
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 *)
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
/* 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 */
/* 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)
},
.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"
" 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,
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;
}
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;
}
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;
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 :
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. */
#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))
__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)),
- 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) -
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;
}
};
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},
};
/*
};
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},
};
/*
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
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,
};
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 \
* 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);
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 */
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;
};
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[] = {
};
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 \
};
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;
};
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 \
};
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[] = {
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);
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)
};
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[] = {
};
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[] = {
};
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[] = {
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);
* 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);
* 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);
#include <rte_tcp.h>
#include <rte_udp.h>
-#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)
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;
}
#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;
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;
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 */
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"
} __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.
} __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.
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;
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;
/* 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))