]> err.no Git - linux-2.6/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 18 Jun 2008 19:55:00 +0000 (12:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 18 Jun 2008 19:55:00 +0000 (12:55 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  Revert "[WATCHDOG] hpwdt: Fix NMI handling."
  [WATCHDOG] hpwdt: Add CFLAGS to get driver working
  Revert "[WATCHDOG] make watchdog/hpwdt.c:asminline_call() static"

64 files changed:
.gitignore
arch/powerpc/kernel/head_44x.S
arch/powerpc/mm/hash_low_64.S
arch/x86/lib/copy_user_64.S
arch/x86/lib/copy_user_nocache_64.S
drivers/atm/he.c
drivers/atm/he.h
drivers/atm/iphase.c
drivers/input/misc/Kconfig
drivers/input/mouse/appletouch.c
drivers/input/serio/i8042-x86ia64io.h
drivers/input/serio/i8042.c
drivers/net/atlx/atl1.c
drivers/net/enc28j60.c
drivers/net/ibm_newemac/Kconfig
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_ethtool.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/netxen/netxen_nic_isr.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/netxen/netxen_nic_niu.c
drivers/net/sky2.c
drivers/net/tun.c
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/dma.c
drivers/net/wireless/b43/main.c
drivers/net/wireless/rt2x00/Kconfig
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt73usb.c
drivers/scsi/dpt/dptsig.h
drivers/scsi/hosts.c
drivers/scsi/sr.c
drivers/ssb/main.c
drivers/usb/core/quirks.c
fs/fuse/inode.c
fs/ocfs2/cluster/nodemanager.c
fs/ocfs2/cluster/nodemanager.h
fs/ocfs2/stack_o2cb.c
fs/ocfs2/stack_user.c
fs/ocfs2/stackglue.c
fs/ocfs2/stackglue.h
fs/udf/udfdecl.h
include/linux/if_tunnel.h
include/net/netfilter/nf_conntrack_extend.h
net/atm/br2684.c
net/core/dev.c
net/ipv4/inet_connection_sock.c
net/ipv4/netfilter/nf_nat_core.c
net/ipv4/raw.c
net/ipv4/tcp_ipv4.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/sit.c
net/mac80211/tx.c
net/mac80211/wext.c
net/mac80211/wme.c
net/netfilter/nf_conntrack_extend.c
net/netfilter/nf_conntrack_h323_main.c
net/netlink/genetlink.c
net/sched/sch_htb.c
net/sctp/associola.c
net/sctp/protocol.c
net/unix/af_unix.c

index d24ad506e799a5740d19913a333fc9d64261d9c7..9bb1cb6d825d540bc92dfe5c34343438b860b009 100644 (file)
@@ -26,6 +26,7 @@ tags
 TAGS
 vmlinux*
 !vmlinux.lds.S
+!vmlinux.lds.h
 System.map
 Module.markers
 Module.symvers
index c2b9dc4fce5d24a4021972f5337d66828faca918..22b5d2c459a3bb927bd157966843e71ac729b69b 100644 (file)
@@ -368,7 +368,12 @@ interrupt_base:
 
        rlwimi  r11,r13,0,26,31         /* Insert static perms */
 
-       rlwinm  r11,r11,0,20,15         /* Clear U0-U3 */
+       /*
+        * Clear U0-U3 and WL1 IL1I IL1D IL2I IL2D bits which are added
+        * on newer 440 cores like the 440x6 used on AMCC 460EX/460GT (see
+        * include/asm-powerpc/pgtable-ppc32.h for details).
+        */
+       rlwinm  r11,r11,0,20,10
 
        /* find the TLB index that caused the fault.  It has to be here. */
        tlbsx   r10, 0, r10
index 21d248486479e29b2f6e59d026b29e812ab26c67..70f4c833fa32c51b300c3a69bb53b00f4925e3a9 100644 (file)
@@ -568,6 +568,10 @@ htab_inval_old_hpte:
        ld      r7,STK_PARM(r9)(r1)     /* ssize */
        ld      r8,STK_PARM(r8)(r1)     /* local */
        bl      .flush_hash_page
+       /* Clear out _PAGE_HPTE_SUB bits in the new linux PTE */
+       lis     r0,_PAGE_HPTE_SUB@h
+       ori     r0,r0,_PAGE_HPTE_SUB@l
+       andc    r30,r30,r0
        b       htab_insert_pte
        
 htab_bail_ok:
index 70bebd310408b98b531a721f7d83ca4ee97d0369..ee1c3f635157b397e4fd70c0060b81e3ff3f34b1 100644 (file)
@@ -217,19 +217,19 @@ ENTRY(copy_user_generic_unrolled)
        /* table sorted by exception address */
        .section __ex_table,"a"
        .align 8
-       .quad .Ls1,.Ls1e
-       .quad .Ls2,.Ls2e
-       .quad .Ls3,.Ls3e
-       .quad .Ls4,.Ls4e
-       .quad .Ld1,.Ls1e
+       .quad .Ls1,.Ls1e        /* Ls1-Ls4 have copied zero bytes */
+       .quad .Ls2,.Ls1e
+       .quad .Ls3,.Ls1e
+       .quad .Ls4,.Ls1e
+       .quad .Ld1,.Ls1e        /* Ld1-Ld4 have copied 0-24 bytes */
        .quad .Ld2,.Ls2e
        .quad .Ld3,.Ls3e
        .quad .Ld4,.Ls4e
-       .quad .Ls5,.Ls5e
-       .quad .Ls6,.Ls6e
-       .quad .Ls7,.Ls7e
-       .quad .Ls8,.Ls8e
-       .quad .Ld5,.Ls5e
+       .quad .Ls5,.Ls5e        /* Ls5-Ls8 have copied 32 bytes */
+       .quad .Ls6,.Ls5e
+       .quad .Ls7,.Ls5e
+       .quad .Ls8,.Ls5e
+       .quad .Ld5,.Ls5e        /* Ld5-Ld8 have copied 32-56 bytes */
        .quad .Ld6,.Ls6e
        .quad .Ld7,.Ls7e
        .quad .Ld8,.Ls8e
@@ -244,11 +244,8 @@ ENTRY(copy_user_generic_unrolled)
        .quad .Le5,.Le_zero
        .previous
 
-       /* compute 64-offset for main loop. 8 bytes accuracy with error on the
-          pessimistic side. this is gross. it would be better to fix the
-          interface. */
        /* eax: zero, ebx: 64 */
-.Ls1e:         addl $8,%eax
+.Ls1e:         addl $8,%eax            /* eax is bytes left uncopied within the loop (Ls1e: 64 .. Ls8e: 8) */
 .Ls2e:         addl $8,%eax
 .Ls3e:         addl $8,%eax
 .Ls4e:         addl $8,%eax
index 5196762b3b0ea3017cbb43e97f253c68055a1a7f..9d3d1ab83763311b95acc0b38c87405bde3a5652 100644 (file)
@@ -145,19 +145,19 @@ ENTRY(__copy_user_nocache)
        /* table sorted by exception address */
        .section __ex_table,"a"
        .align 8
-       .quad .Ls1,.Ls1e
-       .quad .Ls2,.Ls2e
-       .quad .Ls3,.Ls3e
-       .quad .Ls4,.Ls4e
-       .quad .Ld1,.Ls1e
+       .quad .Ls1,.Ls1e        /* .Ls[1-4] - 0 bytes copied */
+       .quad .Ls2,.Ls1e
+       .quad .Ls3,.Ls1e
+       .quad .Ls4,.Ls1e
+       .quad .Ld1,.Ls1e        /* .Ld[1-4] - 0..24 bytes coped */
        .quad .Ld2,.Ls2e
        .quad .Ld3,.Ls3e
        .quad .Ld4,.Ls4e
-       .quad .Ls5,.Ls5e
-       .quad .Ls6,.Ls6e
-       .quad .Ls7,.Ls7e
-       .quad .Ls8,.Ls8e
-       .quad .Ld5,.Ls5e
+       .quad .Ls5,.Ls5e        /* .Ls[5-8] - 32 bytes copied */
+       .quad .Ls6,.Ls5e
+       .quad .Ls7,.Ls5e
+       .quad .Ls8,.Ls5e
+       .quad .Ld5,.Ls5e        /* .Ld[5-8] - 32..56 bytes copied */
        .quad .Ld6,.Ls6e
        .quad .Ld7,.Ls7e
        .quad .Ld8,.Ls8e
@@ -172,11 +172,8 @@ ENTRY(__copy_user_nocache)
        .quad .Le5,.Le_zero
        .previous
 
-       /* compute 64-offset for main loop. 8 bytes accuracy with error on the
-          pessimistic side. this is gross. it would be better to fix the
-          interface. */
        /* eax: zero, ebx: 64 */
-.Ls1e:         addl $8,%eax
+.Ls1e:         addl $8,%eax    /* eax: bytes left uncopied: Ls1e: 64 .. Ls8e: 8 */
 .Ls2e:         addl $8,%eax
 .Ls3e:         addl $8,%eax
 .Ls4e:         addl $8,%eax
index ffc4a5a419465da6e749a084926b21c69fc2a50b..ea495b21f916a5d0d27eff00f12a6e78f7a6d4da 100644 (file)
@@ -1542,7 +1542,8 @@ he_start(struct atm_dev *dev)
        /* initialize framer */
 
 #ifdef CONFIG_ATM_HE_USE_SUNI
-       suni_init(he_dev->atm_dev);
+       if (he_isMM(he_dev))
+               suni_init(he_dev->atm_dev);
        if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start)
                he_dev->atm_dev->phy->start(he_dev->atm_dev);
 #endif /* CONFIG_ATM_HE_USE_SUNI */
@@ -1554,6 +1555,7 @@ he_start(struct atm_dev *dev)
                val = he_phy_get(he_dev->atm_dev, SUNI_TPOP_APM);
                val = (val & ~SUNI_TPOP_APM_S) | (SUNI_TPOP_S_SDH << SUNI_TPOP_APM_S_SHIFT);
                he_phy_put(he_dev->atm_dev, val, SUNI_TPOP_APM);
+               he_phy_put(he_dev->atm_dev, SUNI_TACP_IUCHP_CLP, SUNI_TACP_IUCHP);
        }
 
        /* 5.1.12 enable transmit and receive */
@@ -2844,10 +2846,15 @@ he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg)
                        if (copy_from_user(&reg, arg,
                                           sizeof(struct he_ioctl_reg)))
                                return -EFAULT;
-                       
+
                        spin_lock_irqsave(&he_dev->global_lock, flags);
                        switch (reg.type) {
                                case HE_REGTYPE_PCI:
+                                       if (reg.addr < 0 || reg.addr >= HE_REGMAP_SIZE) {
+                                               err = -EINVAL;
+                                               break;
+                                       }
+
                                        reg.val = he_readl(he_dev, reg.addr);
                                        break;
                                case HE_REGTYPE_RCM:
index fe6cd15a78a4f219f3f9500962268bd237541f69..b87d6ccabac12f4c55c84ab270111eafcc7c16d3 100644 (file)
@@ -267,13 +267,7 @@ struct he_dev {
 
        char prod_id[30];
        char mac_addr[6];
-       int media;                      /*  
-                                        *  0x26 = HE155 MM 
-                                        *  0x27 = HE622 MM 
-                                        *  0x46 = HE155 SM 
-                                        *  0x47 = HE622 SM 
-                                        */
-
+       int media;
 
        unsigned int vcibits, vpibits;
        unsigned int cells_per_row;
@@ -392,6 +386,7 @@ struct he_vcc
 #define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data)
 
 #define he_is622(dev)  ((dev)->media & 0x1)
+#define he_isMM(dev)   ((dev)->media & 0x20)
 
 #define HE_REGMAP_SIZE 0x100000
 
@@ -876,8 +871,8 @@ struct he_vcc
 #define M_SN           0x3a    /* integer */
 #define MEDIA          0x3e    /* integer */
 #define  HE155MM       0x26
-#define  HE155SM       0x27
-#define  HE622MM       0x46
+#define  HE622MM       0x27
+#define  HE155SM       0x46
 #define  HE622SM       0x47
 #define MAC_ADDR       0x42    /* char[] */
 
index 5c28ca7380ff6fa0683599178cbd17af6109e8d4..139fce6968a6382637df695af6899321a429dd9f 100644 (file)
@@ -2562,17 +2562,11 @@ static int __devinit ia_start(struct atm_dev *dev)
                error = suni_init(dev);
                if (error)
                        goto err_free_rx;
-               /* 
-                * Enable interrupt on loss of signal
-                * SUNI_RSOP_CIE - 0x10
-                * SUNI_RSOP_CIE_LOSE - 0x04
-                */
-               ia_phy_put(dev, ia_phy_get(dev, 0x10) | 0x04, 0x10);
-#ifndef MODULE
-               error = dev->phy->start(dev);
-               if (error)
-                       goto err_free_rx;
-#endif
+               if (dev->phy->start) {
+                       error = dev->phy->start(dev);
+                       if (error)
+                               goto err_free_rx;
+               }
                /* Get iadev->carrier_detect status */
                IaFrontEndIntr(iadev);
        }
@@ -3198,6 +3192,8 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
        IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev,
                iadev->LineRate);)
 
