DPDK patches and discussions
 help / color / mirror / Atom feed
From: Itamar Gozlan <igozlan@nvidia.com>
To: <valex@nvidia.com>, <viacheslavo@nvidia.com>,
	<thomas@monjalon.net>, <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>, Ori Kam <orika@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 3/5] net/mlx5/hws: supporting add_field action
Date: Mon, 18 Sep 2023 15:07:03 +0300	[thread overview]
Message-ID: <20230918120705.265025-3-igozlan@nvidia.com> (raw)
In-Reply-To: <20230918120705.265025-1-igozlan@nvidia.com>

Supporting a new modify action: ADD_FIELD.
The new action allows the summing of the packet source field
and destination field/meta-data. The result is stored in the
destination field.
This new action is supported only on capable devices.

Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h        | 2 ++
 drivers/net/mlx5/hws/mlx5dr_action.c  | 6 +++++-
 drivers/net/mlx5/hws/mlx5dr_cmd.c     | 4 +++-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 3 ++-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 4ead9ba2c7..6df7ca20af 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -761,6 +761,7 @@ enum {
 	MLX5_MODIFICATION_TYPE_REMOVE = 0x5,
 	MLX5_MODIFICATION_TYPE_NOP = 0x6,
 	MLX5_MODIFICATION_TYPE_REMOVE_WORDS = 0x7,
+	MLX5_MODIFICATION_TYPE_ADD_FIELD = 0x8,
 	MLX5_MODIFICATION_TYPE_MAX,
 };
 
@@ -3442,6 +3443,7 @@ enum mlx5_ifc_stc_action_type {
 	MLX5_IFC_STC_ACTION_TYPE_ACC_MODIFY_LIST = 0x0e,
 	MLX5_IFC_STC_ACTION_TYPE_ASO = 0x12,
 	MLX5_IFC_STC_ACTION_TYPE_COUNTER = 0x14,
+	MLX5_IFC_STC_ACTION_TYPE_ADD_FIELD = 0x1b,
 	MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE = 0x80,
 	MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_TIR = 0x81,
 	MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT = 0x82,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 920099ba5b..1a03431706 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -481,6 +481,8 @@ static uint32_t mlx5dr_action_get_mh_stc_type(__be64 pattern)
 		return MLX5_IFC_STC_ACTION_TYPE_ADD;
 	case MLX5_MODIFICATION_TYPE_COPY:
 		return MLX5_IFC_STC_ACTION_TYPE_COPY;
+	case MLX5_MODIFICATION_TYPE_ADD_FIELD:
+		return MLX5_IFC_STC_ACTION_TYPE_ADD_FIELD;
 	default:
 		assert(false);
 		DR_LOG(ERR, "Unsupported action type: 0x%x", action_type);
@@ -1958,7 +1960,9 @@ mlx5dr_action_setter_modify_header(struct mlx5dr_actions_apply_data *apply,
 
 	if (action->modify_header.num_of_actions == 1) {
 		if (action->modify_header.single_action_type ==
-		    MLX5_MODIFICATION_TYPE_COPY) {
+		    MLX5_MODIFICATION_TYPE_COPY ||
+		    action->modify_header.single_action_type ==
+		    MLX5_MODIFICATION_TYPE_ADD_FIELD) {
 			apply->wqe_data[MLX5DR_ACTION_OFFSET_DW7] = 0;
 			return;
 		}
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index f9f220cc6a..98d4b3bd3b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -426,6 +426,7 @@ mlx5dr_cmd_stc_modify_set_stc_param(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
 	case MLX5_IFC_STC_ACTION_TYPE_COPY:
 	case MLX5_IFC_STC_ACTION_TYPE_SET:
 	case MLX5_IFC_STC_ACTION_TYPE_ADD:
+	case MLX5_IFC_STC_ACTION_TYPE_ADD_FIELD:
 		*(__be64 *)stc_parm = stc_attr->modify_action.data;
 		break;
 	case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
@@ -599,7 +600,8 @@ mlx5dr_cmd_header_modify_pattern_create(struct ibv_context *ctx,
 		int type;
 
 		type = MLX5_GET(set_action_in, &pattern_data[i], action_type);
-		if (type != MLX5_MODIFICATION_TYPE_COPY)
+		if (type != MLX5_MODIFICATION_TYPE_COPY &&
+		    type != MLX5_MODIFICATION_TYPE_ADD_FIELD)
 			/* Action typ-copy use all bytes for control */
 			MLX5_SET(set_action_in, &pattern_data[i], data, 0);
 	}
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 309a61d477..0cec46cf17 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -80,7 +80,8 @@ static bool mlx5dr_pat_compare_pattern(enum mlx5dr_action_type cur_type,
 		u8 action_id =
 			MLX5_GET(set_action_in, &actions[i], action_type);
 
-		if (action_id == MLX5_MODIFICATION_TYPE_COPY) {
+		if (action_id == MLX5_MODIFICATION_TYPE_COPY ||
+		    action_id == MLX5_MODIFICATION_TYPE_ADD_FIELD) {
 			if (actions[i] != cur_actions[i])
 				return false;
 		} else {
-- 
2.38.1


  parent reply	other threads:[~2023-09-18 12:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 12:07 [PATCH 1/5] net/mlx5/hws: add support for matching on bth_a bit Itamar Gozlan
2023-09-18 12:07 ` [PATCH 2/5] net/mlx5/hws: support additional 4 C registers Itamar Gozlan
2023-09-18 12:07 ` Itamar Gozlan [this message]
2023-09-18 12:07 ` [PATCH 4/5] net/mlx5/hws: supporting default miss table in HWS Itamar Gozlan
2023-10-29 16:02   ` Ori Kam
2023-09-18 12:07 ` [PATCH 5/5] net/mlx5/hws: fix field copy bind Itamar Gozlan
2023-10-09  7:57 ` [PATCH 1/5] net/mlx5/hws: add support for matching on bth_a bit Matan Azrad
2023-10-10  9:33 ` 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=20230918120705.265025-3-igozlan@nvidia.com \
    --to=igozlan@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=valex@nvidia.com \
    --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).