support item NSH matching
cover support item NSH matching
NSH can be matched using the existed item: RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh
Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSH
app/test-pmd/cmdline_flow.c | 26 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 7 files changed, 96 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/5 app/testpmd: support for VXLAN-GPE's next protocol
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Example:
flow create 0 transfer group 1 pattern eth / ipv6 / udp dst is 4790 / vxlan-gpe protocol is 0x04 / eth / ipv4 / tcp / end actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
app/test-pmd/cmdline_flow.c +10 -0
@@ -385,6 +385,7 @@ enum index {ITEM_GENEVE_OPTLEN ,ITEM_VXLAN_GPE ,ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_ARP_ETH_IPV4 ,ITEM_ARP_ETH_IPV4_SHA , ITEM_ARP_ETH_IPV4_SPA,
@@ -1758,6 +1759,7 @@ static const enum index item_geneve[] = {static const enum index item_vxlan_gpe[] = {ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_NEXT ,ZERO , };
@@ -4804,6 +4806,14 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, hdr.vni)), }, + [ITEM_VXLAN_GPE_PROTO] = { + .name = "protocol", + .help = "VXLAN-GPE next protocol", + .next =NEXT (item_vxlan_gpe,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, + protocol)), + }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", .help = "match ARP header for Ethernet/IPv4",
Signature · 1 line
2.34.1
PATCH 2/5 common/mlx5: extend HCA attribute query for NSH
In reply to Haifei LuoAdd NSH supporting field in two places:
1. New HCA capability indicating NSH is supported
2. New field in "mlx5_ifc_per_protocol_networking_offload_caps_bits" structure
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1313,6 +1313,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->tunnel_stateless_gtp =MLX5_GET (per_protocol_networking_offload_caps, hcattr, tunnel_stateless_gtp); + attr->tunnel_stateless_vxlan_gpe_nsh =MLX5_GET + (per_protocol_networking_offload_caps, + hcattr, tunnel_stateless_vxlan_gpe_nsh); attr->rss_ind_tbl_cap =MLX5_GET (per_protocol_networking_offload_caps, hcattr, rss_ind_tbl_cap);
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -196,6 +196,7 @@ struct mlx5_hca_attr { uint32_t tunnel_stateless_geneve_rx:1; uint32_t geneve_max_opt_len:1; /* 0x0: 14DW, 0x1: 63DW */ uint32_t tunnel_stateless_gtp:1; + uint32_t tunnel_stateless_vxlan_gpe_nsh:1;uint32_t max_lso_cap; uint32_t scatter_fcs:1; uint32_t lro_cap:1;
drivers/common/mlx5/mlx5_prm.h +3 -1
@@ -1964,7 +1964,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {u8 swp_lso[0x1 ];u8 reserved_at_23[0x8 ];u8 tunnel_stateless_gtp[0x1 ]; -u8 reserved_at_25[0x4 ]; +u8 reserved_at_25[0x2 ]; +u8 tunnel_stateless_vxlan_gpe_nsh[0x1 ]; +u8 reserved_at_28[0x1 ];u8 max_vxlan_udp_ports[0x8 ];u8 reserved_at_38[0x6 ];u8 max_geneve_opt_len[0x1 ];
Signature · 1 line
2.34.1
PATCH 3/5 net/mlx5: enhance the validation for item VXLAN-GPE
In reply to Haifei LuoEnhance the validation so that configuring vxlan-gpe's next protocol as NSH is supported.
1. The spec's protocol can have value and nic_mask's protocol is 0xff.
--- drivers/net/mlx5/mlx5_flow.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow.c +6 -7
@@ -3198,6 +3198,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,uint8_t vni[4 ]; } id = { .vlan_id = 0, }; +struct rte_flow_item_vxlan_gpe nic_mask = { + .vni ="\xff\xff\xff" , + .protocol =0xff , + }; +if (!priv->sh->config.l3_vxlan_en) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -3221,18 +3226,12 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, mask = &rte_flow_item_vxlan_gpe_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_vxlan_gpe_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_vxlan_gpe ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);if (ret <0 )return ret;if (spec) { -if (spec->hdr.proto) -return rte_flow_error_set (error,ENOTSUP , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"VxLAN-GPE protocol" -" not supported" );memcpy (&id.vni[1 ], spec->hdr.vni,3 );memcpy (&id.vni[1 ], mask->hdr.vni,3 ); }
Signature · 1 line
2.34.1
PATCH 4/5 app/testpmd: support for NSH flow item
In reply to Haifei LuoAdd support for item NSH. The CLI is: nsh Example:
flow create 0 transfer group 1
pattern eth / ipv6 / udp dst is 4790 /
vxlan-gpe / nsh / eth / ipv4 / tcp / end
actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
app/test-pmd/cmdline_flow.c +16 -0
@@ -525,6 +525,7 @@ enum index {ITEM_IB_BTH_PSN ,ITEM_IPV6_PUSH_REMOVE_EXT ,ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ITEM_NSH ,/* Validate/create actions. */ ACTIONS,
@@ -1562,6 +1563,7 @@ static const enum index next_item[] = {ITEM_AGGR_AFFINITY ,ITEM_TX_QUEUE ,ITEM_IB_BTH , +ITEM_NSH ,END_SET , ZERO, };
@@ -2081,6 +2083,11 @@ static const enum index item_ib_bth[] = { ZERO, }; +static const enum index item_nsh[] = { +ITEM_NEXT , +ZERO , +}; +static const enum index next_action[] = {ACTION_END ,ACTION_VOID ,
@@ -5837,6 +5844,15 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, hdr.psn)), }, + [ITEM_NSH] = { + .name = "nsh", + .help = "match NSH header", + .priv =PRIV_ITEM (NSH , + sizeof(struct rte_flow_item_nsh)), + .next = NEXT(item_nsh), + .call = parse_vc, + }, +/* Validate/create actions. */ [ACTIONS] = { .name = "actions",
Signature · 1 line
2.34.1
PATCH 5/5 net/mlx5: add support for item NSH
In reply to Haifei Luo1. Add validation for item NSH.
It will fail if HCA cap for NSH is false.
2. Add item_flags for NSH.
3. For vxlan-gpe if next header is NSH, set next_protocol as NSH.
--- drivers/net/mlx5/mlx5_flow.c | 39 +++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 6 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +39 -0
@@ -3905,6 +3905,45 @@ mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item, MLX5_ITEM_RANGE_NOT_ACCEPTED, error); } +/** +* Validate the NSH item. +* +* @param[in] dev +* Pointer to Ethernet device on which flow rule is being created on. +* @param[out] error +* Pointer to error structure. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error) +{ +struct mlx5_priv *priv = dev->data->dev_private; + +if (item->mask) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"NSH fields matching is not supported" ); + } + +if (!priv->sh->config.dv_flow_en) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"NSH support requires DV flow interface" ); + } + +if (!priv->sh->cdev->config.hca_attr.tunnel_stateless_vxlan_gpe_nsh) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"Current FW does not support matching on NSH" ); + } + +return 0 ; +} + static int flow_null_validate(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr __rte_unused,
drivers/net/mlx5/mlx5_flow.h +6 -0
@@ -233,6 +233,9 @@ enum mlx5_feature_name {/* IB BTH ITEM. */ #define MLX5_FLOW_ITEM_IB_BTH (1ull << 51) +/* NSH ITEM */ +#define MLX5_FLOW_ITEM_NSH (1ull << 53) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
@@ -2453,6 +2456,9 @@ int mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item,uint16_t ether_type, const struct rte_flow_item_ecpri *acc_mask, struct rte_flow_error *error); +int mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error); int mlx5_flow_create_mtr_tbls(struct rte_eth_dev *dev, struct mlx5_flow_meter_info *fm, uint32_t mtr_idx,
drivers/net/mlx5/mlx5_flow_dv.c +12 -1
@@ -7815,6 +7815,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + ret =mlx5_flow_validate_item_nsh (dev, items, error); +if (ret <0 ) +return ret; + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default : return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
@@ -9720,7 +9726,9 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, v_protocol = vxlan_v->hdr.protocol;if (!m_protocol) {/* Force next protocol to ensure next headers parsing. */ -if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) +if (pattern_flags &MLX5_FLOW_ITEM_NSH ) + v_protocol =RTE_VXLAN_GPE_TYPE_NSH ; +else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) v_protocol =RTE_VXLAN_GPE_TYPE_ETH ;else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L3_IPV4 ) v_protocol =RTE_VXLAN_GPE_TYPE_IPV4 ;
@@ -13910,6 +13918,9 @@ flow_dv_translate_items(struct rte_eth_dev *dev,flow_dv_translate_item_ib_bth (key, items, tunnel, key_type); last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default :break ; }
Signature · 1 line
2.34.1
v2 cover support item NSH matching
In reply to Haifei LuoNSH can be matched using the existed item: RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
V2: Add Ack info in commit message.
Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSH
app/test-pmd/cmdline_flow.c | 26 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 7 files changed, 96 insertions(+), 9 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/5 app/testpmd: support for VXLAN-GPE's next protocol
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Example:
flow create 0 transfer group 1 pattern eth / ipv6 / udp dst is 4790 / vxlan-gpe protocol is 0x04 / eth / ipv4 / tcp / end actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
app/test-pmd/cmdline_flow.c +10 -0
@@ -385,6 +385,7 @@ enum index {ITEM_GENEVE_OPTLEN ,ITEM_VXLAN_GPE ,ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_ARP_ETH_IPV4 ,ITEM_ARP_ETH_IPV4_SHA , ITEM_ARP_ETH_IPV4_SPA,
@@ -1758,6 +1759,7 @@ static const enum index item_geneve[] = {static const enum index item_vxlan_gpe[] = {ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_NEXT ,ZERO , };
@@ -4804,6 +4806,14 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, hdr.vni)), }, + [ITEM_VXLAN_GPE_PROTO] = { + .name = "protocol", + .help = "VXLAN-GPE next protocol", + .next =NEXT (item_vxlan_gpe,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, + protocol)), + }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", .help = "match ARP header for Ethernet/IPv4",
Signature · 1 line
2.27.0
PATCH v2 2/5 common/mlx5: extend HCA attribute query for NSH
In reply to Haifei LuoAdd NSH supporting field in two places:
1. New HCA capability indicating NSH is supported
2. New field in "mlx5_ifc_per_protocol_networking_offload_caps_bits" structure
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1313,6 +1313,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->tunnel_stateless_gtp =MLX5_GET (per_protocol_networking_offload_caps, hcattr, tunnel_stateless_gtp); + attr->tunnel_stateless_vxlan_gpe_nsh =MLX5_GET + (per_protocol_networking_offload_caps, + hcattr, tunnel_stateless_vxlan_gpe_nsh); attr->rss_ind_tbl_cap =MLX5_GET (per_protocol_networking_offload_caps, hcattr, rss_ind_tbl_cap);
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -196,6 +196,7 @@ struct mlx5_hca_attr { uint32_t tunnel_stateless_geneve_rx:1; uint32_t geneve_max_opt_len:1; /* 0x0: 14DW, 0x1: 63DW */ uint32_t tunnel_stateless_gtp:1; + uint32_t tunnel_stateless_vxlan_gpe_nsh:1;uint32_t max_lso_cap; uint32_t scatter_fcs:1; uint32_t lro_cap:1;
drivers/common/mlx5/mlx5_prm.h +3 -1
@@ -1964,7 +1964,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {u8 swp_lso[0x1 ];u8 reserved_at_23[0x8 ];u8 tunnel_stateless_gtp[0x1 ]; -u8 reserved_at_25[0x4 ]; +u8 reserved_at_25[0x2 ]; +u8 tunnel_stateless_vxlan_gpe_nsh[0x1 ]; +u8 reserved_at_28[0x1 ];u8 max_vxlan_udp_ports[0x8 ];u8 reserved_at_38[0x6 ];u8 max_geneve_opt_len[0x1 ];
Signature · 1 line
2.27.0
PATCH v2 3/5 net/mlx5: enhance the validation for item VXLAN-GPE
In reply to Haifei LuoEnhance the validation so that configuring vxlan-gpe's next protocol as NSH is supported.
1. The spec's protocol can have value and nic_mask's protocol is 0xff.
--- drivers/net/mlx5/mlx5_flow.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow.c +6 -7
@@ -3198,6 +3198,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,uint8_t vni[4 ]; } id = { .vlan_id = 0, }; +struct rte_flow_item_vxlan_gpe nic_mask = { + .vni ="\xff\xff\xff" , + .protocol =0xff , + }; +if (!priv->sh->config.l3_vxlan_en) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -3221,18 +3226,12 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, mask = &rte_flow_item_vxlan_gpe_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_vxlan_gpe_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_vxlan_gpe ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);if (ret <0 )return ret;if (spec) { -if (spec->hdr.proto) -return rte_flow_error_set (error,ENOTSUP , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"VxLAN-GPE protocol" -" not supported" );memcpy (&id.vni[1 ], spec->hdr.vni,3 );memcpy (&id.vni[1 ], mask->hdr.vni,3 ); }
Signature · 1 line
2.27.0
PATCH v2 4/5 app/testpmd: support for NSH flow item
In reply to Haifei LuoAdd support for item NSH. The CLI is: nsh Example:
flow create 0 transfer group 1
pattern eth / ipv6 / udp dst is 4790 /
vxlan-gpe / nsh / eth / ipv4 / tcp / end
actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
app/test-pmd/cmdline_flow.c +16 -0
@@ -525,6 +525,7 @@ enum index {ITEM_IB_BTH_PSN ,ITEM_IPV6_PUSH_REMOVE_EXT ,ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ITEM_NSH ,/* Validate/create actions. */ ACTIONS,
@@ -1562,6 +1563,7 @@ static const enum index next_item[] = {ITEM_AGGR_AFFINITY ,ITEM_TX_QUEUE ,ITEM_IB_BTH , +ITEM_NSH ,END_SET , ZERO, };
@@ -2081,6 +2083,11 @@ static const enum index item_ib_bth[] = { ZERO, }; +static const enum index item_nsh[] = { +ITEM_NEXT , +ZERO , +}; +static const enum index next_action[] = {ACTION_END ,ACTION_VOID ,
@@ -5837,6 +5844,15 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, hdr.psn)), }, + [ITEM_NSH] = { + .name = "nsh", + .help = "match NSH header", + .priv =PRIV_ITEM (NSH , + sizeof(struct rte_flow_item_nsh)), + .next = NEXT(item_nsh), + .call = parse_vc, + }, +/* Validate/create actions. */ [ACTIONS] = { .name = "actions",
Signature · 1 line
2.27.0
PATCH v2 5/5 net/mlx5: add support for item NSH
In reply to Haifei Luo1. Add validation for item NSH.
It will fail if HCA cap for NSH is false.
2. Add item_flags for NSH.
3. For vxlan-gpe if next header is NSH, set next_protocol as NSH.
--- drivers/net/mlx5/mlx5_flow.c | 39 +++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 6 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +39 -0
@@ -3905,6 +3905,45 @@ mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item, MLX5_ITEM_RANGE_NOT_ACCEPTED, error); } +/** +* Validate the NSH item. +* +* @param[in] dev +* Pointer to Ethernet device on which flow rule is being created on. +* @param[out] error +* Pointer to error structure. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error) +{ +struct mlx5_priv *priv = dev->data->dev_private; + +if (item->mask) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"NSH fields matching is not supported" ); + } + +if (!priv->sh->config.dv_flow_en) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"NSH support requires DV flow interface" ); + } + +if (!priv->sh->cdev->config.hca_attr.tunnel_stateless_vxlan_gpe_nsh) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"Current FW does not support matching on NSH" ); + } + +return 0 ; +} + static int flow_null_validate(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr __rte_unused,
drivers/net/mlx5/mlx5_flow.h +6 -0
@@ -233,6 +233,9 @@ enum mlx5_feature_name {/* IB BTH ITEM. */ #define MLX5_FLOW_ITEM_IB_BTH (1ull << 51) +/* NSH ITEM */ +#define MLX5_FLOW_ITEM_NSH (1ull << 53) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
@@ -2453,6 +2456,9 @@ int mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item,uint16_t ether_type, const struct rte_flow_item_ecpri *acc_mask, struct rte_flow_error *error); +int mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error); int mlx5_flow_create_mtr_tbls(struct rte_eth_dev *dev, struct mlx5_flow_meter_info *fm, uint32_t mtr_idx,
drivers/net/mlx5/mlx5_flow_dv.c +12 -1
@@ -7815,6 +7815,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + ret =mlx5_flow_validate_item_nsh (dev, items, error); +if (ret <0 ) +return ret; + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default : return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
@@ -9720,7 +9726,9 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, v_protocol = vxlan_v->hdr.protocol;if (!m_protocol) {/* Force next protocol to ensure next headers parsing. */ -if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) +if (pattern_flags &MLX5_FLOW_ITEM_NSH ) + v_protocol =RTE_VXLAN_GPE_TYPE_NSH ; +else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) v_protocol =RTE_VXLAN_GPE_TYPE_ETH ;else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L3_IPV4 ) v_protocol =RTE_VXLAN_GPE_TYPE_IPV4 ;
@@ -13910,6 +13918,9 @@ flow_dv_translate_items(struct rte_eth_dev *dev,flow_dv_translate_item_ib_bth (key, items, tunnel, key_type); last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default :break ; }
Signature · 1 line
2.27.0
v3 cover support item NSH matching
In reply to Haifei LuoNSH can be matched using the existed item: RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
V2: Add Ack info in commit message.
V3: Add more Ack in commi message.
Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSH
app/test-pmd/cmdline_flow.c | 26 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 7 files changed, 96 insertions(+), 9 deletions(-)
Signature · 1 line
2.27.0
PATCH v3 1/5 app/testpmd: support for VXLAN-GPE's next protocol
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Example:
flow create 0 transfer group 1 pattern eth / ipv6 / udp dst is 4790 / vxlan-gpe protocol is 0x04 / eth / ipv4 / tcp / end actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
app/test-pmd/cmdline_flow.c +10 -0
@@ -385,6 +385,7 @@ enum index {ITEM_GENEVE_OPTLEN ,ITEM_VXLAN_GPE ,ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_ARP_ETH_IPV4 ,ITEM_ARP_ETH_IPV4_SHA , ITEM_ARP_ETH_IPV4_SPA,
@@ -1758,6 +1759,7 @@ static const enum index item_geneve[] = {static const enum index item_vxlan_gpe[] = {ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_NEXT ,ZERO , };
@@ -4804,6 +4806,14 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, hdr.vni)), }, + [ITEM_VXLAN_GPE_PROTO] = { + .name = "protocol", + .help = "VXLAN-GPE next protocol", + .next =NEXT (item_vxlan_gpe,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, + protocol)), + }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", .help = "match ARP header for Ethernet/IPv4",
Signature · 1 line
2.27.0
PATCH v3 2/5 common/mlx5: extend HCA attribute query for NSH
In reply to Haifei LuoAdd NSH supporting field in two places:
1. New HCA capability indicating NSH is supported
2. New field in "mlx5_ifc_per_protocol_networking_offload_caps_bits" structure
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1313,6 +1313,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->tunnel_stateless_gtp =MLX5_GET (per_protocol_networking_offload_caps, hcattr, tunnel_stateless_gtp); + attr->tunnel_stateless_vxlan_gpe_nsh =MLX5_GET + (per_protocol_networking_offload_caps, + hcattr, tunnel_stateless_vxlan_gpe_nsh); attr->rss_ind_tbl_cap =MLX5_GET (per_protocol_networking_offload_caps, hcattr, rss_ind_tbl_cap);
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -196,6 +196,7 @@ struct mlx5_hca_attr { uint32_t tunnel_stateless_geneve_rx:1; uint32_t geneve_max_opt_len:1; /* 0x0: 14DW, 0x1: 63DW */ uint32_t tunnel_stateless_gtp:1; + uint32_t tunnel_stateless_vxlan_gpe_nsh:1;uint32_t max_lso_cap; uint32_t scatter_fcs:1; uint32_t lro_cap:1;
drivers/common/mlx5/mlx5_prm.h +3 -1
@@ -1964,7 +1964,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {u8 swp_lso[0x1 ];u8 reserved_at_23[0x8 ];u8 tunnel_stateless_gtp[0x1 ]; -u8 reserved_at_25[0x4 ]; +u8 reserved_at_25[0x2 ]; +u8 tunnel_stateless_vxlan_gpe_nsh[0x1 ]; +u8 reserved_at_28[0x1 ];u8 max_vxlan_udp_ports[0x8 ];u8 reserved_at_38[0x6 ];u8 max_geneve_opt_len[0x1 ];
Signature · 1 line
2.27.0
PATCH v3 3/5 net/mlx5: enhance the validation for item VXLAN-GPE
In reply to Haifei LuoEnhance the validation so that configuring vxlan-gpe's next protocol as NSH is supported.
1. The spec's protocol can have value and nic_mask's protocol is 0xff.
--- drivers/net/mlx5/mlx5_flow.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow.c +6 -7
@@ -3198,6 +3198,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,uint8_t vni[4 ]; } id = { .vlan_id = 0, }; +struct rte_flow_item_vxlan_gpe nic_mask = { + .vni ="\xff\xff\xff" , + .protocol =0xff , + }; +if (!priv->sh->config.l3_vxlan_en) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -3221,18 +3226,12 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, mask = &rte_flow_item_vxlan_gpe_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_vxlan_gpe_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_vxlan_gpe ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);if (ret <0 )return ret;if (spec) { -if (spec->hdr.proto) -return rte_flow_error_set (error,ENOTSUP , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"VxLAN-GPE protocol" -" not supported" );memcpy (&id.vni[1 ], spec->hdr.vni,3 );memcpy (&id.vni[1 ], mask->hdr.vni,3 ); }
Signature · 1 line
2.27.0
PATCH v3 4/5 app/testpmd: support for NSH flow item
In reply to Haifei LuoAdd support for item NSH. The CLI is: nsh Example:
flow create 0 transfer group 1
pattern eth / ipv6 / udp dst is 4790 /
vxlan-gpe / nsh / eth / ipv4 / tcp / end
actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
app/test-pmd/cmdline_flow.c +16 -0
@@ -525,6 +525,7 @@ enum index {ITEM_IB_BTH_PSN ,ITEM_IPV6_PUSH_REMOVE_EXT ,ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ITEM_NSH ,/* Validate/create actions. */ ACTIONS,
@@ -1562,6 +1563,7 @@ static const enum index next_item[] = {ITEM_AGGR_AFFINITY ,ITEM_TX_QUEUE ,ITEM_IB_BTH , +ITEM_NSH ,END_SET , ZERO, };
@@ -2081,6 +2083,11 @@ static const enum index item_ib_bth[] = { ZERO, }; +static const enum index item_nsh[] = { +ITEM_NEXT , +ZERO , +}; +static const enum index next_action[] = {ACTION_END ,ACTION_VOID ,
@@ -5837,6 +5844,15 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, hdr.psn)), }, + [ITEM_NSH] = { + .name = "nsh", + .help = "match NSH header", + .priv =PRIV_ITEM (NSH , + sizeof(struct rte_flow_item_nsh)), + .next = NEXT(item_nsh), + .call = parse_vc, + }, +/* Validate/create actions. */ [ACTIONS] = { .name = "actions",
Signature · 1 line
2.27.0
PATCH v3 5/5 net/mlx5: add support for item NSH
In reply to Haifei Luo1. Add validation for item NSH.
It will fail if HCA cap for NSH is false.
2. Add item_flags for NSH.
3. For vxlan-gpe if next header is NSH, set next_protocol as NSH.
--- drivers/net/mlx5/mlx5_flow.c | 39 +++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 6 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +39 -0
@@ -3905,6 +3905,45 @@ mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item, MLX5_ITEM_RANGE_NOT_ACCEPTED, error); } +/** +* Validate the NSH item. +* +* @param[in] dev +* Pointer to Ethernet device on which flow rule is being created on. +* @param[out] error +* Pointer to error structure. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error) +{ +struct mlx5_priv *priv = dev->data->dev_private; + +if (item->mask) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"NSH fields matching is not supported" ); + } + +if (!priv->sh->config.dv_flow_en) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"NSH support requires DV flow interface" ); + } + +if (!priv->sh->cdev->config.hca_attr.tunnel_stateless_vxlan_gpe_nsh) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"Current FW does not support matching on NSH" ); + } + +return 0 ; +} + static int flow_null_validate(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr __rte_unused,
drivers/net/mlx5/mlx5_flow.h +6 -0
@@ -233,6 +233,9 @@ enum mlx5_feature_name {/* IB BTH ITEM. */ #define MLX5_FLOW_ITEM_IB_BTH (1ull << 51) +/* NSH ITEM */ +#define MLX5_FLOW_ITEM_NSH (1ull << 53) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
@@ -2453,6 +2456,9 @@ int mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item,uint16_t ether_type, const struct rte_flow_item_ecpri *acc_mask, struct rte_flow_error *error); +int mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error); int mlx5_flow_create_mtr_tbls(struct rte_eth_dev *dev, struct mlx5_flow_meter_info *fm, uint32_t mtr_idx,
drivers/net/mlx5/mlx5_flow_dv.c +12 -1
@@ -7815,6 +7815,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + ret =mlx5_flow_validate_item_nsh (dev, items, error); +if (ret <0 ) +return ret; + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default : return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
@@ -9720,7 +9726,9 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, v_protocol = vxlan_v->hdr.protocol;if (!m_protocol) {/* Force next protocol to ensure next headers parsing. */ -if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) +if (pattern_flags &MLX5_FLOW_ITEM_NSH ) + v_protocol =RTE_VXLAN_GPE_TYPE_NSH ; +else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) v_protocol =RTE_VXLAN_GPE_TYPE_ETH ;else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L3_IPV4 ) v_protocol =RTE_VXLAN_GPE_TYPE_IPV4 ;
@@ -13910,6 +13918,9 @@ flow_dv_translate_items(struct rte_eth_dev *dev,flow_dv_translate_item_ib_bth (key, items, tunnel, key_type); last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default :break ; }
Signature · 1 line
2.27.0
v4 cover support item NSH matching
In reply to Haifei LuoNSH can be matched using the existed item: RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
V2: Add Ack info in commit message.
V3: Add more Ack in commi message.
V4: Add nsh in feature ini file.
Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSH
app/test-pmd/cmdline_flow.c | 26 ++++++++++++++ doc/guides/nics/features/mlx5.ini | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 8 files changed, 97 insertions(+), 9 deletions(-)
Signature · 1 line
2.27.0
PATCH v4 1/5 app/testpmd: support for VXLAN-GPE's next protocol
Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Example:
flow create 0 transfer group 1 pattern eth / ipv6 / udp dst is 4790 / vxlan-gpe protocol is 0x04 / eth / ipv4 / tcp / end actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
app/test-pmd/cmdline_flow.c +10 -0
@@ -386,6 +386,7 @@ enum index {ITEM_GENEVE_OPTLEN ,ITEM_VXLAN_GPE ,ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_ARP_ETH_IPV4 ,ITEM_ARP_ETH_IPV4_SHA , ITEM_ARP_ETH_IPV4_SPA,
@@ -1760,6 +1761,7 @@ static const enum index item_geneve[] = {static const enum index item_vxlan_gpe[] = {ITEM_VXLAN_GPE_VNI , +ITEM_VXLAN_GPE_PROTO ,ITEM_NEXT ,ZERO , };
@@ -4813,6 +4815,14 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, hdr.vni)), }, + [ITEM_VXLAN_GPE_PROTO] = { + .name = "protocol", + .help = "VXLAN-GPE next protocol", + .next =NEXT (item_vxlan_gpe,NEXT_ENTRY (COMMON_UNSIGNED ), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, + protocol)), + }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", .help = "match ARP header for Ethernet/IPv4",
Signature · 1 line
2.27.0
PATCH v4 2/5 common/mlx5: extend HCA attribute query for NSH
In reply to Haifei LuoAdd NSH supporting field in two places:
1. New HCA capability indicating NSH is supported
2. New field in "mlx5_ifc_per_protocol_networking_offload_caps_bits" structure
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1313,6 +1313,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->tunnel_stateless_gtp =MLX5_GET (per_protocol_networking_offload_caps, hcattr, tunnel_stateless_gtp); + attr->tunnel_stateless_vxlan_gpe_nsh =MLX5_GET + (per_protocol_networking_offload_caps, + hcattr, tunnel_stateless_vxlan_gpe_nsh); attr->rss_ind_tbl_cap =MLX5_GET (per_protocol_networking_offload_caps, hcattr, rss_ind_tbl_cap);
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -196,6 +196,7 @@ struct mlx5_hca_attr { uint32_t tunnel_stateless_geneve_rx:1; uint32_t geneve_max_opt_len:1; /* 0x0: 14DW, 0x1: 63DW */ uint32_t tunnel_stateless_gtp:1; + uint32_t tunnel_stateless_vxlan_gpe_nsh:1;uint32_t max_lso_cap; uint32_t scatter_fcs:1; uint32_t lro_cap:1;
drivers/common/mlx5/mlx5_prm.h +3 -1
@@ -1964,7 +1964,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {u8 swp_lso[0x1 ];u8 reserved_at_23[0x8 ];u8 tunnel_stateless_gtp[0x1 ]; -u8 reserved_at_25[0x4 ]; +u8 reserved_at_25[0x2 ]; +u8 tunnel_stateless_vxlan_gpe_nsh[0x1 ]; +u8 reserved_at_28[0x1 ];u8 max_vxlan_udp_ports[0x8 ];u8 reserved_at_38[0x6 ];u8 max_geneve_opt_len[0x1 ];
Signature · 1 line
2.27.0
PATCH v4 3/5 net/mlx5: enhance the validation for item VXLAN-GPE
In reply to Haifei LuoEnhance the validation so that configuring vxlan-gpe's next protocol as NSH is supported.
1. The spec's protocol can have value and nic_mask's protocol is 0xff.
--- drivers/net/mlx5/mlx5_flow.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow.c +6 -7
@@ -3198,6 +3198,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,uint8_t vni[4 ]; } id = { .vlan_id = 0, }; +struct rte_flow_item_vxlan_gpe nic_mask = { + .vni ="\xff\xff\xff" , + .protocol =0xff , + }; +if (!priv->sh->config.l3_vxlan_en) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -3221,18 +3226,12 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, mask = &rte_flow_item_vxlan_gpe_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_vxlan_gpe_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_vxlan_gpe ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);if (ret <0 )return ret;if (spec) { -if (spec->hdr.proto) -return rte_flow_error_set (error,ENOTSUP , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"VxLAN-GPE protocol" -" not supported" );memcpy (&id.vni[1 ], spec->hdr.vni,3 );memcpy (&id.vni[1 ], mask->hdr.vni,3 ); }
Signature · 1 line
2.27.0
PATCH v4 4/5 app/testpmd: support for NSH flow item
In reply to Haifei LuoAdd support for item NSH. The CLI is: nsh Example:
flow create 0 transfer group 1
pattern eth / ipv6 / udp dst is 4790 /
vxlan-gpe / nsh / eth / ipv4 / tcp / end
actions port_id id 1 / end
--- app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++ doc/guides/nics/features/mlx5.ini | 1 + 2 files changed, 17 insertions(+)
app/test-pmd/cmdline_flow.c +16 -0
@@ -526,6 +526,7 @@ enum index {ITEM_IB_BTH_PSN ,ITEM_IPV6_PUSH_REMOVE_EXT ,ITEM_IPV6_PUSH_REMOVE_EXT_TYPE , +ITEM_NSH ,/* Validate/create actions. */ ACTIONS,
@@ -1563,6 +1564,7 @@ static const enum index next_item[] = {ITEM_AGGR_AFFINITY ,ITEM_TX_QUEUE ,ITEM_IB_BTH , +ITEM_NSH ,END_SET , ZERO, };
@@ -2083,6 +2085,11 @@ static const enum index item_ib_bth[] = { ZERO, }; +static const enum index item_nsh[] = { +ITEM_NEXT , +ZERO , +}; +static const enum index next_action[] = {ACTION_END ,ACTION_VOID ,
@@ -5846,6 +5853,15 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, hdr.psn)), }, + [ITEM_NSH] = { + .name = "nsh", + .help = "match NSH header", + .priv =PRIV_ITEM (NSH , + sizeof(struct rte_flow_item_nsh)), + .next = NEXT(item_nsh), + .call = parse_vc, + }, +/* Validate/create actions. */ [ACTIONS] = { .name = "actions",
doc/guides/nics/features/mlx5.ini +1 -0
@@ -82,6 +82,7 @@ mark = Y meta = Y meter_color = Y mpls = Y +nsh = Y nvgre = Y port_id = Y port_representor = Y
Signature · 1 line
2.27.0
PATCH v4 5/5 net/mlx5: add support for item NSH
In reply to Haifei Luo1. Add validation for item NSH.
It will fail if HCA cap for NSH is false.
2. Add item_flags for NSH.
3. For vxlan-gpe if next header is NSH, set next_protocol as NSH.
--- drivers/net/mlx5/mlx5_flow.c | 39 +++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 6 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +39 -0
@@ -3905,6 +3905,45 @@ mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item, MLX5_ITEM_RANGE_NOT_ACCEPTED, error); } +/** +* Validate the NSH item. +* +* @param[in] dev +* Pointer to Ethernet device on which flow rule is being created on. +* @param[out] error +* Pointer to error structure. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error) +{ +struct mlx5_priv *priv = dev->data->dev_private; + +if (item->mask) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"NSH fields matching is not supported" ); + } + +if (!priv->sh->config.dv_flow_en) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"NSH support requires DV flow interface" ); + } + +if (!priv->sh->cdev->config.hca_attr.tunnel_stateless_vxlan_gpe_nsh) { +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , item, +"Current FW does not support matching on NSH" ); + } + +return 0 ; +} + static int flow_null_validate(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr __rte_unused,
drivers/net/mlx5/mlx5_flow.h +6 -0
@@ -233,6 +233,9 @@ enum mlx5_feature_name {/* IB BTH ITEM. */ #define MLX5_FLOW_ITEM_IB_BTH (1ull << 51) +/* NSH ITEM */ +#define MLX5_FLOW_ITEM_NSH (1ull << 53) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
@@ -2453,6 +2456,9 @@ int mlx5_flow_validate_item_ecpri(const struct rte_flow_item *item,uint16_t ether_type, const struct rte_flow_item_ecpri *acc_mask, struct rte_flow_error *error); +int mlx5_flow_validate_item_nsh (struct rte_eth_dev *dev, +const struct rte_flow_item *item, +struct rte_flow_error *error); int mlx5_flow_create_mtr_tbls(struct rte_eth_dev *dev, struct mlx5_flow_meter_info *fm, uint32_t mtr_idx,
drivers/net/mlx5/mlx5_flow_dv.c +12 -1
@@ -7815,6 +7815,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + ret =mlx5_flow_validate_item_nsh (dev, items, error); +if (ret <0 ) +return ret; + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default : return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
@@ -9720,7 +9726,9 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, v_protocol = vxlan_v->hdr.protocol;if (!m_protocol) {/* Force next protocol to ensure next headers parsing. */ -if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) +if (pattern_flags &MLX5_FLOW_ITEM_NSH ) + v_protocol =RTE_VXLAN_GPE_TYPE_NSH ; +else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L2 ) v_protocol =RTE_VXLAN_GPE_TYPE_ETH ;else if (pattern_flags &MLX5_FLOW_LAYER_INNER_L3_IPV4 ) v_protocol =RTE_VXLAN_GPE_TYPE_IPV4 ;
@@ -13910,6 +13918,9 @@ flow_dv_translate_items(struct rte_eth_dev *dev,flow_dv_translate_item_ib_bth (key, items, tunnel, key_type); last_item =MLX5_FLOW_ITEM_IB_BTH ;break ; +case RTE_FLOW_ITEM_TYPE_NSH : + last_item =MLX5_FLOW_ITEM_NSH ; +break ;default :break ; }
Signature · 1 line
2.27.0
Hi,
Quoted 42 lines
-----Original Message-----
From: Haifei Luo <[email protected]>
Sent: Sunday, October 8, 2023 6:10 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Xueming(Steven) Li <[email protected]>; Haifei Luo <[email protected]>
Subject: [PATCH v4 0/5] support item NSH matchingNSH can be matched using the existed item:
RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
V2: Add Ack info in commit message.
V3: Add more Ack in commi message.
V4: Add nsh in feature ini file.Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSHapp/test-pmd/cmdline_flow.c | 26 ++++++++++++++ doc/guides/nics/features/mlx5.ini | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 8 files changed, 97 insertions(+), 9 deletions(-)
Quoted 2 lines
--
2.27.0
Series applied to next-net-mlx,
Replied originally to V2
Now to the correct version !
Kindest regards,
Raslan Darawsheh
09/10/2023 13:15, Raslan Darawsheh:
Quoted 3 lines
Series applied to next-net-mlx,
Replied originally to V2
Now to the correct version !
A release note should be added:
* **Updated NVIDIA mlx5 net driver.**
* Added support for Network Service Header (NSH) flow matching.
Hi,
Quoted 39 lines
-----Original Message-----
From: Haifei Luo <[email protected]>
Sent: Monday, September 25, 2023 5:09 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Xueming(Steven) Li <[email protected]>; Haifei Luo <[email protected]>
Subject: [PATCH v2 0/5] support item NSH matchingNSH can be matched using the existed item:
RTE_FLOW_ITEM_TYPE_NSH. NSH fields matching is not supported.Add support for configuring VXLAN-GPE's next protocol. The CLI is: vxlan-gpe protocol is <value>.
Add support for matching item NSH. The CLI is: nsh Add support for HCA attribute query of NSH.
Enhance the validation for the case matching item NSH is supported. Add NSH support in net/mlx5.
V2: Add Ack info in commit message.
Haifei Luo (5):
app/testpmd: support for VXLAN-GPE's next protocol common/mlx5: extend HCA attribute query for NSH net/mlx5: enhance the validation for item VXLAN-GPE app/testpmd: support for NSH flow item net/mlx5: add support for item NSHapp/test-pmd/cmdline_flow.c | 26 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 4 ++- drivers/net/mlx5/mlx5_flow.c | 52 ++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 6 ++++ drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++- 7 files changed, 96 insertions(+), 9 deletions(-)
Quoted 2 lines
--
2.27.0
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh