aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-14 05:30:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-14 05:30:23 -0400
commitdf39e8ba56a788733d369068c7319e04b1da3cd5 (patch)
tree1e9be853bdb455e341cdbf957656f342cfa2eb9e
parentf5572855ec492334d8c3ec0e0e86c31865d5cf07 (diff)
parent159d83363b629c91d020734207c1bc788b96af5a (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/ehea/ehea_main.c drivers/net/wireless/iwlwifi/Kconfig drivers/net/wireless/rt2x00/rt61pci.c net/ipv4/inet_timewait_sock.c net/ipv6/raw.c net/mac80211/ieee80211_sta.c
-rw-r--r--drivers/isdn/i4l/isdn_net.c1
-rw-r--r--drivers/net/bnx2x.c6
-rw-r--r--drivers/net/ehea/ehea.h3
-rw-r--r--drivers/net/ehea/ehea_main.c24
-rw-r--r--drivers/net/forcedeth.c31
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c3
-rw-r--r--drivers/net/macb.c14
-rw-r--r--drivers/net/phy/marvell.c2
-rw-r--r--drivers/net/sc92031.c1
-rw-r--r--drivers/net/sky2.c1
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/starfire.c11
-rw-r--r--drivers/net/tg3.c157
-rw-r--r--drivers/net/tg3.h79
-rw-r--r--drivers/net/tokenring/olympic.c21
-rw-r--r--drivers/net/tun.c38
-rw-r--r--drivers/net/ucc_geth.c53
-rw-r--r--drivers/net/virtio_net.c5
-rw-r--r--drivers/net/wan/Kconfig6
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c39
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c7
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c203
-rw-r--r--drivers/net/wireless/ipw2200.c8
-rw-r--r--drivers/net/wireless/libertas/assoc.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/ssb/driver_mipscore.c13
-rw-r--r--drivers/ssb/driver_pcicore.c2
-rw-r--r--drivers/ssb/main.c6
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/if_tun.h39
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/ulpevent.h2
-rw-r--r--include/net/tcp.h2
-rw-r--r--lib/random32.c13
-rw-r--r--net/8021q/vlan_dev.c15
-rw-r--r--net/atm/lec.c29
-rw-r--r--net/ax25/ax25_uid.c2
-rw-r--r--net/bridge/br_netfilter.c5
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/dccp.h6
-rw-r--r--net/dccp/ipv4.c1
-rw-r--r--net/dccp/output.c1
-rw-r--r--net/dccp/proto.c3
-rw-r--r--net/ethernet/eth.c2
-rw-r--r--net/ieee80211/ieee80211_rx.c43
-rw-r--r--net/ipv4/icmp.c24
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c2
-rw-r--r--net/ipv4/tcp_input.c65
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv6/addrconf.c31
-rw-r--r--net/ipv6/anycast.c9
-rw-r--r--net/ipv6/icmp.c22
-rw-r--r--net/netfilter/xt_hashlimit.c23
-rw-r--r--net/sched/cls_u32.c12
-rw-r--r--net/sctp/ipv6.c5
-rw-r--r--net/sctp/outqueue.c3
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c29
-rw-r--r--net/sctp/sm_sideeffect.c3
-rw-r--r--net/sctp/sm_statefuns.c23
-rw-r--r--net/sctp/socket.c5
-rw-r--r--net/sctp/ulpevent.c2
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/xfrm/xfrm_user.c2
69 files changed, 835 insertions, 358 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index ced83c202cac..ef1a300068dc 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2010,6 +2010,7 @@ isdn_net_init(struct net_device *ndev)
2010 ndev->flags = IFF_NOARP|IFF_POINTOPOINT; 2010 ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
2011 ndev->type = ARPHRD_ETHER; 2011 ndev->type = ARPHRD_ETHER;
2012 ndev->addr_len = ETH_ALEN; 2012 ndev->addr_len = ETH_ALEN;
2013 ndev->validate_addr = NULL;
2013 2014
2014 /* for clients with MPPP maybe higher values better */ 2015 /* for clients with MPPP maybe higher values better */
2015 ndev->tx_queue_len = 30; 2016 ndev->tx_queue_len = 30;
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index de32b3fba322..7bdb5af35951 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -63,8 +63,8 @@
63#include "bnx2x.h" 63#include "bnx2x.h"
64#include "bnx2x_init.h" 64#include "bnx2x_init.h"
65 65
66#define DRV_MODULE_VERSION "1.42.3" 66#define DRV_MODULE_VERSION "1.42.4"
67#define DRV_MODULE_RELDATE "2008/3/9" 67#define DRV_MODULE_RELDATE "2008/4/9"
68#define BNX2X_BC_VER 0x040200 68#define BNX2X_BC_VER 0x040200
69 69
70/* Time in jiffies before concluding the transmitter is hung. */ 70/* Time in jiffies before concluding the transmitter is hung. */
@@ -6153,7 +6153,7 @@ static int bnx2x_function_init(struct bnx2x *bp, int mode)
6153 func, mode); 6153 func, mode);
6154 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 6154 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET,
6155 0xffffffff); 6155 0xffffffff);
6156 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 6156 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
6157 0xfffc); 6157 0xfffc);
6158 bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END); 6158 bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END);
6159 6159
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 26acd05c80b5..f5dacceab95b 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0089" 43#define DRV_VERSION "EHEA_0090"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
@@ -371,6 +371,7 @@ struct ehea_port_res {
371 struct ehea_q_skb_arr rq2_skba; 371 struct ehea_q_skb_arr rq2_skba;
372 struct ehea_q_skb_arr rq3_skba; 372 struct ehea_q_skb_arr rq3_skba;
373 struct ehea_q_skb_arr sq_skba; 373 struct ehea_q_skb_arr sq_skba;
374 int sq_skba_size;
374 spinlock_t netif_queue; 375 spinlock_t netif_queue;
375 int queue_stopped; 376 int queue_stopped;
376 int swqe_refill_th; 377 int swqe_refill_th;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 0c1c360a85ca..9ff7538b7595 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -350,7 +350,8 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
350 pr->rq1_skba.os_skbs = 0; 350 pr->rq1_skba.os_skbs = 0;
351 351
352 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) { 352 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) {
353 pr->rq1_skba.index = index; 353 if (nr_of_wqes > 0)
354 pr->rq1_skba.index = index;
354 pr->rq1_skba.os_skbs = fill_wqes; 355 pr->rq1_skba.os_skbs = fill_wqes;
355 return; 356 return;
356 } 357 }
@@ -1465,7 +1466,9 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1465 init_attr->act_nr_rwqes_rq2, 1466 init_attr->act_nr_rwqes_rq2,
1466 init_attr->act_nr_rwqes_rq3); 1467 init_attr->act_nr_rwqes_rq3);
1467 1468
1468 ret = ehea_init_q_skba(&pr->sq_skba, init_attr->act_nr_send_wqes + 1); 1469 pr->sq_skba_size = init_attr->act_nr_send_wqes + 1;
1470
1471 ret = ehea_init_q_skba(&pr->sq_skba, pr->sq_skba_size);
1469 ret |= ehea_init_q_skba(&pr->rq1_skba, init_attr->act_nr_rwqes_rq1 + 1); 1472 ret |= ehea_init_q_skba(&pr->rq1_skba, init_attr->act_nr_rwqes_rq1 + 1);
1470 ret |= ehea_init_q_skba(&pr->rq2_skba, init_attr->act_nr_rwqes_rq2 + 1); 1473 ret |= ehea_init_q_skba(&pr->rq2_skba, init_attr->act_nr_rwqes_rq2 + 1);
1471 ret |= ehea_init_q_skba(&pr->rq3_skba, init_attr->act_nr_rwqes_rq3 + 1); 1474 ret |= ehea_init_q_skba(&pr->rq3_skba, init_attr->act_nr_rwqes_rq3 + 1);
@@ -2622,6 +2625,22 @@ void ehea_purge_sq(struct ehea_qp *orig_qp)
2622 } 2625 }
2623} 2626}
2624 2627
2628void ehea_flush_sq(struct ehea_port *port)
2629{
2630 int i;
2631
2632 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2633 struct ehea_port_res *pr = &port->port_res[i];
2634 int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count;
2635 int k = 0;
2636 while (atomic_read(&pr->swqe_avail) < swqe_max) {
2637 msleep(5);
2638 if (++k == 20)
2639 break;
2640 }
2641 }
2642}
2643
2625int ehea_stop_qps(struct net_device *dev) 2644int ehea_stop_qps(struct net_device *dev)
2626{ 2645{
2627 struct ehea_port *port = netdev_priv(dev); 2646 struct ehea_port *port = netdev_priv(dev);
@@ -2849,6 +2868,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2849 if (dev->flags & IFF_UP) { 2868 if (dev->flags & IFF_UP) {
2850 mutex_lock(&port->port_lock); 2869 mutex_lock(&port->port_lock);
2851 netif_stop_queue(dev); 2870 netif_stop_queue(dev);
2871 ehea_flush_sq(port);
2852 ret = ehea_stop_qps(dev); 2872 ret = ehea_stop_qps(dev);
2853 if (ret) { 2873 if (ret) {
2854 mutex_unlock(&port->port_lock); 2874 mutex_unlock(&port->port_lock);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 4708a1631925..3338b115fa66 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2112,9 +2112,8 @@ static inline void nv_tx_flip_ownership(struct net_device *dev)
2112 2112
2113 np->tx_pkts_in_progress--; 2113 np->tx_pkts_in_progress--;
2114 if (np->tx_change_owner) { 2114 if (np->tx_change_owner) {
2115 __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen); 2115 np->tx_change_owner->first_tx_desc->flaglen |=
2116 flaglen |= NV_TX2_VALID; 2116 cpu_to_le32(NV_TX2_VALID);
2117 np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen);
2118 np->tx_pkts_in_progress++; 2117 np->tx_pkts_in_progress++;
2119 2118
2120 np->tx_change_owner = np->tx_change_owner->next_tx_ctx; 2119 np->tx_change_owner = np->tx_change_owner->next_tx_ctx;
@@ -5319,8 +5318,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5319 5318
5320 /* check the workaround bit for correct mac address order */ 5319 /* check the workaround bit for correct mac address order */
5321 txreg = readl(base + NvRegTransmitPoll); 5320 txreg = readl(base + NvRegTransmitPoll);
5322 if ((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) || 5321 if (id->driver_data & DEV_HAS_CORRECT_MACADDR) {
5323 (id->driver_data & DEV_HAS_CORRECT_MACADDR)) {
5324 /* mac address is already in correct order */ 5322 /* mac address is already in correct order */
5325 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; 5323 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
5326 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; 5324 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
@@ -5328,6 +5326,22 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5328 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; 5326 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
5329 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; 5327 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
5330 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; 5328 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
5329 } else if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) {
5330 /* mac address is already in correct order */
5331 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
5332 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
5333 dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff;
5334 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
5335 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
5336 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
5337 /*
5338 * Set orig mac address back to the reversed version.
5339 * This flag will be cleared during low power transition.
5340 * Therefore, we should always put back the reversed address.
5341 */
5342 np->orig_mac[0] = (dev->dev_addr[5] << 0) + (dev->dev_addr[4] << 8) +
5343 (dev->dev_addr[3] << 16) + (dev->dev_addr[2] << 24);
5344 np->orig_mac[1] = (dev->dev_addr[1] << 0) + (dev->dev_addr[0] << 8);
5331 } else { 5345 } else {
5332 /* need to reverse mac address to correct order */ 5346 /* need to reverse mac address to correct order */
5333 dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; 5347 dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
@@ -5598,7 +5612,9 @@ out:
5598static int nv_resume(struct pci_dev *pdev) 5612static int nv_resume(struct pci_dev *pdev)
5599{ 5613{
5600 struct net_device *dev = pci_get_drvdata(pdev); 5614 struct net_device *dev = pci_get_drvdata(pdev);
5615 u8 __iomem *base = get_hwbase(dev);
5601 int rc = 0; 5616 int rc = 0;
5617 u32 txreg;
5602 5618
5603 if (!netif_running(dev)) 5619 if (!netif_running(dev))
5604 goto out; 5620 goto out;
@@ -5609,6 +5625,11 @@ static int nv_resume(struct pci_dev *pdev)
5609 pci_restore_state(pdev); 5625 pci_restore_state(pdev);
5610 pci_enable_wake(pdev, PCI_D0, 0); 5626 pci_enable_wake(pdev, PCI_D0, 0);
5611 5627
5628 /* restore mac address reverse flag */
5629 txreg = readl(base + NvRegTransmitPoll);
5630 txreg |= NVREG_TRANSMITPOLL_MAC_ADDR_REV;
5631 writel(txreg, base + NvRegTransmitPoll);
5632
5612 rc = nv_open(dev); 5633 rc = nv_open(dev);
5613out: 5634out:
5614 return rc; 5635 return rc;
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index af869cf9ae7d..940e2041ba38 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -835,7 +835,8 @@ static int fs_enet_close(struct net_device *dev)
835 835
836 netif_stop_queue(dev); 836 netif_stop_queue(dev);
837 netif_carrier_off(dev); 837 netif_carrier_off(dev);
838 napi_disable(&fep->napi); 838 if (fep->fpi->use_napi)
839 napi_disable(&fep->napi);
839 phy_stop(fep->phydev); 840 phy_stop(fep->phydev);
840 841
841 spin_lock_irqsave(&fep->lock, flags); 842 spin_lock_irqsave(&fep->lock, flags);
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 1d210ed46130..489c7c3b90d9 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -242,12 +242,12 @@ static int macb_mii_init(struct macb *bp)
242 /* Enable managment port */ 242 /* Enable managment port */
243 macb_writel(bp, NCR, MACB_BIT(MPE)); 243 macb_writel(bp, NCR, MACB_BIT(MPE));
244 244
245 bp->mii_bus.name = "MACB_mii_bus", 245 bp->mii_bus.name = "MACB_mii_bus";
246 bp->mii_bus.read = &macb_mdio_read, 246 bp->mii_bus.read = &macb_mdio_read;
247 bp->mii_bus.write = &macb_mdio_write, 247 bp->mii_bus.write = &macb_mdio_write;
248 bp->mii_bus.reset = &macb_mdio_reset, 248 bp->mii_bus.reset = &macb_mdio_reset;
249 bp->mii_bus.id = bp->pdev->id, 249 bp->mii_bus.id = bp->pdev->id;
250 bp->mii_bus.priv = bp, 250 bp->mii_bus.priv = bp;
251 bp->mii_bus.dev = &bp->dev->dev; 251 bp->mii_bus.dev = &bp->dev->dev;
252 pdata = bp->pdev->dev.platform_data; 252 pdata = bp->pdev->dev.platform_data;
253 253
@@ -1257,6 +1257,8 @@ static int __exit macb_remove(struct platform_device *pdev)
1257 1257
1258 if (dev) { 1258 if (dev) {
1259 bp = netdev_priv(dev); 1259 bp = netdev_priv(dev);
1260 if (bp->phy_dev)
1261 phy_disconnect(bp->phy_dev);
1260 mdiobus_unregister(&bp->mii_bus); 1262 mdiobus_unregister(&bp->mii_bus);
1261 kfree(bp->mii_bus.irq); 1263 kfree(bp->mii_bus.irq);
1262 unregister_netdev(dev); 1264 unregister_netdev(dev);
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 33539917e9b8..32a8503a7acd 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -211,8 +211,6 @@ static int m88e1111_config_init(struct phy_device *phydev)
211 } 211 }
212 212
213 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { 213 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
214 int temp;
215
216 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); 214 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
217 if (temp < 0) 215 if (temp < 0)
218 return temp; 216 return temp;
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 37b42394560d..15fcee55284e 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1446,6 +1446,7 @@ static int __devinit sc92031_probe(struct pci_dev *pdev,
1446 } 1446 }
1447 1447
1448 pci_set_drvdata(pdev, dev); 1448 pci_set_drvdata(pdev, dev);
1449 SET_NETDEV_DEV(dev, &pdev->dev);
1449 1450
1450#if SC92031_USE_BAR == 0 1451#if SC92031_USE_BAR == 0
1451 dev->mem_start = pci_resource_start(pdev, SC92031_USE_BAR); 1452 dev->mem_start = pci_resource_start(pdev, SC92031_USE_BAR);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 853bce0ac478..f226bcac7d17 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -154,6 +154,7 @@ static const char *yukon2_name[] = {
154 "EC", /* 0xb6 */ 154 "EC", /* 0xb6 */
155 "FE", /* 0xb7 */ 155 "FE", /* 0xb7 */
156 "FE+", /* 0xb8 */ 156 "FE+", /* 0xb8 */
157 "Supreme", /* 0xb9 */
157}; 158};
158 159
159static void sky2_set_multicast(struct net_device *dev); 160static void sky2_set_multicast(struct net_device *dev);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 97bdb2a43bc8..600b92af3334 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1326,9 +1326,11 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1326 SMC_SET_INT_MASK(lp, mask); 1326 SMC_SET_INT_MASK(lp, mask);
1327 spin_unlock(&lp->lock); 1327 spin_unlock(&lp->lock);
1328 1328
1329#ifndef CONFIG_NET_POLL_CONTROLLER
1329 if (timeout == MAX_IRQ_LOOPS) 1330 if (timeout == MAX_IRQ_LOOPS)
1330 PRINTK("%s: spurious interrupt (mask = 0x%02x)\n", 1331 PRINTK("%s: spurious interrupt (mask = 0x%02x)\n",
1331 dev->name, mask); 1332 dev->name, mask);
1333#endif
1332 DBG(3, "%s: Interrupt done (%d loops)\n", 1334 DBG(3, "%s: Interrupt done (%d loops)\n",
1333 dev->name, MAX_IRQ_LOOPS - timeout); 1335 dev->name, MAX_IRQ_LOOPS - timeout);
1334 1336
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index c49214feae91..7b7b1717b0d1 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1472,13 +1472,12 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1472#ifndef final_version /* Remove after testing. */ 1472#ifndef final_version /* Remove after testing. */
1473 /* You will want this info for the initial debug. */ 1473 /* You will want this info for the initial debug. */
1474 if (debug > 5) { 1474 if (debug > 5) {
1475 DECLARE_MAC_BUF(mac); 1475 printk(KERN_DEBUG " Rx data " MAC_FMT " " MAC_FMT
1476 DECLARE_MAC_BUF(mac2);
1477
1478 printk(KERN_DEBUG " Rx data %s %s"
1479 " %2.2x%2.2x.\n", 1476 " %2.2x%2.2x.\n",
1480 print_mac(mac, &skb->data[0]), 1477 skb->data[0], skb->data[1], skb->data[2],
1481 print_mac(mac2, &skb->data[6]), 1478 skb->data[3], skb->data[4], skb->data[5],
1479 skb->data[6], skb->data[7], skb->data[8],
1480 skb->data[9], skb->data[10], skb->data[11],
1482 skb->data[12], skb->data[13]); 1481 skb->data[12], skb->data[13]);
1483 } 1482 }
1484#endif 1483#endif
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f9ef8bd8b11e..96043c5746d0 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.88" 67#define DRV_MODULE_VERSION "3.90"
68#define DRV_MODULE_RELDATE "March 20, 2008" 68#define DRV_MODULE_RELDATE "April 12, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -804,6 +804,12 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
804 return ret; 804 return ret;
805} 805}
806 806
807static void tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val)
808{
809 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, reg);
810 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val);
811}
812
807static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable) 813static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable)
808{ 814{
809 u32 phy; 815 u32 phy;
@@ -886,6 +892,49 @@ static int tg3_bmcr_reset(struct tg3 *tp)
886 return 0; 892 return 0;
887} 893}
888 894
895static void tg3_phy_apply_otp(struct tg3 *tp)
896{
897 u32 otp, phy;
898
899 if (!tp->phy_otp)
900 return;
901
902 otp = tp->phy_otp;
903
904 /* Enable SM_DSP clock and tx 6dB coding. */
905 phy = MII_TG3_AUXCTL_SHDWSEL_AUXCTL |
906 MII_TG3_AUXCTL_ACTL_SMDSP_ENA |
907 MII_TG3_AUXCTL_ACTL_TX_6DB;
908 tg3_writephy(tp, MII_TG3_AUX_CTRL, phy);
909
910 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT);
911 phy |= MII_TG3_DSP_TAP1_AGCTGT_DFLT;
912 tg3_phydsp_write(tp, MII_TG3_DSP_TAP1, phy);
913
914 phy = ((otp & TG3_OTP_HPFFLTR_MASK) >> TG3_OTP_HPFFLTR_SHIFT) |
915 ((otp & TG3_OTP_HPFOVER_MASK) >> TG3_OTP_HPFOVER_SHIFT);
916 tg3_phydsp_write(tp, MII_TG3_DSP_AADJ1CH0, phy);
917
918 phy = ((otp & TG3_OTP_LPFDIS_MASK) >> TG3_OTP_LPFDIS_SHIFT);
919 phy |= MII_TG3_DSP_AADJ1CH3_ADCCKADJ;
920 tg3_phydsp_write(tp, MII_TG3_DSP_AADJ1CH3, phy);
921
922 phy = ((otp & TG3_OTP_VDAC_MASK) >> TG3_OTP_VDAC_SHIFT);
923 tg3_phydsp_write(tp, MII_TG3_DSP_EXP75, phy);
924
925 phy = ((otp & TG3_OTP_10BTAMP_MASK) >> TG3_OTP_10BTAMP_SHIFT);
926 tg3_phydsp_write(tp, MII_TG3_DSP_EXP96, phy);
927
928 phy = ((otp & TG3_OTP_ROFF_MASK) >> TG3_OTP_ROFF_SHIFT) |
929 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT);
930 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
931
932 /* Turn off SM_DSP clock. */
933 phy = MII_TG3_AUXCTL_SHDWSEL_AUXCTL |
934 MII_TG3_AUXCTL_ACTL_TX_6DB;
935 tg3_writephy(tp, MII_TG3_AUX_CTRL, phy);
936}
937
889static int tg3_wait_macro_done(struct tg3 *tp) 938static int tg3_wait_macro_done(struct tg3 *tp)
890{ 939{
891 int limit = 100; 940 int limit = 100;
@@ -1073,6 +1122,7 @@ static void tg3_link_report(struct tg3 *);
1073 */ 1122 */
1074static int tg3_phy_reset(struct tg3 *tp) 1123static int tg3_phy_reset(struct tg3 *tp)
1075{ 1124{
1125 u32 cpmuctrl;
1076 u32 phy_status; 1126 u32 phy_status;
1077 int err; 1127 int err;
1078 1128
@@ -1102,10 +1152,28 @@ static int tg3_phy_reset(struct tg3 *tp)
1102 goto out; 1152 goto out;
1103 } 1153 }
1104 1154
1155 cpmuctrl = 0;
1156 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
1157 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) {
1158 cpmuctrl = tr32(TG3_CPMU_CTRL);
1159 if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY)
1160 tw32(TG3_CPMU_CTRL,
1161 cpmuctrl & ~CPMU_CTRL_GPHY_10MB_RXONLY);
1162 }
1163
1105 err = tg3_bmcr_reset(tp); 1164 err = tg3_bmcr_reset(tp);
1106 if (err) 1165 if (err)
1107 return err; 1166 return err;
1108 1167
1168 if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY) {
1169 u32 phy;
1170
1171 phy = MII_TG3_DSP_EXP8_AEDW | MII_TG3_DSP_EXP8_REJ2MHz;
1172 tg3_phydsp_write(tp, MII_TG3_DSP_EXP8, phy);
1173
1174 tw32(TG3_CPMU_CTRL, cpmuctrl);
1175 }
1176
1109 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 1177 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1110 u32 val; 1178 u32 val;
1111 1179
@@ -1124,6 +1192,8 @@ static int tg3_phy_reset(struct tg3 *tp)
1124 MII_TG3_MISC_SHDW_APD_WKTM_84MS); 1192 MII_TG3_MISC_SHDW_APD_WKTM_84MS);
1125 } 1193 }
1126 1194
1195 tg3_phy_apply_otp(tp);
1196
1127out: 1197out:
1128 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1198 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
1129 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1199 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -9464,7 +9534,8 @@ static int tg3_test_loopback(struct tg3 *tp)
9464 if (err) 9534 if (err)
9465 return TG3_LOOPBACK_FAILED; 9535 return TG3_LOOPBACK_FAILED;
9466 9536
9467 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 9537 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9538 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
9468 int i; 9539 int i;
9469 u32 status; 9540 u32 status;
9470 9541
@@ -9481,17 +9552,23 @@ static int tg3_test_loopback(struct tg3 *tp)
9481 if (status != CPMU_MUTEX_GNT_DRIVER) 9552 if (status != CPMU_MUTEX_GNT_DRIVER)
9482 return TG3_LOOPBACK_FAILED; 9553 return TG3_LOOPBACK_FAILED;
9483 9554
9484 /* Turn off power management based on link speed. */ 9555 /* Turn off link-based power management. */
9485 cpmuctrl = tr32(TG3_CPMU_CTRL); 9556 cpmuctrl = tr32(TG3_CPMU_CTRL);
9486 tw32(TG3_CPMU_CTRL, 9557 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9487 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE | 9558 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5761_AX)
9488 CPMU_CTRL_LINK_AWARE_MODE)); 9559 tw32(TG3_CPMU_CTRL,
9560 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE |
9561 CPMU_CTRL_LINK_AWARE_MODE));
9562 else
9563 tw32(TG3_CPMU_CTRL,
9564 cpmuctrl & ~CPMU_CTRL_LINK_AWARE_MODE);
9489 } 9565 }
9490 9566
9491 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) 9567 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
9492 err |= TG3_MAC_LOOPBACK_FAILED; 9568 err |= TG3_MAC_LOOPBACK_FAILED;
9493 9569
9494 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 9570 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9571 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
9495 tw32(TG3_CPMU_CTRL, cpmuctrl); 9572 tw32(TG3_CPMU_CTRL, cpmuctrl);
9496 9573
9497 /* Release the mutex */ 9574 /* Release the mutex */
@@ -10724,9 +10801,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10724 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 10801 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
10725 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 10802 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
10726 10803
10727 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || 10804 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX)
10728 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) 10805 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
10729 tp->led_ctrl = LED_CTRL_MODE_MAC;
10730 10806
10731 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { 10807 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
10732 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 10808 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
@@ -10773,6 +10849,55 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10773 } 10849 }
10774} 10850}
10775 10851
10852static int __devinit tg3_issue_otp_command(struct tg3 *tp, u32 cmd)
10853{
10854 int i;
10855 u32 val;
10856
10857 tw32(OTP_CTRL, cmd | OTP_CTRL_OTP_CMD_START);
10858 tw32(OTP_CTRL, cmd);
10859
10860 /* Wait for up to 1 ms for command to execute. */
10861 for (i = 0; i < 100; i++) {
10862 val = tr32(OTP_STATUS);
10863 if (val & OTP_STATUS_CMD_DONE)
10864 break;
10865 udelay(10);
10866 }
10867
10868 return (val & OTP_STATUS_CMD_DONE) ? 0 : -EBUSY;
10869}
10870
10871/* Read the gphy configuration from the OTP region of the chip. The gphy
10872 * configuration is a 32-bit value that straddles the alignment boundary.
10873 * We do two 32-bit reads and then shift and merge the results.
10874 */
10875static u32 __devinit tg3_read_otp_phycfg(struct tg3 *tp)
10876{
10877 u32 bhalf_otp, thalf_otp;
10878
10879 tw32(OTP_MODE, OTP_MODE_OTP_THRU_GRC);
10880
10881 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_INIT))
10882 return 0;
10883
10884 tw32(OTP_ADDRESS, OTP_ADDRESS_MAGIC1);
10885
10886 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_READ))
10887 return 0;
10888
10889 thalf_otp = tr32(OTP_READ_DATA);
10890
10891 tw32(OTP_ADDRESS, OTP_ADDRESS_MAGIC2);
10892
10893 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_READ))
10894 return 0;
10895
10896 bhalf_otp = tr32(OTP_READ_DATA);
10897
10898 return ((thalf_otp & 0x0000ffff) << 16) | (bhalf_otp >> 16);
10899}
10900
10776static int __devinit tg3_phy_probe(struct tg3 *tp) 10901static int __devinit tg3_phy_probe(struct tg3 *tp)
10777{ 10902{
10778 u32 hw_phy_id_1, hw_phy_id_2; 10903 u32 hw_phy_id_1, hw_phy_id_2;
@@ -11586,6 +11711,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11586 tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; 11711 tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
11587 } 11712 }
11588 11713
11714 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
11715 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) {
11716 tp->phy_otp = tg3_read_otp_phycfg(tp);
11717 if (tp->phy_otp == 0)
11718 tp->phy_otp = TG3_OTP_DEFAULT;
11719 }
11720
11589 tp->coalesce_mode = 0; 11721 tp->coalesce_mode = 0;
11590 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && 11722 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX &&
11591 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) 11723 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX)
@@ -12446,7 +12578,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12446 const struct pci_device_id *ent) 12578 const struct pci_device_id *ent)
12447{ 12579{
12448 static int tg3_version_printed = 0; 12580 static int tg3_version_printed = 0;
12449 unsigned long tg3reg_base, tg3reg_len; 12581 resource_size_t tg3reg_base;
12582 unsigned long tg3reg_len;
12450 struct net_device *dev; 12583 struct net_device *dev;
12451 struct tg3 *tp; 12584 struct tg3 *tp;
12452 int err, pm_cap; 12585 int err, pm_cap;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 3938eb35ce8c..c1075a73d66c 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -138,6 +138,8 @@
138#define CHIPREV_5704_BX 0x21 138#define CHIPREV_5704_BX 0x21
139#define CHIPREV_5750_AX 0x40 139#define CHIPREV_5750_AX 0x40
140#define CHIPREV_5750_BX 0x41 140#define CHIPREV_5750_BX 0x41
141#define CHIPREV_5784_AX 0x57840
142#define CHIPREV_5761_AX 0x57610
141#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff) 143#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff)
142#define METAL_REV_A0 0x00 144#define METAL_REV_A0 0x00
143#define METAL_REV_A1 0x01 145#define METAL_REV_A1 0x01
@@ -866,6 +868,7 @@
866#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 868#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200
867#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 869#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400
868#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 870#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000
871#define CPMU_CTRL_GPHY_10MB_RXONLY 0x00010000
869#define TG3_CPMU_LSPD_10MB_CLK 0x00003604 872#define TG3_CPMU_LSPD_10MB_CLK 0x00003604
870#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000 873#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000
871#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 874#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000
@@ -1559,7 +1562,24 @@
1559/* 0x702c unused */ 1562/* 0x702c unused */
1560 1563
1561#define NVRAM_ADDR_LOCKOUT 0x00007030 1564#define NVRAM_ADDR_LOCKOUT 0x00007030
1562/* 0x7034 --> 0x7c00 unused */ 1565/* 0x7034 --> 0x7500 unused */
1566
1567#define OTP_MODE 0x00007500
1568#define OTP_MODE_OTP_THRU_GRC 0x00000001
1569#define OTP_CTRL 0x00007504
1570#define OTP_CTRL_OTP_PROG_ENABLE 0x00200000
1571#define OTP_CTRL_OTP_CMD_READ 0x00000000
1572#define OTP_CTRL_OTP_CMD_INIT 0x00000008
1573#define OTP_CTRL_OTP_CMD_START 0x00000001
1574#define OTP_STATUS 0x00007508
1575#define OTP_STATUS_CMD_DONE 0x00000001
1576#define OTP_ADDRESS 0x0000750c
1577#define OTP_ADDRESS_MAGIC1 0x000000a0
1578#define OTP_ADDRESS_MAGIC2 0x00000080
1579/* 0x7510 unused */
1580
1581#define OTP_READ_DATA 0x00007514
1582/* 0x7518 --> 0x7c04 unused */
1563 1583
1564#define PCIE_TRANSACTION_CFG 0x00007c04 1584#define PCIE_TRANSACTION_CFG 0x00007c04
1565#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000 1585#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000
@@ -1568,6 +1588,28 @@
1568#define PCIE_PWR_MGMT_THRESH 0x00007d28 1588#define PCIE_PWR_MGMT_THRESH 0x00007d28
1569#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00 1589#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00
1570 1590
1591
1592/* OTP bit definitions */
1593#define TG3_OTP_AGCTGT_MASK 0x000000e0
1594#define TG3_OTP_AGCTGT_SHIFT 1
1595#define TG3_OTP_HPFFLTR_MASK 0x00000300
1596#define TG3_OTP_HPFFLTR_SHIFT 1
1597#define TG3_OTP_HPFOVER_MASK 0x00000400
1598#define TG3_OTP_HPFOVER_SHIFT 1
1599#define TG3_OTP_LPFDIS_MASK 0x00000800
1600#define TG3_OTP_LPFDIS_SHIFT 11
1601#define TG3_OTP_VDAC_MASK 0xff000000
1602#define TG3_OTP_VDAC_SHIFT 24
1603#define TG3_OTP_10BTAMP_MASK 0x0000f000
1604#define TG3_OTP_10BTAMP_SHIFT 8
1605#define TG3_OTP_ROFF_MASK 0x00e00000
1606#define TG3_OTP_ROFF_SHIFT 11
1607#define TG3_OTP_RCOFF_MASK 0x001c0000
1608#define TG3_OTP_RCOFF_SHIFT 16
1609
1610#define TG3_OTP_DEFAULT 0x286c1640
1611
1612
1571#define TG3_EEPROM_MAGIC 0x669955aa 1613#define TG3_EEPROM_MAGIC 0x669955aa
1572#define TG3_EEPROM_MAGIC_FW 0xa5000000 1614#define TG3_EEPROM_MAGIC_FW 0xa5000000
1573#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 1615#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000
@@ -1705,15 +1747,31 @@
1705 1747
1706#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ 1748#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */
1707 1749
1708#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */
1709#define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */ 1750#define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */
1751#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */
1752
1753#define MII_TG3_DSP_TAP1 0x0001
1754#define MII_TG3_DSP_TAP1_AGCTGT_DFLT 0x0007
1755#define MII_TG3_DSP_AADJ1CH0 0x001f
1756#define MII_TG3_DSP_AADJ1CH3 0x601f
1757#define MII_TG3_DSP_AADJ1CH3_ADCCKADJ 0x0002
1758#define MII_TG3_DSP_EXP8 0x0708
1759#define MII_TG3_DSP_EXP8_REJ2MHz 0x0001
1760#define MII_TG3_DSP_EXP8_AEDW 0x0200
1761#define MII_TG3_DSP_EXP75 0x0f75
1762#define MII_TG3_DSP_EXP96 0x0f96
1763#define MII_TG3_DSP_EXP97 0x0f97
1710 1764
1711#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ 1765#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */
1712 1766
1713#define MII_TG3_AUXCTL_MISC_WREN 0x8000 1767#define MII_TG3_AUXCTL_MISC_WREN 0x8000
1714#define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200 1768#define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200
1715#define MII_TG3_AUXCTL_MISC_RDSEL_MISC 0x7000 1769#define MII_TG3_AUXCTL_MISC_RDSEL_MISC 0x7000
1716#define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007 1770#define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007
1771
1772#define MII_TG3_AUXCTL_ACTL_SMDSP_ENA 0x0800
1773#define MII_TG3_AUXCTL_ACTL_TX_6DB 0x0400
1774#define MII_TG3_AUXCTL_SHDWSEL_AUXCTL 0x0000
1717 1775
1718#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */ 1776#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */
1719#define MII_TG3_AUX_STAT_LPASS 0x0004 1777#define MII_TG3_AUX_STAT_LPASS 0x0004
@@ -1743,6 +1801,20 @@
1743#define MII_TG3_INT_DUPLEXCHG 0x0008 1801#define MII_TG3_INT_DUPLEXCHG 0x0008
1744#define MII_TG3_INT_ANEG_PAGE_RX 0x0400 1802#define MII_TG3_INT_ANEG_PAGE_RX 0x0400
1745 1803
1804#define MII_TG3_MISC_SHDW 0x1c
1805#define MII_TG3_MISC_SHDW_WREN 0x8000
1806#define MII_TG3_MISC_SHDW_SCR5_SEL 0x1400
1807#define MII_TG3_MISC_SHDW_APD_SEL 0x2800
1808
1809#define MII_TG3_MISC_SHDW_SCR5_C125OE 0x0001
1810#define MII_TG3_MISC_SHDW_SCR5_DLLAPD 0x0002
1811#define MII_TG3_MISC_SHDW_SCR5_SDTL 0x0004
1812#define MII_TG3_MISC_SHDW_SCR5_DLPTLM 0x0008
1813#define MII_TG3_MISC_SHDW_SCR5_LPED 0x0010
1814
1815#define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001
1816#define MII_TG3_MISC_SHDW_APD_ENABLE 0x0020
1817
1746#define MII_TG3_EPHY_TEST 0x1f /* 5906 PHY register */ 1818#define MII_TG3_EPHY_TEST 0x1f /* 5906 PHY register */
1747#define MII_TG3_EPHY_SHADOW_EN 0x80 1819#define MII_TG3_EPHY_SHADOW_EN 0x80
1748 1820
@@ -2473,6 +2545,7 @@ struct tg3 {
2473#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ 2545#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */
2474 2546
2475 u32 led_ctrl; 2547 u32 led_ctrl;
2548 u32 phy_otp;
2476 u16 pci_cmd; 2549 u16 pci_cmd;
2477 2550
2478 char board_part_number[24]; 2551 char board_part_number[24];
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 433c994ea9d8..0ab51a0f35fc 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -117,7 +117,7 @@
117 * Official releases will only have an a.b.c version number format. 117 * Official releases will only have an a.b.c version number format.
118 */ 118 */
119 119
120static char version[] __devinitdata = 120static char version[] =
121"Olympic.c v1.0.5 6/04/02 - Peter De Schrijver & Mike Phillips" ; 121"Olympic.c v1.0.5 6/04/02 - Peter De Schrijver & Mike Phillips" ;
122 122
123static char *open_maj_error[] = {"No error", "Lobe Media Test", "Physical Insertion", 123static char *open_maj_error[] = {"No error", "Lobe Media Test", "Physical Insertion",
@@ -290,7 +290,7 @@ op_disable_dev:
290 return i; 290 return i;
291} 291}
292 292
293static int __devinit olympic_init(struct net_device *dev) 293static int olympic_init(struct net_device *dev)
294{ 294{
295 struct olympic_private *olympic_priv; 295 struct olympic_private *olympic_priv;
296 u8 __iomem *olympic_mmio, *init_srb,*adapter_addr; 296 u8 __iomem *olympic_mmio, *init_srb,*adapter_addr;
@@ -434,7 +434,7 @@ static int __devinit olympic_init(struct net_device *dev)
434 434
435} 435}
436 436
437static int __devinit olympic_open(struct net_device *dev) 437static int olympic_open(struct net_device *dev)
438{ 438{
439 struct olympic_private *olympic_priv=netdev_priv(dev); 439 struct olympic_private *olympic_priv=netdev_priv(dev);
440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; 440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb;
@@ -1438,13 +1438,18 @@ static void olympic_arb_cmd(struct net_device *dev)
1438 1438
1439 if (olympic_priv->olympic_network_monitor) { 1439 if (olympic_priv->olympic_network_monitor) {
1440 struct trh_hdr *mac_hdr; 1440 struct trh_hdr *mac_hdr;
1441 DECLARE_MAC_BUF(mac);
1442 printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name); 1441 printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name);
1443 mac_hdr = tr_hdr(mac_frame); 1442 mac_hdr = tr_hdr(mac_frame);
1444 printk(KERN_WARNING "%s: MAC Frame Dest. Addr: %s\n", 1443 printk(KERN_WARNING "%s: MAC Frame Dest. Addr: "
1445 dev->name, print_mac(mac, mac_hdr->daddr)); 1444 MAC_FMT " \n", dev->name,
1446 printk(KERN_WARNING "%s: MAC Frame Srce. Addr: %s\n", 1445 mac_hdr->daddr[0], mac_hdr->daddr[1],
1447 dev->name, print_mac(mac, mac_hdr->saddr)); 1446 mac_hdr->daddr[2], mac_hdr->daddr[3],
1447 mac_hdr->daddr[4], mac_hdr->daddr[5]);
1448 printk(KERN_WARNING "%s: MAC Frame Srce. Addr: "
1449 MAC_FMT " \n", dev->name,
1450 mac_hdr->saddr[0], mac_hdr->saddr[1],
1451 mac_hdr->saddr[2], mac_hdr->saddr[3],
1452 mac_hdr->saddr[4], mac_hdr->saddr[5]);
1448 } 1453 }
1449 netif_rx(mac_frame); 1454 netif_rx(mac_frame);
1450 dev->last_rx = jiffies; 1455 dev->last_rx = jiffies;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7b816a032957..5b5d87585d91 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -67,9 +67,42 @@
67#include <asm/system.h> 67#include <asm/system.h>
68#include <asm/uaccess.h> 68#include <asm/uaccess.h>
69 69
70/* Uncomment to enable debugging */
71/* #define TUN_DEBUG 1 */
72
70#ifdef TUN_DEBUG 73#ifdef TUN_DEBUG
71static int debug; 74static int debug;
75
76#define DBG if(tun->debug)printk
77#define DBG1 if(debug==2)printk
78#else
79#define DBG( a... )
80#define DBG1( a... )
81#endif
82
83struct tun_struct {
84 struct list_head list;
85 unsigned long flags;
86 int attached;
87 uid_t owner;
88 gid_t group;
89
90 wait_queue_head_t read_wait;
91 struct sk_buff_head readq;
92
93 struct net_device *dev;
94
95 struct fasync_struct *fasync;
96
97 unsigned long if_flags;
98 u8 dev_addr[ETH_ALEN];
99 u32 chr_filter[2];
100 u32 net_filter[2];
101
102#ifdef TUN_DEBUG
103 int debug;
72#endif 104#endif
105};
73 106
74/* Network device part of the driver */ 107/* Network device part of the driver */
75 108
@@ -253,8 +286,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
253 return -EFAULT; 286 return -EFAULT;
254 } 287 }
255 288
256 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) 289 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
257 align = NET_IP_ALIGN; 290 align = NET_IP_ALIGN;
291 if (unlikely(len < ETH_HLEN))
292 return -EINVAL;
293 }
258 294
259 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { 295 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
260 tun->dev->stats.rx_dropped++; 296 tun->dev->stats.rx_dropped++;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8cc316653a39..0ee4c168e4c0 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3833,6 +3833,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3833 struct device_node *phy; 3833 struct device_node *phy;
3834 int err, ucc_num, max_speed = 0; 3834 int err, ucc_num, max_speed = 0;
3835 const phandle *ph; 3835 const phandle *ph;
3836 const u32 *fixed_link;
3836 const unsigned int *prop; 3837 const unsigned int *prop;
3837 const char *sprop; 3838 const char *sprop;
3838 const void *mac_addr; 3839 const void *mac_addr;
@@ -3923,18 +3924,38 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3923 3924
3924 ug_info->uf_info.regs = res.start; 3925 ug_info->uf_info.regs = res.start;
3925 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); 3926 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
3927 fixed_link = of_get_property(np, "fixed-link", NULL);
3928 if (fixed_link) {
3929 ug_info->mdio_bus = 0;
3930 ug_info->phy_address = fixed_link[0];
3931 phy = NULL;
3932 } else {
3933 ph = of_get_property(np, "phy-handle", NULL);
3934 phy = of_find_node_by_phandle(*ph);
3926 3935
3927 ph = of_get_property(np, "phy-handle", NULL); 3936 if (phy == NULL)
3928 phy = of_find_node_by_phandle(*ph); 3937 return -ENODEV;
3929 3938
3930 if (phy == NULL) 3939 /* set the PHY address */
3931 return -ENODEV; 3940 prop = of_get_property(phy, "reg", NULL);
3941 if (prop == NULL)
3942 return -1;
3943 ug_info->phy_address = *prop;
3944
3945 /* Set the bus id */
3946 mdio = of_get_parent(phy);
3947
3948 if (mdio == NULL)
3949 return -1;
3932 3950
3933 /* set the PHY address */ 3951 err = of_address_to_resource(mdio, 0, &res);
3934 prop = of_get_property(phy, "reg", NULL); 3952 of_node_put(mdio);
3935 if (prop == NULL) 3953
3936 return -1; 3954 if (err)
3937 ug_info->phy_address = *prop; 3955 return -1;
3956
3957 ug_info->mdio_bus = res.start;
3958 }
3938 3959
3939 /* get the phy interface type, or default to MII */ 3960 /* get the phy interface type, or default to MII */
3940 prop = of_get_property(np, "phy-connection-type", NULL); 3961 prop = of_get_property(np, "phy-connection-type", NULL);
@@ -3979,20 +4000,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3979 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; 4000 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3980 } 4001 }
3981 4002
3982 /* Set the bus id */
3983 mdio = of_get_parent(phy);
3984
3985 if (mdio == NULL)
3986 return -1;
3987
3988 err = of_address_to_resource(mdio, 0, &res);
3989 of_node_put(mdio);
3990
3991 if (err)
3992 return -1;
3993
3994 ug_info->mdio_bus = res.start;
3995
3996 if (netif_msg_probe(&debug)) 4003 if (netif_msg_probe(&debug))
3997 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", 4004 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
3998 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, 4005 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index b58472cf76f8..d02d9d75fe14 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -234,11 +234,12 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
234 struct scatterlist sg[1+MAX_SKB_FRAGS]; 234 struct scatterlist sg[1+MAX_SKB_FRAGS];
235 struct virtio_net_hdr *hdr; 235 struct virtio_net_hdr *hdr;
236 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; 236 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
237 DECLARE_MAC_BUF(mac);
238 237
239 sg_init_table(sg, 1+MAX_SKB_FRAGS); 238 sg_init_table(sg, 1+MAX_SKB_FRAGS);
240 239
241 pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); 240 pr_debug("%s: xmit %p " MAC_FMT "\n", dev->name, skb,
241 dest[0], dest[1], dest[2],
242 dest[3], dest[4], dest[5]);
242 243
243 /* Encode metadata header at front. */ 244 /* Encode metadata header at front. */
244 hdr = skb_vnet_hdr(skb); 245 hdr = skb_vnet_hdr(skb);
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index a3df09ee729f..8005dd16fb4e 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -150,9 +150,13 @@ config HDLC_FR
150 150
151config HDLC_PPP 151config HDLC_PPP
152 tristate "Synchronous Point-to-Point Protocol (PPP) support" 152 tristate "Synchronous Point-to-Point Protocol (PPP) support"
153 depends on HDLC 153 depends on HDLC && BROKEN
154 help 154 help
155 Generic HDLC driver supporting PPP over WAN connections. 155 Generic HDLC driver supporting PPP over WAN connections.
156 This module is currently broken and will cause a kernel panic
157 when a device configured in PPP mode is activated.
158
159 It will be replaced by new PPP implementation in Linux 2.6.26.
156 160
157 If unsure, say N. 161 If unsure, say N.
158 162
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 49978bdb4324..4fd73809602e 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -635,7 +635,6 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
635{ 635{
636 struct ieee80211_hdr_4addr *hdr; 636 struct ieee80211_hdr_4addr *hdr;
637 int res, hdrlen; 637 int res, hdrlen;
638 DECLARE_MAC_BUF(mac);
639 638
640 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 639 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
641 return 0; 640 return 0;
@@ -647,8 +646,10 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
647 strcmp(crypt->ops->name, "TKIP") == 0) { 646 strcmp(crypt->ops->name, "TKIP") == 0) {
648 if (net_ratelimit()) { 647 if (net_ratelimit()) {
649 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 648 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
650 "received packet from %s\n", 649 "received packet from " MAC_FMT "\n",
651 local->dev->name, print_mac(mac, hdr->addr2)); 650 local->dev->name,
651 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
652 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
652 } 653 }
653 return -1; 654 return -1;
654 } 655 }
@@ -657,9 +658,12 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
657 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 658 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
658 atomic_dec(&crypt->refcnt); 659 atomic_dec(&crypt->refcnt);
659 if (res < 0) { 660 if (res < 0) {
660 printk(KERN_DEBUG "%s: decryption failed (SA=%s" 661 printk(KERN_DEBUG "%s: decryption failed (SA=" MAC_FMT
661 ") res=%d\n", 662 ") res=%d\n",
662 local->dev->name, print_mac(mac, hdr->addr2), res); 663 local->dev->name,
664 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
665 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
666 res);
663 local->comm_tallies.rx_discards_wep_undecryptable++; 667 local->comm_tallies.rx_discards_wep_undecryptable++;
664 return -1; 668 return -1;
665 } 669 }
@@ -721,7 +725,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
721 struct ieee80211_crypt_data *crypt = NULL; 725 struct ieee80211_crypt_data *crypt = NULL;
722 void *sta = NULL; 726 void *sta = NULL;
723 int keyidx = 0; 727 int keyidx = 0;
724 DECLARE_MAC_BUF(mac);
725 728
726 iface = netdev_priv(dev); 729 iface = netdev_priv(dev);
727 local = iface->local; 730 local = iface->local;
@@ -798,8 +801,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
798 * frames silently instead of filling system log with 801 * frames silently instead of filling system log with
799 * these reports. */ 802 * these reports. */
800 printk(KERN_DEBUG "%s: WEP decryption failed (not set)" 803 printk(KERN_DEBUG "%s: WEP decryption failed (not set)"
801 " (SA=%s)\n", 804 " (SA=" MAC_FMT ")\n",
802 local->dev->name, print_mac(mac, hdr->addr2)); 805 local->dev->name,
806 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
807 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
803#endif 808#endif
804 local->comm_tallies.rx_discards_wep_undecryptable++; 809 local->comm_tallies.rx_discards_wep_undecryptable++;
805 goto rx_dropped; 810 goto rx_dropped;
@@ -813,8 +818,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
813 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 818 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
814 { 819 {
815 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 820 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
816 "from %s\n", dev->name, 821 "from " MAC_FMT "\n", dev->name,
817 print_mac(mac, hdr->addr2)); 822 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
823 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
818 /* TODO: could inform hostapd about this so that it 824 /* TODO: could inform hostapd about this so that it
819 * could send auth failure report */ 825 * could send auth failure report */
820 goto rx_dropped; 826 goto rx_dropped;
@@ -982,8 +988,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
982 "unencrypted EAPOL frame\n", local->dev->name); 988 "unencrypted EAPOL frame\n", local->dev->name);
983 } else { 989 } else {
984 printk(KERN_DEBUG "%s: encryption configured, but RX " 990 printk(KERN_DEBUG "%s: encryption configured, but RX "
985 "frame not encrypted (SA=%s)\n", 991 "frame not encrypted (SA=" MAC_FMT ")\n",
986 local->dev->name, print_mac(mac, hdr->addr2)); 992 local->dev->name,
993 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
994 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
987 goto rx_dropped; 995 goto rx_dropped;
988 } 996 }
989 } 997 }
@@ -992,9 +1000,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
992 !hostap_is_eapol_frame(local, skb)) { 1000 !hostap_is_eapol_frame(local, skb)) {
993 if (net_ratelimit()) { 1001 if (net_ratelimit()) {
994 printk(KERN_DEBUG "%s: dropped unencrypted RX data " 1002 printk(KERN_DEBUG "%s: dropped unencrypted RX data "
995 "frame from %s" 1003 "frame from " MAC_FMT " (drop_unencrypted=1)\n",
996 " (drop_unencrypted=1)\n", 1004 dev->name,
997 dev->name, print_mac(mac, hdr->addr2)); 1005 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1006 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
998 } 1007 }
999 goto rx_dropped; 1008 goto rx_dropped;
1000 } 1009 }
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index e7afc3ec3e6d..921c984416f8 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -314,7 +314,6 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
314 struct ieee80211_hdr_4addr *hdr; 314 struct ieee80211_hdr_4addr *hdr;
315 u16 fc; 315 u16 fc;
316 int prefix_len, postfix_len, hdr_len, res; 316 int prefix_len, postfix_len, hdr_len, res;
317 DECLARE_MAC_BUF(mac);
318 317
319 iface = netdev_priv(skb->dev); 318 iface = netdev_priv(skb->dev);
320 local = iface->local; 319 local = iface->local;
@@ -329,8 +328,10 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
329 hdr = (struct ieee80211_hdr_4addr *) skb->data; 328 hdr = (struct ieee80211_hdr_4addr *) skb->data;
330 if (net_ratelimit()) { 329 if (net_ratelimit()) {
331 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 330 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
332 "TX packet to %s\n", 331 "TX packet to " MAC_FMT "\n",
333 local->dev->name, print_mac(mac, hdr->addr1)); 332 local->dev->name,
333 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
334 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
334 } 335 }
335 kfree_skb(skb); 336 kfree_skb(skb);
336 return NULL; 337 return NULL;
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index ad040a3bb8a7..0acd9589c48c 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -632,7 +632,6 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
632 __le16 *pos; 632 __le16 *pos;
633 struct sta_info *sta = NULL; 633 struct sta_info *sta = NULL;
634 char *txt = NULL; 634 char *txt = NULL;
635 DECLARE_MAC_BUF(mac);
636 635
637 if (ap->local->hostapd) { 636 if (ap->local->hostapd) {
638 dev_kfree_skb(skb); 637 dev_kfree_skb(skb);
@@ -684,10 +683,12 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
684 if (sta) 683 if (sta)
685 atomic_dec(&sta->users); 684 atomic_dec(&sta->users);
686 if (txt) { 685 if (txt) {
687 PDEBUG(DEBUG_AP, "%s: %s auth_cb - alg=%d " 686 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth_cb - alg=%d "
688 "trans#=%d status=%d - %s\n", 687 "trans#=%d status=%d - %s\n",
689 dev->name, print_mac(mac, hdr->addr1), auth_alg, 688 dev->name,
690 auth_transaction, status, txt); 689 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
690 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
691 auth_alg, auth_transaction, status, txt);
691 } 692 }
692 dev_kfree_skb(skb); 693 dev_kfree_skb(skb);
693} 694}
@@ -703,7 +704,6 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
703 __le16 *pos; 704 __le16 *pos;
704 struct sta_info *sta = NULL; 705 struct sta_info *sta = NULL;
705 char *txt = NULL; 706 char *txt = NULL;
706 DECLARE_MAC_BUF(mac);
707 707
708 if (ap->local->hostapd) { 708 if (ap->local->hostapd) {
709 dev_kfree_skb(skb); 709 dev_kfree_skb(skb);
@@ -754,8 +754,11 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
754 if (sta) 754 if (sta)
755 atomic_dec(&sta->users); 755 atomic_dec(&sta->users);
756 if (txt) { 756 if (txt) {
757 PDEBUG(DEBUG_AP, "%s: %s assoc_cb - %s\n", 757 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " assoc_cb - %s\n",
758 dev->name, print_mac(mac, hdr->addr1), txt); 758 dev->name,
759 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
760 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
761 txt);
759 } 762 }
760 dev_kfree_skb(skb); 763 dev_kfree_skb(skb);
761} 764}
@@ -767,7 +770,6 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
767 struct ap_data *ap = data; 770 struct ap_data *ap = data;
768 struct ieee80211_hdr_4addr *hdr; 771 struct ieee80211_hdr_4addr *hdr;
769 struct sta_info *sta; 772 struct sta_info *sta;
770 DECLARE_MAC_BUF(mac);
771 773
772 if (skb->len < 24) 774 if (skb->len < 24)
773 goto fail; 775 goto fail;
@@ -779,9 +781,11 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
779 sta->flags &= ~WLAN_STA_PENDING_POLL; 781 sta->flags &= ~WLAN_STA_PENDING_POLL;
780 spin_unlock(&ap->sta_table_lock); 782 spin_unlock(&ap->sta_table_lock);
781 } else { 783 } else {
782 PDEBUG(DEBUG_AP, "%s: STA %s" 784 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
783 " did not ACK activity poll frame\n", 785 " did not ACK activity poll frame\n",
784 ap->local->dev->name, print_mac(mac, hdr->addr1)); 786 ap->local->dev->name,
787 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
788 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
785 } 789 }
786 790
787 fail: 791 fail:
@@ -1306,7 +1310,6 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1306 struct sta_info *sta = NULL; 1310 struct sta_info *sta = NULL;
1307 struct ieee80211_crypt_data *crypt; 1311 struct ieee80211_crypt_data *crypt;
1308 char *txt = ""; 1312 char *txt = "";
1309 DECLARE_MAC_BUF(mac);
1310 1313
1311 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1314 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1312 1315
@@ -1315,8 +1318,9 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1315 1318
1316 if (len < 6) { 1319 if (len < 6) {
1317 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " 1320 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload "
1318 "(len=%d) from %s\n", dev->name, len, 1321 "(len=%d) from " MAC_FMT "\n", dev->name, len,
1319 print_mac(mac, hdr->addr2)); 1322 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1323 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
1320 return; 1324 return;
1321 } 1325 }
1322 1326
@@ -1381,8 +1385,10 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1381 if (time_after(jiffies, sta->u.ap.last_beacon + 1385 if (time_after(jiffies, sta->u.ap.last_beacon +
1382 (10 * sta->listen_interval * HZ) / 1024)) { 1386 (10 * sta->listen_interval * HZ) / 1024)) {
1383 PDEBUG(DEBUG_AP, "%s: no beacons received for a while," 1387 PDEBUG(DEBUG_AP, "%s: no beacons received for a while,"
1384 " assuming AP %s is now STA\n", 1388 " assuming AP " MAC_FMT " is now STA\n",
1385 dev->name, print_mac(mac, sta->addr)); 1389 dev->name,
1390 sta->addr[0], sta->addr[1], sta->addr[2],
1391 sta->addr[3], sta->addr[4], sta->addr[5]);
1386 sta->ap = 0; 1392 sta->ap = 0;
1387 sta->flags = 0; 1393 sta->flags = 0;
1388 sta->u.sta.challenge = NULL; 1394 sta->u.sta.challenge = NULL;
@@ -1497,10 +1503,13 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1497 } 1503 }
1498 1504
1499 if (resp) { 1505 if (resp) {
1500 PDEBUG(DEBUG_AP, "%s: %s auth (alg=%d " 1506 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth (alg=%d "
1501 "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n", 1507 "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n",
1502 dev->name, print_mac(mac, hdr->addr2), auth_alg, 1508 dev->name,
1503 auth_transaction, status_code, len, fc, resp, txt); 1509 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1510 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1511 auth_alg, auth_transaction, status_code, len,
1512 fc, resp, txt);
1504 } 1513 }
1505} 1514}
1506 1515
@@ -1519,14 +1528,15 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1519 int send_deauth = 0; 1528 int send_deauth = 0;
1520 char *txt = ""; 1529 char *txt = "";
1521 u8 prev_ap[ETH_ALEN]; 1530 u8 prev_ap[ETH_ALEN];
1522 DECLARE_MAC_BUF(mac);
1523 1531
1524 left = len = skb->len - IEEE80211_MGMT_HDR_LEN; 1532 left = len = skb->len - IEEE80211_MGMT_HDR_LEN;
1525 1533
1526 if (len < (reassoc ? 10 : 4)) { 1534 if (len < (reassoc ? 10 : 4)) {
1527 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload " 1535 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload "
1528 "(len=%d, reassoc=%d) from %s\n", 1536 "(len=%d, reassoc=%d) from " MAC_FMT "\n",
1529 dev->name, len, reassoc, print_mac(mac, hdr->addr2)); 1537 dev->name, len, reassoc,
1538 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1539 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
1530 return; 1540 return;
1531 } 1541 }
1532 1542
@@ -1603,9 +1613,12 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1603 } 1613 }
1604 1614
1605 if (left > 0) { 1615 if (left > 0) {
1606 PDEBUG(DEBUG_AP, "%s: assoc from %s" 1616 PDEBUG(DEBUG_AP, "%s: assoc from " MAC_FMT
1607 " with extra data (%d bytes) [", 1617 " with extra data (%d bytes) [",
1608 dev->name, print_mac(mac, hdr->addr2), left); 1618 dev->name,
1619 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1620 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1621 left);
1609 while (left > 0) { 1622 while (left > 0) {
1610 PDEBUG2(DEBUG_AP, "<%02x>", *u); 1623 PDEBUG2(DEBUG_AP, "<%02x>", *u);
1611 u++; left--; 1624 u++; left--;
@@ -1704,10 +1717,15 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1704 } 1717 }
1705 1718
1706#if 0 1719#if 0
1707 PDEBUG(DEBUG_AP, "%s: %s %sassoc (len=%d " 1720 PDEBUG(DEBUG_AP, "%s: " MAC_FMT" %sassoc (len=%d "
1708 "prev_ap=%s) => %d(%d) (%s)\n", 1721 "prev_ap=" MAC_FMT") => %d(%d) (%s)\n",
1709 dev->name, print_mac(mac, hdr->addr2), reassoc ? "re" : "", len, 1722 dev->name,
1710 print_mac(mac, prev_ap), resp, send_deauth, txt); 1723 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1724 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1725 reassoc ? "re" : "", len,
1726 prev_ap[0], prev_ap[1], prev_ap[2],
1727 prev_ap[3], prev_ap[4], prev_ap[5],
1728 resp, send_deauth, txt);
1711#endif 1729#endif
1712} 1730}
1713 1731
@@ -1735,9 +1753,11 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1735 pos = (__le16 *) body; 1753 pos = (__le16 *) body;
1736 reason_code = le16_to_cpu(*pos); 1754 reason_code = le16_to_cpu(*pos);
1737 1755
1738 PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " 1756 PDEBUG(DEBUG_AP, "%s: deauthentication: " MAC_FMT " len=%d, "
1739 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, 1757 "reason_code=%d\n", dev->name,
1740 reason_code); 1758 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1759 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1760 len, reason_code);
1741 1761
1742 spin_lock_bh(&local->ap->sta_table_lock); 1762 spin_lock_bh(&local->ap->sta_table_lock);
1743 sta = ap_get_sta(local->ap, hdr->addr2); 1763 sta = ap_get_sta(local->ap, hdr->addr2);
@@ -1748,9 +1768,11 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1748 } 1768 }
1749 spin_unlock_bh(&local->ap->sta_table_lock); 1769 spin_unlock_bh(&local->ap->sta_table_lock);
1750 if (sta == NULL) { 1770 if (sta == NULL) {
1751 printk("%s: deauthentication from %s, " 1771 printk("%s: deauthentication from " MAC_FMT ", "
1752 "reason_code=%d, but STA not authenticated\n", dev->name, 1772 "reason_code=%d, but STA not authenticated\n", dev->name,
1753 print_mac(mac, hdr->addr2), reason_code); 1773 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1774 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1775 reason_code);
1754 } 1776 }
1755} 1777}
1756 1778
@@ -1766,7 +1788,6 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1766 u16 reason_code; 1788 u16 reason_code;
1767 __le16 *pos; 1789 __le16 *pos;
1768 struct sta_info *sta = NULL; 1790 struct sta_info *sta = NULL;
1769 DECLARE_MAC_BUF(mac);
1770 1791
1771 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1792 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1772 1793
@@ -1778,9 +1799,11 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1778 pos = (__le16 *) body; 1799 pos = (__le16 *) body;
1779 reason_code = le16_to_cpu(*pos); 1800 reason_code = le16_to_cpu(*pos);
1780 1801
1781 PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " 1802 PDEBUG(DEBUG_AP, "%s: disassociation: " MAC_FMT " len=%d, "
1782 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, 1803 "reason_code=%d\n", dev->name,
1783 reason_code); 1804 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1805 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1806 len, reason_code);
1784 1807
1785 spin_lock_bh(&local->ap->sta_table_lock); 1808 spin_lock_bh(&local->ap->sta_table_lock);
1786 sta = ap_get_sta(local->ap, hdr->addr2); 1809 sta = ap_get_sta(local->ap, hdr->addr2);
@@ -1791,9 +1814,12 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1791 } 1814 }
1792 spin_unlock_bh(&local->ap->sta_table_lock); 1815 spin_unlock_bh(&local->ap->sta_table_lock);
1793 if (sta == NULL) { 1816 if (sta == NULL) {
1794 printk("%s: disassociation from %s, " 1817 printk("%s: disassociation from " MAC_FMT ", "
1795 "reason_code=%d, but STA not authenticated\n", 1818 "reason_code=%d, but STA not authenticated\n",
1796 dev->name, print_mac(mac, hdr->addr2), reason_code); 1819 dev->name,
1820 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1821 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1822 reason_code);
1797 } 1823 }
1798} 1824}
1799 1825
@@ -1882,16 +1908,20 @@ static void handle_pspoll(local_info_t *local,
1882 struct sta_info *sta; 1908 struct sta_info *sta;
1883 u16 aid; 1909 u16 aid;
1884 struct sk_buff *skb; 1910 struct sk_buff *skb;
1885 DECLARE_MAC_BUF(mac);
1886 1911
1887 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%s" 1912 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MAC_FMT
1888 ", TA=%s PWRMGT=%d\n", 1913 ", TA=" MAC_FMT " PWRMGT=%d\n",
1889 print_mac(mac, hdr->addr1), print_mac(mac, hdr->addr2), 1914 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
1915 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
1916 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1917 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1890 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); 1918 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
1891 1919
1892 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 1920 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
1893 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=%s" 1921 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MAC_FMT
1894 " not own MAC\n", print_mac(mac, hdr->addr1)); 1922 " not own MAC\n",
1923 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
1924 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
1895 return; 1925 return;
1896 } 1926 }
1897 1927
@@ -1969,7 +1999,6 @@ static void handle_wds_oper_queue(struct work_struct *work)
1969 wds_oper_queue); 1999 wds_oper_queue);
1970 local_info_t *local = ap->local; 2000 local_info_t *local = ap->local;
1971 struct wds_oper_data *entry, *prev; 2001 struct wds_oper_data *entry, *prev;
1972 DECLARE_MAC_BUF(mac);
1973 2002
1974 spin_lock_bh(&local->lock); 2003 spin_lock_bh(&local->lock);
1975 entry = local->ap->wds_oper_entries; 2004 entry = local->ap->wds_oper_entries;
@@ -1978,10 +2007,11 @@ static void handle_wds_oper_queue(struct work_struct *work)
1978 2007
1979 while (entry) { 2008 while (entry) {
1980 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection " 2009 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection "
1981 "to AP %s\n", 2010 "to AP " MAC_FMT "\n",
1982 local->dev->name, 2011 local->dev->name,
1983 entry->type == WDS_ADD ? "adding" : "removing", 2012 entry->type == WDS_ADD ? "adding" : "removing",
1984 print_mac(mac, entry->addr)); 2013 entry->addr[0], entry->addr[1], entry->addr[2],
2014 entry->addr[3], entry->addr[4], entry->addr[5]);
1985 if (entry->type == WDS_ADD) 2015 if (entry->type == WDS_ADD)
1986 prism2_wds_add(local, entry->addr, 0); 2016 prism2_wds_add(local, entry->addr, 0);
1987 else if (entry->type == WDS_DEL) 2017 else if (entry->type == WDS_DEL)
@@ -2158,7 +2188,6 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2158#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2188#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2159 u16 fc, type, stype; 2189 u16 fc, type, stype;
2160 struct ieee80211_hdr_4addr *hdr; 2190 struct ieee80211_hdr_4addr *hdr;
2161 DECLARE_MAC_BUF(mac);
2162 2191
2163 /* FIX: should give skb->len to handler functions and check that the 2192 /* FIX: should give skb->len to handler functions and check that the
2164 * buffer is long enough */ 2193 * buffer is long enough */
@@ -2187,8 +2216,9 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2187 2216
2188 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2217 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2189 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=" 2218 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)="
2190 "%s not own MAC\n", 2219 MAC_FMT " not own MAC\n",
2191 print_mac(mac, hdr->addr1)); 2220 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2221 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2192 goto done; 2222 goto done;
2193 } 2223 }
2194 2224
@@ -2224,14 +2254,18 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2224 } 2254 }
2225 2255
2226 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2256 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2227 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%s" 2257 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=" MAC_FMT
2228 " not own MAC\n", print_mac(mac, hdr->addr1)); 2258 " not own MAC\n",
2259 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2260 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2229 goto done; 2261 goto done;
2230 } 2262 }
2231 2263
2232 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) { 2264 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) {
2233 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%s" 2265 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=" MAC_FMT
2234 " not own MAC\n", print_mac(mac, hdr->addr3)); 2266 " not own MAC\n",
2267 hdr->addr3[0], hdr->addr3[1], hdr->addr3[2],
2268 hdr->addr3[3], hdr->addr3[4], hdr->addr3[5]);
2235 goto done; 2269 goto done;
2236 } 2270 }
2237 2271
@@ -2312,7 +2346,6 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2312 struct sk_buff *skb; 2346 struct sk_buff *skb;
2313 struct ieee80211_hdr_4addr *hdr; 2347 struct ieee80211_hdr_4addr *hdr;
2314 struct hostap_80211_rx_status rx_stats; 2348 struct hostap_80211_rx_status rx_stats;
2315 DECLARE_MAC_BUF(mac);
2316 2349
2317 if (skb_queue_empty(&sta->tx_buf)) 2350 if (skb_queue_empty(&sta->tx_buf))
2318 return; 2351 return;
@@ -2334,7 +2367,9 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2334 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); 2367 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
2335 2368
2336 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA " 2369 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA "
2337 "%s\n", local->dev->name, print_mac(mac, sta->addr)); 2370 MAC_FMT "\n", local->dev->name,
2371 sta->addr[0], sta->addr[1], sta->addr[2],
2372 sta->addr[3], sta->addr[4], sta->addr[5]);
2338 2373
2339 skb->dev = local->dev; 2374 skb->dev = local->dev;
2340 2375
@@ -2661,7 +2696,6 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2661 int ret = sta->tx_rate; 2696 int ret = sta->tx_rate;
2662 struct hostap_interface *iface; 2697 struct hostap_interface *iface;
2663 local_info_t *local; 2698 local_info_t *local;
2664 DECLARE_MAC_BUF(mac);
2665 2699
2666 iface = netdev_priv(dev); 2700 iface = netdev_priv(dev);
2667 local = iface->local; 2701 local = iface->local;
@@ -2689,9 +2723,12 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2689 case 3: sta->tx_rate = 110; break; 2723 case 3: sta->tx_rate = 110; break;
2690 default: sta->tx_rate = 0; break; 2724 default: sta->tx_rate = 0; break;
2691 } 2725 }
2692 PDEBUG(DEBUG_AP, "%s: STA %s" 2726 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
2693 " TX rate raised to %d\n", 2727 " TX rate raised to %d\n",
2694 dev->name, print_mac(mac, sta->addr), sta->tx_rate); 2728 dev->name,
2729 sta->addr[0], sta->addr[1], sta->addr[2],
2730 sta->addr[3], sta->addr[4], sta->addr[5],
2731 sta->tx_rate);
2695 } 2732 }
2696 sta->tx_since_last_failure = 0; 2733 sta->tx_since_last_failure = 0;
2697 } 2734 }
@@ -2709,7 +2746,6 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2709 int set_tim, ret; 2746 int set_tim, ret;
2710 struct ieee80211_hdr_4addr *hdr; 2747 struct ieee80211_hdr_4addr *hdr;
2711 struct hostap_skb_tx_data *meta; 2748 struct hostap_skb_tx_data *meta;
2712 DECLARE_MAC_BUF(mac);
2713 2749
2714 meta = (struct hostap_skb_tx_data *) skb->cb; 2750 meta = (struct hostap_skb_tx_data *) skb->cb;
2715 ret = AP_TX_CONTINUE; 2751 ret = AP_TX_CONTINUE;
@@ -2745,8 +2781,9 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2745 * print out any errors here. */ 2781 * print out any errors here. */
2746 if (net_ratelimit()) { 2782 if (net_ratelimit()) {
2747 printk(KERN_DEBUG "AP: drop packet to non-associated " 2783 printk(KERN_DEBUG "AP: drop packet to non-associated "
2748 "STA %s\n", 2784 "STA " MAC_FMT "\n",
2749 print_mac(mac, hdr->addr1)); 2785 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2786 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2750 } 2787 }
2751#endif 2788#endif
2752 local->ap->tx_drop_nonassoc++; 2789 local->ap->tx_drop_nonassoc++;
@@ -2784,9 +2821,11 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2784 } 2821 }
2785 2822
2786 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) { 2823 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) {
2787 PDEBUG(DEBUG_PS, "%s: No more space in STA (%s" 2824 PDEBUG(DEBUG_PS, "%s: No more space in STA (" MAC_FMT
2788 ")'s PS mode buffer\n", 2825 ")'s PS mode buffer\n",
2789 local->dev->name, print_mac(mac, sta->addr)); 2826 local->dev->name,
2827 sta->addr[0], sta->addr[1], sta->addr[2],
2828 sta->addr[3], sta->addr[4], sta->addr[5]);
2790 /* Make sure that TIM is set for the station (it might not be 2829 /* Make sure that TIM is set for the station (it might not be
2791 * after AP wlan hw reset). */ 2830 * after AP wlan hw reset). */
2792 /* FIX: should fix hw reset to restore bits based on STA 2831 /* FIX: should fix hw reset to restore bits based on STA
@@ -2850,7 +2889,6 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2850 struct sta_info *sta; 2889 struct sta_info *sta;
2851 struct ieee80211_hdr_4addr *hdr; 2890 struct ieee80211_hdr_4addr *hdr;
2852 struct hostap_skb_tx_data *meta; 2891 struct hostap_skb_tx_data *meta;
2853 DECLARE_MAC_BUF(mac);
2854 2892
2855 hdr = (struct ieee80211_hdr_4addr *) skb->data; 2893 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2856 meta = (struct hostap_skb_tx_data *) skb->cb; 2894 meta = (struct hostap_skb_tx_data *) skb->cb;
@@ -2859,9 +2897,12 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2859 sta = ap_get_sta(local->ap, hdr->addr1); 2897 sta = ap_get_sta(local->ap, hdr->addr1);
2860 if (!sta) { 2898 if (!sta) {
2861 spin_unlock(&local->ap->sta_table_lock); 2899 spin_unlock(&local->ap->sta_table_lock);
2862 PDEBUG(DEBUG_AP, "%s: Could not find STA %s" 2900 PDEBUG(DEBUG_AP, "%s: Could not find STA " MAC_FMT
2863 " for this TX error (@%lu)\n", 2901 " for this TX error (@%lu)\n",
2864 local->dev->name, print_mac(mac, hdr->addr1), jiffies); 2902 local->dev->name,
2903 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2904 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
2905 jiffies);
2865 return; 2906 return;
2866 } 2907 }
2867 2908
@@ -2888,9 +2929,11 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2888 case 3: sta->tx_rate = 110; break; 2929 case 3: sta->tx_rate = 110; break;
2889 default: sta->tx_rate = 0; break; 2930 default: sta->tx_rate = 0; break;
2890 } 2931 }
2891 PDEBUG(DEBUG_AP, "%s: STA %s" 2932 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
2892 " TX rate lowered to %d\n", 2933 " TX rate lowered to %d\n",
2893 local->dev->name, print_mac(mac, sta->addr), 2934 local->dev->name,
2935 sta->addr[0], sta->addr[1], sta->addr[2],
2936 sta->addr[3], sta->addr[4], sta->addr[5],
2894 sta->tx_rate); 2937 sta->tx_rate);
2895 } 2938 }
2896 sta->tx_consecutive_exc = 0; 2939 sta->tx_consecutive_exc = 0;
@@ -2956,7 +2999,6 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2956 struct sta_info *sta; 2999 struct sta_info *sta;
2957 u16 fc, type, stype; 3000 u16 fc, type, stype;
2958 struct ieee80211_hdr_4addr *hdr; 3001 struct ieee80211_hdr_4addr *hdr;
2959 DECLARE_MAC_BUF(mac);
2960 3002
2961 if (local->ap == NULL) 3003 if (local->ap == NULL)
2962 return AP_RX_CONTINUE; 3004 return AP_RX_CONTINUE;
@@ -2988,9 +3030,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2988 } else { 3030 } else {
2989 printk(KERN_DEBUG "%s: dropped received packet" 3031 printk(KERN_DEBUG "%s: dropped received packet"
2990 " from non-associated STA " 3032 " from non-associated STA "
2991 "%s" 3033 MAC_FMT
2992 " (type=0x%02x, subtype=0x%02x)\n", 3034 " (type=0x%02x, subtype=0x%02x)\n",
2993 dev->name, print_mac(mac, hdr->addr2), 3035 dev->name,
3036 hdr->addr2[0], hdr->addr2[1],
3037 hdr->addr2[2], hdr->addr2[3],
3038 hdr->addr2[4], hdr->addr2[5],
2994 type >> 2, stype >> 4); 3039 type >> 2, stype >> 4);
2995 hostap_rx(dev, skb, rx_stats); 3040 hostap_rx(dev, skb, rx_stats);
2996#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 3041#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -3025,8 +3070,11 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3025 * being associated. */ 3070 * being associated. */
3026 printk(KERN_DEBUG "%s: rejected received nullfunc " 3071 printk(KERN_DEBUG "%s: rejected received nullfunc "
3027 "frame without ToDS from not associated STA " 3072 "frame without ToDS from not associated STA "
3028 "%s\n", 3073 MAC_FMT "\n",
3029 dev->name, print_mac(mac, hdr->addr2)); 3074 dev->name,
3075 hdr->addr2[0], hdr->addr2[1],
3076 hdr->addr2[2], hdr->addr2[3],
3077 hdr->addr2[4], hdr->addr2[5]);
3030 hostap_rx(dev, skb, rx_stats); 3078 hostap_rx(dev, skb, rx_stats);
3031#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 3079#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
3032 } 3080 }
@@ -3043,9 +3091,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3043 * If BSSID is own, report the dropping of this frame. */ 3091 * If BSSID is own, report the dropping of this frame. */
3044 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 3092 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
3045 printk(KERN_DEBUG "%s: dropped received packet from " 3093 printk(KERN_DEBUG "%s: dropped received packet from "
3046 "%s with no ToDS flag " 3094 MAC_FMT " with no ToDS flag "
3047 "(type=0x%02x, subtype=0x%02x)\n", dev->name, 3095 "(type=0x%02x, subtype=0x%02x)\n", dev->name,
3048 print_mac(mac, hdr->addr2), type >> 2, stype >> 4); 3096 hdr->addr2[0], hdr->addr2[1],
3097 hdr->addr2[2], hdr->addr2[3],
3098 hdr->addr2[4], hdr->addr2[5],
3099 type >> 2, stype >> 4);
3049 hostap_dump_rx_80211(dev->name, skb, rx_stats); 3100 hostap_dump_rx_80211(dev->name, skb, rx_stats);
3050 } 3101 }
3051 ret = AP_RX_DROP; 3102 ret = AP_RX_DROP;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index e79de53bd4f3..fa87c5c2ae0b 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -10192,7 +10192,6 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10192 u8 id, hdr_len, unicast; 10192 u8 id, hdr_len, unicast;
10193 u16 remaining_bytes; 10193 u16 remaining_bytes;
10194 int fc; 10194 int fc;
10195 DECLARE_MAC_BUF(mac);
10196 10195
10197 hdr_len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 10196 hdr_len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
10198 switch (priv->ieee->iw_mode) { 10197 switch (priv->ieee->iw_mode) {
@@ -10203,8 +10202,10 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10203 id = ipw_add_station(priv, hdr->addr1); 10202 id = ipw_add_station(priv, hdr->addr1);
10204 if (id == IPW_INVALID_STATION) { 10203 if (id == IPW_INVALID_STATION) {
10205 IPW_WARNING("Attempt to send data to " 10204 IPW_WARNING("Attempt to send data to "
10206 "invalid cell: %s\n", 10205 "invalid cell: " MAC_FMT "\n",
10207 print_mac(mac, hdr->addr1)); 10206 hdr->addr1[0], hdr->addr1[1],
10207 hdr->addr1[2], hdr->addr1[3],
10208 hdr->addr1[4], hdr->addr1[5]);
10208 goto drop; 10209 goto drop;
10209 } 10210 }
10210 } 10211 }
@@ -11574,6 +11575,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11574 priv->prom_priv->priv = priv; 11575 priv->prom_priv->priv = priv;
11575 11576
11576 strcpy(priv->prom_net_dev->name, "rtap%d"); 11577 strcpy(priv->prom_net_dev->name, "rtap%d");
11578 memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
11577 11579
11578 priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; 11580 priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
11579 priv->prom_net_dev->open = ipw_prom_open; 11581 priv->prom_net_dev->open = ipw_prom_open;
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index f353419acd02..c9c3640ce9fb 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1004,7 +1004,7 @@ void lbs_association_worker(struct work_struct *work)
1004 } 1004 }
1005 1005
1006 if (find_any_ssid) { 1006 if (find_any_ssid) {
1007 u8 new_mode; 1007 u8 new_mode = assoc_req->mode;
1008 1008
1009 ret = lbs_find_best_network_ssid(priv, assoc_req->ssid, 1009 ret = lbs_find_best_network_ssid(priv, assoc_req->ssid,
1010 &assoc_req->ssid_len, assoc_req->mode, &new_mode); 1010 &assoc_req->ssid_len, assoc_req->mode, &new_mode);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 1cb056be4489..468a31c8c113 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2379,10 +2379,8 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2379 */ 2379 */
2380 if (skb_headroom(skb) < intf->beacon->queue->desc_size) { 2380 if (skb_headroom(skb) < intf->beacon->queue->desc_size) {
2381 if (pskb_expand_head(skb, intf->beacon->queue->desc_size, 2381 if (pskb_expand_head(skb, intf->beacon->queue->desc_size,
2382 0, GFP_ATOMIC)) { 2382 0, GFP_ATOMIC))
2383 dev_kfree_skb(skb);
2384 return -ENOMEM; 2383 return -ENOMEM;
2385 }
2386 } 2384 }
2387 2385
2388 /* 2386 /*
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index e3fad3123ecb..3fd3e3b412b6 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -109,12 +109,13 @@ static void set_irq(struct ssb_device *dev, unsigned int irq)
109 clear_irq(bus, oldirq); 109 clear_irq(bus, oldirq);
110 110
111 /* assign the new one */ 111 /* assign the new one */
112 if (irq == 0) 112 if (irq == 0) {
113 ssb_write32(mdev, SSB_INTVEC, ((1 << irqflag) & ssb_read32(mdev, SSB_INTVEC))); 113 ssb_write32(mdev, SSB_INTVEC, ((1 << irqflag) | ssb_read32(mdev, SSB_INTVEC)));
114 114 } else {
115 irqflag <<= ipsflag_irq_shift[irq]; 115 irqflag <<= ipsflag_irq_shift[irq];
116 irqflag |= (ssb_read32(mdev, SSB_IPSFLAG) & ~ipsflag_irq_mask[irq]); 116 irqflag |= (ssb_read32(mdev, SSB_IPSFLAG) & ~ipsflag_irq_mask[irq]);
117 ssb_write32(mdev, SSB_IPSFLAG, irqflag); 117 ssb_write32(mdev, SSB_IPSFLAG, irqflag);
118 }
118} 119}
119 120
120static void ssb_mips_serial_init(struct ssb_mipscore *mcore) 121static void ssb_mips_serial_init(struct ssb_mipscore *mcore)
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 33a7d5620474..2cc668ac5609 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -569,7 +569,7 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
569 } else { 569 } else {
570 tmp = ssb_read32(dev, SSB_TPSFLAG); 570 tmp = ssb_read32(dev, SSB_TPSFLAG);
571 tmp &= SSB_TPSFLAG_BPFLAG; 571 tmp &= SSB_TPSFLAG_BPFLAG;
572 intvec |= tmp; 572 intvec |= (1 << tmp);
573 } 573 }
574 ssb_write32(pdev, SSB_INTVEC, intvec); 574 ssb_write32(pdev, SSB_INTVEC, intvec);
575 } 575 }
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 19ddd2bd1057..6ce92e82b64e 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1190,6 +1190,12 @@ int ssb_bus_may_powerdown(struct ssb_bus *bus)
1190 goto out; 1190 goto out;
1191 1191
1192 cc = &bus->chipco; 1192 cc = &bus->chipco;
1193
1194 if (!cc->dev)
1195 goto out;
1196 if (cc->dev->id.revision < 5)
1197 goto out;
1198
1193 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_SLOW); 1199 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_SLOW);
1194 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0); 1200 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0);
1195 if (err) 1201 if (err)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 29ab9b95d376..e56b739d8e23 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -86,6 +86,7 @@ header-y += if_plip.h
86header-y += if_ppp.h 86header-y += if_ppp.h
87header-y += if_slip.h 87header-y += if_slip.h
88header-y += if_strip.h 88header-y += if_strip.h
89header-y += if_tun.h
89header-y += if_tunnel.h 90header-y += if_tunnel.h
90header-y += in6.h 91header-y += in6.h
91header-y += in_route.h 92header-y += in_route.h
@@ -229,7 +230,6 @@ unifdef-y += if_link.h
229unifdef-y += if_pppol2tp.h 230unifdef-y += if_pppol2tp.h
230unifdef-y += if_pppox.h 231unifdef-y += if_pppox.h
231unifdef-y += if_tr.h 232unifdef-y += if_tr.h
232unifdef-y += if_tun.h
233unifdef-y += if_vlan.h 233unifdef-y += if_vlan.h
234unifdef-y += if_wanpipe.h 234unifdef-y += if_wanpipe.h
235unifdef-y += igmp.h 235unifdef-y += igmp.h
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 72f1c5f47be3..8c71fe2fb1f5 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -18,47 +18,8 @@
18#ifndef __IF_TUN_H 18#ifndef __IF_TUN_H
19#define __IF_TUN_H 19#define __IF_TUN_H
20 20
21/* Uncomment to enable debugging */
22/* #define TUN_DEBUG 1 */
23
24#include <linux/types.h> 21#include <linux/types.h>
25 22
26#ifdef __KERNEL__
27
28#ifdef TUN_DEBUG
29#define DBG if(tun->debug)printk
30#define DBG1 if(debug==2)printk
31#else
32#define DBG( a... )
33#define DBG1( a... )
34#endif
35
36struct tun_struct {
37 struct list_head list;
38 unsigned long flags;
39 int attached;
40 uid_t owner;
41 gid_t group;
42
43 wait_queue_head_t read_wait;
44 struct sk_buff_head readq;
45
46 struct net_device *dev;
47
48 struct fasync_struct *fasync;
49
50 unsigned long if_flags;
51 u8 dev_addr[ETH_ALEN];
52 u32 chr_filter[2];
53 u32 net_filter[2];
54
55#ifdef TUN_DEBUG
56 int debug;
57#endif
58};
59
60#endif /* __KERNEL__ */
61
62/* Read queue size */ 23/* Read queue size */
63#define TUN_READQ_SIZE 500 24#define TUN_READQ_SIZE 500
64 25
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f53e4764fc05..10b666b61add 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,7 +53,7 @@ struct ipv6_opt_hdr {
53 /* 53 /*
54 * TLV encoded option data follows. 54 * TLV encoded option data follows.
55 */ 55 */
56}; 56} __attribute__ ((packed)); /* required for some archs */
57 57
58#define ipv6_destopt_hdr ipv6_opt_hdr 58#define ipv6_destopt_hdr ipv6_opt_hdr
59#define ipv6_hopopt_hdr ipv6_opt_hdr 59#define ipv6_hopopt_hdr ipv6_opt_hdr
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index ba33db053854..7040a782c656 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -47,7 +47,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
47 } while (0) 47 } while (0)
48 48
49#define IP6_ECN_flow_xmit(sk, label) do { \ 49#define IP6_ECN_flow_xmit(sk, label) do { \
50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \ 50 if (INET_ECN_is_capable(inet6_sk(sk)->tclass)) \
51 (label) |= htonl(INET_ECN_ECT_0 << 20); \ 51 (label) |= htonl(INET_ECN_ECT_0 << 20); \
52 } while (0) 52 } while (0)
53 53
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 4263af857794..88988ab03d75 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -104,6 +104,7 @@ typedef enum {
104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ 104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
107 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
107 SCTP_CMD_LAST 108 SCTP_CMD_LAST
108} sctp_verb_t; 109} sctp_verb_t;
109 110
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 9bcfc12275e8..7ea12e8e6676 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -67,7 +67,7 @@ struct sctp_ulpevent {
67}; 67};
68 68
69/* Retrieve the skb this event sits inside of. */ 69/* Retrieve the skb this event sits inside of. */
70static inline struct sk_buff *sctp_event2skb(struct sctp_ulpevent *ev) 70static inline struct sk_buff *sctp_event2skb(const struct sctp_ulpevent *ev)
71{ 71{
72 return container_of((void *)ev, struct sk_buff, cb); 72 return container_of((void *)ev, struct sk_buff, cb);
73} 73}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 2ab350eca02e..2c14edf7b076 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -763,6 +763,8 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
763 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 763 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
764} 764}
765 765
766extern int tcp_limit_reno_sacked(struct tcp_sock *tp);
767
766/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 768/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
767 * The exception is rate halving phase, when cwnd is decreasing towards 769 * The exception is rate halving phase, when cwnd is decreasing towards
768 * ssthresh. 770 * ssthresh.
diff --git a/lib/random32.c b/lib/random32.c
index ec7f81d3fb18..ca87d86992bd 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32);
97 * @seed: seed value 97 * @seed: seed value
98 * 98 *
99 * Add some additional seeding to the random32() pool. 99 * Add some additional seeding to the random32() pool.
100 * Note: this pool is per cpu so it only affects current CPU.
101 */ 100 */
102void srandom32(u32 entropy) 101void srandom32(u32 entropy)
103{ 102{
104 struct rnd_state *state = &get_cpu_var(net_rand_state); 103 int i;
105 __set_random32(state, state->s1 ^ entropy); 104 /*
106 put_cpu_var(state); 105 * No locking on the CPUs, but then somewhat random results are, well,
106 * expected.
107 */
108 for_each_possible_cpu (i) {
109 struct rnd_state *state = &per_cpu(net_rand_state, i);
110 __set_random32(state, state->s1 ^ entropy);
111 }
107} 112}
108EXPORT_SYMBOL(srandom32); 113EXPORT_SYMBOL(srandom32);
109 114
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 0e3b2d3e2339..4ae0d7ef62c1 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev)
692 return 0; 692 return 0;
693} 693}
694 694
695static void vlan_dev_uninit(struct net_device *dev)
696{
697 struct vlan_priority_tci_mapping *pm;
698 struct vlan_dev_info *vlan = vlan_dev_info(dev);
699 int i;
700
701 for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
702 while ((pm = vlan->egress_priority_map[i]) != NULL) {
703 vlan->egress_priority_map[i] = pm->next;
704 kfree(pm);
705 }
706 }
707}
708
695void vlan_setup(struct net_device *dev) 709void vlan_setup(struct net_device *dev)
696{ 710{
697 ether_setup(dev); 711 ether_setup(dev);
@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev)
701 715
702 dev->change_mtu = vlan_dev_change_mtu; 716 dev->change_mtu = vlan_dev_change_mtu;
703 dev->init = vlan_dev_init; 717 dev->init = vlan_dev_init;
718 dev->uninit = vlan_dev_uninit;
704 dev->open = vlan_dev_open; 719 dev->open = vlan_dev_open;
705 dev->stop = vlan_dev_stop; 720 dev->stop = vlan_dev_stop;
706 dev->set_mac_address = vlan_dev_set_mac_address; 721 dev->set_mac_address = vlan_dev_set_mac_address;
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 9bd64bd706b9..653aca3573ac 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -266,7 +266,6 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
266 char buf[300]; 266 char buf[300];
267 int i = 0; 267 int i = 0;
268#endif /* DUMP_PACKETS >0 */ 268#endif /* DUMP_PACKETS >0 */
269 DECLARE_MAC_BUF(mac);
270 269
271 pr_debug("lec_start_xmit called\n"); 270 pr_debug("lec_start_xmit called\n");
272 if (!priv->lecd) { 271 if (!priv->lecd) {
@@ -374,15 +373,19 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
374 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { 373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
375 pr_debug("%s:lec_start_xmit: queuing packet, ", 374 pr_debug("%s:lec_start_xmit: queuing packet, ",
376 dev->name); 375 dev->name);
377 pr_debug("MAC address %s\n", 376 pr_debug("MAC address " MAC_FMT "\n",
378 print_mac(mac, lec_h->h_dest)); 377 lec_h->h_dest[0], lec_h->h_dest[1],
378 lec_h->h_dest[2], lec_h->h_dest[3],
379 lec_h->h_dest[4], lec_h->h_dest[5]);
379 skb_queue_tail(&entry->tx_wait, skb); 380 skb_queue_tail(&entry->tx_wait, skb);
380 } else { 381 } else {
381 pr_debug 382 pr_debug
382 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", 383 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
383 dev->name); 384 dev->name);
384 pr_debug("MAC address %s\n", 385 pr_debug("MAC address " MAC_FMT "\n",
385 print_mac(mac, lec_h->h_dest)); 386 lec_h->h_dest[0], lec_h->h_dest[1],
387 lec_h->h_dest[2], lec_h->h_dest[3],
388 lec_h->h_dest[4], lec_h->h_dest[5]);
386 priv->stats.tx_dropped++; 389 priv->stats.tx_dropped++;
387 dev_kfree_skb(skb); 390 dev_kfree_skb(skb);
388 } 391 }
@@ -394,8 +397,10 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
394 397
395 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { 398 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
396 pr_debug("lec.c: emptying tx queue, "); 399 pr_debug("lec.c: emptying tx queue, ");
397 pr_debug("MAC address %s\n", 400 pr_debug("MAC address " MAC_FMT "\n",
398 print_mac(mac, lec_h->h_dest)); 401 lec_h->h_dest[0], lec_h->h_dest[1],
402 lec_h->h_dest[2], lec_h->h_dest[3],
403 lec_h->h_dest[4], lec_h->h_dest[5]);
399 lec_send(vcc, skb2, priv); 404 lec_send(vcc, skb2, priv);
400 } 405 }
401 406
@@ -449,7 +454,6 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
449 struct lec_arp_table *entry; 454 struct lec_arp_table *entry;
450 int i; 455 int i;
451 char *tmp; /* FIXME */ 456 char *tmp; /* FIXME */
452 DECLARE_MAC_BUF(mac);
453 457
454 atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 458 atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
455 mesg = (struct atmlec_msg *)skb->data; 459 mesg = (struct atmlec_msg *)skb->data;
@@ -536,9 +540,14 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
536 struct net_bridge_fdb_entry *f; 540 struct net_bridge_fdb_entry *f;
537 541
538 pr_debug 542 pr_debug
539 ("%s: bridge zeppelin asks about %s\n", 543 ("%s: bridge zeppelin asks about " MAC_FMT "\n",
540 dev->name, 544 dev->name,
541 print_mac(mac, mesg->content.proxy.mac_addr)); 545 mesg->content.proxy.mac_addr[0],
546 mesg->content.proxy.mac_addr[1],
547 mesg->content.proxy.mac_addr[2],
548 mesg->content.proxy.mac_addr[3],
549 mesg->content.proxy.mac_addr[4],
550 mesg->content.proxy.mac_addr[5]);
542 551
543 if (br_fdb_get_hook == NULL || dev->br_port == NULL) 552 if (br_fdb_get_hook == NULL || dev->br_port == NULL)
544 break; 553 break;
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 5f4eb73fb9d3..57aeba729bae 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -218,9 +218,11 @@ void __exit ax25_uid_free(void)
218 struct hlist_node *node; 218 struct hlist_node *node;
219 219
220 write_lock(&ax25_uid_lock); 220 write_lock(&ax25_uid_lock);
221again:
221 ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { 222 ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) {
222 hlist_del_init(&ax25_uid->uid_node); 223 hlist_del_init(&ax25_uid->uid_node);
223 ax25_uid_put(ax25_uid); 224 ax25_uid_put(ax25_uid);
225 goto again;
224 } 226 }
225 write_unlock(&ax25_uid_lock); 227 write_unlock(&ax25_uid_lock);
226} 228}
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 0278a069c6f1..bb90cd7bace3 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -110,7 +110,10 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
110 * ipt_REJECT needs it. Future netfilter modules might 110 * ipt_REJECT needs it. Future netfilter modules might
111 * require us to fill additional fields. */ 111 * require us to fill additional fields. */
112static struct net_device __fake_net_device = { 112static struct net_device __fake_net_device = {
113 .hard_header_len = ETH_HLEN 113 .hard_header_len = ETH_HLEN,
114#ifdef CONFIG_NET_NS
115 .nd_net = &init_net,
116#endif
114}; 117};
115 118
116static struct rtable __fake_rtable = { 119static struct rtable __fake_rtable = {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4cd12d99b12e..4fe605fa6f8a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2225,8 +2225,8 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum);
2225 * @features: features for the output path (see dev->features) 2225 * @features: features for the output path (see dev->features)
2226 * 2226 *
2227 * This function performs segmentation on the given skb. It returns 2227 * This function performs segmentation on the given skb. It returns
2228 * the segment at the given position. It returns NULL if there are 2228 * a pointer to the first in a list of new skbs for the segments.
2229 * no more segments to generate, or when an error is encountered. 2229 * In case of error it returns ERR_PTR(err).
2230 */ 2230 */
2231struct sk_buff *skb_segment(struct sk_buff *skb, int features) 2231struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2232{ 2232{
diff --git a/net/core/sock.c b/net/core/sock.c
index f2ccb1620dc4..c0ecbdcf75d8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1746,7 +1746,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1746 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; 1746 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
1747 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; 1747 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1748 1748
1749 sk->sk_stamp = ktime_set(-1L, -1L); 1749 sk->sk_stamp = ktime_set(-1L, 0);
1750 1750
1751 atomic_set(&sk->sk_refcnt, 1); 1751 atomic_set(&sk->sk_refcnt, 1);
1752 atomic_set(&sk->sk_drops, 0); 1752 atomic_set(&sk->sk_drops, 0);
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index fe7726b0018f..f44d492d3b74 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -325,6 +325,12 @@ static inline int dccp_bad_service_code(const struct sock *sk,
325 * This is used for transmission as well as for reception. 325 * This is used for transmission as well as for reception.
326 */ 326 */
327struct dccp_skb_cb { 327struct dccp_skb_cb {
328 union {
329 struct inet_skb_parm h4;
330#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
331 struct inet6_skb_parm h6;
332#endif
333 } header;
328 __u8 dccpd_type:4; 334 __u8 dccpd_type:4;
329 __u8 dccpd_ccval:4; 335 __u8 dccpd_ccval:4;
330 __u8 dccpd_reset_code, 336 __u8 dccpd_reset_code,
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index b9974669edb4..baa268d02e24 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -488,7 +488,6 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req)
488 488
489 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr, 489 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr,
490 ireq->rmt_addr); 490 ireq->rmt_addr);
491 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
492 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 491 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
493 ireq->rmt_addr, 492 ireq->rmt_addr,
494 ireq->opt); 493 ireq->opt);
diff --git a/net/dccp/output.c b/net/dccp/output.c
index f32a84ef757b..1f8a9b64c083 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -126,7 +126,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
126 126
127 DCCP_INC_STATS(DCCP_MIB_OUTSEGS); 127 DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
128 128
129 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
130 err = icsk->icsk_af_ops->queue_xmit(skb, 0); 129 err = icsk->icsk_af_ops->queue_xmit(skb, 0);
131 return net_xmit_eval(err); 130 return net_xmit_eval(err);
132 } 131 }
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index d534cdf9603b..a4c1b36f4bc7 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1038,6 +1038,9 @@ static int __init dccp_init(void)
1038 int ehash_order, bhash_order, i; 1038 int ehash_order, bhash_order, i;
1039 int rc = -ENOBUFS; 1039 int rc = -ENOBUFS;
1040 1040
1041 BUILD_BUG_ON(sizeof(struct dccp_skb_cb) >
1042 FIELD_SIZEOF(struct sk_buff, cb));
1043
1041 dccp_hashinfo.bind_bucket_cachep = 1044 dccp_hashinfo.bind_bucket_cachep =
1042 kmem_cache_create("dccp_bind_bucket", 1045 kmem_cache_create("dccp_bind_bucket",
1043 sizeof(struct inet_bind_bucket), 0, 1046 sizeof(struct inet_bind_bucket), 0,
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a7b417523e9b..a80839b02e3f 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -301,7 +301,7 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu)
301static int eth_validate_addr(struct net_device *dev) 301static int eth_validate_addr(struct net_device *dev)
302{ 302{
303 if (!is_valid_ether_addr(dev->dev_addr)) 303 if (!is_valid_ether_addr(dev->dev_addr))
304 return -EINVAL; 304 return -EADDRNOTAVAIL;
305 305
306 return 0; 306 return 0;
307} 307}
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 1e3f87c8c012..200ee1e63728 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -271,7 +271,6 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
271{ 271{
272 struct ieee80211_hdr_3addr *hdr; 272 struct ieee80211_hdr_3addr *hdr;
273 int res, hdrlen; 273 int res, hdrlen;
274 DECLARE_MAC_BUF(mac);
275 274
276 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 275 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
277 return 0; 276 return 0;
@@ -283,8 +282,12 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
283 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 282 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
284 atomic_dec(&crypt->refcnt); 283 atomic_dec(&crypt->refcnt);
285 if (res < 0) { 284 if (res < 0) {
286 IEEE80211_DEBUG_DROP("decryption failed (SA=%s" 285 IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT
287 ") res=%d\n", print_mac(mac, hdr->addr2), res); 286 ") res=%d\n",
287 hdr->addr2[0], hdr->addr2[1],
288 hdr->addr2[2], hdr->addr2[3],
289 hdr->addr2[4], hdr->addr2[5],
290 res);
288 if (res == -2) 291 if (res == -2)
289 IEEE80211_DEBUG_DROP("Decryption failed ICV " 292 IEEE80211_DEBUG_DROP("Decryption failed ICV "
290 "mismatch (key %d)\n", 293 "mismatch (key %d)\n",
@@ -304,7 +307,6 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
304{ 307{
305 struct ieee80211_hdr_3addr *hdr; 308 struct ieee80211_hdr_3addr *hdr;
306 int res, hdrlen; 309 int res, hdrlen;
307 DECLARE_MAC_BUF(mac);
308 310
309 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) 311 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
310 return 0; 312 return 0;
@@ -317,8 +319,12 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
317 atomic_dec(&crypt->refcnt); 319 atomic_dec(&crypt->refcnt);
318 if (res < 0) { 320 if (res < 0) {
319 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 321 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
320 " (SA=%s keyidx=%d)\n", 322 " (SA=" MAC_FMT " keyidx=%d)\n",
321 ieee->dev->name, print_mac(mac, hdr->addr2), keyidx); 323 ieee->dev->name,
324 hdr->addr2[0], hdr->addr2[1],
325 hdr->addr2[2], hdr->addr2[3],
326 hdr->addr2[4], hdr->addr2[5],
327 keyidx);
322 return -1; 328 return -1;
323 } 329 }
324 330
@@ -462,8 +468,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
462 * frames silently instead of filling system log with 468 * frames silently instead of filling system log with
463 * these reports. */ 469 * these reports. */
464 IEEE80211_DEBUG_DROP("Decryption failed (not set)" 470 IEEE80211_DEBUG_DROP("Decryption failed (not set)"
465 " (SA=%s)\n", 471 " (SA=" MAC_FMT ")\n",
466 print_mac(mac, hdr->addr2)); 472 hdr->addr2[0], hdr->addr2[1],
473 hdr->addr2[2], hdr->addr2[3],
474 hdr->addr2[4], hdr->addr2[5]);
467 ieee->ieee_stats.rx_discards_undecryptable++; 475 ieee->ieee_stats.rx_discards_undecryptable++;
468 goto rx_dropped; 476 goto rx_dropped;
469 } 477 }
@@ -474,8 +482,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
474 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && 482 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt &&
475 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { 483 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
476 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 484 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
477 "from %s\n", dev->name, 485 "from " MAC_FMT "\n", dev->name,
478 print_mac(mac, hdr->addr2)); 486 hdr->addr2[0], hdr->addr2[1],
487 hdr->addr2[2], hdr->addr2[3],
488 hdr->addr2[4], hdr->addr2[5]);
479 /* TODO: could inform hostapd about this so that it 489 /* TODO: could inform hostapd about this so that it
480 * could send auth failure report */ 490 * could send auth failure report */
481 goto rx_dropped; 491 goto rx_dropped;
@@ -653,8 +663,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
653 * configured */ 663 * configured */
654 } else { 664 } else {
655 IEEE80211_DEBUG_DROP("encryption configured, but RX " 665 IEEE80211_DEBUG_DROP("encryption configured, but RX "
656 "frame not encrypted (SA=%s" 666 "frame not encrypted (SA="
657 ")\n", print_mac(mac, hdr->addr2)); 667 MAC_FMT ")\n",
668 hdr->addr2[0], hdr->addr2[1],
669 hdr->addr2[2], hdr->addr2[3],
670 hdr->addr2[4], hdr->addr2[5]);
658 goto rx_dropped; 671 goto rx_dropped;
659 } 672 }
660 } 673 }
@@ -662,9 +675,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
662 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && 675 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep &&
663 !ieee80211_is_eapol_frame(ieee, skb)) { 676 !ieee80211_is_eapol_frame(ieee, skb)) {
664 IEEE80211_DEBUG_DROP("dropped unencrypted RX data " 677 IEEE80211_DEBUG_DROP("dropped unencrypted RX data "
665 "frame from %s" 678 "frame from " MAC_FMT
666 " (drop_unencrypted=1)\n", 679 " (drop_unencrypted=1)\n",
667 print_mac(mac, hdr->addr2)); 680 hdr->addr2[0], hdr->addr2[1],
681 hdr->addr2[2], hdr->addr2[3],
682 hdr->addr2[4], hdr->addr2[5]);
668 goto rx_dropped; 683 goto rx_dropped;
669 } 684 }
670 685
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index efc7cbe759c9..3e14d9cd29b3 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -578,7 +578,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
578 } 578 }
579 579
580 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) 580 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET))
581 goto ende; 581 goto relookup_failed;
582 582
583 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) 583 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL)
584 err = __ip_route_output_key(net, &rt2, &fl); 584 err = __ip_route_output_key(net, &rt2, &fl);
@@ -588,7 +588,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
588 588
589 fl2.fl4_dst = fl.fl4_src; 589 fl2.fl4_dst = fl.fl4_src;
590 if (ip_route_output_key(net, &rt2, &fl2)) 590 if (ip_route_output_key(net, &rt2, &fl2))
591 goto ende; 591 goto relookup_failed;
592 592
593 /* Ugh! */ 593 /* Ugh! */
594 odst = skb_in->dst; 594 odst = skb_in->dst;
@@ -601,21 +601,23 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
601 } 601 }
602 602
603 if (err) 603 if (err)
604 goto ende; 604 goto relookup_failed;
605 605
606 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL, 606 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL,
607 XFRM_LOOKUP_ICMP); 607 XFRM_LOOKUP_ICMP);
608 if (err == -ENOENT) { 608 switch (err) {
609 case 0:
610 dst_release(&rt->u.dst);
611 rt = rt2;
612 break;
613 case -EPERM:
614 goto ende;
615 default:
616relookup_failed:
609 if (!rt) 617 if (!rt)
610 goto out_unlock; 618 goto out_unlock;
611 goto route_done; 619 break;
612 } 620 }
613
614 dst_release(&rt->u.dst);
615 rt = rt2;
616
617 if (err)
618 goto out_unlock;
619 } 621 }
620 622
621route_done: 623route_done:
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index d6e76f5229cc..d8adfd4972e2 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1133,7 +1133,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1133 } 1133 }
1134 release_sock(sk); 1134 release_sock(sk);
1135 1135
1136 if (len < sizeof(int) && len > 0 && val>=0 && val<255) { 1136 if (len < sizeof(int) && len > 0 && val>=0 && val<=255) {
1137 unsigned char ucval = (unsigned char)val; 1137 unsigned char ucval = (unsigned char)val;
1138 len = 1; 1138 len = 1;
1139 if (put_user(len, optlen)) 1139 if (put_user(len, optlen))
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 965b08a7d738..380d8daac72b 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -82,8 +82,8 @@ clusterip_config_put(struct clusterip_config *c)
82static inline void 82static inline void
83clusterip_config_entry_put(struct clusterip_config *c) 83clusterip_config_entry_put(struct clusterip_config *c)
84{ 84{
85 write_lock_bh(&clusterip_lock);
85 if (atomic_dec_and_test(&c->entries)) { 86 if (atomic_dec_and_test(&c->entries)) {
86 write_lock_bh(&clusterip_lock);
87 list_del(&c->list); 87 list_del(&c->list);
88 write_unlock_bh(&clusterip_lock); 88 write_unlock_bh(&clusterip_lock);
89 89
@@ -96,7 +96,9 @@ clusterip_config_entry_put(struct clusterip_config *c)
96#ifdef CONFIG_PROC_FS 96#ifdef CONFIG_PROC_FS
97 remove_proc_entry(c->pde->name, c->pde->parent); 97 remove_proc_entry(c->pde->name, c->pde->parent);
98#endif 98#endif
99 return;
99 } 100 }
101 write_unlock_bh(&clusterip_lock);
100} 102}
101 103
102static struct clusterip_config * 104static struct clusterip_config *
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 0d5fa3a54d04..36b4e3bb056f 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -629,6 +629,8 @@ static int __init nf_nat_init(void)
629 size_t i; 629 size_t i;
630 int ret; 630 int ret;
631 631
632 need_ipv4_conntrack();
633
632 ret = nf_ct_extend_register(&nat_extend); 634 ret = nf_ct_extend_register(&nat_extend);
633 if (ret < 0) { 635 if (ret < 0) {
634 printk(KERN_ERR "nf_nat_core: Unable to register extension\n"); 636 printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 743611956045..bd0ee8ca8b21 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1625,13 +1625,11 @@ out:
1625 return flag; 1625 return flag;
1626} 1626}
1627 1627
1628/* If we receive more dupacks than we expected counting segments 1628/* Limits sacked_out so that sum with lost_out isn't ever larger than
1629 * in assumption of absent reordering, interpret this as reordering. 1629 * packets_out. Returns zero if sacked_out adjustement wasn't necessary.
1630 * The only another reason could be bug in receiver TCP.
1631 */ 1630 */
1632static void tcp_check_reno_reordering(struct sock *sk, const int addend) 1631int tcp_limit_reno_sacked(struct tcp_sock *tp)
1633{ 1632{
1634 struct tcp_sock *tp = tcp_sk(sk);
1635 u32 holes; 1633 u32 holes;
1636 1634
1637 holes = max(tp->lost_out, 1U); 1635 holes = max(tp->lost_out, 1U);
@@ -1639,8 +1637,20 @@ static void tcp_check_reno_reordering(struct sock *sk, const int addend)
1639 1637
1640 if ((tp->sacked_out + holes) > tp->packets_out) { 1638 if ((tp->sacked_out + holes) > tp->packets_out) {
1641 tp->sacked_out = tp->packets_out - holes; 1639 tp->sacked_out = tp->packets_out - holes;
1642 tcp_update_reordering(sk, tp->packets_out + addend, 0); 1640 return 1;
1643 } 1641 }
1642 return 0;
1643}
1644
1645/* If we receive more dupacks than we expected counting segments
1646 * in assumption of absent reordering, interpret this as reordering.
1647 * The only another reason could be bug in receiver TCP.
1648 */
1649static void tcp_check_reno_reordering(struct sock *sk, const int addend)
1650{
1651 struct tcp_sock *tp = tcp_sk(sk);
1652 if (tcp_limit_reno_sacked(tp))
1653 tcp_update_reordering(sk, tp->packets_out + addend, 0);
1644} 1654}
1645 1655
1646/* Emulate SACKs for SACKless connection: account for a new dupack. */ 1656/* Emulate SACKs for SACKless connection: account for a new dupack. */
@@ -1681,11 +1691,16 @@ static inline void tcp_reset_reno_sack(struct tcp_sock *tp)
1681int tcp_use_frto(struct sock *sk) 1691int tcp_use_frto(struct sock *sk)
1682{ 1692{
1683 const struct tcp_sock *tp = tcp_sk(sk); 1693 const struct tcp_sock *tp = tcp_sk(sk);
1694 const struct inet_connection_sock *icsk = inet_csk(sk);
1684 struct sk_buff *skb; 1695 struct sk_buff *skb;
1685 1696
1686 if (!sysctl_tcp_frto) 1697 if (!sysctl_tcp_frto)
1687 return 0; 1698 return 0;
1688 1699
1700 /* MTU probe and F-RTO won't really play nicely along currently */
1701 if (icsk->icsk_mtup.probe_size)
1702 return 0;
1703
1689 if (IsSackFrto()) 1704 if (IsSackFrto())
1690 return 1; 1705 return 1;
1691 1706
@@ -2134,11 +2149,13 @@ static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb)
2134/* Mark head of queue up as lost. With RFC3517 SACK, the packets is 2149/* Mark head of queue up as lost. With RFC3517 SACK, the packets is
2135 * is against sacked "cnt", otherwise it's against facked "cnt" 2150 * is against sacked "cnt", otherwise it's against facked "cnt"
2136 */ 2151 */
2137static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit) 2152static void tcp_mark_head_lost(struct sock *sk, int packets)
2138{ 2153{
2139 struct tcp_sock *tp = tcp_sk(sk); 2154 struct tcp_sock *tp = tcp_sk(sk);
2140 struct sk_buff *skb; 2155 struct sk_buff *skb;
2141 int cnt; 2156 int cnt, oldcnt;
2157 int err;
2158 unsigned int mss;
2142 2159
2143 BUG_TRAP(packets <= tp->packets_out); 2160 BUG_TRAP(packets <= tp->packets_out);
2144 if (tp->lost_skb_hint) { 2161 if (tp->lost_skb_hint) {
@@ -2157,13 +2174,25 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit)
2157 tp->lost_skb_hint = skb; 2174 tp->lost_skb_hint = skb;
2158 tp->lost_cnt_hint = cnt; 2175 tp->lost_cnt_hint = cnt;
2159 2176
2177 if (after(TCP_SKB_CB(skb)->end_seq, tp->high_seq))
2178 break;
2179
2180 oldcnt = cnt;
2160 if (tcp_is_fack(tp) || tcp_is_reno(tp) || 2181 if (tcp_is_fack(tp) || tcp_is_reno(tp) ||
2161 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) 2182 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
2162 cnt += tcp_skb_pcount(skb); 2183 cnt += tcp_skb_pcount(skb);
2163 2184
2164 if (((!fast_rexmit || (tp->lost_out > 0)) && (cnt > packets)) || 2185 if (cnt > packets) {
2165 after(TCP_SKB_CB(skb)->end_seq, tp->high_seq)) 2186 if (tcp_is_sack(tp) || (oldcnt >= packets))
2166 break; 2187 break;
2188
2189 mss = skb_shinfo(skb)->gso_size;
2190 err = tcp_fragment(sk, skb, (packets - oldcnt) * mss, mss);
2191 if (err < 0)
2192 break;
2193 cnt = packets;
2194 }
2195
2167 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) { 2196 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) {
2168 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 2197 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
2169 tp->lost_out += tcp_skb_pcount(skb); 2198 tp->lost_out += tcp_skb_pcount(skb);
@@ -2180,17 +2209,17 @@ static void tcp_update_scoreboard(struct sock *sk, int fast_rexmit)
2180 struct tcp_sock *tp = tcp_sk(sk); 2209 struct tcp_sock *tp = tcp_sk(sk);
2181 2210
2182 if (tcp_is_reno(tp)) { 2211 if (tcp_is_reno(tp)) {
2183 tcp_mark_head_lost(sk, 1, fast_rexmit); 2212 tcp_mark_head_lost(sk, 1);
2184 } else if (tcp_is_fack(tp)) { 2213 } else if (tcp_is_fack(tp)) {
2185 int lost = tp->fackets_out - tp->reordering; 2214 int lost = tp->fackets_out - tp->reordering;
2186 if (lost <= 0) 2215 if (lost <= 0)
2187 lost = 1; 2216 lost = 1;
2188 tcp_mark_head_lost(sk, lost, fast_rexmit); 2217 tcp_mark_head_lost(sk, lost);
2189 } else { 2218 } else {
2190 int sacked_upto = tp->sacked_out - tp->reordering; 2219 int sacked_upto = tp->sacked_out - tp->reordering;
2191 if (sacked_upto < 0) 2220 if (sacked_upto < fast_rexmit)
2192 sacked_upto = 0; 2221 sacked_upto = fast_rexmit;
2193 tcp_mark_head_lost(sk, sacked_upto, fast_rexmit); 2222 tcp_mark_head_lost(sk, sacked_upto);
2194 } 2223 }
2195 2224
2196 /* New heuristics: it is possible only after we switched 2225 /* New heuristics: it is possible only after we switched
@@ -2524,7 +2553,7 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag)
2524 before(tp->snd_una, tp->high_seq) && 2553 before(tp->snd_una, tp->high_seq) &&
2525 icsk->icsk_ca_state != TCP_CA_Open && 2554 icsk->icsk_ca_state != TCP_CA_Open &&
2526 tp->fackets_out > tp->reordering) { 2555 tp->fackets_out > tp->reordering) {
2527 tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering, 0); 2556 tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering);
2528 NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); 2557 NET_INC_STATS_BH(LINUX_MIB_TCPLOSS);
2529 } 2558 }
2530 2559
@@ -2586,6 +2615,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag)
2586 case TCP_CA_Loss: 2615 case TCP_CA_Loss:
2587 if (flag & FLAG_DATA_ACKED) 2616 if (flag & FLAG_DATA_ACKED)
2588 icsk->icsk_retransmits = 0; 2617 icsk->icsk_retransmits = 0;
2618 if (tcp_is_reno(tp) && flag & FLAG_SND_UNA_ADVANCED)
2619 tcp_reset_reno_sack(tp);
2589 if (!tcp_try_undo_loss(sk)) { 2620 if (!tcp_try_undo_loss(sk)) {
2590 tcp_moderate_cwnd(tp); 2621 tcp_moderate_cwnd(tp);
2591 tcp_xmit_retransmit_queue(sk); 2622 tcp_xmit_retransmit_queue(sk);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 76b3653e9b4c..90270cbdf42c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1808,6 +1808,9 @@ void tcp_simple_retransmit(struct sock *sk)
1808 if (!lost) 1808 if (!lost)
1809 return; 1809 return;
1810 1810
1811 if (tcp_is_reno(tp))
1812 tcp_limit_reno_sacked(tp);
1813
1811 tcp_verify_left_out(tp); 1814 tcp_verify_left_out(tp);
1812 1815
1813 /* Don't muck with the congestion window here. 1816 /* Don't muck with the congestion window here.
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9d49ed2578d7..8a0fd4007bdb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -372,25 +372,26 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
372 */ 372 */
373 in6_dev_hold(ndev); 373 in6_dev_hold(ndev);
374 374
375#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
376 if (dev->type == ARPHRD_SIT && (dev->priv_flags & IFF_ISATAP)) {
377 printk(KERN_INFO
378 "%s: Disabled Multicast RS\n",
379 dev->name);
380 ndev->cnf.rtr_solicits = 0;
381 }
382#endif
383
375#ifdef CONFIG_IPV6_PRIVACY 384#ifdef CONFIG_IPV6_PRIVACY
376 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev); 385 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev);
377 if ((dev->flags&IFF_LOOPBACK) || 386 if ((dev->flags&IFF_LOOPBACK) ||
378 dev->type == ARPHRD_TUNNEL || 387 dev->type == ARPHRD_TUNNEL ||
379#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE) 388 dev->type == ARPHRD_TUNNEL6 ||
380 dev->type == ARPHRD_SIT || 389 dev->type == ARPHRD_SIT ||
381#endif
382 dev->type == ARPHRD_NONE) { 390 dev->type == ARPHRD_NONE) {
383 printk(KERN_INFO 391 printk(KERN_INFO
384 "%s: Disabled Privacy Extensions\n", 392 "%s: Disabled Privacy Extensions\n",
385 dev->name); 393 dev->name);
386 ndev->cnf.use_tempaddr = -1; 394 ndev->cnf.use_tempaddr = -1;
387
388 if (dev->type == ARPHRD_SIT && (dev->priv_flags & IFF_ISATAP)) {
389 printk(KERN_INFO
390 "%s: Disabled Multicast RS\n",
391 dev->name);
392 ndev->cnf.rtr_solicits = 0;
393 }
394 } else { 395 } else {
395 in6_dev_hold(ndev); 396 in6_dev_hold(ndev);
396 ipv6_regen_rndid((unsigned long) ndev); 397 ipv6_regen_rndid((unsigned long) ndev);
@@ -2529,7 +2530,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2529 2530
2530 ASSERT_RTNL(); 2531 ASSERT_RTNL();
2531 2532
2532 if (dev == init_net.loopback_dev && how == 1) 2533 if ((dev->flags & IFF_LOOPBACK) && how == 1)
2533 how = 0; 2534 how = 0;
2534 2535
2535 rt6_ifdown(net, dev); 2536 rt6_ifdown(net, dev);
@@ -2542,7 +2543,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2542 /* Step 1: remove reference to ipv6 device from parent device. 2543 /* Step 1: remove reference to ipv6 device from parent device.
2543 Do not dev_put! 2544 Do not dev_put!
2544 */ 2545 */
2545 if (how == 1) { 2546 if (how) {
2546 idev->dead = 1; 2547 idev->dead = 1;
2547 2548
2548 /* protected by rtnl_lock */ 2549 /* protected by rtnl_lock */
@@ -2574,12 +2575,12 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2574 write_lock_bh(&idev->lock); 2575 write_lock_bh(&idev->lock);
2575 2576
2576 /* Step 3: clear flags for stateless addrconf */ 2577 /* Step 3: clear flags for stateless addrconf */
2577 if (how != 1) 2578 if (!how)
2578 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); 2579 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
2579 2580
2580 /* Step 4: clear address list */ 2581 /* Step 4: clear address list */
2581#ifdef CONFIG_IPV6_PRIVACY 2582#ifdef CONFIG_IPV6_PRIVACY
2582 if (how == 1 && del_timer(&idev->regen_timer)) 2583 if (how && del_timer(&idev->regen_timer))
2583 in6_dev_put(idev); 2584 in6_dev_put(idev);
2584 2585
2585 /* clear tempaddr list */ 2586 /* clear tempaddr list */
@@ -2616,7 +2617,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2616 2617
2617 /* Step 5: Discard multicast list */ 2618 /* Step 5: Discard multicast list */
2618 2619
2619 if (how == 1) 2620 if (how)
2620 ipv6_mc_destroy_dev(idev); 2621 ipv6_mc_destroy_dev(idev);
2621 else 2622 else
2622 ipv6_mc_down(idev); 2623 ipv6_mc_down(idev);
@@ -2625,7 +2626,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2625 2626
2626 /* Shot the device (if unregistered) */ 2627 /* Shot the device (if unregistered) */
2627 2628
2628 if (how == 1) { 2629 if (how) {
2629 addrconf_sysctl_unregister(idev); 2630 addrconf_sysctl_unregister(idev);
2630 neigh_parms_release(&nd_tbl, idev->nd_parms); 2631 neigh_parms_release(&nd_tbl, idev->nd_parms);
2631 neigh_ifdown(&nd_tbl, dev); 2632 neigh_ifdown(&nd_tbl, dev);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 36e817492095..4e1b29fabdf0 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -314,9 +314,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr)
314 idev->ac_list = aca; 314 idev->ac_list = aca;
315 write_unlock_bh(&idev->lock); 315 write_unlock_bh(&idev->lock);
316 316
317 dst_hold(&rt->u.dst); 317 ip6_ins_rt(rt);
318 if (ip6_ins_rt(rt))
319 dst_release(&rt->u.dst);
320 318
321 addrconf_join_solict(dev, &aca->aca_addr); 319 addrconf_join_solict(dev, &aca->aca_addr);
322 320
@@ -358,10 +356,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr)
358 addrconf_leave_solict(idev, &aca->aca_addr); 356 addrconf_leave_solict(idev, &aca->aca_addr);
359 357
360 dst_hold(&aca->aca_rt->u.dst); 358 dst_hold(&aca->aca_rt->u.dst);
361 if (ip6_del_rt(aca->aca_rt)) 359 ip6_del_rt(aca->aca_rt);
362 dst_free(&aca->aca_rt->u.dst);
363 else
364 dst_release(&aca->aca_rt->u.dst);
365 360
366 aca_put(aca); 361 aca_put(aca);
367 return 0; 362 return 0;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 195086114e63..d42dd16d3487 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -441,24 +441,26 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
441 } 441 }
442 442
443 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 443 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
444 goto out_dst_release; 444 goto relookup_failed;
445 445
446 if (ip6_dst_lookup(sk, &dst2, &fl)) 446 if (ip6_dst_lookup(sk, &dst2, &fl))
447 goto out_dst_release; 447 goto relookup_failed;
448 448
449 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP); 449 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP);
450 if (err == -ENOENT) { 450 switch (err) {
451 case 0:
452 dst_release(dst);
453 dst = dst2;
454 break;
455 case -EPERM:
456 goto out_dst_release;
457 default:
458relookup_failed:
451 if (!dst) 459 if (!dst)
452 goto out; 460 goto out;
453 goto route_done; 461 break;
454 } 462 }
455 463
456 dst_release(dst);
457 dst = dst2;
458
459 if (err)
460 goto out;
461
462route_done: 464route_done:
463 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 465 if (ipv6_addr_is_multicast(&fl.fl6_dst))
464 hlimit = np->mcast_hops; 466 hlimit = np->mcast_hops;
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index dc29007c52cd..40d344b21453 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -466,38 +466,25 @@ static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now)
466 466
467static inline __be32 maskl(__be32 a, unsigned int l) 467static inline __be32 maskl(__be32 a, unsigned int l)
468{ 468{
469 return htonl(ntohl(a) & ~(~(u_int32_t)0 >> l)); 469 return l ? htonl(ntohl(a) & ~0 << (32 - l)) : 0;
470} 470}
471 471
472#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 472#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
473static void hashlimit_ipv6_mask(__be32 *i, unsigned int p) 473static void hashlimit_ipv6_mask(__be32 *i, unsigned int p)
474{ 474{
475 switch (p) { 475 switch (p) {
476 case 0: 476 case 0 ... 31:
477 i[0] = i[1] = 0;
478 i[2] = i[3] = 0;
479 break;
480 case 1 ... 31:
481 i[0] = maskl(i[0], p); 477 i[0] = maskl(i[0], p);
482 i[1] = i[2] = i[3] = 0; 478 i[1] = i[2] = i[3] = 0;
483 break; 479 break;
484 case 32: 480 case 32 ... 63:
485 i[1] = i[2] = i[3] = 0;
486 break;
487 case 33 ... 63:
488 i[1] = maskl(i[1], p - 32); 481 i[1] = maskl(i[1], p - 32);
489 i[2] = i[3] = 0; 482 i[2] = i[3] = 0;
490 break; 483 break;
491 case 64: 484 case 64 ... 95:
492 i[2] = i[3] = 0;
493 break;
494 case 65 ... 95:
495 i[2] = maskl(i[2], p - 64); 485 i[2] = maskl(i[2], p - 64);
496 i[3] = 0; 486 i[3] = 0;
497 case 96: 487 case 96 ... 127:
498 i[3] = 0;
499 break;
500 case 97 ... 127:
501 i[3] = maskl(i[3], p - 96); 488 i[3] = maskl(i[3], p - 96);
502 break; 489 break;
503 case 128: 490 case 128:
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index c5c16b4b6e98..4d755444c449 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -411,8 +411,10 @@ static void u32_destroy(struct tcf_proto *tp)
411 } 411 }
412 } 412 }
413 413
414 for (ht=tp_c->hlist; ht; ht = ht->next) 414 for (ht = tp_c->hlist; ht; ht = ht->next) {
415 ht->refcnt--;
415 u32_clear_hnode(tp, ht); 416 u32_clear_hnode(tp, ht);
417 }
416 418
417 while ((ht = tp_c->hlist) != NULL) { 419 while ((ht = tp_c->hlist) != NULL) {
418 tp_c->hlist = ht->next; 420 tp_c->hlist = ht->next;
@@ -441,8 +443,12 @@ static int u32_delete(struct tcf_proto *tp, unsigned long arg)
441 if (tp->root == ht) 443 if (tp->root == ht)
442 return -EINVAL; 444 return -EINVAL;
443 445
444 if (--ht->refcnt == 0) 446 if (ht->refcnt == 1) {
447 ht->refcnt--;
445 u32_destroy_hnode(tp, ht); 448 u32_destroy_hnode(tp, ht);
449 } else {
450 return -EBUSY;
451 }
446 452
447 return 0; 453 return 0;
448} 454}
@@ -568,7 +574,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
568 if (ht == NULL) 574 if (ht == NULL)
569 return -ENOBUFS; 575 return -ENOBUFS;
570 ht->tp_c = tp_c; 576 ht->tp_c = tp_c;
571 ht->refcnt = 0; 577 ht->refcnt = 1;
572 ht->divisor = divisor; 578 ht->divisor = divisor;
573 ht->handle = handle; 579 ht->handle = handle;
574 ht->prio = tp->prio; 580 ht->prio = tp->prio;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 036bfcc8d15b..e45e44c60635 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -110,8 +110,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
110 spin_lock_bh(&sctp_local_addr_lock); 110 spin_lock_bh(&sctp_local_addr_lock);
111 list_for_each_entry_safe(addr, temp, 111 list_for_each_entry_safe(addr, temp,
112 &sctp_local_addr_list, list) { 112 &sctp_local_addr_list, list) {
113 if (ipv6_addr_equal(&addr->a.v6.sin6_addr, 113 if (addr->a.sa.sa_family == AF_INET6 &&
114 &ifa->addr)) { 114 ipv6_addr_equal(&addr->a.v6.sin6_addr,
115 &ifa->addr)) {
115 found = 1; 116 found = 1;
116 addr->valid = 0; 117 addr->valid = 0;
117 list_del_rcu(&addr->list); 118 list_del_rcu(&addr->list);
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 213c2e2926a9..a7ba9e146dff 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -794,6 +794,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
794 break; 794 break;
795 795
796 case SCTP_CID_ABORT: 796 case SCTP_CID_ABORT:
797 if (sctp_test_T_bit(chunk)) {
798 packet->vtag = asoc->c.my_vtag;
799 }
797 case SCTP_CID_SACK: 800 case SCTP_CID_SACK:
798 case SCTP_CID_HEARTBEAT: 801 case SCTP_CID_HEARTBEAT:
799 case SCTP_CID_HEARTBEAT_ACK: 802 case SCTP_CID_HEARTBEAT_ACK:
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index b34437fdea26..0ec234b762c2 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -650,7 +650,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
650 spin_lock_bh(&sctp_local_addr_lock); 650 spin_lock_bh(&sctp_local_addr_lock);
651 list_for_each_entry_safe(addr, temp, 651 list_for_each_entry_safe(addr, temp,
652 &sctp_local_addr_list, list) { 652 &sctp_local_addr_list, list) {
653 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) { 653 if (addr->a.sa.sa_family == AF_INET &&
654 addr->a.v4.sin_addr.s_addr ==
655 ifa->ifa_local) {
654 found = 1; 656 found = 1;
655 addr->valid = 0; 657 addr->valid = 0;
656 list_del_rcu(&addr->list); 658 list_del_rcu(&addr->list);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0679bddf3a95..81b606424e12 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1982,7 +1982,10 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
1982 struct sctp_chunk *chunk, 1982 struct sctp_chunk *chunk,
1983 struct sctp_chunk **err_chunk) 1983 struct sctp_chunk **err_chunk)
1984{ 1984{
1985 struct sctp_hmac_algo_param *hmacs;
1985 int retval = SCTP_IERROR_NO_ERROR; 1986 int retval = SCTP_IERROR_NO_ERROR;
1987 __u16 n_elt, id = 0;
1988 int i;
1986 1989
1987 /* FIXME - This routine is not looking at each parameter per the 1990 /* FIXME - This routine is not looking at each parameter per the
1988 * chunk type, i.e., unrecognized parameters should be further 1991 * chunk type, i.e., unrecognized parameters should be further
@@ -2056,9 +2059,29 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
2056 break; 2059 break;
2057 2060
2058 case SCTP_PARAM_HMAC_ALGO: 2061 case SCTP_PARAM_HMAC_ALGO:
2059 if (sctp_auth_enable) 2062 if (!sctp_auth_enable)
2060 break; 2063 goto fallthrough;
2061 /* Fall Through */ 2064
2065 hmacs = (struct sctp_hmac_algo_param *)param.p;
2066 n_elt = (ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) >> 1;
2067
2068 /* SCTP-AUTH: Section 6.1
2069 * The HMAC algorithm based on SHA-1 MUST be supported and
2070 * included in the HMAC-ALGO parameter.
2071 */
2072 for (i = 0; i < n_elt; i++) {
2073 id = ntohs(hmacs->hmac_ids[i]);
2074
2075 if (id == SCTP_AUTH_HMAC_ID_SHA1)
2076 break;
2077 }
2078
2079 if (id != SCTP_AUTH_HMAC_ID_SHA1) {
2080 sctp_process_inv_paramlength(asoc, param.p, chunk,
2081 err_chunk);
2082 retval = SCTP_IERROR_ABORT;
2083 }
2084 break;
2062fallthrough: 2085fallthrough:
2063 default: 2086 default:
2064 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", 2087 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n",
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 13beed263e31..23a9f1a95b7d 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1529,6 +1529,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1529 error = sctp_auth_asoc_init_active_key(asoc, 1529 error = sctp_auth_asoc_init_active_key(asoc,
1530 GFP_ATOMIC); 1530 GFP_ATOMIC);
1531 break; 1531 break;
1532 case SCTP_CMD_UPDATE_INITTAG:
1533 asoc->peer.i.init_tag = cmd->obj.u32;
1534 break;
1532 1535
1533 default: 1536 default:
1534 printk(KERN_WARNING "Impossible command: %u, %p\n", 1537 printk(KERN_WARNING "Impossible command: %u, %p\n",
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 622284805500..0c9d5a6950fe 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4138,6 +4138,24 @@ static sctp_disposition_t sctp_sf_abort_violation(
4138 goto nomem; 4138 goto nomem;
4139 4139
4140 if (asoc) { 4140 if (asoc) {
4141 /* Treat INIT-ACK as a special case during COOKIE-WAIT. */
4142 if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK &&
4143 !asoc->peer.i.init_tag) {
4144 sctp_initack_chunk_t *initack;
4145
4146 initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
4147 if (!sctp_chunk_length_valid(chunk,
4148 sizeof(sctp_initack_chunk_t)))
4149 abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T;
4150 else {
4151 unsigned int inittag;
4152
4153 inittag = ntohl(initack->init_hdr.init_tag);
4154 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_INITTAG,
4155 SCTP_U32(inittag));
4156 }
4157 }
4158
4141 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4159 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4142 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); 4160 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
4143 4161
@@ -4343,6 +4361,7 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
4343 sctp_cmd_seq_t *commands) 4361 sctp_cmd_seq_t *commands)
4344{ 4362{
4345 struct sctp_chunk *repl; 4363 struct sctp_chunk *repl;
4364 struct sctp_association* my_asoc;
4346 4365
4347 /* The comment below says that we enter COOKIE-WAIT AFTER 4366 /* The comment below says that we enter COOKIE-WAIT AFTER
4348 * sending the INIT, but that doesn't actually work in our 4367 * sending the INIT, but that doesn't actually work in our
@@ -4366,8 +4385,8 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
4366 /* Cast away the const modifier, as we want to just 4385 /* Cast away the const modifier, as we want to just
4367 * rerun it through as a sideffect. 4386 * rerun it through as a sideffect.
4368 */ 4387 */
4369 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, 4388 my_asoc = (struct sctp_association *)asoc;
4370 SCTP_ASOC((struct sctp_association *) asoc)); 4389 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(my_asoc));
4371 4390
4372 /* Choose transport for INIT. */ 4391 /* Choose transport for INIT. */
4373 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT, 4392 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT,
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 8c90289ba400..e7e3baf7009e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5848,11 +5848,12 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *msg,
5848 sctp_cmsgs_t *cmsgs) 5848 sctp_cmsgs_t *cmsgs)
5849{ 5849{
5850 struct cmsghdr *cmsg; 5850 struct cmsghdr *cmsg;
5851 struct msghdr *my_msg = (struct msghdr *)msg;
5851 5852
5852 for (cmsg = CMSG_FIRSTHDR(msg); 5853 for (cmsg = CMSG_FIRSTHDR(msg);
5853 cmsg != NULL; 5854 cmsg != NULL;
5854 cmsg = CMSG_NXTHDR((struct msghdr*)msg, cmsg)) { 5855 cmsg = CMSG_NXTHDR(my_msg, cmsg)) {
5855 if (!CMSG_OK(msg, cmsg)) 5856 if (!CMSG_OK(my_msg, cmsg))
5856 return -EINVAL; 5857 return -EINVAL;
5857 5858
5858 /* Should we parse this header or ignore? */ 5859 /* Should we parse this header or ignore? */
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index b43f1f110f87..ce6cda6b6994 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -859,7 +859,7 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
859 union sctp_notification *notification; 859 union sctp_notification *notification;
860 struct sk_buff *skb; 860 struct sk_buff *skb;
861 861
862 skb = sctp_event2skb((struct sctp_ulpevent *)event); 862 skb = sctp_event2skb(event);
863 notification = (union sctp_notification *) skb->data; 863 notification = (union sctp_notification *) skb->data;
864 return notification->sn_header.sn_type; 864 return notification->sn_header.sn_type;
865} 865}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 64a7460af734..2bdd4dddc0e1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1161,7 +1161,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
1161 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); 1161 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
1162 params.listen_interval = 1162 params.listen_interval =
1163 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); 1163 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]);
1164 params.listen_interval = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); 1164 params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
1165 1165
1166 if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], 1166 if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS],
1167 &params.station_flags)) 1167 &params.station_flags))
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index ecf9d67daef5..b822b56e5b8e 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -288,7 +288,7 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
288 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); 288 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
289 x->props.flags = p->flags; 289 x->props.flags = p->flags;
290 290
291 if (x->props.mode == XFRM_MODE_TRANSPORT) 291 if (!x->sel.family)
292 x->sel.family = p->family; 292 x->sel.family = p->family;
293 293
294} 294}