linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [patch 02/30] uml: convert network device to internal network device stats
       [not found] <20090327011114.169107105@linux-foundation.org>
@ 2009-03-27  1:11 ` Stephen Hemminger
  2009-03-27  7:50   ` David Miller
  2009-03-27  1:11 ` [uml-devel] [patch 03/30] uml: convert network device to netdevice ops Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2009-03-27  1:11 UTC (permalink / raw)
  To: David Miller, jdike; +Cc: netdev, user-mode-linux-devel

[-- Attachment #1: uml-netstats.patch --]
[-- Type: text/plain, Size: 2641 bytes --]

Convert the UML network device to use internal network device stats.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/arch/um/drivers/net_kern.c	2009-03-21 12:36:49.000000000 -0700
+++ b/arch/um/drivers/net_kern.c	2009-03-26 17:04:05.123352757 -0700
@@ -86,7 +86,7 @@ static int uml_net_rx(struct net_device 
 		drop_skb->dev = dev;
 		/* Read a packet into drop_skb and don't do anything with it. */
 		(*lp->read)(lp->fd, drop_skb, lp);
-		lp->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return 0;
 	}
 
@@ -99,8 +99,8 @@ static int uml_net_rx(struct net_device 
 		skb_trim(skb, pkt_len);
 		skb->protocol = (*lp->protocol)(skb);
 
-		lp->stats.rx_bytes += skb->len;
-		lp->stats.rx_packets++;
+		dev->stats.rx_bytes += skb->len;
+		dev->stats.rx_packets++;
 		netif_rx(skb);
 		return pkt_len;
 	}
@@ -224,8 +224,8 @@ static int uml_net_start_xmit(struct sk_
 	len = (*lp->write)(lp->fd, skb, lp);
 
 	if (len == skb->len) {
-		lp->stats.tx_packets++;
-		lp->stats.tx_bytes += skb->len;
+		dev->stats.tx_packets++;
+		dev->stats.tx_bytes += skb->len;
 		dev->trans_start = jiffies;
 		netif_start_queue(dev);
 
@@ -234,7 +234,7 @@ static int uml_net_start_xmit(struct sk_
 	}
 	else if (len == 0) {
 		netif_start_queue(dev);
-		lp->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 	}
 	else {
 		netif_start_queue(dev);
@@ -248,12 +248,6 @@ static int uml_net_start_xmit(struct sk_
 	return 0;
 }
 
-static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
-{
-	struct uml_net_private *lp = netdev_priv(dev);
-	return &lp->stats;
-}
-
 static void uml_net_set_multicast_list(struct net_device *dev)
 {
 	return;
@@ -476,7 +470,6 @@ static void eth_configure(int n, void *i
 	dev->open = uml_net_open;
 	dev->hard_start_xmit = uml_net_start_xmit;
 	dev->stop = uml_net_close;
-	dev->get_stats = uml_net_get_stats;
 	dev->set_multicast_list = uml_net_set_multicast_list;
 	dev->tx_timeout = uml_net_tx_timeout;
 	dev->set_mac_address = uml_net_set_mac;
--- a/arch/um/include/shared/net_kern.h	2009-03-21 12:36:49.000000000 -0700
+++ b/arch/um/include/shared/net_kern.h	2009-03-22 21:13:26.136674285 -0700
@@ -26,7 +26,7 @@ struct uml_net_private {
 	spinlock_t lock;
 	struct net_device *dev;
 	struct timer_list tl;
-	struct net_device_stats stats;
+
 	struct work_struct work;
 	int fd;
 	unsigned char mac[ETH_ALEN];



------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [uml-devel] [patch 03/30] uml: convert network device to netdevice ops
       [not found] <20090327011114.169107105@linux-foundation.org>
  2009-03-27  1:11 ` [uml-devel] [patch 02/30] uml: convert network device to internal network device stats Stephen Hemminger
@ 2009-03-27  1:11 ` Stephen Hemminger
  2009-03-27  7:50   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2009-03-27  1:11 UTC (permalink / raw)
  To: David Miller, jdike; +Cc: netdev, user-mode-linux-devel

[-- Attachment #1: uml-netdev.patch --]
[-- Type: text/plain, Size: 1660 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/arch/um/drivers/net_kern.c	2009-03-22 21:11:51.000000000 -0700
+++ b/arch/um/drivers/net_kern.c	2009-03-22 21:17:17.920674346 -0700
@@ -371,6 +371,18 @@ static void net_device_release(struct de
 	free_netdev(netdev);
 }
 
+static const struct net_device_ops uml_netdev_ops = {
+	.ndo_open 		= uml_net_open,
+	.ndo_stop 		= uml_net_close,
+	.ndo_start_xmit 	= uml_net_start_xmit,
+	.ndo_set_multicast_list = uml_net_set_multicast_list,
+	.ndo_tx_timeout 	= uml_net_tx_timeout,
+	.ndo_set_mac_address	= uml_net_set_mac,
+	.ndo_change_mtu 	= uml_net_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 /*
  * Ensures that platform_driver_register is called only once by
  * eth_configure.  Will be set in an initcall.
@@ -467,13 +479,7 @@ static void eth_configure(int n, void *i
 
 	set_ether_mac(dev, device->mac);
 	dev->mtu = transport->user->mtu;
-	dev->open = uml_net_open;
-	dev->hard_start_xmit = uml_net_start_xmit;
-	dev->stop = uml_net_close;
-	dev->set_multicast_list = uml_net_set_multicast_list;
-	dev->tx_timeout = uml_net_tx_timeout;
-	dev->set_mac_address = uml_net_set_mac;
-	dev->change_mtu = uml_net_change_mtu;
+	dev->netdev_ops = &uml_netdev_ops;
 	dev->ethtool_ops = &uml_net_ethtool_ops;
 	dev->watchdog_timeo = (HZ >> 1);
 	dev->irq = UM_ETH_IRQ;



------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [uml-devel] [patch 02/30] uml: convert network device to internal network device stats
  2009-03-27  1:11 ` [uml-devel] [patch 02/30] uml: convert network device to internal network device stats Stephen Hemminger
@ 2009-03-27  7:50   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-03-27  7:50 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, jdike, user-mode-linux-devel

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Thu, 26 Mar 2009 18:11:16 -0700

> Convert the UML network device to use internal network device stats.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [uml-devel] [patch 03/30] uml: convert network device to netdevice ops
  2009-03-27  1:11 ` [uml-devel] [patch 03/30] uml: convert network device to netdevice ops Stephen Hemminger
@ 2009-03-27  7:50   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-03-27  7:50 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, jdike, user-mode-linux-devel

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Thu, 26 Mar 2009 18:11:17 -0700

> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-27  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090327011114.169107105@linux-foundation.org>
2009-03-27  1:11 ` [uml-devel] [patch 02/30] uml: convert network device to internal network device stats Stephen Hemminger
2009-03-27  7:50   ` David Miller
2009-03-27  1:11 ` [uml-devel] [patch 03/30] uml: convert network device to netdevice ops Stephen Hemminger
2009-03-27  7:50   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox