Re: [RFC][PATCH -mm take4 6/6] add ioctls for adding/removing target

2007-04-19 Thread David Miller
From: Stephen Hemminger <[EMAIL PROTECTED]>
Date: Thu, 19 Apr 2007 22:39:09 -0700

> Should't this just be a network ioctl against an UDP (AF_INET,
> SOCK_DGRAM) socket?  Also consider netconsole over IPV6 for future
> enhancement.

If it's on a socket use a socket option :-)
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Olympic (IBM PCI tokenring): handle return codes of register_netdev

2007-04-19 Thread Borislav Petkov
Handle return codes of register_netdev().

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>


Index: 21-rc7/drivers/net/tokenring/olympic.c
===
--- 21-rc7.orig/drivers/net/tokenring/olympic.c
+++ 21-rc7/drivers/net/tokenring/olympic.c
@@ -264,7 +264,10 @@ static int __devinit olympic_probe(struc
SET_NETDEV_DEV(dev, &pdev->dev);
 
pci_set_drvdata(pdev,dev) ; 
-   register_netdev(dev) ; 
+
+   if (register_netdev(dev))
+   goto op_free_iomap;
+
printk("Olympic: %s registered as: 
%s\n",olympic_priv->olympic_card_name,dev->name);
if (olympic_priv->olympic_network_monitor) { /* Must go after 
register_netdev as we need the device name */ 
char proc_name[20] ; 
@@ -281,7 +284,8 @@ op_free_iomap:
if (olympic_priv->olympic_lap)
iounmap(olympic_priv->olympic_lap);
 
-   free_netdev(dev);
+   if (dev)
+   free_netdev(dev);
 op_release_dev:
pci_release_regions(pdev); 
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH -mm take4 6/6] add ioctls for adding/removing target

2007-04-19 Thread Stephen Hemminger
On Thu, 19 Apr 2007 21:16:30 -0700
Andrew Morton <[EMAIL PROTECTED]> wrote:

> On Wed, 18 Apr 2007 21:14:55 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:
> 
> > From: Keiichi KII <[EMAIL PROTECTED]>
> > 
> > We add ioctls for adding/removing target.
> > If we use NETCONSOLE_ADD_TARGET ioctl, 
> > we can dynamically add netconsole target.
> > If we use NETCONSOLE_REMOVE_TARGET ioctl,
> > we can dynamically remoe netconsole target.
> > 
> > ...
> >
> > --- mm.orig/drivers/net/netconsole.c
> > +++ mm/drivers/net/netconsole.c
> > @@ -47,6 +47,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  
> >  MODULE_AUTHOR("Maintainer: Matt Mackall <[EMAIL PROTECTED]>");
> >  MODULE_DESCRIPTION("Console driver for network interfaces");
> > @@ -313,6 +314,64 @@ static void release_target(struct kobjec
> > remove_target(nt);
> >  }
> >  
> > +static int netconsole_ioctl(struct inode *inode, struct file *file,
> > +   unsigned int cmd, unsigned long arg)
> > +{
> > +   int id, count;
> > +   char config[256];
> > +   char *cur;
> > +   struct netconsole_request req;
> > +   struct netconsole_target *nt, *tmp;
> > +   void __user *argp = (void __user *)arg;
> > +
> > +   switch (cmd) {
> > +   case NETCON_ADD_TARGET:
> > +   printk(KERN_INFO "netconsole: cmd=NETCON_ADD_TARGET\n");
> > +   if (copy_from_user(&req, argp, sizeof(req)))
> > +   return -EFAULT;
> > +   cur = config;
> > +   count = sprintf(cur, "%d@", req.local_port);
> > +   cur += count;
> > +   if (req.local_ip)
> > +   count = sprintf(cur, "%d.%d.%d.%d/",
> > +   NIPQUAD(req.local_ip));
> > +   else
> > +   count = sprintf(cur, "/");
> > +   cur += count;
> > +   count = sprintf(cur, "%s,", req.netdev_name);
> > +   cur += count;
> > +   count = sprintf(cur, "%d@", req.remote_port);
> > +   cur += count;
> > +   count = sprintf(cur, "%d.%d.%d.%d/",
> > +   NIPQUAD(req.remote_ip));
> > +   cur += count;
> > +   count = sprintf(cur, "%02x:%02x:%02x:%02x:%02x:%02x",
> > +   req.remote_mac[0], req.remote_mac[1],
> > +   req.remote_mac[2], req.remote_mac[3],
> > +   req.remote_mac[4], req.remote_mac[5]);
> > +   printk(KERN_INFO "count = %d config=[%s]\n", count, config);
> > +   if (add_target(config))
> > +   return -EINVAL;
> > +   break;
> > +   case NETCON_REMOVE_TARGET:
> > +   printk(KERN_INFO "netconsole: cmd=NETCON_REMOVE_TARGET\n");
> > +   if (copy_from_user(&id, argp, sizeof(int)))
> > +   return -EFAULT;
> > +   printk(KERN_INFO "netconsole: id=%d\n", id);
> > +   list_for_each_entry_safe(nt, tmp, &target_list, list) {
> > +   if (nt->id == id) {
> > +   kobject_unregister(&nt->obj);
> > +   break;
> > +   }
> > +   }
> > +   break;
> > +   default:
> > +   return -ENOTTY;
> > +   }
> > +
> > +   return 0;
> > +}
> > +
> >  static struct sysfs_ops target_sysfs_ops = {
> > .show = show_target_attr,
> > .store = store_target_attr
> > @@ -324,9 +383,14 @@ static struct kobj_type target_ktype = {
> > .default_attrs = target_attrs,
> >  };
> >  
> > +static struct file_operations miscdev_fops = {
> > +   .ioctl = netconsole_ioctl,
> > +};
> > +
> >  static struct miscdevice netconsole_miscdev = {
> > .minor = MISC_DYNAMIC_MINOR,
> > .name = "netconsole",
> > +   .fops = &miscdev_fops,
> >  };
> >  
> >  static struct notifier_block netconsole_notifier = {
> 
> We'll need to wake up the net guys to get an opinion here.  Using an
> ioctl() against a miscdev is rather untypical for networking.  I'd expect
> they'd prefer to see a netlink-based interface to userspace.

Should't this just be a network ioctl against an UDP (AF_INET, SOCK_DGRAM) 
socket?
Also consider netconsole over IPV6 for future enhancement.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] CONFIG_PACKET_MMAP should depend on MMU

2007-04-19 Thread Aubrey Li

On 4/18/07, David Howells <[EMAIL PROTECTED]> wrote:

Aubrey Li <[EMAIL PROTECTED]> wrote:

> Here, in the attachment I wrote a small test app. Please correct if
> there is anything wrong, and feel free to improve it.

Okay... I have that working... probably.  I don't know what output it's
supposed to produce, but I see this:

# /packet-mmap/sample_packet_mmap
00-00-00-01-00-00-00-8a-00-00-00-8a-00-42-00-50-
38-43-13-a0-00-07-ff-3c-00-00-00-00-00-00-00-00-
00-11-08-00-00-00-00-01-00-01-00-06-00-d0-b7-de-
32-7b-00-00-00-00-00-00-00-00-00-00-00-00-00-00-
00-00-00-90-cc-a2-75-6b-00-d0-b7-de-32-7b-08-00-
45-00-00-7c-00-00-40-00-40-11-b4-13-c0-a8-02-80-
c0-a8-02-8d-08-01-03-20-00-68-8e-65-7f-5b-7e-03-
00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-
00-00-00-00-00-00-00-00-00-00-00-01-00-00-81-a4-
00-00-00-01-00-00-00-00-00-00-00-00-00-1d-b8-86-
00-00-10-00-ff-ff-ff-ff-00-00-0e-f0-00-00-09-02-
01-cb-03-16-46-26-38-0d-00-00-00-00-46-26-38-1e-
00-00-00-00-46-26-38-1e-00-00-00-00-00-00-00-00-
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00- [repeated]

Does that look reasonable?

I've attached the preliminary patch.  Note four things about it:

 (1) I've had to add the get_unmapped_area() op to the proto_ops struct, but
 I've only done it for CONFIG_MMU=n as making it available for CONFIG_MMU=y
 could cause problems.

 (2) There's a race between packet_get_unmapped_area() being called and
 packet_mmap() being called.

 (3) I've added an extra check into packet_set_ring() to make sure the caller
 isn't asking for a combination of buffer size and count that will exceed
 ULONG_MAX.  This protects a multiply done elsewhere.

 (4) The entire data buffer is allocated as one contiguous lump in NOMMU-mode.

David

---
[PATCH] NOMMU: Support mmap() on AF_PACKET sockets

From: David Howells <[EMAIL PROTECTED]>

Support mmap() on AF_PACKET sockets in NOMMU-mode kernels.

Signed-Off-By: David Howells <[EMAIL PROTECTED]>
---

 include/linux/net.h|7 +++
 include/net/sock.h |8 +++
 net/core/sock.c|   10 
 net/packet/af_packet.c |  118 
 net/socket.c   |   77 +++
 5 files changed, 219 insertions(+), 1 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index 4db21e6..9e77cf6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -161,6 +161,11 @@ struct proto_ops {
int (*recvmsg)   (struct kiocb *iocb, struct socket *sock,
  struct msghdr *m, size_t total_len,
  int flags);
+#ifndef CONFIG_MMU
+   unsigned long   (*get_unmapped_area)(struct file *file, struct socket 
*sock,
+unsigned long addr, unsigned long 
len,
+unsigned long pgoff, unsigned long 
flags);
+#endif
int (*mmap)  (struct file *file, struct socket *sock,
  struct vm_area_struct * vma);
ssize_t (*sendpage)  (struct socket *sock, struct page *page,
@@ -191,6 +196,8 @@ extern int   sock_sendmsg(struct socket *sock, 
struct msghdr *msg,
 extern int  sock_recvmsg(struct socket *sock, struct msghdr *msg,
  size_t size, int flags);
 extern int  sock_map_fd(struct socket *sock);
+extern void sock_make_mappable(struct socket *sock,
+   unsigned long prot);
 extern struct socket *sockfd_lookup(int fd, int *err);
 #define sockfd_put(sock) fput(sock->file)
 extern int  net_ratelimit(void);
diff --git a/include/net/sock.h b/include/net/sock.h
index 2c7d60c..d91edea 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -841,6 +841,14 @@ extern int  sock_no_sendmsg(struct 
kiocb *, struct socket *,
struct msghdr *, size_t);
 extern int  sock_no_recvmsg(struct kiocb *, struct socket 
*,
struct msghdr *, size_t, int);
+#ifndef CONFIG_MMU
+extern unsigned long   sock_no_get_unmapped_area(struct file *,
+ struct socket *,
+ unsigned long,
+ unsigned long,
+ unsigned long,
+ unsigned long);
+#endif
 extern int sock_no_mmap(struct file *file,
 struct socket *sock,
 struct vm_area_struct *vma);
diff --g

Re: [RFC][PATCH -mm take4 6/6] add ioctls for adding/removing target

2007-04-19 Thread Andrew Morton
On Wed, 18 Apr 2007 21:14:55 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> From: Keiichi KII <[EMAIL PROTECTED]>
> 
> We add ioctls for adding/removing target.
> If we use NETCONSOLE_ADD_TARGET ioctl, 
> we can dynamically add netconsole target.
> If we use NETCONSOLE_REMOVE_TARGET ioctl,
> we can dynamically remoe netconsole target.
> 
> ...
>
> --- mm.orig/drivers/net/netconsole.c
> +++ mm/drivers/net/netconsole.c
> @@ -47,6 +47,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  MODULE_AUTHOR("Maintainer: Matt Mackall <[EMAIL PROTECTED]>");
>  MODULE_DESCRIPTION("Console driver for network interfaces");
> @@ -313,6 +314,64 @@ static void release_target(struct kobjec
>   remove_target(nt);
>  }
>  
> +static int netconsole_ioctl(struct inode *inode, struct file *file,
> + unsigned int cmd, unsigned long arg)
> +{
> + int id, count;
> + char config[256];
> + char *cur;
> + struct netconsole_request req;
> + struct netconsole_target *nt, *tmp;
> + void __user *argp = (void __user *)arg;
> +
> + switch (cmd) {
> + case NETCON_ADD_TARGET:
> + printk(KERN_INFO "netconsole: cmd=NETCON_ADD_TARGET\n");
> + if (copy_from_user(&req, argp, sizeof(req)))
> + return -EFAULT;
> + cur = config;
> + count = sprintf(cur, "%d@", req.local_port);
> + cur += count;
> + if (req.local_ip)
> + count = sprintf(cur, "%d.%d.%d.%d/",
> + NIPQUAD(req.local_ip));
> + else
> + count = sprintf(cur, "/");
> + cur += count;
> + count = sprintf(cur, "%s,", req.netdev_name);
> + cur += count;
> + count = sprintf(cur, "%d@", req.remote_port);
> + cur += count;
> + count = sprintf(cur, "%d.%d.%d.%d/",
> + NIPQUAD(req.remote_ip));
> + cur += count;
> + count = sprintf(cur, "%02x:%02x:%02x:%02x:%02x:%02x",
> + req.remote_mac[0], req.remote_mac[1],
> + req.remote_mac[2], req.remote_mac[3],
> + req.remote_mac[4], req.remote_mac[5]);
> + printk(KERN_INFO "count = %d config=[%s]\n", count, config);
> + if (add_target(config))
> + return -EINVAL;
> + break;
> + case NETCON_REMOVE_TARGET:
> + printk(KERN_INFO "netconsole: cmd=NETCON_REMOVE_TARGET\n");
> + if (copy_from_user(&id, argp, sizeof(int)))
> + return -EFAULT;
> + printk(KERN_INFO "netconsole: id=%d\n", id);
> + list_for_each_entry_safe(nt, tmp, &target_list, list) {
> + if (nt->id == id) {
> + kobject_unregister(&nt->obj);
> + break;
> + }
> + }
> + break;
> + default:
> + return -ENOTTY;
> + }
> +
> + return 0;
> +}
> +
>  static struct sysfs_ops target_sysfs_ops = {
>   .show = show_target_attr,
>   .store = store_target_attr
> @@ -324,9 +383,14 @@ static struct kobj_type target_ktype = {
>   .default_attrs = target_attrs,
>  };
>  
> +static struct file_operations miscdev_fops = {
> + .ioctl = netconsole_ioctl,
> +};
> +
>  static struct miscdevice netconsole_miscdev = {
>   .minor = MISC_DYNAMIC_MINOR,
>   .name = "netconsole",
> + .fops = &miscdev_fops,
>  };
>  
>  static struct notifier_block netconsole_notifier = {

We'll need to wake up the net guys to get an opinion here.  Using an
ioctl() against a miscdev is rather untypical for networking.  I'd expect
they'd prefer to see a netlink-based interface to userspace.

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH -mm take4 4/6] using symlink for the net_device

2007-04-19 Thread Andrew Morton
On Wed, 18 Apr 2007 21:11:14 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> From: Keiichi KII <[EMAIL PROTECTED]>
> 
> We use symbolic link for net_device.

As Stephen said, please fully document the new interfaces in netconsole.txt.

Please also cc netdev@vger.kernel.org on all networking-related patches.

> +static char *make_netdev_class_name(char *netdev_name);
> +static int netconsole_event(struct notifier_block *this, unsigned long event,
> + void *ptr);

Please try order things in a way which minimises the number of
forward-declarations, as long as such ordering doesn't make the code
illogical (it usually doesn't).

>  static int miscdev_configured;
>  
> @@ -274,12 +277,77 @@ static struct miscdevice netconsole_misc
>   .name = "netconsole",
>  };
>  
> +static struct notifier_block netconsole_notifier = {
> + .notifier_call = netconsole_event,
> +};
> +
>  static int setup_target_sysfs(struct netconsole_target *nt)
>  {
> + int retval = 0;
> + char *name;
> +
>   kobject_set_name(&nt->obj, "port%d", nt->id);
>   nt->obj.parent = &netconsole_miscdev.this_device->kobj;
>   nt->obj.ktype = &target_ktype;
> - return kobject_register(&nt->obj);
> + retval = kobject_register(&nt->obj);
> + name = make_netdev_class_name(nt->np.dev_name);
> + if (IS_ERR(name))
> + return PTR_ERR(name);
> + retval = sysfs_create_link(&nt->obj, &nt->np.dev->dev.kobj, name);
> + kfree(name);
> +
> + return retval;
> +}
> +
> +static char *make_netdev_class_name(char *netdev_name)
> +{
> + int size;
> + char *name;
> + char *netdev_class_prefix = "net:";
> +
> + size = strlen(netdev_class_prefix) + strlen(netdev_name) + 1;
> + name = kmalloc(size, GFP_KERNEL);
> + if (!name) {
> + printk(KERN_ERR "netconsole: kmalloc() failed!\n");
> + return ERR_PTR(-ENOMEM);
> + }
> + strcpy(name, netdev_class_prefix);
> + strcat(name, netdev_name);
> +
> + return name;
> +}

I think this whole function can be replaced by one call to kasprintf()

> +static int netconsole_event(struct notifier_block *this, unsigned long event,
> + void *ptr)
> +{
> + int error = 0;
> + char *old_link_name = NULL, *new_link_name = NULL;
> + struct netconsole_target *nt;
> + struct net_device *dev = ptr;
> +
> + if (event == NETDEV_CHANGENAME) {
> + spin_lock(&target_list_lock);
> + list_for_each_entry(nt, &target_list, list) {
> + if (nt->np.dev != dev)
> + continue;
> + new_link_name = make_netdev_class_name(dev->name);
> + old_link_name =
> + make_netdev_class_name(nt->np.dev_name);

The error return from make_netdev_class_name() is being ignored here.

> + sysfs_remove_link(&nt->obj, old_link_name);
> + error = sysfs_create_link(&nt->obj,
> +   &nt->np.dev->dev.kobj,
> +   new_link_name);
> + if (error)
> + printk(KERN_ERR "can't create link: %s\n",
> +new_link_name);
> + strcpy(nt->np.dev_name, dev->name);
> + kfree(new_link_name);
> + kfree(old_link_name);
> + }
> + spin_unlock(&target_list_lock);
> + }
> +
> + return NOTIFY_DONE;
>  }

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-19 Thread Andrew Morton
On Wed, 18 Apr 2007 21:06:41 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> From: Keiichi KII <[EMAIL PROTECTED]>
> 
> This patch contains the following changes for supporting multiple logging
>  agents.
> 
> 1. extend netconsole to multiple netpolls
>To send kernel messages to multiple logging agents, extend netcosnole
> to be able to use multiple netpolls. Each netpoll sends kernel messages
> to its own logging agent.
> 
> 2. change config parameter format
>We change config parameter format from single configuration to multiple 
>configurations separated by ';'.
> 
>ex) sending kernel messages to destination1 and destination2 using eth0.
> modprobe netconsole \
> netconsole="@/eth0,@[destination1]/;@/eth0,@[destination2]/"
> 
> 3. introduce CONFIG_NETCONSOLE_DYNCON config to change between 
>existing netconsole and netconsole applying the above function.
> 
> Signed-off-by: Keiichi KII <[EMAIL PROTECTED]>
> Signed-off-by: Takayoshi Kochi <[EMAIL PROTECTED]>
> ---
> Index: mm/drivers/net/netconsole.c
> ===
> --- mm.orig/drivers/net/netconsole.c
> +++ mm/drivers/net/netconsole.c
> @@ -61,15 +61,102 @@ static struct netpoll np = {
>   .remote_port = ,
>   .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
>  };
> -static int configured = 0;
>  
>  #define MAX_PRINT_CHUNK 1000
>  
> +#ifdef CONFIG_NETCONSOLE_DYNCON
> +struct netconsole_target {
> + struct list_head list;
> + int id;
> + struct netpoll np;
> +};
> +
> +static LIST_HEAD(target_list);
> +static DEFINE_SPINLOCK(target_list_lock);
> +
> +static int add_target(char* target_config);
> +static void remove_target(struct netconsole_target *nt);
> +static void cleanup_netconsole(void);

I started to do some cleanups and fixups here, but abandoned it when it was
all getting a bit large.

Here are some fixes against this patch:


- Fix Kconfig

- Avoid need for forward-declared statics

- Coding style:

fix `if' layout
unneeded braces

- use spin_lock_irqsave() and _restore()



diff -puN drivers/net/Kconfig~netconsole-support-multiple-logging-fix 
drivers/net/Kconfig
--- a/drivers/net/Kconfig~netconsole-support-multiple-logging-fix
+++ a/drivers/net/Kconfig
@@ -2965,9 +2965,11 @@ config NETCONSOLE_DYNCON
bool "Support for multiple logging and UI for netconsole"
depends on NETCONSOLE
---help---
-   This option enables multiple logging and changing dynamically
-configurations (e.g. IP adderss, port number and so on)
-by using sysfs and ioctl.
+ This option enables multiple logging and changing dynamically
+ configurations (e.g. IP address, port number and so on)
+ by using sysfs and ioctl.
+ See  for details.
+
 endif #NETDEVICES
 
 config NETPOLL
diff -puN drivers/net/netconsole.c~netconsole-support-multiple-logging-fix 
drivers/net/netconsole.c
--- a/drivers/net/netconsole.c~netconsole-support-multiple-logging-fix
+++ a/drivers/net/netconsole.c
@@ -74,10 +74,6 @@ struct netconsole_target {
 static LIST_HEAD(target_list);
 static DEFINE_SPINLOCK(target_list_lock);
 
-static int add_target(char* target_config);
-static void remove_target(struct netconsole_target *nt);
-static void cleanup_netconsole(void);
-
 static int add_target(char* target_config)
 {
int retval = 0;
@@ -142,27 +138,24 @@ static void write_msg(struct console *co
if (list_empty(&target_list))
return;
 
-   local_irq_save(flags);
-   spin_lock(&target_list_lock);
+   spin_lock_irqsave(&target_list_lock, flags);
 
-   for(left = len; left; ) {
+   for (left = len; left; ) {
frag = min(left, MAX_PRINT_CHUNK);
-   list_for_each_entry(target, &target_list, list) {
+   list_for_each_entry(target, &target_list, list)
netpoll_send_udp(&target->np, msg, frag);
-   }
msg += frag;
left -= frag;
}
 
-   spin_unlock(&target_list_lock);
-   local_irq_restore(flags);
+   spin_unlock_irqrestore(&target_list_lock, flags);
 #else
if (!np.dev)
return;
 
local_irq_save(flags);
 
-   for(left = len; left; ) {
+   for (left = len; left; ) {
frag = min(left, MAX_PRINT_CHUNK);
netpoll_send_udp(&np, msg, frag);
msg += frag;
@@ -189,6 +182,20 @@ static int __init option_setup(char *opt
 __setup("netconsole=", option_setup);
 #endif
 
+static void cleanup_netconsole(void)
+{
+#ifdef CONFIG_NETCONSOLE_DYNCON
+   struct netconsole_target *nt, *tmp;
+
+   unregister_console(&netconsole);
+   list_for_each_entry_safe(nt, tmp, &target_list, list)
+   remove_target(nt);
+#else
+   unregister_console(&netconsole);
+   netpoll_cleanup(&np);
+#endif /* CONFIG_NETCONSOLE_DYNCON */
+}
+
 static int __init in

Re: [RFC][PATCH -mm take4 3/6] add interface for netconsole using sysfs

2007-04-19 Thread Andrew Morton
On Wed, 18 Apr 2007 21:08:45 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> +static ssize_t store_local_port(struct netconsole_target *nt, const char 
> *buf,
> + size_t count)
> +{
> + spin_lock(&target_list_lock);
> + nt->np.local_port = simple_strtol(buf, NULL, 10);
> + spin_unlock(&target_list_lock);
> +
> + return count;
> +}
> +
> +static ssize_t store_remote_port(struct netconsole_target *nt, const char 
> *buf,
> + size_t count)
> +{
> + spin_lock(&target_list_lock);
> + nt->np.remote_port = simple_strtol(buf, NULL, 10);
> + spin_unlock(&target_list_lock);
> +
> + return count;
> +}

I think that you'll find that the locking in here does nothing useful and
can be removed.


Also, write_msg() can be called from IRQ context, so this lock _must_ be
taken with spin_lock_irq[save] basically everywhere - the code as-is can be
deadlocked.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Getting the new RxRPC patches upstream

2007-04-19 Thread Herbert Xu
David Miller <[EMAIL PROTECTED]> wrote:
> 
> I applied already the patches I thought were appropriate,
> you had some crypto layer changes that you need to work
> out with Herbert Xu before the rest can be applied.

He has already fixed it by using the scatterlist interface for now.
So the last set of patches he posted is ready for merging into
net-2.6.22.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 13:24:12 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> From: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
> Date: Thu, 19 Apr 2007 21:04:54 +0900 (JST)
> 
> > net-2.6.22-20070417-stats-20070419
> 
> I tried to pull this but I killed it before it tried to merge
> because it looked very large:
> 
> remote: Generating pack...
> remote: Done counting 5200 objects.
> remote: Result has 4227 objects.
> 
> such a small set of changes should not need so many objects
> :-)
:
> I'm going to rebase my tree today, so please resubmit this work
> after I sent a notification here that I have done so.

Hmm, strange; something was wrong.
Any way, of course, I will do so.

Regards,

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 8320] New: replacing route in kernel doesn't send netlink message

2007-04-19 Thread Andrew Morton
On Thu, 19 Apr 2007 14:12:19 +0200
Patrick McHardy <[EMAIL PROTECTED]> wrote:

> Milan Kocián wrote:
> > ok, here is new version. Sign is in patch. Is it correct?
> > 
> > --- a/net/ipv4/fib_hash.c   2007-04-18 12:50:11.0 +0200
> > +++ b/net/ipv4/fib_hash.c   2007-04-19 10:21:04.267136960 +0200
> > [...]
> > Signed-off-by: Milan Kocian <[EMAIL PROTECTED]>
> 
> 
> Looks good, thanks.
> 
> Acked-by: Patrick McHardy <[EMAIL PROTECTED]>

Can we please have a final version of this with appropriate Subject:
and complete changelogging?

Thanks.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AF_PACKET how to get the original netdev from a packet received from a bonded master

2007-04-19 Thread Chris Friesen

Chris Leech wrote:


Just to give you an idea of our motivation around this, we're looking
at layer 2 configuration protocols implemented from user space.


I'd like to second the intent of this patch.  We've been maintaining a 
patch against 2.6.10 for a while now that exports the original ingress 
device to userspace via ancilliary data.  We use it in combination with 
bonding.


Was never submitted to mainline because we're on an old kernel.

Chris
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


tiacx100 problem

2007-04-19 Thread Jonathan Hutchins
I believe the following error message is from the tiacx driver, and is not
related to the firmware:
"unknown chip and EEPROM version combination (ACX100, v0), don't know how
to parse config options yet. Please report"

This is for an SMC2435W, part number 99-012084-036.  While it appears to
load, the card registers as eth1 instead of wlan0, and iwlist reports
"eth1  Interface doesn't support scanning."  iwconfig will not
actually set the essid for the card.

Running Mandriva 2007.1, kernel 2.6.17-5mdv on a Toshiba Satellite A15-S129.

This card worked under Mandriva 9.1.

The firmware source page listed on sourceforge's site is no longer available.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-19 Thread Eric Dumazet

David Miller a écrit :

From: Eric Dumazet <[EMAIL PROTECTED]>
Date: Thu, 19 Apr 2007 16:14:23 +0200


On Wed, 18 Apr 2007 13:04:22 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:


Although I don't think gcc does anything fancy since we don't
use memcmp().  It's a tradeoff, we'd like to use unsigned long
comparisons when both objects are aligned correctly but we also
don't want it to use any more than one potentially mispredicted
branch.

Again, memcmp() *cannot* be optimized, because its semantic is to compare bytes.

memcpy() can take into account alignement if known at compile time, not memcmp()

http://lists.openwall.net/netdev/2007/03/13/31


I was prehaps thinking about strlen() where I know several
implementations work a word at a time even though it is
a byte-based operation:


#define LO_MAGIC 0x01010101
#define HI_MAGIC 0x80808080
 ...
 sethi  %hi(HI_MAGIC), %o4
 ...
 or %o4, %lo(HI_MAGIC), %o3
 ...
 sethi  %hi(LO_MAGIC), %o4
 ...
 or %o4, %lo(LO_MAGIC), %o2
 ...
8:
ld  [%o0], %o5
2:
sub %o5, %o2, %o4
andcc   %o4, %o3, %g0
be,pt   %icc, 8b
 add%o0, 4, %o0


I figured some similar trick could be done with strcmp() and
memcmp().




Hum, I was refering to IA64 (or the more spreaded x86 arches), that is litle 
endian AFAIK.


On big endian machines, a compiler can indeed perform some word tricks for 
memcmp() if it knows at compile time both pointers are word aligned.


PowerPc example (xlc compiler)

int func(const unsigned int *a, const unsigned int *b)
{
return memcmp(a, b, 6);
}

.func:  # 0x (H.10.NO_SYMBOL)
l   r5,0(r3)
l   r0,0(r4)
cmp 0,r5,r0
bc  BO_IF_NOT,CR0_EQ,__L2c
lhz r3,4(r3)
lhz r0,4(r4)
sf  r0,r0,r3
sfzer3,r0
a   r0,r3,r0
aze r3,r0
bcr BO_ALWAYS,CR0_LT
__L2c:  # 0x002c (H.10.NO_SYMBOL+0x2c)
sf  r0,r0,r5
sfzer3,r0
a   r0,r3,r0
aze r3,r0
bcr BO_ALWAYS,CR0_LT


But to compare 6 bytes, known to be aligned to even addresses, current code is 
just fine and portable. We *could* use arch/endian specific tricks to save one 
or two cycles, but who really wants that ?



-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread David Miller
From: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
Date: Thu, 19 Apr 2007 21:04:54 +0900 (JST)

> net-2.6.22-20070417-stats-20070419

I tried to pull this but I killed it before it tried to merge
because it looked very large:

remote: Generating pack...
remote: Done counting 5200 objects.
remote: Result has 4227 objects.

such a small set of changes should not need so many objects
:-)

I imagined you created your net-2.6.22 tree from a more
recent clone of Linus's tree, and therefore I'd end
up getting all of those changes too.

What I'll do is try to pull your work into another tree,
extract out just the ipv6 changes discussed here and
then apply them as patches to my net-2.6.22 tree.

Actually, a pull into net-2.6.22 didn't at all, see below :-(

I'm going to rebase my tree today, so please resubmit this work
after I sent a notification here that I have done so.

Thank you.

[EMAIL PROTECTED]:~/src/GIT$ git clone -l -s net-2.6.22/.git ipv6-2.6.22
Initialized empty Git repository in /home/davem/src/GIT/ipv6-2.6.22/.git/
Checking files out...
 100% (21559/21559) done
[EMAIL PROTECTED]:~/src/GIT$ cd ipv6-2.6.22
[EMAIL PROTECTED]:~/src/GIT/ipv6-2.6.22$ git pull 
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git 
net-2.6.22-20070417-stats-20070419
remote: Generating pack...
remote: Done counting 5200 objects.
remote: Result has 4227 objects.
remote: Deltifying 4227 objects.
remote: 
Indexing 4227 objects.
remote: Total 4227, written 4227 (delta 3889), reused 1 (delta 1)
 100% (4227/4227) done
Resolving 3889 deltas.
 100% (3889/3889) done
1377 objects were added to complete this thin pack.
 100% (22194/22194) done
Auto-merged Documentation/feature-removal-schedule.txt
Auto-merged Documentation/networking/ip-sysctl.txt
Auto-merged arch/ia64/hp/sim/simeth.c
Auto-merged arch/ia64/sn/kernel/xpnet.c
Auto-merged drivers/char/random.c
Auto-merged drivers/connector/connector.c
Auto-merged drivers/infiniband/ulp/ipoib/ipoib_cm.c
Auto-merged drivers/isdn/gigaset/usb-gigaset.c
Auto-merged drivers/isdn/hysdn/hycapi.c
CONFLICT (content): Merge conflict in drivers/isdn/hysdn/hycapi.c
Auto-merged drivers/isdn/pcbit/capi.c
CONFLICT (content): Merge conflict in drivers/isdn/pcbit/capi.c
Auto-merged drivers/net/3c523.c
CONFLICT (content): Merge conflict in drivers/net/3c523.c
Auto-merged drivers/net/8139too.c
Auto-merged drivers/net/appletalk/ltpc.c
Auto-merged drivers/net/atari_bionet.c
Auto-merged drivers/net/atari_pamsnet.c
Auto-merged drivers/net/atl1/atl1_main.c
Auto-merged drivers/net/b44.c
Auto-merged drivers/net/bnx2.c
Auto-merged drivers/net/bonding/bond_main.c
Auto-merged drivers/net/chelsio/sge.c
Auto-merged drivers/net/cxgb3/cxgb3_offload.c
Auto-merged drivers/net/cxgb3/sge.c
Auto-merged drivers/net/defxx.c
Auto-merged drivers/net/e1000/e1000_main.c
Auto-merged drivers/net/ehea/ehea_main.c
Auto-merged drivers/net/forcedeth.c
Auto-merged drivers/net/irda/ali-ircc.c
Auto-merged drivers/net/irda/au1k_ir.c
Auto-merged drivers/net/irda/donauboe.c
Auto-merged drivers/net/irda/mcs7780.c
Auto-merged drivers/net/irda/nsc-ircc.c
Auto-merged drivers/net/irda/pxaficp_ir.c
Auto-merged drivers/net/irda/stir4200.c
Auto-merged drivers/net/irda/via-ircc.c
Auto-merged drivers/net/irda/w83977af_ir.c
Auto-merged drivers/net/ixgb/ixgb_main.c
Auto-merged drivers/net/loopback.c
CONFLICT (content): Merge conflict in drivers/net/loopback.c
Auto-merged drivers/net/macb.c
Auto-merged drivers/net/mv643xx_eth.c
Auto-merged drivers/net/myri10ge/myri10ge.c
Auto-merged drivers/net/netxen/netxen_nic_init.c
Auto-merged drivers/net/ni52.c
CONFLICT (content): Merge conflict in drivers/net/ni52.c
Auto-merged drivers/net/qla3xxx.c
Auto-merged drivers/net/r8169.c
Auto-merged drivers/net/sc92031.c
Auto-merged drivers/net/sis190.c
Auto-merged drivers/net/sk98lin/skge.c
Auto-merged drivers/net/skfp/skfddi.c
Auto-merged drivers/net/skge.c
Auto-merged drivers/net/sky2.c
Auto-merged drivers/net/sun3lance.c
Auto-merged drivers/net/sungem.c
Auto-merged drivers/net/tg3.c
Auto-merged drivers/net/tokenring/3c359.c
CONFLICT (content): Merge conflict in drivers/net/tokenring/3c359.c
Auto-merged drivers/net/tokenring/olympic.c
CONFLICT (content): Merge conflict in drivers/net/tokenring/olympic.c
Auto-merged drivers/net/tokenring/smctr.c
Auto-merged drivers/net/tokenring/tms380tr.c
Auto-merged drivers/net/wan/pc300_drv.c
Auto-merged drivers/net/wan/pc300_tty.c
Auto-merged drivers/net/wan/z85230.c
Auto-merged drivers/net/wireless/prism54/islpci_eth.c
CONFLICT (content): Merge conflict in drivers/net/wireless/prism54/islpci_eth.c
Auto-merged drivers/s390/net/qeth_main.c
Auto-merged drivers/scsi/scsi_netlink.c
Auto-merged drivers/scsi/scsi_transport_iscsi.c
Auto-merged drivers/usb/atm/usbatm.c
CONFLICT (content): Merge conflict in drivers/usb/atm/usbatm.c
Auto-merged drivers/usb/net/asix.c
Auto-merged fs/compat_ioctl.c
Auto-merged fs/ecryptfs/netlink.c
Auto-merged include/linux/dccp.h
Auto-merged include/linux/fib_rules.h
CON

Re: Getting the new RxRPC patches upstream

2007-04-19 Thread David Miller
From: David Howells <[EMAIL PROTECTED]>
Date: Thu, 19 Apr 2007 15:18:23 +0100

> Eric W. Biederman <[EMAIL PROTECTED]> wrote:
> 
> > What is the ETA on your patches?
> 
> That depends on Dave Miller now, I think.  I'm assuming they need to go
> through the network GIT tree to get to Linus.  Certainly Andrew Morton seems
> to think so.

I applied already the patches I thought were appropriate,
you had some crypto layer changes that you need to work
out with Herbert Xu before the rest can be applied.

Let me know what the status is of that stuff.

Either way, I don't think it should block Eric's work here.
If his stuff is more ready first, it should go in and then
you have a little bit of patch merging to do that's all.

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sky2 X86-64 PCI synchronization problems

2007-04-19 Thread Stephen Hemminger
I am testing a Gigabyte 965P-S3 motherboard with onboard Marvell
88E8056 Ethernet controller (sky2 driver). The CPU is a Core-2 Duo.
Strange errors occur under moderate load with X86-64 kernel.
Surprisingly, with i386 kernel the controller runs fine without errors.

These look bus/PCI related because:
* there is also 88E8052 on an PCI-E X1 card, it has no problem.
  Similar chip but different bus interface internally (no ram buffer).

* the errors look like the controller didn't access memory correctly:
1. receive status arrives but data buffer not updated
2. transmit descriptor errors, implying that controller read
   a non-initialized memory.
  the command blocks look okay, it's like the device didn't read them.

It looks like a PCI bus synchronization issue. Any ideas for driver
workarounds?

This is the working controller:

03:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8052 PCI-E ASF 
Gigabit Ethernet Controller (rev 22)
Subsystem: Marvell Technology Group Ltd. Marvell RDK-8052
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- TAbort- SERR- http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at net/core/skbuff.c in linux-2.6.21-rc6

2007-04-19 Thread David Miller
From: Paul Mackerras <[EMAIL PROTECTED]>
Date: Sun, 15 Apr 2007 11:05:53 +1000

> I wrote:
> 
> > So this doesn't change process_input_packet(), which treats the case
> > where the first byte is 0xff (PPP_ALLSTATIONS) but the second byte is
> > 0x03 (PPP_UI) as indicating a packet with a PPP protocol number of
> 
> I meant "the second byte is NOT 0x03", of course.

I've applied this patch, thanks Paul.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-19 Thread David Miller
From: Eric Dumazet <[EMAIL PROTECTED]>
Date: Thu, 19 Apr 2007 16:14:23 +0200

> On Wed, 18 Apr 2007 13:04:22 -0700 (PDT)
> David Miller <[EMAIL PROTECTED]> wrote:
> 
> > 
> > Although I don't think gcc does anything fancy since we don't
> > use memcmp().  It's a tradeoff, we'd like to use unsigned long
> > comparisons when both objects are aligned correctly but we also
> > don't want it to use any more than one potentially mispredicted
> > branch.
> 
> Again, memcmp() *cannot* be optimized, because its semantic is to compare 
> bytes.
> 
> memcpy() can take into account alignement if known at compile time, not 
> memcmp()
> 
> http://lists.openwall.net/netdev/2007/03/13/31

I was prehaps thinking about strlen() where I know several
implementations work a word at a time even though it is
a byte-based operation:


#define LO_MAGIC 0x01010101
#define HI_MAGIC 0x80808080
 ...
 sethi  %hi(HI_MAGIC), %o4
 ...
 or %o4, %lo(HI_MAGIC), %o3
 ...
 sethi  %hi(LO_MAGIC), %o4
 ...
 or %o4, %lo(LO_MAGIC), %o2
 ...
8:
ld  [%o0], %o5
2:
sub %o5, %o2, %o4
andcc   %o4, %o3, %g0
be,pt   %icc, 8b
 add%o0, 4, %o0


I figured some similar trick could be done with strcmp() and
memcmp().
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[git patches] net driver fixes

2007-04-19 Thread Jeff Garzik

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/Kconfig   |1 +
 drivers/net/cxgb3/cxgb3_defs.h|5 +-
 drivers/net/cxgb3/cxgb3_offload.c |   69 +++
 drivers/net/cxgb3/t3_hw.c |   18 +++--
 drivers/net/sky2.c|  176 +++--
 drivers/net/sky2.h|   11 +++
 drivers/net/spider_net.c  |2 +-
 7 files changed, 190 insertions(+), 92 deletions(-)

Dave Jiang (1):
  gianfar needs crc32 lib dependency

Divy Le Ray (2):
  cxgb3 - Fix low memory conditions
  cxgb3 - PHY interrupts and GPIO pins.

Linas Vepstas (1):
  spidernet: Fix problem sending IP fragments

Stephen Hemminger (6):
  sky2: disable support for 88E8056
  sky2: handle descriptor errors
  sky2: disable ASF on all chip types
  sky2: EC-U performance and jumbo support
  sky2: no jumbo on Yukon FE
  sky2: version 1.14

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c3f9f59..a3d46ea 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2263,6 +2263,7 @@ config GIANFAR
tristate "Gianfar Ethernet"
depends on 85xx || 83xx || PPC_86xx
select PHYLIB
+   select CRC32
help
  This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
  and MPC86xx family of chips, and the FEC on the 8540.
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index e14862b..483a594 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -67,7 +67,10 @@ static inline union listen_entry *stid2entry(const struct 
tid_info *t,
 static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t,
   unsigned int tid)
 {
-   return tid < t->ntids ? &(t->tid_tab[tid]) : NULL;
+   struct t3c_tid_entry *t3c_tid = tid < t->ntids ?
+   &(t->tid_tab[tid]) : NULL;
+
+   return (t3c_tid && t3c_tid->client) ? t3c_tid : NULL;
 }
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 4864924..199e506 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -508,6 +508,7 @@ void cxgb3_queue_tid_release(struct t3cdev *tdev, unsigned 
int tid)
 
spin_lock_bh(&td->tid_release_lock);
p->ctx = (void *)td->tid_release_list;
+   p->client = NULL;
td->tid_release_list = p;
if (!p->ctx)
schedule_work(&td->tid_release_task);
@@ -623,7 +624,8 @@ static int do_act_open_rpl(struct t3cdev *dev, struct 
sk_buff *skb)
struct t3c_tid_entry *t3c_tid;
 
t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid);
-   if (t3c_tid->ctx && t3c_tid->client && t3c_tid->client->handlers &&
+   if (t3c_tid && t3c_tid->ctx && t3c_tid->client &&
+   t3c_tid->client->handlers &&
t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) {
return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb,
t3c_tid->
@@ -642,7 +644,7 @@ static int do_stid_rpl(struct t3cdev *dev, struct sk_buff 
*skb)
struct t3c_tid_entry *t3c_tid;
 
t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid);
-   if (t3c_tid->ctx && t3c_tid->client->handlers &&
+   if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
t3c_tid->client->handlers[p->opcode]) {
return t3c_tid->client->handlers[p->opcode] (dev, skb,
 t3c_tid->ctx);
@@ -660,7 +662,7 @@ static int do_hwtid_rpl(struct t3cdev *dev, struct sk_buff 
*skb)
struct t3c_tid_entry *t3c_tid;
 
t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid);
-   if (t3c_tid->ctx && t3c_tid->client->handlers &&
+   if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers &&
t3c_tid->client->handlers[p->opcode]) {
return t3c_tid->client->handlers[p->opcode]
(dev, skb, t3c_tid->ctx);
@@ -689,6 +691,28 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb)
}
 }
 
+/*
+ * Returns an sk_buff for a reply CPL message of size len.  If the input
+ * sk_buff has no other users it is trimmed and reused, otherwise a new buffer
+ * is allocated.  The input skb must be of size at least len.  Note that this
+ * operation does not destroy the original skb data even if it decides to reuse
+ * the buffer.
+ */
+static struct sk_buff *cxgb3_get_cpl_reply_skb(struct sk_buff *skb, size_t len,
+  int gfp)
+{
+   if (likely(!skb_cloned(skb))) {
+   BUG_ON(skb->len < len);
+   __skb_trim(skb, len);
+   skb_get(skb);
+   } else {
+   skb = a

Re: Getting the new RxRPC patches upstream

2007-04-19 Thread Eric W. Biederman
David Howells <[EMAIL PROTECTED]> writes:

> Eric W. Biederman <[EMAIL PROTECTED]> wrote:
>
>> Ok.  I don't see any patches in -mm so I was assuming these patches have
>> not been queued up anywhere.
>
> They haven't been quite yet.  Is it your intention to kill these features in
> 2.6.22?

That is my goal, and I have patches that should do it.  We will see what 
happens.

Eric
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gianfar needs crc32 lib dependency

2007-04-19 Thread Jeff Garzik

Dave Jiang wrote:
Gianfar needs crc32 to be selected to compile. 


Signed-off-by: Dave Jiang <[EMAIL PROTECTED]>

--
 drivers/net/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


applied


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.21 1/2] cxgb3 - Fix low memory conditions

2007-04-19 Thread Jeff Garzik

[EMAIL PROTECTED] wrote:

From: Divy Le Ray <[EMAIL PROTECTED]>

Reuse the incoming skb when a clientless abort req is recieved.

The release of RDMA connections HW resources might be deferred in
low memory situations. 
Ensure that no further activity is passed up to the RDMA driver

for these connections.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/cxgb3_defs.h|5 ++-
 drivers/net/cxgb3/cxgb3_offload.c |   69 +++--
 2 files changed, 55 insertions(+), 19 deletions(-)


applied 1-2


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] Current sky2 driver from GIT backported to 2.6.15-1 (FC5)

2007-04-19 Thread Tom Burns

Hi Stephen, list;

 Patch attached backports the current sky2 driver in GIT to 2.6.15-1.
This version works, I don't know if I'm missing anything crucial in
the port.

 It also seems to alleviate problems we have been experiencing (and
are well documented in various forums/lists online) where the ethernet
device would become unresponsive under moderate to heavy loads and
require restarting the interface to come back up.  I found a lot of
(recent) discourse about these problems and as such figured the port
might have some use in the public domain.

 I apologize in advance if gmail incorrectly mails my patch.

Cheers,
Tom Burns
Software Developer
International Datacasting
http://www.intldata.ca
--- /home/tburns/kernel-git/linux-2.6/drivers/net/sky2.c	2007-04-18 15:55:08.0 -0400
+++ ./sky2-patched.c	2007-04-19 14:55:09.0 -0400
@@ -1034,13 +1034,13 @@
 	struct sky2_hw *hw = sky2->hw;
 	u16 port = sky2->port;
 
-	netif_tx_lock_bh(dev);
+spin_lock_bh(&sky2->tx_lock);
 
 	sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_ON);
 	sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
 	sky2->vlgrp = grp;
 
-	netif_tx_unlock_bh(dev);
+	spin_unlock_bh(&sky2->tx_lock);
 }
 
 static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
@@ -1049,13 +1049,16 @@
 	struct sky2_hw *hw = sky2->hw;
 	u16 port = sky2->port;
 
-	netif_tx_lock_bh(dev);
+	spin_lock_bh(&sky2->tx_lock);
 
 	sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
 	sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
-	vlan_group_set_device(sky2->vlgrp, vid, NULL);
 
-	netif_tx_unlock_bh(dev);
+if (sky2->vlgrp)
+sky2->vlgrp->vlan_devices[vid] = NULL;
+
+
+	spin_unlock_bh(&sky2->tx_lock);
 }
 #endif
 
@@ -1074,7 +1077,7 @@
 	unsigned long p;
 	int i;
 
-	skb = netdev_alloc_skb(sky2->netdev, sky2->rx_data_size + RX_SKB_ALIGN);
+	skb = alloc_skb(sky2->rx_data_size + RX_SKB_ALIGN, GFP_ATOMIC);
 	if (!skb)
 		goto nomem;
 
@@ -1138,7 +1141,7 @@
 	thresh = (size - 8) / sizeof(u32);
 
 	/* Account for overhead of skb - to avoid order > 0 allocation */
-	space = SKB_DATA_ALIGN(size) + NET_SKB_PAD
+	space = SKB_DATA_ALIGN(size) + 16
 		+ sizeof(struct skb_shared_info);
 
 	sky2->rx_nfrags = space >> PAGE_SHIFT;
@@ -1334,10 +1337,10 @@
 	count = sizeof(dma_addr_t) / sizeof(u32);
 	count += skb_shinfo(skb)->nr_frags * count;
 
-	if (skb_is_gso(skb))
+	if (skb_shinfo(skb)->tso_size)
 		++count;
 
-	if (skb->ip_summed == CHECKSUM_PARTIAL)
+	if (skb->ip_summed == CHECKSUM_HW)
 		++count;
 
 	return count;
@@ -1361,8 +1364,15 @@
 	u16 mss;
 	u8 ctrl;
 
- 	if (unlikely(tx_avail(sky2) < tx_le_req(skb)))
+
+	if (!spin_trylock(&sky2->tx_lock))
+return NETDEV_TX_LOCKED;
+
+ 	if (unlikely(tx_avail(sky2) < tx_le_req(skb))) {
+spin_unlock(&sky2->tx_lock);
+
   		return NETDEV_TX_BUSY;
+}
 
 	if (unlikely(netif_msg_tx_queued(sky2)))
 		printk(KERN_DEBUG "%s: tx queued, slot %u, len %d\n",
@@ -1381,7 +1391,7 @@
 	}
 
 	/* Check for TCP Segmentation Offload */
-	mss = skb_shinfo(skb)->gso_size;
+	mss = skb_shinfo(skb)->tso_size;
 	if (mss != 0) {
 		mss += ((skb->h.th->doff - 5) * 4);	/* TCP options */
 		mss += (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr);
@@ -1411,12 +1421,12 @@
 #endif
 
 	/* Handle TCP checksum offload */
-	if (skb->ip_summed == CHECKSUM_PARTIAL) {
+	if (skb->ip_summed == CHECKSUM_HW) {
 		unsigned offset = skb->h.raw - skb->data;
 		u32 tcpsum;
 
 		tcpsum = offset << 16;		/* sum start */
-		tcpsum |= offset + skb->csum_offset;	/* sum write */
+		tcpsum |= offset + (u32) skb->csum;	/* sum write */
 
 		ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
 		if (skb->nh.iph->protocol == IPPROTO_UDP)
@@ -1478,6 +1488,8 @@
 	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
 
 	dev->trans_start = jiffies;
+spin_unlock(&sky2->tx_lock);
+
 	return NETDEV_TX_OK;
 }
 
@@ -1538,9 +1550,11 @@
 {
 	struct sky2_port *sky2 = netdev_priv(dev);
 
-	netif_tx_lock_bh(dev);
+spin_lock_bh(&sky2->tx_lock);
+
 	sky2_tx_complete(sky2, sky2->tx_prod);
-	netif_tx_unlock_bh(dev);
+
+spin_unlock_bh(&sky2->tx_lock);
 }
 
 /* Network shutdown */
@@ -1954,7 +1968,8 @@
 {
 	struct sk_buff *skb;
 
-	skb = netdev_alloc_skb(sky2->netdev, length + 2);
+	skb = alloc_skb(length + 2, GFP_ATOMIC);
+
 	if (likely(skb)) {
 		skb_reserve(skb, 2);
 		pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr,
@@ -2058,8 +2073,9 @@
 
 	if (length < copybreak)
 		skb = receive_copy(sky2, re, length);
-	else
+  	else
 		skb = receive_new(sky2, re, length);
+
 resubmit:
 	sky2_rx_submit(sky2, re);
 
@@ -2092,9 +2108,9 @@
 	struct sky2_port *sky2 = netdev_priv(dev);
 
 	if (netif_running(dev)) {
-		netif_tx_lock(dev);
+spin_lock_bh(&sky2->tx_lock);
 		sky2_tx_complete(sky2, last);
-		netif_tx_unlock(dev);
+spin_unlock_bh(&sky2->tx_lock);
 	}
 }
 
@@ -2134,6 +2150,7 @@
 			sky2->net_stats.rx_pack

Re: [PATCH 1/6] sky2: disable support for 88E8056

2007-04-19 Thread Jeff Garzik

Stephen Hemminger wrote:

This device is having all sorts of problems that lead to data corruption
and system instability.  It gets receive status and data out of order,
it generates descriptor and TSO errors, etc.

Until the problems are resolved, it should not be used by anyone
who cares about there system.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>


applied 1-6


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-19 Thread Stephen Hemminger
On Thu, 19 Apr 2007 16:14:23 +0200
Eric Dumazet <[EMAIL PROTECTED]> wrote:

> On Wed, 18 Apr 2007 13:04:22 -0700 (PDT)
> David Miller <[EMAIL PROTECTED]> wrote:
> 
> > 
> > Although I don't think gcc does anything fancy since we don't
> > use memcmp().  It's a tradeoff, we'd like to use unsigned long
> > comparisons when both objects are aligned correctly but we also
> > don't want it to use any more than one potentially mispredicted
> > branch.
> 
> Again, memcmp() *cannot* be optimized, because its semantic is to compare 
> bytes.
> 
> memcpy() can take into account alignement if known at compile time, not 
> memcmp()
> 
> http://lists.openwall.net/netdev/2007/03/13/31

It can if we order bytes in the bridge id properly.  See ktime_t for example.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Getting the new RxRPC patches upstream

2007-04-19 Thread David Howells
Eric W. Biederman <[EMAIL PROTECTED]> wrote:

> Ok.  I don't see any patches in -mm so I was assuming these patches have
> not been queued up anywhere.

They haven't been quite yet.  Is it your intention to kill these features in
2.6.22?

David
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Possible bug in netlink_recvmsg()

2007-04-19 Thread David Howells
David Miller <[EMAIL PROTECTED]> wrote:

> See this fix in my net-2.6.22 tree:
> 
> commit ad495d7b6cfcd1bc2eaf06c42699be0bb5d84234
> Author: David S. Miller <[EMAIL PROTECTED]>
> Date:   Tue Mar 6 17:02:35 2007 -0800

Ummm... That seems to conflict with something in your net-2.6 tree.  Which one
should I use?

David
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Getting the new RxRPC patches upstream

2007-04-19 Thread Eric W. Biederman
David Howells <[EMAIL PROTECTED]> writes:

> Eric W. Biederman <[EMAIL PROTECTED]> wrote:
>
>> What is the ETA on your patches?
>
> That depends on Dave Miller now, I think.  I'm assuming they need to go
> through the network GIT tree to get to Linus.  Certainly Andrew Morton seems
> to think so.

Ok.  I don't see any patches in -mm so I was assuming these patches have
not been queued up anywhere.

As long as these things happen in a reasonably timely manner so I can
remove the export of kernel_thread and kill daemonize I really don't care.

If you have written them they are quite likely better then my minimal
patches which were quite restrained because of my limited ability to
test these things.

Eric
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] NetXen: Use multiple PCI functions

2007-04-19 Thread Mithlesh Thukral
On Thursday 19 April 2007 20:30, Stephen Hemminger wrote:
> On Thu, 19 Apr 2007 07:52:24 -0700
>
> Linsys Contractor Mithlesh Thukral <[EMAIL PROTECTED]> wrote:
> > NetXen: Make driver use multiple PCI functions.
> > This patch will make NetXen driver work with multiple PCI functions. This
> > will make the usage of memory resources as well as interrupts more
> > independent among different functions which results in better throughput.
> > This change has been done after the multiport support is added in
> > firmware.
> >
> > Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>
> >
> > ---
> >
> >  drivers/net/netxen/netxen_nic.h  |  126 ++---
> >  drivers/net/netxen/netxen_nic_ethtool.c  |   83 +--
> >  drivers/net/netxen/netxen_nic_hdr.h  |8
> >  drivers/net/netxen/netxen_nic_hw.c   |  217 ++--
> >  drivers/net/netxen/netxen_nic_hw.h   |   18
> >  drivers/net/netxen/netxen_nic_init.c |  117 +---
> >  drivers/net/netxen/netxen_nic_isr.c  |   87 +--
> >  drivers/net/netxen/netxen_nic_main.c |  526 ++---
> >  drivers/net/netxen/netxen_nic_niu.c  |   27 -
> >  drivers/net/netxen/netxen_nic_phan_reg.h |  125 
> >  10 files changed, 645 insertions(+), 689 deletions(-)
> >
> > diff --git a/drivers/net/netxen/netxen_nic.h
> > b/drivers/net/netxen/netxen_nic.h index dd8ce35..7a5a95e 100644
> > --- a/drivers/net/netxen/netxen_nic.h
> > +++ b/drivers/net/netxen/netxen_nic.h
> > @@ -219,6 +219,7 @@ #define MIN_RX_COUNT4096
> >  #define NETXEN_CTX_SIGNATURE   0xdee0
> >  #define NETXEN_RCV_PRODUCER(ringid)(ringid)
> >  #define MAX_FRAME_SIZE 0x1 /* 64K MAX size for LSO */
> > +#define MAC_ADDR_LEN   6
>
> Please use ETH_ALEN for this if it is an ethernet device.
Ok. I will change this as it for an ethernet device. Will wait for some other 
feedback, otherwise send the updated patchset tomorrow.

Thanks,
Mithlesh Thukral
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] NetXen: Use multiple PCI functions

2007-04-19 Thread Stephen Hemminger
On Thu, 19 Apr 2007 07:52:24 -0700
Linsys Contractor Mithlesh Thukral <[EMAIL PROTECTED]> wrote:

> NetXen: Make driver use multiple PCI functions.
> This patch will make NetXen driver work with multiple PCI functions. This will
> make the usage of memory resources as well as interrupts more independent
> among different functions which results in better throughput. This change has
> been done after the multiport support is added in firmware.
> 
> Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>
> 
> ---
> 
>  drivers/net/netxen/netxen_nic.h  |  126 ++---
>  drivers/net/netxen/netxen_nic_ethtool.c  |   83 +--
>  drivers/net/netxen/netxen_nic_hdr.h  |8 
>  drivers/net/netxen/netxen_nic_hw.c   |  217 ++--
>  drivers/net/netxen/netxen_nic_hw.h   |   18 
>  drivers/net/netxen/netxen_nic_init.c |  117 +---
>  drivers/net/netxen/netxen_nic_isr.c  |   87 +--
>  drivers/net/netxen/netxen_nic_main.c |  526 ++---
>  drivers/net/netxen/netxen_nic_niu.c  |   27 -
>  drivers/net/netxen/netxen_nic_phan_reg.h |  125 
>  10 files changed, 645 insertions(+), 689 deletions(-)
> 
> diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
> index dd8ce35..7a5a95e 100644
> --- a/drivers/net/netxen/netxen_nic.h
> +++ b/drivers/net/netxen/netxen_nic.h
> @@ -219,6 +219,7 @@ #define MIN_RX_COUNT  4096
>  #define NETXEN_CTX_SIGNATURE 0xdee0
>  #define NETXEN_RCV_PRODUCER(ringid)  (ringid)
>  #define MAX_FRAME_SIZE   0x1 /* 64K MAX size for LSO */
> +#define MAC_ADDR_LEN 6
>

Please use ETH_ALEN for this if it is an ethernet device.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] NetXen: Fix for vmalloc issues

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix vmalloc errors on seen on some X86 high end machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Acked-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7ba2383..6907244 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -131,8 +131,8 @@ #define NX_P2_C10x25
 #define FIRST_PAGE_GROUP_START 0
 #define FIRST_PAGE_GROUP_END   0x10
 
-#define SECOND_PAGE_GROUP_START0x400
-#define SECOND_PAGE_GROUP_END  0x66BC000
+#define SECOND_PAGE_GROUP_START0x600
+#define SECOND_PAGE_GROUP_END  0x68BC000
 
 #define THIRD_PAGE_GROUP_START 0x70E4000
 #define THIRD_PAGE_GROUP_END   0x800
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] NetXen: Fixes for Power PC architecture

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix PPC architecture specific bugs
Fixes some issues seen on Big endian machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |6 +++---
 drivers/net/netxen/netxen_nic_hw.c   |3 +--
 drivers/net/netxen/netxen_nic_init.c |4 ++--
 drivers/net/netxen/netxen_nic_main.c |0 
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 43e712d..e0c3aab 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -64,9 +64,9 @@ #include 
 #include "netxen_nic_hw.h"
 
 #define _NETXEN_NIC_LINUX_MAJOR 3
-#define _NETXEN_NIC_LINUX_MINOR 3
-#define _NETXEN_NIC_LINUX_SUBVERSION 3
-#define NETXEN_NIC_LINUX_VERSIONID  "3.3.3"
+#define _NETXEN_NIC_LINUX_MINOR 4
+#define _NETXEN_NIC_LINUX_SUBVERSION 2
+#define NETXEN_NIC_LINUX_VERSIONID  "3.4.2"
 
 #define NUM_FLASH_SECTORS (64)
 #define FLASH_SECTOR_SIZE (64 * 1024)
diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index fba8790..2af5a9d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxe
char brd_name[NETXEN_MAX_SHORT_NAME];
struct netxen_new_user_info user_info;
int i, addr = USER_START;
-   u32 *ptr32;
+   __le32 *ptr32;
 
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
if (board_info->magic != NETXEN_BDINFO_MAGIC) {
@@ -1141,7 +1141,6 @@ void netxen_nic_flash_print(struct netxe
   netxen_nic_driver_name);
return;
}
-   *ptr32 = le32_to_cpu(*ptr32);
ptr32++;
addr += sizeof(u32);
}
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index ca3d78b..b75998d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -439,6 +439,7 @@ do_rom_fast_read_words(struct netxen_ada
ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
if (ret != 0)
break;
+   *(int *)bytes = cpu_to_le32(*(int *)bytes);
bytes += 4;
}
 
@@ -496,8 +497,7 @@ static inline int do_rom_fast_write_word
int timeout = 0;
int data;
 
-   data = *(u32*)bytes;
-
+   data = le32_to_cpu((*(u32*)bytes));
ret = do_rom_fast_write(adapter, addridx, data);
if (ret < 0)
return ret;
diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] NetXen: Port swap feature for multi port cards

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Port Swap feature
This patch will allow a port numbers on the card to be swapped in
host driver. This feature is applicable to cards having more than
1 port. 

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |   21 +
 drivers/net/netxen/netxen_nic_ethtool.c  |  143 ++---
 drivers/net/netxen/netxen_nic_hdr.h  |3 
 drivers/net/netxen/netxen_nic_hw.c   |   67 
 drivers/net/netxen/netxen_nic_hw.h   |   63 
 drivers/net/netxen/netxen_nic_init.c |2 
 drivers/net/netxen/netxen_nic_isr.c  |   29 -
 drivers/net/netxen/netxen_nic_main.c |  306 -
 drivers/net/netxen/netxen_nic_niu.c  |   93 --
 drivers/net/netxen/netxen_nic_phan_reg.h |7 
 10 files changed, 468 insertions(+), 266 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c85c2cb..43e712d 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_CMD_DESCRIPTORS_HOST   (MAX_CMD_DESCRIPTORS / 4)
 #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
@@ -304,6 +305,8 @@ #define FLAGS_VLAN_TAGGED   0x10
 
 #define netxen_set_cmd_desc_port(cmd_desc, var)\
((cmd_desc)->port_ctxid |= ((var) & 0x0F))
+#define netxen_set_cmd_desc_ctxid(cmd_desc, var)   \
+   ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
 
 #define netxen_set_cmd_desc_flags(cmd_desc, val)   \
((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
@@ -446,7 +449,7 @@ struct status_desc {
/* Bit pattern: 0-6 lro_count indicates frag sequence,
   7 last_frag indicates last frag */
u8 lro;
-} __attribute__ ((aligned(8)));
+} __attribute__ ((aligned(16)));
 
 enum {
NETXEN_RCV_PEG_0 = 0,
@@ -724,6 +727,18 @@ struct netxen_skb_frag {
u32 length;
 };
 
+#define _netxen_set_bits(config_word, start, bits, val){\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));\
+   unsigned long long __tvalue = (val);\
+   (config_word) &= ~__tmask;  \
+   (config_word) |= (((__tvalue) << (start)) & __tmask); \
+}
+   
+#define _netxen_clear_bits(config_word, start, bits) {\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));  \
+   (config_word) &= ~__tmask; \
+}  
+
 /*Following defines are for the state of the buffers*/
 #defineNETXEN_BUFFER_FREE  0
 #defineNETXEN_BUFFER_BUSY  1
@@ -768,6 +783,8 @@ struct netxen_hardware_context {
void __iomem *pci_base0;
void __iomem *pci_base1;
void __iomem *pci_base2;
+   unsigned long first_page_group_end;
+   unsigned long first_page_group_start;
void __iomem *db_base;
unsigned long db_len;
 
@@ -863,6 +880,7 @@ struct netxen_adapter {
struct netxen_adapter *master;
struct net_device *netdev;
struct pci_dev *pdev;
+   struct net_device_stats net_stats;
unsigned char mac_addr[MAC_ADDR_LEN];
int mtu;
int portnum;
@@ -1153,4 +1171,5 @@ extern int netxen_rom_fast_read(struct n
 
 extern struct ethtool_ops netxen_nic_ethtool_ops;
 
+extern int physical_port[];/* physical port # from virtual port.*/
 #endif /* __NETXEN_NIC_H_ */
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index 24c68f4..16fabb3 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -40,8 +40,8 @@ #include 
 #include 
 #include 
 
-#include "netxen_nic_hw.h"
 #include "netxen_nic.h"
+#include "netxen_nic_hw.h"
 #include "netxen_nic_phan_reg.h"
 
 struct netxen_nic_stats {
@@ -379,7 +379,7 @@ netxen_nic_get_regs(struct net_device *d
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
/* GB: port specific registers */
if (mode == 0 && i >= 19)
-   window = adapter->portnum * 
+   window = physical_port[adapter->portnum] *
NETXEN_NIC_PORT_WINDOW;
 
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
@@ -537,16 +537,43 @@ netxen_nic_get_pauseparam(struct net_dev
 {
struct netxen_adapter *adapter = netdev_priv(dev);
__u32 val;
+   int port = physical_port[adapter->portnum];
 
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
+   if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
+   return;
/* get flow control settings */
-   netxen_nic_r

[PATCH 3/7] NetXen: Multi PCI support for Quad cards

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the multi PCI function for cards with more than 2 ports.
This patch fixes the working of multi PCI capable driver on cards with 
more than 2 ports by adding the addresses for their rings and sizes.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_hw.c   |  115 +++--
 drivers/net/netxen/netxen_nic_init.c |4 
 drivers/net/netxen/netxen_nic_main.c |   61 +--
 drivers/net/netxen/netxen_nic_phan_reg.h |6 -
 4 files changed, 144 insertions(+), 42 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index a066208..c464bc7 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -140,8 +140,105 @@ struct netxen_recv_crb recv_crb_register
 NETXEN_NIC_REG(0x180),
 /* crb_status_ring_size */
 NETXEN_NIC_REG(0x184),
-
 },
+   /*
+* Instance 3,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x1d8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1dc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x1f0),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x1f4),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */  
+   NETXEN_NIC_REG(0x1f8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1fc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x200),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x204),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x208),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x20c),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x210),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x214),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x218),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x21c),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x220),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x224),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x228),
+   },
+   /*
+* Instance 4,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x22c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x230),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x234),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x238),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */ 
+   NETXEN_NIC_REG(0x23c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x240),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x244),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x248),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x24c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x250),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x254),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x258),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x25c),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x260),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x264),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x268),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x26c),
+   },
 };
 
 u64 ctx_addr_sig_regs[][3] = {
@@ -294,6 +391,7 @@ int netxen_nic_hw_resources(struct netxe
u32 card_cmdring = 0;
struct netxen_recv_context *recv_ctx;
struct netxen_rcv_desc_ctx *rcv_desc;
+   int func_id = adapter->portnum;
 
DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
@@ -349,6 +447,7 @@ int netxen_nic_hw_resources(struct netxe
}
memset(addr, 0, sizeof(struct netxen_ring_ctx));
adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
+   adapter->ctx_desc->ctx_id = adapter->portnum;
adapter->ctx_desc->cmd_consumer_offset =
cpu_to_le64(adapter->ctx_desc_phys_addr +
sizeof(struct netxen_ring_ctx));
@@ -419,11 +518,11 @@ int netxen_nic_hw_resources(struct netxe
/* Window = 1 */
 
writel(lower32(adapter->ctx_desc_phys_addr),
-  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO));
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO(fun

[PATCH 4/7] NetXen: Removal of redundant macros

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Remove 2 redundant macro definitions from header file.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_phan_reg.h |2 --
 1 files changed, 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h 
b/drivers/net/netxen/netxen_nic_phan_reg.h
index cb9acf1..12bcaf9 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -100,8 +100,6 @@ #define CRB_JUMBO_BUFFER_CONS   NETX
 
 #define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
 #define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
-#define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
-#define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
 #define CRB_CMD_PRODUCER_OFFSET_2   NETXEN_NIC_REG(0x1b8)
 #define CRB_CMD_CONSUMER_OFFSET_2   NETXEN_NIC_REG(0x1bc)
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] NetXen: Removal of redundant argument passing

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |   33 +++
 drivers/net/netxen/netxen_nic_ethtool.c |   10 +-
 drivers/net/netxen/netxen_nic_hdr.h |1 
 drivers/net/netxen/netxen_nic_hw.c  |   23 +++--
 drivers/net/netxen/netxen_nic_hw.h  |4 
 drivers/net/netxen/netxen_nic_init.c|7 -
 drivers/net/netxen/netxen_nic_isr.c |9 +-
 drivers/net/netxen/netxen_nic_main.c|   32 +--
 drivers/net/netxen/netxen_nic_niu.c |   96 +-
 9 files changed, 114 insertions(+), 101 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7a5a95e..c85c2cb 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
 #define MAX_RCVSTATUS_DESCRIPTORS  MAX_RCV_DESCRIPTORS
@@ -781,6 +782,7 @@ struct netxen_hardware_context {
struct pci_dev *cmd_desc_pdev;
dma_addr_t cmd_desc_phys_addr;
struct netxen_adapter *adapter;
+   int pci_func;
 };
 
 #define RCV_RING_LRO   RCV_DESC_LRO
@@ -917,15 +919,15 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
-   int (*enable_phy_interrupts) (struct netxen_adapter *, int);
-   int (*disable_phy_interrupts) (struct netxen_adapter *, int);
+   int (*enable_phy_interrupts) (struct netxen_adapter *);
+   int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
-   int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
-   int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
+   int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
+   int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *);
@@ -971,27 +973,21 @@ static inline void __iomem *pci_base(str
return NULL;
 }
 
-int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter,
-  int port);
-int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-   int port);
+int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter);
 void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
 long enable);
 void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
  long enable);
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg,
+int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
__u32 * readval);
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
+int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
 long reg, __u32 val);
 
 /* Functions available from netxen_nic_hw.c */
@@ -1011,6 +1007,7 @@ int netxen_nic_hw_writ

[PATCH 0/7] NetXen: Make driver use multiple PCI functions

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
hi All,

Thanks Christoph and Stephen for your feedback. I am resending the 7 patches
after incorporating their suggestions.
These patches are with respect to netdev#upstream and we wish their inclusion 
in 2.6.22 kernel.

Out of these the first 2 patches were already accepted into the netdev tree, 
but we have requested them to be dropped. So we are resending those 2.
Please see the following thread for more details :
http://www.spinics.net/lists/netdev/msg26805.html

Regards,
Mithlesh Thukral
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Getting the new RxRPC patches upstream

2007-04-19 Thread David Howells
Eric W. Biederman <[EMAIL PROTECTED]> wrote:

> What is the ETA on your patches?

That depends on Dave Miller now, I think.  I'm assuming they need to go
through the network GIT tree to get to Linus.  Certainly Andrew Morton seems
to think so.

David
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-19 Thread Eric Dumazet
On Wed, 18 Apr 2007 13:04:22 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:

> 
> Although I don't think gcc does anything fancy since we don't
> use memcmp().  It's a tradeoff, we'd like to use unsigned long
> comparisons when both objects are aligned correctly but we also
> don't want it to use any more than one potentially mispredicted
> branch.

Again, memcmp() *cannot* be optimized, because its semantic is to compare bytes.

memcpy() can take into account alignement if known at compile time, not memcmp()

http://lists.openwall.net/netdev/2007/03/13/31


> 
> We could add some alignment tests to the ethernet address
> comparison code, but it's probably more trouble than it's
> worth.
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
-- 
Eric Dumazet <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 8320] New: replacing route in kernel doesn't send netlink message

2007-04-19 Thread Patrick McHardy
Milan Kocián wrote:
> ok, here is new version. Sign is in patch. Is it correct?
> 
> --- a/net/ipv4/fib_hash.c 2007-04-18 12:50:11.0 +0200
> +++ b/net/ipv4/fib_hash.c 2007-04-19 10:21:04.267136960 +0200
> [...]
> Signed-off-by: Milan Kocian <[EMAIL PROTECTED]>


Looks good, thanks.

Acked-by: Patrick McHardy <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 17:58:55 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 10:44:12 +0200), Thomas 
> Graf <[EMAIL PROTECTED]> says:
> 
> > * YOSHIFUJI Hideaki <[EMAIL PROTECTED]> 2007-04-19 15:42
> > > 
> > > Please consider pulling following changesets for supporting exporting
> > > stats information via netlink, on top of net-2.6.22.
> > 
> > The netlink bits are perfectly fine, why the dependency on proc fs?
> 
> I'll follow up to eliminate such dependency afterwards.

Here it is.

All changesets are available on the
net-2.6.22-20070417-stats-20070419
branch at
.

---
[IPV6] SNMP: Export statistics via netlink without CONFIG_PROC_FS.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/proc.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 5c3ce1c..c847cef 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -141,6 +141,7 @@ static struct snmp_mib snmp6_udplite6_list[] = {
SNMP_MIB_ITEM("UdpLite6OutDatagrams", UDP_MIB_OUTDATAGRAMS),
SNMP_MIB_SENTINEL
 };
+#endif /* CONFIG_PROC_FS */
 
 static unsigned long
 fold_field(void *mib[], int offt)
@@ -155,6 +156,7 @@ fold_field(void *mib[], int offt)
return res;
 }
 
+#ifdef CONFIG_PROC_FS
 static inline void
 snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib 
*itemlist)
 {
@@ -206,6 +208,7 @@ static const struct file_operations snmp6_seq_fops = {
.llseek  = seq_lseek,
.release = single_release,
 };
+#endif /* CONFIG_PROC_FS */
 
 static inline void
 __snmp6_fill_stats(u64 *stats, void **mib, int items, int bytes)
@@ -232,6 +235,7 @@ snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int 
attrtype, int bytes)
}
 }
 
+#ifdef CONFIG_PROC_FS
 int snmp6_register_dev(struct inet6_dev *idev)
 {
struct proc_dir_entry *p;
@@ -309,12 +313,6 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
return 0;
 }
 
-void
-snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int bytes)
-{
-   memset(stats, 0, sizeof(bytes));
-}
-
 #endif /* CONFIG_PROC_FS */
 
 int snmp6_alloc_dev(struct inet6_dev *idev)
-- 
1.5.1

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/atm, net

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 drivers/atm/atmtcp.c |2 +-
 net/atm/clip.c   |2 +-
 net/atm/lec.c|2 +-
 net/atm/mpc.c|2 +-
 net/atm/signaling.c  |2 +-
 net/dccp/minisocks.c |2 +-
 net/ipv6/mip6.c  |2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index fc518d8..3fde97b 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -352,7 +352,7 @@ static struct atm_dev atmtcp_control_dev = {
.ops= &atmtcp_c_dev_ops,
.type   = "atmtcp",
.number = 999,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(atmtcp_control_dev.lock)
 };
 
 
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 8c38258..d41137d 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -702,7 +702,7 @@ static struct atm_dev atmarpd_dev = {
.ops =  &atmarpd_dev_ops,
.type = "arpd",
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(atmarpd_dev.lock)
 };
 
 
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 3d804d6..7747586 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -630,7 +630,7 @@ static struct atm_dev lecatm_dev = {
.ops = &lecdev_ops,
.type = "lec",
.number = 999,  /* dummy device number */
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(lecatm_dev.lock)
 };
 
 /*
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index cb3c004..2f0df1f 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -734,7 +734,7 @@ static struct atm_dev mpc_dev = {
.ops= &mpc_ops,
.type   = "mpc",
.number = 42,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(mpc_dev.lock)
/* members not explicitly initialised will be 0 */
 };
 
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index 31d98b5..d14baaf 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -256,7 +256,7 @@ static struct atm_dev sigd_dev = {
.ops =  &sigd_dev_ops,
.type = "sig",
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(sigd_dev.lock)
 };
 
 
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 6d235b3..e18e249 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -27,7 +27,7 @@
 struct inet_timewait_death_row dccp_death_row = {
.sysctl_max_tw_buckets = NR_FILE * 2,
.period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
-   .death_lock = SPIN_LOCK_UNLOCKED,
+   .death_lock = __SPIN_LOCK_UNLOCKED(dccp_death_row.death_lock),
.hashinfo   = &dccp_hashinfo,
.tw_timer   = TIMER_INITIALIZER(inet_twdr_hangman, 0,
(unsigned long)&dccp_death_row),
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 0afcabd..7aac558 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -122,7 +122,7 @@ struct mip6_report_rate_limiter {
 };
 
 static struct mip6_report_rate_limiter mip6_report_rl = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(mip6_report_rl.lock)
 };
 
 static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at net/core/skbuff.c in linux-2.6.21-rc6

2007-04-19 Thread Herbert Xu
Herbert Xu <[EMAIL PROTECTED]> wrote:
> 
> Paul Mackerras <[EMAIL PROTECTED]> wrote:
>> 
>> So this doesn't change process_input_packet(), which treats the case
>> where the first byte is 0xff (PPP_ALLSTATIONS) but the second byte is
>> 0x03 (PPP_UI) as indicating a packet with a PPP protocol number of
>> 0xff.  Arguably that's wrong since PPP protocol 0xff is reserved, and
>> the RFC does envision the possibility of receiving frames where the
>> control field has values other than 0x03.
> 
> Your fix is probably needed too.  However, I think the issue that Patrick
> was trying to fix is the case where p[0] != PPP_ALLSTATIONS and therefore
> we'd still have a problem there.

Nevermind, I mixed up != with == so your patch is all we need.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 8320] New: replacing route in kernel doesn't send netlink message

2007-04-19 Thread Milan Kocián
On Wed, 2007-04-18 at 16:06 +0200, Patrick McHardy wrote:
> Milan Kocián wrote:
> > On Tue, 2007-04-17 at 14:58 +0200, Patrick McHardy wrote:
> > 
> >>Milan, could you cook up another patch which uses NLM_F_REPLACE?
> > 
> > 
> > I can try it. Output is in patch below. Review carefully. I don't know
> > if it's best approach. It's tested and working without problem
> > (probably :-))
> 
> 
> Looks good, but your mailer corrupted long lines. Please resend as
> attachment and sign off the patch.
> 

ok, here is new version. Sign is in patch. Is it correct?


-- 
Milan Kocián <[EMAIL PROTECTED]>
--- a/net/ipv4/fib_hash.c	2007-04-18 12:50:11.0 +0200
+++ b/net/ipv4/fib_hash.c	2007-04-19 10:21:04.267136960 +0200
@@ -457,6 +457,8 @@
 			fib_release_info(fi_drop);
 			if (state & FA_S_ACCESSED)
 rt_cache_flush(-1);
+			rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id,
+  &cfg->fc_nlinfo, NLM_F_REPLACE);
 			return 0;
 		}
 
@@ -524,7 +526,7 @@
 	rt_cache_flush(-1);
 
 	rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id,
-		  &cfg->fc_nlinfo);
+		  &cfg->fc_nlinfo, 0);
 	return 0;
 
 out_free_new_fa:
@@ -590,7 +592,7 @@
 
 		fa = fa_to_delete;
 		rtmsg_fib(RTM_DELROUTE, key, fa, cfg->fc_dst_len,
-			  tb->tb_id, &cfg->fc_nlinfo);
+			  tb->tb_id, &cfg->fc_nlinfo, 0);
 
 		kill_fn = 0;
 		write_lock_bh(&fib_hash_lock);
--- a/net/ipv4/fib_trie.c	2007-04-18 12:50:11.0 +0200
+++ b/net/ipv4/fib_trie.c	2007-04-19 11:41:14.537864656 +0200
@@ -1205,6 +1205,8 @@
 			fib_release_info(fi_drop);
 			if (state & FA_S_ACCESSED)
 rt_cache_flush(-1);
+			rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
+  &cfg->fc_nlinfo, NLM_F_REPLACE);
 			goto succeeded;
 		}
 		/* Error if we find a perfect match which
@@ -1256,7 +1258,7 @@
 
 	rt_cache_flush(-1);
 	rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
-		  &cfg->fc_nlinfo);
+		  &cfg->fc_nlinfo, 0);
 succeeded:
 	return 0;
 
@@ -1599,7 +1601,7 @@
 
 	fa = fa_to_delete;
 	rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id,
-		  &cfg->fc_nlinfo);
+		  &cfg->fc_nlinfo, 0);
 
 	l = fib_find_node(t, key);
 	li = find_leaf_info(l, plen);
--- a/net/ipv4/fib_semantics.c	2007-04-18 12:50:11.0 +0200
+++ b/net/ipv4/fib_semantics.c	2007-04-19 10:22:06.852622520 +0200
@@ -301,7 +301,8 @@
 }
 
 void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
-	   int dst_len, u32 tb_id, struct nl_info *info)
+	   int dst_len, u32 tb_id, struct nl_info *info,
+	   unsigned int nlm_flags)
 {
 	struct sk_buff *skb;
 	u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0;
@@ -313,7 +314,7 @@
 
 	err = fib_dump_info(skb, info->pid, seq, event, tb_id,
 			fa->fa_type, fa->fa_scope, key, dst_len,
-			fa->fa_tos, fa->fa_info, 0);
+			fa->fa_tos, fa->fa_info, nlm_flags);
 	/* failure implies BUG in fib_nlmsg_size() */
 	BUG_ON(err < 0);
 
--- a/net/ipv4/fib_lookup.h	2007-04-18 12:50:11.0 +0200
+++ b/net/ipv4/fib_lookup.h	2007-04-19 10:23:11.637773680 +0200
@@ -30,7 +30,8 @@
 			 int dst_len, u8 tos, struct fib_info *fi,
 			 unsigned int);
 extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
-		  int dst_len, u32 tb_id, struct nl_info *info);
+		  int dst_len, u32 tb_id, struct nl_info *info,
+		  unsigned int nlm_flags);
 extern struct fib_alias *fib_find_alias(struct list_head *fah,
 	u8 tos, u32 prio);
 extern int fib_detect_death(struct fib_info *fi, int order,

Signed-off-by: Milan Kocian <[EMAIL PROTECTED]>


Re: [PATCH] CONFIG_PACKET_MMAP should depend on MMU

2007-04-19 Thread David Howells
Aubrey Li <[EMAIL PROTECTED]> wrote:

> Yes, it's reasonable for me, as long as your
> host IP is 192.168.2.128
> and
> target IP is 192.168.2.141

That is correct, yes:-)

I expect it's an NFS packet as my board is using an NFS root at the moment.

David
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] [AF_IUCV/IUCV]: smp_call_function deadlock

2007-04-19 Thread Frank Pavlic
From: Martin Schwidefsky <[EMAIL PROTECTED]>
From: Heiko Carstens <[EMAIL PROTECTED]>
From: Ursula Braun <[EMAIL PROTECTED]>

Calling smp_call_function can lead to a deadlock if it is called
from tasklet context. 
Fixing this deadlock requires to move the smp_call_function from the
tasklet context to a work queue. To do that queue the path pending
interrupts to a separate list and move the path cleanup out of
iucv_path_sever to iucv_path_connect and iucv_path_pending.
This creates a new requirement for iucv_path_connect: it may not be
called from tasklet context anymore. 
Also fixed compile problem for CONFIG_HOTPLUG_CPU=n and
another one when walking the cpu_online mask. When doing this, 
we must disable cpu hotplug.

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---

 include/net/iucv/iucv.h |2
 net/iucv/iucv.c |  207 ++--
 2 files changed, 133 insertions(+), 76 deletions(-)

diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index 746e741..fd70adb 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -16,7 +16,7 @@
  * completed a register, it can exploit the other functions.
  * For furthur reference on all IUCV functionality, refer to the
  * CP Programming Services book, also available on the web thru
- * www.ibm.com/s390/vm/pubs, manual # SC24-5760
+ * www.vm.ibm.com/pubs, manual # SC24-6084
  *
  * Definition of Return Codes
  * - All positive return codes including zero are reflected back
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 1b10d57..903bdb6 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -90,20 +90,43 @@ struct iucv_irq_data {
u32 res2[8];
 };
 
-struct iucv_work {
+struct iucv_irq_list {
struct list_head list;
struct iucv_irq_data data;
 };
 
-static LIST_HEAD(iucv_work_queue);
-static DEFINE_SPINLOCK(iucv_work_lock);
-
 static struct iucv_irq_data *iucv_irq_data;
 static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE;
 static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE;
 
-static void iucv_tasklet_handler(unsigned long);
-static DECLARE_TASKLET(iucv_tasklet, iucv_tasklet_handler,0);
+/*
+ * Queue of interrupt buffers lock for delivery via the tasklet
+ * (fast but can't call smp_call_function).
+ */
+static LIST_HEAD(iucv_task_queue);
+
+/*
+ * The tasklet for fast delivery of iucv interrupts.
+ */
+static void iucv_tasklet_fn(unsigned long);
+static DECLARE_TASKLET(iucv_tasklet, iucv_tasklet_fn,0);
+
+/*
+ * Queue of interrupt buffers for delivery via a work queue
+ * (slower but can call smp_call_function).
+ */
+static LIST_HEAD(iucv_work_queue);
+
+/*
+ * The work element to deliver path pending interrupts.
+ */
+static void iucv_work_fn(struct work_struct *work);
+static DECLARE_WORK(iucv_work, iucv_work_fn);
+
+/*
+ * Spinlock protecting task and work queue.
+ */
+static DEFINE_SPINLOCK(iucv_queue_lock);
 
 enum iucv_command_codes {
IUCV_QUERY = 0,
@@ -147,10 +170,10 @@ static unsigned long iucv_max_pathid;
 static DEFINE_SPINLOCK(iucv_table_lock);
 
 /*
- * iucv_tasklet_cpu: contains the number of the cpu executing the tasklet.
- * Needed for iucv_path_sever called from tasklet.
+ * iucv_active_cpu: contains the number of the cpu executing the tasklet
+ * or the work handler. Needed for iucv_path_sever called from tasklet.
  */
-static int iucv_tasklet_cpu = -1;
+static int iucv_active_cpu = -1;
 
 /*
  * Mutex and wait queue for iucv_register/iucv_unregister.
@@ -449,17 +472,19 @@ static void iucv_setmask_mp(void)
 {
int cpu;
 
+   preempt_disable();
for_each_online_cpu(cpu)
/* Enable all cpus with a declared buffer. */
if (cpu_isset(cpu, iucv_buffer_cpumask) &&
!cpu_isset(cpu, iucv_irq_cpumask))
smp_call_function_on(iucv_allow_cpu, NULL, 0, 1, cpu);
+   preempt_enable();
 }
 
 /**
  * iucv_setmask_up
  *
- * Allow iucv interrupts on a single cpus.
+ * Allow iucv interrupts on a single cpu.
  */
 static void iucv_setmask_up(void)
 {
@@ -493,8 +518,10 @@ static int iucv_enable(void)
goto out;
/* Declare per cpu buffers. */
rc = -EIO;
+   preempt_disable();
for_each_online_cpu(cpu)
smp_call_function_on(iucv_declare_cpu, NULL, 0, 1, cpu);
+   preempt_enable();
if (cpus_empty(iucv_buffer_cpumask))
/* No cpu could declare an iucv buffer. */
goto out_path;
@@ -519,7 +546,6 @@ static void iucv_disable(void)
kfree(iucv_path_table);
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
 static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
 unsigned long action, void *hcpu)
 {
@@ -565,7 +591,6 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block 
*self,
 static struct notifier_block iucv_cpu_notifier = {
.notifier_call = iucv_cpu_notify,
 };
-#endif
 
 /**

[PATCH 0/3] [AF_IUCV/IUCV]: net-2.6.22 fixes

2007-04-19 Thread Frank Pavlic
Hi Dave,
following three patches contain fixes for AF_IUCV socket support and
for iucv, the base code for IUCV related actions in z/VM .
I made these patches against net-2.6.22, 
but they should also apply to net-2.6 without any conflicts.
Well it works on my copy :-). 
I will make another patchset for net-2.6 if you want me to do so. 

Thank you.

Frank
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] [AF_IUCV/IUCV]: Implementation of a skb backlog queue

2007-04-19 Thread Frank Pavlic
From: Jennifer Hunt <[EMAIL PROTECTED]>

With the inital implementation we missed to implement a skb backlog
queue . The result is that socket receive processing tossed packets.
Since AF_IUCV connections are working synchronously it leads to 
connection hangs. Problems with read, close and select also
occured. 
Using a skb backlog queue is fixing all of these problems .

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---

 include/net/iucv/af_iucv.h |2
 net/iucv/af_iucv.c |  160 -
 2 files changed, 133 insertions(+), 29 deletions(-)

diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 04d1abb..f9bd11b 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -28,6 +28,7 @@ enum {
IUCV_LISTEN,
IUCV_SEVERED,
IUCV_DISCONN,
+   IUCV_CLOSING,
IUCV_CLOSED
 };
 
@@ -62,6 +63,7 @@ struct iucv_sock {
struct sock *parent;
struct iucv_path*path;
struct sk_buff_head send_skb_q;
+   struct sk_buff_head backlog_skb_q;
unsigned intsend_tag;
 };
 
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index acc9421..0c2e4a8 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -147,6 +147,7 @@ static void iucv_sock_close(struct sock *sk)
unsigned char user_data[16];
struct iucv_sock *iucv = iucv_sk(sk);
int err;
+   unsigned long timeo;
 
iucv_sock_clear_timer(sk);
lock_sock(sk);
@@ -159,6 +160,21 @@ static void iucv_sock_close(struct sock *sk)
case IUCV_CONNECTED:
case IUCV_DISCONN:
err = 0;
+
+   sk->sk_state = IUCV_CLOSING;
+   sk->sk_state_change(sk);
+
+   if(!skb_queue_empty(&iucv->send_skb_q)) {
+   if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
+   timeo = sk->sk_lingertime;
+   else
+   timeo = IUCV_DISCONN_TIMEOUT;
+   err = iucv_sock_wait_state(sk, IUCV_CLOSED, 0, timeo);
+   }
+
+   sk->sk_state = IUCV_CLOSED;
+   sk->sk_state_change(sk);
+
if (iucv->path) {
low_nmcpy(user_data, iucv->src_name);
high_nmcpy(user_data, iucv->dst_name);
@@ -168,12 +184,11 @@ static void iucv_sock_close(struct sock *sk)
iucv->path = NULL;
}
 
-   sk->sk_state = IUCV_CLOSED;
-   sk->sk_state_change(sk);
sk->sk_err = ECONNRESET;
sk->sk_state_change(sk);
 
skb_queue_purge(&iucv->send_skb_q);
+   skb_queue_purge(&iucv->backlog_skb_q);
 
sock_set_flag(sk, SOCK_ZAPPED);
break;
@@ -204,6 +219,7 @@ static struct sock *iucv_sock_alloc(struct socket *sock, 
int proto, gfp_t prio)
sock_init_data(sock, sk);
INIT_LIST_HEAD(&iucv_sk(sk)->accept_q);
skb_queue_head_init(&iucv_sk(sk)->send_skb_q);
+   skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q);
iucv_sk(sk)->send_tag = 0;
 
sk->sk_destruct = iucv_sock_destruct;
@@ -510,7 +526,7 @@ static int iucv_sock_accept(struct socket *sock, struct 
socket *newsock,
long timeo;
int err = 0;
 
-   lock_sock(sk);
+   lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
 
if (sk->sk_state != IUCV_LISTEN) {
err = -EBADFD;
@@ -530,7 +546,7 @@ static int iucv_sock_accept(struct socket *sock, struct 
socket *newsock,
 
release_sock(sk);
timeo = schedule_timeout(timeo);
-   lock_sock(sk);
+   lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
 
if (sk->sk_state != IUCV_LISTEN) {
err = -EBADFD;
@@ -606,7 +622,7 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct 
socket *sock,
if(!(skb = sock_alloc_send_skb(sk, len,
   msg->msg_flags & MSG_DONTWAIT,
   &err)))
-   return err;
+   goto out;
 
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)){
err = -EFAULT;
@@ -647,10 +663,16 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct 
socket *sock,
 {
int noblock = flags & MSG_DONTWAIT;
struct sock *sk = sock->sk;
+   struct iucv_sock *iucv = iucv_sk(sk);
int target, copied = 0;
-   struct sk_buff *skb;
+   struct sk_buff *skb, *rskb, *cskb;
int err = 0;
 
+   if ((sk->sk_state == IUCV_DISCONN || sk->sk_state == IUCV_SEVERED) &&
+   skb_queue_empty(&iucv->backlog_skb_q) &&
+   skb_queue_empty(&sk->sk_receive_queue))
+   return 0;
+
if (flags & (MSG_OOB))
return -EOPNOT

[PATCH 3/3] [AF_IUCV/IUCV]: Add missing section annotations

2007-04-19 Thread Frank Pavlic
From: Heiko Carstens <[EMAIL PROTECTED]>

Add missing section annotations and found and fixed some
Coding Style issues.

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---

 af_iucv.c |   44 +++-
 iucv.c|   49 ++---
 2 files changed, 45 insertions(+), 48 deletions(-)

diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 0c2e4a8..7f1672d 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -45,7 +45,8 @@ static struct proto iucv_proto = {
 static void iucv_callback_rx(struct iucv_path *, struct iucv_message *);
 static void iucv_callback_txdone(struct iucv_path *, struct iucv_message *);
 static void iucv_callback_connack(struct iucv_path *, u8 ipuser[16]);
-static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8], u8 
ipuser[16]);
+static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8],
+u8 ipuser[16]);
 static void iucv_callback_connrej(struct iucv_path *, u8 ipuser[16]);
 
 static struct iucv_sock_list iucv_sk_list = {
@@ -152,7 +153,7 @@ static void iucv_sock_close(struct sock *sk)
iucv_sock_clear_timer(sk);
lock_sock(sk);
 
-   switch(sk->sk_state) {
+   switch (sk->sk_state) {
case IUCV_LISTEN:
iucv_sock_cleanup_listen(sk);
break;
@@ -164,7 +165,7 @@ static void iucv_sock_close(struct sock *sk)
sk->sk_state = IUCV_CLOSING;
sk->sk_state_change(sk);
 
-   if(!skb_queue_empty(&iucv->send_skb_q)) {
+   if (!skb_queue_empty(&iucv->send_skb_q)) {
if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
timeo = sk->sk_lingertime;
else
@@ -292,7 +293,7 @@ struct sock *iucv_accept_dequeue(struct sock *parent, 
struct socket *newsock)
struct iucv_sock *isk, *n;
struct sock *sk;
 
-   list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){
+   list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q) {
sk = (struct sock *) isk;
lock_sock(sk);
 
@@ -537,7 +538,7 @@ static int iucv_sock_accept(struct socket *sock, struct 
socket *newsock,
 
/* Wait for an incoming connection */
add_wait_queue_exclusive(sk->sk_sleep, &wait);
-   while (!(nsk = iucv_accept_dequeue(sk, newsock))){
+   while (!(nsk = iucv_accept_dequeue(sk, newsock))) {
set_current_state(TASK_INTERRUPTIBLE);
if (!timeo) {
err = -EAGAIN;
@@ -618,13 +619,13 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct 
socket *sock,
goto out;
}
 
-   if (sk->sk_state == IUCV_CONNECTED){
-   if(!(skb = sock_alloc_send_skb(sk, len,
-  msg->msg_flags & MSG_DONTWAIT,
-  &err)))
+   if (sk->sk_state == IUCV_CONNECTED) {
+   if (!(skb = sock_alloc_send_skb(sk, len,
+   msg->msg_flags & MSG_DONTWAIT,
+   &err)))
goto out;
 
-   if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)){
+   if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
err = -EFAULT;
goto fail;
}
@@ -710,7 +711,7 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct 
socket *sock,
 
/* Queue backlog skbs */
rskb = skb_dequeue(&iucv_sk(sk)->backlog_skb_q);
-   while(rskb) {
+   while (rskb) {
if (sock_queue_rcv_skb(sk, rskb)) {
skb_queue_head(&iucv_sk(sk)->backlog_skb_q,
rskb);
@@ -731,7 +732,7 @@ static inline unsigned int iucv_accept_poll(struct sock 
*parent)
struct iucv_sock *isk, *n;
struct sock *sk;
 
-   list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q){
+   list_for_each_entry_safe(isk, n, &iucv_sk(parent)->accept_q, accept_q) {
sk = (struct sock *) isk;
 
if (sk->sk_state == IUCV_CONNECTED)
@@ -762,7 +763,7 @@ unsigned int iucv_sock_poll(struct file *file, struct 
socket *sock,
mask |= POLLHUP;
 
if (!skb_queue_empty(&sk->sk_receive_queue) ||
-   (sk->sk_shutdown & RCV_SHUTDOWN))
+   (sk->sk_shutdown & RCV_SHUTDOWN))
mask |= POLLIN | POLLRDNORM;
 
if (sk->sk_state == IUCV_CLOSED)
@@ -793,7 +794,7 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
return -EINVAL;
 
lock_sock(sk);
-   switch(sk->sk_state) {
+   switch (sk->sk_state) {
case IUCV_CLOSED:
err = -ENOTCONN;

Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 10:44:12 +0200), Thomas 
Graf <[EMAIL PROTECTED]> says:

> * YOSHIFUJI Hideaki <[EMAIL PROTECTED]> 2007-04-19 15:42
> > 
> > Please consider pulling following changesets for supporting exporting
> > stats information via netlink, on top of net-2.6.22.
> 
> The netlink bits are perfectly fine, why the dependency on proc fs?

I'll follow up to eliminate such dependency afterwards.

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at net/core/skbuff.c in linux-2.6.21-rc6

2007-04-19 Thread Bartek

Your fix is probably needed too.  However, I think the issue that Patrick
was trying to fix is the case where p[0] != PPP_ALLSTATIONS and therefore
we'd still have a problem there.


I tested Paul's patch for last few days and I think everything seems
ok. The system is stable.

Regards
Bartek
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread Thomas Graf
* YOSHIFUJI Hideaki / ?$B5HF#1QL@ <[EMAIL PROTECTED]> 2007-04-19 15:42
> 
> Please consider pulling following changesets for supporting exporting
> stats information via netlink, on top of net-2.6.22.

The netlink bits are perfectly fine, why the dependency on proc fs?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ESP interfamily tunnel bug?

2007-04-19 Thread Diego Beltrami

On Thu, 19 Apr 2007, Kazunori MIYAZAWA wrote:

> I'm using a machine and a dummy device.
> So I'm using loopback communication.
> Yes, the backtrace is correct.
>
> I thought you used loopback communication to test the modes
> because your configuration showed that the dummy device has
> some addresses and you did ping from the address to the other
> address.
>
> Is not right? Did you use two or more hosts?

If we understood you correctly, you are using a single machine? If yes, we
can repeat your problem too. There is something wrong with the
loopback, XFRM (and interfamily).

However, we were describing a different problem. We were using two
separate machines that were in different networks.

>
> I do not have enough environment to test today.
> I'll test it with a couple of machines tomorrow.
>
> Diego Beltrami wrote:
>> Hi Kazunori,
>> thanks for reply.
>>
>> In your backtrace I see that there are both input and output functions
>> calls. Is
>> it the right way?
>>
>> One more thing, were your two hosts you used located on the same network?
>> In fact it seems that if the machines are on the same network, this bug
>> doesn't
>> manifest.
>>
>> Thanks,
>>
>> Diego
>>
>>
>>> Hello Diego,
>>>
>>> I tried to reproduce the bug. But I got a panic of the kernel :-<
>>> I'm using current net-2.6.
>>>
>>> I suspect that some special routing for loopback is related
>>> because I checked with kdb and got the backtrace like
>>>
>>> fib_sync_down
>>> ipv6_rcv
>>> netif_receive_skb
>>> __mod_timer
>>> net_rx_action
>>> __do_softirq
>>> do_softirq
>>> local_bh_enable
>>> dev_queue_xmit
>>> neigh_resolve_output
>>> ip_output
>>> xfrm4_output_finish
>>> xfrm4_output
>>> ip_generic_getfrag
>>> ip6_push_pending_frames
>>>
>>> I think ip_rcv or some IPv4 function should be called between
>>> netif_receive_skb
>>> and ipv6_rcv.
>>>
>>> Anyway I could not classify the way to make a panic.
>>> I'll trace it.
>>>
>>> Thank you,
>>>
>>> Diego Beltrami wrote:
 Hi,

 we have discovered a routing related problem in ESP tunnel and beet mode.
 We don't know whether it is a bug in the XFRM, or just in the way the
 virtual addresses and the corresponding routes are set-up. We set up a
 dummy0 device for the virtual addresses:

 [EMAIL PROTECTED]:~# ip addr show dummy0
 5: dummy0:  mtu 1500 qdisc noqueue
  link/ether 92:09:fe:11:81:1b brd ff:ff:ff:ff:ff:ff
  inet6 2001:72:e6d3:1cf3:e11d:5bb0:b99:e85e/28 scope global
 valid_lft forever preferred_lft forever
  inet6 2001:74:32e0:df36:e862:3963:523e:dd7d/28 scope global
 valid_lft forever preferred_lft forever
  inet6 2001:73:d3a8:8723:d572:7549:7f2c:e590/28 scope global
 valid_lft forever preferred_lft forever
  inet6 2001:75:a2e6:aad6:e901:dd1c:ba95:e300/28 scope global
 valid_lft forever preferred_lft forever
  inet6 fe80::9009:feff:fe11:811b/64 scope link
 valid_lft forever preferred_lft forever

 And then we have routes for the virtual addresses:

 [EMAIL PROTECTED]:~# ip -6 route
 2001:72:e6d3:1cf3:e11d:5bb0:b99:e85e dev dummy0  metric 1024  expires
 21334305sec mtu 1500 advmss 1440 metric 10 4294967295
 2001:73:d3a8:8723:d572:7549:7f2c:e590 dev dummy0  metric 1024  expires
 21334305sec mtu 1500 advmss 1440 metric 10 4294967295
 2001:74:32e0:df36:e862:3963:523e:dd7d dev dummy0  metric 1024  expires
 21334305sec mtu 1500 advmss 1440 metric 10 4294967295
 2001:75:a2e6:aad6:e901:dd1c:ba95:e300 dev dummy0  metric 1024  expires
 21334305sec mtu 1500 advmss 1440 metric 10 4294967295
 2001:70::/28 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss
 1440 metric 10 4294967295
 fe80::/64 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss
 1440
 metric 10 4294967295
 ff00::/8 dev eth0  metric 256  expires 21325454sec mtu 1500 advmss 1440
 metric 10 4294967295
 ff00::/8 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss 1440
 metric 10 4294967295
 unreachable default dev lo  proto none  metric -1  error -101 metric 10
 255

 ...and set-up policies and associations. The virtual IPv6 addresses
 are inner and IPv4 addresses are outer addresses:

 [EMAIL PROTECTED]:~/projects/hipl--userspace--2.6# ip xfrm policy show
 src 2001:76:7d5a:88d7:51af:cdd1:6bf5:3d15/128 dst
 2001:74:32e0:df36:e862:3963:523e:dd7d/128
  dir in priority 0
  tmpl src c1a7:bb82:: dst c0a8:65::
  proto esp reqid 0 mode beet
 src 2001:74:32e0:df36:e862:3963:523e:dd7d/128 dst
 2001:76:7d5a:88d7:51af:cdd1:6bf5:3d15/128
  dir out priority 0
  tmpl src c0a8:65:: dst c1a7:bb82::
  proto esp reqid 0 mode beet

 [EMAIL PROTECTED]:~/projects/hipl--userspace--2.6# ip xfrm state show
 s

Re: ESP interfamily tunnel bug?

2007-04-19 Thread Kazunori MIYAZAWA

I'm using a machine and a dummy device.
So I'm using loopback communication.
Yes, the backtrace is correct.

I thought you used loopback communication to test the modes
because your configuration showed that the dummy device has
some addresses and you did ping from the address to the other
address.

Is not right? Did you use two or more hosts?

I do not have enough environment to test today.
I'll test it with a couple of machines tomorrow.

Diego Beltrami wrote:

Hi Kazunori,
thanks for reply.

In your backtrace I see that there are both input and output functions calls. Is
it the right way?

One more thing, were your two hosts you used located on the same network?
In fact it seems that if the machines are on the same network, this bug doesn't
manifest.

Thanks,

Diego



Hello Diego,

I tried to reproduce the bug. But I got a panic of the kernel :-<
I'm using current net-2.6.

I suspect that some special routing for loopback is related
because I checked with kdb and got the backtrace like

fib_sync_down
ipv6_rcv
netif_receive_skb
__mod_timer
net_rx_action
__do_softirq
do_softirq
local_bh_enable
dev_queue_xmit
neigh_resolve_output
ip_output
xfrm4_output_finish
xfrm4_output
ip_generic_getfrag
ip6_push_pending_frames

I think ip_rcv or some IPv4 function should be called between
netif_receive_skb
and ipv6_rcv.

Anyway I could not classify the way to make a panic.
I'll trace it.

Thank you,

Diego Beltrami wrote:

Hi,

we have discovered a routing related problem in ESP tunnel and beet mode.
We don't know whether it is a bug in the XFRM, or just in the way the
virtual addresses and the corresponding routes are set-up. We set up a
dummy0 device for the virtual addresses:

[EMAIL PROTECTED]:~# ip addr show dummy0
5: dummy0:  mtu 1500 qdisc noqueue
 link/ether 92:09:fe:11:81:1b brd ff:ff:ff:ff:ff:ff
 inet6 2001:72:e6d3:1cf3:e11d:5bb0:b99:e85e/28 scope global
valid_lft forever preferred_lft forever
 inet6 2001:74:32e0:df36:e862:3963:523e:dd7d/28 scope global
valid_lft forever preferred_lft forever
 inet6 2001:73:d3a8:8723:d572:7549:7f2c:e590/28 scope global
valid_lft forever preferred_lft forever
 inet6 2001:75:a2e6:aad6:e901:dd1c:ba95:e300/28 scope global
valid_lft forever preferred_lft forever
 inet6 fe80::9009:feff:fe11:811b/64 scope link
valid_lft forever preferred_lft forever

And then we have routes for the virtual addresses:

[EMAIL PROTECTED]:~# ip -6 route
2001:72:e6d3:1cf3:e11d:5bb0:b99:e85e dev dummy0  metric 1024  expires
21334305sec mtu 1500 advmss 1440 metric 10 4294967295
2001:73:d3a8:8723:d572:7549:7f2c:e590 dev dummy0  metric 1024  expires
21334305sec mtu 1500 advmss 1440 metric 10 4294967295
2001:74:32e0:df36:e862:3963:523e:dd7d dev dummy0  metric 1024  expires
21334305sec mtu 1500 advmss 1440 metric 10 4294967295
2001:75:a2e6:aad6:e901:dd1c:ba95:e300 dev dummy0  metric 1024  expires
21334305sec mtu 1500 advmss 1440 metric 10 4294967295
2001:70::/28 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss
1440 metric 10 4294967295
fe80::/64 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss 1440
metric 10 4294967295
ff00::/8 dev eth0  metric 256  expires 21325454sec mtu 1500 advmss 1440
metric 10 4294967295
ff00::/8 dev dummy0  metric 256  expires 21334305sec mtu 1500 advmss 1440
metric 10 4294967295
unreachable default dev lo  proto none  metric -1  error -101 metric 10
255

...and set-up policies and associations. The virtual IPv6 addresses
are inner and IPv4 addresses are outer addresses:

[EMAIL PROTECTED]:~/projects/hipl--userspace--2.6# ip xfrm policy show
src 2001:76:7d5a:88d7:51af:cdd1:6bf5:3d15/128 dst
2001:74:32e0:df36:e862:3963:523e:dd7d/128
 dir in priority 0
 tmpl src c1a7:bb82:: dst c0a8:65::
 proto esp reqid 0 mode beet
src 2001:74:32e0:df36:e862:3963:523e:dd7d/128 dst
2001:76:7d5a:88d7:51af:cdd1:6bf5:3d15/128
 dir out priority 0
 tmpl src c0a8:65:: dst c1a7:bb82::
 proto esp reqid 0 mode beet

[EMAIL PROTECTED]:~/projects/hipl--userspace--2.6# ip xfrm state show
src 193.167.187.130 dst 192.168.0.101
 proto esp spi 0xf556c7c7 reqid 0 mode beet
 replay-window 0
 auth sha1 0xab327b944011c94a0c54a097b4752e23f377ff34
 enc aes 0x882a334830b1cd14b9e411ec37a4242f
 encap type espinudp-nonike sport 50500 dport 50500
   addr 193.167.187.130
 sel src 2001:76:7d5a:88d7:51af:cdd1:6bf5:3d15/0
 dst 2001:74:32e0:df36:e862:3963:523e:dd7d/0
 src 192.168.0.101 dst 193.167.187.130
 proto esp spi 0x1663f3a4 reqid 0 mode beet
 replay-window 0
 auth sha1 0x9f07dabce4abf2ebfe45e247ede2cf15f9156a13
 enc aes 0xfc50593b9af6d296b042a16ca00bad20
 encap type espinudp-nonike
 sport 50500 dport 50500 addr 192.168.0.101
   

[RFC] [GIT PATCH net-2.6.23] IPV6: Configurable IPv6 address selection policy table (RFC3484)

2007-04-19 Thread YOSHIFUJI Hideaki / 吉藤英明
Hello.

This is RFC(*) for supporting configurable IPv6 address selection policy
table, which is described in RFC3484.

Corresponding userspace tool is available at

.


We store labels only in kernel, and leave precedence in userspace
(/etc/gai.conf), so far.  The name resolution library (getaddrinfo(3))
is required to be changed to try reading label information from kernel.
On the other hand, on BSDs or on Solaris, full policy table including
precedence seems to be stored in kernel, and the name resolution
libary (getaddrinfo(3)) seems to use that information.
We could choose this approach.

Note: Solaris uses string (up to 15 characters excluding NUL) labels.

At this moment, glibc does not reload /etc/gai.conf promptly by default.
According to getaddrinfo(3) manpage, getaddrinfo(3) does not seem
thread safe if we put "reload yes" in the configuration file (/etc/gai.conf).
We probably need to fix that.

Problems in current approach:

Currently when the getaddrinfo(3) tries to reload /etc/gai.conf,
it performs fstat to check if the file is updated.  However, procfs
always reports current time as modification time, so getaddrinfo(3)
will always need to reload procfs.  To further optimization we should
touch procfs subsystem.

Another issue in procfs is it is not atomic.
To solve this issue, we probably need to support netlink
interface.  However, I am not sure how we can optimize reading 
policy from kernel with this approach.


Another problem.  I put several new ioctls in include/linux/ipv6.h, but
I guess it is very hard to include that file from userspace... sigh...

TODOs: Probably we should use RCUs.


Comments / optimions welcome.


*: We do not expect this will be included in net-2.6.22,
but 2.6.23 or so.

Regrads,

-

HEADLINES
-

[IPV6] ADDRCONF: define and export constant for ::.
[IPV6] ADDRCONF: Prepare supporting source address selection policy with 
ifindex.
[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy 
table.

DIFFSTAT


 include/linux/in6.h|2 
 include/linux/ipv6.h   |   16 ++
 include/net/addrconf.h |4 
 include/net/ipv6.h |5 +
 net/ipv6/Makefile  |1 
 net/ipv6/addrconf.c|   50 ++---
 net/ipv6/addrlabel.c   |  454 
 net/ipv6/af_inet6.c|3 
 8 files changed, 498 insertions(+), 37 deletions(-)

CHANGESETS
--

commit 27bafd017775cffa86d60eea179b68c4b90c4ae7
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 00:12:49 2007 +0900

[IPV6] ADDRCONF: define and export constant for ::.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/include/linux/in6.h b/include/linux/in6.h
index d559fac..2a61c82 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
  * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
  * in network byte order, not in host byte order as are the IPv4 equivalents
  */
-#if 0
 extern const struct in6_addr in6addr_any;
 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
-#endif
 extern const struct in6_addr in6addr_loopback;
 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 47d3adf..371ee2f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -206,9 +206,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly 
= {
 };
 
 /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
-#if 0
 const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
-#endif
 const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
 
 static void addrconf_del_timer(struct inet6_ifaddr *ifp)

---
commit ce50931887ad6bdf951f1b165bd76e1cda9adf97
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 00:21:23 2007 +0900

[IPV6] ADDRCONF: Prepare supporting source address selection policy with 
ifindex.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 371ee2f..c61fb62 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -831,7 +831,8 @@ static inline int ipv6_saddr_preferred(int type)
 }
 
 /* static matching label */
-static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
+static inline int ipv6_saddr_label(const struct in6_addr *addr, int type,
+  int ifindex)
 {
  /*
   *prefix (longest match)  label
@@ -866,7 +867,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
struct inet6_ifaddr *ifa_result = NULL;
int daddr_type = __ipv6_addr_type(daddr);
int daddr_scope = __ipv6_addr_src_scope(daddr_type);
-   u32 daddr_label = ipv6_saddr_label(daddr, daddr_type);
+   int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;
+   u32 daddr_label = ipv