Merge branch 'master' of git://1984.lsi.us.es/net-2.6
authorDavid S. Miller <davem@davemloft.net>
Tue, 11 Jan 2011 23:43:03 +0000 (15:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Jan 2011 23:43:03 +0000 (15:43 -0800)
58 files changed:
drivers/net/Kconfig
drivers/net/bfin_mac.c
drivers/net/bfin_mac.h
drivers/net/cxgb4vf/t4vf_hw.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/mlx4/en_netdev.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/ppp_async.c
drivers/net/ppp_deflate.c
drivers/net/ppp_generic.c
drivers/net/ppp_mppe.c
drivers/net/ppp_synctty.c
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_ethtool.c
drivers/net/qlcnic/qlcnic_init.c
drivers/net/qlcnic/qlcnic_main.c
drivers/net/r8169.c
include/linux/bfin_mac.h
include/linux/etherdevice.h
include/linux/netdevice.h
include/net/ah.h
include/net/arp.h
include/net/phonet/phonet.h
include/net/sch_generic.h
net/caif/caif_socket.c
net/caif/chnl_net.c
net/core/dev.c
net/ethernet/eth.c
net/ipv4/ah4.c
net/ipv4/arp.c
net/ipv4/inet_connection_sock.c
net/ipv6/ah6.c
net/ipv6/inet6_connection_sock.c
net/phonet/af_phonet.c
net/sched/act_csum.c
net/sched/act_ipt.c
net/sched/act_mirred.c
net/sched/act_nat.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/act_simple.c
net/sched/act_skbedit.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sched/sch_drr.c
net/sched/sch_dsmark.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_ingress.c
net/sched/sch_multiq.c
net/sched/sch_netem.c
net/sched/sch_prio.c
net/sched/sch_red.c
net/sched/sch_sfq.c
net/sched/sch_tbf.c
net/sched/sch_teql.c
net/xfrm/xfrm_user.c

index 5780dad..ff652c7 100644 (file)
@@ -1950,14 +1950,6 @@ config FEC
          Say Y here if you want to use the built-in 10/100 Fast ethernet
          controller on some Motorola ColdFire and Freescale i.MX processors.
 
-config FEC2
-       bool "Second FEC ethernet controller"
-       depends on FEC
-       help
-         Say Y here if you want to use the second built-in 10/100 Fast
-         ethernet controller on some Motorola ColdFire and Freescale
-         i.MX processors.
-
 config FEC_MPC52xx
        tristate "MPC52xx FEC driver"
        depends on PPC_MPC52xx && PPC_BESTCOMM
index ce1e5e9..0b9fc51 100644 (file)
@@ -8,6 +8,11 @@
  * Licensed under the GPL-2 or later.
  */
 
+#define DRV_VERSION    "1.1"
+#define DRV_DESC       "Blackfin on-chip Ethernet MAC driver"
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 
 #include "bfin_mac.h"
 
-#define DRV_NAME       "bfin_mac"
-#define DRV_VERSION    "1.1"
-#define DRV_AUTHOR     "Bryan Wu, Luke Yang"
-#define DRV_DESC       "Blackfin on-chip Ethernet MAC driver"
-
-MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_AUTHOR("Bryan Wu, Luke Yang");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION(DRV_DESC);
 MODULE_ALIAS("platform:bfin_mac");
@@ -189,8 +189,7 @@ static int desc_list_init(void)
                /* allocate a new skb for next time receive */
                new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
                if (!new_skb) {
-                       printk(KERN_NOTICE DRV_NAME
-                              ": init: low on mem - packet dropped\n");
+                       pr_notice("init: low on mem - packet dropped\n");
                        goto init_error;
                }
                skb_reserve(new_skb, NET_IP_ALIGN);
@@ -240,7 +239,7 @@ static int desc_list_init(void)
 
 init_error:
        desc_list_free();
-       printk(KERN_ERR DRV_NAME ": kmalloc failed\n");
+       pr_err("kmalloc failed\n");
        return -ENOMEM;
 }
 
@@ -259,8 +258,7 @@ static int bfin_mdio_poll(void)
        while ((bfin_read_EMAC_STAADD()) & STABUSY) {
                udelay(1);
                if (timeout_cnt-- < 0) {
-                       printk(KERN_ERR DRV_NAME
-                       ": wait MDC/MDIO transaction to complete timeout\n");
+                       pr_err("wait MDC/MDIO transaction to complete timeout\n");
                        return -ETIMEDOUT;
                }
        }
@@ -350,9 +348,9 @@ static void bfin_mac_adjust_link(struct net_device *dev)
                                        opmode &= ~RMII_10;
                                        break;
                                default:
-                                       printk(KERN_WARNING
-                                               "%s: Ack!  Speed (%d) is not 10/100!\n",
-                                               DRV_NAME, phydev->speed);
+                                       netdev_warn(dev,
+                                               "Ack! Speed (%d) is not 10/100!\n",
+                                               phydev->speed);
                                        break;
                                }
                                bfin_write_EMAC_OPMODE(opmode);
@@ -417,14 +415,13 @@ static int mii_probe(struct net_device *dev, int phy_mode)
 
        /* now we are supposed to have a proper phydev, to attach to... */
        if (!phydev) {
-               printk(KERN_INFO "%s: Don't found any phy device at all\n",
-                       dev->name);
+               netdev_err(dev, "no phy device found\n");
                return -ENODEV;
        }
 
        if (phy_mode != PHY_INTERFACE_MODE_RMII &&
                phy_mode != PHY_INTERFACE_MODE_MII) {
-               printk(KERN_INFO "%s: Invalid phy interface mode\n", dev->name);
+               netdev_err(dev, "invalid phy interface mode\n");
                return -EINVAL;
        }
 
@@ -432,7 +429,7 @@ static int mii_probe(struct net_device *dev, int phy_mode)
                        0, phy_mode);
 
        if (IS_ERR(phydev)) {
-               printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+               netdev_err(dev, "could not attach PHY\n");
                return PTR_ERR(phydev);
        }
 
@@ -453,11 +450,10 @@ static int mii_probe(struct net_device *dev, int phy_mode)
        lp->old_duplex = -1;
        lp->phydev = phydev;
 
-       printk(KERN_INFO "%s: attached PHY driver [%s] "
-              "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
-              "@sclk=%dMHz)\n",
-              DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
-              MDC_CLK, mdc_div, sclk/1000000);
+       pr_info("attached PHY driver [%s] "
+               "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)@sclk=%dMHz)\n",
+               phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
+               MDC_CLK, mdc_div, sclk/1000000);
 
        return 0;
 }
@@ -502,7 +498,7 @@ bfin_mac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
+       strcpy(info->driver, KBUILD_MODNAME);
        strcpy(info->version, DRV_VERSION);
        strcpy(info->fw_version, "N/A");
        strcpy(info->bus_info, dev_name(&dev->dev));
@@ -562,7 +558,7 @@ static const struct ethtool_ops bfin_mac_ethtool_ops = {
 };
 
 /**************************************************************************/
