Skip to content

Commit 16ab85e

Browse files
gal-pressmankuba-moo
authored andcommitted
net/mlx5e: Expose rx_oversize_pkts_buffer counter
Add the rx_oversize_pkts_buffer counter to ethtool statistics. This counter exposes the number of dropped received packets due to length which arrived to RQ and exceed software buffer size allocated by the device for incoming traffic. It might imply that the device MTU is larger than the software buffers size. Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c2c9e31 commit 16ab85e

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3699,7 +3699,8 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
36993699
stats->rx_length_errors =
37003700
PPORT_802_3_GET(pstats, a_in_range_length_errors) +
37013701
PPORT_802_3_GET(pstats, a_out_of_range_length_field) +
3702-
PPORT_802_3_GET(pstats, a_frame_too_long_errors);
3702+
PPORT_802_3_GET(pstats, a_frame_too_long_errors) +
3703+
VNIC_ENV_GET(&priv->stats.vnic, eth_wqe_too_small);
37033704
stats->rx_crc_errors =
37043705
PPORT_802_3_GET(pstats, a_frame_check_sequence_errors);
37053706
stats->rx_frame_errors = PPORT_802_3_GET(pstats, a_alignment_errors);

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,17 +641,26 @@ static const struct counter_desc vnic_env_stats_dev_oob_desc[] = {
641641
VNIC_ENV_OFF(vport_env.internal_rq_out_of_buffer) },
642642
};
643643

644+
static const struct counter_desc vnic_env_stats_drop_desc[] = {
645+
{ "rx_oversize_pkts_buffer",
646+
VNIC_ENV_OFF(vport_env.eth_wqe_too_small) },
647+
};
648+
644649
#define NUM_VNIC_ENV_STEER_COUNTERS(dev) \
645650
(MLX5_CAP_GEN(dev, nic_receive_steering_discard) ? \
646651
ARRAY_SIZE(vnic_env_stats_steer_desc) : 0)
647652
#define NUM_VNIC_ENV_DEV_OOB_COUNTERS(dev) \
648653
(MLX5_CAP_GEN(dev, vnic_env_int_rq_oob) ? \
649654
ARRAY_SIZE(vnic_env_stats_dev_oob_desc) : 0)
655+
#define NUM_VNIC_ENV_DROP_COUNTERS(dev) \
656+
(MLX5_CAP_GEN(dev, eth_wqe_too_small) ? \
657+
ARRAY_SIZE(vnic_env_stats_drop_desc) : 0)
650658

651659
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(vnic_env)
652660
{
653661
return NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev) +
654-
NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev);
662+
NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev) +
663+
NUM_VNIC_ENV_DROP_COUNTERS(priv->mdev);
655664
}
656665

657666
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vnic_env)
@@ -665,6 +674,11 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vnic_env)
665674
for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++)
666675
strcpy(data + (idx++) * ETH_GSTRING_LEN,
667676
vnic_env_stats_dev_oob_desc[i].format);
677+
678+
for (i = 0; i < NUM_VNIC_ENV_DROP_COUNTERS(priv->mdev); i++)
679+
strcpy(data + (idx++) * ETH_GSTRING_LEN,
680+
vnic_env_stats_drop_desc[i].format);
681+
668682
return idx;
669683
}
670684

@@ -679,6 +693,11 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vnic_env)
679693
for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++)
680694
data[idx++] = MLX5E_READ_CTR32_BE(priv->stats.vnic.query_vnic_env_out,
681695
vnic_env_stats_dev_oob_desc, i);
696+
697+
for (i = 0; i < NUM_VNIC_ENV_DROP_COUNTERS(priv->mdev); i++)
698+
data[idx++] = MLX5E_READ_CTR32_BE(priv->stats.vnic.query_vnic_env_out,
699+
vnic_env_stats_drop_desc, i);
700+
682701
return idx;
683702
}
684703

drivers/net/ethernet/mellanox/mlx5/core/en_stats.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ struct mlx5e_qcounter_stats {
273273
u32 rx_if_down_packets;
274274
};
275275

276+
#define VNIC_ENV_GET(vnic_env_stats, c) \
277+
MLX5_GET(query_vnic_env_out, (vnic_env_stats)->query_vnic_env_out, \
278+
vport_env.c)
279+
276280
struct mlx5e_vnic_env_stats {
277281
__be64 query_vnic_env_out[MLX5_ST_SZ_QW(query_vnic_env_out)];
278282
};

include/linux/mlx5/mlx5_ifc.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
14911491

14921492
u8 reserved_at_120[0xa];
14931493
u8 log_max_ra_req_dc[0x6];
1494-
u8 reserved_at_130[0x9];
1494+
u8 reserved_at_130[0x2];
1495+
u8 eth_wqe_too_small[0x1];
1496+
u8 reserved_at_133[0x6];
14951497
u8 vnic_env_cq_overrun[0x1];
14961498
u8 log_max_ra_res_dc[0x6];
14971499

@@ -3537,7 +3539,9 @@ struct mlx5_ifc_vnic_diagnostic_statistics_bits {
35373539

35383540
u8 cq_overrun[0x20];
35393541

3540-
u8 reserved_at_220[0xde0];
3542+
u8 eth_wqe_too_small[0x20];
3543+
3544+
u8 reserved_at_220[0xdc0];
35413545
};
35423546

35433547
struct mlx5_ifc_traffic_counter_bits {

0 commit comments

Comments
 (0)