+       pci_set_drvdata(pdev, dev);
+
        ia_dev[iadev_count] = iadev;
        _ia_dev[iadev_count] = dev;
        iadev_count++;
@@ -3219,8 +3215,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
        iadev->next_board = ia_boards;  
        ia_boards = dev;  
 
-       pci_set_drvdata(pdev, dev);
-
        return 0;
 
 err_out_deregister_dev:
@@ -3238,9 +3232,14 @@ static void __devexit ia_remove_one(struct pci_dev *pdev)
        struct atm_dev *dev = pci_get_drvdata(pdev);
        IADEV *iadev = INPH_IA_DEV(dev);
 
-       ia_phy_put(dev, ia_phy_get(dev,0x10) & ~(0x4), 0x10); 
+       /* Disable phy interrupts */
+       ia_phy_put(dev, ia_phy_get(dev, SUNI_RSOP_CIE) & ~(SUNI_RSOP_CIE_LOSE),
+                                  SUNI_RSOP_CIE);
        udelay(1);
 
+       if (dev->phy && dev->phy->stop)
+               dev->phy->stop(dev);
+
        /* De-register device */  
        free_irq(iadev->irq, dev);
        iadev_count--;
index 3ad8bd9f75436efd29fd3054a79e89a668219b4a..432699d61c58ed3e8b39d4d5d250b045a972abc4 100644 (file)
@@ -15,7 +15,6 @@ if INPUT_MISC
 config INPUT_PCSPKR
        tristate "PC Speaker support"
        depends on PCSPKR_PLATFORM
-       depends on SND_PCSP=n
        help
          Say Y here if you want the standard PC Speaker to be used for
          bells and whistles.
index 8dd3942f302205a6e8abbac51e991df1ff07323f..ce6fdec19e148c0e250b9fb3f1e572197e31d120 100644 (file)
@@ -589,6 +589,21 @@ static void atp_close(struct input_dev *input)
        dev->open = 0;
 }
 
+static int atp_handle_geyser(struct atp *dev)
+{
+       struct usb_device *udev = dev->udev;
+
+       if (!atp_is_fountain(dev)) {
+               /* switch to raw sensor mode */
+               if (atp_geyser_init(udev))
+                       return -EIO;
+
+               printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
+       }
+
+       return 0;
+}
+
 static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id)
 {
        struct atp *dev;
@@ -633,14 +648,6 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
        else
                dev->datalen = 81;
 
-       if (!atp_is_fountain(dev)) {
-               /* switch to raw sensor mode */
-               if (atp_geyser_init(udev))
-                       goto err_free_devs;
-
-               printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
-       }
-
        dev->urb = usb_alloc_urb(0, GFP_KERNEL);
        if (!dev->urb)
                goto err_free_devs;
@@ -654,6 +661,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
                         usb_rcvintpipe(udev, int_in_endpointAddr),
                         dev->data, dev->datalen, atp_complete, dev, 1);
 
+       error = atp_handle_geyser(dev);
+       if (error)
+               goto err_free_buffer;
+
        usb_make_path(udev, dev->phys, sizeof(dev->phys));
        strlcat(dev->phys, "/input0", sizeof(dev->phys));
 
@@ -744,6 +755,20 @@ static void atp_disconnect(struct usb_interface *iface)
        printk(KERN_INFO "input: appletouch disconnected\n");
 }
 
+static int atp_recover(struct atp *dev)
+{
+       int error;
+
+       error = atp_handle_geyser(dev);
+       if (error)
+               return error;
+
+       if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC))
+               return -EIO;
+
+       return 0;
+}
+
 static int atp_suspend(struct usb_interface *iface, pm_message_t message)
 {
        struct atp *dev = usb_get_intfdata(iface);
@@ -764,12 +789,20 @@ static int atp_resume(struct usb_interface *iface)
        return 0;
 }
 
+static int atp_reset_resume(struct usb_interface *iface)
+{
+       struct atp *dev = usb_get_intfdata(iface);
+
+       return atp_recover(dev);
+}
+
 static struct usb_driver atp_driver = {
        .name           = "appletouch",
        .probe          = atp_probe,
        .disconnect     = atp_disconnect,
        .suspend        = atp_suspend,
        .resume         = atp_resume,
+       .reset_resume   = atp_reset_resume,
        .id_table       = atp_table,
 };
 
index 9aafa96cb7460a2e35d465af1687c663542551a7..78eb7841174cbbbe7a1a2d8b88941aa195d76bbf 100644 (file)
@@ -192,6 +192,13 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
                },
        },
+       {
+               .ident = "Fujitsu-Siemens Amilo Pro 2030",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
+               },
+       },
        {
                /*
                 * No data is coming from the touchscreen unless KBC
index 592ff55b62d0684bdcee4e09c549e62ad62f4b8e..170f71ee5772cda51f08298ccf7dd779ffa14bba 100644 (file)
@@ -952,8 +952,12 @@ static int i8042_resume(struct platform_device *dev)
        i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS;
        i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT);
        if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
-               printk(KERN_ERR "i8042: Can't write CTR to resume\n");
-               return -EIO;
+               printk(KERN_WARNING "i8042: Can't write CTR to resume, retrying...\n");
+               msleep(50);
+               if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+                       printk(KERN_ERR "i8042: CTR write retry failed\n");
+                       return -EIO;
+               }
        }
 
 
index 99e0b4cdc56fad301c59b01a1d7ae701da789265..3c798ae5c343a4c1bb9c7a76ff90293b4548c848 100644 (file)
@@ -471,7 +471,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
                        memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
                        return 0;
                }
-               return 1;
        }
 
        /* see if SPI FLAGS exist ? */
index 46a90e9ec56320e4eaca6d48ba21c6d463981ddc..c05cb159c7726eff1286660aa78716ad49a1aa91 100644 (file)
@@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
        mutex_unlock(&priv->lock);
 }
 
-/*
- * Wait until the PHY operation is complete.
- */
-static int wait_phy_ready(struct enc28j60_net *priv)
+static unsigned long msec20_to_jiffies;
+
+static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
 {
-       unsigned long timeout = jiffies + 20 * HZ / 1000;
-       int ret = 1;
+       unsigned long timeout = jiffies + msec20_to_jiffies;
 
        /* 20 msec timeout read */
-       while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) {
+       while ((nolock_regb_read(priv, reg) & mask) != val) {
                if (time_after(jiffies, timeout)) {
                        if (netif_msg_drv(priv))
-                               printk(KERN_DEBUG DRV_NAME
-                                       ": PHY ready timeout!\n");
-                       ret = 0;
-                       break;
+                               dev_dbg(&priv->spi->dev,
+                                       "reg %02x ready timeout!\n", reg);
+                       return -ETIMEDOUT;
                }
                cpu_relax();
        }
-       return ret;
+       return 0;
+}
+
+/*
+ * Wait until the PHY operation is complete.
+ */
+static int wait_phy_ready(struct enc28j60_net *priv)
+{
+       return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1;
 }
 
 /*
@@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
        nolock_regw_write(priv, ETXNDL, end);
 }
 
+/*
+ * Low power mode shrinks power consumption about 100x, so we'd like
+ * the chip to be in that mode whenever it's inactive.  (However, we
+ * can't stay in lowpower mode during suspend with WOL active.)
+ */
+static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
+{
+       if (netif_msg_drv(priv))
+               dev_dbg(&priv->spi->dev, "%s power...\n",
+                               is_low ? "low" : "high");
+
+       mutex_lock(&priv->lock);
+       if (is_low) {
+               nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
+               poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0);
+               poll_ready(priv, ECON1, ECON1_TXRTS, 0);
+               /* ECON2_VRPS was set during initialization */
+               nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
+       } else {
+               nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
+               poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY);
+               /* caller sets ECON1_RXEN */
+       }
+       mutex_unlock(&priv->lock);
+}
+
 static int enc28j60_hw_init(struct enc28j60_net *priv)
 {
        u8 reg;
@@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
        priv->tx_retry_count = 0;
        priv->max_pk_counter = 0;
        priv->rxfilter = RXFILTER_NORMAL;
-       /* enable address auto increment */
-       nolock_regb_write(priv, ECON2, ECON2_AUTOINC);
+       /* enable address auto increment and voltage regulator powersave */
+       nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS);
 
        nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT);
        nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT);
@@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
 
 static void enc28j60_hw_enable(struct enc28j60_net *priv)
 {
-       /* enable interrutps */
+       /* enable interrupts */
        if (netif_msg_hw(priv))
                printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n",
                        __FUNCTION__);
@@ -726,15 +757,12 @@ enc28j60_setlink(struct net_device *ndev, u8 autoneg, u16 speed, u8 duplex)
        int ret = 0;
 
        if (!priv->hw_enable) {
-               if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
+               /* link is in low power mode now; duplex setting
+                * will take effect on next enc28j60_hw_init().
+                */
+               if (autoneg == AUTONEG_DISABLE && speed == SPEED_10)
                        priv->full_duplex = (duplex == DUPLEX_FULL);
-                       if (!enc28j60_hw_init(priv)) {
-                               if (netif_msg_drv(priv))
-                                       dev_err(&ndev->dev,
-                                               "hw_reset() failed\n");
-                               ret = -EINVAL;
-                       }
-               } else {
+               else {
                        if (netif_msg_link(priv))
                                dev_warn(&ndev->dev,
                                        "unsupported link setting\n");
@@ -1307,7 +1335,8 @@ static int enc28j60_net_open(struct net_device *dev)
                }
                return -EADDRNOTAVAIL;
        }
-       /* Reset the hardware here */
+       /* Reset the hardware here (and take it out of low power mode) */
+       enc28j60_lowpower(priv, false);
        enc28j60_hw_disable(priv);
        if (!enc28j60_hw_init(priv)) {
                if (netif_msg_ifup(priv))
@@ -1337,6 +1366,7 @@ static int enc28j60_net_close(struct net_device *dev)
                printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__);
 
        enc28j60_hw_disable(priv);
+       enc28j60_lowpower(priv, true);
        netif_stop_queue(dev);
 
        return 0;
@@ -1537,6 +1567,8 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
        dev->watchdog_timeo = TX_TIMEOUT;
        SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);
 
+       enc28j60_lowpower(priv, true);
+
        ret = register_netdev(dev);
        if (ret) {
                if (netif_msg_probe(priv))
@@ -1556,7 +1588,7 @@ error_alloc:
        return ret;
 }
 
-static int enc28j60_remove(struct spi_device *spi)
+static int __devexit enc28j60_remove(struct spi_device *spi)
 {
        struct enc28j60_net *priv = dev_get_drvdata(&spi->dev);
 
@@ -1573,15 +1605,16 @@ static int enc28j60_remove(struct spi_device *spi)
 static struct spi_driver enc28j60_driver = {
        .driver = {
                   .name = DRV_NAME,
-                  .bus = &spi_bus_type,
                   .owner = THIS_MODULE,
-                  },
+        },
        .probe = enc28j60_probe,
        .remove = __devexit_p(enc28j60_remove),
 };
 
 static int __init enc28j60_init(void)
 {
+       msec20_to_jiffies = msecs_to_jiffies(20);
+
        return spi_register_driver(&enc28j60_driver);
 }
 
index 0d3e7380bad0b268343646668bc38f884c327883..70a3272ee998d646abf7b1c870237d827bc2967f 100644 (file)
@@ -1,6 +1,7 @@
 config IBM_NEW_EMAC
        tristate "IBM EMAC Ethernet support"
        depends on PPC_DCR && PPC_MERGE
+       select CRC32
        help
          This driver supports the IBM EMAC family of Ethernet controllers
          typically found on 4xx embedded PowerPC chips, but also on the