-void setup_system_regs(struct net_device *dev)
+static void setup_system_regs(struct net_device *dev)
 {
        struct bfin_mac_local *lp = netdev_priv(dev);
        int i;
@@ -592,6 +588,10 @@ void setup_system_regs(struct net_device *dev)
 
        bfin_write_EMAC_MMC_CTL(RSTC | CROLL);
 
+       /* Set vlan regs to let 1522 bytes long packets pass through */
+       bfin_write_EMAC_VLAN1(lp->vlan1_mask);
+       bfin_write_EMAC_VLAN2(lp->vlan2_mask);
+
        /* Initialize the TX DMA channel registers */
        bfin_write_DMA2_X_COUNT(0);
        bfin_write_DMA2_X_MODIFY(4);
@@ -827,8 +827,7 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
                while ((!(bfin_read_EMAC_PTP_ISTAT() & TXTL)) && (--timeout_cnt))
                        udelay(1);
                if (timeout_cnt == 0)
-                       printk(KERN_ERR DRV_NAME
-                                       ": fails to timestamp the TX packet\n");
+                       netdev_err(netdev, "timestamp the TX packet failed\n");
                else {
                        struct skb_shared_hwtstamps shhwtstamps;
                        u64 ns;
@@ -1083,8 +1082,7 @@ static void bfin_mac_rx(struct net_device *dev)
         * we which case we simply drop the packet
         */
        if (current_rx_ptr->status.status_word & RX_ERROR_MASK) {
-               printk(KERN_NOTICE DRV_NAME
-                      ": rx: receive error - packet dropped\n");
+               netdev_notice(dev, "rx: receive error - packet dropped\n");
                dev->stats.rx_dropped++;
                goto out;
        }
@@ -1094,8 +1092,7 @@ static void bfin_mac_rx(struct net_device *dev)
 
        new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
        if (!new_skb) {
-               printk(KERN_NOTICE DRV_NAME
-                      ": rx: low on mem - packet dropped\n");
+               netdev_notice(dev, "rx: low on mem - packet dropped\n");
                dev->stats.rx_dropped++;
                goto out;
        }
@@ -1213,7 +1210,7 @@ static int bfin_mac_enable(struct phy_device *phydev)
        int ret;
        u32 opmode;
 
-       pr_debug("%s: %s\n", DRV_NAME, __func__);
+       pr_debug("%s\n", __func__);
 
        /* Set RX DMA */
        bfin_write_DMA1_NEXT_DESC_PTR(&(rx_list_head->desc_a));
@@ -1323,7 +1320,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev)
        u32 sysctl;
 
        if (dev->flags & IFF_PROMISC) {
-               printk(KERN_INFO "%s: set to promisc mode\n", dev->name);
+               netdev_info(dev, "set promisc mode\n");
                sysctl = bfin_read_EMAC_OPMODE();
                sysctl |= PR;
                bfin_write_EMAC_OPMODE(sysctl);
@@ -1393,7 +1390,7 @@ static int bfin_mac_open(struct net_device *dev)
         * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
         */
        if (!is_valid_ether_addr(dev->dev_addr)) {
-               printk(KERN_WARNING DRV_NAME ": no valid ethernet hw addr\n");
+               netdev_warn(dev, "no valid ethernet hw addr\n");
                return -EINVAL;
        }
 
@@ -1527,6 +1524,9 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
                goto out_err_mii_probe;
        }
 
+       lp->vlan1_mask = ETH_P_8021Q | mii_bus_data->vlan1_mask;
+       lp->vlan2_mask = ETH_P_8021Q | mii_bus_data->vlan2_mask;
+
        /* Fill in the fields of the device structure with ethernet values. */
        ether_setup(ndev);
 
@@ -1558,7 +1558,7 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
        bfin_mac_hwtstamp_init(ndev);
 
        /* now, print out the card info, in a short format.. */
-       dev_info(&pdev->dev, "%s, Version %s\n", DRV_DESC, DRV_VERSION);
+       netdev_info(ndev, "%s, Version %s\n", DRV_DESC, DRV_VERSION);
 
        return 0;
 
@@ -1650,7 +1650,7 @@ static int __devinit bfin_mii_bus_probe(struct platform_device *pdev)
         * so set the GPIO pins to Ethernet mode
         */
        pin_req = mii_bus_pd->mac_peripherals;
-       rc = peripheral_request_list(pin_req, DRV_NAME);
+       rc = peripheral_request_list(pin_req, KBUILD_MODNAME);
        if (rc) {
                dev_err(&pdev->dev, "Requesting peripherals failed!\n");
                return rc;
@@ -1739,7 +1739,7 @@ static struct platform_driver bfin_mac_driver = {
        .resume = bfin_mac_resume,
        .suspend = bfin_mac_suspend,
        .driver = {
-               .name = DRV_NAME,
+               .name = KBUILD_MODNAME,
                .owner  = THIS_MODULE,
        },
 };
index aed68be..f8559ac 100644 (file)
 #include <linux/etherdevice.h>
 #include <linux/bfin_mac.h>
 
+/*
+ * Disable hardware checksum for bug #5600 if writeback cache is
+ * enabled. Otherwize, corrupted RX packet will be sent up stack
+ * without error mark.
+ */
+#ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
 #define BFIN_MAC_CSUM_OFFLOAD
+#endif
 
 #define TX_RECLAIM_JIFFIES (HZ / 5)
 
@@ -68,7 +75,6 @@ struct bfin_mac_local {
         */
        struct net_device_stats stats;
 
-       unsigned char Mac[6];   /* MAC address of the board */
        spinlock_t lock;
 
        int wol;                /* Wake On Lan */
@@ -76,6 +82,9 @@ struct bfin_mac_local {
        struct timer_list tx_reclaim_timer;
        struct net_device *ndev;
 
+       /* Data for EMAC_VLAN1 regs */
+       u16 vlan1_mask, vlan2_mask;
+
        /* MII and PHY stuffs */
        int old_link;          /* used by bf537_adjust_link */
        int old_speed;
index e4bec78..0f51c80 100644 (file)
@@ -147,9 +147,20 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
        /*
         * Write the command array into the Mailbox Data register array and
         * transfer ownership of the mailbox to the firmware.
+        *
+        * For the VFs, the Mailbox Data "registers" are actually backed by
+        * T4's "MA" interface rather than PL Registers (as is the case for
+        * the PFs).  Because these are in different coherency domains, the
+        * write to the VF's PL-register-backed Mailbox Control can race in
+        * front of the writes to the MA-backed VF Mailbox Data "registers".
+        * So we need to do a read-back on at least one byte of the VF Mailbox
+        * Data registers before doing the write to the VF Mailbox Control
+        * register.
         */
        for (i = 0, p = cmd; i < size; i += 8)
                t4_write_reg64(adapter, mbox_data + i, be64_to_cpu(*p++));
+       t4_read_reg(adapter, mbox_data);         /* flush write */
+
        t4_write_reg(adapter, mbox_ctl,
                     MBMSGVALID | MBOWNER(MBOX_OWNER_FW));
        t4_read_reg(adapter, mbox_ctl);          /* flush write */
index a724a2d..6c7257b 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "ehea"
-#define DRV_VERSION    "EHEA_0106"
+#define DRV_VERSION    "EHEA_0107"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
index 1032b5b..f75d314 100644 (file)
@@ -437,7 +437,7 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
                }
        }
        /* Ring doorbell */
-       ehea_update_rq1a(pr->qp, i);
+       ehea_update_rq1a(pr->qp, i - 1);
 }
 
 static int ehea_refill_rq_def(struct ehea_port_res *pr,
@@ -1329,9 +1329,7 @@ static int ehea_fill_port_res(struct ehea_port_res *pr)
        int ret;
        struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr;
 
-       ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1
-                              - init_attr->act_nr_rwqes_rq2
-                              - init_attr->act_nr_rwqes_rq3 - 1);
+       ehea_init_fill_rq1(pr, pr->rq1_skba.len);
 
        ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1);
 
