aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS13
-rw-r--r--arch/x86/net/bpf_jit_comp.c2
-rw-r--r--drivers/isdn/hardware/mISDN/avmfritz.c2
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c2
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c2
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNipac.c2
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNisar.c2
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c2
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c2
-rw-r--r--drivers/net/bonding/bond_main.c8
-rw-r--r--drivers/net/eql.c7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c40
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c464
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c2
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c4
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c12
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c40
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c7
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c7
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c7
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c6
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c13
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c7
-rw-r--r--drivers/net/ethernet/marvell/sky2.c5
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c2
-rw-r--r--drivers/net/ethernet/renesas/Kconfig5
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c22
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h15
-rw-r--r--drivers/net/ethernet/via/via-rhine.c12
-rw-r--r--drivers/net/rionet.c11
-rw-r--r--drivers/net/usb/cdc-phonet.c4
-rw-r--r--drivers/net/usb/cdc_eem.c1
-rw-r--r--drivers/net/usb/rtl8150.c26
-rw-r--r--drivers/net/usb/zaurus.c5
-rw-r--r--drivers/net/virtio_net.c7
-rw-r--r--drivers/net/wimax/i2400m/netdev.c3
-rw-r--r--drivers/net/wimax/i2400m/usb.c18
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c4
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c4
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c2
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c2
-rw-r--r--drivers/net/wireless/iwlegacy/common.c31
-rw-r--r--drivers/net/wireless/orinoco/main.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c10
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/phy.c2
-rw-r--r--drivers/usb/gadget/f_phonet.c2
-rw-r--r--include/linux/if_eql.h2
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--net/802/garp.c22
-rw-r--r--net/core/dev.c1
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv6/route.c34
-rw-r--r--net/mac80211/agg-rx.c3
-rw-r--r--net/mac80211/main.c3
-rw-r--r--net/mac80211/scan.c2
-rw-r--r--net/netfilter/nfnetlink_acct.c2
-rw-r--r--net/rose/rose_dev.c4
-rw-r--r--net/wireless/nl80211.c29
69 files changed, 705 insertions, 294 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index eecf3441ac2..962232d6278 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1251,7 +1251,6 @@ ATHEROS ATH5K WIRELESS DRIVER
1251M: Jiri Slaby <jirislaby@gmail.com> 1251M: Jiri Slaby <jirislaby@gmail.com>
1252M: Nick Kossifidis <mickflemm@gmail.com> 1252M: Nick Kossifidis <mickflemm@gmail.com>
1253M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> 1253M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
1254M: Bob Copeland <me@bobcopeland.com>
1255L: linux-wireless@vger.kernel.org 1254L: linux-wireless@vger.kernel.org
1256L: ath5k-devel@lists.ath5k.org 1255L: ath5k-devel@lists.ath5k.org
1257W: http://wireless.kernel.org/en/users/Drivers/ath5k 1256W: http://wireless.kernel.org/en/users/Drivers/ath5k
@@ -3557,17 +3556,13 @@ L: linux-pm@vger.kernel.org
3557S: Supported 3556S: Supported
3558F: arch/x86/platform/mrst/pmu.* 3557F: arch/x86/platform/mrst/pmu.*
3559 3558
3560INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT 3559INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
3560M: Stanislav Yakovlev <stas.yakovlev@gmail.com>
3561L: linux-wireless@vger.kernel.org 3561L: linux-wireless@vger.kernel.org
3562S: Orphan 3562S: Maintained
3563F: Documentation/networking/README.ipw2100 3563F: Documentation/networking/README.ipw2100
3564F: drivers/net/wireless/ipw2x00/ipw2100.*
3565
3566INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT
3567L: linux-wireless@vger.kernel.org
3568S: Orphan
3569F: Documentation/networking/README.ipw2200 3564F: Documentation/networking/README.ipw2200
3570F: drivers/net/wireless/ipw2x00/ipw2200.* 3565F: drivers/net/wireless/ipw2x00/
3571 3566
3572INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) 3567INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
3573M: Joseph Cihula <joseph.cihula@intel.com> 3568M: Joseph Cihula <joseph.cihula@intel.com>
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 5671752f8d9..5a5b6e4dd73 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -289,7 +289,7 @@ void bpf_jit_compile(struct sk_filter *fp)
289 EMIT2(0x24, K & 0xFF); /* and imm8,%al */ 289 EMIT2(0x24, K & 0xFF); /* and imm8,%al */
290 } else if (K >= 0xFFFF0000) { 290 } else if (K >= 0xFFFF0000) {
291 EMIT2(0x66, 0x25); /* and imm16,%ax */ 291 EMIT2(0x66, 0x25); /* and imm16,%ax */
292 EMIT2(K, 2); 292 EMIT(K, 2);
293 } else { 293 } else {
294 EMIT1_off32(0x25, K); /* and imm32,%eax */ 294 EMIT1_off32(0x25, K); /* and imm32,%eax */
295 } 295 }
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index 05ed4d0cb18..c0b8c960ee3 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -891,7 +891,7 @@ open_bchannel(struct fritzcard *fc, struct channel_req *rq)
891{ 891{
892 struct bchannel *bch; 892 struct bchannel *bch;
893 893
894 if (rq->adr.channel > 2) 894 if (rq->adr.channel == 0 || rq->adr.channel > 2)
895 return -EINVAL; 895 return -EINVAL;
896 if (rq->protocol == ISDN_P_NONE) 896 if (rq->protocol == ISDN_P_NONE)
897 return -EINVAL; 897 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index d055ae7fa04..e2c83a2d769 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1962,7 +1962,7 @@ open_bchannel(struct hfc_pci *hc, struct channel_req *rq)
1962{ 1962{
1963 struct bchannel *bch; 1963 struct bchannel *bch;
1964 1964
1965 if (rq->adr.channel > 2) 1965 if (rq->adr.channel == 0 || rq->adr.channel > 2)
1966 return -EINVAL; 1966 return -EINVAL;
1967 if (rq->protocol == ISDN_P_NONE) 1967 if (rq->protocol == ISDN_P_NONE)
1968 return -EINVAL; 1968 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 60233873463..8cde2a0538a 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -486,7 +486,7 @@ open_bchannel(struct hfcsusb *hw, struct channel_req *rq)
486{ 486{
487 struct bchannel *bch; 487 struct bchannel *bch;
488 488
489 if (rq->adr.channel > 2) 489 if (rq->adr.channel == 0 || rq->adr.channel > 2)
490 return -EINVAL; 490 return -EINVAL;
491 if (rq->protocol == ISDN_P_NONE) 491 if (rq->protocol == ISDN_P_NONE)
492 return -EINVAL; 492 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index b47e9bed218..884369f09ca 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -1506,7 +1506,7 @@ open_bchannel(struct ipac_hw *ipac, struct channel_req *rq)
1506{ 1506{
1507 struct bchannel *bch; 1507 struct bchannel *bch;
1508 1508
1509 if (rq->adr.channel > 2) 1509 if (rq->adr.channel == 0 || rq->adr.channel > 2)
1510 return -EINVAL; 1510 return -EINVAL;
1511 if (rq->protocol == ISDN_P_NONE) 1511 if (rq->protocol == ISDN_P_NONE)
1512 return -EINVAL; 1512 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index 10446ab404b..9a6da6edcfa 100644
--- a/drivers/isdn/hardware/mISDN/mISDNisar.c
+++ b/drivers/isdn/hardware/mISDN/mISDNisar.c
@@ -1670,7 +1670,7 @@ isar_open(struct isar_hw *isar, struct channel_req *rq)
1670{ 1670{
1671 struct bchannel *bch; 1671 struct bchannel *bch;
1672 1672
1673 if (rq->adr.channel > 2) 1673 if (rq->adr.channel == 0 || rq->adr.channel > 2)
1674 return -EINVAL; 1674 return -EINVAL;
1675 if (rq->protocol == ISDN_P_NONE) 1675 if (rq->protocol == ISDN_P_NONE)
1676 return -EINVAL; 1676 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index dd6de9f7a8a..c726e09d098 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -860,7 +860,7 @@ open_bchannel(struct tiger_hw *card, struct channel_req *rq)
860{ 860{
861 struct bchannel *bch; 861 struct bchannel *bch;
862 862
863 if (rq->adr.channel > 2) 863 if (rq->adr.channel == 0 || rq->adr.channel > 2)
864 return -EINVAL; 864 return -EINVAL;
865 if (rq->protocol == ISDN_P_NONE) 865 if (rq->protocol == ISDN_P_NONE)
866 return -EINVAL; 866 return -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 7f1e7ba75cd..2183357f079 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1015,7 +1015,7 @@ open_bchannel(struct w6692_hw *card, struct channel_req *rq)
1015{ 1015{
1016 struct bchannel *bch; 1016 struct bchannel *bch;
1017 1017
1018 if (rq->adr.channel > 2) 1018 if (rq->adr.channel == 0 || rq->adr.channel > 2)
1019 return -EINVAL; 1019 return -EINVAL;
1020 if (rq->protocol == ISDN_P_NONE) 1020 if (rq->protocol == ISDN_P_NONE)
1021 return -EINVAL; 1021 return -EINVAL;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0c76186bb9e..941b4e189ad 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -891,9 +891,15 @@ static void bond_do_fail_over_mac(struct bonding *bond,
891 891
892 switch (bond->params.fail_over_mac) { 892 switch (bond->params.fail_over_mac) {
893 case BOND_FOM_ACTIVE: 893 case BOND_FOM_ACTIVE:
894 if (new_active) 894 if (new_active) {
895 memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, 895 memcpy(bond->dev->dev_addr, new_active->dev->dev_addr,
896 new_active->dev->addr_len); 896 new_active->dev->addr_len);
897 write_unlock_bh(&bond->curr_slave_lock);
898 read_unlock(&bond->lock);
899 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
900 read_lock(&bond->lock);
901 write_lock_bh(&bond->curr_slave_lock);
902 }
897 break; 903 break;
898 case BOND_FOM_FOLLOW: 904 case BOND_FOM_FOLLOW:
899 /* 905 /*
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index a59cf961a43..f219d38acf5 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -125,6 +125,7 @@
125#include <linux/if.h> 125#include <linux/if.h>
126#include <linux/if_arp.h> 126#include <linux/if_arp.h>
127#include <linux/if_eql.h> 127#include <linux/if_eql.h>
128#include <linux/pkt_sched.h>
128 129
129#include <asm/uaccess.h> 130#include <asm/uaccess.h>
130 131
@@ -143,7 +144,7 @@ static void eql_timer(unsigned long param)
143 equalizer_t *eql = (equalizer_t *) param; 144 equalizer_t *eql = (equalizer_t *) param;
144 struct list_head *this, *tmp, *head; 145 struct list_head *this, *tmp, *head;
145 146
146 spin_lock_bh(&eql->queue.lock); 147 spin_lock(&eql->queue.lock);
147 head = &eql->queue.all_slaves; 148 head = &eql->queue.all_slaves;
148 list_for_each_safe(this, tmp, head) { 149 list_for_each_safe(this, tmp, head) {
149 slave_t *slave = list_entry(this, slave_t, list); 150 slave_t *slave = list_entry(this, slave_t, list);
@@ -157,7 +158,7 @@ static void eql_timer(unsigned long param)
157 } 158 }
158 159
159 } 160 }
160 spin_unlock_bh(&eql->queue.lock); 161 spin_unlock(&eql->queue.lock);
161 162
162 eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL; 163 eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL;
163 add_timer(&eql->timer); 164 add_timer(&eql->timer);
@@ -341,7 +342,7 @@ static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev)
341 struct net_device *slave_dev = slave->dev; 342 struct net_device *slave_dev = slave->dev;
342 343
343 skb->dev = slave_dev; 344 skb->dev = slave_dev;
344 skb->priority = 1; 345 skb->priority = TC_PRIO_FILLER;
345 slave->bytes_queued += skb->len; 346 slave->bytes_queued += skb->len;
346 dev_queue_xmit(skb); 347 dev_queue_xmit(skb);
347 dev->stats.tx_packets++; 348 dev->stats.tx_packets++;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index e37161f1925..2c9ee552dff 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1173,6 +1173,13 @@ enum {
1173}; 1173};
1174 1174
1175 1175
1176struct bnx2x_prev_path_list {
1177 u8 bus;
1178 u8 slot;
1179 u8 path;
1180 struct list_head list;
1181};
1182
1176struct bnx2x { 1183struct bnx2x {
1177 /* Fields used in the tx and intr/napi performance paths 1184 /* Fields used in the tx and intr/napi performance paths
1178 * are grouped together in the beginning of the structure 1185 * are grouped together in the beginning of the structure
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f1f3ca65667..44556b719e8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -1721,6 +1721,29 @@ static void bnx2x_squeeze_objects(struct bnx2x *bp)
1721 } while (0) 1721 } while (0)
1722#endif 1722#endif
1723 1723
1724bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err)
1725{
1726 /* build FW version dword */
1727 u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) +
1728 (BCM_5710_FW_MINOR_VERSION << 8) +
1729 (BCM_5710_FW_REVISION_VERSION << 16) +
1730 (BCM_5710_FW_ENGINEERING_VERSION << 24);
1731
1732 /* read loaded FW from chip */
1733 u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
1734
1735 DP(NETIF_MSG_IFUP, "loaded fw %x, my fw %x\n", loaded_fw, my_fw);
1736
1737 if (loaded_fw != my_fw) {
1738 if (is_err)
1739 BNX2X_ERR("bnx2x with FW %x was already loaded, which mismatches my %x FW. aborting\n",
1740 loaded_fw, my_fw);
1741 return false;
1742 }
1743
1744 return true;
1745}
1746
1724/* must be called with rtnl_lock */ 1747/* must be called with rtnl_lock */
1725int bnx2x_nic_load(struct bnx2x *bp, int load_mode) 1748int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1726{ 1749{
@@ -1815,23 +1838,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1815 } 1838 }
1816 if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && 1839 if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
1817 load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { 1840 load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
1818 /* build FW version dword */
1819 u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) +
1820 (BCM_5710_FW_MINOR_VERSION << 8) +
1821 (BCM_5710_FW_REVISION_VERSION << 16) +
1822 (BCM_5710_FW_ENGINEERING_VERSION << 24);
1823
1824 /* read loaded FW from chip */
1825 u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
1826
1827 DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x",
1828 loaded_fw, my_fw);
1829
1830 /* abort nic load if version mismatch */ 1841 /* abort nic load if version mismatch */
1831 if (my_fw != loaded_fw) { 1842 if (!bnx2x_test_firmware_version(bp, true)) {
1832 BNX2X_ERR("bnx2x with FW %x already loaded, "
1833 "which mismatches my %x FW. aborting",
1834 loaded_fw, my_fw);
1835 rc = -EBUSY; 1843 rc = -EBUSY;
1836 LOAD_ERROR_EXIT(bp, load_error2); 1844 LOAD_ERROR_EXIT(bp, load_error2);
1837 } 1845 }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 8b163388659..5c27454d2ec 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -431,6 +431,9 @@ void bnx2x_panic_dump(struct bnx2x *bp);
431 431
432void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); 432void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl);
433 433
434/* validate currect fw is loaded */
435bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err);
436
434/* dev_close main block */ 437/* dev_close main block */
435int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); 438int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);
436 439
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 5d71b7d4323..dbff5915b81 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -1251,6 +1251,9 @@ struct drv_func_mb {
1251 1251
1252 #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000 1252 #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000
1253 1253
1254 #define DRV_MSG_CODE_INITIATE_FLR 0x02000000
1255 #define REQ_BC_VER_4_INITIATE_FLR 0x00070213
1256
1254 #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000 1257 #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000
1255 #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000 1258 #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000
1256 #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000 1259 #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index beb4cdbdb6e..efa557b76ac 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -35,7 +35,6 @@
35#define ETH_MAX_PACKET_SIZE 1500 35#define ETH_MAX_PACKET_SIZE 1500
36#define ETH_MAX_JUMBO_PACKET_SIZE 9600 36#define ETH_MAX_JUMBO_PACKET_SIZE 9600
37#define MDIO_ACCESS_TIMEOUT 1000 37#define MDIO_ACCESS_TIMEOUT 1000
38#define BMAC_CONTROL_RX_ENABLE 2
39#define WC_LANE_MAX 4 38#define WC_LANE_MAX 4
40#define I2C_SWITCH_WIDTH 2 39#define I2C_SWITCH_WIDTH 2
41#define I2C_BSC0 0 40#define I2C_BSC0 0
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
index 7ba557a610d..763535ee483 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
@@ -89,6 +89,8 @@
89#define PFC_BRB_FULL_LB_XON_THRESHOLD 250 89#define PFC_BRB_FULL_LB_XON_THRESHOLD 250
90 90
91#define MAXVAL(a, b) (((a) > (b)) ? (a) : (b)) 91#define MAXVAL(a, b) (((a) > (b)) ? (a) : (b))
92
93#define BMAC_CONTROL_RX_ENABLE 2
92/***********************************************************/ 94/***********************************************************/
93/* Structs */ 95/* Structs */
94/***********************************************************/ 96/***********************************************************/
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index f7f9aa80726..e077d250872 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -52,6 +52,7 @@
52#include <linux/prefetch.h> 52#include <linux/prefetch.h>
53#include <linux/zlib.h> 53#include <linux/zlib.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/semaphore.h>
55#include <linux/stringify.h> 56#include <linux/stringify.h>
56#include <linux/vmalloc.h> 57#include <linux/vmalloc.h>
57 58
@@ -211,6 +212,10 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2x_pci_tbl) = {
211 212
212MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); 213MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl);
213 214
215/* Global resources for unloading a previously loaded device */
216#define BNX2X_PREV_WAIT_NEEDED 1
217static DEFINE_SEMAPHORE(bnx2x_prev_sem);
218static LIST_HEAD(bnx2x_prev_list);
214/**************************************************************************** 219/****************************************************************************
215* General service functions 220* General service functions
216****************************************************************************/ 221****************************************************************************/
@@ -8812,109 +8817,371 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp)
8812 bnx2x_undi_int_disable_e1h(bp); 8817 bnx2x_undi_int_disable_e1h(bp);
8813} 8818}
8814 8819
8815static void __devinit bnx2x_undi_unload(struct bnx2x *bp) 8820static void __devinit bnx2x_prev_unload_close_mac(struct bnx2x *bp)
8816{ 8821{
8817 u32 val; 8822 u32 val, base_addr, offset, mask, reset_reg;
8823 bool mac_stopped = false;
8824 u8 port = BP_PORT(bp);
8818 8825
8819 /* possibly another driver is trying to reset the chip */ 8826 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2);
8820 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET);
8821 8827
8822 /* check if doorbell queue is reset */ 8828 if (!CHIP_IS_E3(bp)) {
8823 if (REG_RD(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET) 8829 val = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port * 4);
8824 & MISC_REGISTERS_RESET_REG_1_RST_DORQ) { 8830 mask = MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port;
8831 if ((mask & reset_reg) && val) {
8832 u32 wb_data[2];
8833 BNX2X_DEV_INFO("Disable bmac Rx\n");
8834 base_addr = BP_PORT(bp) ? NIG_REG_INGRESS_BMAC1_MEM
8835 : NIG_REG_INGRESS_BMAC0_MEM;
8836 offset = CHIP_IS_E2(bp) ? BIGMAC2_REGISTER_BMAC_CONTROL
8837 : BIGMAC_REGISTER_BMAC_CONTROL;
8825 8838
8826 /* 8839 /*
8827 * Check if it is the UNDI driver 8840 * use rd/wr since we cannot use dmae. This is safe
8841 * since MCP won't access the bus due to the request
8842 * to unload, and no function on the path can be
8843 * loaded at this time.
8844 */
8845 wb_data[0] = REG_RD(bp, base_addr + offset);
8846 wb_data[1] = REG_RD(bp, base_addr + offset + 0x4);
8847 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
8848 REG_WR(bp, base_addr + offset, wb_data[0]);
8849 REG_WR(bp, base_addr + offset + 0x4, wb_data[1]);
8850
8851 }
8852 BNX2X_DEV_INFO("Disable emac Rx\n");
8853 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0);
8854
8855 mac_stopped = true;
8856 } else {
8857 if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) {
8858 BNX2X_DEV_INFO("Disable xmac Rx\n");
8859 base_addr = BP_PORT(bp) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
8860 val = REG_RD(bp, base_addr + XMAC_REG_PFC_CTRL_HI);
8861 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI,
8862 val & ~(1 << 1));
8863 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI,
8864 val | (1 << 1));
8865 REG_WR(bp, base_addr + XMAC_REG_CTRL, 0);
8866 mac_stopped = true;
8867 }
8868 mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port;
8869 if (mask & reset_reg) {
8870 BNX2X_DEV_INFO("Disable umac Rx\n");
8871 base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
8872 REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0);
8873 mac_stopped = true;
8874 }
8875 }
8876
8877 if (mac_stopped)
8878 msleep(20);
8879
8880}
8881
8882#define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4))
8883#define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff)
8884#define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff)
8885#define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq))
8886
8887static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port,
8888 u8 inc)
8889{
8890 u16 rcq, bd;
8891 u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port));
8892
8893 rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc;
8894 bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc;
8895
8896 tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd);
8897 REG_WR(bp, BNX2X_PREV_UNDI_PROD_ADDR(port), tmp_reg);
8898
8899 BNX2X_DEV_INFO("UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n",
8900 port, bd, rcq);
8901}
8902
8903static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp)
8904{
8905 u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0);
8906 if (!rc) {
8907 BNX2X_ERR("MCP response failure, aborting\n");
8908 return -EBUSY;
8909 }
8910
8911 return 0;
8912}
8913
8914static bool __devinit bnx2x_prev_is_path_marked(struct bnx2x *bp)
8915{
8916 struct bnx2x_prev_path_list *tmp_list;
8917 int rc = false;
8918
8919 if (down_trylock(&bnx2x_prev_sem))
8920 return false;
8921
8922 list_for_each_entry(tmp_list, &bnx2x_prev_list, list) {
8923 if (PCI_SLOT(bp->pdev->devfn) == tmp_list->slot &&
8924 bp->pdev->bus->number == tmp_list->bus &&
8925 BP_PATH(bp) == tmp_list->path) {
8926 rc = true;
8927 BNX2X_DEV_INFO("Path %d was already cleaned from previous drivers\n",
8928 BP_PATH(bp));
8929 break;
8930 }
8931 }
8932
8933 up(&bnx2x_prev_sem);
8934
8935 return rc;
8936}
8937
8938static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp)
8939{
8940 struct bnx2x_prev_path_list *tmp_list;
8941 int rc;
8942
8943 tmp_list = (struct bnx2x_prev_path_list *)
8944 kmalloc(sizeof(struct bnx2x_prev_path_list), GFP_KERNEL);
8945 if (!tmp_list) {
8946 BNX2X_ERR("Failed to allocate 'bnx2x_prev_path_list'\n");
8947 return -ENOMEM;
8948 }
8949
8950 tmp_list->bus = bp->pdev->bus->number;
8951 tmp_list->slot = PCI_SLOT(bp->pdev->devfn);
8952 tmp_list->path = BP_PATH(bp);
8953
8954 rc = down_interruptible(&bnx2x_prev_sem);
8955 if (rc) {
8956 BNX2X_ERR("Received %d when tried to take lock\n", rc);
8957 kfree(tmp_list);
8958 } else {
8959 BNX2X_DEV_INFO("Marked path [%d] - finished previous unload\n",
8960 BP_PATH(bp));
8961 list_add(&tmp_list->list, &bnx2x_prev_list);
8962 up(&bnx2x_prev_sem);
8963 }
8964
8965 return rc;
8966}
8967
8968static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
8969{
8970 int pos;
8971 u32 cap;
8972 struct pci_dev *dev = bp->pdev;
8973
8974 pos = pci_pcie_cap(dev);
8975 if (!pos)
8976 return false;
8977
8978 pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
8979 if (!(cap & PCI_EXP_DEVCAP_FLR))
8980 return false;
8981
8982 return true;
8983}
8984
8985static int __devinit bnx2x_do_flr(struct bnx2x *bp)
8986{
8987 int i, pos;
8988 u16 status;
8989 struct pci_dev *dev = bp->pdev;
8990
8991 /* probe the capability first */
8992 if (bnx2x_can_flr(bp))
8993 return -ENOTTY;
8994
8995 pos = pci_pcie_cap(dev);
8996 if (!pos)
8997 return -ENOTTY;
8998
8999 /* Wait for Transaction Pending bit clean */
9000 for (i = 0; i < 4; i++) {
9001 if (i)
9002 msleep((1 << (i - 1)) * 100);
9003
9004 pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &status);
9005 if (!(status & PCI_EXP_DEVSTA_TRPND))
9006 goto clear;
9007 }
9008
9009 dev_err(&dev->dev,
9010 "transaction is not cleared; proceeding with reset anyway\n");
9011
9012clear:
9013 if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9014 BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9015 bp->common.bc_ver);
9016 return -EINVAL;
9017 }
9018
9019 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
9020
9021 return 0;
9022}
9023
9024static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
9025{
9026 int rc;
9027
9028 BNX2X_DEV_INFO("Uncommon unload Flow\n");
9029
9030 /* Test if previous unload process was already finished for this path */
9031 if (bnx2x_prev_is_path_marked(bp))
9032 return bnx2x_prev_mcp_done(bp);
9033
9034 /* If function has FLR capabilities, and existing FW version matches
9035 * the one required, then FLR will be sufficient to clean any residue
9036 * left by previous driver
9037 */
9038 if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp))
9039 return bnx2x_do_flr(bp);
9040
9041 /* Close the MCP request, return failure*/
9042 rc = bnx2x_prev_mcp_done(bp);
9043 if (!rc)
9044 rc = BNX2X_PREV_WAIT_NEEDED;
9045
9046 return rc;
9047}
9048
9049static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp)
9050{
9051 u32 reset_reg, tmp_reg = 0, rc;
9052 /* It is possible a previous function received 'common' answer,
9053 * but hasn't loaded yet, therefore creating a scenario of
9054 * multiple functions receiving 'common' on the same path.
9055 */
9056 BNX2X_DEV_INFO("Common unload Flow\n");
9057
9058 if (bnx2x_prev_is_path_marked(bp))
9059 return bnx2x_prev_mcp_done(bp);
9060
9061 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1);
9062
9063 /* Reset should be performed after BRB is emptied */
9064 if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) {
9065 u32 timer_count = 1000;
9066 bool prev_undi = false;
9067
9068 /* Close the MAC Rx to prevent BRB from filling up */
9069 bnx2x_prev_unload_close_mac(bp);
9070
9071 /* Check if the UNDI driver was previously loaded
8828 * UNDI driver initializes CID offset for normal bell to 0x7 9072 * UNDI driver initializes CID offset for normal bell to 0x7
8829 */ 9073 */
8830 val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); 9074 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1);
8831 if (val == 0x7) { 9075 if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_DORQ) {
8832 u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; 9076 tmp_reg = REG_RD(bp, DORQ_REG_NORM_CID_OFST);
8833 /* save our pf_num */ 9077 if (tmp_reg == 0x7) {
8834 int orig_pf_num = bp->pf_num; 9078 BNX2X_DEV_INFO("UNDI previously loaded\n");
8835 int port; 9079 prev_undi = true;
8836 u32 swap_en, swap_val, value; 9080 /* clear the UNDI indication */
8837 9081 REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
8838 /* clear the UNDI indication */
8839 REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
8840
8841 BNX2X_DEV_INFO("UNDI is active! reset device\n");
8842
8843 /* try unload UNDI on port 0 */
8844 bp->pf_num = 0;
8845 bp->fw_seq =
8846 (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) &
8847 DRV_MSG_SEQ_NUMBER_MASK);
8848 reset_code = bnx2x_fw_command(bp, reset_code, 0);
8849
8850 /* if UNDI is loaded on the other port */
8851 if (reset_code != FW_MSG_CODE_DRV_UNLOAD_COMMON) {
8852
8853 /* send "DONE" for previous unload */
8854 bnx2x_fw_command(bp,
8855 DRV_MSG_CODE_UNLOAD_DONE, 0);
8856
8857 /* unload UNDI on port 1 */
8858 bp->pf_num = 1;
8859 bp->fw_seq =
8860 (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) &
8861 DRV_MSG_SEQ_NUMBER_MASK);
8862 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
8863
8864 bnx2x_fw_command(bp, reset_code, 0);
8865 } 9082 }
9083 }
9084 /* wait until BRB is empty */
9085 tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS);
9086 while (timer_count) {
9087 u32 prev_brb = tmp_reg;
8866 9088
8867 bnx2x_undi_int_disable(bp); 9089 tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS);
8868 port = BP_PORT(bp); 9090 if (!tmp_reg)
8869 9091 break;
8870 /* close input traffic and wait for it */
8871 /* Do not rcv packets to BRB */
8872 REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_DRV_MASK :
8873 NIG_REG_LLH0_BRB1_DRV_MASK), 0x0);
8874 /* Do not direct rcv packets that are not for MCP to
8875 * the BRB */
8876 REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_NOT_MCP :
8877 NIG_REG_LLH0_BRB1_NOT_MCP), 0x0);
8878 /* clear AEU */
8879 REG_WR(bp, (port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 :
8880 MISC_REG_AEU_MASK_ATTN_FUNC_0), 0);
8881 msleep(10);
8882
8883 /* save NIG port swap info */
8884 swap_val = REG_RD(bp, NIG_REG_PORT_SWAP);
8885 swap_en = REG_RD(bp, NIG_REG_STRAP_OVERRIDE);
8886 /* reset device */
8887 REG_WR(bp,
8888 GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
8889 0xd3ffffff);
8890
8891 value = 0x1400;
8892 if (CHIP_IS_E3(bp)) {
8893 value |= MISC_REGISTERS_RESET_REG_2_MSTAT0;
8894 value |= MISC_REGISTERS_RESET_REG_2_MSTAT1;
8895 }
8896 9092
8897 REG_WR(bp, 9093 BNX2X_DEV_INFO("BRB still has 0x%08x\n", tmp_reg);
8898 GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
8899 value);
8900 9094
8901 /* take the NIG out of reset and restore swap values */ 9095 /* reset timer as long as BRB actually gets emptied */
8902 REG_WR(bp, 9096 if (prev_brb > tmp_reg)
8903 GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 9097 timer_count = 1000;
8904 MISC_REGISTERS_RESET_REG_1_RST_NIG); 9098 else
8905 REG_WR(bp, NIG_REG_PORT_SWAP, swap_val); 9099 timer_count--;
8906 REG_WR(bp, NIG_REG_STRAP_OVERRIDE, swap_en);
8907 9100
8908 /* send unload done to the MCP */ 9101 /* If UNDI resides in memory, manually increment it */
8909 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0); 9102 if (prev_undi)
9103 bnx2x_prev_unload_undi_inc(bp, BP_PORT(bp), 1);
8910 9104
8911 /* restore our func and fw_seq */ 9105 udelay(10);
8912 bp->pf_num = orig_pf_num;
8913 } 9106 }
9107
9108 if (!timer_count)
9109 BNX2X_ERR("Failed to empty BRB, hope for the best\n");
9110
8914 } 9111 }
8915 9112
8916 /* now it's safe to release the lock */ 9113 /* No packets are in the pipeline, path is ready for reset */
8917 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); 9114 bnx2x_reset_common(bp);
9115
9116 rc = bnx2x_prev_mark_path(bp);
9117 if (rc) {
9118 bnx2x_prev_mcp_done(bp);
9119 return rc;
9120 }
9121
9122 return bnx2x_prev_mcp_done(bp);
9123}
9124
9125static int __devinit bnx2x_prev_unload(struct bnx2x *bp)
9126{
9127 int time_counter = 10;
9128 u32 rc, fw, hw_lock_reg, hw_lock_val;
9129 BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
9130
9131 /* Release previously held locks */
9132 hw_lock_reg = (BP_FUNC(bp) <= 5) ?
9133 (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) :
9134 (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8);
9135
9136 hw_lock_val = (REG_RD(bp, hw_lock_reg));
9137 if (hw_lock_val) {
9138 if (hw_lock_val & HW_LOCK_RESOURCE_NVRAM) {
9139 BNX2X_DEV_INFO("Release Previously held NVRAM lock\n");
9140 REG_WR(bp, MCP_REG_MCPR_NVM_SW_ARB,
9141 (MCPR_NVM_SW_ARB_ARB_REQ_CLR1 << BP_PORT(bp)));
9142 }
9143
9144 BNX2X_DEV_INFO("Release Previously held hw lock\n");
9145 REG_WR(bp, hw_lock_reg, 0xffffffff);
9146 } else
9147 BNX2X_DEV_INFO("No need to release hw/nvram locks\n");
9148
9149 if (MCPR_ACCESS_LOCK_LOCK & REG_RD(bp, MCP_REG_MCPR_ACCESS_LOCK)) {
9150 BNX2X_DEV_INFO("Release previously held alr\n");
9151 REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, 0);
9152 }
9153
9154
9155 do {
9156 /* Lock MCP using an unload request */
9157 fw = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS, 0);
9158 if (!fw) {
9159 BNX2X_ERR("MCP response failure, aborting\n");
9160 rc = -EBUSY;
9161 break;
9162 }
9163
9164 if (fw == FW_MSG_CODE_DRV_UNLOAD_COMMON) {
9165 rc = bnx2x_prev_unload_common(bp);
9166 break;
9167 }
9168
9169 /* non-common reply from MCP night require looping */
9170 rc = bnx2x_prev_unload_uncommon(bp);
9171 if (rc != BNX2X_PREV_WAIT_NEEDED)
9172 break;
9173
9174 msleep(20);
9175 } while (--time_counter);
9176
9177 if (!time_counter || rc) {
9178 BNX2X_ERR("Failed unloading previous driver, aborting\n");
9179 rc = -EBUSY;
9180 }
9181
9182 BNX2X_DEV_INFO("Finished Previous Unload Flow [%d]\n", rc);
9183
9184 return rc;
8918} 9185}
8919 9186
8920static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) 9187static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
@@ -10100,8 +10367,16 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
10100 func = BP_FUNC(bp); 10367 func = BP_FUNC(bp);
10101 10368
10102 /* need to reset chip if undi was active */ 10369 /* need to reset chip if undi was active */
10103 if (!BP_NOMCP(bp)) 10370 if (!BP_NOMCP(bp)) {
10104 bnx2x_undi_unload(bp); 10371 /* init fw_seq */
10372 bp->fw_seq =
10373 SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
10374 DRV_MSG_SEQ_NUMBER_MASK;
10375 BNX2X_DEV_INFO("fw_seq 0x%08x\n", bp->fw_seq);
10376
10377 bnx2x_prev_unload(bp);
10378 }
10379
10105 10380
10106 if (CHIP_REV_IS_FPGA(bp)) 10381 if (CHIP_REV_IS_FPGA(bp))
10107 dev_err(&bp->pdev->dev, "FPGA detected\n"); 10382 dev_err(&bp->pdev->dev, "FPGA detected\n");
@@ -11431,9 +11706,18 @@ static int __init bnx2x_init(void)
11431 11706
11432static void __exit bnx2x_cleanup(void) 11707static void __exit bnx2x_cleanup(void)
11433{ 11708{
11709 struct list_head *pos, *q;
11434 pci_unregister_driver(&bnx2x_pci_driver); 11710 pci_unregister_driver(&bnx2x_pci_driver);
11435 11711
11436 destroy_workqueue(bnx2x_wq); 11712 destroy_workqueue(bnx2x_wq);
11713
11714 /* Free globablly allocated resources */
11715 list_for_each_safe(pos, q, &bnx2x_prev_list) {
11716 struct bnx2x_prev_path_list *tmp =
11717 list_entry(pos, struct bnx2x_prev_path_list, list);
11718 list_del(pos);
11719 kfree(tmp);
11720 }
11437} 11721}
11438 11722
11439void bnx2x_notify_link_changed(struct bnx2x *bp) 11723void bnx2x_notify_link_changed(struct bnx2x *bp)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
index fd7fb458184..ab0a250f95f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
@@ -987,6 +987,7 @@
987 * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */ 987 * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */
988#define IGU_REG_WRITE_DONE_PENDING 0x130480 988#define IGU_REG_WRITE_DONE_PENDING 0x130480
989#define MCP_A_REG_MCPR_SCRATCH 0x3a0000 989#define MCP_A_REG_MCPR_SCRATCH 0x3a0000
990#define MCP_REG_MCPR_ACCESS_LOCK 0x8009c
990#define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c 991#define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c
991#define MCP_REG_MCPR_GP_INPUTS 0x800c0 992#define MCP_REG_MCPR_GP_INPUTS 0x800c0
992#define MCP_REG_MCPR_GP_OENABLE 0x800c8 993#define MCP_REG_MCPR_GP_OENABLE 0x800c8
@@ -1686,6 +1687,7 @@
1686 [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13] 1687 [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13]
1687 Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16] 1688 Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16]
1688 rst_pxp_rq_rd_wr; 31:17] reserved */ 1689 rst_pxp_rq_rd_wr; 31:17] reserved */
1690#define MISC_REG_RESET_REG_1 0xa580
1689#define MISC_REG_RESET_REG_2 0xa590 1691#define MISC_REG_RESET_REG_2 0xa590
1690/* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is 1692/* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is
1691 shared with the driver resides */ 1693 shared with the driver resides */
@@ -5606,6 +5608,7 @@
5606/* [RC 32] Parity register #0 read clear */ 5608/* [RC 32] Parity register #0 read clear */
5607#define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 5609#define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128
5608#define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 5610#define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138
5611#define MCPR_ACCESS_LOCK_LOCK (1L<<31)
5609#define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) 5612#define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0)
5610#define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) 5613#define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1)
5611#define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) 5614#define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0)
@@ -5732,6 +5735,7 @@
5732#define MISC_REGISTERS_GPIO_PORT_SHIFT 4 5735#define MISC_REGISTERS_GPIO_PORT_SHIFT 4
5733#define MISC_REGISTERS_GPIO_SET_POS 8 5736#define MISC_REGISTERS_GPIO_SET_POS 8
5734#define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 5737#define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588
5738#define MISC_REGISTERS_RESET_REG_1_RST_BRB1 (0x1<<0)
5735#define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) 5739#define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19)
5736#define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) 5740#define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29)
5737#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) 5741#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 3f52fadee3e..51357332162 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -3847,7 +3847,7 @@ static bool bnx2x_credit_pool_get_entry(
3847 continue; 3847 continue;
3848 3848
3849 /* If we've got here we are going to find a free entry */ 3849 /* If we've got here we are going to find a free entry */
3850 for (idx = vec * BNX2X_POOL_VEC_SIZE, i = 0; 3850 for (idx = vec * BIT_VEC64_ELEM_SZ, i = 0;
3851 i < BIT_VEC64_ELEM_SZ; idx++, i++) 3851 i < BIT_VEC64_ELEM_SZ; idx++, i++)
3852 3852
3853 if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { 3853 if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) {
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 4e4bb387586..062ac333fde 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2778,7 +2778,9 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2778 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 2778 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
2779 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || 2779 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
2780 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && 2780 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
2781 (tp->phy_flags & TG3_PHYFLG_MII_SERDES))) 2781 (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
2782 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
2783 !tp->pci_fn))
2782 return; 2784 return;
2783 2785
2784 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || 2786 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX ||
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 9eb815941df..f7f0bf5d037 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -356,13 +356,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
356 356
357 if (prop) 357 if (prop)
358 tbiaddr = *prop; 358 tbiaddr = *prop;
359 }
360 359
361 if (tbiaddr == -1) { 360 if (tbiaddr == -1) {
362 err = -EBUSY; 361 err = -EBUSY;
363 goto err_free_irqs; 362 goto err_free_irqs;
364 } else { 363 } else {
365 out_be32(tbipa, tbiaddr); 364 out_be32(tbipa, tbiaddr);
365 }
366 } 366 }
367 367
368 err = of_mdiobus_register(new_bus, np); 368 err = of_mdiobus_register(new_bus, np);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 0e9aec8f691..4348b6fd44f 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -164,6 +164,8 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
164static bool e1000_vlan_used(struct e1000_adapter *adapter); 164static bool e1000_vlan_used(struct e1000_adapter *adapter);
165static void e1000_vlan_mode(struct net_device *netdev, 165static void e1000_vlan_mode(struct net_device *netdev,
166 netdev_features_t features); 166 netdev_features_t features);
167static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
168 bool filter_on);
167static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 169static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
168static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 170static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
169static void e1000_restore_vlan(struct e1000_adapter *adapter); 171static void e1000_restore_vlan(struct e1000_adapter *adapter);
@@ -215,7 +217,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
215MODULE_LICENSE("GPL"); 217MODULE_LICENSE("GPL");
216MODULE_VERSION(DRV_VERSION); 218MODULE_VERSION(DRV_VERSION);
217 219
218static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE; 220#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
221static int debug = -1;
219module_param(debug, int, 0); 222module_param(debug, int, 0);
220MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 223MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
221 224
@@ -979,7 +982,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
979 adapter = netdev_priv(netdev); 982 adapter = netdev_priv(netdev);
980 adapter->netdev = netdev; 983 adapter->netdev = netdev;
981 adapter->pdev = pdev; 984 adapter->pdev = pdev;
982 adapter->msg_enable = (1 << debug) - 1; 985 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
983 adapter->bars = bars; 986 adapter->bars = bars;
984 adapter->need_ioport = need_ioport; 987 adapter->need_ioport = need_ioport;
985 988
@@ -1214,7 +1217,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1214 if (err) 1217 if (err)
1215 goto err_register; 1218 goto err_register;
1216 1219
1217 e1000_vlan_mode(netdev, netdev->features); 1220 e1000_vlan_filter_on_off(adapter, false);
1218 1221
1219 /* print bus type/speed/width info */ 1222 /* print bus type/speed/width info */
1220 e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n", 1223 e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n",
@@ -4770,6 +4773,22 @@ static bool e1000_vlan_used(struct e1000_adapter *adapter)
4770 return false; 4773 return false;
4771} 4774}
4772 4775
4776static void __e1000_vlan_mode(struct e1000_adapter *adapter,
4777 netdev_features_t features)
4778{
4779 struct e1000_hw *hw = &adapter->hw;
4780 u32 ctrl;
4781
4782 ctrl = er32(CTRL);
4783 if (features & NETIF_F_HW_VLAN_RX) {
4784 /* enable VLAN tag insert/strip */
4785 ctrl |= E1000_CTRL_VME;
4786 } else {
4787 /* disable VLAN tag insert/strip */
4788 ctrl &= ~E1000_CTRL_VME;
4789 }
4790 ew32(CTRL, ctrl);
4791}
4773static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, 4792static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
4774 bool filter_on) 4793 bool filter_on)
4775{ 4794{
@@ -4779,6 +4798,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
4779 if (!test_bit(__E1000_DOWN, &adapter->flags)) 4798 if (!test_bit(__E1000_DOWN, &adapter->flags))
4780 e1000_irq_disable(adapter); 4799 e1000_irq_disable(adapter);
4781 4800
4801 __e1000_vlan_mode(adapter, adapter->netdev->features);
4782 if (filter_on) { 4802 if (filter_on) {
4783 /* enable VLAN receive filtering */ 4803 /* enable VLAN receive filtering */
4784 rctl = er32(RCTL); 4804 rctl = er32(RCTL);
@@ -4799,24 +4819,14 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
4799} 4819}
4800 4820
4801static void e1000_vlan_mode(struct net_device *netdev, 4821static void e1000_vlan_mode(struct net_device *netdev,
4802 netdev_features_t features) 4822 netdev_features_t features)
4803{ 4823{
4804 struct e1000_adapter *adapter = netdev_priv(netdev); 4824 struct e1000_adapter *adapter = netdev_priv(netdev);
4805 struct e1000_hw *hw = &adapter->hw;
4806 u32 ctrl;
4807 4825
4808 if (!test_bit(__E1000_DOWN, &adapter->flags)) 4826 if (!test_bit(__E1000_DOWN, &adapter->flags))
4809 e1000_irq_disable(adapter); 4827 e1000_irq_disable(adapter);
4810 4828
4811 ctrl = er32(CTRL); 4829 __e1000_vlan_mode(adapter, features);
4812 if (features & NETIF_F_HW_VLAN_RX) {
4813 /* enable VLAN tag insert/strip */
4814 ctrl |= E1000_CTRL_VME;
4815 } else {
4816 /* disable VLAN tag insert/strip */
4817 ctrl &= ~E1000_CTRL_VME;
4818 }
4819 ew32(CTRL, ctrl);
4820 4830
4821 if (!test_bit(__E1000_DOWN, &adapter->flags)) 4831 if (!test_bit(__E1000_DOWN, &adapter->flags))
4822 e1000_irq_enable(adapter); 4832 e1000_irq_enable(adapter);
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 7152eb11b7b..2c38a65ade8 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -60,6 +60,11 @@
60char e1000e_driver_name[] = "e1000e"; 60char e1000e_driver_name[] = "e1000e";
61const char e1000e_driver_version[] = DRV_VERSION; 61const char e1000e_driver_version[] = DRV_VERSION;
62 62
63#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
64static int debug = -1;
65module_param(debug, int, 0);
66MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
67
63static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); 68static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state);
64 69
65static const struct e1000_info *e1000_info_tbl[] = { 70static const struct e1000_info *e1000_info_tbl[] = {
@@ -6172,7 +6177,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
6172 adapter->hw.adapter = adapter; 6177 adapter->hw.adapter = adapter;
6173 adapter->hw.mac.type = ei->mac; 6178 adapter->hw.mac.type = ei->mac;
6174 adapter->max_hw_frame_size = ei->max_hw_frame_size; 6179 adapter->max_hw_frame_size = ei->max_hw_frame_size;
6175 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; 6180 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
6176 6181
6177 mmio_start = pci_resource_start(pdev, 0); 6182 mmio_start = pci_resource_start(pdev, 0);
6178 mmio_len = pci_resource_len(pdev, 0); 6183 mmio_len = pci_resource_len(pdev, 0);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index c4902411d74..5ec31598ee4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -238,6 +238,11 @@ MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver");
238MODULE_LICENSE("GPL"); 238MODULE_LICENSE("GPL");
239MODULE_VERSION(DRV_VERSION); 239MODULE_VERSION(DRV_VERSION);
240 240
241#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
242static int debug = -1;
243module_param(debug, int, 0);
244MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
245
241struct igb_reg_info { 246struct igb_reg_info {
242 u32 ofs; 247 u32 ofs;
243 char *name; 248 char *name;
@@ -1893,7 +1898,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1893 adapter->pdev = pdev; 1898 adapter->pdev = pdev;
1894 hw = &adapter->hw; 1899 hw = &adapter->hw;
1895 hw->back = adapter; 1900 hw->back = adapter;
1896 adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE; 1901 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
1897 1902
1898 mmio_start = pci_resource_start(pdev, 0); 1903 mmio_start = pci_resource_start(pdev, 0);
1899 mmio_len = pci_resource_len(pdev, 0); 1904 mmio_len = pci_resource_len(pdev, 0);
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index 217c143686d..d61ca2a732f 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -55,6 +55,11 @@ static const char igbvf_driver_string[] =
55static const char igbvf_copyright[] = 55static const char igbvf_copyright[] =
56 "Copyright (c) 2009 - 2012 Intel Corporation."; 56 "Copyright (c) 2009 - 2012 Intel Corporation.";
57 57
58#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
59static int debug = -1;
60module_param(debug, int, 0);
61MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
62
58static int igbvf_poll(struct napi_struct *napi, int budget); 63static int igbvf_poll(struct napi_struct *napi, int budget);
59static void igbvf_reset(struct igbvf_adapter *); 64static void igbvf_reset(struct igbvf_adapter *);
60static void igbvf_set_interrupt_capability(struct igbvf_adapter *); 65static void igbvf_set_interrupt_capability(struct igbvf_adapter *);
@@ -2649,7 +2654,7 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
2649 adapter->flags = ei->flags; 2654 adapter->flags = ei->flags;
2650 adapter->hw.back = adapter; 2655 adapter->hw.back = adapter;
2651 adapter->hw.mac.type = ei->mac; 2656 adapter->hw.mac.type = ei->mac;
2652 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; 2657 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
2653 2658
2654 /* PCI config space info */ 2659 /* PCI config space info */
2655 2660
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index 82aaa792cbf..5fce363d810 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -134,8 +134,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver");
134MODULE_LICENSE("GPL"); 134MODULE_LICENSE("GPL");
135MODULE_VERSION(DRV_VERSION); 135MODULE_VERSION(DRV_VERSION);
136 136
137#define DEFAULT_DEBUG_LEVEL_SHIFT 3 137#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
138static int debug = DEFAULT_DEBUG_LEVEL_SHIFT; 138static int debug = -1;
139module_param(debug, int, 0); 139module_param(debug, int, 0);
140MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 140MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
141 141
@@ -442,7 +442,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
442 adapter->netdev = netdev; 442 adapter->netdev = netdev;
443 adapter->pdev = pdev; 443 adapter->pdev = pdev;
444 adapter->hw.back = adapter; 444 adapter->hw.back = adapter;
445 adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); 445 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
446 446
447 adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); 447 adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0);
448 if (!adapter->hw.hw_addr) { 448 if (!adapter->hw.hw_addr) {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 80e26ff30eb..74e192107f9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -544,7 +544,7 @@ struct ixgbe_fdir_filter {
544 u16 action; 544 u16 action;
545}; 545};
546 546
547enum ixbge_state_t { 547enum ixgbe_state_t {
548 __IXGBE_TESTING, 548 __IXGBE_TESTING,
549 __IXGBE_RESETTING, 549 __IXGBE_RESETTING,
550 __IXGBE_DOWN, 550 __IXGBE_DOWN,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 398fc223cab..3e26b1f9ac7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -63,8 +63,8 @@ static char ixgbe_default_device_descr[] =
63 "Intel(R) 10 Gigabit Network Connection"; 63 "Intel(R) 10 Gigabit Network Connection";
64#endif 64#endif
65#define MAJ 3 65#define MAJ 3
66#define MIN 6 66#define MIN 8
67#define BUILD 7 67#define BUILD 21
68#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ 68#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \
69 __stringify(BUILD) "-k" 69 __stringify(BUILD) "-k"
70const char ixgbe_driver_version[] = DRV_VERSION; 70const char ixgbe_driver_version[] = DRV_VERSION;
@@ -141,13 +141,16 @@ module_param(allow_unsupported_sfp, uint, 0);
141MODULE_PARM_DESC(allow_unsupported_sfp, 141MODULE_PARM_DESC(allow_unsupported_sfp,
142 "Allow unsupported and untested SFP+ modules on 82599-based adapters"); 142 "Allow unsupported and untested SFP+ modules on 82599-based adapters");
143 143
144#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
145static int debug = -1;
146module_param(debug, int, 0);
147MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
148
144MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); 149MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
145MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver"); 150MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver");
146MODULE_LICENSE("GPL"); 151MODULE_LICENSE("GPL");
147MODULE_VERSION(DRV_VERSION); 152MODULE_VERSION(DRV_VERSION);
148 153
149#define DEFAULT_DEBUG_LEVEL_SHIFT 3
150
151static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) 154static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)
152{ 155{
153 if (!test_bit(__IXGBE_DOWN, &adapter->state) && 156 if (!test_bit(__IXGBE_DOWN, &adapter->state) &&
@@ -6834,7 +6837,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
6834 adapter->pdev = pdev; 6837 adapter->pdev = pdev;
6835 hw = &adapter->hw; 6838 hw = &adapter->hw;
6836 hw->back = adapter; 6839 hw->back = adapter;
6837 adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; 6840 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
6838 6841
6839 hw->hw_addr = ioremap(pci_resource_start(pdev, 0), 6842 hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
6840 pci_resource_len(pdev, 0)); 6843 pci_resource_len(pdev, 0));
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 581c65976bb..307611ae831 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -91,7 +91,10 @@ MODULE_DESCRIPTION("Intel(R) 82599 Virtual Function Driver");
91MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
92MODULE_VERSION(DRV_VERSION); 92MODULE_VERSION(DRV_VERSION);
93 93
94#define DEFAULT_DEBUG_LEVEL_SHIFT 3 94#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
95static int debug = -1;
96module_param(debug, int, 0);
97MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
95 98
96/* forward decls */ 99/* forward decls */
97static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector); 100static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector);
@@ -3367,7 +3370,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
3367 adapter->pdev = pdev; 3370 adapter->pdev = pdev;
3368 hw = &adapter->hw; 3371 hw = &adapter->hw;
3369 hw->back = adapter; 3372 hw->back = adapter;
3370 adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; 3373 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
3371 3374
3372 /* 3375 /*
3373 * call save state here in standalone driver because it relies on 3376 * call save state here in standalone driver because it relies on
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 423a1a2a702..b806d9b4def 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1767,13 +1767,14 @@ static int sky2_open(struct net_device *dev)
1767 1767
1768 sky2_hw_up(sky2); 1768 sky2_hw_up(sky2);
1769 1769
1770 /* Enable interrupts from phy/mac for port */
1771 imask = sky2_read32(hw, B0_IMSK);
1772
1770 if (hw->chip_id == CHIP_ID_YUKON_OPT || 1773 if (hw->chip_id == CHIP_ID_YUKON_OPT ||
1771 hw->chip_id == CHIP_ID_YUKON_PRM || 1774 hw->chip_id == CHIP_ID_YUKON_PRM ||
1772 hw->chip_id == CHIP_ID_YUKON_OP_2) 1775 hw->chip_id == CHIP_ID_YUKON_OP_2)
1773 imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ 1776 imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */
1774 1777
1775 /* Enable interrupts from phy/mac for port */
1776 imask = sky2_read32(hw, B0_IMSK);
1777 imask |= portirq_msk[port]; 1778 imask |= portirq_msk[port];
1778 sky2_write32(hw, B0_IMSK, imask); 1779 sky2_write32(hw, B0_IMSK, imask);
1779 sky2_read32(hw, B0_IMSK); 1780 sky2_read32(hw, B0_IMSK);
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 69444247c20..6dfc26d85e4 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1441,7 +1441,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
1441 } 1441 }
1442#endif 1442#endif
1443 if (!is_valid_ether_addr(ndev->dev_addr)) 1443 if (!is_valid_ether_addr(ndev->dev_addr))
1444 dev_hw_addr_random(ndev, ndev->dev_addr); 1444 eth_hw_addr_random(ndev);
1445 1445
1446 /* Reset the ethernet controller */ 1446 /* Reset the ethernet controller */
1447 __lpc_eth_reset(pldat); 1447 __lpc_eth_reset(pldat);
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
index 9755b49bbef..3fb2355af37 100644
--- a/drivers/net/ethernet/renesas/Kconfig
+++ b/drivers/net/ethernet/renesas/Kconfig
@@ -7,7 +7,8 @@ config SH_ETH
7 depends on SUPERH && \ 7 depends on SUPERH && \
8 (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ 8 (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
9 CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ 9 CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
10 CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757) 10 CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \
11 CPU_SUBTYPE_SH7757)
11 select CRC32 12 select CRC32
12 select NET_CORE 13 select NET_CORE
13 select MII 14 select MII
@@ -16,4 +17,4 @@ config SH_ETH
16 ---help--- 17 ---help---
17 Renesas SuperH Ethernet device driver. 18 Renesas SuperH Ethernet device driver.
18 This driver supporting CPUs are: 19 This driver supporting CPUs are:
19 - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757. 20 - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757.
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 8615961c128..d63e09b29a9 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * SuperH Ethernet device driver 2 * SuperH Ethernet device driver
3 * 3 *
4 * Copyright (C) 2006-2008 Nobuhiro Iwamatsu 4 * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
5 * Copyright (C) 2008-2009 Renesas Solutions Corp. 5 * Copyright (C) 2008-2012 Renesas Solutions Corp.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License, 8 * under the terms and conditions of the GNU General Public License,
@@ -38,6 +38,7 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#include <linux/if_vlan.h> 40#include <linux/if_vlan.h>
41#include <linux/clk.h>
41#include <linux/sh_eth.h> 42#include <linux/sh_eth.h>
42 43
43#include "sh_eth.h" 44#include "sh_eth.h"
@@ -279,8 +280,9 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
279 return &sh_eth_my_cpu_data; 280 return &sh_eth_my_cpu_data;
280} 281}
281 282
282#elif defined(CONFIG_CPU_SUBTYPE_SH7763) 283#elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
283#define SH_ETH_HAS_TSU 1 284#define SH_ETH_HAS_TSU 1
285static void sh_eth_reset_hw_crc(struct net_device *ndev);
284static void sh_eth_chip_reset(struct net_device *ndev) 286static void sh_eth_chip_reset(struct net_device *ndev)
285{ 287{
286 struct sh_eth_private *mdp = netdev_priv(ndev); 288 struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -314,6 +316,9 @@ static void sh_eth_reset(struct net_device *ndev)
314 sh_eth_write(ndev, 0x0, RDFAR); 316 sh_eth_write(ndev, 0x0, RDFAR);
315 sh_eth_write(ndev, 0x0, RDFXR); 317 sh_eth_write(ndev, 0x0, RDFXR);
316 sh_eth_write(ndev, 0x0, RDFFR); 318 sh_eth_write(ndev, 0x0, RDFFR);
319
320 /* Reset HW CRC register */
321 sh_eth_reset_hw_crc(ndev);
317} 322}
318 323
319static void sh_eth_set_duplex(struct net_device *ndev) 324static void sh_eth_set_duplex(struct net_device *ndev)
@@ -370,8 +375,17 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
370 .no_trimd = 1, 375 .no_trimd = 1,
371 .no_ade = 1, 376 .no_ade = 1,
372 .tsu = 1, 377 .tsu = 1,
378#if defined(CONFIG_CPU_SUBTYPE_SH7734)
379 .hw_crc = 1,
380#endif
373}; 381};
374 382
383static void sh_eth_reset_hw_crc(struct net_device *ndev)
384{
385 if (sh_eth_my_cpu_data.hw_crc)
386 sh_eth_write(ndev, 0x0, CSMR);
387}
388
375#elif defined(CONFIG_CPU_SUBTYPE_SH7619) 389#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
376#define SH_ETH_RESET_DEFAULT 1 390#define SH_ETH_RESET_DEFAULT 1
377static struct sh_eth_cpu_data sh_eth_my_cpu_data = { 391static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
@@ -790,7 +804,7 @@ static int sh_eth_dev_init(struct net_device *ndev)
790 /* all sh_eth int mask */ 804 /* all sh_eth int mask */
791 sh_eth_write(ndev, 0, EESIPR); 805 sh_eth_write(ndev, 0, EESIPR);
792 806
793#if defined(__LITTLE_ENDIAN__) 807#if defined(__LITTLE_ENDIAN)
794 if (mdp->cd->hw_swap) 808 if (mdp->cd->hw_swap)
795 sh_eth_write(ndev, EDMR_EL, EDMR); 809 sh_eth_write(ndev, EDMR_EL, EDMR);
796 else 810 else
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 57dc2626111..0fa14afce23 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * SuperH Ethernet device driver 2 * SuperH Ethernet device driver
3 * 3 *
4 * Copyright (C) 2006-2008 Nobuhiro Iwamatsu 4 * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
5 * Copyright (C) 2008-2011 Renesas Solutions Corp. 5 * Copyright (C) 2008-2012 Renesas Solutions Corp.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License, 8 * under the terms and conditions of the GNU General Public License,
@@ -98,6 +98,8 @@ enum {
98 CEECR, 98 CEECR,
99 MAFCR, 99 MAFCR,
100 RTRATE, 100 RTRATE,
101 CSMR,
102 RMII_MII,
101 103
102 /* TSU Absolute address */ 104 /* TSU Absolute address */
103 ARSTR, 105 ARSTR,
@@ -172,6 +174,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
172 [RMCR] = 0x0458, 174 [RMCR] = 0x0458,
173 [RPADIR] = 0x0460, 175 [RPADIR] = 0x0460,
174 [FCFTR] = 0x0468, 176 [FCFTR] = 0x0468,
177 [CSMR] = 0x04E4,
175 178
176 [ECMR] = 0x0500, 179 [ECMR] = 0x0500,
177 [ECSR] = 0x0510, 180 [ECSR] = 0x0510,
@@ -200,6 +203,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
200 [CERCR] = 0x0768, 203 [CERCR] = 0x0768,
201 [CEECR] = 0x0770, 204 [CEECR] = 0x0770,
202 [MAFCR] = 0x0778, 205 [MAFCR] = 0x0778,
206 [RMII_MII] = 0x0790,
203 207
204 [ARSTR] = 0x0000, 208 [ARSTR] = 0x0000,
205 [TSU_CTRST] = 0x0004, 209 [TSU_CTRST] = 0x0004,
@@ -377,7 +381,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
377/* 381/*
378 * Register's bits 382 * Register's bits
379 */ 383 */
380#ifdef CONFIG_CPU_SUBTYPE_SH7763 384#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
381/* EDSR */ 385/* EDSR */
382enum EDSR_BIT { 386enum EDSR_BIT {
383 EDSR_ENT = 0x01, EDSR_ENR = 0x02, 387 EDSR_ENT = 0x01, EDSR_ENR = 0x02,
@@ -689,7 +693,7 @@ enum TSU_FWSLC_BIT {
689 */ 693 */
690struct sh_eth_txdesc { 694struct sh_eth_txdesc {
691 u32 status; /* TD0 */ 695 u32 status; /* TD0 */
692#if defined(CONFIG_CPU_LITTLE_ENDIAN) 696#if defined(__LITTLE_ENDIAN)
693 u16 pad0; /* TD1 */ 697 u16 pad0; /* TD1 */
694 u16 buffer_length; /* TD1 */ 698 u16 buffer_length; /* TD1 */
695#else 699#else
@@ -706,7 +710,7 @@ struct sh_eth_txdesc {
706 */ 710 */
707struct sh_eth_rxdesc { 711struct sh_eth_rxdesc {
708 u32 status; /* RD0 */ 712 u32 status; /* RD0 */
709#if defined(CONFIG_CPU_LITTLE_ENDIAN) 713#if defined(__LITTLE_ENDIAN)
710 u16 frame_length; /* RD1 */ 714 u16 frame_length; /* RD1 */
711 u16 buffer_length; /* RD1 */ 715 u16 buffer_length; /* RD1 */
712#else 716#else
@@ -751,6 +755,7 @@ struct sh_eth_cpu_data {
751 unsigned rpadir:1; /* E-DMAC have RPADIR */ 755 unsigned rpadir:1; /* E-DMAC have RPADIR */
752 unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ 756 unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */
753 unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ 757 unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */
758 unsigned hw_crc:1; /* E-DMAC have CSMR */
754}; 759};
755 760
756struct sh_eth_private { 761struct sh_eth_private {
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 39b8cf3dafc..fcfa01f7ceb 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -503,30 +503,32 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid);
503static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); 503static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
504static void rhine_restart_tx(struct net_device *dev); 504static void rhine_restart_tx(struct net_device *dev);
505 505
506static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool high) 506static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low)
507{ 507{
508 void __iomem *ioaddr = rp->base; 508 void __iomem *ioaddr = rp->base;
509 int i; 509 int i;
510 510
511 for (i = 0; i < 1024; i++) { 511 for (i = 0; i < 1024; i++) {
512 if (high ^ !!(ioread8(ioaddr + reg) & mask)) 512 bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask);
513
514 if (low ^ has_mask_bits)
513 break; 515 break;
514 udelay(10); 516 udelay(10);
515 } 517 }
516 if (i > 64) { 518 if (i > 64) {
517 netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " 519 netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle "
518 "count: %04d\n", high ? "high" : "low", reg, mask, i); 520 "count: %04d\n", low ? "low" : "high", reg, mask, i);
519 } 521 }
520} 522}
521 523
522static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) 524static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask)
523{ 525{
524 rhine_wait_bit(rp, reg, mask, true); 526 rhine_wait_bit(rp, reg, mask, false);
525} 527}
526 528
527static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) 529static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask)
528{ 530{
529 rhine_wait_bit(rp, reg, mask, false); 531 rhine_wait_bit(rp, reg, mask, true);
530} 532}
531 533
532static u32 rhine_get_events(struct rhine_private *rp) 534static u32 rhine_get_events(struct rhine_private *rp)
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index a57f05726b5..91d25888a1b 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -375,8 +375,8 @@ static void rionet_remove(struct rio_dev *rdev)
375 struct net_device *ndev = rio_get_drvdata(rdev); 375 struct net_device *ndev = rio_get_drvdata(rdev);
376 struct rionet_peer *peer, *tmp; 376 struct rionet_peer *peer, *tmp;
377 377
378 free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? 378 free_pages((unsigned long)rionet_active, get_order(sizeof(void *) *
379 __fls(sizeof(void *)) + 4 : 0); 379 RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size)));
380 unregister_netdev(ndev); 380 unregister_netdev(ndev);
381 free_netdev(ndev); 381 free_netdev(ndev);
382 382
@@ -432,15 +432,16 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev)
432 int rc = 0; 432 int rc = 0;
433 struct rionet_private *rnet; 433 struct rionet_private *rnet;
434 u16 device_id; 434 u16 device_id;
435 const size_t rionet_active_bytes = sizeof(void *) *
436 RIO_MAX_ROUTE_ENTRIES(mport->sys_size);
435 437
436 rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, 438 rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL,
437 mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); 439 get_order(rionet_active_bytes));
438 if (!rionet_active) { 440 if (!rionet_active) {
439 rc = -ENOMEM; 441 rc = -ENOMEM;
440 goto out; 442 goto out;
441 } 443 }
442 memset((void *)rionet_active, 0, sizeof(void *) * 444 memset((void *)rionet_active, 0, rionet_active_bytes);
443 RIO_MAX_ROUTE_ENTRIES(mport->sys_size));
444 445
445 /* Set up private area */ 446 /* Set up private area */
446 rnet = netdev_priv(ndev); 447 rnet = netdev_priv(ndev);
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 3886b30ed37..3e41b00c680 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -165,13 +165,13 @@ static void rx_complete(struct urb *req)
165 memcpy(skb_put(skb, 1), page_address(page), 1); 165 memcpy(skb_put(skb, 1), page_address(page), 1);
166 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 166 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
167 page, 1, req->actual_length, 167 page, 1, req->actual_length,
168 req->actual_length); 168 PAGE_SIZE);
169 page = NULL; 169 page = NULL;
170 } 170 }
171 } else { 171 } else {
172 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 172 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
173 page, 0, req->actual_length, 173 page, 0, req->actual_length,
174 req->actual_length); 174 PAGE_SIZE);
175 page = NULL; 175 page = NULL;
176 } 176 }
177 if (req->actual_length < PAGE_SIZE) 177 if (req->actual_length < PAGE_SIZE)
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 439690be519..685a4e22c76 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -93,6 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
93 /* no jumbogram (16K) support for now */ 93 /* no jumbogram (16K) support for now */
94 94
95 dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN; 95 dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
96 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
96 97
97 return 0; 98 return 0;
98} 99}
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 6dda2fe5b15..d363b31053d 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -85,32 +85,6 @@
85#define INT_CRERR_CNT 0x06 85#define INT_CRERR_CNT 0x06
86#define INT_COL_CNT 0x07 86#define INT_COL_CNT 0x07
87 87
88/* Transmit status register errors */
89#define TSR_ECOL (1<<5)
90#define TSR_LCOL (1<<4)
91#define TSR_LOSS_CRS (1<<3)
92#define TSR_JBR (1<<2)
93#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
94/* Receive status register errors */
95#define RSR_CRC (1<<2)
96#define RSR_FAE (1<<1)
97#define RSR_ERRORS (RSR_CRC | RSR_FAE)
98
99/* Media status register definitions */
100#define MSR_DUPLEX (1<<4)
101#define MSR_SPEED (1<<3)
102#define MSR_LINK (1<<2)
103
104/* Interrupt pipe data */
105#define INT_TSR 0x00
106#define INT_RSR 0x01
107#define INT_MSR 0x02
108#define INT_WAKSR 0x03
109#define INT_TXOK_CNT 0x04
110#define INT_RXLOST_CNT 0x05
111#define INT_CRERR_CNT 0x06
112#define INT_COL_CNT 0x07
113
114 88
115#define RTL8150_MTU 1540 89#define RTL8150_MTU 1540
116#define RTL8150_TX_TIMEOUT (HZ) 90#define RTL8150_TX_TIMEOUT (HZ)
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index c3197ce0e2a..34db195fb8b 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -337,6 +337,11 @@ static const struct usb_device_id products [] = {
337 .driver_info = ZAURUS_PXA_INFO, 337 .driver_info = ZAURUS_PXA_INFO,
338}, 338},
339{ 339{
340 /* Motorola Rokr E6 */
341 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6027, USB_CLASS_COMM,
342 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
343 .driver_info = (unsigned long) &bogus_mdlm_info,
344}, {
340 /* Motorola MOTOMAGX phones */ 345 /* Motorola MOTOMAGX phones */
341 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, 346 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
342 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 347 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 019da012669..4de2760c593 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -625,12 +625,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
625 625
626 /* This can happen with OOM and indirect buffers. */ 626 /* This can happen with OOM and indirect buffers. */
627 if (unlikely(capacity < 0)) { 627 if (unlikely(capacity < 0)) {
628 if (net_ratelimit()) { 628 if (likely(capacity == -ENOMEM)) {
629 if (likely(capacity == -ENOMEM)) { 629 if (net_ratelimit()) {
630 dev_warn(&dev->dev, 630 dev_warn(&dev->dev,
631 "TX queue failure: out of memory\n"); 631 "TX queue failure: out of memory\n");
632 } else { 632 } else {
633 dev->stats.tx_fifo_errors++; 633 dev->stats.tx_fifo_errors++;
634 if (net_ratelimit())
634 dev_warn(&dev->dev, 635 dev_warn(&dev->dev,
635 "Unexpected TX queue failure: %d\n", 636 "Unexpected TX queue failure: %d\n",
636 capacity); 637 capacity);
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
index 63e4b709efa..1d76ae855f0 100644
--- a/drivers/net/wimax/i2400m/netdev.c
+++ b/drivers/net/wimax/i2400m/netdev.c
@@ -597,7 +597,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev,
597 struct i2400m *i2400m = net_dev_to_i2400m(net_dev); 597 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
598 598
599 strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); 599 strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
600 strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1); 600 strncpy(info->fw_version,
601 i2400m->fw_name ? : "", sizeof(info->fw_version) - 1);
601 if (net_dev->dev.parent) 602 if (net_dev->dev.parent)
602 strncpy(info->bus_info, dev_name(net_dev->dev.parent), 603 strncpy(info->bus_info, dev_name(net_dev->dev.parent),
603 sizeof(info->bus_info) - 1); 604 sizeof(info->bus_info) - 1);
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
index 2c1b8b68764..29b1e033a10 100644
--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -339,6 +339,23 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
339 return result; 339 return result;
340} 340}
341 341
342static void i2400mu_get_drvinfo(struct net_device *net_dev,
343 struct ethtool_drvinfo *info)
344{
345 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
346 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
347 struct usb_device *udev = i2400mu->usb_dev;
348
349 strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
350 strncpy(info->fw_version,
351 i2400m->fw_name ? : "", sizeof(info->fw_version) - 1);
352 usb_make_path(udev, info->bus_info, sizeof(info->bus_info));
353}
354
355static const struct ethtool_ops i2400mu_ethtool_ops = {
356 .get_drvinfo = i2400mu_get_drvinfo,
357 .get_link = ethtool_op_get_link,
358};
342 359
343static 360static
344void i2400mu_netdev_setup(struct net_device *net_dev) 361void i2400mu_netdev_setup(struct net_device *net_dev)
@@ -347,6 +364,7 @@ void i2400mu_netdev_setup(struct net_device *net_dev)
347 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); 364 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
348 i2400mu_init(i2400mu); 365 i2400mu_init(i2400mu);
349 i2400m_netdev_setup(net_dev); 366 i2400m_netdev_setup(net_dev);
367 net_dev->ethtool_ops = &i2400mu_ethtool_ops;
350} 368}
351 369
352 370
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 2f4b48e6fb0..e5cceb07757 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -20,7 +20,6 @@
20 20
21/* Common calibration code */ 21/* Common calibration code */
22 22
23#define ATH9K_NF_TOO_HIGH -60
24 23
25static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) 24static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
26{ 25{
@@ -346,10 +345,10 @@ static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf)
346 "NF calibrated [%s] [chain %d] is %d\n", 345 "NF calibrated [%s] [chain %d] is %d\n",
347 (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); 346 (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]);
348 347
349 if (nf[i] > ATH9K_NF_TOO_HIGH) { 348 if (nf[i] > limit->max) {
350 ath_dbg(common, CALIBRATE, 349 ath_dbg(common, CALIBRATE,
351 "NF[%d] (%d) > MAX (%d), correcting to MAX\n", 350 "NF[%d] (%d) > MAX (%d), correcting to MAX\n",
352 i, nf[i], ATH9K_NF_TOO_HIGH); 351 i, nf[i], limit->max);
353 nf[i] = limit->max; 352 nf[i] = limit->max;
354 } else if (nf[i] < limit->min) { 353 } else if (nf[i] < limit->min) {
355 ath_dbg(common, CALIBRATE, 354 ath_dbg(common, CALIBRATE,
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 60159f4ee53..cb006458fc4 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -680,7 +680,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
680 hw->queues = 4; 680 hw->queues = 4;
681 hw->max_rates = 4; 681 hw->max_rates = 4;
682 hw->channel_change_time = 5000; 682 hw->channel_change_time = 5000;
683 hw->max_listen_interval = 10; 683 hw->max_listen_interval = 1;
684 hw->max_rate_tries = 10; 684 hw->max_rate_tries = 10;
685 hw->sta_data_size = sizeof(struct ath_node); 685 hw->sta_data_size = sizeof(struct ath_node);
686 hw->vif_data_size = sizeof(struct ath_vif); 686 hw->vif_data_size = sizeof(struct ath_vif);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 38794850f00..215eb2536b1 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -640,7 +640,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,
640 an->sta = sta; 640 an->sta = sta;
641 an->vif = vif; 641 an->vif = vif;
642 642
643 if (sta->ht_cap.ht_supported) { 643 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
644 ath_tx_node_init(sc, an); 644 ath_tx_node_init(sc, an);
645 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + 645 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
646 sta->ht_cap.ampdu_factor); 646 sta->ht_cap.ampdu_factor);
@@ -659,7 +659,7 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta)
659 an->sta = NULL; 659 an->sta = NULL;
660#endif 660#endif
661 661
662 if (sta->ht_cap.ht_supported) 662 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
663 ath_tx_node_cleanup(sc, an); 663 ath_tx_node_cleanup(sc, an);
664} 664}
665 665
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index f4ae3ba994a..1c4583c7ff7 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1913,13 +1913,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1913 if (sc->rx.frag) { 1913 if (sc->rx.frag) {
1914 int space = skb->len - skb_tailroom(hdr_skb); 1914 int space = skb->len - skb_tailroom(hdr_skb);
1915 1915
1916 sc->rx.frag = NULL;
1917
1918 if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { 1916 if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) {
1919 dev_kfree_skb(skb); 1917 dev_kfree_skb(skb);
1920 goto requeue_drop_frag; 1918 goto requeue_drop_frag;
1921 } 1919 }
1922 1920
1921 sc->rx.frag = NULL;
1922
1923 skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), 1923 skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len),
1924 skb->len); 1924 skb->len);
1925 dev_kfree_skb_any(skb); 1925 dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 4fcdac63a30..2b022571a85 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -11507,9 +11507,9 @@ static int ipw_wdev_init(struct net_device *dev)
11507 rc = -ENOMEM; 11507 rc = -ENOMEM;
11508 goto out; 11508 goto out;
11509 } 11509 }
11510 /* translate geo->bg to a_band.channels */ 11510 /* translate geo->a to a_band.channels */
11511 for (i = 0; i < geo->a_channels; i++) { 11511 for (i = 0; i < geo->a_channels; i++) {
11512 a_band->channels[i].band = IEEE80211_BAND_2GHZ; 11512 a_band->channels[i].band = IEEE80211_BAND_5GHZ;
11513 a_band->channels[i].center_freq = geo->a[i].freq; 11513 a_band->channels[i].center_freq = geo->a[i].freq;
11514 a_band->channels[i].hw_value = geo->a[i].channel; 11514 a_band->channels[i].hw_value = geo->a[i].channel;
11515 a_band->channels[i].max_power = geo->a[i].max_power; 11515 a_band->channels[i].max_power = geo->a[i].max_power;
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 0c120939016..faec4046720 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -2673,8 +2673,6 @@ il3945_bg_restart(struct work_struct *data)
2673 2673
2674 if (test_and_clear_bit(S_FW_ERROR, &il->status)) { 2674 if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
2675 mutex_lock(&il->mutex); 2675 mutex_lock(&il->mutex);
2676 /* FIXME: vif can be dereferenced */
2677 il->vif = NULL;
2678 il->is_open = 0; 2676 il->is_open = 0;
2679 mutex_unlock(&il->mutex); 2677 mutex_unlock(&il->mutex);
2680 il3945_down(il); 2678 il3945_down(il);
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 17f1c685318..c46275a9256 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -5652,8 +5652,6 @@ il4965_bg_restart(struct work_struct *data)
5652 5652
5653 if (test_and_clear_bit(S_FW_ERROR, &il->status)) { 5653 if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
5654 mutex_lock(&il->mutex); 5654 mutex_lock(&il->mutex);
5655 /* FIXME: do we dereference vif without mutex locked ? */
5656 il->vif = NULL;
5657 il->is_open = 0; 5655 il->is_open = 0;
5658 5656
5659 __il4965_down(il); 5657 __il4965_down(il);
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index e5ac04739bc..eaf249452e5 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -4508,6 +4508,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4508{ 4508{
4509 struct il_priv *il = hw->priv; 4509 struct il_priv *il = hw->priv;
4510 int err; 4510 int err;
4511 bool reset;
4511 4512
4512 mutex_lock(&il->mutex); 4513 mutex_lock(&il->mutex);
4513 D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); 4514 D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr);
@@ -4518,7 +4519,12 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4518 goto out; 4519 goto out;
4519 } 4520 }
4520 4521
4521 if (il->vif) { 4522 /*
4523 * We do not support multiple virtual interfaces, but on hardware reset
4524 * we have to add the same interface again.
4525 */
4526 reset = (il->vif == vif);
4527 if (il->vif && !reset) {
4522 err = -EOPNOTSUPP; 4528 err = -EOPNOTSUPP;
4523 goto out; 4529 goto out;
4524 } 4530 }
@@ -4528,8 +4534,11 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4528 4534
4529 err = il_set_mode(il); 4535 err = il_set_mode(il);
4530 if (err) { 4536 if (err) {
4531 il->vif = NULL; 4537 IL_WARN("Fail to set mode %d\n", vif->type);
4532 il->iw_mode = NL80211_IFTYPE_STATION; 4538 if (!reset) {
4539 il->vif = NULL;
4540 il->iw_mode = NL80211_IFTYPE_STATION;
4541 }
4533 } 4542 }
4534 4543
4535out: 4544out:
@@ -5279,9 +5288,9 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5279 D_MAC80211("BSSID %pM\n", bss_conf->bssid); 5288 D_MAC80211("BSSID %pM\n", bss_conf->bssid);
5280 5289
5281 /* 5290 /*
5282 * If there is currently a HW scan going on in the 5291 * If there is currently a HW scan going on in the background,
5283 * background then we need to cancel it else the RXON 5292 * then we need to cancel it, otherwise sometimes we are not
5284 * below/in post_associate will fail. 5293 * able to authenticate (FIXME: why ?)
5285 */ 5294 */
5286 if (il_scan_cancel_timeout(il, 100)) { 5295 if (il_scan_cancel_timeout(il, 100)) {
5287 D_MAC80211("leave - scan abort failed\n"); 5296 D_MAC80211("leave - scan abort failed\n");
@@ -5290,14 +5299,10 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5290 } 5299 }
5291 5300
5292 /* mac80211 only sets assoc when in STATION mode */ 5301 /* mac80211 only sets assoc when in STATION mode */
5293 if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { 5302 memcpy(il->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
5294 memcpy(il->staging.bssid_addr, bss_conf->bssid,
5295 ETH_ALEN);
5296 5303
5297 /* currently needed in a few places */ 5304 /* FIXME: currently needed in a few places */
5298 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); 5305 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN);
5299 } else
5300 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5301 } 5306 }
5302 5307
5303 /* 5308 /*
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index dd6c64ac406..88e3ad2d1db 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1336,6 +1336,10 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf,
1336 unsigned long flags; 1336 unsigned long flags;
1337 1337
1338 sd = kmalloc(sizeof(*sd), GFP_ATOMIC); 1338 sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
1339 if (!sd) {
1340 printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
1341 return;
1342 }
1339 sd->buf = buf; 1343 sd->buf = buf;
1340 sd->len = len; 1344 sd->len = len;
1341 sd->type = type; 1345 sd->type = type;
@@ -1353,6 +1357,10 @@ static void qabort_scan(struct orinoco_private *priv)
1353 unsigned long flags; 1357 unsigned long flags;
1354 1358
1355 sd = kmalloc(sizeof(*sd), GFP_ATOMIC); 1359 sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
1360 if (!sd) {
1361 printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
1362 return;
1363 }
1356 sd->len = -1; /* Abort */ 1364 sd->len = -1; /* Abort */
1357 1365
1358 spin_lock_irqsave(&priv->scan_lock, flags); 1366 spin_lock_irqsave(&priv->scan_lock, flags);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index cd490abced9..001735f7a66 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -163,7 +163,13 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
163 163
164 /* Reschedule urb to read TX status again instantly */ 164 /* Reschedule urb to read TX status again instantly */
165 return true; 165 return true;
166 } else if (rt2800usb_txstatus_pending(rt2x00dev)) { 166 }
167
168 /* Check if there is any entry that timedout waiting on TX status */
169 if (rt2800usb_txstatus_timeout(rt2x00dev))
170 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
171
172 if (rt2800usb_txstatus_pending(rt2x00dev)) {
167 /* Read register after 250 us */ 173 /* Read register after 250 us */
168 hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), 174 hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
169 HRTIMER_MODE_REL); 175 HRTIMER_MODE_REL);
@@ -178,7 +184,7 @@ stop_reading:
178 * here again if status reading is needed. 184 * here again if status reading is needed.
179 */ 185 */
180 if (rt2800usb_txstatus_pending(rt2x00dev) && 186 if (rt2800usb_txstatus_pending(rt2x00dev) &&
181 test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) 187 !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
182 return true; 188 return true;
183 else 189 else
184 return false; 190 return false;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 1eec3a06d1f..4c016241f34 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -1893,7 +1893,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw)
1893 break; 1893 break;
1894 case IO_CMD_PAUSE_DM_BY_SCAN: 1894 case IO_CMD_PAUSE_DM_BY_SCAN:
1895 rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; 1895 rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue;
1896 dm_digtable.cur_igvalue = 0x17; 1896 dm_digtable.cur_igvalue = 0x37;
1897 rtl92c_dm_write_dig(hw); 1897 rtl92c_dm_write_dig(hw);
1898 break; 1898 break;
1899 default: 1899 default:
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
index 34591eeb837..28fc5fb8057 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -3077,7 +3077,7 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw)
3077 break; 3077 break;
3078 case IO_CMD_PAUSE_DM_BY_SCAN: 3078 case IO_CMD_PAUSE_DM_BY_SCAN:
3079 rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; 3079 rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue;
3080 de_digtable.cur_igvalue = 0x17; 3080 de_digtable.cur_igvalue = 0x37;
3081 rtl92d_dm_write_dig(hw); 3081 rtl92d_dm_write_dig(hw);
3082 break; 3082 break;
3083 default: 3083 default:
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 85a5cebe96b..965a6293206 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -345,7 +345,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)
345 } 345 }
346 346
347 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 347 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
348 skb->len <= 1, req->actual, req->actual); 348 skb->len <= 1, req->actual, PAGE_SIZE);
349 page = NULL; 349 page = NULL;
350 350
351 if (req->actual < req->length) { /* Last fragment */ 351 if (req->actual < req->length) { /* Last fragment */
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index 79c4f268410..18a5d02a864 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -22,7 +22,7 @@
22#define EQL_DEFAULT_SLAVE_PRIORITY 28800 22#define EQL_DEFAULT_SLAVE_PRIORITY 28800
23#define EQL_DEFAULT_MAX_SLAVES 4 23#define EQL_DEFAULT_MAX_SLAVES 4
24#define EQL_DEFAULT_MTU 576 24#define EQL_DEFAULT_MTU 576
25#define EQL_DEFAULT_RESCHED_IVAL 100 25#define EQL_DEFAULT_RESCHED_IVAL HZ
26 26
27#define EQL_ENSLAVE (SIOCDEVPRIVATE) 27#define EQL_ENSLAVE (SIOCDEVPRIVATE)
28#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) 28#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 248fb05feb6..83d800c31e3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -620,8 +620,10 @@ struct sta_bss_parameters {
620 * @llid: mesh local link id 620 * @llid: mesh local link id
621 * @plid: mesh peer link id 621 * @plid: mesh peer link id
622 * @plink_state: mesh peer link state 622 * @plink_state: mesh peer link state
623 * @signal: signal strength of last received packet in dBm 623 * @signal: the signal strength, type depends on the wiphy's signal_type
624 * @signal_avg: signal strength average in dBm 624 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
625 * @signal_avg: avg signal strength, type depends on the wiphy's signal_type
626 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
625 * @txrate: current unicast bitrate from this station 627 * @txrate: current unicast bitrate from this station
626 * @rxrate: current unicast bitrate to this station 628 * @rxrate: current unicast bitrate to this station
627 * @rx_packets: packets received from this station 629 * @rx_packets: packets received from this station
diff --git a/net/802/garp.c b/net/802/garp.c
index 8e21b6db398..a5c22483043 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -167,7 +167,8 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app,
167 return NULL; 167 return NULL;
168} 168}
169 169
170static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new) 170static struct garp_attr *garp_attr_create(struct garp_applicant *app,
171 const void *data, u8 len, u8 type)
171{ 172{
172 struct rb_node *parent = NULL, **p = &app->gid.rb_node; 173 struct rb_node *parent = NULL, **p = &app->gid.rb_node;
173 struct garp_attr *attr; 174 struct garp_attr *attr;
@@ -176,21 +177,16 @@ static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new)
176 while (*p) { 177 while (*p) {
177 parent = *p; 178 parent = *p;
178 attr = rb_entry(parent, struct garp_attr, node); 179 attr = rb_entry(parent, struct garp_attr, node);
179 d = garp_attr_cmp(attr, new->data, new->dlen, new->type); 180 d = garp_attr_cmp(attr, data, len, type);
180 if (d < 0) 181 if (d < 0)
181 p = &parent->rb_left; 182 p = &parent->rb_left;
182 else if (d > 0) 183 else if (d > 0)
183 p = &parent->rb_right; 184 p = &parent->rb_right;
185 else {
186 /* The attribute already exists; re-use it. */
187 return attr;
188 }
184 } 189 }
185 rb_link_node(&new->node, parent, p);
186 rb_insert_color(&new->node, &app->gid);
187}
188
189static struct garp_attr *garp_attr_create(struct garp_applicant *app,
190 const void *data, u8 len, u8 type)
191{
192 struct garp_attr *attr;
193
194 attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); 190 attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC);
195 if (!attr) 191 if (!attr)
196 return attr; 192 return attr;
@@ -198,7 +194,9 @@ static struct garp_attr *garp_attr_create(struct garp_applicant *app,
198 attr->type = type; 194 attr->type = type;
199 attr->dlen = len; 195 attr->dlen = len;
200 memcpy(attr->data, data, len); 196 memcpy(attr->data, data, len);
201 garp_attr_insert(app, attr); 197
198 rb_link_node(&attr->node, parent, p);
199 rb_insert_color(&attr->node, &app->gid);
202 return attr; 200 return attr;
203} 201}
204 202
diff --git a/net/core/dev.c b/net/core/dev.c
index 5d59155adf2..6c7dc9d78e1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1596,6 +1596,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1596 kfree_skb(skb); 1596 kfree_skb(skb);
1597 return NET_RX_DROP; 1597 return NET_RX_DROP;
1598 } 1598 }
1599 skb->skb_iif = 0;
1599 skb_set_dev(skb, dev); 1600 skb_set_dev(skb, dev);
1600 skb->tstamp.tv64 = 0; 1601 skb->tstamp.tv64 = 0;
1601 skb->pkt_type = PACKET_HOST; 1602 skb->pkt_type = PACKET_HOST;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4dc1c104c94..167ea10b521 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2041,7 +2041,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2041 if (err < 0) 2041 if (err < 0)
2042 goto e_err; 2042 goto e_err;
2043 } 2043 }
2044 rth = rt_dst_alloc(init_net.loopback_dev, 2044 rth = rt_dst_alloc(dev_net(dev)->loopback_dev,
2045 IN_DEV_CONF_GET(in_dev, NOPOLICY), false); 2045 IN_DEV_CONF_GET(in_dev, NOPOLICY), false);
2046 if (!rth) 2046 if (!rth)
2047 goto e_nobufs; 2047 goto e_nobufs;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 496b62712fe..3992e26a603 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -881,6 +881,16 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *
881 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); 881 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags);
882} 882}
883 883
884static struct dst_entry *ip6_route_input_lookup(struct net *net,
885 struct net_device *dev,
886 struct flowi6 *fl6, int flags)
887{
888 if (rt6_need_strict(&fl6->daddr) && dev->type != ARPHRD_PIMREG)
889 flags |= RT6_LOOKUP_F_IFACE;
890
891 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input);
892}
893
884void ip6_route_input(struct sk_buff *skb) 894void ip6_route_input(struct sk_buff *skb)
885{ 895{
886 const struct ipv6hdr *iph = ipv6_hdr(skb); 896 const struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -895,10 +905,7 @@ void ip6_route_input(struct sk_buff *skb)
895 .flowi6_proto = iph->nexthdr, 905 .flowi6_proto = iph->nexthdr,
896 }; 906 };
897 907
898 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) 908 skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags));
899 flags |= RT6_LOOKUP_F_IFACE;
900
901 skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input));
902} 909}
903 910
904static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, 911static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
@@ -2537,7 +2544,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2537 struct sk_buff *skb; 2544 struct sk_buff *skb;
2538 struct rtmsg *rtm; 2545 struct rtmsg *rtm;
2539 struct flowi6 fl6; 2546 struct flowi6 fl6;
2540 int err, iif = 0; 2547 int err, iif = 0, oif = 0;
2541 2548
2542 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); 2549 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
2543 if (err < 0) 2550 if (err < 0)
@@ -2564,15 +2571,29 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2564 iif = nla_get_u32(tb[RTA_IIF]); 2571 iif = nla_get_u32(tb[RTA_IIF]);
2565 2572
2566 if (tb[RTA_OIF]) 2573 if (tb[RTA_OIF])
2567 fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]); 2574 oif = nla_get_u32(tb[RTA_OIF]);
2568 2575
2569 if (iif) { 2576 if (iif) {
2570 struct net_device *dev; 2577 struct net_device *dev;
2578 int flags = 0;
2579
2571 dev = __dev_get_by_index(net, iif); 2580 dev = __dev_get_by_index(net, iif);
2572 if (!dev) { 2581 if (!dev) {
2573 err = -ENODEV; 2582 err = -ENODEV;
2574 goto errout; 2583 goto errout;
2575 } 2584 }
2585
2586 fl6.flowi6_iif = iif;
2587
2588 if (!ipv6_addr_any(&fl6.saddr))
2589 flags |= RT6_LOOKUP_F_HAS_SADDR;
2590
2591 rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6,
2592 flags);
2593 } else {
2594 fl6.flowi6_oif = oif;
2595
2596 rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6);
2576 } 2597 }
2577 2598
2578 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 2599 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
@@ -2587,7 +2608,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2587 skb_reset_mac_header(skb); 2608 skb_reset_mac_header(skb);
2588 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); 2609 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
2589 2610
2590 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6);
2591 skb_dst_set(skb, &rt->dst); 2611 skb_dst_set(skb, &rt->dst);
2592 2612
2593 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, 2613 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif,
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 1068f668ac4..64d3ce5ea1a 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -49,6 +49,8 @@ static void ieee80211_free_tid_rx(struct rcu_head *h)
49 container_of(h, struct tid_ampdu_rx, rcu_head); 49 container_of(h, struct tid_ampdu_rx, rcu_head);
50 int i; 50 int i;
51 51
52 del_timer_sync(&tid_rx->reorder_timer);
53
52 for (i = 0; i < tid_rx->buf_size; i++) 54 for (i = 0; i < tid_rx->buf_size; i++)
53 dev_kfree_skb(tid_rx->reorder_buf[i]); 55 dev_kfree_skb(tid_rx->reorder_buf[i]);
54 kfree(tid_rx->reorder_buf); 56 kfree(tid_rx->reorder_buf);
@@ -91,7 +93,6 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
91 tid, WLAN_BACK_RECIPIENT, reason); 93 tid, WLAN_BACK_RECIPIENT, reason);
92 94
93 del_timer_sync(&tid_rx->session_timer); 95 del_timer_sync(&tid_rx->session_timer);
94 del_timer_sync(&tid_rx->reorder_timer);
95 96
96 call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); 97 call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx);
97} 98}
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b581a24fa15..16336480c63 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -102,9 +102,6 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
102 102
103 might_sleep(); 103 might_sleep();
104 104
105 /* If this off-channel logic ever changes, ieee80211_on_oper_channel
106 * may need to change as well.
107 */
108 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; 105 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
109 if (local->scan_channel) { 106 if (local->scan_channel) {
110 chan = local->scan_channel; 107 chan = local->scan_channel;
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 33cd1690137..c70e1767713 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -370,7 +370,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
370 */ 370 */
371 drv_sw_scan_start(local); 371 drv_sw_scan_start(local);
372 372
373 local->leave_oper_channel_time = 0; 373 local->leave_oper_channel_time = jiffies;
374 local->next_scan_state = SCAN_DECISION; 374 local->next_scan_state = SCAN_DECISION;
375 local->scan_channel_idx = 0; 375 local->scan_channel_idx = 0;
376 376
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 3eb348bfc4f..d98c868c148 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/atomic.h>
13#include <linux/netlink.h> 14#include <linux/netlink.h>
14#include <linux/rculist.h> 15#include <linux/rculist.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
@@ -17,7 +18,6 @@
17#include <linux/errno.h> 18#include <linux/errno.h>
18#include <net/netlink.h> 19#include <net/netlink.h>
19#include <net/sock.h> 20#include <net/sock.h>
20#include <asm/atomic.h>
21 21
22#include <linux/netfilter.h> 22#include <linux/netfilter.h>
23#include <linux/netfilter/nfnetlink.h> 23#include <linux/netfilter/nfnetlink.h>
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 1ab8689726e..906cc05bba6 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -95,11 +95,11 @@ static int rose_set_mac_address(struct net_device *dev, void *addr)
95 struct sockaddr *sa = addr; 95 struct sockaddr *sa = addr;
96 int err; 96 int err;
97 97
98 if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len)) 98 if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len))
99 return 0; 99 return 0;
100 100
101 if (dev->flags & IFF_UP) { 101 if (dev->flags & IFF_UP) {
102 err = rose_add_loopback_node((rose_address *)dev->dev_addr); 102 err = rose_add_loopback_node((rose_address *)sa->sa_data);
103 if (err) 103 if (err)
104 return err; 104 return err;
105 105
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4c1eb9472dd..e49da279702 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2386,7 +2386,9 @@ nla_put_failure:
2386} 2386}
2387 2387
2388static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, 2388static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
2389 int flags, struct net_device *dev, 2389 int flags,
2390 struct cfg80211_registered_device *rdev,
2391 struct net_device *dev,
2390 const u8 *mac_addr, struct station_info *sinfo) 2392 const u8 *mac_addr, struct station_info *sinfo)
2391{ 2393{
2392 void *hdr; 2394 void *hdr;
@@ -2425,12 +2427,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
2425 if (sinfo->filled & STATION_INFO_PLINK_STATE) 2427 if (sinfo->filled & STATION_INFO_PLINK_STATE)
2426 NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, 2428 NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE,
2427 sinfo->plink_state); 2429 sinfo->plink_state);
2428 if (sinfo->filled & STATION_INFO_SIGNAL) 2430 switch (rdev->wiphy.signal_type) {
2429 NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, 2431 case CFG80211_SIGNAL_TYPE_MBM:
2430 sinfo->signal); 2432 if (sinfo->filled & STATION_INFO_SIGNAL)
2431 if (sinfo->filled & STATION_INFO_SIGNAL_AVG) 2433 NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL,
2432 NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, 2434 sinfo->signal);
2433 sinfo->signal_avg); 2435 if (sinfo->filled & STATION_INFO_SIGNAL_AVG)
2436 NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG,
2437 sinfo->signal_avg);
2438 break;
2439 default:
2440 break;
2441 }
2434 if (sinfo->filled & STATION_INFO_TX_BITRATE) { 2442 if (sinfo->filled & STATION_INFO_TX_BITRATE) {
2435 if (!nl80211_put_sta_rate(msg, &sinfo->txrate, 2443 if (!nl80211_put_sta_rate(msg, &sinfo->txrate,
2436 NL80211_STA_INFO_TX_BITRATE)) 2444 NL80211_STA_INFO_TX_BITRATE))
@@ -2523,7 +2531,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
2523 if (nl80211_send_station(skb, 2531 if (nl80211_send_station(skb,
2524 NETLINK_CB(cb->skb).pid, 2532 NETLINK_CB(cb->skb).pid,
2525 cb->nlh->nlmsg_seq, NLM_F_MULTI, 2533 cb->nlh->nlmsg_seq, NLM_F_MULTI,
2526 netdev, mac_addr, 2534 dev, netdev, mac_addr,
2527 &sinfo) < 0) 2535 &sinfo) < 0)
2528 goto out; 2536 goto out;
2529 2537
@@ -2568,7 +2576,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
2568 return -ENOMEM; 2576 return -ENOMEM;
2569 2577
2570 if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, 2578 if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0,
2571 dev, mac_addr, &sinfo) < 0) { 2579 rdev, dev, mac_addr, &sinfo) < 0) {
2572 nlmsg_free(msg); 2580 nlmsg_free(msg);
2573 return -ENOBUFS; 2581 return -ENOBUFS;
2574 } 2582 }
@@ -7596,7 +7604,8 @@ void nl80211_send_sta_event(struct cfg80211_registered_device *rdev,
7596 if (!msg) 7604 if (!msg)
7597 return; 7605 return;
7598 7606
7599 if (nl80211_send_station(msg, 0, 0, 0, dev, mac_addr, sinfo) < 0) { 7607 if (nl80211_send_station(msg, 0, 0, 0,
7608 rdev, dev, mac_addr, sinfo) < 0) {
7600 nlmsg_free(msg); 7609 nlmsg_free(msg);
7601 return; 7610 return;
7602 } 7611 }