index 8cb29f5b1038a7428f190edf7b288d66b1a46216..da4c4fb9706460d60dce97460574df7c40ad3c51 100644 (file)
@@ -776,7 +776,6 @@ struct netxen_hardware_context {
 
        u8 revision_id;
        u16 board_type;
-       u16 max_ports;
        struct netxen_board_info boardcfg;
        u32 xg_linkup;
        u32 qg_linksup;
@@ -863,6 +862,7 @@ struct netxen_adapter {
        unsigned char mac_addr[ETH_ALEN];
        int mtu;
        int portnum;
+       u8 physical_port;
 
        struct work_struct watchdog_task;
        struct timer_list watchdog_timer;
@@ -1034,7 +1034,6 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
 
 /* Functions from netxen_nic_isr.c */
 void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
-void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
 void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr,
                   struct pci_dev **used_dev);
 void netxen_initialize_adapter_ops(struct netxen_adapter *adapter);
@@ -1077,20 +1076,6 @@ static const struct netxen_brdinfo netxen_boards[] = {
 
 #define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards)
 
-static inline void get_brd_port_by_type(u32 type, int *ports)
-{
-       int i, found = 0;
-       for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
-               if (netxen_boards[i].brdtype == type) {
-                       *ports = netxen_boards[i].ports;
-                       found = 1;
-                       break;
-               }
-       }
-       if (!found)
-               *ports = 0;
-}
-
 static inline void get_brd_name_by_type(u32 type, char *name)
 {
        int i, found = 0;
@@ -1169,5 +1154,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
 
 extern struct ethtool_ops netxen_nic_ethtool_ops;
 
-extern int physical_port[];    /* physical port # from virtual port.*/
 #endif                         /* __NETXEN_NIC_H_ */
index 6e98d830eefb48a4542dc8cb077f2d4df029882f..723487bf200cb3b612b71521252e3a065bf30635 100644 (file)
@@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
                for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
                        /* GB: port specific registers */
                        if (mode == 0 && i >= 19)
-                               window = physical_port[adapter->portnum] *
+                               window = adapter->physical_port *
                                        NETXEN_NIC_PORT_WINDOW;
 
                        NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
@@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
 {
        struct netxen_adapter *adapter = netdev_priv(dev);
        __u32 val;
-       int port = physical_port[adapter->portnum];
+       int port = adapter->physical_port;
 
        if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
                if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
@@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
 {
        struct netxen_adapter *adapter = netdev_priv(dev);
        __u32 val;
-       int port = physical_port[adapter->portnum];
+       int port = adapter->physical_port;
        /* read mode */
        if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
                if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
index af7356468251ec4fc5aedb23a263a2cc7f70a1e5..c43d06b8de9b1b63f01c75e2cca024f122afe1dd 100644 (file)
@@ -396,11 +396,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
        }
        adapter->intr_scheme = readl(
                NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
-       printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name,
-                       adapter->intr_scheme);
        adapter->msi_mode = readl(
                NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW));
-       DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");
 
        addr = netxen_alloc(adapter->ahw.pdev,
                            sizeof(struct netxen_ring_ctx) +
@@ -408,8 +405,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
                            (dma_addr_t *) & adapter->ctx_desc_phys_addr,
                            &adapter->ctx_desc_pdev);
 
-       printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n",
-              (unsigned long long) adapter->ctx_desc_phys_addr);
        if (addr == NULL) {
                DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
                err = -ENOMEM;
@@ -429,8 +424,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
                            adapter->max_tx_desc_count,
                            (dma_addr_t *) & hw->cmd_desc_phys_addr,
                            &adapter->ahw.cmd_desc_pdev);
-       printk(KERN_INFO "cmd_desc_phys_addr: 0x%llx\n",
-              (unsigned long long) hw->cmd_desc_phys_addr);
 
        if (addr == NULL) {
                DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
@@ -1032,15 +1025,15 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
 int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu)
 {
        netxen_nic_write_w0(adapter,
-                       NETXEN_NIU_GB_MAX_FRAME_SIZE(
-                               physical_port[adapter->portnum]), new_mtu);
+               NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port),
+               new_mtu);
        return 0;
 }
 
 int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
 {
        new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
-       if (physical_port[adapter->portnum] == 0)
+       if (adapter->physical_port == 0)
                netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE,
                                new_mtu);
        else
@@ -1051,7 +1044,7 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
 
 void netxen_nic_init_niu_gb(struct netxen_adapter *adapter)
 {
-       netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]);
+       netxen_niu_gbe_init_port(adapter, adapter->physical_port);
 }
 
 void
@@ -1127,7 +1120,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
 
 void netxen_nic_flash_print(struct netxen_adapter *adapter)
 {
-       int valid = 1;
        u32 fw_major = 0;
        u32 fw_minor = 0;
        u32 fw_build = 0;
@@ -1137,70 +1129,62 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
        __le32 *ptr32;
 
        struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
-       if (board_info->magic != NETXEN_BDINFO_MAGIC) {
-               printk
-                   ("NetXen Unknown board config, Read 0x%x expected as 0x%x\n",
-                    board_info->magic, NETXEN_BDINFO_MAGIC);
-               valid = 0;
-       }
-       if (board_info->header_version != NETXEN_BDINFO_VERSION) {
-               printk("NetXen Unknown board config version."
-                      " Read %x, expected %x\n",
-                      board_info->header_version, NETXEN_BDINFO_VERSION);
-               valid = 0;
-       }
-       if (valid) {
-               ptr32 = (u32 *)&serial_num;
-               addr = NETXEN_USER_START +
-                      offsetof(struct netxen_new_user_info, serial_num);
-               for (i = 0; i < 8; i++) {
-                       if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) {
-                               printk("%s: ERROR reading %s board userarea.\n",
-                                      netxen_nic_driver_name,
-                                      netxen_nic_driver_name);
-                               return;
-                       }
-                       ptr32++;
-                       addr += sizeof(u32);
+
+       adapter->driver_mismatch = 0;
+
+       ptr32 = (u32 *)&serial_num;
+       addr = NETXEN_USER_START +
+              offsetof(struct netxen_new_user_info, serial_num);
+       for (i = 0; i < 8; i++) {
+               if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) {
+                       printk("%s: ERROR reading %s board userarea.\n",
+                              netxen_nic_driver_name,
+                              netxen_nic_driver_name);
+                       adapter->driver_mismatch = 1;
+                       return;
                }
+               ptr32++;
+               addr += sizeof(u32);
+       }
+
+       fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
+                                             NETXEN_FW_VERSION_MAJOR));
+       fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
+                                             NETXEN_FW_VERSION_MINOR));
+       fw_build =
+           readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
 
+       if (adapter->portnum == 0) {
                get_brd_name_by_type(board_info->board_type, brd_name);
 
                printk("NetXen %s Board S/N %s  Chip id 0x%x\n",
-                      brd_name, serial_num, board_info->chip_id);
-
-               printk("NetXen %s Board #%d, Chip id 0x%x\n",
-                      board_info->board_type == 0x0b ? "XGB" : "GBE",
-                      board_info->board_num, board_info->chip_id);
-               fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
-                                                     NETXEN_FW_VERSION_MAJOR));
-               fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
-                                                     NETXEN_FW_VERSION_MINOR));
-               fw_build =
-                   readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
-
-               printk("NetXen Firmware version %d.%d.%d\n", fw_major, fw_minor,
-                      fw_build);
+                               brd_name, serial_num, board_info->chip_id);
+               printk("NetXen Firmware version %d.%d.%d\n", fw_major,
+                               fw_minor, fw_build);
        }
+
        if (fw_major != _NETXEN_NIC_LINUX_MAJOR) {
-               printk(KERN_ERR "The mismatch in driver version and firmware "
-                      "version major number\n"
-                      "Driver version major number = %d \t"
-                      "Firmware version major number = %d \n",
-                      _NETXEN_NIC_LINUX_MAJOR, fw_major);
                adapter->driver_mismatch = 1;
        }
        if (fw_minor != _NETXEN_NIC_LINUX_MINOR &&
                        fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) {
-               printk(KERN_ERR "The mismatch in driver version and firmware "
-                      "version minor number\n"
-                      "Driver version minor number = %d \t"
-                      "Firmware version minor number = %d \n",
-                      _NETXEN_NIC_LINUX_MINOR, fw_minor);
                adapter->driver_mismatch = 1;
        }
-       if (adapter->driver_mismatch)
-               printk(KERN_INFO "Use the driver with version no %d.%d.xxx\n",
-                      fw_major, fw_minor);
+       if (adapter->driver_mismatch) {
+               printk(KERN_ERR "%s: driver and firmware version mismatch\n",
+                               adapter->netdev->name);
+               return;
+       }
+
+       switch (adapter->ahw.board_type) {
+       case NETXEN_NIC_GBE:
+               dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n",
+                               adapter->netdev->name);
+               break;
+       case NETXEN_NIC_XGBE:
+               dev_info(&adapter->pdev->dev, "%s: XGbE port initialized\n",
+                               adapter->netdev->name);
+               break;
+       }
 }
 
index 45fa33e0cb9062764dc542d3c9fd428dfa6cc17f..70d1b22ced220c601276f47a4e6e92b50a95f7a0 100644 (file)
@@ -203,21 +203,6 @@ void netxen_initialize_adapter_sw(struct netxen_adapter *adapter)
        }
 }
 
-void netxen_initialize_adapter_hw(struct netxen_adapter *adapter)
-{
-       int ports = 0;
-       struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
-
-       if (netxen_nic_get_board_info(adapter) != 0)
-               printk("%s: Error getting board config info.\n",
-                      netxen_nic_driver_name);
-       get_brd_port_by_type(board_info->board_type, &ports);
-       if (ports == 0)
-               printk(KERN_ERR "%s: Unknown board type\n",
-                      netxen_nic_driver_name);
-       adapter->ahw.max_ports = ports;
-}
-
 void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
 {
        switch (adapter->ahw.board_type) {
@@ -765,18 +750,13 @@ int netxen_flash_unlock(struct netxen_adapter *adapter)
 
 int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
 {
-       int addr, val, status;
+       int addr, val;
        int n, i;
        int init_delay = 0;
        struct crb_addr_pair *buf;
        u32 off;
 
        /* resetall */
-       status = netxen_nic_get_board_info(adapter);
-       if (status)
-               printk("%s: netxen_pinit_from_rom: Error getting board info\n",
-                      netxen_nic_driver_name);
-
        netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET,
                                    NETXEN_ROMBUS_RESET);
 
@@ -860,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
                                netxen_nic_pci_change_crbwindow(adapter, 1);
                        }
                        if (init_delay == 1) {
-                               msleep(2000);
+                               msleep(1000);
                                init_delay = 0;
                        }
-                       msleep(20);
+                       msleep(1);
                }
                kfree(buf);
 
@@ -938,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
 
 void netxen_free_adapter_offload(struct netxen_adapter *adapter)
 {
+       int i;
+
        if (adapter->dummy_dma.addr) {
-               pci_free_consistent(adapter->ahw.pdev,
+               i = 100;
+               do {
+                       if (dma_watchdog_shutdown_request(adapter) == 1)
+                               break;
+                       msleep(50);
+                       if (dma_watchdog_shutdown_poll_result(adapter) == 1)
+                               break;
+               } while (--i);
+
+               if (i) {
+                       pci_free_consistent(adapter->ahw.pdev,
                                    NETXEN_HOST_DUMMY_DMA_SIZE,
                                    adapter->dummy_dma.addr,
                                    adapter->dummy_dma.phys_addr);
-               adapter->dummy_dma.addr = NULL;
+                       adapter->dummy_dma.addr = NULL;
+               } else {
+                       printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
+                                       adapter->netdev->name);
+               }
        }
 }
 
index f487615f4063dd527a4b4ee5a18e4e7120d58419..96cec41f90197ab7df3607890906b3f53e02bb66 100644 (file)
@@ -145,7 +145,7 @@ static void netxen_nic_isr_other(struct netxen_adapter *adapter)
 
        /* verify the offset */
        val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
-       val = val >> physical_port[adapter->portnum];
+       val = val >> adapter->physical_port;
        if (val == adapter->ahw.qg_linksup)
                return;
 
@@ -199,7 +199,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
 
        /* WINDOW = 1 */
        val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
-       val >>= (physical_port[adapter->portnum] * 8);
+       val >>= (adapter->physical_port * 8);
        val &= 0xff;
 
        if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) {
index 7144c255ce54aa3b23856fb9df2f1dfe2f28d48e..6797ed069f1f43ed659147da5d925bda1036e9e8 100644 (file)
@@ -70,17 +70,15 @@ static void netxen_nic_poll_controller(struct net_device *netdev);
 static irqreturn_t netxen_intr(int irq, void *data);
 static irqreturn_t netxen_msi_intr(int irq, void *data);
 
-int physical_port[] = {0, 1, 2, 3};
-
 /*  PCI Device ID Table  */
 static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
-       {PCI_DEVICE(0x4040, 0x0001)},
-       {PCI_DEVICE(0x4040, 0x0002)},
-       {PCI_DEVICE(0x4040, 0x0003)},
-       {PCI_DEVICE(0x4040, 0x0004)},
-       {PCI_DEVICE(0x4040, 0x0005)},
-       {PCI_DEVICE(0x4040, 0x0024)},
-       {PCI_DEVICE(0x4040, 0x0025)},
+       {PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)},
+       {PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)},
        {0,}
 };
 
@@ -288,10 +286,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        int pci_func_id = PCI_FUNC(pdev->devfn);
        DECLARE_MAC_BUF(mac);
 
-       printk(KERN_INFO "%s \n", netxen_nic_driver_string);
+       if (pci_func_id == 0)
+               printk(KERN_INFO "%s \n", netxen_nic_driver_string);
 
        if (pdev->class != 0x020000) {
-               printk(KERN_ERR"NetXen function %d, class %x will not "
+               printk(KERN_DEBUG "NetXen function %d, class %x will not "
                                "be enabled.\n",pci_func_id, pdev->class);
                return -ENODEV;
        }
@@ -450,8 +449,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         */
        adapter->curr_window = 255;
 
-       /* initialize the adapter */
-       netxen_initialize_adapter_hw(adapter);
+       if (netxen_nic_get_board_info(adapter) != 0) {
+               printk("%s: Error getting board config info.\n",
+                      netxen_nic_driver_name);
+               err = -EIO;
+               goto err_out_iounmap;
+       }
 
        /*
         *  Adapter in our case is quad port so initialize it before
@@ -530,17 +533,15 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        netxen_initialize_adapter_sw(adapter);  /* initialize the buffers in adapter */
 
        /* Mezz cards have PCI function 0,2,3 enabled */
-       if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
-               && (pci_func_id >= 2))
+       switch (adapter->ahw.boardcfg.board_type) {
+       case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
+       case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
+               if (pci_func_id >= 2)
                        adapter->portnum = pci_func_id - 2;
-
-#ifdef CONFIG_IA64
-       if(adapter->portnum == 0) {
-               netxen_pinit_from_rom(adapter, 0);
-               udelay(500);
-               netxen_load_firmware(adapter);
+               break;
+       default:
+               break;
        }
-#endif
 
        init_timer(&adapter->watchdog_timer);
        adapter->ahw.xg_linkup = 0;
@@ -613,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                                err = -ENODEV;
                                goto err_out_free_dev;
                    }
