Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] cpmac: do not leak struct net_device on phy_connect errors
From: Florian Fainelli @ 2010-06-27 17:05 UTC (permalink / raw)
  To: netdev; +Cc: David Miller
In-Reply-To: <201006211007.49039.florian@openwrt.org>

Hi David,

Forgot to mention that this is relevant for -stable and current net-next-2.6. Thanks!

Le Monday 21 June 2010 10:07:48,  Fainelli a écrit :
> If the call to phy_connect fails, we will return directly instead of
> freeing the previously allocated struct net_device.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> CC: stable@kernel.org
> ---
> diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
> index 3c58db5..23786ee 100644
> --- a/drivers/net/cpmac.c
> +++ b/drivers/net/cpmac.c
> @@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct
> platform_device *pdev) if (netif_msg_drv(priv))
>  			printk(KERN_ERR "%s: Could not attach to PHY\n",
>  			       dev->name);
> -		return PTR_ERR(priv->phy);
> +		rc = PTR_ERR(priv->phy);
> +		goto fail;
>  	}
> 
>  	if ((rc = register_netdev(dev))) {


^ permalink raw reply

* [PATCH RFC] vhost-net: add dhclient work-around from userspace
From: Michael S. Tsirkin @ 2010-06-27 15:46 UTC (permalink / raw)
  To: Sridhar Samudrala, David S. Miller, Arnd Bergmann,
	Paul E. McKenney, kvm
In-Reply-To: <20100626.200320.43025947.davem@davemloft.net>

Userspace virtio server has the following hack
so guests rely on it, and we have to replicate it, too:

use source port to detect incoming IPv4 DHCP response packets,
and fill in the checksum for these.

The issue we are solving is that on linux guests, some apps
that use recvmsg with AF_PACKET sockets, don't know how to
handle CHECKSUM_PARTIAL;
The interface to return the relevant information was added
in 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
and older userspace does not use it.
One important user of recvmsg with AF_PACKET is dhclient,
so we add a work-around just for DHCP.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

So here's what I came up with: I basically copied
the work-around from userspace virtio.
As suggested by Dave (assuming I understood the suggestion
correctly) this implements the workaround in vhost-net, so
other tun users don't start relying on it.
Untested.

 drivers/vhost/net.c |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 54096ee..9ed4051 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -25,6 +25,10 @@
 #include <linux/if_tun.h>
 #include <linux/if_macvlan.h>
 
+#include <linux/ip.h>
+#include <linux/udp.h>
+#include <linux/netdevice.h>
+
 #include <net/sock.h>
 
 #include "vhost.h"
@@ -191,6 +195,42 @@ static void handle_tx(struct vhost_net *net)
 	unuse_mm(net->dev.mm);
 }
 
+static int peek_head(struct sock *sk)
+{
+	struct sk_buff *head;
+	int ret;
+
+	lock_sock(sk);
+	head = skb_peek(&sk->sk_receive_queue);
+	if (likely(head)) {
+		ret = 1;
+		/* Userspace virtio server has the following hack so
+		 * guests rely on it, and we have to replicate it, too: */
+		/* On linux guests, some apps that use recvmsg with AF_PACKET
+		 * sockets, don't know how to handle CHECKSUM_PARTIAL;
+		 * The interface to return the relevant information was added in
+		 * 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
+		 * and older userspace does not use it.
+		 * One important user of recvmsg with AF_PACKET is dhclient,
+		 * so we add a work-around just for DHCP. */
+		/* We use source port to detect DHCP packets. */
+		if (skb->ip_summed == CHECKSUM_PARTIAL &&
+		    skb->protocol == htons(ETH_P_IP) &&
+		    skb_network_header_len(skb) >= sizeof(struct iphdr) &&
+		    ip_hdr(skb)->protocol == IPPRODO_UDP &&
+		    skb_headlen(skb) >= skb_transport_offset(skb) + sizeof(struct udphdr) &&
+		    udp_hdr(skb)->source == htons(0x67)) {
+			skb_checksum_help(skb);
+			/* Restore ip_summed value: tun passes it to user. */
+			skb->ip_summed = CHECKSUM_PARTIAL;
+		}
+	} else {
+		ret = 0;
+	}
+	release_sock(sk);
+	return len;
+}
+
 /* Expects to be always run from workqueue - which acts as
  * read-size critical section for our kind of RCU. */
 static void handle_rx(struct vhost_net *net)
@@ -228,7 +268,7 @@ static void handle_rx(struct vhost_net *net)
 	vq_log = unlikely(vhost_has_feature(&net->dev, VHOST_F_LOG_ALL)) ?
 		vq->log : NULL;
 