index 6d6806b..897f576 100644 (file)
@@ -972,7 +972,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        int i;
        int err;
 
-       dev = alloc_etherdev_mq(sizeof(struct mlx4_en_priv), prof->tx_ring_num);
+       dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv),
+           prof->tx_ring_num, prof->rx_ring_num);
        if (dev == NULL) {
                mlx4_err(mdev, "Net device allocation failed\n");
                return -ENOMEM;
index 2c15891..e953793 100644 (file)
@@ -1536,6 +1536,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
        PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722),
        PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2),
        PCMCIA_DEVICE_PROD_ID12("corega", "Ether CF-TD", 0x0a21501a, 0x6589340a),
+       PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether CF-TD LAN Card", 0x5261440f, 0x8797663b),
        PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd),
        PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d),
        PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
index 78d70a6..a1b82c9 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/slab.h>
+#include <asm/unaligned.h>
 #include <asm/uaccess.h>
 #include <asm/string.h>
 
@@ -542,7 +543,7 @@ ppp_async_encode(struct asyncppp *ap)
        data = ap->tpkt->data;
        count = ap->tpkt->len;
        fcs = ap->tfcs;
-       proto = (data[0] << 8) + data[1];
+       proto = get_unaligned_be16(data);
 
        /*
         * LCP packets with code values between 1 (configure-reqest)
@@ -963,7 +964,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
        code = data[0];
        if (code != CONFACK && code != CONFREQ)
                return;
-       dlen = (data[2] << 8) + data[3];
+       dlen = get_unaligned_be16(data + 2);
        if (len < dlen)
                return;         /* packet got truncated or length is bogus */
 
