aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic
diff options
context:
space:
mode:
authorAmit Kumar Salecha <amit.salecha@qlogic.com>2010-10-04 00:20:10 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-05 01:46:49 -0400
commitef1828058b8a37f7005be677686727bbbde77f6a (patch)
treeef3dd450c5265f983b33c0a35858c3bf00acbdeb /drivers/net/qlcnic
parent31dee692e22eedaf2540fa543fa9c91df6ab8bda (diff)
qlcnic: fix eswitch stats
Some of the counters are not implemented in fw. Fw return NOT AVAILABLE VALUE as (0xffffffffffffffff). Adding these counters, result in invalid value. Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r--drivers/net/qlcnic/qlcnic.h12
-rw-r--r--drivers/net/qlcnic/qlcnic_ctx.c31
2 files changed, 34 insertions, 9 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 714ddf461d73..4667463d5523 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -1169,6 +1169,18 @@ struct qlcnic_esw_func_cfg {
1169#define QLCNIC_STATS_ESWITCH 2 1169#define QLCNIC_STATS_ESWITCH 2
1170#define QLCNIC_QUERY_RX_COUNTER 0 1170#define QLCNIC_QUERY_RX_COUNTER 0
1171#define QLCNIC_QUERY_TX_COUNTER 1 1171#define QLCNIC_QUERY_TX_COUNTER 1
1172#define QLCNIC_ESW_STATS_NOT_AVAIL 0xffffffffffffffffULL
1173
1174#define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)\
1175do { \
1176 if (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) && \
1177 ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
1178 (VAL1) = (VAL2); \
1179 else if (((VAL1) != QLCNIC_ESW_STATS_NOT_AVAIL) && \
1180 ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
1181 (VAL1) += (VAL2); \
1182} while (0)
1183
1172struct __qlcnic_esw_statistics { 1184struct __qlcnic_esw_statistics {
1173 __le16 context_id; 1185 __le16 context_id;
1174 __le16 version; 1186 __le16 version;
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 95a821e0b66f..a4c4d091739e 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -1016,7 +1016,14 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
1016 if (adapter->npars == NULL) 1016 if (adapter->npars == NULL)
1017 return -EIO; 1017 return -EIO;
1018 1018
1019 memset(esw_stats, 0, sizeof(struct __qlcnic_esw_statistics)); 1019 memset(esw_stats, 0, sizeof(u64));
1020 esw_stats->unicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
1021 esw_stats->multicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
1022 esw_stats->broadcast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
1023 esw_stats->dropped_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
1024 esw_stats->errors = QLCNIC_ESW_STATS_NOT_AVAIL;
1025 esw_stats->local_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
1026 esw_stats->numbytes = QLCNIC_ESW_STATS_NOT_AVAIL;
1020 esw_stats->context_id = eswitch; 1027 esw_stats->context_id = eswitch;
1021 1028
1022 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { 1029 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
@@ -1029,14 +1036,20 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
1029 1036
1030 esw_stats->size = port_stats.size; 1037 esw_stats->size = port_stats.size;
1031 esw_stats->version = port_stats.version; 1038 esw_stats->version = port_stats.version;
1032 esw_stats->unicast_frames += port_stats.unicast_frames; 1039 QLCNIC_ADD_ESW_STATS(esw_stats->unicast_frames,
1033 esw_stats->multicast_frames += port_stats.multicast_frames; 1040 port_stats.unicast_frames);
1034 esw_stats->broadcast_frames += port_stats.broadcast_frames; 1041 QLCNIC_ADD_ESW_STATS(esw_stats->multicast_frames,
1035 esw_stats->dropped_frames += port_stats.dropped_frames; 1042 port_stats.multicast_frames);
1036 esw_stats->errors += port_stats.errors; 1043 QLCNIC_ADD_ESW_STATS(esw_stats->broadcast_frames,
1037 esw_stats->local_frames += port_stats.local_frames; 1044 port_stats.broadcast_frames);
1038 esw_stats->numbytes += port_stats.numbytes; 1045 QLCNIC_ADD_ESW_STATS(esw_stats->dropped_frames,
1039 1046 port_stats.dropped_frames);
1047 QLCNIC_ADD_ESW_STATS(esw_stats->errors,
1048 port_stats.errors);
1049 QLCNIC_ADD_ESW_STATS(esw_stats->local_frames,
1050 port_stats.local_frames);
1051 QLCNIC_ADD_ESW_STATS(esw_stats->numbytes,
1052 port_stats.numbytes);
1040 ret = 0; 1053 ret = 0;
1041 } 1054 }
1042 return ret; 1055 return ret;