Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
authorDavid S. Miller <davem@davemloft.net>
Tue, 9 Oct 2012 17:14:32 +0000 (13:14 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Oct 2012 17:14:32 +0000 (13:14 -0400)
Pulled mainline in order to get the UAPI infrastructure already
merged before I pull in David Howells's UAPI trees for networking.

Signed-off-by: David S. Miller <davem@davemloft.net>
60 files changed:
drivers/infiniband/core/cma.c
drivers/infiniband/core/netlink.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/calxeda/xgmac.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/dec/tulip/dmfe.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/gianfar.h
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/freescale/ucc_geth.h
drivers/net/ethernet/intel/e1000e/hw.h
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/ixgbe/ixgbe.h
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
drivers/net/ethernet/marvell/mv643xx_eth.c
drivers/net/ethernet/marvell/skge.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/natsemi/natsemi.c
drivers/net/ethernet/natsemi/xtsonic.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
drivers/net/ethernet/realtek/8139cp.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/sfc/ptp.c
drivers/net/ethernet/sis/sis900.c
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/sun/niu.c
drivers/net/ethernet/sun/sungem.c
drivers/net/irda/irtty-sir.c
drivers/net/irda/mcs7780.c
drivers/net/irda/pxaficp_ir.c
drivers/net/irda/sa1100_ir.c
drivers/net/irda/sh_irda.c
drivers/net/irda/sh_sir.c
drivers/net/vxlan.c
include/linux/if_vlan.h
include/linux/netdevice.h
include/linux/netlink.h
include/linux/skbuff.h
include/net/flow.h
include/net/route.h
include/rdma/rdma_netlink.h
net/8021q/vlan_core.c
net/core/dev.c
net/core/neighbour.c
net/core/skbuff.c
net/ipv4/fib_frontend.c
net/ipv4/fib_semantics.c
net/ipv4/inet_connection_sock.c
net/ipv4/ip_forward.c
net/ipv4/ip_output.c
net/ipv4/route.c
net/ipv4/xfrm4_policy.c
net/ipv6/af_inet6.c
net/netfilter/ipvs/ip_vs_xmit.c
net/netlink/af_netlink.c

index 1983adc192432936e67b3ab128627596604b6f2d..a7568c34a1aa624c505f2a7a8d0235e9f2ccd21f 100644 (file)
@@ -3498,7 +3498,8 @@ out:
 }
 
 static const struct ibnl_client_cbs cma_cb_table[] = {
-       [RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats },
+       [RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats,
+                                      .module = THIS_MODULE },
 };
 
 static int __init cma_init(void)
index fe10a949aef9b6bd0533da3c4886933ee4a2091f..da06abde9e0d557ae1536f1995cd1a84af6ab219 100644 (file)
@@ -154,6 +154,7 @@ static int ibnl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                        {
                                struct netlink_dump_control c = {
                                        .dump = client->cb_table[op].dump,
+                                       .module = client->cb_table[op].module,
                                };
                                return netlink_dump_start(nls, skb, nlh, &c);
                        }
index 64d0d9c1afa271c9ae73cb1818cdb6b7318d36f4..3491d4312fc9252639a082f7897643a2ee6f3c0a 100644 (file)
@@ -1845,6 +1845,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
        if((pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM))==0){
                printk(KERN_ERR "amd8111e: No Power Management capability, "
                       "exiting.\n");
+               err = -ENODEV;
                goto err_free_reg;
        }
 
@@ -1852,6 +1853,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
        if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) {
                printk(KERN_ERR "amd8111e: DMA not supported,"
                        "exiting.\n");
+               err = -ENODEV;
                goto err_free_reg;
        }
 
index 397596b078d9415d7b3431f78b140542da88e2be..f195acfa2df7dc4efcc5368173be475e6cd5b72f 100644 (file)
@@ -1174,8 +1174,10 @@ static int __devinit au1000_probe(struct platform_device *pdev)
        snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
                pdev->name, aup->mac_id);
        aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
-       if (aup->mii_bus->irq == NULL)
+       if (aup->mii_bus->irq == NULL) {
+               err = -ENOMEM;
                goto err_out;
+       }
 
        for (i = 0; i < PHY_MAX_ADDR; ++i)
                aup->mii_bus->irq[i] = PHY_POLL;
@@ -1190,7 +1192,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
                goto err_mdiobus_reg;
        }
 
-       if (au1000_mii_probe(dev) != 0)
+       err = au1000_mii_probe(dev);
+       if (err != 0)
                goto err_out;
 
        pDBfree = NULL;
@@ -1205,6 +1208,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
        }
        aup->pDBfree = pDBfree;
 
+       err = -ENODEV;
        for (i = 0; i < NUM_RX_DMA; i++) {
                pDB = au1000_GetFreeDB(aup);
                if (!pDB)
@@ -1213,6 +1217,8 @@ static int __devinit au1000_probe(struct platform_device *pdev)
                aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
                aup->rx_db_inuse[i] = pDB;
        }
+
+       err = -ENODEV;
        for (i = 0; i < NUM_TX_DMA; i++) {
                pDB = au1000_GetFreeDB(aup);
                if (!pDB)
index 2b4b4f529ab4db6627f558ff16f0059d216f7ddb..16814b34d4b66ae8a39414a14e2bec0a72f89029 100644 (file)
@@ -375,7 +375,6 @@ struct xgmac_priv {
        unsigned int tx_tail;
 
        void __iomem *base;
-       struct sk_buff_head rx_recycle;
        unsigned int dma_buf_sz;
        dma_addr_t dma_rx_phy;
        dma_addr_t dma_tx_phy;
@@ -672,9 +671,7 @@ static void xgmac_rx_refill(struct xgmac_priv *priv)
                p = priv->dma_rx + entry;
 
                if (priv->rx_skbuff[entry] == NULL) {
-                       skb = __skb_dequeue(&priv->rx_recycle);
-                       if (skb == NULL)
-                               skb = netdev_alloc_skb(priv->dev, priv->dma_buf_sz);
+                       skb = netdev_alloc_skb(priv->dev, priv->dma_buf_sz);
                        if (unlikely(skb == NULL))
                                break;
 
@@ -887,17 +884,7 @@ static void xgmac_tx_complete(struct xgmac_priv *priv)
                                       desc_get_buf_len(p), DMA_TO_DEVICE);
                }
 
-               /*
-                * If there's room in the queue (limit it to size)
-                * we add this skb back into the pool,
-                * if it's the right size.
-                */
-               if ((skb_queue_len(&priv->rx_recycle) <
-                       DMA_RX_RING_SZ) &&
-                       skb_recycle_check(skb, priv->dma_buf_sz))
-                       __skb_queue_head(&priv->rx_recycle, skb);
-               else
-                       dev_kfree_skb(skb);
+               dev_kfree_skb(skb);
        }
 
        if (dma_ring_space(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ) >
@@ -1016,7 +1003,6 @@ static int xgmac_open(struct net_device *dev)
                        dev->dev_addr);
        }
 
-       skb_queue_head_init(&priv->rx_recycle);
        memset(&priv->xstats, 0, sizeof(struct xgmac_extra_stats));
 
        /* Initialize the XGMAC and descriptors */
@@ -1053,7 +1039,6 @@ static int xgmac_stop(struct net_device *dev)
                napi_disable(&priv->napi);
 
        writel(0, priv->base + XGMAC_DMA_INTR_ENA);
-       skb_queue_purge(&priv->rx_recycle);
 
        /* Disable the MAC core */
        xgmac_mac_disable(priv->base);
index 31752b24434eaafc348665be8b2be6104bb5c018..a4da893ac1e15cfd02a2d071503afaa21838e51c 100644 (file)
@@ -696,6 +696,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable);
 int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
 int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
 unsigned int t4_flash_cfg_addr(struct adapter *adapter);
+int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size);
 int t4_check_fw_version(struct adapter *adapter);
 int t4_prep_adapter(struct adapter *adapter);
 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
index 6b9f6bb2f7edb9e505c69f8ce40507b2093df131..604f4f87f550c879a087fd128892d97450aa2d19 100644 (file)
@@ -443,7 +443,10 @@ int dbfifo_int_thresh = 10; /* 10 == 640 entry threshold */
 module_param(dbfifo_int_thresh, int, 0644);
 MODULE_PARM_DESC(dbfifo_int_thresh, "doorbell fifo interrupt threshold");
 
-int dbfifo_drain_delay = 1000; /* usecs to sleep while draining the dbfifo */
+/*
+ * usecs to sleep while draining the dbfifo
+ */
+static int dbfifo_drain_delay = 1000;
 module_param(dbfifo_drain_delay, int, 0644);
 MODULE_PARM_DESC(dbfifo_drain_delay,
                 "usecs to sleep while draining the dbfifo");
