[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH_-1qz3cKSMbNYUZwa=tEM1=5QSF86GrSgDwbpu9-qoMwHXww@mail.gmail.com>
Date: Fri, 28 Jun 2019 16:05:33 -0700
From: Catherine Sullivan <csully@...gle.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, Sagi Shahar <sagis@...gle.com>,
Jon Olson <jonolson@...gle.com>,
Willem de Bruijn <willemb@...gle.com>,
Luigi Rizzo <lrizzo@...gle.com>
Subject: Re: [PATCH net-next v2 4/4] gve: Add ethtool support
On Fri, Jun 28, 2019 at 11:11 AM Stephen Hemminger
<stephen@...workplumber.org> wrote:
>
> On Fri, 28 Jun 2019 10:56:33 -0700
> Catherine Sullivan <csully@...gle.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.
Ah, thanks, removed in v3.
Powered by blists - more mailing lists