net/mlx5e: Add local loopback counter to vport stats

Add counter for number of unicast, multicast and broadcast packets/
octets that were loopback.

Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
Or Har-Toov 2023-03-23 18:11:50 +02:00 committed by Saeed Mahameed
parent 0bd2e6fc78
commit c8013a1f71
2 changed files with 32 additions and 1 deletions

View File

@ -797,6 +797,16 @@ Counters on the NIC port that is connected to a eSwitch.
RoCE/UD/RC traffic) [#accel]_. RoCE/UD/RC traffic) [#accel]_.
- Acceleration - Acceleration
* - `vport_loopback_packets`
- Unicast, multicast and broadcast packets that were loop-back (received
and transmitted), IB/Eth [#accel]_.
- Acceleration
* - `vport_loopback_bytes`
- Unicast, multicast and broadcast bytes that were loop-back (received
and transmitted), IB/Eth [#accel]_.
- Acceleration
* - `rx_steer_missed_packets` * - `rx_steer_missed_packets`
- Number of packets that was received by the NIC, however was discarded - Number of packets that was received by the NIC, however was discarded
because it did not match any flow in the NIC flow table. because it did not match any flow in the NIC flow table.

View File

@ -748,11 +748,22 @@ static const struct counter_desc vport_stats_desc[] = {
VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) }, VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
}; };
static const struct counter_desc vport_loopback_stats_desc[] = {
{ "vport_loopback_packets",
VPORT_COUNTER_OFF(local_loopback.packets) },
{ "vport_loopback_bytes",
VPORT_COUNTER_OFF(local_loopback.octets) },
};
#define NUM_VPORT_COUNTERS ARRAY_SIZE(vport_stats_desc) #define NUM_VPORT_COUNTERS ARRAY_SIZE(vport_stats_desc)
#define NUM_VPORT_LOOPBACK_COUNTERS(dev) \
(MLX5_CAP_GEN(dev, vport_counter_local_loopback) ? \
ARRAY_SIZE(vport_loopback_stats_desc) : 0)
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(vport) static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(vport)
{ {
return NUM_VPORT_COUNTERS; return NUM_VPORT_COUNTERS +
NUM_VPORT_LOOPBACK_COUNTERS(priv->mdev);
} }
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vport) static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vport)
@ -761,6 +772,11 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vport)
for (i = 0; i < NUM_VPORT_COUNTERS; i++) for (i = 0; i < NUM_VPORT_COUNTERS; i++)
strcpy(data + (idx++) * ETH_GSTRING_LEN, vport_stats_desc[i].format); strcpy(data + (idx++) * ETH_GSTRING_LEN, vport_stats_desc[i].format);
for (i = 0; i < NUM_VPORT_LOOPBACK_COUNTERS(priv->mdev); i++)
strcpy(data + (idx++) * ETH_GSTRING_LEN,
vport_loopback_stats_desc[i].format);
return idx; return idx;
} }
@ -771,6 +787,11 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vport)
for (i = 0; i < NUM_VPORT_COUNTERS; i++) for (i = 0; i < NUM_VPORT_COUNTERS; i++)
data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vport.query_vport_out, data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vport.query_vport_out,
vport_stats_desc, i); vport_stats_desc, i);
for (i = 0; i < NUM_VPORT_LOOPBACK_COUNTERS(priv->mdev); i++)
data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vport.query_vport_out,
vport_loopback_stats_desc, i);
return idx; return idx;
} }