@@ -636,7 +639,7 @@ static void name_msix_vecs(struct adapter *adap)
 static int request_msix_queue_irqs(struct adapter *adap)
 {
        struct sge *s = &adap->sge;
-       int err, ethqidx, ofldqidx = 0, rdmaqidx = 0, msi = 2;
+       int err, ethqidx, ofldqidx = 0, rdmaqidx = 0, msi_index = 2;
 
        err = request_irq(adap->msix_info[1].vec, t4_sge_intr_msix, 0,
                          adap->msix_info[1].desc, &s->fw_evtq);
@@ -644,56 +647,60 @@ static int request_msix_queue_irqs(struct adapter *adap)
                return err;
 
        for_each_ethrxq(s, ethqidx) {
-               err = request_irq(adap->msix_info[msi].vec, t4_sge_intr_msix, 0,
-                                 adap->msix_info[msi].desc,
+               err = request_irq(adap->msix_info[msi_index].vec,
+                                 t4_sge_intr_msix, 0,
+                                 adap->msix_info[msi_index].desc,
                                  &s->ethrxq[ethqidx].rspq);
                if (err)
                        goto unwind;
-               msi++;
+               msi_index++;
        }
        for_each_ofldrxq(s, ofldqidx) {
-               err = request_irq(adap->msix_info[msi].vec, t4_sge_intr_msix, 0,
-                                 adap->msix_info[msi].desc,
+               err = request_irq(adap->msix_info[msi_index].vec,
+                                 t4_sge_intr_msix, 0,
+                                 adap->msix_info[msi_index].desc,
                                  &s->ofldrxq[ofldqidx].rspq);
                if (err)
                        goto unwind;
-               msi++;
+               msi_index++;
        }
        for_each_rdmarxq(s, rdmaqidx) {
-               err = request_irq(adap->msix_info[msi].vec, t4_sge_intr_msix, 0,
-                                 adap->msix_info[msi].desc,
+               err = request_irq(adap->msix_info[msi_index].vec,
+                                 t4_sge_intr_msix, 0,
+                                 adap->msix_info[msi_index].desc,
                                  &s->rdmarxq[rdmaqidx].rspq);
                if (err)
                        goto unwind;
-               msi++;
+               msi_index++;
        }
        return 0;
 
 unwind:
        while (--rdmaqidx >= 0)
-               free_irq(adap->msix_info[--msi].vec,
+               free_irq(adap->msix_info[--msi_index].vec,
                         &s->rdmarxq[rdmaqidx].rspq);
        while (--ofldqidx >= 0)
-               free_irq(adap->msix_info[--msi].vec,
+               free_irq(adap->msix_info[--msi_index].vec,
                         &s->ofldrxq[ofldqidx].rspq);
        while (--ethqidx >= 0)
-               free_irq(adap->msix_info[--msi].vec, &s->ethrxq[ethqidx].rspq);
+               free_irq(adap->msix_info[--msi_index].vec,
+                        &s->ethrxq[ethqidx].rspq);
        free_irq(adap->msix_info[1].vec, &s->fw_evtq);
        return err;
 }
 
 static void free_msix_queue_irqs(struct adapter *adap)
 {
-       int i, msi = 2;
+       int i, msi_index = 2;
        struct sge *s = &adap->sge;
 
        free_irq(adap->msix_info[1].vec, &s->fw_evtq);
        for_each_ethrxq(s, i)
-               free_irq(adap->msix_info[msi++].vec, &s->ethrxq[i].rspq);
+               free_irq(adap->msix_info[msi_index++].vec, &s->ethrxq[i].rspq);
        for_each_ofldrxq(s, i)
-               free_irq(adap->msix_info[msi++].vec, &s->ofldrxq[i].rspq);
+               free_irq(adap->msix_info[msi_index++].vec, &s->ofldrxq[i].rspq);
        for_each_rdmarxq(s, i)
-               free_irq(adap->msix_info[msi++].vec, &s->rdmarxq[i].rspq);
+               free_irq(adap->msix_info[msi_index++].vec, &s->rdmarxq[i].rspq);
 }
 
 /**
@@ -2535,9 +2542,8 @@ static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx)
 
        ret = t4_mem_win_read_len(adap, addr, (__be32 *)&indices, 8);
        if (!ret) {
-               indices = be64_to_cpu(indices);
-               *cidx = (indices >> 25) & 0xffff;
-               *pidx = (indices >> 9) & 0xffff;
+               *cidx = (be64_to_cpu(indices) >> 25) & 0xffff;
+               *pidx = (be64_to_cpu(indices) >> 9) & 0xffff;
        }
        return ret;
 }
@@ -3634,10 +3640,10 @@ static int adap_init0_no_config(struct adapter *adapter, int reset)
         * field selections will fit in the 36-bit budget.
         */
        if (tp_vlan_pri_map != TP_VLAN_PRI_MAP_DEFAULT) {
-               int i, bits = 0;
+               int j, bits = 0;
 
-               for (i = TP_VLAN_PRI_MAP_FIRST; i <= TP_VLAN_PRI_MAP_LAST; i++)
-                       switch (tp_vlan_pri_map & (1 << i)) {
+               for (j = TP_VLAN_PRI_MAP_FIRST; j <= TP_VLAN_PRI_MAP_LAST; j++)
+                       switch (tp_vlan_pri_map & (1 << j)) {
                        case 0:
                                /* compressed filter field not enabled */
                                break;
index 137a24438d9c76532d691158913a9066d38146f0..32eec15fe4c2cd8425f89661231797e96007c5b1 100644 (file)
@@ -380,9 +380,11 @@ static int t4_mem_win_rw(struct adapter *adap, u32 addr, __be32 *data, int dir)
        /* Collecting data 4 bytes at a time upto MEMWIN0_APERTURE */
        for (i = 0; i < MEMWIN0_APERTURE; i = i+0x4) {
                if (dir)
-                       *data++ = t4_read_reg(adap, (MEMWIN0_BASE + i));
+                       *data++ = (__force __be32) t4_read_reg(adap,
+                                                       (MEMWIN0_BASE + i));
                else
-                       t4_write_reg(adap, (MEMWIN0_BASE + i), *data++);
+                       t4_write_reg(adap, (MEMWIN0_BASE + i),
+                                    (__force u32) *data++);
        }
 
        return 0;
@@ -417,7 +419,7 @@ static int t4_memory_rw(struct adapter *adap, int mtype, u32 addr, u32 len,
        if ((addr & 0x3) || (len & 0x3))
                return -EINVAL;
 
-       data = vmalloc(MEMWIN0_APERTURE/sizeof(__be32));
+       data = vmalloc(MEMWIN0_APERTURE);
        if (!data)
                return -ENOMEM;
 
@@ -744,7 +746,7 @@ static int t4_read_flash(struct adapter *adapter, unsigned int addr,
                if (ret)
                        return ret;
                if (byte_oriented)
-                       *data = htonl(*data);
+                       *data = (__force __u32) (htonl(*data));
        }
        return 0;
 }
@@ -992,7 +994,7 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size)
        int ret, addr;
        unsigned int i;
        u8 first_page[SF_PAGE_SIZE];
-       const u32 *p = (const u32 *)fw_data;
+       const __be32 *p = (const __be32 *)fw_data;
        const struct fw_hdr *hdr = (const struct fw_hdr *)fw_data;
        unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec;
        unsigned int fw_img_start = adap->params.sf_fw_start;
@@ -2315,7 +2317,8 @@ int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len)
        t4_read_reg(adap, PCIE_MEM_ACCESS_OFFSET);
 
        for (i = 0; i < len; i += 4)
-               *data++ = t4_read_reg(adap, (MEMWIN0_BASE + off + i));
+               *data++ = (__force __be32) t4_read_reg(adap,
+                                               (MEMWIN0_BASE + off + i));
 
        return 0;
 }
index 4d6fe604fa64b920d58b05f3989a365355f951c3..d23755ea9bc79c68b793af65c824dfd6477ddb78 100644 (file)
@@ -446,13 +446,17 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
        /* Allocate Tx/Rx descriptor memory */
        db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) *
                        DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
-       if (!db->desc_pool_ptr)
+       if (!db->desc_pool_ptr) {
+               err = -ENOMEM;
                goto err_out_res;
+       }
 
        db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC *
                        TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
-       if (!db->buf_pool_ptr)
+       if (!db->buf_pool_ptr) {
+               err = -ENOMEM;
                goto err_out_free_desc;
+       }
 
        db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
        db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -462,8 +466,10 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
        db->chip_id = ent->driver_data;
        /* IO type range. */
        db->ioaddr = pci_iomap(pdev, 0, 0);
-       if (!db->ioaddr)
+       if (!db->ioaddr) {
+               err = -ENOMEM;
                goto err_out_free_buf;
+       }
 
        db->chip_revision = pdev->revision;
        db->wol_mode = 0;
index a1b52ec3b930981e240cad7ba4d3522936ed2eab..1d03dcdd5e5686bb6e76cb71069607a44d8d4eb2 100644 (file)
@@ -1765,7 +1765,6 @@ static void free_skb_resources(struct gfar_private *priv)
                          sizeof(struct rxbd8) * priv->total_rx_ring_size,
                          priv->tx_queue[0]->tx_bd_base,
                          priv->tx_queue[0]->tx_bd_dma_base);
-       skb_queue_purge(&priv->rx_recycle);
 }
 
 void gfar_start(struct net_device *dev)
@@ -1943,8 +1942,6 @@ static int gfar_enet_open(struct net_device *dev)
 
        enable_napi(priv);
 
-       skb_queue_head_init(&priv->rx_recycle);
-
        /* Initialize a bunch of registers */
        init_registers(dev);
 
@@ -2533,16 +2530,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 
                bytes_sent += skb->len;
 
-               /* If there's room in the queue (limit it to rx_buffer_size)
-                * we add this skb back into the pool, if it's the right size
-                */
-               if (skb_queue_len(&priv->rx_recycle) < rx_queue->rx_ring_size &&
-                   skb_recycle_check(skb, priv->rx_buffer_size +
-                                     RXBUF_ALIGNMENT)) {
-                       gfar_align_skb(skb);
-                       skb_queue_head(&priv->rx_recycle, skb);
-               } else
-                       dev_kfree_skb_any(skb);
+               dev_kfree_skb_any(skb);
 
                tx_queue->tx_skbuff[skb_dirtytx] = NULL;
 
@@ -2608,7 +2596,7 @@ static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
 static struct sk_buff *gfar_alloc_skb(struct net_device *dev)
 {
        struct gfar_private *priv = netdev_priv(dev);
-       struct sk_buff *skb = NULL;
+       struct sk_buff *skb;
 
        skb = netdev_alloc_skb(dev, priv->rx_buffer_size + RXBUF_ALIGNMENT);
        if (!skb)
@@ -2621,14 +2609,7 @@ static struct sk_buff *gfar_alloc_skb(struct net_device *dev)
 
 struct sk_buff *gfar_new_skb(struct net_device *dev)
 {
-       struct gfar_private *priv = netdev_priv(dev);
-       struct sk_buff *skb = NULL;
-
-       skb = skb_dequeue(&priv->rx_recycle);
-       if (!skb)
-               skb = gfar_alloc_skb(dev);
-
-       return skb;
+       return gfar_alloc_skb(dev);
 }
 
 static inline void count_errors(unsigned short status, struct net_device *dev)
@@ -2787,7 +2768,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
                        if (unlikely(!newskb))
                                newskb = skb;
                        else if (skb)
-                               skb_queue_head(&priv->rx_recycle, skb);
+                               dev_kfree_skb(skb);
                } else {
                        /* Increment the number of packets */
                        rx_queue->stats.rx_packets++;
index 4141ef2ddafc3974563b2e16e433d312bd1cb894..22eabc13ca99df900587678c24003167636446d3 100644 (file)
@@ -1080,8 +1080,6 @@ struct gfar_private {
 
        u32 cur_filer_idx;
 
-       struct sk_buff_head rx_recycle;
-
        /* RX queue filer rule set*/
        struct ethtool_rx_list rx_list;
        struct mutex rx_queue_access;
index 164288439220c69f59f755c091afb2c53289c420..0a70bb55d1b0fb624cf4202c855055f5969f5154 100644 (file)
@@ -209,14 +209,12 @@ static struct list_head *dequeue(struct list_head *lh)
 static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth,
                u8 __iomem *bd)
 {
-       struct sk_buff *skb = NULL;
+       struct sk_buff *skb;
 
-       skb = __skb_dequeue(&ugeth->rx_recycle);
+       skb = netdev_alloc_skb(ugeth->ndev,
+                              ugeth->ug_info->uf_info.max_rx_buf_length +
+                              UCC_GETH_RX_DATA_BUF_ALIGNMENT);
        if (!skb)
-               skb = netdev_alloc_skb(ugeth->ndev,
-                                     ugeth->ug_info->uf_info.max_rx_buf_length +
-                                     UCC_GETH_RX_DATA_BUF_ALIGNMENT);
-       if (skb == NULL)
                return NULL;
 
        /* We need the data buffer to be aligned properly.  We will reserve
@@ -2020,8 +2018,6 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
                iounmap(ugeth->ug_regs);
                ugeth->ug_regs = NULL;
        }
-
-       skb_queue_purge(&ugeth->rx_recycle);
 }
 
 static void ucc_geth_set_multi(struct net_device *dev)
@@ -2230,8 +2226,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
                return -ENOMEM;
        }
 
-       skb_queue_head_init(&ugeth->rx_recycle);
-
        return 0;
 }
 
@@ -3274,12 +3268,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
                        if (netif_msg_rx_err(ugeth))
                                ugeth_err("%s, %d: ERROR!!! skb - 0x%08x",
                                           __func__, __LINE__, (u32) skb);
-                       if (skb) {
-                               skb->data = skb->head + NET_SKB_PAD;
-                               skb->len = 0;
-                               skb_reset_tail_pointer(skb);
-                               __skb_queue_head(&ugeth->rx_recycle, skb);
-                       }
+                       dev_kfree_skb(skb);
 
                        ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL;
                        dev->stats.rx_dropped++;
@@ -3349,13 +3338,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 
                dev->stats.tx_packets++;
 
-               if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN &&
-                            skb_recycle_check(skb,
-                                   ugeth->ug_info->uf_info.max_rx_buf_length +
-                                   UCC_GETH_RX_DATA_BUF_ALIGNMENT))
-                       __skb_queue_head(&ugeth->rx_recycle, skb);
-               else
-                       dev_kfree_skb(skb);
+               dev_kfree_skb(skb);
 
                ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
                ugeth->skb_dirtytx[txQ] =
index f71b3e7b12defe7c92489ca967fbfe72819ab382..75f337163ce3c685fab0909516d5cb44055fcfa1 100644 (file)
@@ -1214,8 +1214,6 @@ struct ucc_geth_private {
        /* index of the first skb which hasn't been transmitted yet. */
        u16 skb_dirtytx[NUM_TX_QUEUES];
 
-       struct sk_buff_head rx_recycle;
-
        struct ugeth_mii_info *mii_info;
        struct phy_device *phydev;
        phy_interface_t phy_interface;
index ed5b40985edb10ccccbd6c216110e0830d6085f7..d37bfd96c987277980d4ec7b2e2db85f7e1dcf36 100644 (file)
@@ -412,6 +412,8 @@ enum e1e_registers {
 #define E1000_DEV_ID_PCH2_LV_V                 0x1503
 #define E1000_DEV_ID_PCH_LPT_I217_LM           0x153A
 #define E1000_DEV_ID_PCH_LPT_I217_V            0x153B
+#define E1000_DEV_ID_PCH_LPTLP_I218_LM         0x155A
+#define E1000_DEV_ID_PCH_LPTLP_I218_V          0x1559
 
 #define E1000_REVISION_4 4
 
index fb659dd8db038941842e9eb937b94eed8640d98e..de57a2ba6bde613504cd994662f7377e8e3461cc 100644 (file)
@@ -6558,6 +6558,8 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
 
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPT_I217_LM), board_pch_lpt },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPT_I217_V), board_pch_lpt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPTLP_I218_LM), board_pch_lpt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPTLP_I218_V), board_pch_lpt },
 
        { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
 };
