Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265525
b: refs/heads/master
c: 09c1c68
h: refs/heads/master
i:
  265523: c672454
v: v3
  • Loading branch information
Sathya Perla authored and David S. Miller committed Aug 24, 2011
1 parent dc85d70 commit eef7702
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db3ea7819d035ff01c8260fce364511adfae0eaa
refs/heads/master: 09c1c68f2239dcd99b76be2c44e84811fba273db
22 changes: 19 additions & 3 deletions trunk/drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ static void populate_lancer_stats(struct be_adapter *adapter)
pport_stats->rx_drops_too_many_frags_lo;
}

static void accumulate_16bit_val(u32 *acc, u16 val)
{
#define lo(x) (x & 0xFFFF)
#define hi(x) (x & 0xFFFF0000)
bool wrapped = val < lo(*acc);
u32 newacc = hi(*acc) + val;

if (wrapped)
newacc += 65536;
ACCESS_ONCE(*acc) = newacc;
}

void be_parse_stats(struct be_adapter *adapter)
{
struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter);
Expand All @@ -394,9 +406,13 @@ void be_parse_stats(struct be_adapter *adapter)
}

/* as erx_v1 is longer than v0, ok to use v1 defn for v0 access */
for_all_rx_queues(adapter, rxo, i)
rx_stats(rxo)->rx_drops_no_frags =
erx->rx_drops_no_fragments[rxo->q.id];
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]);
}
}

static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
Expand Down

0 comments on commit eef7702

Please sign in to comment.