netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: leitao@linux.vnet.ibm.com
Cc: netdev@vger.kernel.org, mchan@broadcom.com
Subject: Re: [PATCH] bnx2: avoid flushing statistics when doing a MTU change
Date: Mon, 30 Nov 2009 11:30:42 +0100	[thread overview]
Message-ID: <4B139ED2.2060500@gmail.com> (raw)
In-Reply-To: <1259341163-12775-1-git-send-email-leitao@linux.vnet.ibm.com>

leitao@linux.vnet.ibm.com a écrit :
> Actually when bnx2 changes the interface's MTU size, it resets
> the chip and consequently flushes the interface statistics.
> This patch saves the statistics in a temporary space in order to
> maintain the statistics correct after the chip reset.
> 
> Signed-off-by: Breno Leitao<leitao@linux.vnet.ibm.com>


  
>  	return net_stats;
>  }
> @@ -6989,6 +7004,11 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
>  {
>  	if (netif_running(bp->dev)) {
>  		bnx2_netif_stop(bp);

I wonder if you need to renew this stats before copying them ?
 (eg calling bnx2_get_stats())


> +
> +		/* Save statistics that is going to be reseted */
> +		memcpy(bp->stats_extra, &bp->dev->stats,
> +			sizeof(struct net_device_stats));
> +
>  		bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET);
>  		bnx2_free_skbs(bp);
>  		bnx2_free_mem(bp);
> @@ -7649,6 +7669,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
>  
>  	bp->flags = 0;
>  	bp->phy_flags = 0;
> +	bp->stats_extra = kzalloc(sizeof(struct net_device_stats), GFP_KERNEL);

There is no test of failed allocation.

>  
>  	/* enable device (incl. PCI PM wakeup), and bus-mastering */
>  	rc = pci_enable_device(pdev);
> @@ -8162,6 +8183,7 @@ bnx2_remove_one(struct pci_dev *pdev)
>  	if (bp->regview)
>  		iounmap(bp->regview);
>  
> +	kfree(bp->stats_extra);
>  	free_netdev(dev);
>  	pci_release_regions(pdev);
>  	pci_disable_device(pdev);

Structure is small anyway, why not including it in struct bnx2 ?

  parent reply	other threads:[~2009-11-30 10:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27 16:59 [PATCH] bnx2: avoid flushing statistics when doing a MTU change leitao
2009-11-30  9:20 ` Michael Chan
2009-11-30 10:30 ` Eric Dumazet [this message]
2009-11-30 10:43   ` Michael Chan
2009-11-30 10:49     ` Eric Dumazet
2009-11-30 11:02       ` Michael Chan
2009-11-30 13:17     ` Breno Leitao
2009-11-30 13:32       ` Eric Dumazet
2009-11-30 14:05         ` Breno Leitao
2009-11-30 18:09           ` Michael Chan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B139ED2.2060500@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=leitao@linux.vnet.ibm.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).