+               } else {
+                       writel(0, NETXEN_CRB_NORMALIZE(adapter,
+                                               CRB_CMDPEG_STATE));
+                       netxen_pinit_from_rom(adapter, 0);
+                       msleep(1);
+                       netxen_load_firmware(adapter);
+                       netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
                }
 
                /* clear the register for future unloads/loads */
                writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
-               printk(KERN_INFO "State: 0x%0x\n",
+               dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n",
                        readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
 
                /*
@@ -639,9 +647,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /*
         * See if the firmware gave us a virtual-physical port mapping.
         */
+       adapter->physical_port = adapter->portnum;
        i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum)));
        if (i != 0x55555555)
-               physical_port[adapter->portnum] = i;
+               adapter->physical_port = i;
 
        netif_carrier_off(netdev);
        netif_stop_queue(netdev);
@@ -654,22 +663,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_out_free_dev;
        }
 
+       netxen_nic_flash_print(adapter);
        pci_set_drvdata(pdev, adapter);
 
-       switch (adapter->ahw.board_type) {
-               case NETXEN_NIC_GBE:
-                       printk(KERN_INFO "%s: QUAD GbE board initialized\n",
-                              netxen_nic_driver_name);
-                       break;
-
-               case NETXEN_NIC_XGBE:
-                       printk(KERN_INFO "%s: XGbE board initialized\n",
-                                       netxen_nic_driver_name);
-                       break;
-       }
-
-       adapter->driver_mismatch = 0;
-
        return 0;
 
 err_out_free_dev:
@@ -760,55 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
 
        vfree(adapter->cmd_buf_arr);
 
-       if (adapter->portnum == 0) {
-               if (init_firmware_done) {
-                       i = 100;
-                       do {
-                               if (dma_watchdog_shutdown_request(adapter) == 1)
-                                       break;
-                               msleep(100);
-                               if (dma_watchdog_shutdown_poll_result(adapter) == 1)
-                                       break;
-                       } while (--i);
-
-                       if (i == 0)
-                               printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
-                                               netdev->name);
-
-                       /* clear the register for future unloads/loads */
-                       writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
-                       printk(KERN_INFO "State: 0x%0x\n",
-                               readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
-
-                       /* leave the hw in the same state as reboot */
-                       writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
-                       netxen_pinit_from_rom(adapter, 0);
-                       msleep(1);
-                       netxen_load_firmware(adapter);
-                       netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
-               }
-
-               /* clear the register for future unloads/loads */
-               writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
-               printk(KERN_INFO "State: 0x%0x\n",
-                       readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
-
-               i = 100;
-               do {
-                       if (dma_watchdog_shutdown_request(adapter) == 1)
-                               break;
-                       msleep(100);
-                       if (dma_watchdog_shutdown_poll_result(adapter) == 1)
-                               break;
-               } while (--i);
-
-               if (i) {
-                       netxen_free_adapter_offload(adapter);
-               } else {
-                       printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
-                                       netdev->name);
-               }
-       }
+       if (adapter->portnum == 0)
+               netxen_free_adapter_offload(adapter);
 
        if (adapter->irq)
                free_irq(adapter->irq, adapter);
@@ -840,13 +789,15 @@ static int netxen_nic_open(struct net_device *netdev)
        irq_handler_t handler;
        unsigned long flags = IRQF_SAMPLE_RANDOM;
 
+       if (adapter->driver_mismatch)
+               return -EIO;
+
        if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) {
                err = netxen_init_firmware(adapter);
                if (err != 0) {
                        printk(KERN_ERR "Failed to init firmware\n");
                        return -EIO;
                }
-               netxen_nic_flash_print(adapter);
 
                /* setup all the resources for the Phantom... */
                /* this include the descriptors for rcv, tx, and status */
@@ -895,14 +846,12 @@ static int netxen_nic_open(struct net_device *netdev)
        if (adapter->set_mtu)
                adapter->set_mtu(adapter, netdev->mtu);
 
-       if (!adapter->driver_mismatch)
-               mod_timer(&adapter->watchdog_timer, jiffies);
+       mod_timer(&adapter->watchdog_timer, jiffies);
 
        napi_enable(&adapter->napi);
        netxen_nic_enable_int(adapter);
 
-       if (!adapter->driver_mismatch)
-               netif_start_queue(netdev);
+       netif_start_queue(netdev);
 
        return 0;
 }
index 1c852a76c80d6bc352f1caf191bc4ae599163261..a3bc7cc67a6fd1c2c57c14e5bff6ef52e7c513cf 100644 (file)
@@ -94,7 +94,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
        long timeout = 0;
        long result = 0;
        long restore = 0;
-       long phy = physical_port[adapter->portnum];
+       long phy = adapter->physical_port;
        __u32 address;
        __u32 command;
        __u32 status;
@@ -190,7 +190,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
        long timeout = 0;
        long result = 0;
        long restore = 0;
-       long phy = physical_port[adapter->portnum];
+       long phy = adapter->physical_port;
        __u32 address;
        __u32 command;
        __u32 status;
@@ -456,7 +456,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
 
 int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
 {
-       u32 portnum = physical_port[adapter->portnum];
+       u32 portnum = adapter->physical_port;
 
        netxen_crb_writelit_adapter(adapter,
                NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447);
@@ -573,7 +573,7 @@ static int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
 {
        u32 stationhigh;
        u32 stationlow;
-       int phy = physical_port[adapter->portnum];
+       int phy = adapter->physical_port;
        u8 val[8];
 
        if (addr == NULL)
@@ -604,7 +604,7 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
 {
        u8 temp[4];
        u32 val;
-       int phy = physical_port[adapter->portnum];
+       int phy = adapter->physical_port;
        unsigned char mac_addr[6];
        int i;
        DECLARE_MAC_BUF(mac);
@@ -724,7 +724,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
 int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
 {
        __u32 mac_cfg0;
-       u32 port = physical_port[adapter->portnum];
+       u32 port = adapter->physical_port;
 
        if (port > NETXEN_NIU_MAX_GBE_PORTS)
                return -EINVAL;
@@ -740,7 +740,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
 int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
 {
        __u32 mac_cfg;
-       u32 port = physical_port[adapter->portnum];
+       u32 port = adapter->physical_port;
 
        if (port > NETXEN_NIU_MAX_XG_PORTS)
                return -EINVAL;
@@ -757,7 +757,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
                                    netxen_niu_prom_mode_t mode)
 {
        __u32 reg;
-       u32 port = physical_port[adapter->portnum];
+       u32 port = adapter->physical_port;
 
        if (port > NETXEN_NIU_MAX_GBE_PORTS)
                return -EINVAL;
@@ -814,7 +814,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
 int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
                              netxen_ethernet_macaddr_t addr)
 {
-       int phy = physical_port[adapter->portnum];
+       int phy = adapter->physical_port;
        u8 temp[4];
        u32 val;
 
@@ -867,7 +867,7 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
 int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter,
                              netxen_ethernet_macaddr_t * addr)
 {
-       int phy = physical_port[adapter->portnum];
+       int phy = adapter->physical_port;
        u32 stationhigh;
        u32 stationlow;
        u8 val[8];
@@ -896,7 +896,7 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
                                       netxen_niu_prom_mode_t mode)
 {
        __u32 reg;
-       u32 port = physical_port[adapter->portnum];
+       u32 port = adapter->physical_port;
 
        if (port > NETXEN_NIU_MAX_XG_PORTS)
                return -EINVAL;
index 62436b3a18c6fdf1a4ef55a44fb3ee6d22a48633..c8a5ef2d75f4280f896306ce06ebefef4358fa32 100644 (file)
@@ -118,6 +118,7 @@ static const struct pci_device_id sky2_id_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4355) }, /* 88E8040T */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
index 0ce07a339c7eee77a209fc365e664976ed4a6b57..7ab94c825b577f13b606bc938b834db6003559ad 100644 (file)
@@ -313,6 +313,21 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
 
        switch (tun->flags & TUN_TYPE_MASK) {
        case TUN_TUN_DEV:
+               if (tun->flags & TUN_NO_PI) {
+                       switch (skb->data[0] & 0xf0) {
+                       case 0x40:
+                               pi.proto = htons(ETH_P_IP);
+                               break;
+                       case 0x60:
+                               pi.proto = htons(ETH_P_IPV6);
+                               break;
+                       default:
+                               tun->dev->stats.rx_dropped++;
+                               kfree_skb(skb);
+                               return -EINVAL;
+                       }
+               }
+
                skb_reset_mac_header(skb);
                skb->protocol = pi.proto;
                skb->dev = tun->dev;
index dfa4bdd5597c6a6909b6d11a08d25188f06af9e3..d3db298c05fc1d1a8bac136666f3aa7daa225400 100644 (file)
@@ -630,7 +630,6 @@ struct b43_pio {
 
 /* Context information for a noise calculation (Link Quality). */
 struct b43_noise_calculation {
-       u8 channel_at_start;
        bool calculation_running;
        u8 nr_samples;
        s8 samples[8][4];
index 6dcbb3c87e7207a01cf64f2269f3cea1438cfe04..e23f2f172bd783f163ae8aeb41ed7f348aa08a65 100644 (file)
@@ -795,24 +795,49 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
 {
        struct b43_dmaring *ring;
        int err;
-       int nr_slots;
        dma_addr_t dma_test;
 
        ring = kzalloc(sizeof(*ring), GFP_KERNEL);
        if (!ring)
                goto out;
-       ring->type = type;
 
-       nr_slots = B43_RXRING_SLOTS;
+       ring->nr_slots = B43_RXRING_SLOTS;
        if (for_tx)
-               nr_slots = B43_TXRING_SLOTS;
+               ring->nr_slots = B43_TXRING_SLOTS;
 
-       ring->meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta),
+       ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta),
                             GFP_KERNEL);
        if (!ring->meta)
                goto err_kfree_ring;
+
+       ring->type = type;
+       ring->dev = dev;
+       ring->mmio_base = b43_dmacontroller_base(type, controller_index);
+       ring->index = controller_index;
+       if (type == B43_DMA_64BIT)
+               ring->ops = &dma64_ops;
+       else
+               ring->ops = &dma32_ops;
        if (for_tx) {
-               ring->txhdr_cache = kcalloc(nr_slots,
+               ring->tx = 1;
+               ring->current_slot = -1;
+       } else {
+               if (ring->index == 0) {
+                       ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
+                       ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
+               } else if (ring->index == 3) {
+                       ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE;
+                       ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET;
+               } else
+                       B43_WARN_ON(1);
+       }
+       spin_lock_init(&ring->lock);
+#ifdef CONFIG_B43_DEBUG
+       ring->last_injected_overflow = jiffies;
+#endif
+
+       if (for_tx) {
+               ring->txhdr_cache = kcalloc(ring->nr_slots,
                                            b43_txhdr_size(dev),
                                            GFP_KERNEL);
                if (!ring->txhdr_cache)
@@ -828,7 +853,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
                                          b43_txhdr_size(dev), 1)) {
                        /* ugh realloc */
                        kfree(ring->txhdr_cache);
-                       ring->txhdr_cache = kcalloc(nr_slots,
+                       ring->txhdr_cache = kcalloc(ring->nr_slots,
                                                    b43_txhdr_size(dev),
                                                    GFP_KERNEL | GFP_DMA);
                        if (!ring->txhdr_cache)
@@ -853,32 +878,6 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
                                 DMA_TO_DEVICE);
        }
 
-       ring->dev = dev;
-       ring->nr_slots = nr_slots;
-       ring->mmio_base = b43_dmacontroller_base(type, controller_index);
-       ring->index = controller_index;
-       if (type == B43_DMA_64BIT)
-               ring->ops = &dma64_ops;
-       else
-               ring->ops = &dma32_ops;
-       if (for_tx) {
-               ring->tx = 1;
-               ring->current_slot = -1;
-       } else {
-               if (ring->index == 0) {
-                       ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
-                       ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
-               } else if (ring->index == 3) {
-                       ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE;
-                       ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET;
-               } else
-                       B43_WARN_ON(1);
-       }
-       spin_lock_init(&ring->lock);
-#ifdef CONFIG_B43_DEBUG
-       ring->last_injected_overflow = jiffies;
-#endif
-
        err = alloc_ringmemory(ring);
        if (err)
                goto err_kfree_txhdr_cache;
index 6c3d9ea0a9f858461f54ffb0e148f1f567fb6a22..fa4b0d8b74a26df90df59f8f3fa57dc8925d023e 100644 (file)
@@ -1145,7 +1145,6 @@ static void b43_generate_noise_sample(struct b43_wldev *dev)
        b43_jssi_write(dev, 0x7F7F7F7F);
        b43_write32(dev, B43_MMIO_MACCMD,
                    b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE);
-       B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel);
 }
 
 static void b43_calculate_link_quality(struct b43_wldev *dev)
@@ -1154,7 +1153,6 @@ static void b43_calculate_link_quality(struct b43_wldev *dev)
 
        if (dev->noisecalc.calculation_running)
                return;
-       dev->noisecalc.channel_at_start = dev->phy.channel;
        dev->noisecalc.calculation_running = 1;
        dev->noisecalc.nr_samples = 0;
 
@@ -1171,9 +1169,16 @@ static void handle_irq_noise(struct b43_wldev *dev)
 
        /* Bottom half of Link Quality calculation. */
 
+       /* Possible race condition: It might be possible that the user
+        * changed to a different channel in the meantime since we
+        * started the calculation. We ignore that fact, since it's
+        * not really that much of a problem. The background noise is
+        * an estimation only anyway. Slightly wrong results will get damped
+        * by the averaging of the 8 sample rounds. Additionally the
+        * value is shortlived. So it will be replaced by the next noise
+        * calculation round soon. */
+
        B43_WARN_ON(!dev->noisecalc.calculation_running);
-       if (dev->noisecalc.channel_at_start != phy->channel)
-               goto drop_calculation;
        *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev));
        if (noise[0] == 0x7F || noise[1] == 0x7F ||
            noise[2] == 0x7F || noise[3] == 0x7F)
