Skip to contentSkip to conversation

mlx5-next updates 2025-09-11

PATCH Applied Tariq Toukan 4 participants 10 messages Sep 11, 2025 – Sep 17, 2025

Subsystems (7)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

cover mlx5-next updates 2025-09-11

Hi,

This series by Carolina contains cleanups significantly touching shared mlx5 net and rdma headers.

Regards,
Tariq

Carolina Jubran (3):
net/mlx5: Remove VLAN insertion fields from WQE Ether segment net/mlx5: Refactor MACsec WQE metadata shifts net/mlx5e: Prevent WQE metadata conflicts between timestamping and
offloads

 .../mellanox/mlx5/core/en_accel/macsec.c         |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c  |  2 +-
 .../ethernet/mellanox/mlx5/core/lib/macsec_fs.c  | 14 ++++++--------
 .../ethernet/mellanox/mlx5/core/lib/macsec_fs.h  | 15 +++++++++++++++
 include/linux/mlx5/qp.h                          | 16 ++++++++--------
 5 files changed, 31 insertions(+), 18 deletions(-)

base-commit: ff97bc38be343e4530e2f140b40cbdce2e09152f

Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/3 net/mlx5: Remove VLAN insertion fields from WQE Ether segment

From: Carolina Jubran <[email protected]>

Now that the driver no longer uses VLAN TX insertion via the WQE Ethernet segment, the related fields and flags can be removed.

---
 include/linux/mlx5/qp.h | 6 ------
 1 file changed, 6 deletions(-)
include/linux/mlx5/qp.h +0 -6
index fc7eeff99a8a..5546c7bd2c83 100644
@@ -237,13 +237,11 @@ enum {
 };
 
 enum {
-	MLX5_ETH_WQE_SVLAN              = 1 << 0,
 	MLX5_ETH_WQE_TRAILER_HDR_OUTER_IP_ASSOC = 1 << 26,
 	MLX5_ETH_WQE_TRAILER_HDR_OUTER_L4_ASSOC = 1 << 27,
 	MLX5_ETH_WQE_TRAILER_HDR_INNER_IP_ASSOC = 3 << 26,
 	MLX5_ETH_WQE_TRAILER_HDR_INNER_L4_ASSOC = 1 << 28,
 	MLX5_ETH_WQE_INSERT_TRAILER     = 1 << 30,
-	MLX5_ETH_WQE_INSERT_VLAN        = 1 << 15,
 };
 
 enum {
@@ -275,10 +273,6 @@ struct mlx5_wqe_eth_seg {
 				DECLARE_FLEX_ARRAY(u8, data);
 			};
 		} inline_hdr;
-		struct {
-			__be16 type;
-			__be16 vlan_tci;
-		} insert;
 		__be32 trailer;
 	};
 };
Signature · 1 line
2.31.1
author maintainer
#3 lore raw

PATCH 2/3 net/mlx5: Refactor MACsec WQE metadata shifts

In reply to Tariq Toukan

From: Carolina Jubran <[email protected]>

Introduce MLX5_ETH_WQE_FT_META_SHIFT as a shared base offset for features that use the lower 8 bits of the WQE flow_table_metadata field, currently used for timestamping, IPsec, and MACsec.

Define MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK so that fs_id occupies bits 2–5, making it clear that fs_id occupies bits in the metadata.

Set MLX5_ETH_WQE_FT_META_MACSEC_MASK as the OR of the MACsec flag and MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK, corresponding to the original 0x3E mask.

Update the fs_id macro to right-shift the MACsec flag by MLX5_ETH_WQE_FT_META_SHIFT and update the RoCE modify-header action to use it.

Introduce the helper macro MLX5_MACSEC_TX_METADATA(fs_id) to compose the full shifted MACsec metadata value.

These changes make it explicit exactly which metadata bits carry MACsec information, simplifying future feature exclusions when multiple features share the WQE flowtable metadata.

In addition, drop the incorrect “RX flow steering” comment, since this applies to TX flow steering.

---
 .../ethernet/mellanox/mlx5/core/en_accel/macsec.c |  2 +-
 .../ethernet/mellanox/mlx5/core/lib/macsec_fs.c   | 12 +++++-------
 .../ethernet/mellanox/mlx5/core/lib/macsec_fs.h   | 15 +++++++++++++++
 include/linux/mlx5/qp.h                           |  9 +++++++--
 4 files changed, 28 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +1 -1
