From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <orika@nvidia.com>, <rasland@nvidia.com>,
<matan@nvidia.com>, <viacheslavo@nvidia.com>
Subject: [PATCH 3/4] net/mlx5: add hash result metadata to modify field
Date: Fri, 27 Jan 2023 01:40:53 +0200 [thread overview]
Message-ID: <20230126234054.3960463-4-akozyrev@nvidia.com> (raw)
In-Reply-To: <20230126234054.3960463-1-akozyrev@nvidia.com>
Allow copy of the hash result via modify_field Flow API.
Setting this value is not allowed, it is read-only field.
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 5 +++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7ca909999b..84fc725738 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1390,6 +1390,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
case RTE_FLOW_FIELD_IPV6_ECN:
case RTE_FLOW_FIELD_METER_COLOR:
return 2;
+ case RTE_FLOW_FIELD_HASH_RESULT:
+ return 32;
default:
MLX5_ASSERT(false);
}
@@ -1883,6 +1885,16 @@ mlx5_flow_field_id_to_modify_info
info[idx].offset = data->offset;
}
break;
+ case RTE_FLOW_FIELD_HASH_RESULT:
+ MLX5_ASSERT(data->offset + width <= 32);
+ off_be = 32 - (data->offset + width);
+ info[idx] = (struct field_modify_info){4, 0,
+ MLX5_MODI_HASH_RESULT};
+ if (mask)
+ mask[idx] = flow_modify_info_mask_32(width, off_be);
+ else
+ info[idx].offset = off_be;
+ break;
case RTE_FLOW_FIELD_POINTER:
case RTE_FLOW_FIELD_VALUE:
default:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index b209b448c6..6f391d990d 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -3530,10 +3530,11 @@ flow_hw_validate_action_modify_field(const struct rte_flow_action *action,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"destination field mask and template are not equal");
if (action_conf->dst.field == RTE_FLOW_FIELD_POINTER ||
- action_conf->dst.field == RTE_FLOW_FIELD_VALUE)
+ action_conf->dst.field == RTE_FLOW_FIELD_VALUE ||
+ action_conf->dst.field == RTE_FLOW_FIELD_HASH_RESULT)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, action,
- "immediate value and pointer cannot be used as destination");
+ "immediate value, pointer and hash result cannot be used as destination");
if (mask_conf->dst.level != UINT32_MAX)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, action,
--
2.18.2
next prev parent reply other threads:[~2023-01-26 23:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 23:40 [PATCH 0/4] net/mlx5: add template table insertion and matching types Alexander Kozyrev
2023-01-26 23:40 ` [PATCH 1/4] net/mlx5: add table insertion type and hash function Alexander Kozyrev
2023-03-06 15:16 ` Slava Ovsiienko
2023-01-26 23:40 ` [PATCH 2/4] net/mlx5: add flow rule insertion by index Alexander Kozyrev
2023-03-06 15:17 ` Slava Ovsiienko
2023-01-26 23:40 ` Alexander Kozyrev [this message]
2023-03-06 15:18 ` [PATCH 3/4] net/mlx5: add hash result metadata to modify field Slava Ovsiienko
2023-01-26 23:40 ` [PATCH 4/4] net/mlx5: define index register for linear tables Alexander Kozyrev
2023-03-06 15:18 ` Slava Ovsiienko
2023-03-07 11:13 ` [PATCH 0/4] net/mlx5: add template table insertion and matching types 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=20230126234054.3960463-4-akozyrev@nvidia.com \
--to=akozyrev@nvidia.com \
--cc=dev@dpdk.org \
--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).