diff --git a/[refs] b/[refs] index 922de175becb..cb637cd3fbf3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 72b43d0898e97f588293b4a24b33c58c46633d81 +refs/heads/master: 6cae913d6c06557fee81aa8a181eafcc9a76516a diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index ff652c77a0a5..5780dad6a3cb 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -1950,6 +1950,14 @@ 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 diff --git a/trunk/drivers/net/bfin_mac.c b/trunk/drivers/net/bfin_mac.c index fe75e7a9742e..ce1e5e9d06f6 100644 --- a/trunk/drivers/net/bfin_mac.c +++ b/trunk/drivers/net/bfin_mac.c @@ -8,11 +8,6 @@ * 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 #include #include @@ -46,7 +41,12 @@ #include "bfin_mac.h" -MODULE_AUTHOR("Bryan Wu, Luke Yang"); +#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_LICENSE("GPL"); MODULE_DESCRIPTION(DRV_DESC); MODULE_ALIAS("platform:bfin_mac"); @@ -189,7 +189,8 @@ 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) { - pr_notice("init: low on mem - packet dropped\n"); + printk(KERN_NOTICE DRV_NAME + ": init: low on mem - packet dropped\n"); goto init_error; } skb_reserve(new_skb, NET_IP_ALIGN); @@ -239,7 +240,7 @@ static int desc_list_init(void) init_error: desc_list_free(); - pr_err("kmalloc failed\n"); + printk(KERN_ERR DRV_NAME ": kmalloc failed\n"); return -ENOMEM; } @@ -258,7 +259,8 @@ static int bfin_mdio_poll(void) while ((bfin_read_EMAC_STAADD()) & STABUSY) { udelay(1); if (timeout_cnt-- < 0) { - pr_err("wait MDC/MDIO transaction to complete timeout\n"); + printk(KERN_ERR DRV_NAME + ": wait MDC/MDIO transaction to complete timeout\n"); return -ETIMEDOUT; } } @@ -348,9 +350,9 @@ static void bfin_mac_adjust_link(struct net_device *dev) opmode &= ~RMII_10; break; default: - netdev_warn(dev, - "Ack! Speed (%d) is not 10/100!\n", - phydev->speed); + printk(KERN_WARNING + "%s: Ack! Speed (%d) is not 10/100!\n", + DRV_NAME, phydev->speed); break; } bfin_write_EMAC_OPMODE(opmode); @@ -415,13 +417,14 @@ 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) { - netdev_err(dev, "no phy device found\n"); + printk(KERN_INFO "%s: Don't found any phy device at all\n", + dev->name); return -ENODEV; } if (phy_mode != PHY_INTERFACE_MODE_RMII && phy_mode != PHY_INTERFACE_MODE_MII) { - netdev_err(dev, "invalid phy interface mode\n"); + printk(KERN_INFO "%s: Invalid phy interface mode\n", dev->name); return -EINVAL; } @@ -429,7 +432,7 @@ static int mii_probe(struct net_device *dev, int phy_mode) 0, phy_mode); if (IS_ERR(phydev)) { - netdev_err(dev, "could not attach PHY\n"); + printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); return PTR_ERR(phydev); } @@ -450,10 +453,11 @@ static int mii_probe(struct net_device *dev, int phy_mode) lp->old_duplex = -1; lp->phydev = phydev; - 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); + 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); return 0; } @@ -498,7 +502,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, KBUILD_MODNAME); + strcpy(info->driver, DRV_NAME); strcpy(info->version, DRV_VERSION); strcpy(info->fw_version, "N/A"); strcpy(info->bus_info, dev_name(&dev->dev)); @@ -558,7 +562,7 @@ static const struct ethtool_ops bfin_mac_ethtool_ops = { }; /**************************************************************************/ -static void setup_system_regs(struct net_device *dev) +void setup_system_regs(struct net_device *dev) { struct bfin_mac_local *lp = netdev_priv(dev); int i; @@ -588,10 +592,6 @@ static 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,7 +827,8 @@ 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) - netdev_err(netdev, "timestamp the TX packet failed\n"); + printk(KERN_ERR DRV_NAME + ": fails to timestamp the TX packet\n"); else { struct skb_shared_hwtstamps shhwtstamps; u64 ns; @@ -1082,7 +1083,8 @@ 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) { - netdev_notice(dev, "rx: receive error - packet dropped\n"); + printk(KERN_NOTICE DRV_NAME + ": rx: receive error - packet dropped\n"); dev->stats.rx_dropped++; goto out; } @@ -1092,7 +1094,8 @@ static void bfin_mac_rx(struct net_device *dev) new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN); if (!new_skb) { - netdev_notice(dev, "rx: low on mem - packet dropped\n"); + printk(KERN_NOTICE DRV_NAME + ": rx: low on mem - packet dropped\n"); dev->stats.rx_dropped++; goto out; } @@ -1210,7 +1213,7 @@ static int bfin_mac_enable(struct phy_device *phydev) int ret; u32 opmode; - pr_debug("%s\n", __func__); + pr_debug("%s: %s\n", DRV_NAME, __func__); /* Set RX DMA */ bfin_write_DMA1_NEXT_DESC_PTR(&(rx_list_head->desc_a)); @@ -1293,7 +1296,7 @@ static void bfin_mac_multicast_hash(struct net_device *dev) addrs = ha->addr; /* skip non-multicast addresses */ - if (!is_multicast_ether_addr(addrs)) + if (!(*addrs & 1)) continue; crc = ether_crc(ETH_ALEN, addrs); @@ -1320,7 +1323,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev) u32 sysctl; if (dev->flags & IFF_PROMISC) { - netdev_info(dev, "set promisc mode\n"); + printk(KERN_INFO "%s: set to promisc mode\n", dev->name); sysctl = bfin_read_EMAC_OPMODE(); sysctl |= PR; bfin_write_EMAC_OPMODE(sysctl); @@ -1390,7 +1393,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)) { - netdev_warn(dev, "no valid ethernet hw addr\n"); + printk(KERN_WARNING DRV_NAME ": no valid ethernet hw addr\n"); return -EINVAL; } @@ -1524,9 +1527,6 @@ 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.. */ - netdev_info(ndev, "%s, Version %s\n", DRV_DESC, DRV_VERSION); + dev_info(&pdev->dev, "%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, KBUILD_MODNAME); + rc = peripheral_request_list(pin_req, DRV_NAME); 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 = KBUILD_MODNAME, + .name = DRV_NAME, .owner = THIS_MODULE, }, }; diff --git a/trunk/drivers/net/bfin_mac.h b/trunk/drivers/net/bfin_mac.h index f8559ac9a403..aed68bed2365 100644 --- a/trunk/drivers/net/bfin_mac.h +++ b/trunk/drivers/net/bfin_mac.h @@ -17,14 +17,7 @@ #include #include -/* - * 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) @@ -75,6 +68,7 @@ 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 */ @@ -82,9 +76,6 @@ 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; diff --git a/trunk/drivers/net/cxgb4vf/cxgb4vf_main.c b/trunk/drivers/net/cxgb4vf/cxgb4vf_main.c index 56166ae2059f..3c403f895750 100644 --- a/trunk/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/trunk/drivers/net/cxgb4vf/cxgb4vf_main.c @@ -749,19 +749,13 @@ static int cxgb4vf_open(struct net_device *dev) netif_set_real_num_tx_queues(dev, pi->nqsets); err = netif_set_real_num_rx_queues(dev, pi->nqsets); if (err) - goto err_unwind; + return err; + set_bit(pi->port_id, &adapter->open_device_map); err = link_start(dev); if (err) - goto err_unwind; - + return err; netif_tx_start_all_queues(dev); - set_bit(pi->port_id, &adapter->open_device_map); return 0; - -err_unwind: - if (adapter->open_device_map == 0) - adapter_down(adapter); - return err; } /* @@ -770,12 +764,13 @@ static int cxgb4vf_open(struct net_device *dev) */ static int cxgb4vf_stop(struct net_device *dev) { + int ret; struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; netif_tx_stop_all_queues(dev); netif_carrier_off(dev); - t4vf_enable_vi(adapter, pi->viid, false, false); + ret = t4vf_enable_vi(adapter, pi->viid, false, false); pi->link_cfg.link_ok = 0; clear_bit(pi->port_id, &adapter->open_device_map); diff --git a/trunk/drivers/net/cxgb4vf/t4vf_hw.c b/trunk/drivers/net/cxgb4vf/t4vf_hw.c index 0f51c80475ce..e4bec78c8e3f 100644 --- a/trunk/drivers/net/cxgb4vf/t4vf_hw.c +++ b/trunk/drivers/net/cxgb4vf/t4vf_hw.c @@ -147,20 +147,9 @@ 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 */ diff --git a/trunk/drivers/net/ehea/ehea.h b/trunk/drivers/net/ehea/ehea.h index 6c7257bd73fc..a724a2d14506 100644 --- a/trunk/drivers/net/ehea/ehea.h +++ b/trunk/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include #define DRV_NAME "ehea" -#define DRV_VERSION "EHEA_0107" +#define DRV_VERSION "EHEA_0106" /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/trunk/drivers/net/ehea/ehea_main.c b/trunk/drivers/net/ehea/ehea_main.c index f75d3144b8a5..1032b5bbe238 100644 --- a/trunk/drivers/net/ehea/ehea_main.c +++ b/trunk/drivers/net/ehea/ehea_main.c @@ -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 - 1); + ehea_update_rq1a(pr->qp, i); } static int ehea_refill_rq_def(struct ehea_port_res *pr, @@ -1329,7 +1329,9 @@ 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, pr->rq1_skba.len); + ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1 + - init_attr->act_nr_rwqes_rq2 + - init_attr->act_nr_rwqes_rq3 - 1); ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1); diff --git a/trunk/drivers/net/mlx4/en_netdev.c b/trunk/drivers/net/mlx4/en_netdev.c index 897f576b8b17..6d6806b361e3 100644 --- a/trunk/drivers/net/mlx4/en_netdev.c +++ b/trunk/drivers/net/mlx4/en_netdev.c @@ -972,8 +972,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, int i; int err; - dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), - prof->tx_ring_num, prof->rx_ring_num); + dev = alloc_etherdev_mq(sizeof(struct mlx4_en_priv), prof->tx_ring_num); if (dev == NULL) { mlx4_err(mdev, "Net device allocation failed\n"); return -ENOMEM; diff --git a/trunk/drivers/net/pcmcia/pcnet_cs.c b/trunk/drivers/net/pcmcia/pcnet_cs.c index e953793a33ff..2c158910f7ea 100644 --- a/trunk/drivers/net/pcmcia/pcnet_cs.c +++ b/trunk/drivers/net/pcmcia/pcnet_cs.c @@ -1536,7 +1536,6 @@ 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), diff --git a/trunk/drivers/net/ppp_async.c b/trunk/drivers/net/ppp_async.c index a1b82c9c67d2..78d70a6481bf 100644 --- a/trunk/drivers/net/ppp_async.c +++ b/trunk/drivers/net/ppp_async.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -543,7 +542,7 @@ ppp_async_encode(struct asyncppp *ap) data = ap->tpkt->data; count = ap->tpkt->len; fcs = ap->tfcs; - proto = get_unaligned_be16(data); + proto = (data[0] << 8) + data[1]; /* * LCP packets with code values between 1 (configure-reqest) @@ -964,7 +963,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, code = data[0]; if (code != CONFACK && code != CONFREQ) return; - dlen = get_unaligned_be16(data + 2); + dlen = (data[2] << 8) + data[3]; if (len < dlen) return; /* packet got truncated or length is bogus */ @@ -998,14 +997,15 @@ 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 = get_unaligned_be16(data + 2); + val = (data[2] << 8) + data[3]; if (inbound) ap->mru = val; else ap->chan.mtu = val; break; case LCP_ASYNCMAP: - val = get_unaligned_be32(data + 2); + val = (data[2] << 24) + (data[3] << 16) + + (data[4] << 8) + data[5]; if (inbound) ap->raccm = val; else diff --git a/trunk/drivers/net/ppp_deflate.c b/trunk/drivers/net/ppp_deflate.c index 43583309a65d..695bc83e0cfd 100644 --- a/trunk/drivers/net/ppp_deflate.c +++ b/trunk/drivers/net/ppp_deflate.c @@ -41,7 +41,6 @@ #include #include -#include /* * State for a Deflate (de)compressor. @@ -233,9 +232,11 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, */ wptr[0] = PPP_ADDRESS(rptr); wptr[1] = PPP_CONTROL(rptr); - put_unaligned_be16(PPP_COMP, wptr + 2); + wptr[2] = PPP_COMP >> 8; + wptr[3] = PPP_COMP; wptr += PPP_HDRLEN; - put_unaligned_be16(state->seqno, wptr); + wptr[0] = state->seqno >> 8; + wptr[1] = state->seqno; wptr += DEFLATE_OVHD; olen = PPP_HDRLEN + DEFLATE_OVHD; state->strm.next_out = wptr; @@ -450,7 +451,7 @@ static int z_decompress(void *arg, unsigned char *ibuf, int isize, } /* Check the sequence number. */ - seq = get_unaligned_be16(ibuf + PPP_HDRLEN); + seq = (ibuf[PPP_HDRLEN] << 8) + ibuf[PPP_HDRLEN+1]; if (seq != (state->seqno & 0xffff)) { if (state->debug) printk(KERN_DEBUG "z_decompress%d: bad seq # %d, expected %d\n", diff --git a/trunk/drivers/net/ppp_generic.c b/trunk/drivers/net/ppp_generic.c index c7a6c4466978..6456484c0299 100644 --- a/trunk/drivers/net/ppp_generic.c +++ b/trunk/drivers/net/ppp_generic.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -211,7 +210,7 @@ struct ppp_net { }; /* Get the PPP protocol number from a skb */ -#define PPP_PROTO(skb) get_unaligned_be16((skb)->data) +#define PPP_PROTO(skb) (((skb)->data[0] << 8) + (skb)->data[1]) /* We limit the length of ppp->file.rq to this (arbitrary) value */ #define PPP_MAX_RQLEN 32 @@ -965,7 +964,8 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) pp = skb_push(skb, 2); proto = npindex_to_proto[npi]; - put_unaligned_be16(proto, pp); + pp[0] = proto >> 8; + pp[1] = proto; netif_stop_queue(dev); skb_queue_tail(&ppp->file.xq, skb); @@ -1473,7 +1473,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) q = skb_put(frag, flen + hdrlen); /* make the MP header */ - put_unaligned_be16(PPP_MP, q); + q[0] = PPP_MP >> 8; + q[1] = PPP_MP; if (ppp->flags & SC_MP_XSHORTSEQ) { q[2] = bits + ((ppp->nxseq >> 8) & 0xf); q[3] = ppp->nxseq; diff --git a/trunk/drivers/net/ppp_mppe.c b/trunk/drivers/net/ppp_mppe.c index 9a1849a83e2a..6d1a1b80cc3e 100644 --- a/trunk/drivers/net/ppp_mppe.c +++ b/trunk/drivers/net/ppp_mppe.c @@ -55,7 +55,6 @@ #include #include #include -#include #include "ppp_mppe.h" @@ -396,14 +395,16 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, */ obuf[0] = PPP_ADDRESS(ibuf); obuf[1] = PPP_CONTROL(ibuf); - put_unaligned_be16(PPP_COMP, obuf + 2); + obuf[2] = PPP_COMP >> 8; /* isize + MPPE_OVHD + 1 */ + obuf[3] = PPP_COMP; /* isize + MPPE_OVHD + 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); - put_unaligned_be16(state->ccount, obuf); + obuf[0] = state->ccount >> 8; + obuf[1] = state->ccount & 0xff; if (!state->stateful || /* stateless mode */ ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ diff --git a/trunk/drivers/net/ppp_synctty.c b/trunk/drivers/net/ppp_synctty.c index 4e6b72f57de8..4c95ec3fb8d4 100644 --- a/trunk/drivers/net/ppp_synctty.c +++ b/trunk/drivers/net/ppp_synctty.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #define PPP_VERSION "2.4.2" @@ -564,7 +563,7 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb) int islcp; data = skb->data; - proto = get_unaligned_be16(data); + proto = (data[0] << 8) + data[1]; /* LCP packets with codes between 1 (configure-request) * and 7 (code-reject) must be sent as though no options diff --git a/trunk/drivers/net/qlcnic/qlcnic.h b/trunk/drivers/net/qlcnic/qlcnic.h index 44e316fd67b8..9c2a02d204dc 100644 --- a/trunk/drivers/net/qlcnic/qlcnic.h +++ b/trunk/drivers/net/qlcnic/qlcnic.h @@ -34,8 +34,8 @@ #define _QLCNIC_LINUX_MAJOR 5 #define _QLCNIC_LINUX_MINOR 0 -#define _QLCNIC_LINUX_SUBVERSION 15 -#define QLCNIC_LINUX_VERSIONID "5.0.15" +#define _QLCNIC_LINUX_SUBVERSION 14 +#define QLCNIC_LINUX_VERSIONID "5.0.14" #define QLCNIC_DRV_IDC_VER 0x01 #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) @@ -289,26 +289,6 @@ 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 diff --git a/trunk/drivers/net/qlcnic/qlcnic_ethtool.c b/trunk/drivers/net/qlcnic/qlcnic_ethtool.c index 4c14510e2a87..1e7af709d395 100644 --- a/trunk/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/trunk/drivers/net/qlcnic/qlcnic_ethtool.c @@ -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; diff --git a/trunk/drivers/net/qlcnic/qlcnic_init.c b/trunk/drivers/net/qlcnic/qlcnic_init.c index a7f1d5b7e811..9b9c7c39d3ee 100644 --- a/trunk/drivers/net/qlcnic/qlcnic_init.c +++ b/trunk/drivers/net/qlcnic/qlcnic_init.c @@ -627,73 +627,12 @@ 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; - 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); + qlcnic_rom_fast_read(adapter, QLCNIC_FW_VERSION_OFFSET, (int *)&ver); ver = QLCNIC_DECODE_VERSION(ver); min_ver = QLCNIC_MIN_FW_VERSION; diff --git a/trunk/drivers/net/qlcnic/qlcnic_main.c b/trunk/drivers/net/qlcnic/qlcnic_main.c index 37c04b4fade3..11e3a46c0911 100644 --- a/trunk/drivers/net/qlcnic/qlcnic_main.c +++ b/trunk/drivers/net/qlcnic/qlcnic_main.c @@ -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, 0444); +module_param(qlcnic_mac_learn, int, 0644); MODULE_PARM_DESC(qlcnic_mac_learn, "Mac Filter (0=disabled, 1=enabled)"); static int use_msi = 1; -module_param(use_msi, int, 0444); +module_param(use_msi, int, 0644); MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled"); static int use_msi_x = 1; -module_param(use_msi_x, int, 0444); +module_param(use_msi_x, int, 0644); 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, 0444); +module_param(load_fw_file, int, 0644); MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file"); static int qlcnic_config_npars; -module_param(qlcnic_config_npars, int, 0444); +module_param(qlcnic_config_npars, int, 0644); MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled"); static int __devinit qlcnic_probe(struct pci_dev *pdev, diff --git a/trunk/drivers/net/r8169.c b/trunk/drivers/net/r8169.c index bb8645ab247c..dd758cdb55c4 100644 --- a/trunk/drivers/net/r8169.c +++ b/trunk/drivers/net/r8169.c @@ -1632,134 +1632,36 @@ 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 index, fw_size = fw->size / sizeof(*phytable); - u32 predata, count; + size_t i; if (fw->size % sizeof(*phytable)) { netif_err(tp, probe, dev, "odd sized firmware %zd\n", fw->size); return; } - for (index = 0; index < fw_size; index++) { - u32 action = le32_to_cpu(phytable[index]); - u32 regno = (action & 0x0fff0000) >> 16; + for (i = 0; i < fw->size / sizeof(*phytable); i++) { + u32 action = le32_to_cpu(phytable[i]); - 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; - - 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; - } + if (!action) 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); + if ((action & 0xf0000000) != PHY_WRITE) { + netif_err(tp, probe, dev, + "unknown action 0x%08x\n", action); return; } } - predata = 0; - count = 0; - - for (index = 0; index < fw_size; ) { - u32 action = le32_to_cpu(phytable[index]); + while (i-- != 0) { + u32 action = le32_to_cpu(*phytable); u32 data = action & 0x0000ffff; - u32 regno = (action & 0x0fff0000) >> 16; - - if (!action) - break; + u32 reg = (action & 0x0fff0000) >> 16; 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, 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++; + rtl_writephy(tp, reg, data); + phytable++; 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(); } diff --git a/trunk/drivers/net/ucc_geth.c b/trunk/drivers/net/ucc_geth.c index dc6cb974f25d..acbdab3d66ca 100644 --- a/trunk/drivers/net/ucc_geth.c +++ b/trunk/drivers/net/ucc_geth.c @@ -2031,7 +2031,7 @@ static void ucc_geth_set_multi(struct net_device *dev) netdev_for_each_mc_addr(ha, dev) { /* Only support group multicast for now. */ - if (!is_multicast_ether_addr(ha->addr)) + if (!(ha->addr[0] & 1)) continue; /* Ask CPM to run CRC and set bit in diff --git a/trunk/drivers/net/wireless/ath/ath9k/hw.c b/trunk/drivers/net/wireless/ath/ath9k/hw.c index fde978665e07..4a44f711045e 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/hw.c +++ b/trunk/drivers/net/wireless/ath/ath9k/hw.c @@ -436,9 +436,10 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah) static int ath9k_hw_post_init(struct ath_hw *ah) { + struct ath_common *common = ath9k_hw_common(ah); int ecode; - if (!AR_SREV_9271(ah)) { + if (common->bus_ops->ath_bus_type != ATH_USB) { if (!ath9k_hw_chip_test(ah)) return -ENODEV; } diff --git a/trunk/include/linux/bfin_mac.h b/trunk/include/linux/bfin_mac.h index a69554ef8476..904dec7d03a1 100644 --- a/trunk/include/linux/bfin_mac.h +++ b/trunk/include/linux/bfin_mac.h @@ -24,7 +24,6 @@ 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 diff --git a/trunk/include/linux/etherdevice.h b/trunk/include/linux/etherdevice.h index bec8b82889bf..f16a01081e15 100644 --- a/trunk/include/linux/etherdevice.h +++ b/trunk/include/linux/etherdevice.h @@ -48,10 +48,8 @@ extern int eth_validate_addr(struct net_device *dev); -extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs, - unsigned int rxqs); +extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); #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. diff --git a/trunk/include/linux/if_bridge.h b/trunk/include/linux/if_bridge.h index dd3f20139640..f7e73c338c40 100644 --- a/trunk/include/linux/if_bridge.h +++ b/trunk/include/linux/if_bridge.h @@ -103,7 +103,7 @@ struct __fdb_entry { extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); -typedef int br_should_route_hook_t(struct sk_buff *skb); +typedef int (*br_should_route_hook_t)(struct sk_buff *skb); extern br_should_route_hook_t __rcu *br_should_route_hook; #endif diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index be4957cf6511..de2bfe6da359 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -2191,15 +2191,11 @@ 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_mqs(int sizeof_priv, const char *name, +extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, void (*setup)(struct net_device *), - unsigned int txqs, unsigned int rxqs); + unsigned int queue_count); #define alloc_netdev(sizeof_priv, name, setup) \ - 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) - + alloc_netdev_mq(sizeof_priv, name, setup, 1) extern int register_netdev(struct net_device *dev); extern void unregister_netdev(struct net_device *dev); diff --git a/trunk/include/linux/netfilter/x_tables.h b/trunk/include/linux/netfilter/x_tables.h index 6712e713b299..742bec051440 100644 --- a/trunk/include/linux/netfilter/x_tables.h +++ b/trunk/include/linux/netfilter/x_tables.h @@ -472,7 +472,7 @@ extern void xt_free_table_info(struct xt_table_info *info); * necessary for reading the counters. */ struct xt_info_lock { - seqlock_t lock; + spinlock_t lock; unsigned char readers; }; DECLARE_PER_CPU(struct xt_info_lock, xt_info_locks); @@ -497,7 +497,7 @@ static inline void xt_info_rdlock_bh(void) local_bh_disable(); lock = &__get_cpu_var(xt_info_locks); if (likely(!lock->readers++)) - write_seqlock(&lock->lock); + spin_lock(&lock->lock); } static inline void xt_info_rdunlock_bh(void) @@ -505,7 +505,7 @@ static inline void xt_info_rdunlock_bh(void) struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks); if (likely(!--lock->readers)) - write_sequnlock(&lock->lock); + spin_unlock(&lock->lock); local_bh_enable(); } @@ -516,12 +516,12 @@ static inline void xt_info_rdunlock_bh(void) */ static inline void xt_info_wrlock(unsigned int cpu) { - write_seqlock(&per_cpu(xt_info_locks, cpu).lock); + spin_lock(&per_cpu(xt_info_locks, cpu).lock); } static inline void xt_info_wrunlock(unsigned int cpu) { - write_sequnlock(&per_cpu(xt_info_locks, cpu).lock); + spin_unlock(&per_cpu(xt_info_locks, cpu).lock); } /* diff --git a/trunk/include/net/ah.h b/trunk/include/net/ah.h index be7798dea6f4..f0129f79a31a 100644 --- a/trunk/include/net/ah.h +++ b/trunk/include/net/ah.h @@ -4,7 +4,7 @@ #include /* This is the maximum truncated ICV length that we know of. */ -#define MAX_AH_AUTH_LEN 16 +#define MAX_AH_AUTH_LEN 12 struct crypto_ahash; diff --git a/trunk/include/net/arp.h b/trunk/include/net/arp.h index 91f0568a04ef..f4cf6ce66586 100644 --- a/trunk/include/net/arp.h +++ b/trunk/include/net/arp.h @@ -25,6 +25,5 @@ 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 */ diff --git a/trunk/include/net/phonet/phonet.h b/trunk/include/net/phonet/phonet.h index 5395e09187df..d5df797f9540 100644 --- a/trunk/include/net/phonet/phonet.h +++ b/trunk/include/net/phonet/phonet.h @@ -107,8 +107,8 @@ struct phonet_protocol { int sock_type; }; -int phonet_proto_register(unsigned int protocol, struct phonet_protocol *pp); -void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp); +int phonet_proto_register(int protocol, struct phonet_protocol *pp); +void phonet_proto_unregister(int protocol, struct phonet_protocol *pp); int phonet_sysctl_init(void); void phonet_sysctl_exit(void); diff --git a/trunk/include/net/sch_generic.h b/trunk/include/net/sch_generic.h index e9eee99d8b1f..0af57ebae762 100644 --- a/trunk/include/net/sch_generic.h +++ b/trunk/include/net/sch_generic.h @@ -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(const struct sk_buff *skb) +static inline struct qdisc_skb_cb *qdisc_skb_cb(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(const struct sk_buff *skb) +static inline unsigned int qdisc_pkt_len(struct sk_buff *skb) { return qdisc_skb_cb(skb)->pkt_len; } @@ -426,18 +426,10 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch) return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; } - -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) +static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len) { - bstats_update(&sch->bstats, skb); + sch->bstats.bytes += len; + sch->bstats.packets++; } static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, @@ -445,7 +437,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_bstats_update(sch, skb); + __qdisc_update_bstats(sch, qdisc_pkt_len(skb)); return NET_XMIT_SUCCESS; } diff --git a/trunk/net/ax25/af_ax25.c b/trunk/net/ax25/af_ax25.c index 6da5daeebab7..bb86d2932394 100644 --- a/trunk/net/ax25/af_ax25.c +++ b/trunk/net/ax25/af_ax25.c @@ -1392,7 +1392,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, ax25_cb *ax25; int err = 0; - memset(fsa, 0, sizeof(*fsa)); + memset(fsa, 0, sizeof(fsa)); lock_sock(sk); ax25 = ax25_sk(sk); diff --git a/trunk/net/caif/caif_socket.c b/trunk/net/caif/caif_socket.c index 8184c031d028..1bf0cf503796 100644 --- a/trunk/net/caif/caif_socket.c +++ b/trunk/net/caif/caif_socket.c @@ -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; diff --git a/trunk/net/caif/chnl_net.c b/trunk/net/caif/chnl_net.c index fa9dab372b68..84a422c98941 100644 --- a/trunk/net/caif/chnl_net.c +++ b/trunk/net/caif/chnl_net.c @@ -76,8 +76,6 @@ 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); @@ -92,21 +90,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) * send the packet to the net stack. */ skb->dev = priv->netdev; - - /* 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; - } + skb->protocol = htons(ETH_P_IP); /* If we change the header in loop mode, the checksum is corrupted. */ if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index a3ef808b5e36..3fe443be4b15 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -2297,10 +2297,7 @@ 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_skb_cb(skb)->pkt_len = skb->len; - qdisc_bstats_update(q, skb); - + __qdisc_update_bstats(q, skb->len); if (sch_direct_xmit(skb, q, dev, txq, root_lock)) { if (unlikely(contended)) { spin_unlock(&q->busylock); @@ -5620,20 +5617,18 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) } /** - * alloc_netdev_mqs - allocate network device + * alloc_netdev_mq - allocate network device * @sizeof_priv: size of private data to allocate space for * @name: device name format string * @setup: callback to initialize device - * @txqs: the number of TX subqueues to allocate - * @rxqs: the number of RX subqueues to allocate + * @queue_count: the number of 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. + * for each queue on the device at the end of the netdevice. */ -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 *alloc_netdev_mq(int sizeof_priv, const char *name, + void (*setup)(struct net_device *), unsigned int queue_count) { struct net_device *dev; size_t alloc_size; @@ -5641,20 +5636,12 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, BUG_ON(strlen(name) >= sizeof(dev->name)); - if (txqs < 1) { + if (queue_count < 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 */ @@ -5685,14 +5672,14 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, dev_net_set(dev, &init_net); - dev->num_tx_queues = txqs; - dev->real_num_tx_queues = txqs; + dev->num_tx_queues = queue_count; + dev->real_num_tx_queues = queue_count; if (netif_alloc_netdev_queues(dev)) goto free_pcpu; #ifdef CONFIG_RPS - dev->num_rx_queues = rxqs; - dev->real_num_rx_queues = rxqs; + dev->num_rx_queues = queue_count; + dev->real_num_rx_queues = queue_count; if (netif_alloc_rx_queues(dev)) goto free_pcpu; #endif @@ -5720,7 +5707,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, kfree(p); return NULL; } -EXPORT_SYMBOL(alloc_netdev_mqs); +EXPORT_SYMBOL(alloc_netdev_mq); /** * free_netdev - free network device diff --git a/trunk/net/ethernet/eth.c b/trunk/net/ethernet/eth.c index f9d7ac924f15..f00ef2f1d814 100644 --- a/trunk/net/ethernet/eth.c +++ b/trunk/net/ethernet/eth.c @@ -347,11 +347,10 @@ void ether_setup(struct net_device *dev) EXPORT_SYMBOL(ether_setup); /** - * alloc_etherdev_mqs - Allocates and sets up an Ethernet device + * alloc_etherdev_mq - Allocates and sets up an Ethernet device * @sizeof_priv: Size of additional driver-private structure to be allocated * for this Ethernet device - * @txqs: The number of TX queues this device has. - * @txqs: The number of RX queues this device has. + * @queue_count: The number of queues this device has. * * Fill in the fields of the device structure with Ethernet-generic * values. Basically does everything except registering the device. @@ -361,12 +360,11 @@ EXPORT_SYMBOL(ether_setup); * this private data area. */ -struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs, - unsigned int rxqs) +struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count) { - return alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs); + return alloc_netdev_mq(sizeof_priv, "eth%d", ether_setup, queue_count); } -EXPORT_SYMBOL(alloc_etherdev_mqs); +EXPORT_SYMBOL(alloc_etherdev_mq); static size_t _format_mac_addr(char *buf, int buflen, const unsigned char *addr, int len) diff --git a/trunk/net/ipv4/ah4.c b/trunk/net/ipv4/ah4.c index 86961bec70ab..880a5ec6dce0 100644 --- a/trunk/net/ipv4/ah4.c +++ b/trunk/net/ipv4/ah4.c @@ -314,15 +314,14 @@ 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; diff --git a/trunk/net/ipv4/arp.c b/trunk/net/ipv4/arp.c index 04c8b69fd426..a2fc7b961dbc 100644 --- a/trunk/net/ipv4/arp.c +++ b/trunk/net/ipv4/arp.c @@ -1143,23 +1143,6 @@ 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) { @@ -1180,6 +1163,7 @@ 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); @@ -1197,7 +1181,16 @@ static int arp_req_delete(struct net *net, struct arpreq *r, if (!dev) return -EINVAL; } - return arp_invalidate(dev, ip); + 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; } /* diff --git a/trunk/net/ipv4/inet_connection_sock.c b/trunk/net/ipv4/inet_connection_sock.c index 97e5fb765265..25e318153f14 100644 --- a/trunk/net/ipv4/inet_connection_sock.c +++ b/trunk/net/ipv4/inet_connection_sock.c @@ -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 || - ((1 << sk2->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))) { + sk2->sk_state == TCP_LISTEN) { 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,8 +122,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) (tb->num_owners < smallest_size || smallest_size == -1)) { smallest_size = tb->num_owners; smallest_rover = rover; - if (atomic_read(&hashinfo->bsockets) > (high - low) + 1 && - !inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { + if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { spin_unlock(&head->lock); snum = smallest_rover; goto have_snum; diff --git a/trunk/net/ipv4/netfilter/arp_tables.c b/trunk/net/ipv4/netfilter/arp_tables.c index e855fffaed95..3fac340a28d5 100644 --- a/trunk/net/ipv4/netfilter/arp_tables.c +++ b/trunk/net/ipv4/netfilter/arp_tables.c @@ -710,25 +710,42 @@ static void get_counters(const struct xt_table_info *t, struct arpt_entry *iter; unsigned int cpu; unsigned int i; + unsigned int curcpu = get_cpu(); + + /* Instead of clearing (by a previous call to memset()) + * the counters and using adds, we set the counters + * with data used by 'current' CPU + * + * Bottom half has to be disabled to prevent deadlock + * if new softirq were to run and call ipt_do_table + */ + local_bh_disable(); + i = 0; + xt_entry_foreach(iter, t->entries[curcpu], t->size) { + SET_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); + ++i; + } + local_bh_enable(); + /* Processing counters from other cpus, we can let bottom half enabled, + * (preemption is disabled) + */ for_each_possible_cpu(cpu) { - seqlock_t *lock = &per_cpu(xt_info_locks, cpu).lock; - + if (cpu == curcpu) + continue; i = 0; + local_bh_disable(); + xt_info_wrlock(cpu); xt_entry_foreach(iter, t->entries[cpu], t->size) { - u64 bcnt, pcnt; - unsigned int start; - - do { - start = read_seqbegin(lock); - bcnt = iter->counters.bcnt; - pcnt = iter->counters.pcnt; - } while (read_seqretry(lock, start)); - - ADD_COUNTER(counters[i], bcnt, pcnt); + ADD_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); ++i; } + xt_info_wrunlock(cpu); + local_bh_enable(); } + put_cpu(); } static struct xt_counters *alloc_counters(const struct xt_table *table) @@ -742,7 +759,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) * about). */ countersize = sizeof(struct xt_counters) * private->number; - counters = vzalloc(countersize); + counters = vmalloc(countersize); if (counters == NULL) return ERR_PTR(-ENOMEM); @@ -990,7 +1007,7 @@ static int __do_replace(struct net *net, const char *name, struct arpt_entry *iter; ret = 0; - counters = vzalloc(num_counters * sizeof(struct xt_counters)); + counters = vmalloc(num_counters * sizeof(struct xt_counters)); if (!counters) { ret = -ENOMEM; goto out; diff --git a/trunk/net/ipv4/netfilter/ip_tables.c b/trunk/net/ipv4/netfilter/ip_tables.c index 652efea013dc..a846d633b3b6 100644 --- a/trunk/net/ipv4/netfilter/ip_tables.c +++ b/trunk/net/ipv4/netfilter/ip_tables.c @@ -884,25 +884,42 @@ get_counters(const struct xt_table_info *t, struct ipt_entry *iter; unsigned int cpu; unsigned int i; + unsigned int curcpu = get_cpu(); + + /* Instead of clearing (by a previous call to memset()) + * the counters and using adds, we set the counters + * with data used by 'current' CPU. + * + * Bottom half has to be disabled to prevent deadlock + * if new softirq were to run and call ipt_do_table + */ + local_bh_disable(); + i = 0; + xt_entry_foreach(iter, t->entries[curcpu], t->size) { + SET_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); + ++i; + } + local_bh_enable(); + /* Processing counters from other cpus, we can let bottom half enabled, + * (preemption is disabled) + */ for_each_possible_cpu(cpu) { - seqlock_t *lock = &per_cpu(xt_info_locks, cpu).lock; - + if (cpu == curcpu) + continue; i = 0; + local_bh_disable(); + xt_info_wrlock(cpu); xt_entry_foreach(iter, t->entries[cpu], t->size) { - u64 bcnt, pcnt; - unsigned int start; - - do { - start = read_seqbegin(lock); - bcnt = iter->counters.bcnt; - pcnt = iter->counters.pcnt; - } while (read_seqretry(lock, start)); - - ADD_COUNTER(counters[i], bcnt, pcnt); + ADD_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); ++i; /* macro does multi eval of i */ } + xt_info_wrunlock(cpu); + local_bh_enable(); } + put_cpu(); } static struct xt_counters *alloc_counters(const struct xt_table *table) @@ -915,7 +932,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) (other than comefrom, which userspace doesn't care about). */ countersize = sizeof(struct xt_counters) * private->number; - counters = vzalloc(countersize); + counters = vmalloc(countersize); if (counters == NULL) return ERR_PTR(-ENOMEM); @@ -1186,7 +1203,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks, struct ipt_entry *iter; ret = 0; - counters = vzalloc(num_counters * sizeof(struct xt_counters)); + counters = vmalloc(num_counters * sizeof(struct xt_counters)); if (!counters) { ret = -ENOMEM; goto out; diff --git a/trunk/net/ipv6/ah6.c b/trunk/net/ipv6/ah6.c index 1aba54ae53c4..ee82d4ef26ce 100644 --- a/trunk/net/ipv6/ah6.c +++ b/trunk/net/ipv6/ah6.c @@ -538,16 +538,14 @@ 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; diff --git a/trunk/net/ipv6/inet6_connection_sock.c b/trunk/net/ipv6/inet6_connection_sock.c index d144e629d2b4..e46305d1815a 100644 --- a/trunk/net/ipv6/inet6_connection_sock.c +++ b/trunk/net/ipv6/inet6_connection_sock.c @@ -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 || - ((1 << sk2->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))) && + sk2->sk_state == TCP_LISTEN) && ipv6_rcv_saddr_equal(sk, sk2)) break; } diff --git a/trunk/net/ipv6/ip6_output.c b/trunk/net/ipv6/ip6_output.c index 5f8d242be3f3..94b5bf132b2e 100644 --- a/trunk/net/ipv6/ip6_output.c +++ b/trunk/net/ipv6/ip6_output.c @@ -401,9 +401,6 @@ int ip6_forward(struct sk_buff *skb) goto drop; } - if (skb->pkt_type != PACKET_HOST) - goto drop; - skb_forward_csum(skb); /* diff --git a/trunk/net/ipv6/netfilter/ip6_tables.c b/trunk/net/ipv6/netfilter/ip6_tables.c index 7d227c644f72..455582384ece 100644 --- a/trunk/net/ipv6/netfilter/ip6_tables.c +++ b/trunk/net/ipv6/netfilter/ip6_tables.c @@ -897,25 +897,42 @@ get_counters(const struct xt_table_info *t, struct ip6t_entry *iter; unsigned int cpu; unsigned int i; + unsigned int curcpu = get_cpu(); + + /* Instead of clearing (by a previous call to memset()) + * the counters and using adds, we set the counters + * with data used by 'current' CPU + * + * Bottom half has to be disabled to prevent deadlock + * if new softirq were to run and call ipt_do_table + */ + local_bh_disable(); + i = 0; + xt_entry_foreach(iter, t->entries[curcpu], t->size) { + SET_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); + ++i; + } + local_bh_enable(); + /* Processing counters from other cpus, we can let bottom half enabled, + * (preemption is disabled) + */ for_each_possible_cpu(cpu) { - seqlock_t *lock = &per_cpu(xt_info_locks, cpu).lock; - + if (cpu == curcpu) + continue; i = 0; + local_bh_disable(); + xt_info_wrlock(cpu); xt_entry_foreach(iter, t->entries[cpu], t->size) { - u64 bcnt, pcnt; - unsigned int start; - - do { - start = read_seqbegin(lock); - bcnt = iter->counters.bcnt; - pcnt = iter->counters.pcnt; - } while (read_seqretry(lock, start)); - - ADD_COUNTER(counters[i], bcnt, pcnt); + ADD_COUNTER(counters[i], iter->counters.bcnt, + iter->counters.pcnt); ++i; } + xt_info_wrunlock(cpu); + local_bh_enable(); } + put_cpu(); } static struct xt_counters *alloc_counters(const struct xt_table *table) @@ -928,7 +945,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) (other than comefrom, which userspace doesn't care about). */ countersize = sizeof(struct xt_counters) * private->number; - counters = vzalloc(countersize); + counters = vmalloc(countersize); if (counters == NULL) return ERR_PTR(-ENOMEM); @@ -1199,7 +1216,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks, struct ip6t_entry *iter; ret = 0; - counters = vzalloc(num_counters * sizeof(struct xt_counters)); + counters = vmalloc(num_counters * sizeof(struct xt_counters)); if (!counters) { ret = -ENOMEM; goto out; diff --git a/trunk/net/netfilter/nf_conntrack_netlink.c b/trunk/net/netfilter/nf_conntrack_netlink.c index 5cb8d3027b18..746140264b2d 100644 --- a/trunk/net/netfilter/nf_conntrack_netlink.c +++ b/trunk/net/netfilter/nf_conntrack_netlink.c @@ -645,23 +645,25 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); u_int8_t l3proto = nfmsg->nfgen_family; - spin_lock_bh(&nf_conntrack_lock); + rcu_read_lock(); last = (struct nf_conn *)cb->args[1]; for (; cb->args[0] < net->ct.htable_size; cb->args[0]++) { restart: - hlist_nulls_for_each_entry(h, n, &net->ct.hash[cb->args[0]], + hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[cb->args[0]], hnnode) { if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL) continue; ct = nf_ct_tuplehash_to_ctrack(h); + if (!atomic_inc_not_zero(&ct->ct_general.use)) + continue; /* Dump entries of a given L3 protocol number. * If it is not specified, ie. l3proto == 0, * then dump everything. */ if (l3proto && nf_ct_l3num(ct) != l3proto) - continue; + goto releasect; if (cb->args[1]) { if (ct != last) - continue; + goto releasect; cb->args[1] = 0; } if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, @@ -679,6 +681,8 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) if (acct) memset(acct, 0, sizeof(struct nf_conn_counter[IP_CT_DIR_MAX])); } +releasect: + nf_ct_put(ct); } if (cb->args[1]) { cb->args[1] = 0; @@ -686,7 +690,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) } } out: - spin_unlock_bh(&nf_conntrack_lock); + rcu_read_unlock(); if (last) nf_ct_put(last); diff --git a/trunk/net/netfilter/x_tables.c b/trunk/net/netfilter/x_tables.c index c94237631077..80463507420e 100644 --- a/trunk/net/netfilter/x_tables.c +++ b/trunk/net/netfilter/x_tables.c @@ -1325,8 +1325,7 @@ static int __init xt_init(void) for_each_possible_cpu(i) { struct xt_info_lock *lock = &per_cpu(xt_info_locks, i); - - seqlock_init(&lock->lock); + spin_lock_init(&lock->lock); lock->readers = 0; } diff --git a/trunk/net/phonet/af_phonet.c b/trunk/net/phonet/af_phonet.c index 1072b2c19d31..fd95beb72f5d 100644 --- a/trunk/net/phonet/af_phonet.c +++ b/trunk/net/phonet/af_phonet.c @@ -37,7 +37,7 @@ /* Transport protocol registration */ static struct phonet_protocol *proto_tab[PHONET_NPROTO] __read_mostly; -static struct phonet_protocol *phonet_proto_get(unsigned int protocol) +static struct phonet_protocol *phonet_proto_get(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(unsigned int protocol, +int __init_or_module phonet_proto_register(int protocol, struct phonet_protocol *pp) { int err = 0; @@ -481,7 +481,7 @@ int __init_or_module phonet_proto_register(unsigned int protocol, } EXPORT_SYMBOL(phonet_proto_register); -void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp) +void phonet_proto_unregister(int protocol, struct phonet_protocol *pp) { mutex_lock(&proto_tab_lock); BUG_ON(proto_tab[protocol] != pp); diff --git a/trunk/net/sched/act_csum.c b/trunk/net/sched/act_csum.c index 83ddfc07e45d..67dc7ce9b63a 100644 --- a/trunk/net/sched/act_csum.c +++ b/trunk/net/sched/act_csum.c @@ -508,7 +508,8 @@ static int tcf_csum(struct sk_buff *skb, spin_lock(&p->tcf_lock); p->tcf_tm.lastuse = jiffies; - bstats_update(&p->tcf_bstats, skb); + p->tcf_bstats.bytes += qdisc_pkt_len(skb); + p->tcf_bstats.packets++; action = p->tcf_action; update_flags = p->update_flags; spin_unlock(&p->tcf_lock); diff --git a/trunk/net/sched/act_ipt.c b/trunk/net/sched/act_ipt.c index c2a7c20e81c1..8daef9632255 100644 --- a/trunk/net/sched/act_ipt.c +++ b/trunk/net/sched/act_ipt.c @@ -209,7 +209,8 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, spin_lock(&ipt->tcf_lock); ipt->tcf_tm.lastuse = jiffies; - bstats_update(&ipt->tcf_bstats, skb); + ipt->tcf_bstats.bytes += qdisc_pkt_len(skb); + ipt->tcf_bstats.packets++; /* yes, we have to worry about both in and out dev worry later - danger - this API seems to have changed diff --git a/trunk/net/sched/act_mirred.c b/trunk/net/sched/act_mirred.c index d765067e99db..0c311be92827 100644 --- a/trunk/net/sched/act_mirred.c +++ b/trunk/net/sched/act_mirred.c @@ -165,7 +165,8 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, spin_lock(&m->tcf_lock); m->tcf_tm.lastuse = jiffies; - bstats_update(&m->tcf_bstats, skb); + m->tcf_bstats.bytes += qdisc_pkt_len(skb); + m->tcf_bstats.packets++; dev = m->tcfm_dev; if (!dev) { diff --git a/trunk/net/sched/act_nat.c b/trunk/net/sched/act_nat.c index 178a4bd7b7cb..186eb837e600 100644 --- a/trunk/net/sched/act_nat.c +++ b/trunk/net/sched/act_nat.c @@ -125,7 +125,8 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a, egress = p->flags & TCA_NAT_FLAG_EGRESS; action = p->tcf_action; - bstats_update(&p->tcf_bstats, skb); + p->tcf_bstats.bytes += qdisc_pkt_len(skb); + p->tcf_bstats.packets++; spin_unlock(&p->tcf_lock); diff --git a/trunk/net/sched/act_pedit.c b/trunk/net/sched/act_pedit.c index 445bef716f77..a0593c9640db 100644 --- a/trunk/net/sched/act_pedit.c +++ b/trunk/net/sched/act_pedit.c @@ -187,7 +187,8 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, bad: p->tcf_qstats.overlimits++; done: - bstats_update(&p->tcf_bstats, skb); + p->tcf_bstats.bytes += qdisc_pkt_len(skb); + p->tcf_bstats.packets++; spin_unlock(&p->tcf_lock); return p->tcf_action; } diff --git a/trunk/net/sched/act_police.c b/trunk/net/sched/act_police.c index e2f08b1e2e58..7ebf7439b478 100644 --- a/trunk/net/sched/act_police.c +++ b/trunk/net/sched/act_police.c @@ -298,7 +298,8 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, spin_lock(&police->tcf_lock); - bstats_update(&police->tcf_bstats, skb); + police->tcf_bstats.bytes += qdisc_pkt_len(skb); + police->tcf_bstats.packets++; if (police->tcfp_ewma_rate && police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { diff --git a/trunk/net/sched/act_simple.c b/trunk/net/sched/act_simple.c index 7287cff7af3e..97e84f3ee775 100644 --- a/trunk/net/sched/act_simple.c +++ b/trunk/net/sched/act_simple.c @@ -42,7 +42,8 @@ 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; - bstats_update(&d->tcf_bstats, skb); + d->tcf_bstats.bytes += qdisc_pkt_len(skb); + d->tcf_bstats.packets++; /* print policy string followed by _ then packet count * Example if this was the 3rd packet and the string was "hello" diff --git a/trunk/net/sched/act_skbedit.c b/trunk/net/sched/act_skbedit.c index 836f5fee9e58..66cbf4eb8855 100644 --- a/trunk/net/sched/act_skbedit.c +++ b/trunk/net/sched/act_skbedit.c @@ -46,7 +46,8 @@ static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a, spin_lock(&d->tcf_lock); d->tcf_tm.lastuse = jiffies; - bstats_update(&d->tcf_bstats, skb); + d->tcf_bstats.bytes += qdisc_pkt_len(skb); + d->tcf_bstats.packets++; if (d->flags & SKBEDIT_F_PRIORITY) skb->priority = d->priority; diff --git a/trunk/net/sched/sch_atm.c b/trunk/net/sched/sch_atm.c index 943d733409d0..282540778aa8 100644 --- a/trunk/net/sched/sch_atm.c +++ b/trunk/net/sched/sch_atm.c @@ -422,8 +422,10 @@ drop: __maybe_unused } return ret; } - qdisc_bstats_update(sch, skb); - bstats_update(&flow->bstats, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; + flow->bstats.bytes += qdisc_pkt_len(skb); + flow->bstats.packets++; /* * 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 diff --git a/trunk/net/sched/sch_cbq.c b/trunk/net/sched/sch_cbq.c index c80d1c210c5d..eb7631590865 100644 --- a/trunk/net/sched/sch_cbq.c +++ b/trunk/net/sched/sch_cbq.c @@ -390,7 +390,8 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) ret = qdisc_enqueue(skb, cl->q); if (ret == NET_XMIT_SUCCESS) { sch->q.qlen++; - qdisc_bstats_update(sch, skb); + sch->bstats.packets++; + sch->bstats.bytes += qdisc_pkt_len(skb); cbq_mark_toplevel(q, cl); if (!cl->next_alive) cbq_activate_class(cl); @@ -649,7 +650,8 @@ 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++; - qdisc_bstats_update(sch, skb); + sch->bstats.packets++; + sch->bstats.bytes += qdisc_pkt_len(skb); if (!cl->next_alive) cbq_activate_class(cl); return 0; diff --git a/trunk/net/sched/sch_drr.c b/trunk/net/sched/sch_drr.c index de55e642eafc..aa8b5313f8cf 100644 --- a/trunk/net/sched/sch_drr.c +++ b/trunk/net/sched/sch_drr.c @@ -351,6 +351,7 @@ 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); @@ -361,6 +362,7 @@ 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)) { @@ -375,8 +377,10 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch) cl->deficit = cl->quantum; } - bstats_update(&cl->bstats, skb); - qdisc_bstats_update(sch, skb); + cl->bstats.packets++; + cl->bstats.bytes += len; + sch->bstats.packets++; + sch->bstats.bytes += len; sch->q.qlen++; return err; diff --git a/trunk/net/sched/sch_dsmark.c b/trunk/net/sched/sch_dsmark.c index 60f4bdd4408e..1d295d62bb5c 100644 --- a/trunk/net/sched/sch_dsmark.c +++ b/trunk/net/sched/sch_dsmark.c @@ -260,7 +260,8 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch) return err; } - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; sch->q.qlen++; return NET_XMIT_SUCCESS; diff --git a/trunk/net/sched/sch_hfsc.c b/trunk/net/sched/sch_hfsc.c index 2e45791d4f6c..069c62b7bb36 100644 --- a/trunk/net/sched/sch_hfsc.c +++ b/trunk/net/sched/sch_hfsc.c @@ -1599,8 +1599,10 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) if (cl->qdisc->q.qlen == 1) set_active(cl, qdisc_pkt_len(skb)); - bstats_update(&cl->bstats, skb); - qdisc_bstats_update(sch, skb); + cl->bstats.packets++; + cl->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; + sch->bstats.bytes += qdisc_pkt_len(skb); sch->q.qlen++; return NET_XMIT_SUCCESS; diff --git a/trunk/net/sched/sch_htb.c b/trunk/net/sched/sch_htb.c index 984c1b0c6836..01b519d6c52d 100644 --- a/trunk/net/sched/sch_htb.c +++ b/trunk/net/sched/sch_htb.c @@ -569,12 +569,15 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) } return ret; } else { - bstats_update(&cl->bstats, skb); + cl->bstats.packets += + skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1; + cl->bstats.bytes += qdisc_pkt_len(skb); htb_activate(q, cl); } sch->q.qlen++; - qdisc_bstats_update(sch, skb); + sch->bstats.packets += skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1; + sch->bstats.bytes += qdisc_pkt_len(skb); return NET_XMIT_SUCCESS; } @@ -645,10 +648,12 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl, htb_add_to_wait_tree(q, cl, diff); } - /* update basic stats except for leaves which are already updated */ - if (cl->level) - bstats_update(&cl->bstats, skb); - + /* 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; + } cl = cl->parent; } } diff --git a/trunk/net/sched/sch_ingress.c b/trunk/net/sched/sch_ingress.c index bce1665239b8..f10e34a68445 100644 --- a/trunk/net/sched/sch_ingress.c +++ b/trunk/net/sched/sch_ingress.c @@ -63,7 +63,8 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch) result = tc_classify(skb, p->filter_list, &res); - qdisc_bstats_update(sch, skb); + sch->bstats.packets++; + sch->bstats.bytes += qdisc_pkt_len(skb); switch (result) { case TC_ACT_SHOT: result = TC_ACT_SHOT; diff --git a/trunk/net/sched/sch_multiq.c b/trunk/net/sched/sch_multiq.c index 21f13da24763..32690deab5d0 100644 --- a/trunk/net/sched/sch_multiq.c +++ b/trunk/net/sched/sch_multiq.c @@ -83,7 +83,8 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch) ret = qdisc_enqueue(skb, qdisc); if (ret == NET_XMIT_SUCCESS) { - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; sch->q.qlen++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/sched/sch_netem.c b/trunk/net/sched/sch_netem.c index 1c4bce863479..e5593c083a78 100644 --- a/trunk/net/sched/sch_netem.c +++ b/trunk/net/sched/sch_netem.c @@ -240,7 +240,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) if (likely(ret == NET_XMIT_SUCCESS)) { sch->q.qlen++; - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; } else if (net_xmit_drop_count(ret)) { sch->qstats.drops++; } @@ -476,7 +477,8 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) __skb_queue_after(list, skb, nskb); sch->qstats.backlog += qdisc_pkt_len(nskb); - qdisc_bstats_update(sch, nskb); + sch->bstats.bytes += qdisc_pkt_len(nskb); + sch->bstats.packets++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/sched/sch_prio.c b/trunk/net/sched/sch_prio.c index 966158d49dd1..b1c95bce33ce 100644 --- a/trunk/net/sched/sch_prio.c +++ b/trunk/net/sched/sch_prio.c @@ -84,7 +84,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) ret = qdisc_enqueue(skb, qdisc); if (ret == NET_XMIT_SUCCESS) { - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; sch->q.qlen++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/sched/sch_red.c b/trunk/net/sched/sch_red.c index a6009c5a2c97..a67ba3c5a0cc 100644 --- a/trunk/net/sched/sch_red.c +++ b/trunk/net/sched/sch_red.c @@ -94,7 +94,8 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch) ret = qdisc_enqueue(skb, child); if (likely(ret == NET_XMIT_SUCCESS)) { - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; sch->q.qlen++; } else if (net_xmit_drop_count(ret)) { q->stats.pdrop++; diff --git a/trunk/net/sched/sch_sfq.c b/trunk/net/sched/sch_sfq.c index 239ec53a634d..d54ac94066c2 100644 --- a/trunk/net/sched/sch_sfq.c +++ b/trunk/net/sched/sch_sfq.c @@ -403,7 +403,8 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) slot->allot = q->scaled_quantum; } if (++sch->q.qlen <= q->limit) { - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/sched/sch_tbf.c b/trunk/net/sched/sch_tbf.c index 77565e721811..641a30d64635 100644 --- a/trunk/net/sched/sch_tbf.c +++ b/trunk/net/sched/sch_tbf.c @@ -134,7 +134,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) } sch->q.qlen++; - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/sched/sch_teql.c b/trunk/net/sched/sch_teql.c index af9360d1f6eb..106479a7c94a 100644 --- a/trunk/net/sched/sch_teql.c +++ b/trunk/net/sched/sch_teql.c @@ -83,7 +83,8 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch) if (q->q.qlen < dev->tx_queue_len) { __skb_queue_tail(&q->q, skb); - qdisc_bstats_update(sch, skb); + sch->bstats.bytes += qdisc_pkt_len(skb); + sch->bstats.packets++; return NET_XMIT_SUCCESS; } diff --git a/trunk/net/xfrm/xfrm_user.c b/trunk/net/xfrm/xfrm_user.c index d5e1e0b08890..6a8da81ff66f 100644 --- a/trunk/net/xfrm/xfrm_user.c +++ b/trunk/net/xfrm/xfrm_user.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #include @@ -303,8 +302,7 @@ 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 / 8) > MAX_AH_AUTH_LEN || - ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits) + if (ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits) return -EINVAL; *props = algo->desc.sadb_alg_id;