* [PATCH] ibmveth: Fix endian issues with rx_no_buffer statistic
@ 2014-08-22 1:36 Anton Blanchard
2014-08-22 18:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2014-08-22 1:36 UTC (permalink / raw)
To: santil, paulus; +Cc: netdev, linuxppc-dev
Hidden away in the last 8 bytes of the buffer_list page is a solitary
statistic. It needs to be byte swapped or else ethtool -S will
produce numbers that terrify the user.
Since we do this in multiple places, create a helper function with a
comment explaining what is going on.
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@vger.kernel.org
---
Index: b/drivers/net/ethernet/ibm/ibmveth.c
===================================================================
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -292,6 +292,18 @@ failure:
atomic_add(buffers_added, &(pool->available));
}
+/*
+ * The final 8 bytes of the buffer list is a counter of frames dropped
+ * because there was not a buffer in the buffer list capable of holding
+ * the frame.
+ */
+static void ibmveth_update_rx_no_buffer(struct ibmveth_adapter *adapter)
+{
+ __be64 *p = adapter->buffer_list_addr + 4096 - 8;
+
+ adapter->rx_no_buffer = be64_to_cpup(p);
+}
+
/* replenish routine */
static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
{
@@ -307,8 +319,7 @@ static void ibmveth_replenish_task(struc
ibmveth_replenish_buffer_pool(adapter, pool);
}
- adapter->rx_no_buffer = *(u64 *)(((char*)adapter->buffer_list_addr) +
- 4096 - 8);
+ ibmveth_update_rx_no_buffer(adapter);
}
/* empty and free ana buffer pool - also used to do cleanup in error paths */
@@ -698,8 +709,7 @@ static int ibmveth_close(struct net_devi
free_irq(netdev->irq, netdev);
- adapter->rx_no_buffer = *(u64 *)(((char *)adapter->buffer_list_addr) +
- 4096 - 8);
+ ibmveth_update_rx_no_buffer(adapter);
ibmveth_cleanup(adapter);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ibmveth: Fix endian issues with rx_no_buffer statistic
2014-08-22 1:36 [PATCH] ibmveth: Fix endian issues with rx_no_buffer statistic Anton Blanchard
@ 2014-08-22 18:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-08-22 18:28 UTC (permalink / raw)
To: anton; +Cc: paulus, santil, linuxppc-dev, netdev
From: Anton Blanchard <anton@samba.org>
Date: Fri, 22 Aug 2014 11:36:52 +1000
> Hidden away in the last 8 bytes of the buffer_list page is a solitary
> statistic. It needs to be byte swapped or else ethtool -S will
> produce numbers that terrify the user.
>
> Since we do this in multiple places, create a helper function with a
> comment explaining what is going on.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Applied, thanks Anton.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-22 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-22 1:36 [PATCH] ibmveth: Fix endian issues with rx_no_buffer statistic Anton Blanchard
2014-08-22 18:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).