@@ -997,15 +998,14 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
        while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) {
                switch (data[0]) {
                case LCP_MRU:
-                       val = (data[2] << 8) + data[3];
+                       val = get_unaligned_be16(data + 2);
                        if (inbound)
                                ap->mru = val;
                        else
                                ap->chan.mtu = val;
                        break;
                case LCP_ASYNCMAP:
-                       val = (data[2] << 24) + (data[3] << 16)
-                               + (data[4] << 8) + data[5];
+                       val = get_unaligned_be32(data + 2);
                        if (inbound)
                                ap->raccm = val;
                        else
index 695bc83..4358330 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/ppp-comp.h>
 
 #include <linux/zlib.h>
+#include <asm/unaligned.h>
 
 /*
  * State for a Deflate (de)compressor.
@@ -232,11 +233,9 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
         */
        wptr[0] = PPP_ADDRESS(rptr);
        wptr[1] = PPP_CONTROL(rptr);
-       wptr[2] = PPP_COMP >> 8;
-       wptr[3] = PPP_COMP;
+       put_unaligned_be16(PPP_COMP, wptr + 2);
        wptr += PPP_HDRLEN;
-       wptr[0] = state->seqno >> 8;
-       wptr[1] = state->seqno;
+       put_unaligned_be16(state->seqno, wptr);
        wptr += DEFLATE_OVHD;
        olen = PPP_HDRLEN + DEFLATE_OVHD;
        state->strm.next_out = wptr;
@@ -451,7 +450,7 @@ static int z_decompress(void *arg, unsigned char *ibuf, int isize,
        }
 
        /* Check the sequence number. */
-       seq = (ibuf[PPP_HDRLEN] << 8) + ibuf[PPP_HDRLEN+1];
+       seq = get_unaligned_be16(ibuf + PPP_HDRLEN);
        if (seq != (state->seqno & 0xffff)) {
                if (state->debug)
                        printk(KERN_DEBUG "z_decompress%d: bad seq # %d, expected %d\n",
index 6456484..c7a6c44 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/device.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <asm/unaligned.h>
 #include <net/slhc_vj.h>
 #include <asm/atomic.h>
 
@@ -210,7 +211,7 @@ struct ppp_net {
 };
 
 /* Get the PPP protocol number from a skb */
-#define PPP_PROTO(skb) (((skb)->data[0] << 8) + (skb)->data[1])
+#define PPP_PROTO(skb) get_unaligned_be16((skb)->data)
 
 /* We limit the length of ppp->file.rq to this (arbitrary) value */
 #define PPP_MAX_RQLEN  32
@@ -964,8 +965,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        pp = skb_push(skb, 2);
        proto = npindex_to_proto[npi];
-       pp[0] = proto >> 8;
-       pp[1] = proto;
+       put_unaligned_be16(proto, pp);
 
        netif_stop_queue(dev);
        skb_queue_tail(&ppp->file.xq, skb);
@@ -1473,8 +1473,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
                q = skb_put(frag, flen + hdrlen);
 
                /* make the MP header */
-               q[0] = PPP_MP >> 8;
-               q[1] = PPP_MP;
+               put_unaligned_be16(PPP_MP, q);
                if (ppp->flags & SC_MP_XSHORTSEQ) {
                        q[2] = bits + ((ppp->nxseq >> 8) & 0xf);
                        q[3] = ppp->nxseq;
index 6d1a1b8..9a1849a 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/ppp_defs.h>
 #include <linux/ppp-comp.h>
 #include <linux/scatterlist.h>
+#include <asm/unaligned.h>
 
 #include "ppp_mppe.h"
 
@@ -395,16 +396,14 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
         */
        obuf[0] = PPP_ADDRESS(ibuf);
        obuf[1] = PPP_CONTROL(ibuf);
-       obuf[2] = PPP_COMP >> 8;        /* isize + MPPE_OVHD + 1 */
-       obuf[3] = PPP_COMP;     /* isize + MPPE_OVHD + 2 */
+       put_unaligned_be16(PPP_COMP, obuf + 2);
        obuf += PPP_HDRLEN;
 
        state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
        if (state->debug >= 7)
                printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit,
                       state->ccount);
-       obuf[0] = state->ccount >> 8;
-       obuf[1] = state->ccount & 0xff;
+       put_unaligned_be16(state->ccount, obuf);
 
        if (!state->stateful || /* stateless mode     */
            ((state->ccount & 0xff) == 0xff) || /* "flag" packet      */
index 4c95ec3..4e6b72f 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/completion.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <asm/unaligned.h>
 #include <asm/uaccess.h>
 
 #define PPP_VERSION    "2.4.2"
@@ -563,7 +564,7 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)
        int islcp;
 
        data  = skb->data;
-       proto = (data[0] << 8) + data[1];
+       proto = get_unaligned_be16(data);
 
        /* LCP packets with codes between 1 (configure-request)
         * and 7 (code-reject) must be sent as though no options
index 9c2a02d..44e316f 100644 (file)
@@ -34,8 +34,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 14
-#define QLCNIC_LINUX_VERSIONID  "5.0.14"
+#define _QLCNIC_LINUX_SUBVERSION 15
+#define QLCNIC_LINUX_VERSIONID  "5.0.15"
 #define QLCNIC_DRV_IDC_VER  0x01
 #define QLCNIC_DRIVER_VERSION  ((_QLCNIC_LINUX_MAJOR << 16) |\
                 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -289,6 +289,26 @@ struct uni_data_desc{
        u32     reserved[5];
 };
 
+/* Flash Defines and Structures */
+#define QLCNIC_FLT_LOCATION    0x3F1000
+#define QLCNIC_FW_IMAGE_REGION 0x74
+struct qlcnic_flt_header {
+       u16 version;
+       u16 len;
+       u16 checksum;
+       u16 reserved;
+};
+
+struct qlcnic_flt_entry {
+       u8 region;
+       u8 reserved0;
+       u8 attrib;
+       u8 reserved1;
+       u32 size;
+       u32 start_addr;
+       u32 end_add;
+};
+
 /* Magic number to let user know flash is programmed */
 #define        QLCNIC_BDINFO_MAGIC 0x12345678
 
index 1e7af70..4c14510 100644 (file)
@@ -672,7 +672,7 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
        if (data[1])
                eth_test->flags |= ETH_TEST_FL_FAILED;
 
-       if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
+       if (eth_test->flags & ETH_TEST_FL_OFFLINE) {
                data[2] = qlcnic_irq_test(dev);
                if (data[2])
                        eth_test->flags |= ETH_TEST_FL_FAILED;
index 9b9c7c3..a7f1d5b 100644 (file)
@@ -627,12 +627,73 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
        return 0;
 }
 
+static int qlcnic_get_flt_entry(struct qlcnic_adapter *adapter, u8 region,
+                               struct qlcnic_flt_entry *region_entry)
+{
+       struct qlcnic_flt_header flt_hdr;
+       struct qlcnic_flt_entry *flt_entry;
+       int i = 0, ret;
+       u32 entry_size;
+
+       memset(region_entry, 0, sizeof(struct qlcnic_flt_entry));
+       ret = qlcnic_rom_fast_read_words(adapter, QLCNIC_FLT_LOCATION,
+                                        (u8 *)&flt_hdr,
+                                        sizeof(struct qlcnic_flt_header));
+       if (ret) {
+               dev_warn(&adapter->pdev->dev,
+                        "error reading flash layout header\n");
+               return -EIO;
+       }
+
+       entry_size = flt_hdr.len - sizeof(struct qlcnic_flt_header);
+       flt_entry = (struct qlcnic_flt_entry *)vzalloc(entry_size);
+       if (flt_entry == NULL) {
+               dev_warn(&adapter->pdev->dev, "error allocating memory\n");
+               return -EIO;
+       }
+
+       ret = qlcnic_rom_fast_read_words(adapter, QLCNIC_FLT_LOCATION +
+                                        sizeof(struct qlcnic_flt_header),
+                                        (u8 *)flt_entry, entry_size);
+       if (ret) {
+               dev_warn(&adapter->pdev->dev,
+                        "error reading flash layout entries\n");
+               goto err_out;
+       }
+
+       while (i < (entry_size/sizeof(struct qlcnic_flt_entry))) {
+               if (flt_entry[i].region == region)
+                       break;
+               i++;
+       }
+       if (i >= (entry_size/sizeof(struct qlcnic_flt_entry))) {
+               dev_warn(&adapter->pdev->dev,
+                        "region=%x not found in %d regions\n", region, i);
+               ret = -EIO;
+               goto err_out;
+       }
+       memcpy(region_entry, &flt_entry[i], sizeof(struct qlcnic_flt_entry));
+
+err_out:
+       vfree(flt_entry);
+       return ret;
+}
+
 int
 qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter)
 {
+       struct qlcnic_flt_entry fw_entry;
        u32 ver = -1, min_ver;
+       int ret;
 
-       qlcnic_rom_fast_read(adapter, QLCNIC_FW_VERSION_OFFSET, (int *)&ver);
+       ret = qlcnic_get_flt_entry(adapter, QLCNIC_FW_IMAGE_REGION, &fw_entry);
+       if (!ret)
+               /* 0-4:-signature,  4-8:-fw version */
+               qlcnic_rom_fast_read(adapter, fw_entry.start_addr + 4,
+                                    (int *)&ver);
+       else
+               qlcnic_rom_fast_read(adapter, QLCNIC_FW_VERSION_OFFSET,
+                                    (int *)&ver);
 
        ver = QLCNIC_DECODE_VERSION(ver);
        min_ver = QLCNIC_MIN_FW_VERSION;
index 11e3a46..37c04b4 100644 (file)
@@ -31,15 +31,15 @@ static const char qlcnic_driver_string[] = "QLogic 1/10 GbE "
 
 static struct workqueue_struct *qlcnic_wq;
 static int qlcnic_mac_learn;
-module_param(qlcnic_mac_learn, int, 0644);
+module_param(qlcnic_mac_learn, int, 0444);
 MODULE_PARM_DESC(qlcnic_mac_learn, "Mac Filter (0=disabled, 1=enabled)");
 
 static int use_msi = 1;
-module_param(use_msi, int, 0644);
+module_param(use_msi, int, 0444);
 MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled");
 
 static int use_msi_x = 1;
-module_param(use_msi_x, int, 0644);
+module_param(use_msi_x, int, 0444);
 MODULE_PARM_DESC(use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled");
 
 static int auto_fw_reset = AUTO_FW_RESET_ENABLED;
@@ -47,11 +47,11 @@ module_param(auto_fw_reset, int, 0644);
 MODULE_PARM_DESC(auto_fw_reset, "Auto firmware reset (0=disabled, 1=enabled");
 
 static int load_fw_file;
-module_param(load_fw_file, int, 0644);
+module_param(load_fw_file, int, 0444);
 MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file");
 
 static int qlcnic_config_npars;
-module_param(qlcnic_config_npars, int, 0644);
+module_param(qlcnic_config_npars, int, 0444);
 MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled");
 
 static int __devinit qlcnic_probe(struct pci_dev *pdev,
index dd758cd..bb8645a 100644 (file)
@@ -1632,36 +1632,134 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw)
 {
        __le32 *phytable = (__le32 *)fw->data;
        struct net_device *dev = tp->dev;
-       size_t i;
+       size_t index, fw_size = fw->size / sizeof(*phytable);
+       u32 predata, count;
 
        if (fw->size % sizeof(*phytable)) {
                netif_err(tp, probe, dev, "odd sized firmware %zd\n", fw->size);
                return;
        }
 
-       for (i = 0; i < fw->size / sizeof(*phytable); i++) {
-               u32 action = le32_to_cpu(phytable[i]);
+       for (index = 0; index < fw_size; index++) {
+               u32 action = le32_to_cpu(phytable[index]);
+               u32 regno = (action & 0x0fff0000) >> 16;
 
-               if (!action)
+               switch(action & 0xf0000000) {
+               case PHY_READ:
+               case PHY_DATA_OR:
+               case PHY_DATA_AND:
+               case PHY_READ_EFUSE:
+               case PHY_CLEAR_READCOUNT:
+               case PHY_WRITE:
+               case PHY_WRITE_PREVIOUS:
+               case PHY_DELAY_MS:
                        break;
 
-               if ((action & 0xf0000000) != PHY_WRITE) {
-                       netif_err(tp, probe, dev,
-                                 "unknown action 0x%08x\n", action);
+               case PHY_BJMPN:
+                       if (regno > index) {
+                               netif_err(tp, probe, tp->dev,
+                                       "Out of range of firmware\n");
+                               return;
+                       }
+                       break;
+               case PHY_READCOUNT_EQ_SKIP:
+                       if (index + 2 >= fw_size) {
+                               netif_err(tp, probe, tp->dev,
+                                       "Out of range of firmware\n");
+                               return;
+                       }
+                       break;
+               case PHY_COMP_EQ_SKIPN:
+               case PHY_COMP_NEQ_SKIPN:
+               case PHY_SKIPN:
+                       if (index + 1 + regno >= fw_size) {
+                               netif_err(tp, probe, tp->dev,
+                                       "Out of range of firmware\n");
+                               return;
+                       }
+                       break;
+
+               case PHY_READ_MAC_BYTE:
+               case PHY_WRITE_MAC_BYTE:
+               case PHY_WRITE_ERI_WORD:
+               default:
+                       netif_err(tp, probe, tp->dev,
+                                 "Invalid action 0x%08x\n", action);
                        return;
                }
        }
 
-       while (i-- != 0) {
-               u32 action = le32_to_cpu(*phytable);
+       predata = 0;
+       count = 0;
+
+       for (index = 0; index < fw_size; ) {
+               u32 action = le32_to_cpu(phytable[index]);
                u32 data = action & 0x0000ffff;
-               u32 reg = (action & 0x0fff0000) >> 16;
+               u32 regno = (action & 0x0fff0000) >> 16;
+
+               if (!action)
+                       break;
 
                switch(action & 0xf0000000) {
+               case PHY_READ:
+                       predata = rtl_readphy(tp, regno);
+                       count++;
+                       index++;
+                       break;
+               case PHY_DATA_OR:
+                       predata |= data;
+                       index++;
+                       break;
+               case PHY_DATA_AND:
+                       predata &= data;
+                       index++;
+                       break;
+               case PHY_BJMPN:
+                       index -= regno;
+                       break;
+               case PHY_READ_EFUSE:
+                       predata = rtl8168d_efuse_read(tp->mmio_addr, regno);
+                       index++;
+                       break;
+               case PHY_CLEAR_READCOUNT:
+                       count = 0;
+                       index++;
+                       break;
                case PHY_WRITE:
-                       rtl_writephy(tp, reg, data);
-                       phytable++;
+                       rtl_writephy(tp, regno, data);
+                       index++;
+                       break;
+               case PHY_READCOUNT_EQ_SKIP:
+                       if (count == data)
+                               index += 2;
+                       else
+                               index += 1;
+                       break;
+               case PHY_COMP_EQ_SKIPN:
+                       if (predata == data)
+                               index += regno;
+                       index++;
+                       break;
+               case PHY_COMP_NEQ_SKIPN:
+                       if (predata != data)
+                               index += regno;
+                       index++;
+                       break;
+               case PHY_WRITE_PREVIOUS:
+                       rtl_writephy(tp, regno, predata);
+                       index++;
                        break;
+               case PHY_SKIPN:
+                       index += regno + 1;
+                       break;
+               case PHY_DELAY_MS:
+                       mdelay(data);
+                       index++;
+                       break;
+
+               case PHY_READ_MAC_BYTE:
+               case PHY_WRITE_MAC_BYTE:
+               case PHY_WRITE_ERI_WORD:
                default:
                        BUG();
                }
index 904dec7..a69554e 100644 (file)
@@ -24,6 +24,7 @@ struct bfin_mii_bus_platform_data {
        const unsigned short *mac_peripherals;
        int phy_mode;
        unsigned int phy_mask;
+       unsigned short vlan1_mask, vlan2_mask;
 };
 
 #endif
index f16a010..bec8b82 100644 (file)
@@ -48,8 +48,10 @@ extern int eth_validate_addr(struct net_device *dev);
 
 
 
-extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
+extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
+                                           unsigned int rxqs);
 #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
+#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
 
 /**
  * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
index de2bfe6..be4957c 100644 (file)
@@ -2191,11 +2191,15 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
 extern void            ether_setup(struct net_device *dev);
 
 /* Support for loadable net-drivers */
-extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
+extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
                                       void (*setup)(struct net_device *),
-                                      unsigned int queue_count);
+                                      unsigned int txqs, unsigned int rxqs);
 #define alloc_netdev(sizeof_priv, name, setup) \
-       alloc_netdev_mq(sizeof_priv, name, setup, 1)
+       alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
+
+#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
+       alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
+
 extern int             register_netdev(struct net_device *dev);
 extern void            unregister_netdev(struct net_device *dev);
 
index f0129f7..be7798d 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/skbuff.h>
 
 /* This is the maximum truncated ICV length that we know of. */
-#define MAX_AH_AUTH_LEN        12
+#define MAX_AH_AUTH_LEN        16
 
 struct crypto_ahash;
 
index f4cf6ce..91f0568 100644 (file)
@@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
                                  const unsigned char *src_hw,
                                  const unsigned char *target_hw);
 extern void arp_xmit(struct sk_buff *skb);
+int arp_invalidate(struct net_device *dev, __be32 ip);
 
 #endif /* _ARP_H */
index d5df797..5395e09 100644 (file)
@@ -107,8 +107,8 @@ struct phonet_protocol {
        int                     sock_type;
 };
 
-int phonet_proto_register(int protocol, struct phonet_protocol *pp);
-void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
+int phonet_proto_register(unsigned int protocol, struct phonet_protocol *pp);
+void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp);
 
 int phonet_sysctl_init(void);
 void phonet_sysctl_exit(void);
index 0af57eb..e9eee99 100644 (file)
@@ -207,7 +207,7 @@ static inline int qdisc_qlen(struct Qdisc *q)
        return q->q.qlen;
 }
 
-static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
+static inline struct qdisc_skb_cb *qdisc_skb_cb(const struct sk_buff *skb)
 {
        return (struct qdisc_skb_cb *)skb->cb;
 }
@@ -394,7 +394,7 @@ static inline bool qdisc_tx_is_noop(const struct net_device *dev)
        return true;
 }
 
-static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
+static inline unsigned int qdisc_pkt_len(const struct sk_buff *skb)
 {
        return qdisc_skb_cb(skb)->pkt_len;
 }
@@ -426,10 +426,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
        return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
 }
 
-static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
+
+static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
+                                const struct sk_buff *skb)
+{
+       bstats->bytes += qdisc_pkt_len(skb);
+       bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
+}
+
+static inline void qdisc_bstats_update(struct Qdisc *sch,
+                                      const struct sk_buff *skb)
 {
-       sch->bstats.bytes += len;
-       sch->bstats.packets++;
+       bstats_update(&sch->bstats, skb);
 }
 
 static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
@@ -437,7 +445,7 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
 {
        __skb_queue_tail(list, skb);
        sch->qstats.backlog += qdisc_pkt_len(skb);
-       __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
+       qdisc_bstats_update(sch, skb);
 
        return NET_XMIT_SUCCESS;
 }
index 1bf0cf5..8184c03 100644 (file)
@@ -740,12 +740,12 @@ static int setsockopt(struct socket *sock,
                if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL)
                        return -ENOPROTOOPT;
                lock_sock(&(cf_sk->sk));
-               cf_sk->conn_req.param.size = ol;
                if (ol > sizeof(cf_sk->conn_req.param.data) ||
                        copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) {
                        release_sock(&cf_sk->sk);
                        return -EINVAL;
                }
+               cf_sk->conn_req.param.size = ol;
                release_sock(&cf_sk->sk);
                return 0;
 
index 84a422c..fa9dab3 100644 (file)
@@ -76,6 +76,8 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
        struct chnl_net *priv  = container_of(layr, struct chnl_net, chnl);
        int pktlen;
        int err = 0;
+       const u8 *ip_version;
+       u8 buf;
 
        priv = container_of(layr, struct chnl_net, chnl);
 
@@ -90,7 +92,21 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
         * send the packet to the net stack.
         */
        skb->dev = priv->netdev;
-       skb->protocol = htons(ETH_P_IP);
+
+       /* check the version of IP */
+       ip_version = skb_header_pointer(skb, 0, 1, &buf);
+       if (!ip_version)
+               return -EINVAL;
+       switch (*ip_version >> 4) {
+       case 4:
+               skb->protocol = htons(ETH_P_IP);
+               break;
+       case 6:
+               skb->protocol = htons(ETH_P_IPV6);
+               break;
+       default:
+               return -EINVAL;
+       }
 
        /* If we change the header in loop mode, the checksum is corrupted. */
        if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP)
