diff mbox series

[net] nfp: fix port stats for mac representors

Message ID 20171202053723.32660-1-jakub.kicinski@netronome.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net] nfp: fix port stats for mac representors | expand

Commit Message

Jakub Kicinski Dec. 2, 2017, 5:37 a.m. UTC
From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>

Previously we swapped the tx_packets, tx_bytes and tx_dropped counters
with rx_packets, rx_bytes and rx_dropped counters, respectively. This
behaviour is correct and expected for VF representors but it should not
be swapped for physical port mac representors.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Jakub Kicinski Dec. 2, 2017, 10:03 a.m. UTC | #1
On Fri, Dec 1, 2017 at 9:37 PM, Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
>
> Previously we swapped the tx_packets, tx_bytes and tx_dropped counters
> with rx_packets, rx_bytes and rx_dropped counters, respectively. This
> behaviour is correct and expected for VF representors but it should not
> be swapped for physical port mac representors.

Ah, I forgot to point the finger.  Should I repost?

Fixes: eadfa4c3be99 ("nfp: add stats and xmit helpers for representors")

> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>
> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
David Miller Dec. 5, 2017, 4:27 p.m. UTC | #2
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri,  1 Dec 2017 21:37:23 -0800

> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
> 
> Previously we swapped the tx_packets, tx_bytes and tx_dropped counters
> with rx_packets, rx_bytes and rx_dropped counters, respectively. This
> behaviour is correct and expected for VF representors but it should not
> be swapped for physical port mac representors.
> 
> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>
> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Applied.
David Miller Dec. 5, 2017, 4:30 p.m. UTC | #3
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Sat, 2 Dec 2017 02:03:31 -0800

> On Fri, Dec 1, 2017 at 9:37 PM, Jakub Kicinski
> <jakub.kicinski@netronome.com> wrote:
>> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
>>
>> Previously we swapped the tx_packets, tx_bytes and tx_dropped counters
>> with rx_packets, rx_bytes and rx_dropped counters, respectively. This
>> behaviour is correct and expected for VF representors but it should not
>> be swapped for physical port mac representors.
> 
> Ah, I forgot to point the finger.  Should I repost?
> 
> Fixes: eadfa4c3be99 ("nfp: add stats and xmit helpers for representors")

I added this to the commit message, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 924a05e05da0..78b36c67c232 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -84,16 +84,13 @@  nfp_repr_phy_port_get_stats64(struct nfp_port *port,
 {
 	u8 __iomem *mem = port->eth_stats;
 
-	/* TX and RX stats are flipped as we are returning the stats as seen
-	 * at the switch port corresponding to the phys port.
-	 */
-	stats->tx_packets = readq(mem + NFP_MAC_STATS_RX_FRAMES_RECEIVED_OK);
-	stats->tx_bytes = readq(mem + NFP_MAC_STATS_RX_IN_OCTETS);
-	stats->tx_dropped = readq(mem + NFP_MAC_STATS_RX_IN_ERRORS);
+	stats->tx_packets = readq(mem + NFP_MAC_STATS_TX_FRAMES_TRANSMITTED_OK);
+	stats->tx_bytes = readq(mem + NFP_MAC_STATS_TX_OUT_OCTETS);
+	stats->tx_dropped = readq(mem + NFP_MAC_STATS_TX_OUT_ERRORS);
 
-	stats->rx_packets = readq(mem + NFP_MAC_STATS_TX_FRAMES_TRANSMITTED_OK);
-	stats->rx_bytes = readq(mem + NFP_MAC_STATS_TX_OUT_OCTETS);
-	stats->rx_dropped = readq(mem + NFP_MAC_STATS_TX_OUT_ERRORS);
+	stats->rx_packets = readq(mem + NFP_MAC_STATS_RX_FRAMES_RECEIVED_OK);
+	stats->rx_bytes = readq(mem + NFP_MAC_STATS_RX_IN_OCTETS);
+	stats->rx_dropped = readq(mem + NFP_MAC_STATS_RX_IN_ERRORS);
 }
 
 static void