diff mbox

[net,v4,1/6] bnx2x: properly initialize statistic counters

Message ID 1375738544-8695-2-git-send-email-dmitry@broadcom.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Dmitry Kravkov Aug. 5, 2013, 9:35 p.m. UTC
This prevent second statistics query be sent before first one is complete.
This is required since two outstanding queries may cause FW assert.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Benjamin Poirier Aug. 12, 2013, 8:08 p.m. UTC | #1
On 2013/08/06 00:35, Dmitry Kravkov wrote:
> This prevent second statistics query be sent before first one is complete.
> This is required since two outstanding queries may cause FW assert.
> 
> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
> Signed-off-by: Ariel Elior <ariele@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> index 98366ab..a22ad61 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> @@ -1589,12 +1589,17 @@ void bnx2x_memset_stats(struct bnx2x *bp)
>  
>  void bnx2x_stats_init(struct bnx2x *bp)
>  {
> -	int /*abs*/port = BP_PORT(bp);
> +	struct stats_counter *counters = &bp->fw_stats_data->storm_counters;
>  	int mb_idx = BP_FW_MB_IDX(bp);
> +	int port = BP_PORT(bp);
>  
>  	bp->stats_pending = 0;
>  	bp->executer_idx = 0;
>  	bp->stats_counter = 0;
> +	counters->xstats_counter = cpu_to_le16(0xFFFF);
> +	counters->tstats_counter = cpu_to_le16(0xFFFF);
> +	counters->ustats_counter = cpu_to_le16(0xFFFF);
> +	counters->cstats_counter = cpu_to_le16(0xFFFF);

I think the following code executed a little later becomes redundant:

static void bnx2x_prep_fw_stats_req(struct bnx2x *bp)
{
[...]
	/* prepare to the first stats ramrod (will be completed with
	 * the counters equal to zero) - init counters to somethig different.
	 */
	memset(&bp->fw_stats_data->storm_counters, 0xff,
	       sizeof(struct stats_counter));
--
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
Dmitry Kravkov Aug. 12, 2013, 10:48 p.m. UTC | #2
> -----Original Message-----
> From: Benjamin Poirier [mailto:benjamin.poirier@gmail.com]
> Sent: Monday, August 12, 2013 11:08 PM
> To: Dmitry Kravkov
> Cc: davem@davemloft.net; netdev@vger.kernel.org; Eilon Greenstein;
> Ariel Elior
> Subject: Re: [PATCH net v4 1/6] bnx2x: properly initialize statistic counters
> 
> On 2013/08/06 00:35, Dmitry Kravkov wrote:
> > This prevent second statistics query be sent before first one is complete.
> > This is required since two outstanding queries may cause FW assert.
> >
> > Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
> > Signed-off-by: Ariel Elior <ariele@broadcom.com>
> > Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
> > ---
> >  drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> > b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> > index 98366ab..a22ad61 100644
> > --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> > +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
> > @@ -1589,12 +1589,17 @@ void bnx2x_memset_stats(struct bnx2x *bp)
> >
> >  void bnx2x_stats_init(struct bnx2x *bp)  {
> > -	int /*abs*/port = BP_PORT(bp);
> > +	struct stats_counter *counters = &bp->fw_stats_data-
> >storm_counters;
> >  	int mb_idx = BP_FW_MB_IDX(bp);
> > +	int port = BP_PORT(bp);
> >
> >  	bp->stats_pending = 0;
> >  	bp->executer_idx = 0;
> >  	bp->stats_counter = 0;
> > +	counters->xstats_counter = cpu_to_le16(0xFFFF);
> > +	counters->tstats_counter = cpu_to_le16(0xFFFF);
> > +	counters->ustats_counter = cpu_to_le16(0xFFFF);
> > +	counters->cstats_counter = cpu_to_le16(0xFFFF);
> 
> I think the following code executed a little later becomes redundant:
> 
> static void bnx2x_prep_fw_stats_req(struct bnx2x *bp) { [...]
> 	/* prepare to the first stats ramrod (will be completed with
> 	 * the counters equal to zero) - init counters to somethig different.
> 	 */
> 	memset(&bp->fw_stats_data->storm_counters, 0xff,
> 	       sizeof(struct stats_counter));

You absolutely right. Thanks!


--
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/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index 98366ab..a22ad61 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1589,12 +1589,17 @@  void bnx2x_memset_stats(struct bnx2x *bp)
 
 void bnx2x_stats_init(struct bnx2x *bp)
 {
-	int /*abs*/port = BP_PORT(bp);
+	struct stats_counter *counters = &bp->fw_stats_data->storm_counters;
 	int mb_idx = BP_FW_MB_IDX(bp);
+	int port = BP_PORT(bp);
 
 	bp->stats_pending = 0;
 	bp->executer_idx = 0;
 	bp->stats_counter = 0;
+	counters->xstats_counter = cpu_to_le16(0xFFFF);
+	counters->tstats_counter = cpu_to_le16(0xFFFF);
+	counters->ustats_counter = cpu_to_le16(0xFFFF);
+	counters->cstats_counter = cpu_to_le16(0xFFFF);
 
 	/* port and func stats for management */
 	if (!BP_NOMCP(bp)) {