index 6ab02f3fc291..528b04d4de41 100644
@@ -1676,7 +1676,7 @@ void mlx5e_macsec_tx_build_eseg(struct mlx5e_macsec *macsec,
 	if (!fs_id)
 		return;
 
-	eseg->flow_table_metadata = cpu_to_be32(MLX5_ETH_WQE_FT_META_MACSEC | fs_id << 2);
+	eseg->flow_table_metadata = cpu_to_be32(MLX5_MACSEC_TX_METADATA(fs_id));
 }
 
 void mlx5e_macsec_offload_handle_rx_skb(struct net_device *netdev,
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c +5 -7
index 762d55ba9e51..9ec450603176 100644
@@ -45,11 +45,7 @@
 #define MLX5_SECTAG_HEADER_SIZE_WITHOUT_SCI 0x8
 #define MLX5_SECTAG_HEADER_SIZE_WITH_SCI (MLX5_SECTAG_HEADER_SIZE_WITHOUT_SCI + MACSEC_SCI_LEN)
 
-/* MACsec RX flow steering */
-#define MLX5_ETH_WQE_FT_META_MACSEC_MASK 0x3E
-
 /* MACsec fs_id handling for steering */
-#define macsec_fs_set_tx_fs_id(fs_id) (MLX5_ETH_WQE_FT_META_MACSEC | (fs_id) << 2)
 #define macsec_fs_set_rx_fs_id(fs_id) ((fs_id) | BIT(30))
 
 struct mlx5_sectag_header {
@@ -597,7 +593,7 @@ static int macsec_fs_tx_setup_fte(struct mlx5_macsec_fs *macsec_fs,
 	MLX5_SET(fte_match_param, spec->match_criteria, misc_parameters_2.metadata_reg_a,
 		 MLX5_ETH_WQE_FT_META_MACSEC_MASK);
 	MLX5_SET(fte_match_param, spec->match_value, misc_parameters_2.metadata_reg_a,
-		 macsec_fs_set_tx_fs_id(id));
+		 MLX5_MACSEC_TX_METADATA(id));
 
 	*fs_id = id;
 	flow_act->crypto.type = MLX5_FLOW_CONTEXT_ENCRYPT_DECRYPT_TYPE_MACSEC;
@@ -2219,8 +2215,10 @@ static int mlx5_macsec_fs_add_roce_rule_tx(struct mlx5_macsec_fs *macsec_fs, u32
 
 	MLX5_SET(set_action_in, action, action_type, MLX5_ACTION_TYPE_SET);
 	MLX5_SET(set_action_in, action, field, MLX5_ACTION_IN_FIELD_METADATA_REG_A);
-	MLX5_SET(set_action_in, action, data, macsec_fs_set_tx_fs_id(fs_id));
-	MLX5_SET(set_action_in, action, offset, 0);
+	MLX5_SET(set_action_in, action, data,
+		 mlx5_macsec_fs_set_tx_fs_id(fs_id));
+	MLX5_SET(set_action_in, action, offset,
+		 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT);
 	MLX5_SET(set_action_in, action, length, 32);
 
 	modify_hdr = mlx5_modify_header_alloc(mdev, MLX5_FLOW_NAMESPACE_RDMA_TX_MACSEC,
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.h +15 -0
index 34b80c3ef6a5..15acaff43641 100644
@@ -12,6 +12,21 @@
 #define MLX5_MACSEC_METADATA_MARKER(metadata)  ((((metadata) >> 30) & 0x3)  == 0x1)
 #define MLX5_MACSEC_RX_METADAT_HANDLE(metadata)  ((metadata) & MLX5_MACSEC_RX_FS_ID_MASK)
 
+/* MACsec TX flow steering */
+#define MLX5_ETH_WQE_FT_META_MACSEC_MASK \
+	(MLX5_ETH_WQE_FT_META_MACSEC | MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK)
+#define MLX5_ETH_WQE_FT_META_MACSEC_SHIFT MLX5_ETH_WQE_FT_META_SHIFT
+
+/* MACsec fs_id handling for steering */
+#define mlx5_macsec_fs_set_tx_fs_id(fs_id) \
+	(((MLX5_ETH_WQE_FT_META_MACSEC) >> MLX5_ETH_WQE_FT_META_MACSEC_SHIFT) \
+	 | ((fs_id) << 2))
+
+#define MLX5_MACSEC_TX_METADATA(fs_id) \
+	(mlx5_macsec_fs_set_tx_fs_id(fs_id) << \
+	 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT)
+
+/* MACsec fs_id uses 4 bits, supports up to 16 interfaces */
 #define MLX5_MACSEC_NUM_OF_SUPPORTED_INTERFACES 16
 
 struct mlx5_macsec_fs;
include/linux/mlx5/qp.h +7 -2
index 5546c7bd2c83..b21be7630575 100644
@@ -251,9 +251,14 @@ enum {
 	MLX5_ETH_WQE_SWP_OUTER_L4_UDP   = 1 << 5,
 };
 
+/* Base shift for metadata bits used by timestamping, IPsec, and MACsec */
+#define MLX5_ETH_WQE_FT_META_SHIFT 0
+
 enum {
-	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0),
-	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1),
+	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0) << MLX5_ETH_WQE_FT_META_SHIFT,
+	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1) << MLX5_ETH_WQE_FT_META_SHIFT,
+	MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK =
+		GENMASK(5, 2) << MLX5_ETH_WQE_FT_META_SHIFT,
 };
 
 struct mlx5_wqe_eth_seg {
Signature · 1 line
2.31.1
author maintainer
#7 lore raw

PATCH 3/3 net/mlx5e: Prevent WQE metadata conflicts between timestamping and offloads

In reply to Tariq Toukan

From: Carolina Jubran <[email protected]>

Update the WQE metadata assignment to avoid overriding existing metadata when setting the sysport timestamp ID. Since timestamp IDs are limited to 256 values, they use only the lower 8 bits of the metadata field.

To avoid conflicts, move IPsec and MACsec metadata ID to bits 8 and 9, and shift the MACsec fs_id accordingly. This ensures safe coexistence of timestamping and offload features that use the same metadata field.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c         | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c | 2 +-
 include/linux/mlx5/qp.h                                 | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1 -1
index 319061d31602..6c55b67b7335 100644
@@ -653,7 +653,7 @@ static void mlx5e_cqe_ts_id_eseg(struct mlx5e_ptpsq *ptpsq, struct sk_buff *skb,
 				 struct mlx5_wqe_eth_seg *eseg)
 {
 	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
-		eseg->flow_table_metadata =
+		eseg->flow_table_metadata |=
 			cpu_to_be32(mlx5e_ptp_metadata_fifo_peek(&ptpsq->metadata_freelist));
 }
 
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c +1 -1
index 9ec450603176..e6be2f01daf4 100644
@@ -2219,7 +2219,7 @@ static int mlx5_macsec_fs_add_roce_rule_tx(struct mlx5_macsec_fs *macsec_fs, u32
 		 mlx5_macsec_fs_set_tx_fs_id(fs_id));
 	MLX5_SET(set_action_in, action, offset,
 		 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT);
-	MLX5_SET(set_action_in, action, length, 32);
+	MLX5_SET(set_action_in, action, length, 8);
 
 	modify_hdr = mlx5_modify_header_alloc(mdev, MLX5_FLOW_NAMESPACE_RDMA_TX_MACSEC,
 					      1, action);
include/linux/mlx5/qp.h +3 -2
index b21be7630575..d67aedc6ea68 100644
@@ -251,8 +251,9 @@ enum {
 	MLX5_ETH_WQE_SWP_OUTER_L4_UDP   = 1 << 5,
 };
 
-/* Base shift for metadata bits used by timestamping, IPsec, and MACsec */
-#define MLX5_ETH_WQE_FT_META_SHIFT 0
+/* Metadata bits 0-7 are used by timestamping */
+/* Base shift for metadata bits used by IPsec and MACsec */
+#define MLX5_ETH_WQE_FT_META_SHIFT 8
 
 enum {
 	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0) << MLX5_ETH_WQE_FT_META_SHIFT,
Signature · 1 line
2.31.1
reviewer
#4 lore raw

Re: [PATCH mlx5-next 2/3] net/mlx5: Refactor MACsec WQE metadata shifts

In reply to Tariq Toukan
Quoted 24 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

Introduce MLX5_ETH_WQE_FT_META_SHIFT as a shared base offset for features that use the lower 8 bits of the WQE flow_table_metadata field, currently used for timestamping, IPsec, and MACsec.

Define MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK so that fs_id occupies bits 2–5, making it clear that fs_id occupies bits in the metadata.

Set MLX5_ETH_WQE_FT_META_MACSEC_MASK as the OR of the MACsec flag and MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK, corresponding to the original 0x3E mask.

Update the fs_id macro to right-shift the MACsec flag by MLX5_ETH_WQE_FT_META_SHIFT and update the RoCE modify-header action to use it.

Introduce the helper macro MLX5_MACSEC_TX_METADATA(fs_id) to compose the full shifted MACsec metadata value.

These changes make it explicit exactly which metadata bits carry MACsec information, simplifying future feature exclusions when multiple features share the WQE flowtable metadata.

Quoted 7 lines

In addition, drop the incorrect “RX flow steering” comment, since this applies to TX flow steering.

Hi Carolina, Tariq, all,

I'm wondering if dropping _SHIFT and making use of FIELD_PREP would lead to a cleaner and more idiomatic implementation.

I'm thinking that such an approach would involve updating MLX5_ETH_WQE_FT_META_MACSEC_MASK rather than MLX5_ETH_WQE_FT_META_MACSEC_SHIFT in the following patch.

I'm thinking of something along the lines of following incremental patch.

drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c +1 -1
index 9ec450603176..58c0ff4af78f 100644
@@ -2218,7 +2218,7 @@ static int mlx5_macsec_fs_add_roce_rule_tx(struct mlx5_macsec_fs *macsec_fs, u32
 	MLX5_SET(set_action_in, action, data,
 		 mlx5_macsec_fs_set_tx_fs_id(fs_id));
 	MLX5_SET(set_action_in, action, offset,
-		 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT);
+		 __bf_shf(MLX5_ETH_WQE_FT_META_MACSEC_MASK));
 	MLX5_SET(set_action_in, action, length, 32);
 
 	modify_hdr = mlx5_modify_header_alloc(mdev, MLX5_FLOW_NAMESPACE_RDMA_TX_MACSEC,
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.h +4 -7
index 15acaff43641..402840cb3110 100644
@@ -13,18 +13,15 @@
 #define MLX5_MACSEC_RX_METADAT_HANDLE(metadata)  ((metadata) & MLX5_MACSEC_RX_FS_ID_MASK)
 
 /* MACsec TX flow steering */
-#define MLX5_ETH_WQE_FT_META_MACSEC_MASK \
-	(MLX5_ETH_WQE_FT_META_MACSEC | MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK)
-#define MLX5_ETH_WQE_FT_META_MACSEC_SHIFT MLX5_ETH_WQE_FT_META_SHIFT
+#define MLX5_ETH_WQE_FT_META_MACSEC_MASK GENMASK(7, 0)
 
 /* MACsec fs_id handling for steering */
 #define mlx5_macsec_fs_set_tx_fs_id(fs_id) \
-	(((MLX5_ETH_WQE_FT_META_MACSEC) >> MLX5_ETH_WQE_FT_META_MACSEC_SHIFT) \
-	 | ((fs_id) << 2))
+	(MLX5_ETH_WQE_FT_META_IPSEC | (fs_id) << 2)
 
 #define MLX5_MACSEC_TX_METADATA(fs_id) \
-	(mlx5_macsec_fs_set_tx_fs_id(fs_id) << \
-	 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT)
+	FIELD_PREP(MLX5_ETH_WQE_FT_META_MACSEC_MASK, \
+		   mlx5_macsec_fs_set_tx_fs_id(fs_id))
 
 /* MACsec fs_id uses 4 bits, supports up to 16 interfaces */
 #define MLX5_MACSEC_NUM_OF_SUPPORTED_INTERFACES 16
include/linux/mlx5/qp.h +2 -7
index b21be7630575..5546c7bd2c83 100644
@@ -251,14 +251,9 @@ enum {
 	MLX5_ETH_WQE_SWP_OUTER_L4_UDP   = 1 << 5,
 };
 
-/* Base shift for metadata bits used by timestamping, IPsec, and MACsec */
-#define MLX5_ETH_WQE_FT_META_SHIFT 0
-
 enum {
-	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0) << MLX5_ETH_WQE_FT_META_SHIFT,
-	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1) << MLX5_ETH_WQE_FT_META_SHIFT,
-	MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK =
-		GENMASK(5, 2) << MLX5_ETH_WQE_FT_META_SHIFT,
+	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0),
+	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1),
 };
 
 struct mlx5_wqe_eth_seg {
#5 lore raw

Re: [PATCH mlx5-next 2/3] net/mlx5: Refactor MACsec WQE metadata shifts

Quoted 94 lines · Simon Horman
Quoted 24 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

Introduce MLX5_ETH_WQE_FT_META_SHIFT as a shared base offset for features that use the lower 8 bits of the WQE flow_table_metadata field, currently used for timestamping, IPsec, and MACsec.

Define MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK so that fs_id occupies bits 2–5, making it clear that fs_id occupies bits in the metadata.

Set MLX5_ETH_WQE_FT_META_MACSEC_MASK as the OR of the MACsec flag and MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK, corresponding to the original 0x3E mask.

Update the fs_id macro to right-shift the MACsec flag by MLX5_ETH_WQE_FT_META_SHIFT and update the RoCE modify-header action to use it.

Introduce the helper macro MLX5_MACSEC_TX_METADATA(fs_id) to compose the full shifted MACsec metadata value.

These changes make it explicit exactly which metadata bits carry MACsec information, simplifying future feature exclusions when multiple features share the WQE flowtable metadata.

Quoted 7 lines

In addition, drop the incorrect “RX flow steering” comment, since this applies to TX flow steering.

Hi Carolina, Tariq, all,

I'm wondering if dropping _SHIFT and making use of FIELD_PREP would lead to a cleaner and more idiomatic implementation.

I'm thinking that such an approach would involve updating MLX5_ETH_WQE_FT_META_MACSEC_MASK rather than MLX5_ETH_WQE_FT_META_MACSEC_SHIFT in the following patch.

I'm thinking of something along the lines of following incremental patch.

drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c +1 -1
index 9ec450603176..58c0ff4af78f 100644
@@ -2218,7 +2218,7 @@ static int mlx5_macsec_fs_add_roce_rule_tx(struct mlx5_macsec_fs *macsec_fs, u32
  	MLX5_SET(set_action_in, action, data,
  		 mlx5_macsec_fs_set_tx_fs_id(fs_id));
  	MLX5_SET(set_action_in, action, offset,
-		 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT);
+		 __bf_shf(MLX5_ETH_WQE_FT_META_MACSEC_MASK));
  	MLX5_SET(set_action_in, action, length, 32);
 
  	modify_hdr = mlx5_modify_header_alloc(mdev, MLX5_FLOW_NAMESPACE_RDMA_TX_MACSEC,
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.h +4 -7
index 15acaff43641..402840cb3110 100644
@@ -13,18 +13,15 @@
  #define MLX5_MACSEC_RX_METADAT_HANDLE(metadata)  ((metadata) & MLX5_MACSEC_RX_FS_ID_MASK)
 
  /* MACsec TX flow steering */
-#define MLX5_ETH_WQE_FT_META_MACSEC_MASK \
-	(MLX5_ETH_WQE_FT_META_MACSEC | MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK)
-#define MLX5_ETH_WQE_FT_META_MACSEC_SHIFT MLX5_ETH_WQE_FT_META_SHIFT
+#define MLX5_ETH_WQE_FT_META_MACSEC_MASK GENMASK(7, 0)
 
  /* MACsec fs_id handling for steering */
  #define mlx5_macsec_fs_set_tx_fs_id(fs_id) \
-	(((MLX5_ETH_WQE_FT_META_MACSEC) >> MLX5_ETH_WQE_FT_META_MACSEC_SHIFT) \
-	 | ((fs_id) << 2))
+	(MLX5_ETH_WQE_FT_META_IPSEC | (fs_id) << 2)
 
  #define MLX5_MACSEC_TX_METADATA(fs_id) \
-	(mlx5_macsec_fs_set_tx_fs_id(fs_id) << \
-	 MLX5_ETH_WQE_FT_META_MACSEC_SHIFT)
+	FIELD_PREP(MLX5_ETH_WQE_FT_META_MACSEC_MASK, \
+		   mlx5_macsec_fs_set_tx_fs_id(fs_id))
 
  /* MACsec fs_id uses 4 bits, supports up to 16 interfaces */
  #define MLX5_MACSEC_NUM_OF_SUPPORTED_INTERFACES 16
include/linux/mlx5/qp.h +0 -3
index b21be7630575..5546c7bd2c83 100644
@@ -251,14 +251,9 @@ enum {
  	MLX5_ETH_WQE_SWP_OUTER_L4_UDP   = 1 << 5,
  };
 
-/* Base shift for metadata bits used by timestamping, IPsec, and MACsec */
-#define MLX5_ETH_WQE_FT_META_SHIFT 0
-

include/linux/mlx5/qp.h enum { · line 259

Quoted 10 lines
include/linux/mlx5/qp.h +2 -4
  enum {
-	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0) << MLX5_ETH_WQE_FT_META_SHIFT,
-	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1) << MLX5_ETH_WQE_FT_META_SHIFT,
-	MLX5_ETH_WQE_FT_META_MACSEC_FS_ID_MASK =
-		GENMASK(5, 2) << MLX5_ETH_WQE_FT_META_SHIFT,
+	MLX5_ETH_WQE_FT_META_IPSEC = BIT(0),
+	MLX5_ETH_WQE_FT_META_MACSEC = BIT(1),
  };
 
  struct mlx5_wqe_eth_seg {

Hi Simon,

Thanks for the suggestion!

The goal with this patch was to clearly show which bits are used for each feature in the metadata field, rather than compressing everything under a single mask. That’s why we chose to explicitly define MACsec, FS_ID_MASK, and the shift separately. This way, its easy to see at a glance that MACsec uses bit 1, and bits 2–5 are reserved for the fs_id.

Using FIELD_PREP can work, but it hides the bit layout behind one mask, which makes it harder to reason about when multiple features share the same 32-bit field. We wanted to keep things more readable and maintainable by showing the bit assignments explicitly.

Carolina

reviewer Reviewed-by
#6 lore raw

Re: [PATCH mlx5-next 2/3] net/mlx5: Refactor MACsec WQE metadata shifts

Quoted 4 lines · Carolina Jubran
Quoted 2 lines · Simon Horman
Quoted 1 line · Tariq Toukan

From: Carolina Jubran <[email protected]>

...

Quoted 10 lines

Hi Simon,

Thanks for the suggestion!

The goal with this patch was to clearly show which bits are used for each feature in the metadata field, rather than compressing everything under a single mask. That’s why we chose to explicitly define MACsec, FS_ID_MASK, and the shift separately. This way, its easy to see at a glance that MACsec uses bit 1, and bits 2–5 are reserved for the fs_id.

Quoted 6 lines

Using FIELD_PREP can work, but it hides the bit layout behind one mask, which makes it harder to reason about when multiple features share the same 32-bit field. We wanted to keep things more readable and maintainable by showing the bit assignments explicitly.

Carolina

Hi Carolina.

Thanks for your response.
If this is a deliberate choice then I'm happy with the current approach.

reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH mlx5-next 1/3] net/mlx5: Remove VLAN insertion fields from WQE Ether segment

In reply to Tariq Toukan
Quoted 7 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

Now that the driver no longer uses VLAN TX insertion via the WQE Ethernet segment, the related fields and flags can be removed.

reviewer Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH mlx5-next 3/3] net/mlx5e: Prevent WQE metadata conflicts between timestamping and offloads

In reply to Tariq Toukan
Quoted 11 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

Update the WQE metadata assignment to avoid overriding existing metadata when setting the sysport timestamp ID. Since timestamp IDs are limited to 256 values, they use only the lower 8 bits of the metadata field.

To avoid conflicts, move IPsec and MACsec metadata ID to bits 8 and 9, and shift the MACsec fs_id accordingly. This ensures safe coexistence of timestamping and offload features that use the same metadata field.

Quoted 5 lines
#9 lore raw
In reply to Tariq Toukan
Quoted 5 lines · Tariq Toukan

Hi,

This series by Carolina contains cleanups significantly touching shared mlx5 net and rdma headers.

Quoted 8 lines

Regards,
Tariq

Carolina Jubran (3):
net/mlx5: Remove VLAN insertion fields from WQE Ether segment net/mlx5: Refactor MACsec WQE metadata shifts net/mlx5e: Prevent WQE metadata conflicts between timestamping and
offloads

Thanks, applied to mlx5-next.