]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/core/dev_mcast.c
[PATCH] remove many unneeded #includes of sched.h
[linux-2.6-omap-h63xx.git] / net / core / dev_mcast.c
index 05d60850840e07a0d0beba51baf2b53fb622a883..56b310c0c860af79db12593d6efbe48f793e034d 100644 (file)
@@ -1,12 +1,12 @@
 /*
- *     Linux NET3:     Multicast List maintenance. 
+ *     Linux NET3:     Multicast List maintenance.
  *
  *     Authors:
- *             Tim Kordas <tjk@nostromo.eeap.cwru.edu> 
+ *             Tim Kordas <tjk@nostromo.eeap.cwru.edu>
  *             Richard Underwood <richard@wuzz.demon.co.uk>
  *
  *     Stir fried together from the IP multicast and CAP patches above
- *             Alan Cox <Alan.Cox@linux.org>   
+ *             Alan Cox <Alan.Cox@linux.org>
  *
  *     Fixes:
  *             Alan Cox        :       Update the device on a real delete
  *     2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h> 
-#include <linux/module.h> 
+#include <linux/module.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/socket.h>
 
 
 /*
- *     Device multicast list maintenance. 
+ *     Device multicast list maintenance.
  *
- *     This is used both by IP and by the user level maintenance functions. 
- *     Unlike BSD we maintain a usage count on a given multicast address so 
- *     that a casual user application can add/delete multicasts used by 
+ *     This is used both by IP and by the user level maintenance functions.
+ *     Unlike BSD we maintain a usage count on a given multicast address so
+ *     that a casual user application can add/delete multicasts used by
  *     protocols without doing damage to the protocols when it deletes the
  *     entries. It also helps IP as it tracks overlapping maps.
  *
  *     Device mc lists are changed by bh at least if IPv6 is enabled,
  *     so that it must be bh protected.
  *
- *     We block accesses to device mc filters with dev->xmit_lock.
+ *     We block accesses to device mc filters with netif_tx_lock.
  */
 
 /*
  *     Update the multicast list into the physical NIC controller.
  */
+
 static void __dev_mc_upload(struct net_device *dev)
 {
        /* Don't do anything till we up the interface
@@ -93,21 +91,21 @@ static void __dev_mc_upload(struct net_device *dev)
 
 void dev_mc_upload(struct net_device *dev)
 {
-       spin_lock_bh(&dev->xmit_lock);
+       netif_tx_lock_bh(dev);
        __dev_mc_upload(dev);
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
 }
 
 /*
  *     Delete a device level multicast
  */
+
 int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
 {
        int err = 0;
        struct dev_mc_list *dmi, **dmip;
 
-       spin_lock_bh(&dev->xmit_lock);
+       netif_tx_lock_bh(dev);
 
        for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; dmip = &dmi->next) {
                /*
@@ -138,21 +136,21 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
                         *      loaded filter is now wrong. Fix it
                         */
                        __dev_mc_upload(dev);
-                       
-                       spin_unlock_bh(&dev->xmit_lock);
+
+                       netif_tx_unlock_bh(dev);
                        return 0;
                }
        }
        err = -ENOENT;
 done:
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
        return err;
 }
 
 /*
  *     Add a device level multicast
  */
+
 int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
 {
        int err = 0;
@@ -160,7 +158,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
 
        dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC);
 
-       spin_lock_bh(&dev->xmit_lock);
+       netif_tx_lock_bh(dev);
        for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) {
                if (memcmp(dmi->dmi_addr, addr, dmi->dmi_addrlen) == 0 &&
                    dmi->dmi_addrlen == alen) {
@@ -176,7 +174,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
        }
 
        if ((dmi = dmi1) == NULL) {
-               spin_unlock_bh(&dev->xmit_lock);
+               netif_tx_unlock_bh(dev);
                return -ENOMEM;
        }
        memcpy(dmi->dmi_addr, addr, alen);
@@ -188,12 +186,12 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
        dev->mc_count++;
 
        __dev_mc_upload(dev);
-       
-       spin_unlock_bh(&dev->xmit_lock);
+
+       netif_tx_unlock_bh(dev);
        return 0;
 
 done:
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
        kfree(dmi1);
        return err;
 }
@@ -204,8 +202,8 @@ done:
 
 void dev_mc_discard(struct net_device *dev)
 {
-       spin_lock_bh(&dev->xmit_lock);
-       
+       netif_tx_lock_bh(dev);
+
        while (dev->mc_list != NULL) {
                struct dev_mc_list *tmp = dev->mc_list;
                dev->mc_list = tmp->next;
@@ -215,7 +213,7 @@ void dev_mc_discard(struct net_device *dev)
        }
        dev->mc_count = 0;
 
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
 }
 
 #ifdef CONFIG_PROC_FS
@@ -226,7 +224,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
 
        read_lock(&dev_base_lock);
        for (dev = dev_base; dev; dev = dev->next) {
-               if (off++ == *pos) 
+               if (off++ == *pos)
                        return dev;
        }
        return NULL;
@@ -250,7 +248,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
        struct dev_mc_list *m;
        struct net_device *dev = v;
 
-       spin_lock_bh(&dev->xmit_lock);
+       netif_tx_lock_bh(dev);
        for (m = dev->mc_list; m; m = m->next) {
                int i;
 
@@ -262,7 +260,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
 
                seq_putc(seq, '\n');
        }
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
        return 0;
 }
 
@@ -278,7 +276,7 @@ static int dev_mc_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &dev_mc_seq_ops);
 }
 
-static struct file_operations dev_mc_seq_fops = {
+static const struct file_operations dev_mc_seq_fops = {
        .owner   = THIS_MODULE,
        .open    = dev_mc_seq_open,
        .read    = seq_read,