index 5bd26763554c8926282739bf18d308d92c892990..30efc9f0f47a3cea7cf5aee5438b5ad70c208f30 100644 (file)
@@ -410,7 +410,7 @@ static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
 #define IXGBE_TX_CTXTDESC(R, i)            \
        (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
 
-#define IXGBE_MAX_JUMBO_FRAME_SIZE        16128
+#define IXGBE_MAX_JUMBO_FRAME_SIZE     9728 /* Maximum Supported Size 9.5KB */
 #ifdef IXGBE_FCOE
 /* Use 3K as the baby jumbo frame size for FCoE */
 #define IXGBE_FCOE_JUMBO_FRAME_SIZE       3072
index 383b4e1cd17532682c9dfc087d7d9a08a969b81a..4a9c9c285685294df5b5531c689f0e11171056be 100644 (file)
@@ -175,7 +175,7 @@ struct ixgbevf_q_vector {
 #define IXGBEVF_TX_CTXTDESC(R, i)          \
        (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
 
-#define IXGBE_MAX_JUMBO_FRAME_SIZE        16128
+#define IXGBE_MAX_JUMBO_FRAME_SIZE     9728 /* Maximum Supported Size 9.5KB */
 
 #define OTHER_VECTOR 1
 #define NON_Q_VECTORS (OTHER_VECTOR)
index 0ee9bd4819f444b392d087403da514db125af0bd..de1ad506665d6a33c223c8a73fbada54f39df832 100644 (file)
@@ -1747,6 +1747,7 @@ err_tx_ring_allocation:
  **/
 static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
 {
+       struct net_device *netdev = adapter->netdev;
        int err = 0;
        int vector, v_budget;
 
@@ -1775,6 +1776,12 @@ static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
 
        ixgbevf_acquire_msix_vectors(adapter, v_budget);
 
+       err = netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues);
+       if (err)
+               goto out;
+
+       err = netif_set_real_num_rx_queues(netdev, adapter->num_rx_queues);
+
 out:
        return err;
 }
index 087b9e0669f181c5832a3e51d08c0b785ed8134f..84c13263c514c988e44d4335d3ccae0147c220d6 100644 (file)
@@ -412,7 +412,6 @@ struct mv643xx_eth_private {
        u8 work_rx_refill;
 
        int skb_size;
-       struct sk_buff_head rx_recycle;
 
        /*
         * RX state.
@@ -673,9 +672,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
                struct rx_desc *rx_desc;
                int size;
 
-               skb = __skb_dequeue(&mp->rx_recycle);
-               if (skb == NULL)
-                       skb = netdev_alloc_skb(mp->dev, mp->skb_size);
+               skb = netdev_alloc_skb(mp->dev, mp->skb_size);
 
                if (skb == NULL) {
                        mp->oom = 1;
@@ -989,14 +986,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
                                       desc->byte_cnt, DMA_TO_DEVICE);
                }
 
-               if (skb != NULL) {
-                       if (skb_queue_len(&mp->rx_recycle) <
-                                       mp->rx_ring_size &&
-                           skb_recycle_check(skb, mp->skb_size))
-                               __skb_queue_head(&mp->rx_recycle, skb);
-                       else
-                               dev_kfree_skb(skb);
-               }
+               dev_kfree_skb(skb);
        }
 
        __netif_tx_unlock(nq);
@@ -2349,8 +2339,6 @@ static int mv643xx_eth_open(struct net_device *dev)
 
        napi_enable(&mp->napi);
 
-       skb_queue_head_init(&mp->rx_recycle);
-
        mp->int_mask = INT_EXT;
 
        for (i = 0; i < mp->rxq_count; i++) {
@@ -2445,8 +2433,6 @@ static int mv643xx_eth_stop(struct net_device *dev)
        mib_counters_update(mp);
        del_timer_sync(&mp->mib_counters_timer);
 
-       skb_queue_purge(&mp->rx_recycle);
-
        for (i = 0; i < mp->rxq_count; i++)
                rxq_deinit(mp->rxq + i);
        for (i = 0; i < mp->txq_count; i++)
index 5a30bf823099a00b8c5d230f4d2172775b85c967..9b9c2ac5c4c214d65366782c05d6406a1859cb17 100644 (file)
@@ -3189,7 +3189,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
        if (work_done < to_do) {
                unsigned long flags;
 
-               napi_gro_flush(napi);
+               napi_gro_flush(napi, false);
                spin_lock_irqsave(&hw->hw_lock, flags);
                __napi_complete(napi);
                hw->intr_mask |= napimask[skge->port];
@@ -3945,8 +3945,10 @@ static int __devinit skge_probe(struct pci_dev *pdev,
                skge_board_name(hw), hw->chip_rev);
 
        dev = skge_devinit(hw, 0, using_dac);
-       if (!dev)
+       if (!dev) {
+               err = -ENOMEM;
                goto err_out_led_off;
+       }
 
        /* Some motherboards are broken and has zero in ROM. */
        if (!is_valid_ether_addr(dev->dev_addr))
@@ -4153,6 +4155,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "nForce"),
                },
        },
+       {
+               .ident = "ASUS P5NSLI",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "P5NSLI")
+               },
+       },
        {}
 };
 
index 2b0748dba8b874544c935df9b7ba224141b1a2b3..78946feab4a2de4c187138d02c01418cf8b4fb6f 100644 (file)
@@ -4924,6 +4924,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 
        if (~reg == 0) {
                dev_err(&pdev->dev, "PCI configuration read error\n");
+               err = -EIO;
                goto err_out;
        }
 
@@ -4993,8 +4994,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
        hw->st_size = hw->ports * roundup_pow_of_two(3*RX_MAX_PENDING + TX_MAX_PENDING);
        hw->st_le = pci_alloc_consistent(pdev, hw->st_size * sizeof(struct sky2_status_le),
                                         &hw->st_dma);
