net: bcmgenet: Track per TX/RX rings statistics
__bcmgenet_tx_reclaim() is currently summing TX bytes/packets in a way that is not SMP friendly, mutliples CPUs could run __bcmgenet_tx_reclaim() independently and still update stats->tx_bytes and stats->tx_packets, cloberring the other CPUs statistics. Fix this by tracking per RX and TX rings the number of bytes, packets, dropped and errors statistics, and provide a bcmgenet_get_stats() function which aggregates everything and returns a consistent output. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
bf4e0a3db9
commit
37a30b435b
@@ -552,6 +552,8 @@ struct bcmgenet_skb_cb {
|
||||
struct bcmgenet_tx_ring {
|
||||
spinlock_t lock; /* ring lock */
|
||||
struct napi_struct napi; /* NAPI per tx queue */
|
||||
unsigned long packets;
|
||||
unsigned long bytes;
|
||||
unsigned int index; /* ring index */
|
||||
unsigned int queue; /* queue index */
|
||||
struct enet_cb *cbs; /* tx ring buffer control block*/
|
||||
@@ -570,6 +572,10 @@ struct bcmgenet_tx_ring {
|
||||
|
||||
struct bcmgenet_rx_ring {
|
||||
struct napi_struct napi; /* Rx NAPI struct */
|
||||
unsigned long bytes;
|
||||
unsigned long packets;
|
||||
unsigned long errors;
|
||||
unsigned long dropped;
|
||||
unsigned int index; /* Rx ring index */
|
||||
struct enet_cb *cbs; /* Rx ring buffer control block */
|
||||
unsigned int size; /* Rx ring size */
|
||||
|
Reference in New Issue
Block a user