index 3fe443b..a3ef808 100644 (file)
@@ -2297,7 +2297,10 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
                 */
                if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE))
                        skb_dst_force(skb);
-               __qdisc_update_bstats(q, skb->len);
+
+               qdisc_skb_cb(skb)->pkt_len = skb->len;
+               qdisc_bstats_update(q, skb);
+
                if (sch_direct_xmit(skb, q, dev, txq, root_lock)) {
                        if (unlikely(contended)) {
                                spin_unlock(&q->busylock);
@@ -5617,18 +5620,20 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
 }
 
 /**
- *     alloc_netdev_mq - allocate network device
+ *     alloc_netdev_mqs - allocate network device
  *     @sizeof_priv:   size of private data to allocate space for
  *     @name:          device name format string
  *     @setup:         callback to initialize device
- *     @queue_count:   the number of subqueues to allocate
+ *     @txqs:          the number of TX subqueues to allocate
+ *     @rxqs:          the number of RX subqueues to allocate
  *
  *     Allocates a struct net_device with private data area for driver use
  *     and performs basic initialization.  Also allocates subquue structs
- *     for each queue on the device at the end of the netdevice.
+ *     for each queue on the device.
  */
-struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
-               void (*setup)(struct net_device *), unsigned int queue_count)
+struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
+               void (*setup)(struct net_device *),
+               unsigned int txqs, unsigned int rxqs)
 {
        struct net_device *dev;
        size_t alloc_size;
@@ -5636,12 +5641,20 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 
        BUG_ON(strlen(name) >= sizeof(dev->name));
 
-       if (queue_count < 1) {
+       if (txqs < 1) {
                pr_err("alloc_netdev: Unable to allocate device "
                       "with zero queues.\n");
                return NULL;
        }
 
+#ifdef CONFIG_RPS
+       if (rxqs < 1) {
+               pr_err("alloc_netdev: Unable to allocate device "
+                      "with zero RX queues.\n");
+               return NULL;
+       }
+#endif
+
        alloc_size = sizeof(struct net_device);
        if (sizeof_priv) {
                /* ensure 32-byte alignment of private area */
@@ -5672,14 +5685,14 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 
        dev_net_set(dev, &init_net);
 
-       dev->num_tx_queues = queue_count;
-       dev->real_num_tx_queues = queue_count;
+       dev->num_tx_queues = txqs;
+       dev->real_num_tx_queues = txqs;
        if (netif_alloc_netdev_queues(dev))
                goto free_pcpu;
 
 #ifdef CONFIG_RPS
-       dev->num_rx_queues = queue_count;
-       dev->real_num_rx_queues = queue_count;
+       dev->num_rx_queues = rxqs;
+       dev->real_num_rx_queues = rxqs;
        if (netif_alloc_rx_queues(dev))
                goto free_pcpu;
 #endif
@@ -5707,7 +5720,7 @@ free_p:
        kfree(p);
        return NULL;
 }
-EXPORT_SYMBOL(alloc_netdev_mq);
+EXPORT_SYMBOL(alloc_netdev_mqs);
 
 /**
  *     free_netdev - free network device
index f00ef2f..f9d7ac9 100644 (file)
@@ -347,10 +347,11 @@ void ether_setup(struct net_device *dev)
 EXPORT_SYMBOL(ether_setup);
 
 /**
- * alloc_etherdev_mq - Allocates and sets up an Ethernet device
+ * alloc_etherdev_mqs - Allocates and sets up an Ethernet device
  * @sizeof_priv: Size of additional driver-private structure to be allocated
  *     for this Ethernet device
- * @queue_count: The number of queues this device has.
+ * @txqs: The number of TX queues this device has.
+ * @txqs: The number of RX queues this device has.
  *
  * Fill in the fields of the device structure with Ethernet-generic
  * values. Basically does everything except registering the device.
@@ -360,11 +361,12 @@ EXPORT_SYMBOL(ether_setup);
  * this private data area.
  */
 
-struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count)
+struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
+                                     unsigned int rxqs)
 {
-       return alloc_netdev_mq(sizeof_priv, "eth%d", ether_setup, queue_count);
+       return alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs);
 }
