DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
	<orika@nvidia.com>, <thomas@monjalon.net>
Cc: <rasland@nvidia.com>, Dariusz Sosnowski <dsosnowski@nvidia.com>
Subject: [PATCH v2 5/6] net/mlx5: return error for sws modify field
Date: Wed, 22 Feb 2023 11:37:14 +0200	[thread overview]
Message-ID: <20230222093715.740279-6-rongweil@nvidia.com> (raw)
In-Reply-To: <20230222093715.740279-1-rongweil@nvidia.com>

Return unsupported error message when application tries to
modify flex item field.

Validation of packet modifications actions for SW Steering checked
if either source or destination field of MODIFY_FIELD action
was a flex item.
When DEC_TTL action is used, DEC_TTL action does not have any
action configuration and dereferencing source or destination field
is invalid, so validation of source and destination field types
should be moved to MODIFY_FIELD specific validation function, then
field types are validated if and only if action type is MODIFY_FIELD.

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8355249ce5..3d760d1913 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4838,6 +4838,7 @@ flow_dv_validate_action_modify_hdr(const uint64_t action_flags,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  NULL, "action configuration not set");
+
 	if (action_flags & MLX5_FLOW_ACTION_ENCAP)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -5163,17 +5164,21 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 	struct mlx5_hca_attr *hca_attr = &priv->sh->cdev->config.hca_attr;
 	const struct rte_flow_action_modify_field *action_modify_field =
 		action->conf;
-	uint32_t dst_width = mlx5_flow_item_field_width(dev,
-				action_modify_field->dst.field,
-				-1, attr, error);
-	uint32_t src_width = mlx5_flow_item_field_width(dev,
-				action_modify_field->src.field,
-				dst_width, attr, error);
+	uint32_t dst_width, src_width;
 
 	ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
 	if (ret)
 		return ret;
-
+	if (action_modify_field->src.field == RTE_FLOW_FIELD_FLEX_ITEM ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_FLEX_ITEM)
+		return rte_flow_error_set(error, ENOTSUP,
+				RTE_FLOW_ERROR_TYPE_ACTION, action,
+				"flex item fields modification"
+				" is not supported");
+	dst_width = mlx5_flow_item_field_width(dev, action_modify_field->dst.field,
+					       -1, attr, error);
+	src_width = mlx5_flow_item_field_width(dev, action_modify_field->src.field,
+					       dst_width, attr, error);
 	if (action_modify_field->width == 0)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-- 
2.27.0


  parent reply	other threads:[~2023-02-22  9:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 11:52 [PATCH v1 0/6] add flex item implementation Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 5/6] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 6/6] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-22  9:37   ` [PATCH v2 0/6] add flex item implementation Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-22  9:37     ` Rongwei Liu [this message]
2023-02-22  9:37     ` [PATCH v2 6/6] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-23  7:06   ` [PATCH v3 0/7] add flex item implementation Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 1/7] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 2/7] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 3/7] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 4/7] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 5/7] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 6/7] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-23 12:37       ` Thomas Monjalon
2023-02-23 12:48         ` [PATCH v4 0/6] add flex item implementation Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 5/6] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 6/6] net/mlx5: add error message Rongwei Liu
2023-02-27 10:27           ` [PATCH v4 0/6] add flex item implementation Raslan Darawsheh
2023-02-23  7:06     ` [PATCH v3 7/7] net/mlx5: add error message Rongwei Liu

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=20230222093715.740279-6-rongweil@nvidia.com \
    --to=rongweil@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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).