* [PATCH v2 1/5] app/testpmd: support for VXLAN-GPE's next protocol
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
@ 2023-09-25 2:09 ` Haifei Luo
2023-09-25 2:09 ` [PATCH v2 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
` (5 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 2:09 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil, Jiawei Wang,
Dariusz Sosnowski, Aman Singh, Yuying Zhang
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
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 94827bcc4a..d25f941259 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 2/5] common/mlx5: extend HCA attribute query for NSH
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
2023-09-25 2:09 ` [PATCH v2 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
@ 2023-09-25 2:09 ` Haifei Luo
2023-09-25 2:09 ` [PATCH v2 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
` (4 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 2:09 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Matan Azrad, Suanming Mou
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
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(-)
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 66a77159a0..830199212e 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -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);
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index e071cd841f..11772431ae 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -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;
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 51f426c614..f005877dd7 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -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];
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 3/5] net/mlx5: enhance the validation for item VXLAN-GPE
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
2023-09-25 2:09 ` [PATCH v2 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
2023-09-25 2:09 ` [PATCH v2 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
@ 2023-09-25 2:09 ` Haifei Luo
2023-09-25 2:09 ` [PATCH v2 4/5] app/testpmd: support for NSH flow item Haifei Luo
` (3 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 2:09 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Matan Azrad, Suanming Mou
Enhance 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f7f8f54eb4..202e878ddf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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);
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 4/5] app/testpmd: support for NSH flow item
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
` (2 preceding siblings ...)
2023-09-25 2:09 ` [PATCH v2 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
@ 2023-09-25 2:09 ` Haifei Luo
2023-09-25 2:09 ` [PATCH v2 5/5] net/mlx5: add support for item NSH Haifei Luo
` (2 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 2:09 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Aman Singh, Yuying Zhang
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index d25f941259..bf93d649e1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 5/5] net/mlx5: add support for item NSH
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
` (3 preceding siblings ...)
2023-09-25 2:09 ` [PATCH v2 4/5] app/testpmd: support for NSH flow item Haifei Luo
@ 2023-09-25 2:09 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
2023-10-08 10:34 ` [PATCH v2 " Raslan Darawsheh
6 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 2:09 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Matan Azrad, Suanming Mou
1. 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 202e878ddf..8ad85e6027 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 3a97975d69..ccb416e497 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3f4325c5c8..5cd04b1d93 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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;
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 0/5] support item NSH matching
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
` (4 preceding siblings ...)
2023-09-25 2:09 ` [PATCH v2 5/5] net/mlx5: add support for item NSH Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
` (5 more replies)
2023-10-08 10:34 ` [PATCH v2 " Raslan Darawsheh
6 siblings, 6 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev; +Cc: orika, viacheslavo, rasland, xuemingl, haifeil
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.
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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 1/5] app/testpmd: support for VXLAN-GPE's next protocol
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
` (4 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil, Jiawei Wang,
Dariusz Sosnowski, Suanming Mou, Aman Singh, Yuying Zhang
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
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 94827bcc4a..d25f941259 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 2/5] common/mlx5: extend HCA attribute query for NSH
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
2023-09-25 8:07 ` [PATCH v3 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
` (3 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
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(-)
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 66a77159a0..830199212e 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -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);
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index e071cd841f..11772431ae 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -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;
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 51f426c614..f005877dd7 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -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];
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 3/5] net/mlx5: enhance the validation for item VXLAN-GPE
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
2023-09-25 8:07 ` [PATCH v3 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
2023-09-25 8:07 ` [PATCH v3 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 4/5] app/testpmd: support for NSH flow item Haifei Luo
` (2 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
Enhance 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f7f8f54eb4..202e878ddf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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);
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 4/5] app/testpmd: support for NSH flow item
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
` (2 preceding siblings ...)
2023-09-25 8:07 ` [PATCH v3 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-09-25 8:07 ` [PATCH v3 5/5] net/mlx5: add support for item NSH Haifei Luo
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Aman Singh, Yuying Zhang
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index d25f941259..bf93d649e1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 5/5] net/mlx5: add support for item NSH
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
` (3 preceding siblings ...)
2023-09-25 8:07 ` [PATCH v3 4/5] app/testpmd: support for NSH flow item Haifei Luo
@ 2023-09-25 8:07 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-09-25 8:07 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
1. 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 202e878ddf..8ad85e6027 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 3a97975d69..ccb416e497 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3f4325c5c8..5cd04b1d93 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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;
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 0/5] support item NSH matching
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
` (4 preceding siblings ...)
2023-09-25 8:07 ` [PATCH v3 5/5] net/mlx5: add support for item NSH Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
` (5 more replies)
5 siblings, 6 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev; +Cc: orika, viacheslavo, rasland, xuemingl, haifeil
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.
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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 1/5] app/testpmd: support for VXLAN-GPE's next protocol
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
` (4 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil, Jiawei Wang,
Dariusz Sosnowski, Suanming Mou, Aman Singh, Yuying Zhang
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
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 95c0a19beb..8a4e06c50a 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 2/5] common/mlx5: extend HCA attribute query for NSH
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
2023-10-08 3:10 ` [PATCH v4 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
` (3 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
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(-)
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 66a77159a0..830199212e 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -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);
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index e071cd841f..11772431ae 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -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;
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 51f426c614..f005877dd7 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -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];
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 3/5] net/mlx5: enhance the validation for item VXLAN-GPE
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
2023-10-08 3:10 ` [PATCH v4 1/5] app/testpmd: support for VXLAN-GPE's next protocol Haifei Luo
2023-10-08 3:10 ` [PATCH v4 2/5] common/mlx5: extend HCA attribute query for NSH Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 4/5] app/testpmd: support for NSH flow item Haifei Luo
` (2 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
Enhance 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f7f8f54eb4..202e878ddf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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);
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 4/5] app/testpmd: support for NSH flow item
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
` (2 preceding siblings ...)
2023-10-08 3:10 ` [PATCH v4 3/5] net/mlx5: enhance the validation for item VXLAN-GPE Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-08 3:10 ` [PATCH v4 5/5] net/mlx5: add support for item NSH Haifei Luo
2023-10-09 11:15 ` [PATCH v4 0/5] support item NSH matching Raslan Darawsheh
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Aman Singh, Yuying Zhang,
Matan Azrad
Add 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
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 16 ++++++++++++++++
doc/guides/nics/features/mlx5.ini | 1 +
2 files changed, 17 insertions(+)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 8a4e06c50a..84de3a2506 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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",
diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index c0e0b779cf..fc67415c6c 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -82,6 +82,7 @@ mark = Y
meta = Y
meter_color = Y
mpls = Y
+nsh = Y
nvgre = Y
port_id = Y
port_representor = Y
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v4 5/5] net/mlx5: add support for item NSH
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
` (3 preceding siblings ...)
2023-10-08 3:10 ` [PATCH v4 4/5] app/testpmd: support for NSH flow item Haifei Luo
@ 2023-10-08 3:10 ` Haifei Luo
2023-10-09 11:15 ` [PATCH v4 0/5] support item NSH matching Raslan Darawsheh
5 siblings, 0 replies; 27+ messages in thread
From: Haifei Luo @ 2023-10-08 3:10 UTC (permalink / raw)
To: dev
Cc: orika, viacheslavo, rasland, xuemingl, haifeil,
Dariusz Sosnowski, Suanming Mou, Matan Azrad
1. 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.
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 202e878ddf..8ad85e6027 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 3a97975d69..ccb416e497 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3f4325c5c8..5cd04b1d93 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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;
}
--
2.27.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v4 0/5] support item NSH matching
2023-10-08 3:10 ` [PATCH v4 0/5] support item NSH matching Haifei Luo
` (4 preceding siblings ...)
2023-10-08 3:10 ` [PATCH v4 5/5] net/mlx5: add support for item NSH Haifei Luo
@ 2023-10-09 11:15 ` Raslan Darawsheh
2023-10-16 9:27 ` Thomas Monjalon
5 siblings, 1 reply; 27+ messages in thread
From: Raslan Darawsheh @ 2023-10-09 11:15 UTC (permalink / raw)
To: Haifei Luo, dev; +Cc: Ori Kam, Slava Ovsiienko, Xueming(Steven) Li
Hi,
> -----Original Message-----
> From: Haifei Luo <haifeil@nvidia.com>
> Sent: Sunday, October 8, 2023 6:10 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Raslan Darawsheh <rasland@nvidia.com>; Xueming(Steven) Li
> <xuemingl@nvidia.com>; Haifei Luo <haifeil@nvidia.com>
> Subject: [PATCH v4 0/5] 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.
>
> 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(-)
>
> --
> 2.27.0
Series applied to next-net-mlx,
Replied originally to V2
Now to the correct version !
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 0/5] support item NSH matching
2023-09-25 2:09 ` [PATCH v2 0/5] support item NSH matching Haifei Luo
` (5 preceding siblings ...)
2023-09-25 8:07 ` [PATCH v3 0/5] support item NSH matching Haifei Luo
@ 2023-10-08 10:34 ` Raslan Darawsheh
6 siblings, 0 replies; 27+ messages in thread
From: Raslan Darawsheh @ 2023-10-08 10:34 UTC (permalink / raw)
To: Haifei Luo, dev; +Cc: Ori Kam, Slava Ovsiienko, Xueming(Steven) Li
Hi,
> -----Original Message-----
> From: Haifei Luo <haifeil@nvidia.com>
> Sent: Monday, September 25, 2023 5:09 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Raslan Darawsheh <rasland@nvidia.com>; Xueming(Steven) Li
> <xuemingl@nvidia.com>; Haifei Luo <haifeil@nvidia.com>
> Subject: [PATCH v2 0/5] 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.
>
> 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(-)
>
> --
> 2.27.0
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 27+ messages in thread