-EXPORT_SYMBOL(alloc_etherdev_mq);
+EXPORT_SYMBOL(alloc_etherdev_mqs);
 
 static size_t _format_mac_addr(char *buf, int buflen,
                               const unsigned char *addr, int len)
index 880a5ec..86961be 100644 (file)
@@ -314,14 +314,15 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
 
        skb->ip_summed = CHECKSUM_NONE;
 
-       ah = (struct ip_auth_hdr *)skb->data;
-       iph = ip_hdr(skb);
-       ihl = ip_hdrlen(skb);
 
        if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
                goto out;
        nfrags = err;
 
+       ah = (struct ip_auth_hdr *)skb->data;
+       iph = ip_hdr(skb);
+       ihl = ip_hdrlen(skb);
+
        work_iph = ah_alloc_tmp(ahash, nfrags, ihl + ahp->icv_trunc_len);
        if (!work_iph)
                goto out;
index a2fc7b9..04c8b69 100644 (file)
@@ -1143,6 +1143,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
        return err;
 }
 
+int arp_invalidate(struct net_device *dev, __be32 ip)
+{
+       struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev);
+       int err = -ENXIO;
+
+       if (neigh) {
+               if (neigh->nud_state & ~NUD_NOARP)
+                       err = neigh_update(neigh, NULL, NUD_FAILED,
+                                          NEIGH_UPDATE_F_OVERRIDE|
+                                          NEIGH_UPDATE_F_ADMIN);
+               neigh_release(neigh);
+       }
+
+       return err;
+}
+EXPORT_SYMBOL(arp_invalidate);
+
 static int arp_req_delete_public(struct net *net, struct arpreq *r,
                struct net_device *dev)
 {
@@ -1163,7 +1180,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
 {
        int err;
        __be32 ip;
-       struct neighbour *neigh;
 
        if (r->arp_flags & ATF_PUBL)
                return arp_req_delete_public(net, r, dev);
@@ -1181,16 +1197,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
                if (!dev)
                        return -EINVAL;
        }
-       err = -ENXIO;
-       neigh = neigh_lookup(&arp_tbl, &ip, dev);
-       if (neigh) {
-               if (neigh->nud_state & ~NUD_NOARP)
-                       err = neigh_update(neigh, NULL, NUD_FAILED,
-                                          NEIGH_UPDATE_F_OVERRIDE|
-                                          NEIGH_UPDATE_F_ADMIN);
-               neigh_release(neigh);
-       }
-       return err;
+       return arp_invalidate(dev, ip);
 }
 
 /*
index 25e3181..97e5fb7 100644 (file)
@@ -73,7 +73,7 @@ int inet_csk_bind_conflict(const struct sock *sk,
                     !sk2->sk_bound_dev_if ||
                     sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
                        if (!reuse || !sk2->sk_reuse ||
-                           sk2->sk_state == TCP_LISTEN) {
+                           ((1 << sk2->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))) {
                                const __be32 sk2_rcv_saddr = sk_rcv_saddr(sk2);
                                if (!sk2_rcv_saddr || !sk_rcv_saddr(sk) ||
                                    sk2_rcv_saddr == sk_rcv_saddr(sk))
@@ -122,7 +122,8 @@ again:
                                            (tb->num_owners < smallest_size || smallest_size == -1)) {
                                                smallest_size = tb->num_owners;
                                                smallest_rover = rover;
-                                               if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
+                                               if (atomic_read(&hashinfo->bsockets) > (high - low) + 1 &&
+                                                   !inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
                                                        spin_unlock(&head->lock);
                                                        snum = smallest_rover;
                                                        goto have_snum;
index ee82d4e..1aba54a 100644 (file)
@@ -538,14 +538,16 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
        if (!pskb_may_pull(skb, ah_hlen))
                goto out;
 
-       ip6h = ipv6_hdr(skb);
-
-       skb_push(skb, hdr_len);
 
        if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
                goto out;
        nfrags = err;
 
+       ah = (struct ip_auth_hdr *)skb->data;
+       ip6h = ipv6_hdr(skb);
+
+       skb_push(skb, hdr_len);
+
        work_iph = ah_alloc_tmp(ahash, nfrags, hdr_len + ahp->icv_trunc_len);
        if (!work_iph)
                goto out;
index e46305d..d144e62 100644 (file)
@@ -44,7 +44,7 @@ int inet6_csk_bind_conflict(const struct sock *sk,
                     !sk2->sk_bound_dev_if ||
                     sk->sk_bound_dev_if == sk2->sk_bound_dev_if) &&
                    (!sk->sk_reuse || !sk2->sk_reuse ||
-                    sk2->sk_state == TCP_LISTEN) &&
+                    ((1 << sk2->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))) &&
                     ipv6_rcv_saddr_equal(sk, sk2))
                        break;
        }
index fd95beb..1072b2c 100644 (file)
@@ -37,7 +37,7 @@
 /* Transport protocol registration */
 static struct phonet_protocol *proto_tab[PHONET_NPROTO] __read_mostly;
 
