netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@tilera.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: [PATCH 07/13] tile: update dev->stats directly in tilegx network driver
Date: Tue, 23 Jul 2013 16:05:48 -0400	[thread overview]
Message-ID: <07b5385c3cb11e0d9550a6afa0a2a8ba57d6ad2e.1374609949.git.cmetcalf@tilera.com> (raw)
In-Reply-To: <cover.1374609948.git.cmetcalf@tilera.com>

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
---
 drivers/net/ethernet/tile/tilegx.c | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 8d1f748..a245858 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -178,8 +178,6 @@ struct tile_net_priv {
 	int loopify_channel;
 	/* The egress channel (channel or loopify_channel). */
 	int echannel;
-	/* Total stats. */
-	struct net_device_stats stats;
 };
 
 /* Egress info, indexed by "priv->echannel" (lazily created as needed). */
@@ -447,7 +445,6 @@ static void tile_net_receive_skb(struct net_device *dev, struct sk_buff *skb,
 				 gxio_mpipe_idesc_t *idesc, unsigned long len)
 {
 	struct tile_net_info *info = &__get_cpu_var(per_cpu_info);
-	struct tile_net_priv *priv = netdev_priv(dev);
 
 	/* Encode the actual packet length. */
 	skb_put(skb, len);
@@ -464,8 +461,8 @@ static void tile_net_receive_skb(struct net_device *dev, struct sk_buff *skb,
 	netif_receive_skb(skb);
 
 	/* Update stats. */
-	tile_net_stats_add(1, &priv->stats.rx_packets);
-	tile_net_stats_add(len, &priv->stats.rx_bytes);
+	tile_net_stats_add(1, &dev->stats.rx_packets);
+	tile_net_stats_add(len, &dev->stats.rx_bytes);
 
 	/* Need a new buffer. */
 	if (idesc->size == buffer_size_enums[0])
@@ -481,7 +478,6 @@ static bool tile_net_handle_packet(gxio_mpipe_idesc_t *idesc)
 {
 	struct tile_net_info *info = &__get_cpu_var(per_cpu_info);
 	struct net_device *dev = tile_net_devs_for_channel[idesc->channel];
-	struct tile_net_priv *priv = netdev_priv(dev);
 	uint8_t l2_offset;
 	void *va;
 	void *buf;
@@ -495,7 +491,7 @@ static bool tile_net_handle_packet(gxio_mpipe_idesc_t *idesc)
 	 */
 	if (idesc->be || idesc->me || idesc->tr || idesc->ce) {
 		if (dev)
-			tile_net_stats_add(1, &priv->stats.rx_errors);
+			tile_net_stats_add(1, &dev->stats.rx_errors);
 		goto drop;
 	}
 
@@ -515,7 +511,7 @@ static bool tile_net_handle_packet(gxio_mpipe_idesc_t *idesc)
 	filter = filter_packet(dev, buf);
 	if (filter) {
 		if (dev)
-			tile_net_stats_add(1, &priv->stats.rx_dropped);
+			tile_net_stats_add(1, &dev->stats.rx_dropped);
 	drop:
 		gxio_mpipe_iqueue_drop(&info->mpipe[instance].iqueue, idesc);
 	} else {
@@ -1549,7 +1545,6 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
 static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue,
 		       struct sk_buff *skb, unsigned char *headers, s64 slot)
 {
-	struct tile_net_priv *priv = netdev_priv(dev);
 	struct skb_shared_info *sh = skb_shinfo(skb);
 	unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
 	unsigned int data_len = skb->len - sh_len;
@@ -1627,8 +1622,8 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue,
 	}
 
 	/* Update stats. */
-	tile_net_stats_add(tx_packets, &priv->stats.tx_packets);
-	tile_net_stats_add(tx_bytes, &priv->stats.tx_bytes);
+	tile_net_stats_add(tx_packets, &dev->stats.tx_packets);
+	tile_net_stats_add(tx_bytes, &dev->stats.tx_bytes);
 }
 
 /* Do "TSO" handling for egress.
@@ -1774,9 +1769,9 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
 	add_comp(equeue, comps, slot - 1, skb);
 
 	/* NOTE: Use ETH_ZLEN for short packets (e.g. 42 < 60). */
-	tile_net_stats_add(1, &priv->stats.tx_packets);
+	tile_net_stats_add(1, &dev->stats.tx_packets);
 	tile_net_stats_add(max_t(unsigned int, len, ETH_ZLEN),
-			   &priv->stats.tx_bytes);
+			   &dev->stats.tx_bytes);
 
 	local_irq_restore(irqflags);
 
@@ -1813,13 +1808,6 @@ static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return -EOPNOTSUPP;
 }
 