@@ -1214,11 +1219,10 @@ static void handle_irq_noise(struct b43_wldev *dev)
                        average -= 48;
 
                dev->stats.link_noise = average;
-             drop_calculation:
                dev->noisecalc.calculation_running = 0;
                return;
        }
-      generate_new:
+generate_new:
        b43_generate_noise_sample(dev);
 }
 
index ab1029e7988457539fc7f08e5548a19a0c322890..2d611876bbe045133c9b4aa118f32f3e1f07d2c9 100644 (file)
@@ -32,12 +32,13 @@ config RT2X00_LIB_FIRMWARE
 config RT2X00_LIB_RFKILL
        boolean
        depends on RT2X00_LIB
+       depends on INPUT
        select RFKILL
        select INPUT_POLLDEV
 
 config RT2X00_LIB_LEDS
        boolean
-       depends on RT2X00_LIB
+       depends on RT2X00_LIB && NEW_LEDS
 
 config RT2400PCI
        tristate "Ralink rt2400 pci/pcmcia support"
@@ -51,7 +52,7 @@ config RT2400PCI
 
 config RT2400PCI_RFKILL
        bool "RT2400 rfkill support"
-       depends on RT2400PCI
+       depends on RT2400PCI && INPUT
        select RT2X00_LIB_RFKILL
        ---help---
          This adds support for integrated rt2400 devices that feature a
@@ -60,7 +61,7 @@ config RT2400PCI_RFKILL
 
 config RT2400PCI_LEDS
        bool "RT2400 leds support"
-       depends on RT2400PCI
+       depends on RT2400PCI && NEW_LEDS
        select LEDS_CLASS
        select RT2X00_LIB_LEDS
        ---help---
@@ -78,7 +79,7 @@ config RT2500PCI
 
 config RT2500PCI_RFKILL
        bool "RT2500 rfkill support"
-       depends on RT2500PCI
+       depends on RT2500PCI && INPUT
        select RT2X00_LIB_RFKILL
        ---help---
          This adds support for integrated rt2500 devices that feature a
@@ -87,7 +88,7 @@ config RT2500PCI_RFKILL
 
 config RT2500PCI_LEDS
        bool "RT2500 leds support"
-       depends on RT2500PCI
+       depends on RT2500PCI && NEW_LEDS
        select LEDS_CLASS
        select RT2X00_LIB_LEDS
        ---help---
@@ -107,7 +108,7 @@ config RT61PCI
 
 config RT61PCI_RFKILL
        bool "RT61 rfkill support"
-       depends on RT61PCI
+       depends on RT61PCI && INPUT
        select RT2X00_LIB_RFKILL
        ---help---
          This adds support for integrated rt61 devices that feature a
@@ -116,7 +117,7 @@ config RT61PCI_RFKILL
 
 config RT61PCI_LEDS
        bool "RT61 leds support"
-       depends on RT61PCI
+       depends on RT61PCI && NEW_LEDS
        select LEDS_CLASS
        select RT2X00_LIB_LEDS
        ---help---
@@ -133,7 +134,7 @@ config RT2500USB
 
 config RT2500USB_LEDS
        bool "RT2500 leds support"
-       depends on RT2500USB
+       depends on RT2500USB && NEW_LEDS
        select LEDS_CLASS
        select RT2X00_LIB_LEDS
        ---help---
@@ -152,7 +153,7 @@ config RT73USB
 
 config RT73USB_LEDS
        bool "RT73 leds support"
-       depends on RT73USB
+       depends on RT73USB && NEW_LEDS
        select LEDS_CLASS
        select RT2X00_LIB_LEDS
        ---help---
index 971af2546b59a85e3e820f6d9b7e14e9276a515f..60893de3bf8ff64c99f3552244c0cd35c3713020 100644 (file)
@@ -412,8 +412,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
        if (pci_set_mwi(pci_dev))
                ERROR_PROBE("MWI not available.\n");
 
-       if (pci_set_dma_mask(pci_dev, DMA_64BIT_MASK) &&
-           pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
                ERROR_PROBE("PCI DMA not supported.\n");
                retval = -EIO;
                goto exit_disable_device;
index 5a331674dcb2384c036f77b08aa79f93b819946a..e5ceae805b579805909f72fe7a98f43247775f9e 100644 (file)
@@ -362,6 +362,12 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)
                }
        }
 
+       /*
+        * Kill guardian urb (if required by driver).
+        */
+       if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
+               return;
+
        for (i = 0; i < rt2x00dev->bcn->limit; i++) {
                priv_bcn = rt2x00dev->bcn->entries[i].priv_data;
                usb_kill_urb(priv_bcn->urb);
index da19a3a91f4d3909fd21d732a5f833862b6bdb10..fff8386e816ba289045ff8955575b7377a98b60b 100644 (file)
@@ -2131,6 +2131,7 @@ static struct usb_device_id rt73usb_device_table[] = {
        /* D-Link */
        { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
        { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
+       { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) },
        { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
        /* Gemtek */
        { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
index 72c8992fdf21e089f5c25b6dfd2c42d507c0eb3c..a6644b332b538e510d4a32d86d6cf9a5eda8701c 100644 (file)
@@ -85,7 +85,7 @@ typedef unsigned int sigINT;
 /* ------------------------------------------------------------------ */
 /* What type of processor the file is meant to run on. */
 /* This will let us know whether to read sigWORDs as high/low or low/high. */
-#define PROC_INTEL      0x00    /* Intel 80x86 */
+#define PROC_INTEL      0x00    /* Intel 80x86/ia64 */
 #define PROC_MOTOROLA   0x01    /* Motorola 68K */
 #define PROC_MIPS4000   0x02    /* MIPS RISC 4000 */
 #define PROC_ALPHA      0x03    /* DEC Alpha */
@@ -104,6 +104,7 @@ typedef unsigned int sigINT;
 #define PROC_486        0x08    /* Intel 80486 */
 #define PROC_PENTIUM    0x10    /* Intel 586 aka P5 aka Pentium */
 #define PROC_SEXIUM    0x20    /* Intel 686 aka P6 aka Pentium Pro or MMX */
+#define PROC_IA64      0x40    /* Intel IA64 processor */
 
 /* PROC_i960: */
 #define PROC_960RX      0x01    /* Intel 80960RC/RD */
index 3690360d7a798ec98f73e58bb83880fe01e99de3..c6457bfc8a49039b8c7e6e187945905c6d71f706 100644 (file)
@@ -456,6 +456,10 @@ static int __scsi_host_match(struct device *dev, void *data)
  *
  * Return value:
  *     A pointer to located Scsi_Host or NULL.
+ *
+ *     The caller must do a scsi_host_put() to drop the reference
+ *     that scsi_host_get() took. The put_device() below dropped
+ *     the reference from class_find_device().
  **/
 struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
 {
@@ -463,9 +467,10 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
        struct Scsi_Host *shost = ERR_PTR(-ENXIO);
 
        cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match);
-       if (cdev)
+       if (cdev) {
                shost = scsi_host_get(class_to_shost(cdev));
-
+               put_device(cdev);
+       }
        return shost;
 }
 EXPORT_SYMBOL(scsi_host_lookup);
index 7ee86d4a761810f6c66ffbd5ce4af203a824edeb..c82df8bd4d8931cc72d3654a74edde4e4c9dd75b 100644 (file)
@@ -178,6 +178,9 @@ int sr_test_unit_ready(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr)
                the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL,
                                              0, sshdr, SR_TIMEOUT,
                                              retries--);
+               if (scsi_sense_valid(sshdr) &&
+                   sshdr->sense_key == UNIT_ATTENTION)
+                       sdev->changed = 1;
 
        } while (retries > 0 &&
                 (!scsi_status_is_good(the_result) ||
index 7cf8851286b54a7592412510a0130dc86e626bfe..d184f2aea78d1f0a4b2e2df05c5d79bf8d4a75d9 100644 (file)
@@ -1168,15 +1168,21 @@ EXPORT_SYMBOL(ssb_dma_translation);
 int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask)
 {
        struct device *dma_dev = ssb_dev->dma_dev;
+       int err = 0;
 
 #ifdef CONFIG_SSB_PCIHOST
-       if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI)
-               return dma_set_mask(dma_dev, mask);
+       if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) {
+               err = pci_set_dma_mask(ssb_dev->bus->host_pci, mask);
+               if (err)
+                       return err;
+               err = pci_set_consistent_dma_mask(ssb_dev->bus->host_pci, mask);
+               return err;
+       }
 #endif
        dma_dev->coherent_dma_mask = mask;
        dma_dev->dma_mask = &dma_dev->coherent_dma_mask;
 
-       return 0;
+       return err;
 }
 EXPORT_SYMBOL(ssb_dma_set_mask);
 
index 3da1ab4b389df9fc6f9b0e90fa5ed15eb5845902..c070b34b669de70da98c450eaf7ac4d48e85ec93 100644 (file)
@@ -47,6 +47,9 @@ static const struct usb_device_id usb_quirk_list[] = {
        /* Edirol SD-20 */
        { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
 
+       /* appletouch */
+       { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
+
        /* Avision AV600U */
        { USB_DEVICE(0x0638, 0x0a13), .driver_info =
          USB_QUIRK_STRING_FETCH_255 },
index 43e99513334ae1a11c95d9428282d0541715e8ae..3141690558c8aa6029128f7c2d8a5b9fc742696d 100644 (file)
@@ -591,7 +591,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
                fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages);
                fc->minor = arg->minor;
                fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
-               fc->max_write = min_t(unsigned, 4096, fc->max_write);
+               fc->max_write = max_t(unsigned, 4096, fc->max_write);
                fc->conn_init = 1;
        }
        fuse_put_request(fc, req);
@@ -667,7 +667,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
        fc->flags = d.flags;
        fc->user_id = d.user_id;
        fc->group_id = d.group_id;
-       fc->max_read = min_t(unsigned, 4096, d.max_read);
+       fc->max_read = max_t(unsigned, 4096, d.max_read);
 
        /* Used by get_root_inode() */
        sb->s_fs_info = fc;
index cf9401e8cd0b221e4187dbd4624c05e2070a3d89..cfdb08b484edb6ab33e5b4e4c89ccca612b18ab2 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/sysctl.h>
 #include <linux/configfs.h>
 
 #include "tcp.h"
  * cluster references throughout where nodes are looked up */
 struct o2nm_cluster *o2nm_single_cluster = NULL;
 
-#define OCFS2_MAX_HB_CTL_PATH 256
-static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
-
-static ctl_table ocfs2_nm_table[] = {
-       {
-               .ctl_name       = 1,
-               .procname       = "hb_ctl_path",
-               .data           = ocfs2_hb_ctl_path,
-               .maxlen         = OCFS2_MAX_HB_CTL_PATH,
-               .mode           = 0644,
-               .proc_handler   = &proc_dostring,
-               .strategy       = &sysctl_string,
-       },
-       { .ctl_name = 0 }
-};
-
-static ctl_table ocfs2_mod_table[] = {
-       {
-               .ctl_name       = FS_OCFS2_NM,
-               .procname       = "nm",
-               .data           = NULL,
-               .maxlen         = 0,
-               .mode           = 0555,
-               .child          = ocfs2_nm_table
-       },
-       { .ctl_name = 0}
-};
-
-static ctl_table ocfs2_kern_table[] = {
-       {
-               .ctl_name       = FS_OCFS2,
-               .procname       = "ocfs2",
-               .data           = NULL,
-               .maxlen         = 0,
-               .mode           = 0555,
-               .child          = ocfs2_mod_table
-       },
-       { .ctl_name = 0}
-};
-
-static ctl_table ocfs2_root_table[] = {
-       {
-               .ctl_name       = CTL_FS,
-               .procname       = "fs",
-               .data           = NULL,
-               .maxlen         = 0,
-               .mode           = 0555,
-               .child          = ocfs2_kern_table
-       },
-       { .ctl_name = 0 }
-};
-
-static struct ctl_table_header *ocfs2_table_header = NULL;
-
-const char *o2nm_get_hb_ctl_path(void)
-{
-       return ocfs2_hb_ctl_path;
-}
-EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path);
 
 struct o2nm_node *o2nm_get_node_by_num(u8 node_num)
 {
@@ -941,9 +881,6 @@ void o2nm_undepend_this_node(void)
 
 static void __exit exit_o2nm(void)
 {
-       if (ocfs2_table_header)
-               unregister_sysctl_table(ocfs2_table_header);
-
        /* XXX sync with hb callbacks and shut down hb? */
        o2net_unregister_hb_callbacks();
        configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
@@ -964,16 +901,9 @@ static int __init init_o2nm(void)
        if (ret)
                goto out;
 
-       ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
-       if (!ocfs2_table_header) {
-               printk(KERN_ERR "nodemanager: unable to register sysctl\n");
-               ret = -ENOMEM; /* or something. */
-               goto out_o2net;
-       }
-
        ret = o2net_register_hb_callbacks();
        if (ret)
-               goto out_sysctl;
+               goto out_o2net;
 
        config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
        mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
@@ -990,8 +920,6 @@ static int __init init_o2nm(void)
        configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
 out_callbacks:
        o2net_unregister_hb_callbacks();
-out_sysctl:
-       unregister_sysctl_table(ocfs2_table_header);
 out_o2net:
        o2net_exit();
 out:
index 7c860361b8ddc944a84c7b05ddf760df99b6cdd2..c992ea0da4add8295528b2e8b02c907ab9337df0 100644 (file)
 #include <linux/configfs.h>
 #include <linux/rbtree.h>
 
-#define FS_OCFS2_NM            1
-
-const char *o2nm_get_hb_ctl_path(void);
-
 struct o2nm_node {
        spinlock_t              nd_lock;
        struct config_item      nd_item;
index bbd1667aa7d3996035fdf517dd0dd71c034ec6e5..fcd120f1493afb0ba8838bf543495eadb2b639b8 100644 (file)
@@ -317,8 +317,7 @@ out:
        return rc;
 }
 
-static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn,
-                                  int hangup_pending)
+static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn)
 {
        struct dlm_ctxt *dlm = conn->cc_lockspace;
        struct o2dlm_private *priv = conn->cc_private;
@@ -333,43 +332,6 @@ static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn,
        return 0;
 }
 
-static void o2hb_stop(const char *group)
-{
-       int ret;
-       char *argv[5], *envp[3];
-
-       argv[0] = (char *)o2nm_get_hb_ctl_path();
-       argv[1] = "-K";
-       argv[2] = "-u";
-       argv[3] = (char *)group;
-       argv[4] = NULL;
-
-       mlog(0, "Run: %s %s %s %s\n", argv[0], argv[1], argv[2], argv[3]);
-
-       /* minimal command environment taken from cpu_run_sbin_hotplug */
-       envp[0] = "HOME=/";
-       envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
-       envp[2] = NULL;
-
-       ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
-       if (ret < 0)
-               mlog_errno(ret);
-}
-
-/*
- * Hangup is a hack for tools compatibility.  Older ocfs2-tools software
- * expects the filesystem to call "ocfs2_hb_ctl" during unmount.  This
- * happens regardless of whether the DLM got started, so we can't do it
- * in ocfs2_cluster_disconnect().  We bring the o2hb_stop() function into
- * the glue and provide a "hangup" API for super.c to call.
- *
- * Other stacks will eventually provide a NULL ->hangup() pointer.
- */
-static void o2cb_cluster_hangup(const char *group, int grouplen)
-{
-       o2hb_stop(group);
-}
-
 static int o2cb_cluster_this_node(unsigned int *node)
 {
        int node_num;
@@ -388,7 +350,6 @@ static int o2cb_cluster_this_node(unsigned int *node)
 static struct ocfs2_stack_operations o2cb_stack_ops = {
        .connect        = o2cb_cluster_connect,
        .disconnect     = o2cb_cluster_disconnect,
-       .hangup         = o2cb_cluster_hangup,
        .this_node      = o2cb_cluster_this_node,
        .dlm_lock       = o2cb_dlm_lock,
        .dlm_unlock     = o2cb_dlm_unlock,
index 6b97d11f6bf89c067912c2c7c571af2430ea0e2b..c021280dd462bc1303b89fd5d1806c8cf994d528 100644 (file)
@@ -816,8 +816,7 @@ out:
        return rc;
 }
 
-static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn,
-                                  int hangup_pending)
+static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn)
 {
        dlm_release_lockspace(conn->cc_lockspace, 2);
        conn->cc_lockspace = NULL;
index 119f60cea9cc27e8b2aca2214e8626e1558c7439..10e149ae5e3aad289f3070714ef5b8530078acf0 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/fs.h>
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
+#include <linux/sysctl.h>
 
 #include "ocfs2_fs.h"
 
 
 #define OCFS2_STACK_PLUGIN_O2CB                "o2cb"
 #define OCFS2_STACK_PLUGIN_USER                "user"
+#define OCFS2_MAX_HB_CTL_PATH          256
 
 static struct ocfs2_locking_protocol *lproto;
 static DEFINE_SPINLOCK(ocfs2_stack_lock);
 static LIST_HEAD(ocfs2_stack_list);
 static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1];
