|
|
d8f823 |
From 5391a9ae3e19dbb7bd9d314271ec510177f9d8ca Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Tue, 12 May 2020 10:55:18 -0400
|
|
|
d8f823 |
Subject: [PATCH 202/312] [netdrv] net/mlx5e: Get the latest values from
|
|
|
d8f823 |
counters in switchdev mode
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200512105530.4207-113-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 306985
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1789382 112/124] net/mlx5e: Get the latest values from counters in switchdev mode
|
|
|
d8f823 |
Bugzilla: 1789382
|
|
|
d8f823 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1789382
|
|
|
d8f823 |
Upstream: v5.7-rc3
|
|
|
d8f823 |
|
|
|
d8f823 |
commit dcdf4ce0ff4ba206fc362e149c8ae81d6a2f849c
|
|
|
d8f823 |
Author: Zhu Yanjun <yanjunz@mellanox.com>
|
|
|
d8f823 |
Date: Wed Apr 8 14:51:52 2020 +0800
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5e: Get the latest values from counters in switchdev mode
|
|
|
d8f823 |
|
|
|
d8f823 |
In the switchdev mode, when running "cat
|
|
|
d8f823 |
/sys/class/net/NIC/statistics/tx_packets", the ppcnt register is
|
|
|
d8f823 |
accessed to get the latest values. But currently this command can
|
|
|
d8f823 |
not get the correct values from ppcnt.
|
|
|
d8f823 |
|
|
|
d8f823 |
From firmware manual, before getting the 802_3 counters, the 802_3
|
|
|
d8f823 |
data layout should be set to the ppcnt register.
|
|
|
d8f823 |
|
|
|
d8f823 |
When the command "cat /sys/class/net/NIC/statistics/tx_packets" is
|
|
|
d8f823 |
run, before updating 802_3 data layout with ppcnt register, the
|
|
|
d8f823 |
monitor counters are tested. The test result will decide the
|
|
|
d8f823 |
802_3 data layout is updated or not.
|
|
|
d8f823 |
|
|
|
d8f823 |
Actually the monitor counters do not support to monitor rx/tx
|
|
|
d8f823 |
stats of 802_3 in switchdev mode. So the rx/tx counters change
|
|
|
d8f823 |
will not trigger monitor counters. So the 802_3 data layout will
|
|
|
d8f823 |
not be updated in ppcnt register. Finally this command can not get
|
|
|
d8f823 |
the latest values from ppcnt register with 802_3 data layout.
|
|
|
d8f823 |
|
|
|
d8f823 |
Fixes: 5c7e8bbb0257 ("net/mlx5e: Use monitor counters for update stats")
|
|
|
d8f823 |
Signed-off-by: Zhu Yanjun <yanjunz@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 ++++++-
|
|
|
d8f823 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
index 0d50ee4fd986..22298f67fbd2 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
|
|
|
d8f823 |
@@ -3584,7 +3584,12 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
|
|
d8f823 |
struct mlx5e_vport_stats *vstats = &priv->stats.vport;
|
|
|
d8f823 |
struct mlx5e_pport_stats *pstats = &priv->stats.pport;
|
|
|
d8f823 |
|
|
|
d8f823 |
- if (!mlx5e_monitor_counter_supported(priv)) {
|
|
|
d8f823 |
+ /* In switchdev mode, monitor counters doesn't monitor
|
|
|
d8f823 |
+ * rx/tx stats of 802_3. The update stats mechanism
|
|
|
d8f823 |
+ * should keep the 802_3 layout counters updated
|
|
|
d8f823 |
+ */
|
|
|
d8f823 |
+ if (!mlx5e_monitor_counter_supported(priv) ||
|
|
|
d8f823 |
+ mlx5e_is_uplink_rep(priv)) {
|
|
|
d8f823 |
/* update HW stats in background for next time */
|
|
|
d8f823 |
mlx5e_queue_update_stats(priv);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|