-       if (!hw->st_le)
+       if (!hw->st_le) {
+               err = -ENOMEM;
                goto err_out_reset;
+       }
 
        dev_info(&pdev->dev, "Yukon-2 %s chip revision %d\n",
                 sky2_name(hw->chip_id, buf1, sizeof(buf1)), hw->chip_rev);
index 5b61d12f8b91127a3439de1ad71ae6d7b27e6e2c..dbaaa99a0d43fb81f14f7d3a4c6c8b2f3caabd80 100644 (file)
@@ -947,8 +947,8 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
        i = register_netdev(dev);
        if (i)
                goto err_register_netdev;
-
-       if (NATSEMI_CREATE_FILE(pdev, dspcfg_workaround))
+       i = NATSEMI_CREATE_FILE(pdev, dspcfg_workaround);
+       if (i)
                goto err_create_file;
 
        if (netif_msg_drv(np)) {
index e01c0a07a93ac15f490021b34e321f64433537b6..7dfe88398d7d3937cd6f308fb6d08b6943ee58d5 100644 (file)
@@ -205,6 +205,7 @@ static int __init sonic_probe1(struct net_device *dev)
        if (lp->descriptors == NULL) {
                printk(KERN_ERR "%s: couldn't alloc DMA memory for "
                                " descriptors.\n", dev_name(lp->device));
+               err = -ENOMEM;
                goto out;
        }
 
index 473ce134ca63d83c42ac115be60ca6e32aec04dc..24ad17ec7fcde46a6f11491873546f8ffbb3cef2 100644 (file)
@@ -1601,7 +1601,8 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        adapter->netdev  = netdev;
        adapter->pdev    = pdev;
 
-       if (qlcnic_alloc_adapter_resources(adapter))
+       err = qlcnic_alloc_adapter_resources(adapter);
+       if (err)
                goto err_out_free_netdev;
 
        adapter->dev_rst_time = jiffies;
index 995d0cfc4c065658ad47279a3705beb27b8c43f0..1c818254b7bec650da02fc352625570a3937b6f8 100644 (file)
@@ -563,7 +563,7 @@ rx_next:
                if (cpr16(IntrStatus) & cp_rx_intr_mask)
                        goto rx_status_loop;
 
-               napi_gro_flush(napi);
+               napi_gro_flush(napi, false);
                spin_lock_irqsave(&cp->lock, flags);
                __napi_complete(napi);
                cpw16_f(IntrMask, cp_intr_mask);
index bad8f2eec9b46f652298a3d9f0b48edbef1ac6b8..c8bfea0524dd304408642b5df86c3119d7a6a65c 100644 (file)
@@ -2438,6 +2438,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
                rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
                if (!rtsu) {
                        dev_err(&pdev->dev, "Not found TSU resource\n");
+                       ret = -ENODEV;
                        goto out_release;
                }
                mdp->tsu_addr = ioremap(rtsu->start,
index 5b3dd028ce852a267833254bf4c5f28fcf9acf7e..0767043f44a42866d545a8ff843604a3d717af48 100644 (file)
@@ -640,8 +640,7 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx)
                        evt = list_entry(cursor, struct efx_ptp_event_rx,
                                         link);
                        if (time_after(jiffies, evt->expiry)) {
-                               list_del(&evt->link);
-                               list_add(&evt->link, &ptp->evt_free_list);
+                               list_move(&evt->link, &ptp->evt_free_list);
                                netif_warn(efx, hw, efx->net_dev,
                                           "PTP rx event dropped\n");
                        }
@@ -684,8 +683,7 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx,
 
                        match->state = PTP_PACKET_STATE_MATCHED;
                        rc = PTP_PACKET_STATE_MATCHED;
-                       list_del(&evt->link);
-                       list_add(&evt->link, &ptp->evt_free_list);
+                       list_move(&evt->link, &ptp->evt_free_list);
                        break;
                }
        }
@@ -820,8 +818,7 @@ static int efx_ptp_stop(struct efx_nic *efx)
        /* Drop any pending receive events */
        spin_lock_bh(&efx->ptp_data->evt_lock);
        list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) {
-               list_del(cursor);
-               list_add(cursor, &efx->ptp_data->evt_free_list);
+               list_move(cursor, &efx->ptp_data->evt_free_list);
        }
        spin_unlock_bh(&efx->ptp_data->evt_lock);
 
index 203d9c6ec23a109cd9f941d2709257a2058930a4..fb9f6b38511f97beddbff380c2ae7d31878e4ff4 100644 (file)
@@ -478,8 +478,10 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
 
        /* IO region. */
        ioaddr = pci_iomap(pci_dev, 0, 0);
-       if (!ioaddr)
+       if (!ioaddr) {
+               ret = -ENOMEM;
                goto err_out_cleardev;
+       }
 
        sis_priv = netdev_priv(net_dev);
        sis_priv->ioaddr = ioaddr;
index e872e1da3137cef68265e845188bb8544acb988e..7d51a65ab09960ac34baa8baa0b2a3a640a9dfc5 100644 (file)
@@ -50,7 +50,6 @@ struct stmmac_priv {
        unsigned int dirty_rx;
        struct sk_buff **rx_skbuff;
        dma_addr_t *rx_skbuff_dma;
-       struct sk_buff_head rx_recycle;
 
        struct net_device *dev;
        dma_addr_t dma_rx_phy;
index 3be88331d17ab0e690b71f06b2ac30f50d7a7f77..c6cdbc4eb05e613cd499cc35af4ee56300cafcf8 100644 (file)
@@ -747,18 +747,7 @@ static void stmmac_tx(struct stmmac_priv *priv)
                priv->hw->ring->clean_desc3(p);
 
                if (likely(skb != NULL)) {
-                       /*
-                        * If there's room in the queue (limit it to size)
-                        * we add this skb back into the pool,
-                        * if it's the right size.
-                        */
-                       if ((skb_queue_len(&priv->rx_recycle) <
-                               priv->dma_rx_size) &&
-                               skb_recycle_check(skb, priv->dma_buf_sz))
-                               __skb_queue_head(&priv->rx_recycle, skb);
-                       else
-                               dev_kfree_skb(skb);
-
+                       dev_kfree_skb(skb);
                        priv->tx_skbuff[entry] = NULL;
                }
 
@@ -1169,7 +1158,6 @@ static int stmmac_open(struct net_device *dev)
        priv->eee_enabled = stmmac_eee_init(priv);
 
        napi_enable(&priv->napi);
-       skb_queue_head_init(&priv->rx_recycle);
        netif_start_queue(dev);
 
        return 0;
@@ -1222,7 +1210,6 @@ static int stmmac_release(struct net_device *dev)
                kfree(priv->tm);
 #endif
        napi_disable(&priv->napi);
-       skb_queue_purge(&priv->rx_recycle);
 
        /* Free the IRQ lines */
        free_irq(dev->irq, dev);
@@ -1388,10 +1375,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
                if (likely(priv->rx_skbuff[entry] == NULL)) {
                        struct sk_buff *skb;
 
-                       skb = __skb_dequeue(&priv->rx_recycle);
-                       if (skb == NULL)
-                               skb = netdev_alloc_skb_ip_align(priv->dev,
-                                                               bfsize);
+                       skb = netdev_alloc_skb_ip_align(priv->dev, bfsize);
 
                        if (unlikely(skb == NULL))
                                break;
index 8419bf385e08b89633948c237e4cce6821e40e77..275b430aeb75daebc70cdaeec7695954168d6a04 100644 (file)
@@ -9788,6 +9788,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
 
        if (!pci_is_pcie(pdev)) {
                dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n");
+               err = -ENODEV;
                goto err_out_free_res;
        }
 
index 9ae12d0c963212b332bd0a69e35e134dad560ab1..6c8695ec7cb9846fc0a53bbff830ce839fa95a21 100644 (file)
@@ -2963,7 +2963,8 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
                goto err_out_iounmap;
        }
 
-       if (gem_get_device_address(gp))
+       err = gem_get_device_address(gp);
+       if (err)
                goto err_out_free_consistent;
 
        dev->netdev_ops = &gem_netdev_ops;
index 30087ca23a0fc7e6c33c75fcb80f020aae42186c..6e4d4b62c9a849326edae6598611328b110233be 100644 (file)
@@ -459,8 +459,10 @@ static int irtty_open(struct tty_struct *tty)
 
        /* allocate private device info block */
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-       if (!priv)
+       if (!priv) {
+               ret = -ENOMEM;
                goto out_put;
+       }
 
        priv->magic = IRTTY_MAGIC;
        priv->tty = tty;
index 1a00b5990cb8a0ec7beec4e5f6efe24b591cb263..f07c340990da570303a25a0e44cbf7ca4b21efa8 100644 (file)
@@ -920,8 +920,10 @@ static int mcs_probe(struct usb_interface *intf,
 
        ndev->netdev_ops = &mcs_netdev_ops;
 
-       if (!intf->cur_altsetting)
+       if (!intf->cur_altsetting) {
+               ret = -ENOMEM;
                goto error2;
+       }
 
        ret = mcs_find_endpoints(mcs, intf->cur_altsetting->endpoint,
                                 intf->cur_altsetting->desc.bNumEndpoints);
index 002a442bf73fab057bb74ba2d2509b421abd5fe6..858de05bdb7dc171012374ac02998c1fd111349c 100644 (file)
@@ -846,8 +846,10 @@ static int pxa_irda_probe(struct platform_device *pdev)
                goto err_mem_2;
 
        dev = alloc_irdadev(sizeof(struct pxa_irda));
-       if (!dev)
+       if (!dev) {
+               err = -ENOMEM;
                goto err_mem_3;
+       }
 
        SET_NETDEV_DEV(dev, &pdev->dev);
        si = netdev_priv(dev);
index e25067552b209327763da3f381a41e85be5e22a2..42fde9ed23e153fbb8f7e3295fca7e81da23a626 100644 (file)
@@ -940,8 +940,10 @@ static int sa1100_irda_probe(struct platform_device *pdev)
                goto err_mem_3;
 
        dev = alloc_irdadev(sizeof(struct sa1100_irda));
-       if (!dev)
+       if (!dev) {
+               err = -ENOMEM;
                goto err_mem_4;
+       }
 
        SET_NETDEV_DEV(dev, &pdev->dev);
 
index eb315b8d07a3c448822dabe8a0df5dfae3dcc13f..4b746d9bd8e7e74b227e0ea6bea63193c9942c21 100644 (file)
@@ -808,8 +808,8 @@ static int __devinit sh_irda_probe(struct platform_device *pdev)
                goto err_mem_4;
 
        platform_set_drvdata(pdev, ndev);
-
-       if (request_irq(irq, sh_irda_irq, IRQF_DISABLED, "sh_irda", self)) {
+       err = request_irq(irq, sh_irda_irq, IRQF_DISABLED, "sh_irda", self);
+       if (err) {
                dev_warn(&pdev->dev, "Unable to attach sh_irda interrupt\n");
                goto err_mem_4;
        }
index 795109425568623977428b1a62bffc7d11c6fa14..624ac1939e857a90a71d66d6dd22e5bddffe71f9 100644 (file)
@@ -741,6 +741,7 @@ static int __devinit sh_sir_probe(struct platform_device *pdev)
        self->clk = clk_get(&pdev->dev, clk_name);
        if (IS_ERR(self->clk)) {
                dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
+               err = -ENODEV;
                goto err_mem_3;
        }
 
@@ -760,8 +761,8 @@ static int __devinit sh_sir_probe(struct platform_device *pdev)
                goto err_mem_4;
 
        platform_set_drvdata(pdev, ndev);
-
-       if (request_irq(irq, sh_sir_irq, IRQF_DISABLED, "sh_sir", self)) {
+       err = request_irq(irq, sh_sir_irq, IRQF_DISABLED, "sh_sir", self);
+       if (err) {
                dev_warn(&pdev->dev, "Unable to attach sh_sir interrupt\n");
                goto err_mem_4;
        }
index 51de9edb55f55d7eca5fe9a9956632ca5c403452..8be9bf07bd3915a8678ab807a93674916351cee8 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/igmp.h>
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h>
-#include <linux/version.h>
 #include <linux/hash.h>
 #include <net/ip.h>
 #include <net/icmp.h>
@@ -1084,13 +1083,13 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
        if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni))
                goto nla_put_failure;
 
-       if (vxlan->gaddr && nla_put_u32(skb, IFLA_VXLAN_GROUP, vxlan->gaddr))
+       if (vxlan->gaddr && nla_put_be32(skb, IFLA_VXLAN_GROUP, vxlan->gaddr))
                goto nla_put_failure;
 
        if (vxlan->link && nla_put_u32(skb, IFLA_VXLAN_LINK, vxlan->link))
                goto nla_put_failure;
 
-       if (vxlan->saddr && nla_put_u32(skb, IFLA_VXLAN_LOCAL, vxlan->saddr))
+       if (vxlan->saddr && nla_put_be32(skb, IFLA_VXLAN_LOCAL, vxlan->saddr))
                goto nla_put_failure;
 
        if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->ttl) ||
index e6ff12dd717baf338d2e8ef88cb524c912304ad0..c0ff748d0aa546671293ba5b42c46d108b7a6e26 100644 (file)
@@ -80,6 +80,8 @@ static inline int is_vlan_dev(struct net_device *dev)
 }
 
 #define vlan_tx_tag_present(__skb)     ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