+static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
 
 /*
  * The stack currently in use.  If not null, active_stack->sp_count > 0,
@@ -349,7 +352,7 @@ int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
 
        BUG_ON(conn == NULL);
 
-       ret = active_stack->sp_ops->disconnect(conn, hangup_pending);
+       ret = active_stack->sp_ops->disconnect(conn);
 
        /* XXX Should we free it anyway? */
        if (!ret) {
@@ -362,13 +365,48 @@ int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
 }
 EXPORT_SYMBOL_GPL(ocfs2_cluster_disconnect);
 
+/*
+ * Leave the group for this filesystem.  This is executed by a userspace
+ * program (stored in ocfs2_hb_ctl_path).
+ */
+static void ocfs2_leave_group(const char *group)
+{
+       int ret;
+       char *argv[5], *envp[3];
+
+       argv[0] = ocfs2_hb_ctl_path;
+       argv[1] = "-K";
+       argv[2] = "-u";
+       argv[3] = (char *)group;
+       argv[4] = NULL;
+
+       /* minimal command environment taken from cpu_run_sbin_hotplug */
+       envp[0] = "HOME=/";
+       envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+       envp[2] = NULL;
+
+       ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
+       if (ret < 0) {
+               printk(KERN_ERR
+                      "ocfs2: Error %d running user helper "
+                      "\"%s %s %s %s\"\n",
+                      ret, argv[0], argv[1], argv[2], argv[3]);
+       }
+}
+
+/*
+ * Hangup is a required post-umount.  ocfs2-tools software expects the
+ * filesystem to call "ocfs2_hb_ctl" during unmount.  This happens
+ * regardless of whether the DLM got started, so we can't do it
+ * in ocfs2_cluster_disconnect().  The ocfs2_leave_group() function does
+ * the actual work.
+ */
 void ocfs2_cluster_hangup(const char *group, int grouplen)
 {
        BUG_ON(group == NULL);
        BUG_ON(group[grouplen] != '\0');
 
-       if (active_stack->sp_ops->hangup)
-               active_stack->sp_ops->hangup(group, grouplen);
+       ocfs2_leave_group(group);
 
        /* cluster_disconnect() was called with hangup_pending==1 */
        ocfs2_stack_driver_put();
@@ -548,10 +586,83 @@ error:
        return ret;
 }
 
+/*
+ * Sysctl bits
+ *
+ * The sysctl lives at /proc/sys/fs/ocfs2/nm/hb_ctl_path.  The 'nm' doesn't
+ * make as much sense in a multiple cluster stack world, but it's safer
+ * and easier to preserve the name.
+ */
+
+#define FS_OCFS2_NM            1
+
+static ctl_table ocfs2_nm_table[] = {
+       {
+               .ctl_name       = 1,
+               .procname       = "hb_ctl_path",
+               .data           = ocfs2_hb_ctl_path,
+               .maxlen         = OCFS2_MAX_HB_CTL_PATH,
+               .mode           = 0644,
+               .proc_handler   = &proc_dostring,
+               .strategy       = &sysctl_string,
+       },
+       { .ctl_name = 0 }
+};
+
+static ctl_table ocfs2_mod_table[] = {
+       {
+               .ctl_name       = FS_OCFS2_NM,
+               .procname       = "nm",
+               .data           = NULL,
+               .maxlen         = 0,
+               .mode           = 0555,
+               .child          = ocfs2_nm_table
+       },
+       { .ctl_name = 0}
+};
+
+static ctl_table ocfs2_kern_table[] = {
+       {
+               .ctl_name       = FS_OCFS2,
+               .procname       = "ocfs2",
+               .data           = NULL,
+               .maxlen         = 0,
+               .mode           = 0555,
+               .child          = ocfs2_mod_table
+       },
+       { .ctl_name = 0}
+};
+
+static ctl_table ocfs2_root_table[] = {
+       {
+               .ctl_name       = CTL_FS,
+               .procname       = "fs",
+               .data           = NULL,
+               .maxlen         = 0,
+               .mode           = 0555,
+               .child          = ocfs2_kern_table
+       },
+       { .ctl_name = 0 }
+};
+
+static struct ctl_table_header *ocfs2_table_header = NULL;
+
+
+/*
+ * Initialization
+ */
+
 static int __init ocfs2_stack_glue_init(void)
 {
        strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);
 
+       ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
+       if (!ocfs2_table_header) {
+               printk(KERN_ERR
+                      "ocfs2 stack glue: unable to register sysctl\n");
+               return -ENOMEM; /* or something. */
+       }
+
        return ocfs2_sysfs_init();
 }
 
@@ -559,6 +670,8 @@ static void __exit ocfs2_stack_glue_exit(void)
 {
        lproto = NULL;
        ocfs2_sysfs_exit();
+       if (ocfs2_table_header)
+               unregister_sysctl_table(ocfs2_table_header);
 }
 
 MODULE_AUTHOR("Oracle");
index 005e4f170e0f998a44b2c9dab2524d0bd1fa1d79..db56281dd1be48d5282ce1aaf0c2b1472c1d8f88 100644 (file)
@@ -134,22 +134,10 @@ struct ocfs2_stack_operations {
         * be freed.  Thus, a stack must not return from ->disconnect()
         * until it will no longer reference the conn pointer.
         *
-        * If hangup_pending is zero, ocfs2_cluster_disconnect() will also
-        * be dropping the reference on the module.
+        * Once this call returns, the stack glue will be dropping this
+        * connection's reference on the module.
         */
-       int (*disconnect)(struct ocfs2_cluster_connection *conn,
-                         int hangup_pending);
-
-       /*
-        * ocfs2_cluster_hangup() exists for compatibility with older
-        * ocfs2 tools.  Only the classic stack really needs it.  As such
-        * ->hangup() is not required of all stacks.  See the comment by
-        * ocfs2_cluster_hangup() for more details.
-        *
-        * Note that ocfs2_cluster_hangup() can only be called if
-        * hangup_pending was passed to ocfs2_cluster_disconnect().
-        */
-       void (*hangup)(const char *group, int grouplen);
+       int (*disconnect)(struct ocfs2_cluster_connection *conn);
 
        /*
         * ->this_node() returns the cluster's unique identifier for the
@@ -258,4 +246,5 @@ void ocfs2_stack_glue_set_locking_protocol(struct ocfs2_locking_protocol *proto)
 /* Used by stack plugins */
 int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin);
 void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin);
+
 #endif  /* STACKGLUE_H */
index 8fa9c2d70911701fb6aa0abded2bc86ed439d749..8ec865de5f133052771c1a428bb94e3834b9f374 100644 (file)
@@ -16,7 +16,7 @@
 #define UDF_PREALLOCATE
 #define UDF_DEFAULT_PREALLOC_BLOCKS    8
 
-#define UDFFS_DEBUG
+#undef UDFFS_DEBUG
 
 #ifdef UDFFS_DEBUG
 #define udf_debug(f, a...) \
index f1fbe9c930d77a3742de987c0545eed6b40f9614..d4efe40147056e6bc10bca8e1262bcfb569b68ee 100644 (file)
@@ -41,7 +41,7 @@ struct ip_tunnel_prl {
        __u16                   __reserved;
        __u32                   datalen;
        __u32                   __reserved2;
-       void __user             *data;
+       /* data follows */
 };
 
 /* PRL flags */
index f736e842977f07ce8469bf832fcf2905af36ded1..f80c0ed6d870f3514e39f9da71ce399927919465 100644 (file)
@@ -15,6 +15,7 @@ enum nf_ct_ext_id
 
 /* Extensions: optional stuff which isn't permanently in struct. */
 struct nf_ct_ext {
+       struct rcu_head rcu;
        u8 offset[NF_CT_EXT_NUM];
        u8 len;
        char data[0];
index 9d52ebfc1962b360774f55e728b32ea0d8388654..05fafdc2eea338b604661be4fa23121da2f9449c 100644 (file)
@@ -188,10 +188,13 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
                                return 0;
                        }
                }