-/* Get system network statistics for device. */
-static struct net_device_stats *tile_net_get_stats(struct net_device *dev)
-{
-	struct tile_net_priv *priv = netdev_priv(dev);
-	return &priv->stats;
-}
-
 /* Change the MTU. */
 static int tile_net_change_mtu(struct net_device *dev, int new_mtu)
 {
@@ -1869,7 +1857,6 @@ static const struct net_device_ops tile_net_ops = {
 	.ndo_start_xmit = tile_net_tx,
 	.ndo_select_queue = tile_net_select_queue,
 	.ndo_do_ioctl = tile_net_ioctl,
-	.ndo_get_stats = tile_net_get_stats,
 	.ndo_change_mtu = tile_net_change_mtu,
 	.ndo_tx_timeout = tile_net_tx_timeout,
 	.ndo_set_mac_address = tile_net_set_mac_address,
-- 
1.8.3.1

  parent reply	other threads:[~2013-07-23 20:05 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 20:05 [PATCH 00/13] update tile network drivers Chris Metcalf
2013-07-23 20:05 ` [PATCH 04/13] tile: remove dead is_dup_ack() function from tilepro net driver Chris Metcalf
2013-07-23 20:05 ` [PATCH 03/13] tile: avoid bug in tilepro net driver built with old hypervisor Chris Metcalf
2013-07-23 20:05 ` [PATCH 11/13] tile: support TSO for IPv6 in tilegx network driver Chris Metcalf
2013-07-23 20:05 ` [PATCH 02/13] tile: support rx_dropped/rx_errors in tilepro net driver Chris Metcalf
2013-07-23 20:05 ` [PATCH 08/13] tile: fix panic bug in napi support for tilegx network driver Chris Metcalf
2013-07-23 20:05 ` [PATCH 01/13] tile: handle 64-bit statistics in tilepro " Chris Metcalf
2013-07-24  9:31   ` David Miller
2013-07-25 16:41   ` [PATCH v2] " Chris Metcalf
2013-07-30 23:16     ` David Miller
2013-07-31  0:34       ` Chris Metcalf
2013-07-31  0:36         ` David Miller
2013-07-23 20:05 ` Chris Metcalf [this message]
2013-07-23 20:05 ` [PATCH 05/13] tile: support PTP using the tilegx mPIPE (IEEE 1588) Chris Metcalf
2013-07-24  6:25   ` Richard Cochran
2013-07-24  6:29   ` Richard Cochran
2013-07-24 16:17     ` Chris Metcalf
2013-07-25 15:19   ` [PATCH v2] " Chris Metcalf
2013-07-25 17:55     ` Richard Cochran
2013-07-23 20:05 ` [PATCH 09/13] tile: enable GRO in the tilegx network driver Chris Metcalf
2013-07-23 21:19   ` Eric Dumazet
2013-07-23 22:26     ` Chris Metcalf
2013-07-23 20:05 ` [PATCH 12/13] tile: make "tile_net.custom" a proper bool module parameter Chris Metcalf
2013-07-23 20:05 ` [PATCH 10/13] tile: support multiple mPIPE shims in tilegx network driver Chris Metcalf
2013-07-23 20:05 ` [PATCH 13/13] tile: remove deprecated NETIF_F_LLTX flag from tile drivers Chris Metcalf
2013-07-23 20:05 ` [PATCH 06/13] tile: support jumbo frames in the tilegx network driver Chris Metcalf
2013-07-31 15:05 ` [PATCH v2 00/12] update tile network drivers Chris Metcalf
2013-07-31 15:05   ` [PATCH 03/12] tile: remove dead is_dup_ack() function from tilepro net driver Chris Metcalf
2013-07-31 15:05   ` [PATCH 04/12] tile: support jumbo frames in the tilegx network driver Chris Metcalf
2013-07-31 15:05   ` [PATCH 06/12] tile: fix panic bug in napi support for " Chris Metcalf
2013-07-31 15:05   ` [PATCH 01/12] tile: support rx_dropped/rx_errors in tilepro net driver Chris Metcalf
2013-07-31 15:05   ` [PATCH 11/12] tile: remove deprecated NETIF_F_LLTX flag from tile drivers Chris Metcalf
2013-07-31 15:05   ` [PATCH 12/12] tile: support PTP using the tilegx mPIPE (IEEE 1588) Chris Metcalf
2013-07-31 15:05   ` [PATCH 10/12] tile: make "tile_net.custom" a proper bool module parameter Chris Metcalf
2013-07-31 15:05   ` [PATCH 07/12] tile: enable GRO in the tilegx network driver Chris Metcalf
2013-07-31 15:05   ` [PATCH 09/12] tile: support TSO for IPv6 in " Chris Metcalf
2013-07-31 19:25     ` David Miller
2013-08-01 15:36       ` [PATCH v2 13/12] tile: set hw_features and vlan_features in setup Chris Metcalf
2013-08-01 18:31         ` David Miller
2013-08-01 19:25         ` [PATCH v3 00/13] update tile network drivers Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 02/13] tile: support rx_dropped/rx_errors in tilepro net driver Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 06/13] tile: update dev->stats directly in tilegx network driver Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 08/13] tile: enable GRO in the " Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 09/13] tile: support multiple mPIPE shims in " Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 05/13] tile: support jumbo frames in the " Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 04/13] tile: remove dead is_dup_ack() function from tilepro net driver Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 03/13] tile: avoid bug in tilepro net driver built with old hypervisor Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 13/13] tile: support PTP using the tilegx mPIPE (IEEE 1588) Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 10/13] tile: support TSO for IPv6 in tilegx network driver Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 12/13] tile: remove deprecated NETIF_F_LLTX flag from tile drivers Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 01/13] tile: set hw_features and vlan_features in setup Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 07/13] tile: fix panic bug in napi support for tilegx network driver Chris Metcalf
2013-08-01 15:36           ` [PATCH v3 11/13] tile: make "tile_net.custom" a proper bool module parameter Chris Metcalf
2013-08-01 21:42           ` [PATCH v3 00/13] update tile network drivers David Miller
2013-07-31 15:05   ` [PATCH 08/12] tile: support multiple mPIPE shims in tilegx network driver Chris Metcalf
2013-07-31 15:05   ` [PATCH 02/12] tile: avoid bug in tilepro net driver built with old hypervisor Chris Metcalf
2013-07-31 15:05   ` [PATCH 05/12] tile: update dev->stats directly in tilegx network driver Chris Metcalf

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=07b5385c3cb11e0d9550a6afa0a2a8ba57d6ad2e.1374609949.git.cmetcalf@tilera.com \
    --to=cmetcalf@tilera.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).