[dpdk-dev] [PATCH 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. Jijiang Liu (4): change the 'rte_eth_tunnel_filter_conf' structure add IP in GRE type in the enum 'rte_eth_tunnel_type' implement cloud filter for IP in GRE on i40e add codes to test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 23 --- drivers/net/i40e/i40e_ethdev.c | 21 +++-- lib/librte_ether/rte_eth_ctrl.h |5 +++-- 3 files changed, 34 insertions(+), 15 deletions(-) -- 1.7.7.6
[dpdk-dev] [PATCH 1/4] lib/ether: optimize the 'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c |6 -- drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h |4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..71ccbab 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6638,8 +6638,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + (void)rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..1dd1077 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.7.7.6
[dpdk-dev] [PATCH 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao, Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.7.7.6
[dpdk-dev] [PATCH 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao, Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 1dd1077..25975d2 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5854,6 +5860,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); -- 1.7.7.6
[dpdk-dev] [PATCH 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Signed-off-by: Xutao, Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 26 ++ 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 792da7d..f871095 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -299,12 +299,14 @@ static void cmd_help_long_parsed(void *parsed_result, "Set the outer VLAN TPID for Packet Filtering on" " a port\n\n" - "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter add (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|iningre) (filter_type)" + "(tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" - "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter rm (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|ipingre) (filter_type)" + "(tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6638,6 +6640,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + (void)rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); (void)rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -,6 +6670,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6675,6 +6683,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6720,11 +6730,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid"); cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id = TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result, @@ -6738,8 +6748,8 @@ cmdline_parse_inst_t cmd_tunnel_filter = { .data = (void *)0, .help_str = "add/rm tunnel filter of a port: " "tunnel_filter add port_id outer_mac inner_mac ip " - "inner_vlan tunnel_type(vxlan|nvgre) filter_type " - "(imac-ivlan|imac-ivlan-tenid|imac-tenid|" + "inner_vlan tunnel_type(vxlan|nvgre|ipingre) filter_type " + "(oip|iip|imac-ivlan|imac-ivlan-tenid|imac-tenid|" "imac|omac-imac-tenid) " "tenant_id queue_num", .tokens = { -- 1.7.7.6
[dpdk-dev] [PATCH v2 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. Xutao Sun (4): change the 'rte_eth_tunnel_filter_conf' structure add IP in GRE type in the enum 'rte_eth_tunnel_type' implement cloud filter for ip in GRE on i40e test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 42 ++- drivers/net/i40e/i40e_ethdev.c | 44 - lib/librte_ether/rte_eth_ctrl.h | 5 +++-- 3 files changed, 61 insertions(+), 30 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v2 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH v2 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 1dd1077..5c0eff9 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,7 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5839,22 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; + tunnel_filter->ip_addr.ipv4_addr = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr); (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv4_addr, sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; + for (i = 0; i < 4; i++) { + tunnel_filter->ip_addr.ipv6_addr[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv6_addr, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5866,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5883,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE + | ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v2 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6084449..ad09a4a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -301,12 +301,14 @@ static void cmd_help_long_parsed(void *parsed_result, "Set the outer VLAN TPID for Packet Filtering on" " a port\n\n" - "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter add (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|iningre) (filter_type)" + "(tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" - "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter rm (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|ipingre) (filter_type)" + "(tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + (void)rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); (void)rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid");
[dpdk-dev] [PATCH v2 1/4] lib/ether: optimize the 'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 -- drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6d28c1b..6084449 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + (void)rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..1dd1077 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.9.3
[dpdk-dev] [PATCH v3 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. v3 changes: Remove the deprecation notice and update the release notes. Xutao Sun (4): lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure lib/ether: add IP in GRE type driver/i40e: implement tunnel filter for IP in GRE app/test-pmd: test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 42 ++ doc/guides/rel_notes/deprecation.rst | 5 doc/guides/rel_notes/release_2_3.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 44 lib/librte_ether/rte_eth_ctrl.h | 5 ++-- 5 files changed, 63 insertions(+), 35 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v3 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 -- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_2_3.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6d28c1b..67df259 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e94d4a2..a895364 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -32,11 +32,6 @@ Deprecation Notices RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, but release 2.3 will. -* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields - of outer_mac and inner_mac from pointer to struct in order to keep the - code's readability. The release 2.2 does not contain these ABI changes, but - release 2.3 will, and no backwards compatibility is planned. - * The scheduler statistics structure will change to allow keeping track of RED actions. diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index 99de186..ee7fd48 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -39,6 +39,8 @@ API Changes ABI Changes --- +* The fields of outer_mac and inner_mac were changed from pointer + to struct in order to keep the code's readability. Shared Library Versions --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..1dd1077 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.9.3
[dpdk-dev] [PATCH v3 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 1dd1077..5c0eff9 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,7 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5839,22 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; + tunnel_filter->ip_addr.ipv4_addr = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr); (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv4_addr, sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; + for (i = 0; i < 4; i++) { + tunnel_filter->ip_addr.ipv6_addr[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv6_addr, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5866,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5883,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE + | ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v3 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH v3 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 67df259..4dedf28 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -301,12 +301,14 @@ static void cmd_help_long_parsed(void *parsed_result, "Set the outer VLAN TPID for Packet Filtering on" " a port\n\n" - "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter add (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|iningre) (filter_type)" + "(tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" - "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter rm (port_id) (outer_ip) (inner_ip) (outer_mac)" + "(inner_mac) (ip_addr) (inner_vlan) (vxlan|nvgre|ipingre) (filter_type)" + "(tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid");
[dpdk-dev] [PATCH v6 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 -- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_16_04.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h| 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..c707318 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e94d4a2..a895364 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -32,11 +32,6 @@ Deprecation Notices RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, but release 2.3 will. -* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields - of outer_mac and inner_mac from pointer to struct in order to keep the - code's readability. The release 2.2 does not contain these ABI changes, but - release 2.3 will, and no backwards compatibility is planned. - * The scheduler statistics structure will change to allow keeping track of RED actions. diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 64e913d..704d0f6 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -123,6 +123,8 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* The fields of outer_mac and inner_mac were changed from pointer + to struct in order to keep the code's readability. Shared Library Versions --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..7c22358 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.9.3
[dpdk-dev] [PATCH v6 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Update the testpmd documentation. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 32 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 +++-- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c707318..3e7cec8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -302,11 +302,13 @@ static void cmd_help_long_parsed(void *parsed_result, " a port\n\n" "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid"); cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id = TOKEN_NUM_INITIALIZER(struct cmd_tunnel_
[dpdk-dev] [PATCH v6 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. v3 changes: Remove the deprecation notice and update the release notes. v4 changes: Modify the mistakes in cmdline.c in the old patch. v5 changes: Fix type errors and update the testpmd documentation. v6 changes: Use internal variables to convert byte order. Xutao Sun (4): lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure lib/ether: add IP in GRE type driver/i40e: implement tunnel filter for IP in GRE app/test-pmd: test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 38 +++--- doc/guides/rel_notes/deprecation.rst| 5 --- doc/guides/rel_notes/release_16_04.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 +++-- drivers/net/i40e/i40e_ethdev.c | 49 +++-- lib/librte_ether/rte_eth_ctrl.h | 5 +-- 6 files changed, 97 insertions(+), 37 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v6 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 37 +++-- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7c22358..6d860ee 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; + /* internal varialbe to convert byte order */ + uint32_t convert_ipv4; + uint32_t convert_ipv6[4]; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5842,20 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; - (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + convert_ipv4 = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr); + (void)rte_memcpy(&pfilter->ipaddr.v4.data, &convert_ipv4, sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; - (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + for (i = 0; i < 4; i++) { + convert_ipv6[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } + (void)rte_memcpy(&pfilter->ipaddr.v6.data, &convert_ipv6, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5867,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5884,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE + | ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v6 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH v7 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. v3 changes: Remove the deprecation notice and update the release notes. v4 changes: Modify the mistakes in cmdline.c in the old patch. v5 changes: Fix type errors and update the testpmd documentation. v6 changes: Use internal variables to convert byte order. v7 changes: Modify the mistakes of code style. Xutao Sun (4): lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure lib/ether: add IP in GRE type driver/i40e: implement tunnel filter for IP in GRE app/test-pmd: test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 38 doc/guides/rel_notes/deprecation.rst| 5 doc/guides/rel_notes/release_16_04.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 -- drivers/net/i40e/i40e_ethdev.c | 45 +++-- lib/librte_ether/rte_eth_ctrl.h | 5 ++-- 6 files changed, 94 insertions(+), 36 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v7 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 -- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_16_04.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h| 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..c707318 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e94d4a2..a895364 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -32,11 +32,6 @@ Deprecation Notices RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, but release 2.3 will. -* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields - of outer_mac and inner_mac from pointer to struct in order to keep the - code's readability. The release 2.2 does not contain these ABI changes, but - release 2.3 will, and no backwards compatibility is planned. - * The scheduler statistics structure will change to allow keeping track of RED actions. diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 64e913d..704d0f6 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -123,6 +123,8 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* The fields of outer_mac and inner_mac were changed from pointer + to struct in order to keep the code's readability. Shared Library Versions --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..7c22358 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.9.3
[dpdk-dev] [PATCH v7 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7c22358..237c735 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; + /* internal varialbe to convert ipv6 byte order */ + uint32_t convert_ipv6[4]; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5841,19 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + &rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr), sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; - (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + for (i = 0; i < 4; i++) { + convert_ipv6[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } + (void)rte_memcpy(&pfilter->ipaddr.v6.data, &convert_ipv6, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5865,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5882,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | + ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v7 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Update the testpmd documentation. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 32 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 +++-- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c707318..3e7cec8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -302,11 +302,13 @@ static void cmd_help_long_parsed(void *parsed_result, " a port\n\n" "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid"); cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id = TOKEN_NUM_INITIALIZER(struct cmd_tunnel_
[dpdk-dev] [PATCH v7 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH] examples/vmdq: Fix the core dump issue when mem_pool is more than 34
Macro MAX_QUEUES was defined to 128, only allow 16 mem_pools in theory. When running vmdq_app with more than 34 mem_pools, it will cause the core_dump issue. Change MAX_QUEUES to 1024 will solve this issue. Signed-off-by: Xutao Sun --- examples/vmdq/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index a142d49..b463cfb 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -69,7 +69,7 @@ #include #include -#define MAX_QUEUES 128 +#define MAX_QUEUES 1024 /* * For 10 GbE, 128 queues require roughly * 128*512 (RX/TX_queue_nb * RX/TX_ring_descriptors_nb) per port. -- 1.9.3
[dpdk-dev] [PATCH v2] examples/vmdq: Fix the core dump issue when mem_pool is more than 34
Macro MAX_QUEUES was defined to 128, only allow 16 vmdq_pools in theory. When running vmdq_app with more than 34 vmdq_pools, it will cause the core_dump issue. Change MAX_QUEUES to 1024 will solve this issue. Signed-off-by: Xutao Sun --- v2: - rectify the NUM_MBUFS_PER_PORT since MAX_QUEUES has been changed examples/vmdq/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index a142d49..bba5164 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -69,12 +69,13 @@ #include #include -#define MAX_QUEUES 128 +#define MAX_QUEUES 1024 /* * For 10 GbE, 128 queues require roughly * 128*512 (RX/TX_queue_nb * RX/TX_ring_descriptors_nb) per port. */ -#define NUM_MBUFS_PER_PORT (128*512) +#define NUM_MBUFS_PER_PORT (MAX_QUEUES * RTE_MAX(RTE_TEST_RX_DESC_DEFAULT, \ + RTE_TEST_TX_DESC_DEFAULT)) #define MBUF_CACHE_SIZE 64 #define MAX_PKT_BURST 32 -- 1.9.3
[dpdk-dev] [PATCH v3] examples/vmdq: Fix the core dump issue when mem_pool is more than 34
Macro MAX_QUEUES was defined to 128, only allow 16 vmdq_pools in theory. When running vmdq_app with more than 34 vmdq_pools, it will cause the core_dump issue. Change MAX_QUEUES to 1024 will solve this issue. Signed-off-by: Xutao Sun --- v2: - Rectify the NUM_MBUFS_PER_PORT since MAX_QUEUES has been changed v3: - Change the comments above the relevant code. examples/vmdq/main.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index a142d49..178af2f 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -69,12 +69,13 @@ #include #include -#define MAX_QUEUES 128 +#define MAX_QUEUES 1024 /* - * For 10 GbE, 128 queues require roughly - * 128*512 (RX/TX_queue_nb * RX/TX_ring_descriptors_nb) per port. + * 1024 queues require to meet the needs of a large number of vmdq_pools. + * (RX/TX_queue_nb * RX/TX_ring_descriptors_nb) per port. */ -#define NUM_MBUFS_PER_PORT (128*512) +#define NUM_MBUFS_PER_PORT (MAX_QUEUES * RTE_MAX(RTE_TEST_RX_DESC_DEFAULT, \ + RTE_TEST_TX_DESC_DEFAULT)) #define MBUF_CACHE_SIZE 64 #define MAX_PKT_BURST 32 -- 1.9.3
[dpdk-dev] [PATCH v1] i40e: Fix the statistics issue of i40e
The old statistics on i40e only count the packets on ports. This patch is to make statistics for packets both on ports and VSI. But there're still some issues about statistics for 'bytes'. Signed-off-by: Xutao Sun --- drivers/net/i40e/i40e_ethdev.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 40b0526..a8d7116 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1511,21 +1511,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v2] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. Signed-off-by: Xutao Sun --- drivers/net/i40e/i40e_ethdev.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 40b0526..5e20fa7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1511,21 +1511,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; - stats->ibytes = ns->eth.rx_bytes; - stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; + stats->ibytes = pf->main_vsi->eth_stats.rx_bytes; + stats->obytes = pf->main_vsi->eth_stats.tx_bytes; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. v2 changes: Reword comments. v3 changes: Update documentation. Xutao Sun (2): i40e: Fix the statistics issue of i40e doc: update release notes doc/guides/rel_notes/release_2_1.rst | 5 + drivers/net/i40e/i40e_ethdev.c | 23 ++- 2 files changed, 19 insertions(+), 9 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v3 1/2] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. Signed-off-by: Xutao Sun --- v2: - reword comments drivers/net/i40e/i40e_ethdev.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 40b0526..5e20fa7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1511,21 +1511,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; - stats->ibytes = ns->eth.rx_bytes; - stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; + stats->ibytes = pf->main_vsi->eth_stats.rx_bytes; + stats->obytes = pf->main_vsi->eth_stats.tx_bytes; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v3 2/2] doc: update release notes
Update release notes with the newly resolved issues about statistics on i40e. Signed-off-by: Xutao Sun --- doc/guides/rel_notes/release_2_1.rst | 5 + 1 file changed, 5 insertions(+) diff --git a/doc/guides/rel_notes/release_2_1.rst b/doc/guides/rel_notes/release_2_1.rst index 103a5ee..897f939 100644 --- a/doc/guides/rel_notes/release_2_1.rst +++ b/doc/guides/rel_notes/release_2_1.rst @@ -676,6 +676,11 @@ Resolved Issues * **i40e: Fix registers access from big endian CPU.** +* **i40e: Fix statistics of packets.** + + Add discarding packets on VSI to the stats and rectify the old statistics. + + * **i40evf: Clear command when error occurs.** -- 1.9.3
[dpdk-dev] [PATCH v4] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. Also update release notes. Signed-off-by: Xutao Sun --- v2: - reword comments v3: - update release notes v4: - fix the wrong release notes and move the doc as part of this patch doc/guides/rel_notes/release_2_2.rst | 4 drivers/net/i40e/i40e_ethdev.c | 23 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 682f468..e80c20d 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -8,6 +8,10 @@ New Features Resolved Issues --- +* **i40e: Fix statistics of packets.** + + Add discarding packets on VSI to the stats and rectify the old statistics. + Known Issues diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 40b0526..5e20fa7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1511,21 +1511,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; - stats->ibytes = ns->eth.rx_bytes; - stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; + stats->ibytes = pf->main_vsi->eth_stats.rx_bytes; + stats->obytes = pf->main_vsi->eth_stats.tx_bytes; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. Also update release notes. Signed-off-by: Xutao Sun --- v2: - reword comments v3: - update release notes v4: - fix the wrong release notes and move the doc as part of this patch v5: - fix the patch_apply issue doc/guides/rel_notes/release_2_2.rst | 4 drivers/net/i40e/i40e_ethdev.c | 23 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 89e4d58..8991209 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -67,6 +67,10 @@ Drivers Fixed i40e issue that occurred when a DPDK application didn't initialize ports if memory wasn't available on socket 0. +* **i40e: Fix statistics of packets.** + + Add discarding packets on VSI to the stats and rectify the old statistics. + * **vhost: Fixed Qemu shutdown.** Fixed issue with libvirt ``virsh destroy`` not killing the VM. diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 2dd9fdc..5365192 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1511,21 +1511,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; - stats->ibytes = ns->eth.rx_bytes; - stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; + stats->ibytes = pf->main_vsi->eth_stats.rx_bytes; + stats->obytes = pf->main_vsi->eth_stats.tx_bytes; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v6] i40e: Fix the statistics issue of i40e
The old statistics on i40e only counted the packets on ports. So the discarding packets on VSI were not counted. This patch is to make statistics for packets both on ports and VSI. Also update release notes. Signed-off-by: Xutao Sun --- v2: - reword comments v3: - update release notes v4: - fix the wrong release notes and move the doc as part of this patch v5: - fix the patch_apply issue v6: - rebase on Harry's patches doc/guides/rel_notes/release_2_2.rst | 5 + drivers/net/i40e/i40e_ethdev.c | 23 ++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index ca8471b..e012ccf 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -134,6 +134,11 @@ Drivers as long as the total number of queues used in PF, VFs, VMDq and FD does not exceeds the hardware maximum. +* **i40e: Fixed statistics of packets.** + + Fixed the issue in i40e of statistics. Added discarding packets on VSI to + the stats and rectify the old statistics. + * **vhost: Fixed Qemu shutdown.** Fixed issue with libvirt ``virsh destroy`` not killing the VM. diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 34acc8c..df9db04 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1858,21 +1858,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* call read registers - updates values, now write them to struct */ i40e_read_stats_registers(pf, hw); - stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast; - stats->ibytes = ns->eth.rx_bytes; - stats->obytes = ns->eth.tx_bytes; - stats->oerrors = ns->eth.tx_errors; - stats->imcasts = ns->eth.rx_multicast; + stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + + pf->main_vsi->eth_stats.rx_multicast + + pf->main_vsi->eth_stats.rx_broadcast - + pf->main_vsi->eth_stats.rx_discards; + stats->opackets = pf->main_vsi->eth_stats.tx_unicast + + pf->main_vsi->eth_stats.tx_multicast + + pf->main_vsi->eth_stats.tx_broadcast; + stats->ibytes = pf->main_vsi->eth_stats.rx_bytes; + stats->obytes = pf->main_vsi->eth_stats.tx_bytes; + stats->oerrors = ns->eth.tx_errors + + pf->main_vsi->eth_stats.tx_errors; + stats->imcasts = pf->main_vsi->eth_stats.rx_multicast; stats->fdirmatch = ns->fd_sb_match; /* Rx Errors */ stats->ibadcrc = ns->crc_errors; stats->ibadlen = ns->rx_length_errors + ns->rx_undersize + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; - stats->imissed = ns->eth.rx_discards; + stats->imissed = ns->eth.rx_discards + + pf->main_vsi->eth_stats.rx_discards; stats->ierrors = stats->ibadcrc + stats->ibadlen + stats->imissed; PMD_DRV_LOG(DEBUG, "* PF stats start ***"); -- 1.9.3
[dpdk-dev] [PATCH v4 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. v3 changes: Remove the deprecation notice and update the release notes. v4 changes: Modify the mistakes in cmdline.c in the old patch Xutao Sun (4): lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure lib/ether: add IP in GRE type driver/i40e: implement tunnel filter for IP in GRE app/test-pmd: test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 42 +--- doc/guides/rel_notes/deprecation.rst | 5 doc/guides/rel_notes/release_16_04.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 44 +++--- lib/librte_ether/rte_eth_ctrl.h| 5 ++-- 5 files changed, 63 insertions(+), 35 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v4 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH v4 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c707318..6a5cd9f 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -301,12 +301,14 @@ static void cmd_help_long_parsed(void *parsed_result, "Set the outer VLAN TPID for Packet Filtering on" " a port\n\n" - "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr)" + "(inner_vlan) (vxlan|nvgre|iningre) (filter_type)" + "(tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" - "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr)" + "(inner_vlan) (vxlan|nvgre|ipingre) (filter_type)" + "(tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid"); cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id =
[dpdk-dev] [PATCH v4 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 -- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_16_04.rst | 2 ++ drivers/net/i40e/i40e_ethdev.c | 12 ++-- lib/librte_ether/rte_eth_ctrl.h| 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..c707318 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e94d4a2..a895364 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -32,11 +32,6 @@ Deprecation Notices RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, but release 2.3 will. -* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields - of outer_mac and inner_mac from pointer to struct in order to keep the - code's readability. The release 2.2 does not contain these ABI changes, but - release 2.3 will, and no backwards compatibility is planned. - * The scheduler statistics structure will change to allow keeping track of RED actions. diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index eb1b3b2..2588225 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -104,6 +104,8 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* The fields of outer_mac and inner_mac were changed from pointer + to struct in order to keep the code's readability. Shared Library Versions --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..7c22358 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_addr)); - (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac, - sizeof(struct ether_addr)); + (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac, + ETHER_ADDR_LEN); + (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, + ETHER_ADDR_LEN); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6131,13 +6131,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(filter->outer_mac))) { + (is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(filter->inner_mac))) { + (is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..30cbde7 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -280,8 +280,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr *outer_mac; /**< Outer MAC address filter. */ - struct ether_addr *inner_mac; /**< Inner MAC address filter. */ + struct ether_addr outer_mac; /**< Outer MAC address filter. */ + struct ether_addr inner_mac; /**< Inner MAC address filter. */ uint16_t inner_vlan; /**< Inner VLAN filter. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ union { -- 1.9.3
[dpdk-dev] [PATCH v4 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7c22358..a33fef5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,7 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5839,22 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; + tunnel_filter->ip_addr.ipv4_addr = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr); (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv4_addr, sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; + for (i = 0; i < 4; i++) { + tunnel_filter->ip_addr.ipv6_addr[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv6_addr, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5866,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5883,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE + | ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v5 0/4] Add tunnel filter support for IP in GRE on i40e
This patch set adds tunnel filter support for IP in GRE on i40e. v2 changes: Fix the byte order problem. v3 changes: Remove the deprecation notice and update the release notes. v4 changes: Modify the mistakes in cmdline.c in the old patch. v5 changes: Fix type errors and update the testpmd documentation. Xutao Sun (4): lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure lib/ether: add IP in GRE type driver/i40e: implement tunnel filter for IP in GRE app/test-pmd: test tunnel filter for IP in GRE app/test-pmd/cmdline.c | 38 + doc/guides/rel_notes/deprecation.rst| 5 doc/guides/rel_notes/release_16_04.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 +-- drivers/net/i40e/i40e_ethdev.c | 44 - lib/librte_ether/rte_eth_ctrl.h | 5 ++-- 6 files changed, 94 insertions(+), 35 deletions(-) -- 1.9.3
[dpdk-dev] [PATCH v5 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure
Change the fields of outer_mac and inner_mac from pointer to struct in order to keep the code's readability. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 6 +++-- doc/guides/rel_notes/deprecation.rst| 5 - doc/guides/rel_notes/release_16_04.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 +++-- drivers/net/i40e/i40e_ethdev.c | 12 +- lib/librte_ether/rte_eth_ctrl.h | 4 ++-- 6 files changed, 47 insertions(+), 17 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..c707318 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6640,8 +6640,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; - tunnel_filter_conf.outer_mac = &res->outer_mac; - tunnel_filter_conf.inner_mac = &res->inner_mac; + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, + ETHER_ADDR_LEN); + rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, + ETHER_ADDR_LEN); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e94d4a2..a895364 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -32,11 +32,6 @@ Deprecation Notices RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, but release 2.3 will. -* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields - of outer_mac and inner_mac from pointer to struct in order to keep the - code's readability. The release 2.2 does not contain these ABI changes, but - release 2.3 will, and no backwards compatibility is planned. - * The scheduler statistics structure will change to allow keeping track of RED actions. diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index eb1b3b2..2588225 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -104,6 +104,8 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* The fields of outer_mac and inner_mac were changed from pointer + to struct in order to keep the code's readability. Shared Library Versions --- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a520cc5..3ee629a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -553,7 +553,37 @@ tunnel_filter add Add a tunnel filter on a port:: testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \ -(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id) +(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ +imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) + +The available information categories are: + +* ``vxlan``: Set tunnel type as VXLAN. + +* ``nvgre``: Set tunnel type as NVGRE. + +* ``ipingre``: Set tunnel type as IP-in-GRE. + +* ``imac-ivlan``: Set filter type as Inner MAC and VLAN. + +* ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID. + +* ``imac-tenid``: Set filter type as Inner MAC and tenant ID. + +* ``imac``: Set filter type as Inner MAC. + +* ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID. + +* ``oip``: Set filter type as Outer IP. + +* ``iip``: Set filter type as Inner IP. + +Example:: + + testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \ +192.168.2.2 0 ipingre oip 1 1 + + Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP. tunnel_filter remove @@ -561,7 +591,8 @@ tunnel_filter remove Remove a tunnel filter on a port:: testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \ -(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id) +(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ +imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) rx_vxlan_port add ~ diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..7c22358 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5828,10 +5828,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac, - sizeof(struct ether_ad
[dpdk-dev] [PATCH v5 2/4] lib/ether: add IP in GRE type
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- lib/librte_ether/rte_eth_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 30cbde7..0e948a1 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -244,6 +244,7 @@ enum rte_eth_tunnel_type { RTE_TUNNEL_TYPE_GENEVE, RTE_TUNNEL_TYPE_TEREDO, RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, RTE_TUNNEL_TYPE_MAX, }; -- 1.9.3
[dpdk-dev] [PATCH v5 3/4] driver/i40e: implement tunnel filter for IP in GRE
Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- drivers/net/i40e/i40e_ethdev.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7c22358..a33fef5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5797,6 +5797,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag) case ETH_TUNNEL_FILTER_IMAC: *flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC; break; + case ETH_TUNNEL_FILTER_OIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_OIP; + break; + case ETH_TUNNEL_FILTER_IIP: + *flag = I40E_AQC_ADD_CLOUD_FILTER_IIP; + break; default: PMD_DRV_LOG(ERR, "invalid tunnel filter type"); return -EINVAL; @@ -5811,7 +5817,7 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, uint8_t add) { uint16_t ip_type; - uint8_t tun_type = 0; + uint8_t i, tun_type = 0; int val, ret = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi = pf->main_vsi; @@ -5833,16 +5839,22 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac, ETHER_ADDR_LEN); - pfilter->inner_vlan = tunnel_filter->inner_vlan; + pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; + tunnel_filter->ip_addr.ipv4_addr = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr); (void)rte_memcpy(&pfilter->ipaddr.v4.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv4_addr, sizeof(pfilter->ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; + for (i = 0; i < 4; i++) { + tunnel_filter->ip_addr.ipv6_addr[i] = + rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]); + } (void)rte_memcpy(&pfilter->ipaddr.v6.data, - &tunnel_filter->ip_addr, + &tunnel_filter->ip_addr.ipv6_addr, sizeof(pfilter->ipaddr.v6.data)); } @@ -5854,6 +5866,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, case RTE_TUNNEL_TYPE_NVGRE: tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC; break; + case RTE_TUNNEL_TYPE_IP_IN_GRE: + tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; + break; default: /* Other tunnel types is not supported. */ PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ -5868,10 +5883,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, return -EINVAL; } - pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type | - (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT); - pfilter->tenant_id = tunnel_filter->tenant_id; - pfilter->queue_number = tunnel_filter->queue_id; + pfilter->flags |= rte_cpu_to_le_16( + I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE + | ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)); + pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id); + pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id); if (add) ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1); -- 1.9.3
[dpdk-dev] [PATCH v5 4/4] app/test-pmd: test tunnel filter for IP in GRE
This patch add some options in tunnel_filter command to test IP in GRE packet classification on i40e. Signed-off-by: Xutao Sun Signed-off-by: Jijiang Liu --- app/test-pmd/cmdline.c | 32 ++-- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c707318..3e7cec8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -302,11 +302,13 @@ static void cmd_help_long_parsed(void *parsed_result, " a port\n\n" "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " add a tunnel filter of a port.\n\n" "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) " - "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n" + "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|" + "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n" " remove a tunnel filter of a port.\n\n" "rx_vxlan_port add (udp_port) (port_id)\n" @@ -6640,6 +6642,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, struct rte_eth_tunnel_filter_conf tunnel_filter_conf; int ret = 0; + memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); + rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac, ETHER_ADDR_LEN); rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac, @@ -6648,12 +6652,14 @@ cmd_tunnel_filter_parsed(void *parsed_result, if (res->ip_value.family == AF_INET) { tunnel_filter_conf.ip_addr.ipv4_addr = - res->ip_value.addr.ipv4.s_addr; + rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr); tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4; } else { - memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr), - &(res->ip_value.addr.ipv6), - sizeof(struct in6_addr)); + int i; + for (i = 0; i < 4; i++) { + tunnel_filter_conf.ip_addr.ipv6_addr[i] = + rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]); + } tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6; } @@ -6669,6 +6675,10 @@ cmd_tunnel_filter_parsed(void *parsed_result, else if (!strcmp(res->filter_type, "omac-imac-tenid")) tunnel_filter_conf.filter_type = RTE_TUNNEL_FILTER_OMAC_TENID_IMAC; + else if (!strcmp(res->filter_type, "oip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_OIP; + else if (!strcmp(res->filter_type, "iip")) + tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP; else { printf("The filter type is not supported"); return; @@ -6678,6 +6688,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN; else if (!strcmp(res->tunnel_type, "nvgre")) tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE; + else if (!strcmp(res->tunnel_type, "ipingre")) + tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE; else { printf("The tunnel type %s not supported.\n", res->tunnel_type); return; @@ -6723,11 +6735,11 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = ip_value); cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - tunnel_type, "vxlan#nvgre"); + tunnel_type, "vxlan#nvgre#ipingre"); cmdline_parse_token_string_t cmd_tunnel_filter_filter_type = TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result, - filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#" + filter_type, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#" "imac#omac-imac-tenid"); cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id = TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result, @@ -6741,8 +6753,8 @@ cmdline_parse_inst_t cmd_tunnel_filter = { .data = (void *)0, .help_str = &q