]> www.infradead.org Git - users/hch/misc.git/commitdiff
net/mlx5e: Prevent WQE metadata conflicts between timestamping and offloads
authorCarolina Jubran <cjubran@nvidia.com>
Thu, 11 Sep 2025 07:10:19 +0000 (10:10 +0300)
committerLeon Romanovsky <leon@kernel.org>
Wed, 17 Sep 2025 08:38:10 +0000 (04:38 -0400)
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.

Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1757574619-604874-4-git-send-email-tariqt@nvidia.com
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
include/linux/mlx5/qp.h

index 319061d31602d5f0369e7d2f65835ac599acac89..6c55b67b7335ce629bf04718a80ac47e5749ed5f 100644 (file)
@@ -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));
 }
 
index 9ec45060317659f1cb88115ceed22eea65379ff4..e6be2f01daf4c592ad9ec7bc761b4cb24dc20237 100644 (file)
@@ -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);
index b21be7630575bd2b3e7f2fddd3851a712786a647..d67aedc6ea68ae9f514a1de11626792bfe847c04 100644 (file)
@@ -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,