Skip to content

Commit 9fcc2b6

Browse files
gal-pressmanPaolo Abeni
authored andcommitted
net/mlx5e: Fix potentially misleading debug message
Change the debug message to print the correct units instead of always assuming Gbps, as the value can be in either 100 Mbps or 1 Gbps units. Fixes: 5da8bc3 ("net/mlx5e: DCBNL, Add debug messages log") Signed-off-by: Gal Pressman <gal@nvidia.com> Reviewed-by: Nimrod Oren <noren@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1762681073-1084058-6-git-send-email-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 43b27d1 commit 9fcc2b6

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,19 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
598598
__u64 upper_limit_mbps;
599599
__u64 upper_limit_gbps;
600600
int i;
601+
struct {
602+
int scale;
603+
const char *units_str;
604+
} units[] = {
605+
[MLX5_100_MBPS_UNIT] = {
606+
.scale = 100,
607+
.units_str = "Mbps",
608+
},
609+
[MLX5_GBPS_UNIT] = {
610+
.scale = 1,
611+
.units_str = "Gbps",
612+
},
613+
};
601614

602615
memset(max_bw_value, 0, sizeof(max_bw_value));
603616
memset(max_bw_unit, 0, sizeof(max_bw_unit));
@@ -628,8 +641,9 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
628641
}
629642

630643
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
631-
netdev_dbg(netdev, "%s: tc_%d <=> max_bw %d Gbps\n",
632-
__func__, i, max_bw_value[i]);
644+
netdev_dbg(netdev, "%s: tc_%d <=> max_bw %u %s\n", __func__, i,
645+
max_bw_value[i] * units[max_bw_unit[i]].scale,
646+
units[max_bw_unit[i]].units_str);
633647
}
634648

635649
return mlx5_modify_port_ets_rate_limit(mdev, max_bw_value, max_bw_unit);

0 commit comments

Comments
 (0)