+#define vlan_tx_nonzero_tag_present(__skb) \
+       (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
 #define vlan_tx_tag_get(__skb)         ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
 
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
@@ -89,7 +91,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
 extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
 extern u16 vlan_dev_vlan_id(const struct net_device *dev);
 
-extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
+extern bool vlan_do_receive(struct sk_buff **skb);
 extern struct sk_buff *vlan_untag(struct sk_buff *skb);
 
 extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
@@ -120,10 +122,8 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
        return 0;
 }
 
-static inline bool vlan_do_receive(struct sk_buff **skb, bool last_handler)
+static inline bool vlan_do_receive(struct sk_buff **skb)
 {
-       if (((*skb)->vlan_tci & VLAN_VID_MASK) && last_handler)
-               (*skb)->pkt_type = PACKET_OTHERHOST;
        return false;
 }
 
index 01646aa53b0e6c30be6de8afb406516a2f4b69a5..561c8bc8976dce2b65245aba6aa051cdc590c69f 100644 (file)
@@ -1497,19 +1497,25 @@ struct napi_gro_cb {
        /* This indicates where we are processing relative to skb->data. */
        int data_offset;
 
-       /* This is non-zero if the packet may be of the same flow. */
-       int same_flow;
-
        /* This is non-zero if the packet cannot be merged with the new skb. */
        int flush;
 
        /* Number of segments aggregated. */
-       int count;
+       u16     count;
+
+       /* This is non-zero if the packet may be of the same flow. */
+       u8      same_flow;
 
        /* Free the skb? */
-       int free;
+       u8      free;
 #define NAPI_GRO_FREE            1
 #define NAPI_GRO_FREE_STOLEN_HEAD 2
+
+       /* jiffies when first packet was created/queued */
+       unsigned long age;
+
+       /* Used in ipv6_gro_receive() */
+       int     proto;
 };
 
 #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1663,7 +1669,6 @@ extern int                netpoll_trap(void);
 #endif
 extern int            skb_gro_receive(struct sk_buff **head,
                                       struct sk_buff *skb);
-extern void           skb_gro_reset_offset(struct sk_buff *skb);
 
 static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
 {
@@ -2157,7 +2162,7 @@ extern gro_result_t       dev_gro_receive(struct napi_struct *napi,
 extern gro_result_t    napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
 extern gro_result_t    napi_gro_receive(struct napi_struct *napi,
                                         struct sk_buff *skb);
-extern void            napi_gro_flush(struct napi_struct *napi);
+extern void            napi_gro_flush(struct napi_struct *napi, bool flush_old);
 extern struct sk_buff *        napi_get_frags(struct napi_struct *napi);
 extern gro_result_t    napi_frags_finish(struct napi_struct *napi,
                                          struct sk_buff *skb,
index f80c56ac4d82a822efe44f0dbbd87cfba819dd92..6d3af05c107cf50e1dfe962a610b16bd43d7b6ab 100644 (file)
@@ -245,6 +245,8 @@ struct netlink_callback {
                                        struct netlink_callback *cb);
        int                     (*done)(struct netlink_callback *cb);
        void                    *data;
+       /* the module that dump function belong to */
+       struct module           *module;
        u16                     family;
        u16                     min_dump_alloc;
        unsigned int            prev_seq, seq;
@@ -262,14 +264,24 @@ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int fla
 
 struct netlink_dump_control {
        int (*dump)(struct sk_buff *skb, struct netlink_callback *);
-       int (*done)(struct netlink_callback*);
+       int (*done)(struct netlink_callback *);
        void *data;
+       struct module *module;
        u16 min_dump_alloc;
 };
 
-extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
-                             const struct nlmsghdr *nlh,
-                             struct netlink_dump_control *control);
+extern int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+                               const struct nlmsghdr *nlh,
+                               struct netlink_dump_control *control);
+static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+                                    const struct nlmsghdr *nlh,
+                                    struct netlink_dump_control *control)
+{
+       if (!control->module)
+               control->module = THIS_MODULE;
+
+       return __netlink_dump_start(ssk, skb, nlh, control);
+}
 
 #endif /* __KERNEL__ */
 
index b33a3a1f205e45c747c9125a5b5920365ca2f8be..6a2c34e6d962658d0a1532959a06b5ddebe65087 100644 (file)
@@ -589,9 +589,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
        return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
 }
 
-extern void skb_recycle(struct sk_buff *skb);
-extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
-
 extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
 extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
 extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -2645,27 +2642,6 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb)
 
 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
 
-static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
-{
-       if (irqs_disabled())
-               return false;
-
-       if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY)
-               return false;
-
-       if (skb_is_nonlinear(skb) || skb->fclone != SKB_FCLONE_UNAVAILABLE)
-               return false;
-
-       skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
-       if (skb_end_offset(skb) < skb_size)
-               return false;
-
-       if (skb_shared(skb) || skb_cloned(skb))
-               return false;
-
-       return true;
-}
-
 /**
  * skb_head_is_locked - Determine if the skb->head is locked down
  * @skb: skb to check
index e1dd5082ec7e43605e66ae0c48789ed1b4e68e35..628e11b98c580d7f66ace375f5a4e0598d03b471 100644 (file)
@@ -21,6 +21,7 @@ struct flowi_common {
        __u8    flowic_flags;
 #define FLOWI_FLAG_ANYSRC              0x01
 #define FLOWI_FLAG_CAN_SLEEP           0x02
+#define FLOWI_FLAG_KNOWN_NH            0x04
        __u32   flowic_secid;
 };
 
index da22243d27600cd66b5fb70da61f5cadc05d5468..bc40b633a5c4dc0e763c5c8c4ff123135160dc04 100644 (file)
@@ -48,7 +48,8 @@ struct rtable {
        int                     rt_genid;
        unsigned int            rt_flags;
        __u16                   rt_type;
-       __u16                   rt_is_input;
+       __u8                    rt_is_input;
+       __u8                    rt_uses_gateway;
 
        int                     rt_iif;
 
index 3c5363ab867b263e24d1c94da2714be532236795..bd3d8b24b42024f848ffd0c55f2dc58dc6de1b28 100644 (file)
@@ -39,6 +39,7 @@ struct rdma_cm_id_stats {
 
 struct ibnl_client_cbs {
        int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
+       struct module *module;
 };
 
 int ibnl_init(void);
index add69d0fd99d2b34025c0d8fb42f703ca6ea38c0..fbbf1fa00940e2c843f1706ea1a6bcfff349c555 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/export.h>
 #include "vlan.h"
 
-bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
+bool vlan_do_receive(struct sk_buff **skbp)
 {
        struct sk_buff *skb = *skbp;
        u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
@@ -13,14 +13,8 @@ bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
        struct vlan_pcpu_stats *rx_stats;
 
        vlan_dev = vlan_find_dev(skb->dev, vlan_id);
-       if (!vlan_dev) {
-               /* Only the last call to vlan_do_receive() should change
-                * pkt_type to PACKET_OTHERHOST
-                */
-               if (vlan_id && last_handler)
-                       skb->pkt_type = PACKET_OTHERHOST;
+       if (!vlan_dev)
                return false;
