diff mbox

[PATCHv2,NEXT,2/8] qlcnic: fix eswitch stats

Message ID 1286205297-23214-2-git-send-email-amit.salecha@qlogic.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

amit salecha Oct. 4, 2010, 3:14 p.m. UTC
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>
---
 drivers/net/qlcnic/qlcnic.h     |   12 ++++++++++++
 drivers/net/qlcnic/qlcnic_ctx.c |   31 ++++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 9 deletions(-)

Comments

David Miller April 11, 2011, 10:55 p.m. UTC | #1
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon,  4 Oct 2010 08:14:51 -0700

> 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>

Why are patches being posted from back in October 4, 2010?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger April 11, 2011, 11:09 p.m. UTC | #2
On Mon,  4 Oct 2010 08:14:51 -0700
Amit Kumar Salecha <amit.salecha@qlogic.com> wrote:

> +
> +#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)

Fugly macro. Make it an inline function?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
amit salecha April 12, 2011, 4:48 a.m. UTC | #3
> From: Amit Kumar Salecha <amit.salecha@qlogic.com>
> Date: Mon,  4 Oct 2010 08:14:51 -0700
>
> > 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>
>
> Why are patches being posted from back in October 4, 2010?

My mail server is spamming mail, please ignore all below emails:

[PATCH NEXT 1/2] netxen: Notify firmware of Flex-10 interface down
[PATCHv2 NEXT 3/8] qlcnic: fix diag register
[PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit
[PATCH NEXT 0/2]nexten: bug fixes
[PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
[PATCH NEXT 2/2] netxen: support for GbE port settings
[PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
[PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting
[PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine

Sorry for inconvenience caused to all.

-Amit

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 714ddf4..4667463 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -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;
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 95a821e..a4c4d09 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,
 	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++) {
@@ -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;