Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214900
b: refs/heads/master
c: ef18280
h: refs/heads/master
v: v3
  • Loading branch information
Amit Kumar Salecha authored and David S. Miller committed Oct 5, 2010
1 parent 6b8a582 commit aa8eb8b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 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: 31dee692e22eedaf2540fa543fa9c91df6ab8bda
refs/heads/master: ef1828058b8a37f7005be677686727bbbde77f6a
12 changes: 12 additions & 0 deletions trunk/drivers/net/qlcnic/qlcnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,18 @@ struct qlcnic_esw_func_cfg {
#define QLCNIC_STATS_ESWITCH 2
#define QLCNIC_QUERY_RX_COUNTER 0
#define QLCNIC_QUERY_TX_COUNTER 1
#define QLCNIC_ESW_STATS_NOT_AVAIL 0xffffffffffffffffULL

#define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)\
do { \
if (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) && \
((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
(VAL1) = (VAL2); \
else if (((VAL1) != QLCNIC_ESW_STATS_NOT_AVAIL) && \
((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
(VAL1) += (VAL2); \
} while (0)

struct __qlcnic_esw_statistics {
__le16 context_id;
__le16 version;
Expand Down
31 changes: 22 additions & 9 deletions trunk/drivers/net/qlcnic/qlcnic_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,14 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
if (adapter->npars == NULL)
return -EIO;

memset(esw_stats, 0, sizeof(struct __qlcnic_esw_statistics));
memset(esw_stats, 0, sizeof(u64));
esw_stats->unicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->multicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->broadcast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->dropped_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->errors = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->local_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->numbytes = QLCNIC_ESW_STATS_NOT_AVAIL;
esw_stats->context_id = eswitch;

for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
Expand All @@ -1029,14 +1036,20 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,

esw_stats->size = port_stats.size;
esw_stats->version = port_stats.version;
esw_stats->unicast_frames += port_stats.unicast_frames;
esw_stats->multicast_frames += port_stats.multicast_frames;
esw_stats->broadcast_frames += port_stats.broadcast_frames;
esw_stats->dropped_frames += port_stats.dropped_frames;
esw_stats->errors += port_stats.errors;
esw_stats->local_frames += port_stats.local_frames;
esw_stats->numbytes += port_stats.numbytes;

QLCNIC_ADD_ESW_STATS(esw_stats->unicast_frames,
port_stats.unicast_frames);
QLCNIC_ADD_ESW_STATS(esw_stats->multicast_frames,
port_stats.multicast_frames);
QLCNIC_ADD_ESW_STATS(esw_stats->broadcast_frames,
port_stats.broadcast_frames);
QLCNIC_ADD_ESW_STATS(esw_stats->dropped_frames,
port_stats.dropped_frames);
QLCNIC_ADD_ESW_STATS(esw_stats->errors,
port_stats.errors);
QLCNIC_ADD_ESW_STATS(esw_stats->local_frames,
port_stats.local_frames);
QLCNIC_ADD_ESW_STATS(esw_stats->numbytes,
port_stats.numbytes);
ret = 0;
}
return ret;
Expand Down

0 comments on commit aa8eb8b

Please sign in to comment.