-       }
 
        skb = *skbp = skb_share_check(skb, GFP_ATOMIC);
        if (unlikely(!skb))
index 1e0a1847c3bbee7fd5aeb8654bf0d9da08ce5ca9..09cb3f6dc40c4a573a9597ca851b9a91a09a1c3d 100644 (file)
@@ -3300,18 +3300,18 @@ ncls:
                                && !skb_pfmemalloc_protocol(skb))
                goto drop;
 
-       rx_handler = rcu_dereference(skb->dev->rx_handler);
        if (vlan_tx_tag_present(skb)) {
                if (pt_prev) {
                        ret = deliver_skb(skb, pt_prev, orig_dev);
                        pt_prev = NULL;
                }
-               if (vlan_do_receive(&skb, !rx_handler))
+               if (vlan_do_receive(&skb))
                        goto another_round;
                else if (unlikely(!skb))
                        goto unlock;
        }
 
+       rx_handler = rcu_dereference(skb->dev->rx_handler);
        if (rx_handler) {
                if (pt_prev) {
                        ret = deliver_skb(skb, pt_prev, orig_dev);
@@ -3331,6 +3331,9 @@ ncls:
                }
        }
 
+       if (vlan_tx_nonzero_tag_present(skb))
+               skb->pkt_type = PACKET_OTHERHOST;
+
        /* deliver only exact match when indicated */
        null_or_dev = deliver_exact ? skb->dev : NULL;
 
@@ -3471,17 +3474,31 @@ out:
        return netif_receive_skb(skb);
 }
 
-inline void napi_gro_flush(struct napi_struct *napi)
+/* napi->gro_list contains packets ordered by age.
+ * youngest packets at the head of it.
+ * Complete skbs in reverse order to reduce latencies.
+ */
+void napi_gro_flush(struct napi_struct *napi, bool flush_old)
 {
-       struct sk_buff *skb, *next;
+       struct sk_buff *skb, *prev = NULL;
 
-       for (skb = napi->gro_list; skb; skb = next) {
-               next = skb->next;
+       /* scan list and build reverse chain */
+       for (skb = napi->gro_list; skb != NULL; skb = skb->next) {
+               skb->prev = prev;
+               prev = skb;
+       }
+
+       for (skb = prev; skb; skb = prev) {
                skb->next = NULL;
+
+               if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
+                       return;
+
+               prev = skb->prev;
                napi_gro_complete(skb);
+               napi->gro_count--;
        }
 
-       napi->gro_count = 0;
        napi->gro_list = NULL;
 }
 EXPORT_SYMBOL(napi_gro_flush);
@@ -3542,6 +3559,7 @@ enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 
        napi->gro_count++;
        NAPI_GRO_CB(skb)->count = 1;
+       NAPI_GRO_CB(skb)->age = jiffies;
        skb_shinfo(skb)->gso_size = skb_gro_len(skb);
        skb->next = napi->gro_list;
        napi->gro_list = skb;
@@ -3631,20 +3649,22 @@ gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(napi_skb_finish);
 
-void skb_gro_reset_offset(struct sk_buff *skb)
+static void skb_gro_reset_offset(struct sk_buff *skb)
 {
+       const struct skb_shared_info *pinfo = skb_shinfo(skb);
+       const skb_frag_t *frag0 = &pinfo->frags[0];
+
        NAPI_GRO_CB(skb)->data_offset = 0;
        NAPI_GRO_CB(skb)->frag0 = NULL;
        NAPI_GRO_CB(skb)->frag0_len = 0;
 
        if (skb->mac_header == skb->tail &&
-           !PageHighMem(skb_frag_page(&skb_shinfo(skb)->frags[0]))) {
-               NAPI_GRO_CB(skb)->frag0 =
-                       skb_frag_address(&skb_shinfo(skb)->frags[0]);
-               NAPI_GRO_CB(skb)->frag0_len = skb_frag_size(&skb_shinfo(skb)->frags[0]);
+           pinfo->nr_frags &&
+           !PageHighMem(skb_frag_page(frag0))) {
+               NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0);
+               NAPI_GRO_CB(skb)->frag0_len = skb_frag_size(frag0);
        }
 }
-EXPORT_SYMBOL(skb_gro_reset_offset);
 
 gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 {
@@ -3876,7 +3896,7 @@ void napi_complete(struct napi_struct *n)
        if (unlikely(test_bit(NAPI_STATE_NPSVC, &n->state)))
                return;
 
-       napi_gro_flush(n);
+       napi_gro_flush(n, false);
        local_irq_save(flags);
        __napi_complete(n);
        local_irq_restore(flags);
@@ -3981,8 +4001,17 @@ static void net_rx_action(struct softirq_action *h)
                                local_irq_enable();
                                napi_complete(n);
                                local_irq_disable();
-                       } else
+                       } else {
+                               if (n->gro_list) {
+                                       /* flush too old packets
+                                        * If HZ < 1000, flush all packets.
+                                        */
+                                       local_irq_enable();
+                                       napi_gro_flush(n, HZ >= 1000);
+                                       local_irq_disable();
+                               }
                                list_move_tail(&n->poll_list, &sd->poll_list);
+                       }
                }
 
                netpoll_poll_unlock(have);
index baca771caae2df503a1b0f1bcc9a4fcb577777e8..22571488730a7d1bbc2f5f2ec545abf850dcdf4a 100644 (file)
@@ -1301,8 +1301,6 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
        if (!dst)
                goto discard;
 
-       __skb_pull(skb, skb_network_offset(skb));
-
        if (!neigh_event_send(neigh, skb)) {
                int err;
                struct net_device *dev = neigh->dev;
@@ -1312,6 +1310,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
                        neigh_hh_init(neigh, dst);
 
                do {
+                       __skb_pull(skb, skb_network_offset(skb));
                        seq = read_seqbegin(&neigh->ha_lock);
                        err = dev_hard_header(skb, dev, ntohs(skb->protocol),
                                              neigh->ha, NULL, skb->len);
@@ -1342,9 +1341,8 @@ int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb)
        unsigned int seq;
        int err;
 
-       __skb_pull(skb, skb_network_offset(skb));
-
        do {
+               __skb_pull(skb, skb_network_offset(skb));
                seq = read_seqbegin(&neigh->ha_lock);
                err = dev_hard_header(skb, dev, ntohs(skb->protocol),
                                      neigh->ha, NULL, skb->len);
index cdc28598f4efadb83b79a006a71ea676b508a655..6e04b1fa11f2d4c6d0e0aacb27441688c5fe1438 100644 (file)
@@ -655,53 +655,6 @@ void consume_skb(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(consume_skb);
 
-/**
- *     skb_recycle - clean up an skb for reuse
- *     @skb: buffer
- *
- *     Recycles the skb to be reused as a receive buffer. This
- *     function does any necessary reference count dropping, and
- *     cleans up the skbuff as if it just came from __alloc_skb().
- */
-void skb_recycle(struct sk_buff *skb)
-{
-       struct skb_shared_info *shinfo;
-
-       skb_release_head_state(skb);
-
-       shinfo = skb_shinfo(skb);
-       memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
-       atomic_set(&shinfo->dataref, 1);
-
-       memset(skb, 0, offsetof(struct sk_buff, tail));
-       skb->data = skb->head + NET_SKB_PAD;
-       skb_reset_tail_pointer(skb);
-}
-EXPORT_SYMBOL(skb_recycle);
-
-/**
- *     skb_recycle_check - check if skb can be reused for receive
- *     @skb: buffer
- *     @skb_size: minimum receive buffer size
- *
- *     Checks that the skb passed in is not shared or cloned, and
- *     that it is linear and its head portion at least as large as
- *     skb_size so that it can be recycled as a receive buffer.
- *     If these conditions are met, this function does any necessary
- *     reference count dropping and cleans up the skbuff as if it
- *     just came from __alloc_skb().
- */
-bool skb_recycle_check(struct sk_buff *skb, int skb_size)
-{
-       if (!skb_is_recycleable(skb, skb_size))
-               return false;
-
-       skb_recycle(skb);
-
-       return true;
-}
-EXPORT_SYMBOL(skb_recycle_check);
-
 static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 {
        new->tstamp             = old->tstamp;
index 68c93d1bb03adb9fef46ff264a783dad82a962ea..825c608826de1c4b5dea08c46e6ff4255117c990 100644 (file)
@@ -322,7 +322,8 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
 {
        int r = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev);
 
-       if (!r && !fib_num_tclassid_users(dev_net(dev))) {
+       if (!r && !fib_num_tclassid_users(dev_net(dev)) &&
+           (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) {
                *itag = 0;
                return 0;
        }
index 267753060ffc5c7efe6a3e183113d8dc3fbb49e6..71b125cd5db18a3af37d124d4eb3495f3e03fdea 100644 (file)
@@ -840,6 +840,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
        change_nexthops(fi) {
                nexthop_nh->nh_parent = fi;
                nexthop_nh->nh_pcpu_rth_output = alloc_percpu(struct rtable __rcu *);
+               if (!nexthop_nh->nh_pcpu_rth_output)
+                       goto failure;
        } endfor_nexthops(fi)
 
        if (cfg->fc_mx) {
index f0c5b9c1a95714e2e206cf6cd178a90626271fcc..d34ce2972c8f90bca6809342aab5451c9138241e 100644 (file)
@@ -406,7 +406,7 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
        rt = ip_route_output_flow(net, fl4, sk);
        if (IS_ERR(rt))
                goto no_route;
-       if (opt && opt->opt.is_strictroute && rt->rt_gateway)
+       if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
                goto route_err;
        return &rt->dst;
 
@@ -442,7 +442,7 @@ struct dst_entry *inet_csk_route_child_sock(struct sock *sk,
        rt = ip_route_output_flow(net, fl4, sk);
        if (IS_ERR(rt))
                goto no_route;
-       if (opt && opt->opt.is_strictroute && rt->rt_gateway)
+       if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
                goto route_err;
        rcu_read_unlock();
        return &rt->dst;
index ab09b126423ce3e56fd1fee2f6bda54e4b851022..694de3b7aebfede6073433201e1200cf72008997 100644 (file)
@@ -85,7 +85,7 @@ int ip_forward(struct sk_buff *skb)
 
        rt = skb_rtable(skb);
 
-       if (opt->is_strictroute && opt->nexthop != rt->rt_gateway)
+       if (opt->is_strictroute && rt->rt_uses_gateway)
                goto sr_failed;
 
        if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&
index 24a29a39e9a885dfa96300067fd37154b0875f53..6537a408a4fb451d906b574def4746c064399fd9 100644 (file)
@@ -193,7 +193,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
        }
 
        rcu_read_lock_bh();
-       nexthop = rt->rt_gateway ? rt->rt_gateway : ip_hdr(skb)->daddr;
+       nexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr);
        neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
        if (unlikely(!neigh))
                neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
@@ -371,7 +371,7 @@ int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl)
        skb_dst_set_noref(skb, &rt->dst);
 
 packet_routed:
-       if (inet_opt && inet_opt->opt.is_strictroute && rt->rt_gateway)
+       if (inet_opt && inet_opt->opt.is_strictroute && rt->rt_uses_gateway)
                goto no_route;
 
        /* OK, we know where to send it, allocate and build IP header. */
index ff622069fcefbe5ac2248440c2059b5a16d524e0..1a0da8dc8180c9977fb75aea1a06f43ee656621b 100644 (file)
@@ -802,7 +802,8 @@ void ip_rt_send_redirect(struct sk_buff *skb)
        net = dev_net(rt->dst.dev);
        peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1);
        if (!peer) {
-               icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway);
+               icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST,
+                         rt_nexthop(rt, ip_hdr(skb)->daddr));
                return;
        }
 
@@ -827,7 +828,9 @@ void ip_rt_send_redirect(struct sk_buff *skb)
            time_after(jiffies,
                       (peer->rate_last +
                        (ip_rt_redirect_load << peer->rate_tokens)))) {
-               icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway);
+               __be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr);
+
+               icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
                peer->rate_last = jiffies;
                ++peer->rate_tokens;
 #ifdef CONFIG_IP_ROUTE_VERBOSE