-	for (;;) {
+	while (peek_head(sock)) {
 		head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
 					 ARRAY_SIZE(vq->iov),
 					 &out, &in,
-- 
1.7.1.12.g42b7f

^ permalink raw reply related

* [PATCH 4/4] netdevice.h: Change netif_<level> macros to call netdev_<level> functions
From: Joe Perches @ 2010-06-27 11:02 UTC (permalink / raw)
  To: Andrew Morton, David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <cover.1277636090.git.joe@perches.com>

Reduces text ~300 bytes of text (woohoo!) in an x86 defconfig

$ size vmlinux*
   text	   data	    bss	    dec	    hex	filename
7198526	 720112	1366288	9284926	 8dad3e	vmlinux
7198862	 720112	1366288	9285262	 8dae8e	vmlinux.netdev

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/netdevice.h |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7f3197d..489a612 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2291,20 +2291,26 @@ do {					  			\
 		netdev_printk(level, (dev), fmt, ##args);	\
 } while (0)
 
+#define netif_level(level, priv, type, dev, fmt, args...)	\
+do {								\
+	if (netif_msg_##type(priv))				\
+		netdev_##level(dev, fmt, ##args);		\
+} while (0)
+
 #define netif_emerg(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
+	netif_level(emerg, priv, type, dev, fmt, ##args)
 #define netif_alert(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
+	netif_level(alert, priv, type, dev, fmt, ##args)
 #define netif_crit(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
+	netif_level(crit, priv, type, dev, fmt, ##args)
 #define netif_err(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
+	netif_level(err, priv, type, dev, fmt, ##args)
 #define netif_warn(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
+	netif_level(warn, priv, type, dev, fmt, ##args)
 #define netif_notice(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
+	netif_level(notice, priv, type, dev, fmt, ##args)
 #define netif_info(priv, type, dev, fmt, args...)		\
-	netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
+	netif_level(info, priv, type, dev, fmt, ##args)
 
 #if defined(DEBUG)
 #define netif_dbg(priv, type, dev, format, args...)		\
-- 
1.7.1.337.g6068.dirty


^ permalink raw reply related

* [PATCH 0/4] Introduce and use printk pointer extension %pV
From: Joe Perches @ 2010-06-27 11:02 UTC (permalink / raw)
  To: Andrew Morton, David Miller; +Cc: linux-kernel, netdev

Recursive printk can reduce the total image size of an x86 defconfig about 1% 
by reducing duplicated KERN_<level> strings and centralizing the functions
used by macros in new separate functions.

Joe Perches (4):
  vsprintf: Recursive vsnprintf: Add "%pV", struct va_format
  device.h drivers/base/core.c Convert dev_<level> logging macros to functions
  netdevice.h net/core/dev.c: Convert netdev_<level> logging macros to functions
  netdevice.h: Change netif_<level> macros to call netdev_<level> functions

 drivers/base/core.c       |   64 +++++++++++++++++++++++++
 include/linux/device.h    |  112 ++++++++++++++++++++++++++++++++++----------
 include/linux/kernel.h    |    5 ++
 include/linux/netdevice.h |   56 ++++++++++++----------
 lib/vsprintf.c            |    9 ++++
 net/core/dev.c            |   62 +++++++++++++++++++++++++
 6 files changed, 256 insertions(+), 52 deletions(-)


^ permalink raw reply

* [PATCH 3/4] netdevice.h net/core/dev.c: Convert netdev_<level> logging macros to functions
From: Joe Perches @ 2010-06-27 11:02 UTC (permalink / raw)
  To: Andrew Morton, David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <cover.1277636090.git.joe@perches.com>

Reduces an x86 defconfig text and data ~2k.
text is smaller, data is larger.

$ size vmlinux*
   text	   data	    bss	    dec	    hex	filename
7198862	 720112	1366288	9285262	 8dae8e	vmlinux
7205273	 716016	1366288	9287577	 8db799	vmlinux.device_h

Uses %pV and struct va_format
Format arguments are verified before printk

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/netdevice.h |   36 ++++++++++++-------------
 net/core/dev.c            |   62 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 19 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 40291f3..7f3197d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2227,25 +2227,23 @@ static inline const char *netdev_name(const struct net_device *dev)
 	return dev->name;
 }
 
-#define netdev_printk(level, netdev, format, args...)		\
-	dev_printk(level, (netdev)->dev.parent,			\
-		   "%s: " format,				\
-		   netdev_name(netdev), ##args)
-
-#define netdev_emerg(dev, format, args...)			\
-	netdev_printk(KERN_EMERG, dev, format, ##args)
-#define netdev_alert(dev, format, args...)			\
-	netdev_printk(KERN_ALERT, dev, format, ##args)
-#define netdev_crit(dev, format, args...)			\
-	netdev_printk(KERN_CRIT, dev, format, ##args)
-#define netdev_err(dev, format, args...)			\
-	netdev_printk(KERN_ERR, dev, format, ##args)
-#define netdev_warn(dev, format, args...)			\
-	netdev_printk(KERN_WARNING, dev, format, ##args)
-#define netdev_notice(dev, format, args...)			\
-	netdev_printk(KERN_NOTICE, dev, format, ##args)
-#define netdev_info(dev, format, args...)			\
-	netdev_printk(KERN_INFO, dev, format, ##args)
+extern int netdev_printk(const char *level, const struct net_device *dev,
+			 const char *format, ...)
+	__attribute__ ((format (printf, 3, 4)));
+extern int netdev_emerg(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_alert(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_crit(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_err(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_warn(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_notice(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int netdev_info(const struct net_device *dev, const char *format, ...)
+	__attribute__ ((format (printf, 2, 3)));
 
 #if defined(DEBUG)
 #define netdev_dbg(__dev, format, args...)			\
diff --git a/net/core/dev.c b/net/core/dev.c
index 2b3bf53..6f6e1f4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5790,6 +5790,68 @@ char *netdev_drivername(const struct net_device *dev, char *buffer, int len)
 	return buffer;
 }
 
+static int __netdev_printk(const char *level, const struct net_device *dev,
+			   struct va_format *vaf)
+{
+	int r;
+
+	if (dev && dev->dev.parent)
+		r = dev_printk(level, dev->dev.parent, "%s: %pV",
+			       netdev_name(dev), vaf);
+	else if (dev)
+		r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
+	else
+		r = printk("%s(NULL net_device): %pV", level, vaf);
+
+	return r;
+}
+
+int netdev_printk(const char *level, const struct net_device *dev,
+		  const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	int r;
+
+	va_start(args, format);
+
+	vaf.fmt = format;
+	vaf.va = &args;
+
+	r = __netdev_printk(level, dev, &vaf);
+	va_end(args);
+
+	return r;
+}
+EXPORT_SYMBOL(netdev_printk);
+
+#define define_netdev_printk_level(func, level)			\
+int func(const struct net_device *dev, const char *fmt, ...)	\
+{								\
+	int r;							\
+	struct va_format vaf;					\
+	va_list args;						\
+								\
+	va_start(args, fmt);					\
+								\
+	vaf.fmt = fmt;						\
+	vaf.va = &args;						\
+								\
+	r = __netdev_printk(level, dev, &vaf);			\
+	va_end(args);						\
+								\
+	return r;						\
+}								\
+EXPORT_SYMBOL(func);
+
+define_netdev_printk_level(netdev_emerg, KERN_EMERG);
+define_netdev_printk_level(netdev_alert, KERN_ALERT);
+define_netdev_printk_level(netdev_crit, KERN_CRIT);
+define_netdev_printk_level(netdev_err, KERN_ERR);
+define_netdev_printk_level(netdev_warn, KERN_WARNING);
+define_netdev_printk_level(netdev_notice, KERN_NOTICE);
+define_netdev_printk_level(netdev_info, KERN_INFO);
+
 static void __net_exit netdev_exit(struct net *net)
 {
 	kfree(net->dev_name_head);
-- 
1.7.1.337.g6068.dirty

^ permalink raw reply related

* [PATCH 2/4] device.h drivers/base/core.c Convert dev_<level> logging macros to functions
From: Joe Perches @ 2010-06-27 11:02 UTC (permalink / raw)
  To: Andrew Morton, David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <cover.1277636090.git.joe@perches.com>

Reduces an x86 defconfig text and data ~55k, .6% smaller.

$ size vmlinux*
   text	   data	    bss	    dec	    hex	filename
7205273	 716016	1366288	9287577	 8db799	vmlinux
7258890	 719768	1366288	9344946	 8e97b2	vmlinux.master

Uses %pV and struct va_format
Format arguments are verified before printk

The dev_info macro is converted to _dev_info because there are
existing uses of variables named dev_info in the kernel tree
like drivers/net/pcmcia/pcnet_cs.c

A dev_info macro is created to call _dev_info

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/base/core.c    |   64 +++++++++++++++++++++++++++
 include/linux/device.h |  112 ++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 150 insertions(+), 26 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9630fbd..38bbbd0 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1819,3 +1819,67 @@ void device_shutdown(void)
 	spin_unlock(&devices_kset->list_lock);
 	async_synchronize_full();
 }
+
+/*
+ * Device logging functions
+ */
+
+#ifdef CONFIG_PRINTK
+
+static int __dev_printk(const char *level, const struct device *dev,
+			struct va_format *vaf)
+{
+	if (!dev)
+		return printk("%s(NULL device *): %pV", level, vaf);
+
+	return printk("%s%s %s: %pV",
+		      level, dev_driver_string(dev), dev_name(dev), vaf);
+}
+
+int dev_printk(const char *level, const struct device *dev,
+	       const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	int r;
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	r = __dev_printk(level, dev, &vaf);
+	va_end(args);
+
+	return r;
+}
+EXPORT_SYMBOL(dev_printk);
+
+#define define_dev_printk_level(func, kern_level)		\
+int func(const struct device *dev, const char *fmt, ...)	\
+{								\
+	struct va_format vaf;					\
+	va_list args;						\
+	int r;							\
+								\
+	va_start(args, fmt);					\
+								\
+	vaf.fmt = fmt;						\
+	vaf.va = &args;						\
+								\
+	r = __dev_printk(kern_level, dev, &vaf);		\
+	va_end(args);						\
+								\
+	return r;						\
+}								\
+EXPORT_SYMBOL(func);
+
+define_dev_printk_level(dev_emerg, KERN_EMERG);
+define_dev_printk_level(dev_alert, KERN_ALERT);
+define_dev_printk_level(dev_crit, KERN_CRIT);
+define_dev_printk_level(dev_err, KERN_ERR);
+define_dev_printk_level(dev_warn, KERN_WARNING);
+define_dev_printk_level(dev_notice, KERN_NOTICE);
+define_dev_printk_level(_dev_info, KERN_INFO);
+
+#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index 0713e10..6a8276f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -638,43 +638,103 @@ extern void sysdev_shutdown(void);
 
 /* debugging and troubleshooting/diagnostic helpers. */
 extern const char *dev_driver_string(const struct device *dev);
-#define dev_printk(level, dev, format, arg...)	\
-	printk(level "%s %s: " format , dev_driver_string(dev) , \
-	       dev_name(dev) , ## arg)
-
-#define dev_emerg(dev, format, arg...)		\
-	dev_printk(KERN_EMERG , dev , format , ## arg)
-#define dev_alert(dev, format, arg...)		\
-	dev_printk(KERN_ALERT , dev , format , ## arg)
-#define dev_crit(dev, format, arg...)		\
-	dev_printk(KERN_CRIT , dev , format , ## arg)
-#define dev_err(dev, format, arg...)		\
-	dev_printk(KERN_ERR , dev , format , ## arg)
-#define dev_warn(dev, format, arg...)		\
-	dev_printk(KERN_WARNING , dev , format , ## arg)
-#define dev_notice(dev, format, arg...)		\
-	dev_printk(KERN_NOTICE , dev , format , ## arg)
-#define dev_info(dev, format, arg...)		\
-	dev_printk(KERN_INFO , dev , format , ## arg)
+
+
+#ifdef CONFIG_PRINTK
+
+extern int dev_printk(const char *level, const struct device *dev,
+		      const char *fmt, ...)
+	__attribute__ ((format (printf, 3, 4)));
+extern int dev_emerg(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int dev_alert(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int dev_crit(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int dev_err(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int dev_warn(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int dev_notice(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+extern int _dev_info(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+
+#else
+
+static inline int dev_printk(const char *level, const struct device *dev,
+		      const char *fmt, ...)
+	__attribute__ ((format (printf, 3, 4)));
+static inline int dev_printk(const char *level, const struct device *dev,
+		      const char *fmt, ...)
+	 { return 0; }
+
+static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int dev_crit(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_crit(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int dev_alert(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_alert(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int dev_err(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_err(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int dev_warn(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_warn(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int dev_notice(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int dev_notice(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+static inline int _dev_info(const struct device *dev, const char *fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
+static inline int _dev_info(const struct device *dev, const char *fmt, ...)
+	{ return 0; }
+
+#endif
+
+/*
+ * Stupid hackaround for existing uses of non-printk uses dev_info
+ *
+ * Note that the definition of dev_info below is actually _dev_info
+ * and a macro is used to avoid redefining dev_info
+ */
+
+#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
 
 #if defined(DEBUG)
 #define dev_dbg(dev, format, arg...)		\
-	dev_printk(KERN_DEBUG , dev , format , ## arg)
+	dev_printk(KERN_DEBUG, dev, format, ##arg)
 #elif defined(CONFIG_DYNAMIC_DEBUG)
-#define dev_dbg(dev, format, ...) do { \
+#define dev_dbg(dev, format, ...)		     \
+do {						     \
 	dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
-	} while (0)
+} while (0)
 #else
-#define dev_dbg(dev, format, arg...)		\
-	({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
+#define dev_dbg(dev, format, arg...)				\
+({								\
+	if (0)							\
+		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
+	0;							\
+})
 #endif
 
 #ifdef VERBOSE_DEBUG
 #define dev_vdbg	dev_dbg
 #else
-
-#define dev_vdbg(dev, format, arg...)		\
-	({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
+#define dev_vdbg(dev, format, arg...)				\
+({								\
+	if (0)							\
+		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
+	0;							\
+})
 #endif
 
 /*
-- 
1.7.1.337.g6068.dirty

^ permalink raw reply related

* [PATCH 1/4] vsprintf: Recursive vsnprintf: Add "%pV", struct va_format
From: Joe Perches @ 2010-06-27 11:02 UTC (permalink / raw)
  To: Andrew Morton, David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <cover.1277636090.git.joe@perches.com>

Add the ability to print a format and va_list from a structure pointer

Allows __dev_printk to be implemented as a single printk while
minimizing string space duplication.

%pV should not be used without some mechanism to verify the
format and argument use ala __attribute__(format (printf(...))).

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/kernel.h |    5 +++++
 lib/vsprintf.c         |    9 +++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8317ec4..01dfc05 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -171,6 +171,11 @@ static inline void might_fault(void)
 }
 #endif
 
+struct va_format {
+	const char *fmt;
+	va_list *va;
+};
+
 extern struct atomic_notifier_head panic_notifier_list;
 extern long (*panic_blink)(long time);
 NORET_TYPE void panic(const char * fmt, ...)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b8a2f54..4ee19d0 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -980,6 +980,11 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
  *             [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15]
  *           little endian output byte order is:
  *             [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15]
+ * - 'V' For a struct va_format which contains a format string * and va_list *,
+ *       call vsnprintf(->format, *->va_list).
+ *       Implements a "recursive vsnprintf".
+ *       Do not use this feature without some mechanism to verify the
+ *       correctness of the format string and va_list arguments.
  *
  * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
  * function pointers are really function descriptors, which contain a
@@ -1025,6 +1030,10 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 		break;
 	case 'U':
 		return uuid_string(buf, end, ptr, spec, fmt);
+	case 'V':
+		return buf + vsnprintf(buf, end - buf,
+				       ((struct va_format *)ptr)->fmt,
+				       *(((struct va_format *)ptr)->va));
 	}
 	spec.flags |= SMALL;
 	if (spec.field_width == -1) {
-- 
1.7.1.337.g6068.dirty

^ permalink raw reply related

* [PATCH 1/2 v3] mv643xx_eth: use sw csum for big packets
From: Saeed Bishara @ 2010-06-27 10:26 UTC (permalink / raw)
  To: netdev; +Cc: Saeed Bishara

Some controllers (KW, Dove) limits the TX IP/layer4 checksum offloading to a max size.

Signed-off-by: Saeed Bishara <saeed@marvell.com>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
 drivers/net/mv643xx_eth.c   |    9 +++++++--
 include/linux/mv643xx_eth.h |    5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index e345ec8..73bb8ea 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private {
 	unsigned int t_clk;
 	int extended_rx_coal_limit;
 	int tx_bw_control;
+	int tx_csum_limit;
 };
 
 #define TX_BW_CONTROL_ABSENT		0
@@ -776,13 +777,16 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
 	l4i_chk = 0;
 
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		int hdr_len;
 		int tag_bytes;
 
 		BUG_ON(skb->protocol != htons(ETH_P_IP) &&
 		       skb->protocol != htons(ETH_P_8021Q));
 
-		tag_bytes = (void *)ip_hdr(skb) - (void *)skb->data - ETH_HLEN;
-		if (unlikely(tag_bytes & ~12)) {
+		hdr_len = (void *)ip_hdr(skb) - (void *)skb->data;
+		tag_bytes = hdr_len - ETH_HLEN;
+		if (skb->len - hdr_len > mp->shared->tx_csum_limit ||
+		    unlikely(tag_bytes & ~12)) {
 			if (skb_checksum_help(skb) == 0)
 				goto no_csum;
 			kfree_skb(skb);
@@ -2666,6 +2670,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 	 * Detect hardware parameters.
 	 */
 	msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
+	msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
 	infer_hw_params(msp);
 
 	platform_set_drvdata(pdev, msp);
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index cbbbe9b..30b0c4e 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
 	struct mbus_dram_target_info	*dram;
 	struct platform_device	*shared_smi;
 	unsigned int		t_clk;
+	/*
+	 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
+	 * limit of 9KiB will be used.
+	 */
+	int			tx_csum_limit;
 };
 
 #define MV643XX_ETH_PHY_ADDR_DEFAULT	0
-- 
1.6.0.4


^ permalink raw reply related

* [PATCH] net/Makefile: conditionally descend to wireless and ieee802154
From: Nicolas Kaiser @ 2010-06-27 10:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kbuild, linux-kernel

Don't descend to wireless and ieee802154 unless they are actually used.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 net/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/Makefile b/net/Makefile
index cb7bdc1..41d4200 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -50,7 +50,7 @@ endif
 obj-$(CONFIG_IP_DCCP)		+= dccp/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
 obj-$(CONFIG_RDS)		+= rds/
-obj-y				+= wireless/
+obj-$(CONFIG_WIRELESS)		+= wireless/
 obj-$(CONFIG_MAC80211)		+= mac80211/
 obj-$(CONFIG_TIPC)		+= tipc/
 obj-$(CONFIG_NETLABEL)		+= netlabel/
@@ -61,7 +61,7 @@ obj-$(CONFIG_CAIF)		+= caif/
 ifneq ($(CONFIG_DCB),)
 obj-y				+= dcb/
 endif
-obj-y				+= ieee802154/
+obj-$(CONFIG_IEEE802154)	+= ieee802154/
 
 ifeq ($(CONFIG_NET),y)
 obj-$(CONFIG_SYSCTL)		+= sysctl_net.o
-- 
1.7.1

^ permalink raw reply related

* [PATCH] vhost: break out of polling loop on error
From: Michael S. Tsirkin @ 2010-06-27  8:59 UTC (permalink / raw)
  To: Sridhar Samudrala, Arnd Bergmann, Paul E. McKenney, Juan Quintela,
	Rusty Russell

When ring parsing fails, we currently handle this
as ring empty condition. This means that we enable
kicks and recheck ring empty: if this not empty,
we re-start polling which of course will fail again.

Instead, let's return a negative error code and stop polling.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Dave, I'm sending this out so it can get reviewed.
I'll put this on my vhost tree
so no need for you to pick this patch directly.

 drivers/vhost/net.c   |   12 ++++++++++--
 drivers/vhost/vhost.c |   33 +++++++++++++++++----------------
 drivers/vhost/vhost.h |    8 ++++----
 3 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 0f41c91..54096ee 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -98,7 +98,8 @@ static void tx_poll_start(struct vhost_net *net, struct socket *sock)
 static void handle_tx(struct vhost_net *net)
 {
 	struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX];
-	unsigned head, out, in, s;
+	unsigned out, in, s;
+	int head;
 	struct msghdr msg = {
 		.msg_name = NULL,
 		.msg_namelen = 0,
@@ -135,6 +136,9 @@ static void handle_tx(struct vhost_net *net)
 					 ARRAY_SIZE(vq->iov),
 					 &out, &in,
 					 NULL, NULL);
+		/* On error, stop handling until the next kick. */
+		if (head < 0)
+			break;
 		/* Nothing new?  Wait for eventfd to tell us they refilled. */
 		if (head == vq->num) {
 			wmem = atomic_read(&sock->sk->sk_wmem_alloc);
@@ -192,7 +196,8 @@ static void handle_tx(struct vhost_net *net)
 static void handle_rx(struct vhost_net *net)
 {
 	struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
-	unsigned head, out, in, log, s;
+	unsigned out, in, log, s;
+	int head;
 	struct vhost_log *vq_log;
 	struct msghdr msg = {
 		.msg_name = NULL,
@@ -228,6 +233,9 @@ static void handle_rx(struct vhost_net *net)
 					 ARRAY_SIZE(vq->iov),
 					 &out, &in,
 					 vq_log, &log);
+		/* On error, stop handling until the next kick. */
+		if (head < 0)
+			break;
 		/* OK, now we need to know about added descriptors. */
 		if (head == vq->num) {
 			if (unlikely(vhost_enable_notify(vq))) {
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 3b83382..5ccd384 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -873,12 +873,13 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
  * number of output then some number of input descriptors, it's actually two
  * iovecs, but we pack them into one and note how many of each there were.
  *
- * This function returns the descriptor number found, or vq->num (which
- * is never a valid descriptor number) if none was found. */
-unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
-			   struct iovec iov[], unsigned int iov_size,
-			   unsigned int *out_num, unsigned int *in_num,
-			   struct vhost_log *log, unsigned int *log_num)
+ * This function returns the descriptor number found, or vq->num (which is
+ * never a valid descriptor number) if none was found.  A negative code is
+ * returned on error. */
+int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
+		      struct iovec iov[], unsigned int iov_size,
+		      unsigned int *out_num, unsigned int *in_num,
+		      struct vhost_log *log, unsigned int *log_num)
 {
 	struct vring_desc desc;
 	unsigned int i, head, found = 0;
@@ -890,13 +891,13 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 	if (get_user(vq->avail_idx, &vq->avail->idx)) {
 		vq_err(vq, "Failed to access avail idx at %p\n",
 		       &vq->avail->idx);
-		return vq->num;
+		return -EFAULT;
 	}
 
 	if ((u16)(vq->avail_idx - last_avail_idx) > vq->num) {
 		vq_err(vq, "Guest moved used index from %u to %u",
 		       last_avail_idx, vq->avail_idx);
-		return vq->num;
+		return -EFAULT;
 	}
 
 	/* If there's nothing new since last we looked, return invalid. */
@@ -912,14 +913,14 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 		vq_err(vq, "Failed to read head: idx %d address %p\n",
 		       last_avail_idx,
 		       &vq->avail->ring[last_avail_idx % vq->num]);
-		return vq->num;
+		return -EFAULT;
 	}
 
 	/* If their number is silly, that's an error. */
 	if (head >= vq->num) {
 		vq_err(vq, "Guest says index %u > %u is available",
 		       head, vq->num);
-		return vq->num;
+		return -EINVAL;
 	}
 
 	/* When we start there are none of either input nor output. */
@@ -933,19 +934,19 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 		if (i >= vq->num) {
 			vq_err(vq, "Desc index is %u > %u, head = %u",
 			       i, vq->num, head);
-			return vq->num;
+			return -EINVAL;
 		}
 		if (++found > vq->num) {
 			vq_err(vq, "Loop detected: last one at %u "
 			       "vq size %u head %u\n",
 			       i, vq->num, head);
-			return vq->num;
+			return -EINVAL;
 		}
 		ret = copy_from_user(&desc, vq->desc + i, sizeof desc);
 		if (ret) {
 			vq_err(vq, "Failed to get descriptor: idx %d addr %p\n",
 			       i, vq->desc + i);
-			return vq->num;
+			return -EFAULT;
 		}
 		if (desc.flags & VRING_DESC_F_INDIRECT) {
 			ret = get_indirect(dev, vq, iov, iov_size,
@@ -954,7 +955,7 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 			if (ret < 0) {
 				vq_err(vq, "Failure detected "
 				       "in indirect descriptor at idx %d\n", i);
-				return vq->num;
+				return ret;
 			}
 			continue;
 		}
@@ -964,7 +965,7 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 		if (ret < 0) {
 			vq_err(vq, "Translation failure %d descriptor idx %d\n",
 			       ret, i);
-			return vq->num;
+			return ret;
 		}
 		if (desc.flags & VRING_DESC_F_WRITE) {
 			/* If this is an input descriptor,
@@ -981,7 +982,7 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 			if (*in_num) {
 				vq_err(vq, "Descriptor has out after in: "
 				       "idx %d\n", i);
-				return vq->num;
+				return -EINVAL;
 			}
 			*out_num += ret;
 		}
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 44591ba..11ee13d 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -120,10 +120,10 @@ long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg);
 int vhost_vq_access_ok(struct vhost_virtqueue *vq);
 int vhost_log_access_ok(struct vhost_dev *);
 
-unsigned vhost_get_vq_desc(struct vhost_dev *, struct vhost_virtqueue *,
-			   struct iovec iov[], unsigned int iov_count,
-			   unsigned int *out_num, unsigned int *in_num,
-			   struct vhost_log *log, unsigned int *log_num);
+int vhost_get_vq_desc(struct vhost_dev *, struct vhost_virtqueue *,
+		      struct iovec iov[], unsigned int iov_count,
+		      unsigned int *out_num, unsigned int *in_num,
+		      struct vhost_log *log, unsigned int *log_num);
 void vhost_discard_vq_desc(struct vhost_virtqueue *);
 
 int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len);
-- 
1.7.1.12.g42b7f

^ permalink raw reply related

* Re: dhclient, checksum and tap
From: Michael S. Tsirkin @ 2010-06-27  8:24 UTC (permalink / raw)
  To: David Miller; +Cc: herbert.xu, netdev
In-Reply-To: <20100626.200320.43025947.davem@davemloft.net>

On Sat, Jun 26, 2010 at 08:03:20PM -0700, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Sun, 27 Jun 2010 00:14:19 +0300
> 
> > On Fri, Jun 25, 2010 at 11:21:52AM -0700, David Miller wrote:
> >> We added the af_packet status as the migration path to deal with
> >> this issue in the cleanest manner possible.  Putting a new hack
> >> into the TAP driver works contrary to that goal.
> > 
> > Hmm, problem is, using the af_packets status requires
> > userspace changes, and so does not help old clients.
> > And for virt, clients might be running old kernels without this support.
> > qemu has a hack to make old guests running within qemu work.
> > I guess I can copy that hack into vhost - a bit ugly as I don't have
> > access to the original skb there, so I will have to duplcate some logic,
> > but doable.  Is this what you suggest?  OTOH if we had the workaround in
> > tap, this could replace hacks in both vhost and qemu.
> 
> If you add the TAP thing you can _never_ remove it.  Exactly for the
> same reason that the qemu thing can never be removed.  It'll always be
> needed for the sake of old guests running old stuff.
> 
> This is why I truly believe that keeping the af_packet status thing as
> the only kernel side assist is likely best in the long run.

Just to spell it out for me, you think the hack should be done
in vhost-net?

-- 
MST

^ permalink raw reply

* Re: [PATCH] ip: correctly report 802.15.4 link type
From: Jan Engelhardt @ 2010-06-27  7:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <7q2rynq4hva9nlyv9hdbhr26.1277596268239@email.android.com>

On Sunday 2010-06-27 01:51, Stephen Hemminger wrote:

>OK but long-term fix is to get rid of hardcoded table

With what will you be replacing it?


>>Up until now, the "hardwpan" devices were displayed as link/[804].
>>
>>Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
>>---
>> lib/ll_types.c |    3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>>diff --git a/lib/ll_types.c b/lib/ll_types.c

>>index 846cdb0..1cc46b6 100644
>>--- a/lib/ll_types.c
>>+++ b/lib/ll_types.c
>>@@ -125,6 +125,9 @@ __PF(IEEE80211_PRISM,ieee802.11/prism)
>> #ifdef ARPHRD_IEEE80211_RADIOTAP
>> __PF(IEEE80211_RADIOTAP,ieee802.11/radiotap)
>> #endif
>>+#ifdef ARPHRD_IEEE802154
>>+__PF(IEEE802154, ieee802.15.4)
>>+#endif
>> #ifdef ARPHRD_NONE
>> __PF(NONE, none)
>> #endif
>>-- 
>>1.7.1
>>
>


^ permalink raw reply

* Re: [RFC PATCH v7 01/19] Add a new structure for skb buffer from external.
From: Herbert Xu @ 2010-06-27  6:14 UTC (permalink / raw)
  To: Dong, Eddie
  Cc: Xin, Xiaohui, Stephen Hemminger, netdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com,
	mingo@elte.hu, davem@davemloft.net, jdike@linux.intel.com
In-Reply-To: <1A42CE6F5F474C41B63392A5F80372B21F58D666@shsmsx501.ccr.corp.intel.com>

On Fri, Jun 25, 2010 at 09:03:46AM +0800, Dong, Eddie wrote:
> 
> In current patch, each SKB for the assigned device (SRIOV VF or NIC or a complete queue pairs) uses the buffer from guest, so it eliminates copy completely in software and requires hardware to do so. If we can have an additonal place to store the buffer per skb (may cause copy later on), we can do copy later on or re-post the buffer to assigned NIC driver later on. But that may be not very clean either :(

OK, if I understand you correctly then I don't think have a
problem.  With your current patch-set you have exactly the same
situation when the skb->data is reallocated as a kernel buffer.

This is OK because as you correctly argue, it is a rare situation.

With my proposal you will need to get this extra external buffer
in even less cases, because you'd only need to do it if the skb
head grows, which only happens if it becomes encapsulated.

So let me explain it in a bit more detail:

Our packet starts out as a purely non-linear skb, i.e., skb->head
contains nothing and all the page frags come from the guest.

During host processing we may pull data into skb->head but the
first frag will remain unless we pull all of it.  If we did do
that then you would have a free external buffer anyway.

Now in the common case the header may be modified or pulled, but
it very rarely grows.  So you can just copy the header back into
the first frag just before we give it to the guest.

Only in the case where the packet header grows (e.g., encapsulation)
would you need to get an extra external buffer.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] phylib: Add autoload support for the LXT973 phy.
From: David Miller @ 2010-06-27  5:16 UTC (permalink / raw)
  To: dwmw2; +Cc: richardcochran, netdev
In-Reply-To: <1277210293.21798.11.camel@localhost>

From: David Woodhouse <dwmw2@infradead.org>
Date: Tue, 22 Jun 2010 13:38:13 +0100

> Commit e13647c1 (phylib: Add support for the LXT973 phy.) added a new ID
> but neglected to also add it to the MODULE_DEVICE_TABLE.
> 
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Applied, thanks.

> When I did this stuff, I did wonder if we should make this happen
> automatically somehow. I pondered some dirty macro hack in
> phy_driver_register() which would do it somehow, but couldn't come up
> with anything that'd work.
> 
> Removing the phy_id and phy_id_mask from struct phy_driver and having a
> pointer to a match table would suck, since each driver only really
> matches one device/mask. (Even where a single C file has multiple
> drivers, they often differ in some methods or flags.)
> 
> The best option I can come up with right now, is probably to remove
> phy_id and phy_id_mask from phy_driver and put a pointer to the driver
> into the ID table, and take the ID table as the argument to
> phy_driver_register(). I'm not sure I like that very much though -- I'd
> prefer that we just remember to update the table and don't need to be
> forced :)
> 
> (Another cheap option is to pass the ID table as an extra argument to
> the existing phy_device_register(), I suppose, and it can just print a
> warning if it doesn't find the same phy_id and phy_id_mask in the table)

As our experience shows, people aren't remembering to do it so we have
to do something hard handed to make sure this doesn't break.

A compile time error out is the best, but if that is too hard or ugly
and we do it at run time then we should fail the register (not just
print a warning) if the table is incomplete.

Otherwise we run into cases where a developer adds several new IDs,
forgets some of the table entries, but only tries testing the ones he
did remember to add and doesn't notice the warning message.

^ permalink raw reply

* Re: [PATCH] ISDN: hysdn, fix potential NULL dereference
From: David Miller @ 2010-06-27  5:12 UTC (permalink / raw)
  To: jslaby; +Cc: isdn, linux-kernel, jirislaby, shemminger, kaber, netdev
In-Reply-To: <1277206896-27197-1-git-send-email-jslaby@suse.cz>

From: Jiri Slaby <jslaby@suse.cz>
Date: Tue, 22 Jun 2010 13:41:36 +0200

> Stanse found that lp is dereferenced earlier than checked for being
> NULL in hysdn_rx_netpkt. Move the initialization below the test.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

Applied.

^ permalink raw reply

* Re: [PATCH] vxge: fix memory leak in vxge_alloc_msix() error path {nodisc}
From: David Miller @ 2010-06-27  5:12 UTC (permalink / raw)
  To: Ramkrishna.Vepa; +Cc: mschmidt, netdev
In-Reply-To: <FCA91A92EE52B041906A0358FC28FCC38EF1837D08@FRE1EXCH02.hq.exar.com>

From: Ramkrishna Vepa <Ramkrishna.Vepa@exar.com>
Date: Fri, 25 Jun 2010 00:21:48 -0700

>> When pci_enable_msix() returned ret<0, entries and vxge_entries were
>> leaked.
>> While at it, use the centralized exit idiom in the function.
>> 
>> Not tested. It compiles OK.
>> 
>> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
> 
> Reviewed and tested the patch. Thanks!
> 
> Acked-by: Ram Vepa <ram.vepa@exar.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/2] syncookies: add support for ECN
From: David Miller @ 2010-06-27  5:00 UTC (permalink / raw)
  To: fw; +Cc: netdev
In-Reply-To: <1277156925-7295-2-git-send-email-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Mon, 21 Jun 2010 23:48:45 +0200

> Allows use of ECN when syncookies are in effect by encoding ecn_ok
> into the syn-ack tcp timestamp.
> 
> While at it, remove a uneeded #ifdef CONFIG_SYN_COOKIES.
> With CONFIG_SYN_COOKIES=nm want_cookie is ifdef'd to 0 and gcc
> removes the "if (0)".
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Also applied, nice work Florian.

^ permalink raw reply

* Re: [PATCH 1/2] syncookies: do not store rcv_wscale in tcp timestamp
From: David Miller @ 2010-06-27  5:00 UTC (permalink / raw)
  To: fw; +Cc: netdev
In-Reply-To: <1277156925-7295-1-git-send-email-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Mon, 21 Jun 2010 23:48:44 +0200

> As pointed out by Fernando Gont there is no need to encode rcv_wscale
> into the cookie.
> 
> We did not use the restored rcv_wscale anyway; it is recomputed
> via tcp_select_initial_window().
> 
> Thus we can save 4 bits in the ts option space by removing rcv_wscale.
> In case window scaling was not supported, we set the (invalid) wscale
> value 0xf.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied.

^ permalink raw reply

* Re: [PATCH 1/2] syncookies: do not store rcv_wscale in tcp timestamp
From: David Miller @ 2010-06-27  4:27 UTC (permalink / raw)
  To: hagen; +Cc: fw, netdev, ilpo.jarvinen
In-Reply-To: <20100624221416.GA31116@nuttenaction>

From: Hagen Paul Pfeifer <hagen@jauu.net>
Date: Fri, 25 Jun 2010 00:14:16 +0200

> why not limit the window to 2^16 bytes which is sufficient for
> 99.9999% of the use case?

This may have been true 8 years ago, but it is not any longer.

You will underutilize your link with anything smaller than
~512k on the modern internet.

^ permalink raw reply

* Re: [PATCH] net, ucc_geth: ethtool -d shows phy register values
From: David Miller @ 2010-06-27  4:20 UTC (permalink / raw)
  To: holger.brunck; +Cc: netdev, christopher.varlese, leoli, avorontsov, tj
In-Reply-To: <1276610603-11589-1-git-send-email-holger.brunck@keymile.com>

From: Holger Brunck <holger.brunck@keymile.com>
Date: Tue, 15 Jun 2010 16:03:23 +0200

> From: Chris Varlese <christopher.varlese@keymile.com>
> 
> Fixes MPC83xx UCC Ethernet driver so ethtool -d dumps values of
> the PHY registers (like other devices do) instead of the UCC registers
> of the MPC83xx.
> 
> Signed-off-by: Chris Varlese <christopher.varlese@keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>

This doesn't look right at all.

ethtool -d dumps "chip registers", not the PHY registers.  So the
current code looks correct, not what you're changing it to.

^ permalink raw reply

* Re: dhclient, checksum and tap
From: David Miller @ 2010-06-27  3:03 UTC (permalink / raw)
  To: mst; +Cc: herbert.xu, netdev
In-Reply-To: <20100626211419.GA3646@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Sun, 27 Jun 2010 00:14:19 +0300

> On Fri, Jun 25, 2010 at 11:21:52AM -0700, David Miller wrote:
>> We added the af_packet status as the migration path to deal with
>> this issue in the cleanest manner possible.  Putting a new hack
>> into the TAP driver works contrary to that goal.
> 
> Hmm, problem is, using the af_packets status requires
> userspace changes, and so does not help old clients.
> And for virt, clients might be running old kernels without this support.
> qemu has a hack to make old guests running within qemu work.
> I guess I can copy that hack into vhost - a bit ugly as I don't have
> access to the original skb there, so I will have to duplcate some logic,
> but doable.  Is this what you suggest?  OTOH if we had the workaround in
> tap, this could replace hacks in both vhost and qemu.

If you add the TAP thing you can _never_ remove it.  Exactly for the
same reason that the qemu thing can never be removed.  It'll always be
needed for the sake of old guests running old stuff.

This is why I truly believe that keeping the af_packet status thing as
the only kernel side assist is likely best in the long run.

^ permalink raw reply

* Re: [PATCH] usb: pegasus: fixed coding style issues
From: Petko Manolov @ 2010-06-27  2:47 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: Petko Manolov, linux-usb, netdev
In-Reply-To: <20100626185854.4a3eff43@absol.kitzblitz>

I think the old code is what "Lindent" script outputs.  To me it doesn't 
matter either way. :-)


 		Petko


On Sat, 26 Jun 2010, Nicolas Kaiser wrote:

> Fixed brace, static initialization, comment, whitespace and spacing
> coding style issues.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> drivers/net/usb/pegasus.c |  125 +++++++++----------
> drivers/net/usb/pegasus.h |  296 ++++++++++++++++++++++----------------------
> 2 files changed, 209 insertions(+), 212 deletions(-)
>
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index 974d17f..6710f09 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -21,11 +21,11 @@
>  *			behaves. Pegasus II support added since this version.
>  *			TODO: suppressing HCD warnings spewage on disconnect.
>  *		v0.4.13	Ethernet address is now set at probe(), not at open()
> - *			time as this seems to break dhcpd.
> + *			time as this seems to break dhcpd.
>  *		v0.5.0	branch to 2.5.x kernels
>  *		v0.5.1	ethtool support added
>  *		v0.5.5	rx socket buffers are in a pool and the their allocation
> - * 			is out of the interrupt routine.
> + *			is out of the interrupt routine.
>  */
>
> #include <linux/sched.h>
> @@ -55,9 +55,9 @@ static const char driver_name[] = "pegasus";
> #define	BMSR_MEDIA	(BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
> 			BMSR_100FULL | BMSR_ANEGCAPABLE)
>
> -static int loopback = 0;
> -static int mii_mode = 0;
> -static char *devid=NULL;
> +static int loopback;
> +static int mii_mode;
> +static char *devid;
>
> static struct usb_eth_dev usb_dev_id[] = {
> #define	PEGASUS_DEV(pn, vid, pid, flags)	\
> @@ -102,8 +102,8 @@ MODULE_PARM_DESC(devid, "The format is: 'DEV_name:VendorID:DeviceID:Flags'");
>
> /* use ethtool to change the level for any given device */
> static int msg_level = -1;
> -module_param (msg_level, int, 0);
> -MODULE_PARM_DESC (msg_level, "Override default message level");
> +module_param(msg_level, int, 0);
> +MODULE_PARM_DESC(msg_level, "Override default message level");
>
> MODULE_DEVICE_TABLE(usb, pegasus_ids);
> static const struct net_device_ops pegasus_netdev_ops;
> @@ -141,7 +141,7 @@ static void ctrl_callback(struct urb *urb)
> 	wake_up(&pegasus->ctrl_wait);
> }
>
> -static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
> +static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
> 			 void *data)
> {
> 	int ret;
> @@ -196,7 +196,7 @@ out:
> 	return ret;
> }
>
> -static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
> +static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
> 			 void *data)
> {
> 	int ret;
> @@ -248,7 +248,7 @@ out:
> 	return ret;
> }
>
> -static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
> +static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
> {
> 	int ret;
> 	char *tmp;
> @@ -299,7 +299,7 @@ out:
> 	return ret;
> }
>
> -static int update_eth_regs_async(pegasus_t * pegasus)
> +static int update_eth_regs_async(pegasus_t *pegasus)
> {
> 	int ret;
>
> @@ -326,7 +326,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
> }
>
> /* Returns 0 on success, error on failure */
> -static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
> +static int read_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd)
> {
> 	int i;
> 	__u8 data[4] = { phy, 0, 0, indx };
> @@ -334,7 +334,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
> 	int ret;
>
> 	set_register(pegasus, PhyCtrl, 0);
> -	set_registers(pegasus, PhyAddr, sizeof (data), data);
> +	set_registers(pegasus, PhyAddr, sizeof(data), data);
> 	set_register(pegasus, PhyCtrl, (indx | PHY_READ));
> 	for (i = 0; i < REG_TIMEOUT; i++) {
> 		ret = get_registers(pegasus, PhyCtrl, 1, data);
> @@ -366,7 +366,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int loc)
> 	return (int)res;
> }
>
> -static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
> +static int write_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 regd)
> {
> 	int i;
> 	__u8 data[4] = { phy, 0, 0, indx };
> @@ -402,7 +402,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
> 	write_mii_word(pegasus, phy_id, loc, val);
> }
>
> -static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
> +static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
> {
> 	int i;
> 	__u8 tmp;
> @@ -433,7 +433,7 @@ fail:
> }
>
> #ifdef	PEGASUS_WRITE_EEPROM
> -static inline void enable_eprom_write(pegasus_t * pegasus)
> +static inline void enable_eprom_write(pegasus_t *pegasus)
> {
> 	__u8 tmp;
> 	int ret;
> @@ -442,7 +442,7 @@ static inline void enable_eprom_write(pegasus_t * pegasus)
> 	set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
> }
>
> -static inline void disable_eprom_write(pegasus_t * pegasus)
> +static inline void disable_eprom_write(pegasus_t *pegasus)
> {
> 	__u8 tmp;
> 	int ret;
> @@ -452,7 +452,7 @@ static inline void disable_eprom_write(pegasus_t * pegasus)
> 	set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE);
> }
>
> -static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
> +static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data)
> {
> 	int i;
> 	__u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
> @@ -484,7 +484,7 @@ fail:
> }
> #endif				/* PEGASUS_WRITE_EEPROM */
>
> -static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
> +static inline void get_node_id(pegasus_t *pegasus, __u8 *id)
> {
> 	int i;
> 	__u16 w16;
> @@ -495,7 +495,7 @@ static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
> 	}
> }
>
> -static void set_ethernet_addr(pegasus_t * pegasus)
> +static void set_ethernet_addr(pegasus_t *pegasus)
> {
> 	__u8 node_id[6];
>
> @@ -503,12 +503,12 @@ static void set_ethernet_addr(pegasus_t * pegasus)
> 		get_registers(pegasus, 0x10, sizeof(node_id), node_id);
> 	} else {
> 		get_node_id(pegasus, node_id);
> -		set_registers(pegasus, EthID, sizeof (node_id), node_id);
> +		set_registers(pegasus, EthID, sizeof(node_id), node_id);
> 	}
> -	memcpy(pegasus->net->dev_addr, node_id, sizeof (node_id));
> +	memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id));
> }
>
> -static inline int reset_mac(pegasus_t * pegasus)
> +static inline int reset_mac(pegasus_t *pegasus)
> {
> 	__u8 data = 0x8;
> 	int i;
> @@ -563,7 +563,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
> 		data[1] = 0;
> 	data[2] = (loopback & 1) ? 0x09 : 0x01;
>
> -	memcpy(pegasus->eth_regs, data, sizeof (data));
> +	memcpy(pegasus->eth_regs, data, sizeof(data));
> 	ret = set_registers(pegasus, EthCtrl0, 3, data);
>
> 	if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
> @@ -577,7 +577,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
> 	return ret;
> }
>
> -static void fill_skb_pool(pegasus_t * pegasus)
> +static void fill_skb_pool(pegasus_t *pegasus)
> {
> 	int i;
>
> @@ -595,7 +595,7 @@ static void fill_skb_pool(pegasus_t * pegasus)
> 	}
> }
>
> -static void free_skb_pool(pegasus_t * pegasus)
> +static void free_skb_pool(pegasus_t *pegasus)
> {
> 	int i;
>
> @@ -667,11 +667,11 @@ static void read_bulk_callback(struct urb *urb)
> 		netif_dbg(pegasus, rx_err, net,
> 			  "RX packet error %x\n", rx_status);
> 		pegasus->stats.rx_errors++;
> -		if (rx_status & 0x06)	// long or runt
> +		if (rx_status & 0x06)	/* long or runt	*/
> 			pegasus->stats.rx_length_errors++;
> 		if (rx_status & 0x08)
> 			pegasus->stats.rx_crc_errors++;
> -		if (rx_status & 0x10)	// extra bits
> +		if (rx_status & 0x10)	/* extra bits	*/
> 			pegasus->stats.rx_frame_errors++;
> 		goto goon;
> 	}
> @@ -748,9 +748,8 @@ static void rx_fixup(unsigned long data)
> 	if (pegasus->flags & PEGASUS_RX_URB_FAIL)
> 		if (pegasus->rx_skb)
> 			goto try_again;
> -	if (pegasus->rx_skb == NULL) {
> +	if (pegasus->rx_skb == NULL)
> 		pegasus->rx_skb = pull_skb(pegasus);
> -	}
> 	if (pegasus->rx_skb == NULL) {
> 		netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n");
> 		tasklet_schedule(&pegasus->rx_tl);
> @@ -835,7 +834,7 @@ static void intr_callback(struct urb *urb)
> 	}
>
> 	if (urb->actual_length >= 6) {
> -		u8	* d = urb->transfer_buffer;
> +		u8 *d = urb->transfer_buffer;
>
> 		/* byte 0 == tx_status1, reg 2B */
> 		if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
> @@ -918,14 +917,14 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
> 	return &((pegasus_t *) netdev_priv(dev))->stats;
> }
>
> -static inline void disable_net_traffic(pegasus_t * pegasus)
> +static inline void disable_net_traffic(pegasus_t *pegasus)
> {
> 	__le16 tmp = cpu_to_le16(0);
>
> 	set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
> }
>
> -static inline void get_interrupt_interval(pegasus_t * pegasus)
> +static inline void get_interrupt_interval(pegasus_t *pegasus)
> {
> 	u16 data;
> 	u8 interval;
> @@ -961,7 +960,7 @@ static void set_carrier(struct net_device *net)
> 		netif_carrier_off(net);
> }
>
> -static void free_all_urbs(pegasus_t * pegasus)
> +static void free_all_urbs(pegasus_t *pegasus)
> {
> 	usb_free_urb(pegasus->intr_urb);
> 	usb_free_urb(pegasus->tx_urb);
> @@ -969,7 +968,7 @@ static void free_all_urbs(pegasus_t * pegasus)
> 	usb_free_urb(pegasus->ctrl_urb);
> }
>
> -static void unlink_all_urbs(pegasus_t * pegasus)
> +static void unlink_all_urbs(pegasus_t *pegasus)
> {
> 	usb_kill_urb(pegasus->intr_urb);
> 	usb_kill_urb(pegasus->tx_urb);
> @@ -977,12 +976,11 @@ static void unlink_all_urbs(pegasus_t * pegasus)
> 	usb_kill_urb(pegasus->ctrl_urb);
> }
>
> -static int alloc_urbs(pegasus_t * pegasus)
> +static int alloc_urbs(pegasus_t *pegasus)
> {
> 	pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
> -	if (!pegasus->ctrl_urb) {
> +	if (!pegasus->ctrl_urb)
> 		return 0;
> -	}
> 	pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
> 	if (!pegasus->rx_urb) {
> 		usb_free_urb(pegasus->ctrl_urb);
> @@ -1019,7 +1017,7 @@ static int pegasus_open(struct net_device *net)
> 		return -ENOMEM;
>
> 	res = set_registers(pegasus, EthID, 6, net->dev_addr);
> -
> +
> 	usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
> 			  usb_rcvbulkpipe(pegasus->usb, 1),
> 			  pegasus->rx_skb->data, PEGASUS_MTU + 8,
> @@ -1033,7 +1031,7 @@ static int pegasus_open(struct net_device *net)
>
> 	usb_fill_int_urb(pegasus->intr_urb, pegasus->usb,
> 			 usb_rcvintpipe(pegasus->usb, 3),
> -			 pegasus->intr_buff, sizeof (pegasus->intr_buff),
> +			 pegasus->intr_buff, sizeof(pegasus->intr_buff),
> 			 intr_callback, pegasus, pegasus->intr_interval);
> 	if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) {
> 		if (res == -ENODEV)
> @@ -1076,9 +1074,9 @@ static void pegasus_get_drvinfo(struct net_device *dev,
> 				struct ethtool_drvinfo *info)
> {
> 	pegasus_t *pegasus = netdev_priv(dev);
> -	strncpy(info->driver, driver_name, sizeof (info->driver) - 1);
> -	strncpy(info->version, DRIVER_VERSION, sizeof (info->version) - 1);
> -	usb_make_path(pegasus->usb, info->bus_info, sizeof (info->bus_info));
> +	strncpy(info->driver, driver_name, sizeof(info->driver) - 1);
> +	strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
> +	usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
> }
>
> /* also handles three patterns of some kind in hardware */
> @@ -1098,7 +1096,7 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
> {
> 	pegasus_t	*pegasus = netdev_priv(dev);
> 	u8		reg78 = 0x04;
> -
> +
> 	if (wol->wolopts & ~WOL_SUPPORTED)
> 		return -EINVAL;
>
> @@ -1118,7 +1116,7 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
> static inline void pegasus_reset_wol(struct net_device *dev)
> {
> 	struct ethtool_wolinfo wol;
> -
> +
> 	memset(&wol, 0, sizeof wol);
> 	(void) pegasus_set_wol(dev, &wol);
> }
> @@ -1178,7 +1176,7 @@ static const struct ethtool_ops ops = {
>
> static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
> {
> -	__u16 *data = (__u16 *) & rq->ifr_ifru;
> +	__u16 *data = (__u16 *) &rq->ifr_ifru;
> 	pegasus_t *pegasus = netdev_priv(net);
> 	int res;
>
> @@ -1223,7 +1221,7 @@ static void pegasus_set_multicast(struct net_device *net)
> 	ctrl_callback(pegasus->ctrl_urb);
> }
>
> -static __u8 mii_phy_probe(pegasus_t * pegasus)
> +static __u8 mii_phy_probe(pegasus_t *pegasus)
> {
> 	int i;
> 	__u16 tmp;
> @@ -1239,10 +1237,10 @@ static __u8 mii_phy_probe(pegasus_t * pegasus)
> 	return 0xff;
> }
>
> -static inline void setup_pegasus_II(pegasus_t * pegasus)
> +static inline void setup_pegasus_II(pegasus_t *pegasus)
> {
> 	__u8 data = 0xa5;
> -
> +
> 	set_register(pegasus, Reg1d, 0);
> 	set_register(pegasus, Reg7b, 1);
> 	mdelay(100);
> @@ -1254,16 +1252,15 @@ static inline void setup_pegasus_II(pegasus_t * pegasus)
> 	set_register(pegasus, 0x83, data);
> 	get_registers(pegasus, 0x83, 1, &data);
>
> -	if (data == 0xa5) {
> +	if (data == 0xa5)
> 		pegasus->chip = 0x8513;
> -	} else {
> +	else
> 		pegasus->chip = 0;
> -	}
>
> 	set_register(pegasus, 0x80, 0xc0);
> 	set_register(pegasus, 0x83, 0xff);
> 	set_register(pegasus, 0x84, 0x01);
> -
> +
> 	if (pegasus->features & HAS_HOME_PNA && mii_mode)
> 		set_register(pegasus, Reg81, 6);
> 	else
> @@ -1272,7 +1269,7 @@ static inline void setup_pegasus_II(pegasus_t * pegasus)
>
>
> static int pegasus_count;
> -static struct workqueue_struct *pegasus_workqueue = NULL;
> +static struct workqueue_struct *pegasus_workqueue;
> #define CARRIER_CHECK_DELAY (2 * HZ)
>
> static void check_carrier(struct work_struct *work)
> @@ -1367,7 +1364,7 @@ static int pegasus_probe(struct usb_interface *intf,
> 	pegasus->mii.phy_id_mask = 0x1f;
> 	pegasus->mii.reg_num_mask = 0x1f;
> 	spin_lock_init(&pegasus->rx_pool_lock);
> -	pegasus->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
> +	pegasus->msg_enable = netif_msg_init(msg_level, NETIF_MSG_DRV
> 				| NETIF_MSG_PROBE | NETIF_MSG_LINK);
>
> 	pegasus->features = usb_dev_id[dev_index].private;
> @@ -1442,11 +1439,11 @@ static void pegasus_disconnect(struct usb_interface *intf)
> 	pegasus_dec_workqueue();
> }
>
> -static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
> +static int pegasus_suspend(struct usb_interface *intf, pm_message_t message)
> {
> 	struct pegasus *pegasus = usb_get_intfdata(intf);
> -
> -	netif_device_detach (pegasus->net);
> +
> +	netif_device_detach(pegasus->net);
> 	cancel_delayed_work(&pegasus->carrier_check);
> 	if (netif_running(pegasus->net)) {
> 		usb_kill_urb(pegasus->rx_urb);
> @@ -1455,11 +1452,11 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
> 	return 0;
> }
>
> -static int pegasus_resume (struct usb_interface *intf)
> +static int pegasus_resume(struct usb_interface *intf)
> {
> 	struct pegasus *pegasus = usb_get_intfdata(intf);
>
> -	netif_device_attach (pegasus->net);
> +	netif_device_attach(pegasus->net);
> 	if (netif_running(pegasus->net)) {
> 		pegasus->rx_urb->status = 0;
> 		pegasus->rx_urb->actual_length = 0;
> @@ -1498,8 +1495,8 @@ static struct usb_driver pegasus_driver = {
>
> static void __init parse_id(char *id)
> {
> -	unsigned int vendor_id=0, device_id=0, flags=0, i=0;
> -	char *token, *name=NULL;
> +	unsigned int vendor_id = 0, device_id = 0, flags = 0, i = 0;
> +	char *token, *name = NULL;
>
> 	if ((token = strsep(&id, ":")) != NULL)
> 		name = token;
> @@ -1510,14 +1507,14 @@ static void __init parse_id(char *id)
> 		device_id = simple_strtoul(token, NULL, 16);
> 	flags = simple_strtoul(id, NULL, 16);
> 	pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n",
> -	        driver_name, name, vendor_id, device_id, flags);
> +		driver_name, name, vendor_id, device_id, flags);
>
> 	if (vendor_id > 0x10000 || vendor_id == 0)
> 		return;
> 	if (device_id > 0x10000 || device_id == 0)
> 		return;
>
> -	for (i=0; usb_dev_id[i].name; i++);
> +	for (i = 0; usb_dev_id[i].name; i++);
> 	usb_dev_id[i].name = name;
> 	usb_dev_id[i].vendor = vendor_id;
> 	usb_dev_id[i].device = device_id;
> diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
> index 29f5211..65b78b3 100644
> --- a/drivers/net/usb/pegasus.h
> +++ b/drivers/net/usb/pegasus.h
> @@ -68,7 +68,7 @@ enum pegasus_registers {
> 	EpromData = 0x21,	/* 0x21 low, 0x22 high byte */
> 	EpromCtrl = 0x23,
> 	PhyAddr = 0x25,
> -	PhyData = 0x26, 	/* 0x26 low, 0x27 high byte */
> +	PhyData = 0x26,		/* 0x26 low, 0x27 high byte */
> 	PhyCtrl = 0x28,
> 	UsbStst = 0x2a,
> 	EthTxStat0 = 0x2b,
> @@ -154,162 +154,162 @@ struct usb_eth_dev {
>
> #else	/* PEGASUS_DEV */
>
> -PEGASUS_DEV( "3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
> -PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
> +PEGASUS_DEV("3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
> +PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
> 		VENDOR_ADMTEK, 0x8511,
> -		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
> -PEGASUS_DEV( "ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
> +		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
> +PEGASUS_DEV("ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
> 		VENDOR_ADMTEK, 0x8513,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
> 		VENDOR_ADMTEK, 0x8515,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
> 		VENDOR_ADMTEK, 0x0986,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "AN986A USB MAC", VENDOR_ADMTEK, 1986,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("AN986A USB MAC", VENDOR_ADMTEK, 1986,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> /*
>  * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
>  * with the same product IDs by checking the device class too.
>  */
> -PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "D-Link DSB-650", VENDOR_DLINK, 0xabc1,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
> -		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
> -PEGASUS_DEV( "ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM,  0x4010,
> -		DEFAULT_GPIO_RESET  | PEGASUS_II )
> -PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x093a,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
> +PEGASUS_DEV_CLASS("Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("D-Link DSB-650", VENDOR_DLINK, 0xabc1,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
> +		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
> +PEGASUS_DEV("ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM,  0x4010,
> +		DEFAULT_GPIO_RESET  | PEGASUS_II)
> +PEGASUS_DEV("EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
> 		DEFAULT_GPIO_RESET)
> -PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
> -		DEFAULT_GPIO_RESET | PEGASUS_II)
> -PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
> -		DEFAULT_GPIO_RESET | HAS_HOME_PNA )
> -PEGASUS_DEV( "Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
> -		DEFAULT_GPIO_RESET | PEGASUS_II)
> -PEGASUS_DEV( "Linksys USBVPN1", VENDOR_LINKSYS2, 0x08b4,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "OCT Inc.", VENDOR_OCT, 0x0109,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
> -		DEFAULT_GPIO_RESET | PEGASUS_II)
> -PEGASUS_DEV( "SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
> -		DEFAULT_GPIO_RESET )
> -PEGASUS_DEV( "SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> -PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
> -		DEFAULT_GPIO_RESET | PEGASUS_II )
> +PEGASUS_DEV("GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("IO DATA USB ETX-US2", VENDOR_IODATA, 0x093a,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
> +		DEFAULT_GPIO_RESET | HAS_HOME_PNA)
> +PEGASUS_DEV("Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Linksys USBVPN1", VENDOR_LINKSYS2, 0x08b4,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("OCT Inc.", VENDOR_OCT, 0x0109,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
> +		DEFAULT_GPIO_RESET)
> +PEGASUS_DEV("SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
> +PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
> +		DEFAULT_GPIO_RESET | PEGASUS_II)
>
>
> #endif	/* PEGASUS_DEV */
> -- 
> 1.7.1
>

^ permalink raw reply

* Re: [PATCH] ip: correctly report 802.15.4 link type
From: Stephen Hemminger @ 2010-06-26 23:51 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netdev

OK but long-term fix is to get rid of hardcoded table

Jan Engelhardt <jengelh@medozas.de> wrote:

>Up until now, the "hardwpan" devices were displayed as link/[804].
>
>Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
>---
> lib/ll_types.c |    3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
>diff --git a/lib/ll_types.c b/lib/ll_types.c
>index 846cdb0..1cc46b6 100644
>--- a/lib/ll_types.c
>+++ b/lib/ll_types.c
>@@ -125,6 +125,9 @@ __PF(IEEE80211_PRISM,ieee802.11/prism)
> #ifdef ARPHRD_IEEE80211_RADIOTAP
> __PF(IEEE80211_RADIOTAP,ieee802.11/radiotap)
> #endif
>+#ifdef ARPHRD_IEEE802154
>+__PF(IEEE802154, ieee802.15.4)
>+#endif
> #ifdef ARPHRD_NONE
> __PF(NONE, none)
> #endif
>-- 
>1.7.1
>

^ permalink raw reply

* [PATCH 2/2] ipv6: Use interface max_desync_factor instead of static default
From: Ben Hutchings @ 2010-06-26 21:42 UTC (permalink / raw)
  To: David Miller
  Cc: Hideaki YOSHIFUJI, Patrick McHardy, 514646, Piotr Lewandowski,
	netdev
In-Reply-To: <1277588267.26161.300.camel@localhost>

max_desync_factor can be configured per-interface, but nothing is
using the value.

Reported-by: Piotr Lewandowski <piotr.lewandowski@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Also compile-tested only.

Note that there is nothing to stop temp_prefered_lft being set smaller
than max_desync_factor, which can result in underflow in calculation of
tmp_prefered_lft in ipv6_create_tempaddr().  However, the same applies
to the current static variable desync_factor.

Ben.

 net/ipv6/addrconf.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1459eed..ec8c92f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -121,8 +121,6 @@ static inline void addrconf_sysctl_unregister(struct inet6_dev *idev)
 static int __ipv6_regen_rndid(struct inet6_dev *idev);
 static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
 static void ipv6_regen_rndid(unsigned long data);
-
-static int desync_factor = MAX_DESYNC_FACTOR * HZ;
 #endif
 
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev);
@@ -890,7 +888,8 @@ retry:
 			      idev->cnf.temp_valid_lft);
 	tmp_prefered_lft = min_t(__u32,
 				 ifp->prefered_lft,
-				 idev->cnf.temp_prefered_lft - desync_factor / HZ);
+				 idev->cnf.temp_prefered_lft -
+				 idev->cnf.max_desync_factor);
 	tmp_plen = ifp->prefix_len;
 	max_addresses = idev->cnf.max_addresses;
 	tmp_cstamp = ifp->cstamp;
@@ -1650,7 +1649,8 @@ static void ipv6_regen_rndid(unsigned long data)
 
 	expires = jiffies +
 		idev->cnf.temp_prefered_lft * HZ -
-		idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - desync_factor;
+		idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time -
+		idev->cnf.max_desync_factor * HZ;
 	if (time_before(expires, jiffies)) {
 		printk(KERN_WARNING
 			"ipv6_regen_rndid(): too short regeneration interval; timer disabled for %s.\n",
-- 
1.7.1



^ permalink raw reply related

* [PATCH 1/2] ipv6: Clamp reported valid_lft to a minimum of 0
From: Ben Hutchings @ 2010-06-26 21:37 UTC (permalink / raw)
  To: David Miller
  Cc: Hideaki YOSHIFUJI, Patrick McHardy, 514644, Piotr Lewandowski,
	netdev

Since addresses are only revalidated every 2 minutes, the reported
valid_lft can underflow shortly before the address is deleted.
Clamp it to a minimum of 0, as for prefered_lft.

Reported-by: Piotr Lewandowski <piotr.lewandowski@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This is compile-tested only.  I don't claim any familiarity with this
code.

Ben.

 net/ipv6/addrconf.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b97bb1f..1459eed 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3492,8 +3492,12 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
 				preferred -= tval;
 			else
 				preferred = 0;
-			if (valid != INFINITY_LIFE_TIME)
-				valid -= tval;
+			if (valid != INFINITY_LIFE_TIME) {
+				if (valid > tval)
+					valid -= tval;
+				else
+					valid = 0;
+			}
 		}
 	} else {
 		preferred = INFINITY_LIFE_TIME;
-- 
1.7.1




^ permalink raw reply related


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