mlxsw: Do not store Tx header length as driver parameter
authorAmit Cohen <amcohen@nvidia.com>
Thu, 16 Jan 2025 16:38:18 +0000 (17:38 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 18 Jan 2025 03:58:00 +0000 (19:58 -0800)
Tx header handling was moved to PCI code, as there is no several drivers
which configure Tx header differently. Tx header length is stored as driver
parameter, this is not really necessary as it always stores the same value.
Remove this field and use the macro MLXSW_TXHDR_LEN explicitly.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/1fb7b3f007de4d311e559c8a954b673d0895d5e9.1737044384.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index 3988867..2bb2b77 100644 (file)
@@ -35,6 +35,7 @@
 #include "reg.h"
 #include "resources.h"
 #include "../mlxfw/mlxfw.h"
+#include "txheader.h"
 
 static LIST_HEAD(mlxsw_core_driver_list);
 static DEFINE_SPINLOCK(mlxsw_core_driver_list_lock);
@@ -943,7 +944,7 @@ static struct sk_buff *mlxsw_emad_alloc(const struct mlxsw_core *mlxsw_core,
 
        emad_len = (reg_len + sizeof(u32) + MLXSW_EMAD_ETH_HDR_LEN +
                    (MLXSW_EMAD_OP_TLV_LEN + MLXSW_EMAD_END_TLV_LEN) *
-                   sizeof(u32) + mlxsw_core->driver->txhdr_len);
+                   sizeof(u32) + MLXSW_TXHDR_LEN);
        if (mlxsw_core->emad.enable_string_tlv)
                emad_len += MLXSW_EMAD_STRING_TLV_LEN * sizeof(u32);
        if (mlxsw_core->emad.enable_latency_tlv)
index d842af2..1a87139 100644 (file)
@@ -444,7 +444,6 @@ struct mlxsw_driver {
        void (*ptp_transmitted)(struct mlxsw_core *mlxsw_core,
                                struct sk_buff *skb, u16 local_port);
 
-       u8 txhdr_len;
        const struct mlxsw_config_profile *profile;
        bool sdq_supports_cqe_v2;
 };
index d2886a8..d714311 100644 (file)
@@ -3890,7 +3890,6 @@ static struct mlxsw_driver mlxsw_sp1_driver = {
        .resources_register             = mlxsw_sp1_resources_register,
        .kvd_sizes_get                  = mlxsw_sp_kvd_sizes_get,
        .ptp_transmitted                = mlxsw_sp_ptp_transmitted,
-       .txhdr_len                      = MLXSW_TXHDR_LEN,
        .profile                        = &mlxsw_sp1_config_profile,
        .sdq_supports_cqe_v2            = false,
 };
@@ -3926,7 +3925,6 @@ static struct mlxsw_driver mlxsw_sp2_driver = {
        .trap_policer_counter_get       = mlxsw_sp_trap_policer_counter_get,
        .resources_register             = mlxsw_sp2_resources_register,
        .ptp_transmitted                = mlxsw_sp_ptp_transmitted,
-       .txhdr_len                      = MLXSW_TXHDR_LEN,
        .profile                        = &mlxsw_sp2_config_profile,
        .sdq_supports_cqe_v2            = true,
 };
@@ -3962,7 +3960,6 @@ static struct mlxsw_driver mlxsw_sp3_driver = {
        .trap_policer_counter_get       = mlxsw_sp_trap_policer_counter_get,
        .resources_register             = mlxsw_sp2_resources_register,
        .ptp_transmitted                = mlxsw_sp_ptp_transmitted,
-       .txhdr_len                      = MLXSW_TXHDR_LEN,
        .profile                        = &mlxsw_sp2_config_profile,
        .sdq_supports_cqe_v2            = true,
 };
@@ -3996,7 +3993,6 @@ static struct mlxsw_driver mlxsw_sp4_driver = {
        .trap_policer_counter_get       = mlxsw_sp_trap_policer_counter_get,
        .resources_register             = mlxsw_sp2_resources_register,
        .ptp_transmitted                = mlxsw_sp_ptp_transmitted,
-       .txhdr_len                      = MLXSW_TXHDR_LEN,
        .profile                        = &mlxsw_sp4_config_profile,
        .sdq_supports_cqe_v2            = true,
 };