@@ -835,7 +838,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
                    peer->rate_tokens == ip_rt_redirect_number)
                        net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
                                             &ip_hdr(skb)->saddr, inet_iif(skb),
-                                            &ip_hdr(skb)->daddr, &rt->rt_gateway);
+                                            &ip_hdr(skb)->daddr, &gw);
 #endif
        }
 out_put_peer:
@@ -904,22 +907,32 @@ out:      kfree_skb(skb);
        return 0;
 }
 
-static u32 __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
+static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 {
+       struct dst_entry *dst = &rt->dst;
        struct fib_result res;
 
+       if (dst->dev->mtu < mtu)
+               return;
+
        if (mtu < ip_rt_min_pmtu)
                mtu = ip_rt_min_pmtu;
 
+       if (!rt->rt_pmtu) {
+               dst->obsolete = DST_OBSOLETE_KILL;
+       } else {
+               rt->rt_pmtu = mtu;
+               dst->expires = max(1UL, jiffies + ip_rt_mtu_expires);
+       }
+
        rcu_read_lock();
-       if (fib_lookup(dev_net(rt->dst.dev), fl4, &res) == 0) {
+       if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) {
                struct fib_nh *nh = &FIB_RES_NH(res);
 
                update_or_create_fnhe(nh, fl4->daddr, 0, mtu,
                                      jiffies + ip_rt_mtu_expires);
        }
        rcu_read_unlock();
-       return mtu;
 }
 
 static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
@@ -929,14 +942,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
        struct flowi4 fl4;
 
        ip_rt_build_flow_key(&fl4, sk, skb);
-       mtu = __ip_rt_update_pmtu(rt, &fl4, mtu);
-
-       if (!rt->rt_pmtu) {
-               dst->obsolete = DST_OBSOLETE_KILL;
-       } else {
-               rt->rt_pmtu = mtu;
-               rt->dst.expires = max(1UL, jiffies + ip_rt_mtu_expires);
-       }
+       __ip_rt_update_pmtu(rt, &fl4, mtu);
 }
 
 void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
@@ -1120,7 +1126,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
        mtu = dst->dev->mtu;
 
        if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
-               if (rt->rt_gateway && mtu > 576)
+               if (rt->rt_uses_gateway && mtu > 576)
                        mtu = 576;
        }
 
@@ -1171,7 +1177,9 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
                if (fnhe->fnhe_gw) {
                        rt->rt_flags |= RTCF_REDIRECTED;
                        rt->rt_gateway = fnhe->fnhe_gw;
-               }
+                       rt->rt_uses_gateway = 1;
+               } else if (!rt->rt_gateway)
+                       rt->rt_gateway = daddr;
 
                orig = rcu_dereference(fnhe->fnhe_rth);
                rcu_assign_pointer(fnhe->fnhe_rth, rt);
@@ -1180,13 +1188,6 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
 
                fnhe->fnhe_stamp = jiffies;
                ret = true;
-       } else {
-               /* Routes we intend to cache in nexthop exception have
-                * the DST_NOCACHE bit clear.  However, if we are
-                * unsuccessful at storing this route into the cache
-                * we really need to set it.
-                */
-               rt->dst.flags |= DST_NOCACHE;
        }
        spin_unlock_bh(&fnhe_lock);
 
@@ -1201,8 +1202,6 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
        if (rt_is_input_route(rt)) {
                p = (struct rtable **)&nh->nh_rth_input;
        } else {
-               if (!nh->nh_pcpu_rth_output)
-                       goto nocache;
                p = (struct rtable **)__this_cpu_ptr(nh->nh_pcpu_rth_output);
        }
        orig = *p;
@@ -1211,16 +1210,8 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
        if (prev == orig) {
                if (orig)
                        rt_free(orig);
-       } else {
-               /* Routes we intend to cache in the FIB nexthop have
-                * the DST_NOCACHE bit clear.  However, if we are
-                * unsuccessful at storing this route into the cache
-                * we really need to set it.
-                */
-nocache:
-               rt->dst.flags |= DST_NOCACHE;
+       } else
                ret = false;
-       }
 
        return ret;
 }
@@ -1281,8 +1272,10 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
        if (fi) {
                struct fib_nh *nh = &FIB_RES_NH(*res);
 
-               if (nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK)
+               if (nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) {
                        rt->rt_gateway = nh->nh_gw;
+                       rt->rt_uses_gateway = 1;
+               }
                dst_init_metrics(&rt->dst, fi->fib_metrics, true);
 #ifdef CONFIG_IP_ROUTE_CLASSID
                rt->dst.tclassid = nh->nh_tclassid;
@@ -1291,8 +1284,18 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
                        cached = rt_bind_exception(rt, fnhe, daddr);
                else if (!(rt->dst.flags & DST_NOCACHE))
                        cached = rt_cache_route(nh, rt);
-       }
-       if (unlikely(!cached))
+               if (unlikely(!cached)) {
+                       /* Routes we intend to cache in nexthop exception or
+                        * FIB nexthop have the DST_NOCACHE bit clear.
+                        * However, if we are unsuccessful at storing this
+                        * route into the cache we really need to set it.
+                        */
+                       rt->dst.flags |= DST_NOCACHE;
+                       if (!rt->rt_gateway)
+                               rt->rt_gateway = daddr;
+                       rt_add_uncached_list(rt);
+               }
+       } else
                rt_add_uncached_list(rt);
 
 #ifdef CONFIG_IP_ROUTE_CLASSID
@@ -1360,6 +1363,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
        rth->rt_iif     = 0;
        rth->rt_pmtu    = 0;
        rth->rt_gateway = 0;
