diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2013-05-01 09:37:27 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-02 16:43:13 -0400 |
commit | a6c578ef9b6dc39efd8cd6e68295f63486d20c75 (patch) | |
tree | 374c40541a9eb889d2ccbb3b85e288e0b5ccf648 /drivers/net/ethernet | |
parent | bbdc42f8147d19f71fe4bc3db8a83e03a21af7a4 (diff) | |
download | op-kernel-dev-a6c578ef9b6dc39efd8cd6e68295f63486d20c75.zip op-kernel-dev-a6c578ef9b6dc39efd8cd6e68295f63486d20c75.tar.gz |
be2net: Fix to use 32-bit stats to report rx_drops_no_fragment
Only BE devices provide 16-bit counter for rx_drops_no_fragment.
All other devices provide a 32-bit counter for this stat.
Use the 32-bit value where available.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 4babc8a..e60e7f7 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -471,11 +471,26 @@ static void accumulate_16bit_val(u32 *acc, u16 val) ACCESS_ONCE(*acc) = newacc; } +void populate_erx_stats(struct be_adapter *adapter, + struct be_rx_obj *rxo, + u32 erx_stat) +{ + if (!BEx_chip(adapter)) + rx_stats(rxo)->rx_drops_no_frags = erx_stat; + else + /* below erx HW counter can actually wrap around after + * 65535. Driver accumulates a 32-bit value + */ + accumulate_16bit_val(&rx_stats(rxo)->rx_drops_no_frags, + (u16)erx_stat); +} + void be_parse_stats(struct be_adapter *adapter) { struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter); struct be_rx_obj *rxo; int i; + u32 erx_stat; if (lancer_chip(adapter)) { populate_lancer_stats(adapter); @@ -488,12 +503,8 @@ void be_parse_stats(struct be_adapter *adapter) /* as erx_v1 is longer than v0, ok to use v1 for v0 access */ for_all_rx_queues(adapter, rxo, i) { - /* below erx HW counter can actually wrap around after - * 65535. Driver accumulates a 32-bit value - */ - accumulate_16bit_val(&rx_stats(rxo)->rx_drops_no_frags, - (u16)erx->rx_drops_no_fragments \ - [rxo->q.id]); + erx_stat = erx->rx_drops_no_fragments[rxo->q.id]; + populate_erx_stats(adapter, rxo, erx_stat); } } } |