-       } else {
-               skb_push(skb, 2);
-               if (brdev->payload == p_bridged)
+       } else { /* e_vc */
+               if (brdev->payload == p_bridged) {
+                       skb_push(skb, 2);
                        memset(skb->data, 0, 2);
+               } else { /* p_routed */
+                       skb_pull(skb, ETH_HLEN);
+               }
        }
        skb_debug(skb);
 
@@ -377,11 +380,8 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
                                 (skb->data + 6, ethertype_ipv4,
                                  sizeof(ethertype_ipv4)) == 0)
                                skb->protocol = __constant_htons(ETH_P_IP);
-                       else {
-                               brdev->stats.rx_errors++;
-                               dev_kfree_skb(skb);
-                               return;
-                       }
+                       else
+                               goto error;
                        skb_pull(skb, sizeof(llc_oui_ipv4));
                        skb_reset_network_header(skb);
                        skb->pkt_type = PACKET_HOST;
@@ -394,44 +394,56 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
                           (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) {
                        skb_pull(skb, sizeof(llc_oui_pid_pad));
                        skb->protocol = eth_type_trans(skb, net_dev);
-               } else {
-                       brdev->stats.rx_errors++;
-                       dev_kfree_skb(skb);
-                       return;
-               }
+               } else
+                       goto error;
 
-       } else {
-               /* first 2 chars should be 0 */
-               if (*((u16 *) (skb->data)) != 0) {
-                       brdev->stats.rx_errors++;
-                       dev_kfree_skb(skb);
-                       return;
+       } else { /* e_vc */
+               if (brdev->payload == p_routed) {
+                       struct iphdr *iph;
+
+                       skb_reset_network_header(skb);
+                       iph = ip_hdr(skb);
+                       if (iph->version == 4)
+                               skb->protocol = __constant_htons(ETH_P_IP);
+                       else if (iph->version == 6)
+                               skb->protocol = __constant_htons(ETH_P_IPV6);
+                       else
+                               goto error;
+                       skb->pkt_type = PACKET_HOST;
+               } else { /* p_bridged */
+                       /* first 2 chars should be 0 */
+                       if (*((u16 *) (skb->data)) != 0)
+                               goto error;
+                       skb_pull(skb, BR2684_PAD_LEN);
+                       skb->protocol = eth_type_trans(skb, net_dev);
                }
-               skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN);       /* pad, dstmac, srcmac, ethtype */
-               skb->protocol = eth_type_trans(skb, net_dev);
        }
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
-       if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
-               brdev->stats.rx_dropped++;
-               dev_kfree_skb(skb);
-               return;
-       }
+       if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb)))
+               goto dropped;
 #endif /* CONFIG_ATM_BR2684_IPFILTER */
        skb->dev = net_dev;
        ATM_SKB(skb)->vcc = atmvcc;     /* needed ? */
        pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol));
        skb_debug(skb);
-       if (unlikely(!(net_dev->flags & IFF_UP))) {
-               /* sigh, interface is down */
-               brdev->stats.rx_dropped++;
-               dev_kfree_skb(skb);
-               return;
-       }
+       /* sigh, interface is down? */
+       if (unlikely(!(net_dev->flags & IFF_UP)))
+               goto dropped;
        brdev->stats.rx_packets++;
        brdev->stats.rx_bytes += skb->len;
        memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
        netif_rx(skb);
+       return;
+
+dropped:
+       brdev->stats.rx_dropped++;
+       goto free_skb;
+error:
+       brdev->stats.rx_errors++;
+free_skb:
+       dev_kfree_skb(skb);
+       return;
 }
 
 /*
@@ -518,9 +530,9 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
                struct sk_buff *next = skb->next;
 
                skb->next = skb->prev = NULL;
+               br2684_push(atmvcc, skb);
                BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
                BRPRIV(skb->dev)->stats.rx_packets--;
-               br2684_push(atmvcc, skb);
 
                skb = next;
        }
index 58296307787746e99da8bdcfe006b9b39af32de1..68d8df0992abfd425c517fc8b9df3d6a40fe71ff 100644 (file)
 #include <linux/err.h>
 #include <linux/ctype.h>
 #include <linux/if_arp.h>
+#include <linux/if_vlan.h>
 
 #include "net-sysfs.h"
 
@@ -1362,6 +1363,29 @@ void netif_device_attach(struct net_device *dev)
 }
 EXPORT_SYMBOL(netif_device_attach);
 
+static bool can_checksum_protocol(unsigned long features, __be16 protocol)
+{
+       return ((features & NETIF_F_GEN_CSUM) ||
+               ((features & NETIF_F_IP_CSUM) &&
+                protocol == htons(ETH_P_IP)) ||
+               ((features & NETIF_F_IPV6_CSUM) &&
+                protocol == htons(ETH_P_IPV6)));
+}
+
+static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
+{
+       if (can_checksum_protocol(dev->features, skb->protocol))
+               return true;
+
+       if (skb->protocol == htons(ETH_P_8021Q)) {
+               struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
+               if (can_checksum_protocol(dev->features & dev->vlan_features,
+                                         veh->h_vlan_encapsulated_proto))
+                       return true;
+       }
+
+       return false;
+}
 
 /*
  * Invalidate hardware checksum when packet is to be mangled, and
@@ -1640,14 +1664,8 @@ int dev_queue_xmit(struct sk_buff *skb)
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                skb_set_transport_header(skb, skb->csum_start -
                                              skb_headroom(skb));
-
-               if (!(dev->features & NETIF_F_GEN_CSUM) &&
-                   !((dev->features & NETIF_F_IP_CSUM) &&
-                     skb->protocol == htons(ETH_P_IP)) &&
-                   !((dev->features & NETIF_F_IPV6_CSUM) &&
-                     skb->protocol == htons(ETH_P_IPV6)))
-                       if (skb_checksum_help(skb))
-                               goto out_kfree_skb;
+               if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb))
+                       goto out_kfree_skb;
        }
 
 gso:
index 045e799d3e1db4e5cc58f72c8a35fc3f05d2eb87..ec834480abe727c3cfee6100824cf87a2f7284fa 100644 (file)
@@ -466,9 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
                reqp=&lopt->syn_table[i];
                while ((req = *reqp) != NULL) {
                        if (time_after_eq(now, req->expires)) {
-                               if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) &&
-                                   (inet_rsk(req)->acked ||
-                                    !req->rsk_ops->rtx_syn_ack(parent, req))) {
+                               if ((req->retrans < thresh ||
+                                    (inet_rsk(req)->acked && req->retrans < max_retries))
+                                   && !req->rsk_ops->rtx_syn_ack(parent, req)) {
                                        unsigned long timeo;
 
                                        if (req->retrans++ == 0)
index 04578593e100cee88d67fc88999efe8c421f353d..d2a887fc8d9b1b53f1539bcfc8c446d248466522 100644 (file)
@@ -556,7 +556,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
 
        spin_lock_bh(&nf_nat_lock);
        hlist_del_rcu(&nat->bysource);
-       nat->ct = NULL;
        spin_unlock_bh(&nf_nat_lock);
 }
 
@@ -570,8 +569,8 @@ static void nf_nat_move_storage(void *new, void *old)
                return;
 
        spin_lock_bh(&nf_nat_lock);
-       hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
        new_nat->ct = ct;
+       hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
        spin_unlock_bh(&nf_nat_lock);
 }
 
index e7e091d365fffb1630782dba6ca659921cb0a411..37a1ecd9d600323c78cbd209cdbaa11b2f7d39a8 100644 (file)
@@ -934,7 +934,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
              srcp  = inet->num;
 
        seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
-               " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d",
+               " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
                i, src, srcp, dest, destp, sp->sk_state,
                atomic_read(&sp->sk_wmem_alloc),
                atomic_read(&sp->sk_rmem_alloc),
index 97a230026e13af4243e458a5a915c90561b8ac28..12695be2c255a2ac4baeb5aa049dd16f41fb7bf9 100644 (file)
 int sysctl_tcp_tw_reuse __read_mostly;
 int sysctl_tcp_low_latency __read_mostly;
 
-/* Check TCP sequence numbers in ICMP packets. */
-#define ICMP_MIN_LENGTH 8
-
-void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
 
 #ifdef CONFIG_TCP_MD5SIG
 static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
index 584e6d74e3a9f0cf1b72fe0c797dc8033332eed0..7135279f3f8480d20e07120f5b34740811f71a36 100644 (file)
@@ -52,7 +52,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
                IP_ECN_clear(top_iph);
 
        top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
-                           0 : XFRM_MODE_SKB_CB(skb)->frag_off;
+               0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF));
        ip_select_ident(top_iph, dst->child, NULL);
 
        top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
index 3de6ffdaedf2ff234a2f16ddaaacce7e4a481aef..32e871a6c25ac35a3952fc8705f7394ec0f7ba2a 100644 (file)
@@ -222,15 +222,18 @@ __ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr)
 
 }
 
-static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
+static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
+                               struct ip_tunnel_prl __user *a)
 {
-       struct ip_tunnel_prl *kp;
+       struct ip_tunnel_prl kprl, *kp;
        struct ip_tunnel_prl_entry *prl;
        unsigned int cmax, c = 0, ca, len;
        int ret = 0;
 
-       cmax = a->datalen / sizeof(*a);
-       if (cmax > 1 && a->addr != htonl(INADDR_ANY))
+       if (copy_from_user(&kprl, a, sizeof(kprl)))
+               return -EFAULT;
+       cmax = kprl.datalen / sizeof(kprl);
+       if (cmax > 1 && kprl.addr != htonl(INADDR_ANY))
                cmax = 1;
 
        /* For simple GET or for root users,
@@ -261,26 +264,25 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
        for (prl = t->prl; prl; prl = prl->next) {
                if (c > cmax)
                        break;
-               if (a->addr != htonl(INADDR_ANY) && prl->addr != a->addr)
+               if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr)
                        continue;
                kp[c].addr = prl->addr;
                kp[c].flags = prl->flags;
                c++;
-               if (a->addr != htonl(INADDR_ANY))
+               if (kprl.addr != htonl(INADDR_ANY))
                        break;
        }
 out:
        read_unlock(&ipip6_lock);
 
        len = sizeof(*kp) * c;
-       ret = len ? copy_to_user(a->data, kp, len) : 0;
+       ret = 0;
+       if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen))
+               ret = -EFAULT;
 
        kfree(kp);
-       if (ret)
-               return -EFAULT;
 
-       a->datalen = len;
-       return 0;
+       return ret;
 }
 
 static int
@@ -873,11 +875,20 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
                break;
 
        case SIOCGETPRL:
+               err = -EINVAL;
+               if (dev == sitn->fb_tunnel_dev)
+                       goto done;
+               err = -ENOENT;
+               if (!(t = netdev_priv(dev)))
+                       goto done;
+               err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data);
+               break;
+
        case SIOCADDPRL:
        case SIOCDELPRL:
        case SIOCCHGPRL:
                err = -EPERM;
-               if (cmd != SIOCGETPRL && !capable(CAP_NET_ADMIN))
+               if (!capable(CAP_NET_ADMIN))
                        goto done;
                err = -EINVAL;
                if (dev == sitn->fb_tunnel_dev)
@@ -890,12 +901,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
                        goto done;
 
                switch (cmd) {
-               case SIOCGETPRL:
-                       err = ipip6_tunnel_get_prl(t, &prl);
-                       if (!err && copy_to_user(ifr->ifr_ifru.ifru_data,
-                                                &prl, sizeof(prl)))
-                               err = -EFAULT;
-                       break;
                case SIOCDELPRL:
                        err = ipip6_tunnel_del_prl(t, &prl);
                        break;
@@ -904,8 +909,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
                        err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL);
                        break;
                }
-               if (cmd != SIOCGETPRL)
-                       netdev_state_change(dev);
+               netdev_state_change(dev);
                break;
 
        default:
index 1d7dd54aacef31120fa744bef928bd7075ad72c2..28d8bd53bd3a9f3ccf01e56c5df5bcffd87d1908 100644 (file)
@@ -1562,13 +1562,13 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
         * be cloned. This could happen, e.g., with Linux bridge code passing
         * us broadcast frames. */
 
-       if (head_need > 0 || skb_header_cloned(skb)) {
+       if (head_need > 0 || skb_cloned(skb)) {
 #if 0
                printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes "
                       "of headroom\n", dev->name, head_need);
 #endif
 
-               if (skb_header_cloned(skb))
+               if (skb_cloned(skb))
                        I802_DEBUG_INC(local->tx_expand_skb_head_cloned);
                else
                        I802_DEBUG_INC(local->tx_expand_skb_head);
index a8bb8e31b1ec790c2e1e4e160ca81f8be1719d5c..6106cb79060c928f65e7d5a5d2154f280b55bf5f 100644 (file)
@@ -496,7 +496,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
            sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
-               if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
+               if (sdata->u.sta.state == IEEE80211_ASSOCIATED ||
+                   sdata->u.sta.state == IEEE80211_IBSS_JOINED) {
                        ap_addr->sa_family = ARPHRD_ETHER;
                        memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
                        return 0;
index dc1598b86004e9df03e4eefb188b17ca292171b9..635b996c8c350c52c5f9cef6747c3408e3e40711 100644 (file)
@@ -673,7 +673,7 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
 #ifdef CONFIG_MAC80211_HT_DEBUG
                        if (net_ratelimit())
                                printk(KERN_DEBUG "allocated aggregation queue"
-                                       " %d tid %d addr %s pool=0x%lX",
+                                       " %d tid %d addr %s pool=0x%lX\n",
                                        i, tid, print_mac(mac, sta->addr),
                                        q->qdisc_pool[0]);
 #endif /* CONFIG_MAC80211_HT_DEBUG */
index bcc19fa4ed1e07ab4277f7c02c933235cd0dc261..8a3f8b34e4661ef38a8acb81b7c5fb015cf108c6 100644 (file)
@@ -59,12 +59,19 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
        if (!*ext)
                return NULL;
 
+       INIT_RCU_HEAD(&(*ext)->rcu);
        (*ext)->offset[id] = off;
        (*ext)->len = len;
 
        return (void *)(*ext) + off;
 }
 
+static void __nf_ct_ext_free_rcu(struct rcu_head *head)
+{
+       struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu);
+       kfree(ext);
+}
+
 void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
 {
        struct nf_ct_ext *new;
@@ -106,7 +113,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
                                        (void *)ct->ext + ct->ext->offset[i]);
                        rcu_read_unlock();
                }