-static struct phonet_protocol *phonet_proto_get(int protocol)
+static struct phonet_protocol *phonet_proto_get(unsigned int protocol)
 {
        struct phonet_protocol *pp;
 
@@ -458,7 +458,7 @@ static struct packet_type phonet_packet_type __read_mostly = {
 
 static DEFINE_MUTEX(proto_tab_lock);
 
-int __init_or_module phonet_proto_register(int protocol,
+int __init_or_module phonet_proto_register(unsigned int protocol,
                                                struct phonet_protocol *pp)
 {
        int err = 0;
@@ -481,7 +481,7 @@ int __init_or_module phonet_proto_register(int protocol,
 }
 EXPORT_SYMBOL(phonet_proto_register);
 
-void phonet_proto_unregister(int protocol, struct phonet_protocol *pp)
+void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp)
 {
        mutex_lock(&proto_tab_lock);
        BUG_ON(proto_tab[protocol] != pp);
index 67dc7ce..83ddfc0 100644 (file)
@@ -508,8 +508,7 @@ static int tcf_csum(struct sk_buff *skb,
 
        spin_lock(&p->tcf_lock);
        p->tcf_tm.lastuse = jiffies;
-       p->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       p->tcf_bstats.packets++;
+       bstats_update(&p->tcf_bstats, skb);
        action = p->tcf_action;
        update_flags = p->update_flags;
        spin_unlock(&p->tcf_lock);
index 8daef96..c2a7c20 100644 (file)
@@ -209,8 +209,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a,
        spin_lock(&ipt->tcf_lock);
 
        ipt->tcf_tm.lastuse = jiffies;
-       ipt->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       ipt->tcf_bstats.packets++;
+       bstats_update(&ipt->tcf_bstats, skb);
 
        /* yes, we have to worry about both in and out dev
         worry later - danger - this API seems to have changed
index 0c311be..d765067 100644 (file)
@@ -165,8 +165,7 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
 
        spin_lock(&m->tcf_lock);
        m->tcf_tm.lastuse = jiffies;
-       m->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       m->tcf_bstats.packets++;
+       bstats_update(&m->tcf_bstats, skb);
 
        dev = m->tcfm_dev;
        if (!dev) {
index 186eb83..178a4bd 100644 (file)
@@ -125,8 +125,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
        egress = p->flags & TCA_NAT_FLAG_EGRESS;
        action = p->tcf_action;
 
-       p->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       p->tcf_bstats.packets++;
+       bstats_update(&p->tcf_bstats, skb);
 
        spin_unlock(&p->tcf_lock);
 
index a0593c9..445bef7 100644 (file)
@@ -187,8 +187,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
 bad:
        p->tcf_qstats.overlimits++;
 done:
-       p->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       p->tcf_bstats.packets++;
+       bstats_update(&p->tcf_bstats, skb);
        spin_unlock(&p->tcf_lock);
        return p->tcf_action;
 }
index 7ebf743..e2f08b1 100644 (file)
@@ -298,8 +298,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
 
        spin_lock(&police->tcf_lock);
 
-       police->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       police->tcf_bstats.packets++;
+       bstats_update(&police->tcf_bstats, skb);
 
        if (police->tcfp_ewma_rate &&
            police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
index 97e84f3..7287cff 100644 (file)
@@ -42,8 +42,7 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result
 
        spin_lock(&d->tcf_lock);
        d->tcf_tm.lastuse = jiffies;
-       d->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       d->tcf_bstats.packets++;
+       bstats_update(&d->tcf_bstats, skb);
 
        /* print policy string followed by _ then packet count
         * Example if this was the 3rd packet and the string was "hello"
index 66cbf4e..836f5fe 100644 (file)
@@ -46,8 +46,7 @@ static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a,
 
        spin_lock(&d->tcf_lock);
        d->tcf_tm.lastuse = jiffies;
-       d->tcf_bstats.bytes += qdisc_pkt_len(skb);
-       d->tcf_bstats.packets++;
+       bstats_update(&d->tcf_bstats, skb);
 
        if (d->flags & SKBEDIT_F_PRIORITY)
                skb->priority = d->priority;
index 2825407..943d733 100644 (file)
@@ -422,10 +422,8 @@ drop: __maybe_unused
                }
                return ret;
        }
-       sch->bstats.bytes += qdisc_pkt_len(skb);
-       sch->bstats.packets++;
-       flow->bstats.bytes += qdisc_pkt_len(skb);
-       flow->bstats.packets++;
+       qdisc_bstats_update(sch, skb);
+       bstats_update(&flow->bstats, skb);
        /*
         * Okay, this may seem weird. We pretend we've dropped the packet if
         * it goes via ATM. The reason for this is that the outer qdisc
index eb76315..c80d1c2 100644 (file)
@@ -390,8 +390,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        ret = qdisc_enqueue(skb, cl->q);
        if (ret == NET_XMIT_SUCCESS) {
                sch->q.qlen++;
-               sch->bstats.packets++;
-               sch->bstats.bytes += qdisc_pkt_len(skb);
+               qdisc_bstats_update(sch, skb);
                cbq_mark_toplevel(q, cl);
                if (!cl->next_alive)
                        cbq_activate_class(cl);
@@ -650,8 +649,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
                ret = qdisc_enqueue(skb, cl->q);
                if (ret == NET_XMIT_SUCCESS) {
                        sch->q.qlen++;
-                       sch->bstats.packets++;
-                       sch->bstats.bytes += qdisc_pkt_len(skb);
+                       qdisc_bstats_update(sch, skb);
                        if (!cl->next_alive)
                                cbq_activate_class(cl);
                        return 0;
index aa8b531..de55e64 100644 (file)
@@ -351,7 +351,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
        struct drr_sched *q = qdisc_priv(sch);
        struct drr_class *cl;
-       unsigned int len;
        int err;
 
        cl = drr_classify(skb, sch, &err);
@@ -362,7 +361,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                return err;
        }
 
-       len = qdisc_pkt_len(skb);
        err = qdisc_enqueue(skb, cl->qdisc);
        if (unlikely(err != NET_XMIT_SUCCESS)) {
                if (net_xmit_drop_count(err)) {
@@ -377,10 +375,8 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                cl->deficit = cl->quantum;
        }
 
-       cl->bstats.packets++;
-       cl->bstats.bytes += len;
-       sch->bstats.packets++;
-       sch->bstats.bytes += len;
+       bstats_update(&cl->bstats, skb);
+       qdisc_bstats_update(sch, skb);
 
        sch->q.qlen++;
        return err;
index 1d295d6..60f4bdd 100644 (file)
@@ -260,8 +260,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                return err;
        }
 
-       sch->bstats.bytes += qdisc_pkt_len(skb);
-       sch->bstats.packets++;
+       qdisc_bstats_update(sch, skb);
        sch->q.qlen++;
 
        return NET_XMIT_SUCCESS;
index 069c62b..2e45791 100644 (file)
@@ -1599,10 +1599,8 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        if (cl->qdisc->q.qlen == 1)
                set_active(cl, qdisc_pkt_len(skb));
 
-       cl->bstats.packets++;
-       cl->bstats.bytes += qdisc_pkt_len(skb);
-       sch->bstats.packets++;
-       sch->bstats.bytes += qdisc_pkt_len(skb);
+       bstats_update(&cl->bstats, skb);
+       qdisc_bstats_update(sch, skb);
        sch->q.qlen++;
 
        return NET_XMIT_SUCCESS;
index 01b519d..984c1b0 100644 (file)
@@ -569,15 +569,12 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                }
                return ret;
        } else {
-               cl->bstats.packets +=
-                       skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
-               cl->bstats.bytes += qdisc_pkt_len(skb);
+               bstats_update(&cl->bstats, skb);
                htb_activate(q, cl);
        }
 
        sch->q.qlen++;
-       sch->bstats.packets += skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
-       sch->bstats.bytes += qdisc_pkt_len(skb);
+       qdisc_bstats_update(sch, skb);
        return NET_XMIT_SUCCESS;
 }
 
@@ -648,12 +645,10 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
                                htb_add_to_wait_tree(q, cl, diff);
                }
 
-               /* update byte stats except for leaves which are already updated */
-               if (cl->level) {
-                       cl->bstats.bytes += bytes;
-                       cl->bstats.packets += skb_is_gso(skb)?
-                                       skb_shinfo(skb)->gso_segs:1;
-               }
+               /* update basic stats except for leaves which are already updated */
+               if (cl->level)
+                       bstats_update(&cl->bstats, skb);
+
                cl = cl->parent;
        }
 }
index f10e34a..bce1665 100644 (file)
@@ -63,8 +63,7 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        result = tc_classify(skb, p->filter_list, &res);
 
-       sch->bstats.packets++;
-       sch->bstats.bytes += qdisc_pkt_len(skb);
+       qdisc_bstats_update(sch, skb);
        switch (result) {
        case TC_ACT_SHOT:
                result = TC_ACT_SHOT;
index 32690de..21f13da 100644 (file)
@@ -83,8 +83,7 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        ret = qdisc_enqueue(skb, qdisc);
        if (ret == NET_XMIT_SUCCESS) {
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
                sch->q.qlen++;
                return NET_XMIT_SUCCESS;
        }
index e5593c0..1c4bce8 100644 (file)
@@ -240,8 +240,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        if (likely(ret == NET_XMIT_SUCCESS)) {
                sch->q.qlen++;
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
        } else if (net_xmit_drop_count(ret)) {
                sch->qstats.drops++;
        }
@@ -477,8 +476,7 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
                __skb_queue_after(list, skb, nskb);
 
                sch->qstats.backlog += qdisc_pkt_len(nskb);
-               sch->bstats.bytes += qdisc_pkt_len(nskb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, nskb);
 
                return NET_XMIT_SUCCESS;
        }
index b1c95bc..966158d 100644 (file)
@@ -84,8 +84,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        ret = qdisc_enqueue(skb, qdisc);
        if (ret == NET_XMIT_SUCCESS) {
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
                sch->q.qlen++;
                return NET_XMIT_SUCCESS;
        }
index a67ba3c..a6009c5 100644 (file)
@@ -94,8 +94,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
        ret = qdisc_enqueue(skb, child);
        if (likely(ret == NET_XMIT_SUCCESS)) {
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
                sch->q.qlen++;
        } else if (net_xmit_drop_count(ret)) {
                q->stats.pdrop++;
index d54ac94..239ec53 100644 (file)
@@ -403,8 +403,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                slot->allot = q->scaled_quantum;
        }
        if (++sch->q.qlen <= q->limit) {
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
                return NET_XMIT_SUCCESS;
        }
 
index 641a30d..77565e7 100644 (file)
@@ -134,8 +134,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
        }
 
        sch->q.qlen++;
-       sch->bstats.bytes += qdisc_pkt_len(skb);
-       sch->bstats.packets++;
+       qdisc_bstats_update(sch, skb);
        return NET_XMIT_SUCCESS;
 }
 
index 106479a..af9360d 100644 (file)
@@ -83,8 +83,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
        if (q->q.qlen < dev->tx_queue_len) {
                __skb_queue_tail(&q->q, skb);
-               sch->bstats.bytes += qdisc_pkt_len(skb);
-               sch->bstats.packets++;
+               qdisc_bstats_update(sch, skb);
                return NET_XMIT_SUCCESS;
        }
 
index 6a8da81..d5e1e0b 100644 (file)
@@ -26,6 +26,7 @@
 #include <net/sock.h>
 #include <net/xfrm.h>
 #include <net/netlink.h>
+#include <net/ah.h>
 #include <asm/uaccess.h>
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 #include <linux/in6.h>
@@ -302,7 +303,8 @@ static int attach_auth_trunc(struct xfrm_algo_auth **algpp, u8 *props,
        algo = xfrm_aalg_get_byname(ualg->alg_name, 1);
        if (!algo)
                return -ENOSYS;
-       if (ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits)
+       if ((ualg->alg_trunc_len / 8) > MAX_AH_AUTH_LEN ||
+           ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits)
                return -EINVAL;
        *props = algo->desc.sadb_alg_id;