+       rth->rt_uses_gateway = 0;
        INIT_LIST_HEAD(&rth->rt_uncached);
        if (our) {
                rth->dst.input= ip_local_deliver;
@@ -1429,7 +1433,6 @@ static int __mkroute_input(struct sk_buff *skb,
                return -EINVAL;
        }
 
-
        err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),
                                  in_dev->dev, in_dev, &itag);
        if (err < 0) {
@@ -1439,10 +1442,13 @@ static int __mkroute_input(struct sk_buff *skb,
                goto cleanup;
        }
 
-       if (out_dev == in_dev && err &&
+       do_cache = res->fi && !itag;
+       if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
            (IN_DEV_SHARED_MEDIA(out_dev) ||
-            inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
+            inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
                flags |= RTCF_DOREDIRECT;
+               do_cache = false;
+       }
 
        if (skb->protocol != htons(ETH_P_IP)) {
                /* Not IP (i.e. ARP). Do not create route, if it is
@@ -1459,15 +1465,11 @@ static int __mkroute_input(struct sk_buff *skb,
                }
        }
 
-       do_cache = false;
-       if (res->fi) {
-               if (!itag) {
-                       rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
-                       if (rt_cache_valid(rth)) {
-                               skb_dst_set_noref(skb, &rth->dst);
-                               goto out;
-                       }
-                       do_cache = true;
+       if (do_cache) {
+               rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
+               if (rt_cache_valid(rth)) {
+                       skb_dst_set_noref(skb, &rth->dst);
+                       goto out;
                }
        }
 
@@ -1486,6 +1488,7 @@ static int __mkroute_input(struct sk_buff *skb,
        rth->rt_iif     = 0;
        rth->rt_pmtu    = 0;
        rth->rt_gateway = 0;
+       rth->rt_uses_gateway = 0;
        INIT_LIST_HEAD(&rth->rt_uncached);
 
        rth->dst.input = ip_forward;
@@ -1656,6 +1659,7 @@ local_input:
        rth->rt_iif     = 0;
        rth->rt_pmtu    = 0;
        rth->rt_gateway = 0;
+       rth->rt_uses_gateway = 0;
        INIT_LIST_HEAD(&rth->rt_uncached);
        if (res.type == RTN_UNREACHABLE) {
                rth->dst.input= ip_error;
@@ -1758,6 +1762,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
        struct in_device *in_dev;
        u16 type = res->type;
        struct rtable *rth;
+       bool do_cache;
 
        in_dev = __in_dev_get_rcu(dev_out);
        if (!in_dev)
@@ -1794,24 +1799,36 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
        }
 
        fnhe = NULL;
+       do_cache = fi != NULL;
        if (fi) {
                struct rtable __rcu **prth;
+               struct fib_nh *nh = &FIB_RES_NH(*res);
 
-               fnhe = find_exception(&FIB_RES_NH(*res), fl4->daddr);
+               fnhe = find_exception(nh, fl4->daddr);
                if (fnhe)
                        prth = &fnhe->fnhe_rth;
-               else
-                       prth = __this_cpu_ptr(FIB_RES_NH(*res).nh_pcpu_rth_output);
+               else {
+                       if (unlikely(fl4->flowi4_flags &
+                                    FLOWI_FLAG_KNOWN_NH &&
+                                    !(nh->nh_gw &&
+                                      nh->nh_scope == RT_SCOPE_LINK))) {
+                               do_cache = false;
+                               goto add;
+                       }
+                       prth = __this_cpu_ptr(nh->nh_pcpu_rth_output);
+               }
                rth = rcu_dereference(*prth);
                if (rt_cache_valid(rth)) {
                        dst_hold(&rth->dst);
                        return rth;
                }
        }
+
+add:
        rth = rt_dst_alloc(dev_out,
                           IN_DEV_CONF_GET(in_dev, NOPOLICY),
                           IN_DEV_CONF_GET(in_dev, NOXFRM),
-                          fi);
+                          do_cache);
        if (!rth)
                return ERR_PTR(-ENOBUFS);
 
@@ -1824,6 +1841,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
        rth->rt_iif     = orig_oif ? : 0;
        rth->rt_pmtu    = 0;
        rth->rt_gateway = 0;
+       rth->rt_uses_gateway = 0;
        INIT_LIST_HEAD(&rth->rt_uncached);
 
        RT_CACHE_STAT_INC(out_slow_tot);
@@ -2102,6 +2120,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
                rt->rt_flags = ort->rt_flags;
                rt->rt_type = ort->rt_type;
                rt->rt_gateway = ort->rt_gateway;
+               rt->rt_uses_gateway = ort->rt_uses_gateway;
 
                INIT_LIST_HEAD(&rt->rt_uncached);
 
@@ -2180,12 +2199,22 @@ static int rt_fill_info(struct net *net,  __be32 dst, __be32 src,
                if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr))
                        goto nla_put_failure;
        }
-       if (rt->rt_gateway &&
+       if (rt->rt_uses_gateway &&
            nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway))
                goto nla_put_failure;
 
+       expires = rt->dst.expires;
+       if (expires) {
+               unsigned long now = jiffies;
+
+               if (time_before(now, expires))
+                       expires -= now;
+               else
+                       expires = 0;
+       }
+
        memcpy(metrics, dst_metrics_ptr(&rt->dst), sizeof(metrics));
-       if (rt->rt_pmtu)
+       if (rt->rt_pmtu && expires)
                metrics[RTAX_MTU - 1] = rt->rt_pmtu;
        if (rtnetlink_put_metrics(skb, metrics) < 0)
                goto nla_put_failure;
@@ -2195,13 +2224,6 @@ static int rt_fill_info(struct net *net,  __be32 dst, __be32 src,
                goto nla_put_failure;
 
        error = rt->dst.error;
-       expires = rt->dst.expires;
-       if (expires) {
-               if (time_before(jiffies, expires))
-                       expires -= jiffies;
-               else
-                       expires = 0;
-       }
 
        if (rt_is_input_route(rt)) {
                if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
index 681ea2f413e2ff624c41b8301d0095cf46ac73d9..05c5ab8d983c462f75ab6143ca653669d36c1005 100644 (file)
@@ -91,6 +91,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
                                              RTCF_LOCAL);
        xdst->u.rt.rt_type = rt->rt_type;
        xdst->u.rt.rt_gateway = rt->rt_gateway;
+       xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway;
        xdst->u.rt.rt_pmtu = rt->rt_pmtu;
        INIT_LIST_HEAD(&xdst->u.rt.rt_uncached);
 
index e22e6d88bac68173ecd6ca06e5bb7161583910ff..a974247a9ae40bdb6c83cf5a60a6432761bd84e7 100644 (file)
@@ -822,13 +822,6 @@ out:
        return segs;
 }
 
-struct ipv6_gro_cb {
-       struct napi_gro_cb napi;
-       int proto;
-};
-
-#define IPV6_GRO_CB(skb) ((struct ipv6_gro_cb *)(skb)->cb)
-
 static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
                                         struct sk_buff *skb)
 {
@@ -874,28 +867,31 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
                iph = ipv6_hdr(skb);
        }
 
-       IPV6_GRO_CB(skb)->proto = proto;
+       NAPI_GRO_CB(skb)->proto = proto;
 
        flush--;
        nlen = skb_network_header_len(skb);
 
        for (p = *head; p; p = p->next) {
-               struct ipv6hdr *iph2;
+               const struct ipv6hdr *iph2;
+               __be32 first_word; /* <Version:4><Traffic_Class:8><Flow_Label:20> */
 
                if (!NAPI_GRO_CB(p)->same_flow)
                        continue;
 
                iph2 = ipv6_hdr(p);
+               first_word = *(__be32 *)iph ^ *(__be32 *)iph2 ;
 
-               /* All fields must match except length. */
+               /* All fields must match except length and Traffic Class. */
                if (nlen != skb_network_header_len(p) ||
-                   memcmp(iph, iph2, offsetof(struct ipv6hdr, payload_len)) ||
+                   (first_word & htonl(0xF00FFFFF)) ||
                    memcmp(&iph->nexthdr, &iph2->nexthdr,
                           nlen - offsetof(struct ipv6hdr, nexthdr))) {
                        NAPI_GRO_CB(p)->same_flow = 0;
                        continue;
                }
-
+               /* flush if Traffic Class fields are different */
+               NAPI_GRO_CB(p)->flush |= !!(first_word & htonl(0x0FF00000));
                NAPI_GRO_CB(p)->flush |= flush;
        }
 
@@ -927,7 +923,7 @@ static int ipv6_gro_complete(struct sk_buff *skb)
                                 sizeof(*iph));
 
        rcu_read_lock();
-       ops = rcu_dereference(inet6_protos[IPV6_GRO_CB(skb)->proto]);
+       ops = rcu_dereference(inet6_protos[NAPI_GRO_CB(skb)->proto]);
        if (WARN_ON(!ops || !ops->gro_complete))
                goto out_unlock;
 
index 56f6d5d81a7735d33ea7cc777945024850dfe177..cc4c8095681ad70dd0c40fa1a5459debed396a01 100644 (file)
@@ -50,6 +50,7 @@ enum {
                                      * local
                                      */
        IP_VS_RT_MODE_CONNECT   = 8, /* Always bind route to saddr */
+       IP_VS_RT_MODE_KNOWN_NH  = 16,/* Route via remote addr */
 };
 
 /*
@@ -113,6 +114,8 @@ static struct rtable *do_output_route4(struct net *net, __be32 daddr,
        fl4.daddr = daddr;
        fl4.saddr = (rt_mode & IP_VS_RT_MODE_CONNECT) ? *saddr : 0;
        fl4.flowi4_tos = rtos;
+       fl4.flowi4_flags = (rt_mode & IP_VS_RT_MODE_KNOWN_NH) ?
+                          FLOWI_FLAG_KNOWN_NH : 0;
 
 retry:
        rt = ip_route_output_key(net, &fl4);
@@ -1061,7 +1064,8 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        if (!(rt = __ip_vs_get_out_rt(skb, cp->dest, cp->daddr.ip,
                                      RT_TOS(iph->tos),
                                      IP_VS_RT_MODE_LOCAL |
-                                       IP_VS_RT_MODE_NON_LOCAL, NULL)))
+                                     IP_VS_RT_MODE_NON_LOCAL |
+                                     IP_VS_RT_MODE_KNOWN_NH, NULL)))
                goto tx_error_icmp;
        if (rt->rt_flags & RTCF_LOCAL) {
                ip_rt_put(rt);
index 0f2e3ad69c473afb5f7fcdbc1cbb05b5c0be46f7..01e944a017a4db6be96c3d4a8e7adc8d7890b34e 100644 (file)
@@ -169,6 +169,8 @@ static void netlink_sock_destruct(struct sock *sk)
        if (nlk->cb) {
                if (nlk->cb->done)
                        nlk->cb->done(nlk->cb);
+
+               module_put(nlk->cb->module);
                netlink_destroy_callback(nlk->cb);
        }
 
@@ -1758,6 +1760,7 @@ static int netlink_dump(struct sock *sk)
        nlk->cb = NULL;
        mutex_unlock(nlk->cb_mutex);
 
+       module_put(cb->module);
        netlink_consume_callback(cb);
        return 0;
 
@@ -1767,9 +1770,9 @@ errout_skb:
        return err;
 }
 
-int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
-                      const struct nlmsghdr *nlh,
-                      struct netlink_dump_control *control)
+int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+                        const struct nlmsghdr *nlh,
+                        struct netlink_dump_control *control)
 {
        struct netlink_callback *cb;
        struct sock *sk;
@@ -1784,6 +1787,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
        cb->done = control->done;
        cb->nlh = nlh;
        cb->data = control->data;
+       cb->module = control->module;
        cb->min_dump_alloc = control->min_dump_alloc;
        atomic_inc(&skb->users);
        cb->skb = skb;
@@ -1794,19 +1798,28 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
                return -ECONNREFUSED;
        }
        nlk = nlk_sk(sk);
-       /* A dump is in progress... */
+
        mutex_lock(nlk->cb_mutex);
+       /* A dump is in progress... */
        if (nlk->cb) {
                mutex_unlock(nlk->cb_mutex);
                netlink_destroy_callback(cb);
-               sock_put(sk);
-               return -EBUSY;
+               ret = -EBUSY;
+               goto out;
        }
+       /* add reference of module which cb->dump belongs to */
+       if (!try_module_get(cb->module)) {
+               mutex_unlock(nlk->cb_mutex);
+               netlink_destroy_callback(cb);
+               ret = -EPROTONOSUPPORT;
+               goto out;
+       }
+
        nlk->cb = cb;
        mutex_unlock(nlk->cb_mutex);
 
        ret = netlink_dump(sk);
-
+out:
        sock_put(sk);
 
        if (ret)
@@ -1817,7 +1830,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
         */
        return -EINTR;
 }
-EXPORT_SYMBOL(netlink_dump_start);
+EXPORT_SYMBOL(__netlink_dump_start);
 
 void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
 {