From: Wisam Jaddo <wisamm@mellanox.com>
To: dev@dpdk.org, orika@mellanox.com, matan@mellanox.com
Cc: rasland@mellanox.com, viacheslavo@mellanox.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: fix zero value validation for metadata
Date: Thu, 19 Mar 2020 09:02:37 +0000 [thread overview]
Message-ID: <20200319090237.15639-1-wisamm@mellanox.com> (raw)
MARK and META come and go to data path, so zero
value has special meaning to metadata actions/items.
The special meaning is to say that this packet don't
have META/MARK anymore - clear it.
Thus, metadata actions/items now allowed to set/match
on zero value as long as mask is not zero
Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support")
Fixes: e554b672aa05 ("net/mlx5: support flow tag")
Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")
Cc: viacheslavo@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
---
doc/guides/nics/mlx5.rst | 10 ++++++++++
drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index afd11cd..e1e2fa4 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -1267,6 +1267,16 @@ Supported hardware offloads
| | | ConnectX-5 | | ConnectX-5 |
+-----------------------+-----------------+-----------------+
+Notes for metadata
+------------------
+MARK and META come and go to data path, so zero value has special meaning to
+metadata actions/items. The special meaning is to say that this packet don't
+have META/MARK anymore - clear it.
+
+Summery:
+1. Metadata actions allows setting meta, tag & mark to zero value.
+2. Match on metadata items is allowed, as long as mask is not zero.
+
Notes for testpmd
-----------------
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2090631..09865f6 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1406,6 +1406,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev *dev,
"mark id exceeds the limit");
if (!mask)
mask = &nic_mask;
+ else if (!mask->id)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+ "mask cannot be zero");
+
ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
(const uint8_t *)&nic_mask,
sizeof(struct rte_flow_item_mark),
@@ -1451,10 +1456,7 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
item->spec,
"data cannot be empty");
- if (!spec->data)
- return rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
- "data cannot be zero");
+
if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) {
if (!mlx5_flow_ext_mreg_supported(dev))
return rte_flow_error_set(error, ENOTSUP,
@@ -1474,6 +1476,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused,
}
if (!mask)
mask = &rte_flow_item_meta_mask;
+ else if (!mask->data)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+ "mask cannot be zero");
+
ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
(const uint8_t *)&nic_mask,
sizeof(struct rte_flow_item_meta),
@@ -1522,6 +1529,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev *dev,
"data cannot be empty");
if (!mask)
mask = &rte_flow_item_tag_mask;
+ else if (!mask->data)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL,
+ "mask cannot be zero");
+
ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
(const uint8_t *)&nic_mask,
sizeof(struct rte_flow_item_tag),
--
2.7.4
next reply other threads:[~2020-03-19 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 9:02 Wisam Jaddo [this message]
2020-03-26 10:22 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo
2020-03-26 10:24 ` Slava Ovsiienko
2020-03-29 14:06 ` Raslan Darawsheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319090237.15639-1-wisamm@mellanox.com \
--to=wisamm@mellanox.com \
--cc=dev@dpdk.org \
--cc=matan@mellanox.com \
--cc=orika@mellanox.com \
--cc=rasland@mellanox.com \
--cc=stable@dpdk.org \
--cc=viacheslavo@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).