DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	 Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>
Subject: [PATCH v2 6/7] net/mlx5: support modify IPv6 traffic class field
Date: Wed, 7 Feb 2024 17:55:32 +0200	[thread overview]
Message-ID: <20240207155533.1582031-7-michaelba@nvidia.com> (raw)
In-Reply-To: <20240207155533.1582031-1-michaelba@nvidia.com>

Add HW steering support for IPv6 traffic class field modification.
Copy from inner IPv6 traffic class field is also supported using
"level=2".

Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index a504aebe15..50ba66daac 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -113,6 +113,7 @@ New Features
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SPI`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action.
+  * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS`` flow action.
 
 
 Removed Items
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 46f9f59e67..7d92c1cc24 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1394,6 +1394,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
 		return 8;
@@ -1795,6 +1796,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+		MLX5_ASSERT(data->offset + width <= 8);
+		off_be = 8 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_TRAFFIC_CLASS, data->level);
+		info[idx] = (struct field_modify_info){1, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_8(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 7a1821f457..a41b46e18f 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -2874,7 +2874,7 @@ flow_hw_modify_field_construct(struct mlx5_hw_q_job *job,
 		 * bits left. Shift the data left for IPV6 DSCP
 		 */
 		if (field->id == MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS &&
-		    !(mask & MLX5_IPV6_HDR_ECN_MASK))
+		    mhdr_action->dst.field == RTE_FLOW_FIELD_IPV6_DSCP)
 			data <<= MLX5_IPV6_HDR_DSCP_SHIFT;
 		data = (data & mask) >> off_b;
 		job->mhdr_cmd[i++].data1 = rte_cpu_to_be_32(data);
@@ -5063,6 +5063,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_IPV4_TTL:
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
-- 
2.25.1


  parent reply	other threads:[~2024-02-07 15:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 14:39 [PATCH v1 0/7] net/mlx5: support copy from inner fields Michael Baum
2024-02-06 14:39 ` [PATCH v1 1/7] common/mlx5: remove enum value duplication Michael Baum
2024-02-06 14:39 ` [PATCH v1 2/7] common/mlx5: reorder modification field PRM list Michael Baum
2024-02-06 14:39 ` [PATCH v1 3/7] common/mlx5: add inner PRM fields Michael Baum
2024-02-06 14:39 ` [PATCH v1 4/7] common/mlx5: add IPv6 flow label PRM field Michael Baum
2024-02-06 14:39 ` [PATCH v1 5/7] net/mlx5: add support for modify inner fields Michael Baum
2024-02-06 14:39 ` [PATCH v1 6/7] net/mlx5: support modify IPv6 traffic class field Michael Baum
2024-02-06 14:39 ` [PATCH v1 7/7] net/mlx5: support modify IPv6 flow label field Michael Baum
2024-02-07 15:55 ` [PATCH v2 0/7] net/mlx5: support copy from inner fields Michael Baum
2024-02-07 15:55   ` [PATCH v2 1/7] common/mlx5: remove enum value duplication Michael Baum
2024-02-07 15:55   ` [PATCH v2 2/7] common/mlx5: reorder modification field PRM list Michael Baum
2024-02-07 15:55   ` [PATCH v2 3/7] common/mlx5: add inner PRM fields Michael Baum
2024-02-07 15:55   ` [PATCH v2 4/7] common/mlx5: add IPv6 flow label PRM field Michael Baum
2024-02-07 15:55   ` [PATCH v2 5/7] net/mlx5: add support for modify inner fields Michael Baum
2024-02-07 15:55   ` Michael Baum [this message]
2024-02-07 15:55   ` [PATCH v2 7/7] net/mlx5: support modify IPv6 flow label field Michael Baum
2024-02-14  8:28   ` [PATCH v2 0/7] net/mlx5: support copy from inner fields Dariusz Sosnowski
2024-02-26 13:45   ` [PATCH v3 " Michael Baum
2024-02-26 13:45     ` [PATCH v3 1/7] common/mlx5: remove enum value duplication Michael Baum
2024-02-26 13:45     ` [PATCH v3 2/7] common/mlx5: reorder modification field PRM list Michael Baum
2024-02-26 13:45     ` [PATCH v3 3/7] common/mlx5: add inner PRM fields Michael Baum
2024-02-26 13:45     ` [PATCH v3 4/7] common/mlx5: add IPv6 flow label PRM field Michael Baum
2024-02-26 13:45     ` [PATCH v3 5/7] net/mlx5: add support for modify inner fields Michael Baum
2024-02-26 13:45     ` [PATCH v3 6/7] net/mlx5: support modify IPv6 traffic class field Michael Baum
2024-02-26 13:45     ` [PATCH v3 7/7] net/mlx5: support modify IPv6 flow label field Michael Baum
2024-02-27 13:24     ` [PATCH v3 0/7] net/mlx5: support copy from inner fields 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=20240207155533.1582031-7-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=suanmingm@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).