-               kfree(ct->ext);
+               call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu);
                ct->ext = new;
        }
 
index 95da1a24aab786e31eecd1a983a67faa81b44de0..2f83c158934d4ba5350d63aa86d6ff90ae99d585 100644 (file)
@@ -619,6 +619,7 @@ static const struct nf_conntrack_expect_policy h245_exp_policy = {
 static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = {
        .name                   = "H.245",
        .me                     = THIS_MODULE,
+       .tuple.src.l3num        = AF_UNSPEC,
        .tuple.dst.protonum     = IPPROTO_UDP,
        .help                   = h245_help,
        .expect_policy          = &h245_exp_policy,
@@ -1765,6 +1766,7 @@ static void __exit nf_conntrack_h323_fini(void)
        nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
        nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
        nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
+       nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
        kfree(h323_buffer);
        pr_debug("nf_ct_h323: fini\n");
 }
@@ -1777,28 +1779,34 @@ static int __init nf_conntrack_h323_init(void)
        h323_buffer = kmalloc(65536, GFP_KERNEL);
        if (!h323_buffer)
                return -ENOMEM;
-       ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]);
+       ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245);
        if (ret < 0)
                goto err1;
-       ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]);
+       ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]);
        if (ret < 0)
                goto err2;
-       ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]);
+       ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]);
        if (ret < 0)
                goto err3;
-       ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]);
+       ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]);
        if (ret < 0)
                goto err4;
+       ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]);
+       if (ret < 0)
+               goto err5;
        pr_debug("nf_ct_h323: init success\n");
        return 0;
 
-err4:
+err5:
        nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
-err3:
+err4:
        nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
-err2:
+err3:
        nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
+err2:
+       nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
 err1:
+       kfree(h323_buffer);
        return ret;
 }
 
index f5aa23c3e886d88b852ff0aeeb8ef55ae2bb3182..3e1191cecaf03131d5ad2ff321f171f9168bc6ad 100644 (file)
@@ -444,8 +444,11 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                if (ops->dumpit == NULL)
                        return -EOPNOTSUPP;
 
-               return netlink_dump_start(genl_sock, skb, nlh,
-                                         ops->dumpit, ops->done);
+               genl_unlock();
+               err = netlink_dump_start(genl_sock, skb, nlh,
+                                        ops->dumpit, ops->done);
+               genl_lock();
+               return err;
        }
 
        if (ops->doit == NULL)
@@ -603,9 +606,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
        int chains_to_skip = cb->args[0];
        int fams_to_skip = cb->args[1];
 
-       if (chains_to_skip != 0)
-               genl_lock();
-
        for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
                if (i < chains_to_skip)
                        continue;
@@ -623,9 +623,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
        }
 
 errout:
-       if (chains_to_skip != 0)
-               genl_unlock();
-
        cb->args[0] = i;
        cb->args[1] = n;
 
@@ -770,7 +767,7 @@ static int __init genl_init(void)
 
        /* we'll bump the group number right afterwards */
        genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0,
-                                         genl_rcv, NULL, THIS_MODULE);
+                                         genl_rcv, &genl_mutex, THIS_MODULE);
        if (genl_sock == NULL)
                panic("GENL: Cannot initialize generic netlink\n");
 
index 5bc1ed4901800af63fc1255ba1f5eecbbe8368de..6807c97985a54adac52ceb42d4b3847e0beebdd2 100644 (file)
@@ -28,6 +28,7 @@
  * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $
  */
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 */
 
 #define HTB_HSIZE 16           /* classid hash size */
-#define HTB_HYSTERESIS 1       /* whether to use mode hysteresis for speedup */
+static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */
 #define HTB_VER 0x30011                /* major must be matched with number suplied by TC as version */
 
 #if HTB_VER >> 16 != TC_HTB_PROTOVER
 #error "Mismatched sch_htb.c and pkt_sch.h"
 #endif
 
+/* Module parameter and sysfs export */
+module_param    (htb_hysteresis, int, 0640);
+MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
+
 /* used internaly to keep status of single class */
 enum htb_cmode {
        HTB_CANT_SEND,          /* class can't send and can't borrow */
@@ -462,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
                htb_remove_class_from_row(q, cl, mask);
 }
 
-#if HTB_HYSTERESIS
 static inline long htb_lowater(const struct htb_class *cl)
 {
-       return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
+       if (htb_hysteresis)
+               return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
+       else
+               return 0;
 }
 static inline long htb_hiwater(const struct htb_class *cl)
 {
-       return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
+       if (htb_hysteresis)
+               return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
+       else
+               return 0;
 }
-#else
-#define htb_lowater(cl)        (0)
-#define htb_hiwater(cl)        (0)
-#endif
+
 
 /**
  * htb_class_mode - computes and returns current class mode
index 532634861db15907ac417a7be79706615e825c6d..024c3ebd9661b946897bebc9e3819013fa2c4000 100644 (file)
@@ -474,6 +474,15 @@ static void sctp_association_destroy(struct sctp_association *asoc)
 void sctp_assoc_set_primary(struct sctp_association *asoc,
                            struct sctp_transport *transport)
 {
+       int changeover = 0;
+
+       /* it's a changeover only if we already have a primary path
+        * that we are changing
+        */
+       if (asoc->peer.primary_path != NULL &&
+           asoc->peer.primary_path != transport)
+               changeover = 1 ;
+
        asoc->peer.primary_path = transport;
 
        /* Set a default msg_name for events. */
@@ -499,12 +508,12 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
         * double switch to the same destination address.
         */
        if (transport->cacc.changeover_active)
-               transport->cacc.cycling_changeover = 1;
+               transport->cacc.cycling_changeover = changeover;
 
        /* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that
         * a changeover has occurred.
         */
-       transport->cacc.changeover_active = 1;
+       transport->cacc.changeover_active = changeover;
 
        /* 3) The sender MUST store the next TSN to be sent in
         * next_tsn_at_change.
index b435a193c5df916cd8d4ff7d0412167d17f5c99d..9258dfe784aee759e71c68115fa4eb847d6b8825 100644 (file)
@@ -108,14 +108,23 @@ static __init int sctp_proc_init(void)
        }
 
        if (sctp_snmp_proc_init())
-               goto out_nomem;
+               goto out_snmp_proc_init;
        if (sctp_eps_proc_init())
-               goto out_nomem;
+               goto out_eps_proc_init;
        if (sctp_assocs_proc_init())
-               goto out_nomem;
+               goto out_assocs_proc_init;
 
        return 0;
 
+out_assocs_proc_init:
+       sctp_eps_proc_exit();
+out_eps_proc_init:
+       sctp_snmp_proc_exit();
+out_snmp_proc_init:
+       if (proc_net_sctp) {
+               proc_net_sctp = NULL;
+               remove_proc_entry("sctp", init_net.proc_net);
+       }
 out_nomem:
        return -ENOMEM;
 }
index e18cd3628db4f7fe12ad6acc9fe6c0922d022a82..657835f227d342a2eadc4498c6076b7c435839ac 100644 (file)
@@ -169,6 +169,11 @@ static inline int unix_may_send(struct sock *sk, struct sock *osk)
        return (unix_peer(osk) == NULL || unix_our_peer(sk, osk));
 }
 
+static inline int unix_recvq_full(struct sock const *sk)
+{
+       return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog;
+}
+
 static struct sock *unix_peer_get(struct sock *s)
 {
        struct sock *peer;
@@ -482,6 +487,8 @@ static int unix_socketpair(struct socket *, struct socket *);
 static int unix_accept(struct socket *, struct socket *, int);
 static int unix_getname(struct socket *, struct sockaddr *, int *, int);
 static unsigned int unix_poll(struct file *, struct socket *, poll_table *);
+static unsigned int unix_datagram_poll(struct file *, struct socket *,
+                                      poll_table *);
 static int unix_ioctl(struct socket *, unsigned int, unsigned long);
 static int unix_shutdown(struct socket *, int);
 static int unix_stream_sendmsg(struct kiocb *, struct socket *,
@@ -527,7 +534,7 @@ static const struct proto_ops unix_dgram_ops = {
        .socketpair =   unix_socketpair,
        .accept =       sock_no_accept,
        .getname =      unix_getname,
-       .poll =         datagram_poll,
+       .poll =         unix_datagram_poll,
        .ioctl =        unix_ioctl,
        .listen =       sock_no_listen,
        .shutdown =     unix_shutdown,
@@ -548,7 +555,7 @@ static const struct proto_ops unix_seqpacket_ops = {
        .socketpair =   unix_socketpair,
        .accept =       unix_accept,
        .getname =      unix_getname,
-       .poll =         datagram_poll,
+       .poll =         unix_datagram_poll,
        .ioctl =        unix_ioctl,
        .listen =       unix_listen,
        .shutdown =     unix_shutdown,
@@ -983,8 +990,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
 
        sched = !sock_flag(other, SOCK_DEAD) &&
                !(other->sk_shutdown & RCV_SHUTDOWN) &&
-               (skb_queue_len(&other->sk_receive_queue) >
-                other->sk_max_ack_backlog);
+               unix_recvq_full(other);
 
        unix_state_unlock(other);
 
@@ -1058,8 +1064,7 @@ restart:
        if (other->sk_state != TCP_LISTEN)
                goto out_unlock;
 
-       if (skb_queue_len(&other->sk_receive_queue) >
-           other->sk_max_ack_backlog) {
+       if (unix_recvq_full(other)) {
                err = -EAGAIN;
                if (!timeo)
                        goto out_unlock;
@@ -1428,9 +1433,7 @@ restart:
                        goto out_unlock;
        }
 
-       if (unix_peer(other) != sk &&
-           (skb_queue_len(&other->sk_receive_queue) >
-            other->sk_max_ack_backlog)) {
+       if (unix_peer(other) != sk && unix_recvq_full(other)) {
                if (!timeo) {
                        err = -EAGAIN;
                        goto out_unlock;
@@ -1991,6 +1994,64 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
        return mask;
 }
 
+static unsigned int unix_datagram_poll(struct file *file, struct socket *sock,
+                                      poll_table *wait)
+{
+       struct sock *sk = sock->sk, *peer;
+       unsigned int mask;
+
+       poll_wait(file, sk->sk_sleep, wait);
+
+       peer = unix_peer_get(sk);
+       if (peer) {
+               if (peer != sk) {
+                       /*
+                        * Writability of a connected socket additionally
+                        * depends on the state of the receive queue of the
+                        * peer.
+                        */
+                       poll_wait(file, &unix_sk(peer)->peer_wait, wait);
+               } else {
+                       sock_put(peer);
+                       peer = NULL;
+               }
+       }
+
+       mask = 0;
+
+       /* exceptional events? */
+       if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
+               mask |= POLLERR;
+       if (sk->sk_shutdown & RCV_SHUTDOWN)
+               mask |= POLLRDHUP;
+       if (sk->sk_shutdown == SHUTDOWN_MASK)
+               mask |= POLLHUP;
+
+       /* readable? */
+       if (!skb_queue_empty(&sk->sk_receive_queue) ||
+           (sk->sk_shutdown & RCV_SHUTDOWN))
+               mask |= POLLIN | POLLRDNORM;
+
+       /* Connection-based need to check for termination and startup */
+       if (sk->sk_type == SOCK_SEQPACKET) {
+               if (sk->sk_state == TCP_CLOSE)
+                       mask |= POLLHUP;
+               /* connection hasn't started yet? */
+               if (sk->sk_state == TCP_SYN_SENT)
+                       return mask;
+       }
+
+       /* writable? */
+       if (unix_writable(sk) && !(peer && unix_recvq_full(peer)))
+               mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
+       else
+               set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
+
+       if (peer)
+               sock_put(peer);
+
+       return mask;
+}
 
 #ifdef CONFIG_PROC_FS
 static struct sock *first_unix_socket(int *i)