public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: Catherine Sullivan <csully@google•com>
Cc: netdev@vger•kernel.org, Sagi Shahar <sagis@google•com>,
	Jon Olson <jonolson@google•com>,
	Willem de Bruijn <willemb@google•com>,
	Luigi Rizzo <lrizzo@google•com>
Subject: Re: [PATCH net-next v2 4/4] gve: Add ethtool support
Date: Fri, 28 Jun 2019 11:10:52 -0700	[thread overview]
Message-ID: <20190628111052.26b7c0e2@hermes.lan> (raw)
In-Reply-To: <20190628175633.143501-5-csully@google.com>

On Fri, 28 Jun 2019 10:56:33 -0700
Catherine Sullivan <csully@google•com> wrote:

> +static void
> +gve_get_ethtool_stats(struct net_device *netdev,
> +		      struct ethtool_stats *stats, u64 *data)
> +{
> +	struct gve_priv *priv = netdev_priv(netdev);
> +	u64 rx_pkts, rx_bytes, tx_pkts, tx_bytes;
> +	int ring;
> +	int i;
> +
> +	ASSERT_RTNL();
> +
> +	for (rx_pkts = 0, rx_bytes = 0, ring = 0;
> +	     ring < priv->rx_cfg.num_queues; ring++) {
> +		if (priv->rx) {
> +			rx_pkts += priv->rx[ring].rpackets;
> +			rx_bytes += priv->rx[ring].rbytes;
> +		}
> +	}
> +	for (tx_pkts = 0, tx_bytes = 0, ring = 0;
> +	     ring < priv->tx_cfg.num_queues; ring++) {
> +		if (priv->tx) {
> +			tx_pkts += priv->tx[ring].pkt_done;
> +			tx_bytes += priv->tx[ring].bytes_done;
> +		}
> +	}
> +	memset(data, 0, GVE_MAIN_STATS_LEN * sizeof(*data));

memset here is unnecessary since ethtool_get_stats allocates
and zeros the memory already.

  reply	other threads:[~2019-06-28 18:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 17:56 [PATCH net-next v2 0/4] Add gve driver Catherine Sullivan
2019-06-28 17:56 ` [PATCH net-next v2 1/4] gve: Add basic driver framework for Compute Engine Virtual NIC Catherine Sullivan
2019-06-29 15:07   ` kbuild test robot
2019-06-28 17:56 ` [PATCH net-next v2 2/4] gve: Add transmit and receive support Catherine Sullivan
2019-06-29 13:54   ` kbuild test robot
2019-06-29 17:00   ` kbuild test robot
2019-06-28 17:56 ` [PATCH net-next v2 3/4] gve: Add workqueue and reset support Catherine Sullivan
2019-06-28 17:56 ` [PATCH net-next v2 4/4] gve: Add ethtool support Catherine Sullivan
2019-06-28 18:10   ` Stephen Hemminger [this message]
2019-06-28 23:05     ` Catherine Sullivan

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=20190628111052.26b7c0e2@hermes.lan \
    --to=stephen@networkplumber$(echo .)org \
    --cc=csully@google$(echo .)com \
    --cc=jonolson@google$(echo .)com \
    --cc=lrizzo@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sagis@google$(echo .)com \
    --cc=willemb@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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