aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c68
-rw-r--r--drivers/net/caif/caif_spi.c10
-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.c41
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h110
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c148
-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.h12
-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/chelsio/cxgb4/cxgb4_main.c9
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c12
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c6
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c40
-rw-r--r--drivers/net/ethernet/intel/e1000e/e1000.h6
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c33
-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_dcb_nl.c164
-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.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h5
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c3
-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/stmicro/stmmac/stmmac_main.c6
-rw-r--r--drivers/net/ethernet/tile/tilepro.c77
-rw-r--r--drivers/net/ethernet/via/via-rhine.c12
-rw-r--r--drivers/net/irda/sa1100_ir.c2
-rw-r--r--drivers/net/phy/icplus.c3
-rw-r--r--drivers/net/ppp/ppp_generic.c14
-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/debugfs.c15
-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/ath5k/debug.c23
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c42
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c37
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_debug.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c26
-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/rc.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c4
-rw-r--r--drivers/net/wireless/ath/carl9170/debug.c7
-rw-r--r--drivers/net/wireless/b43/debugfs.c8
-rw-r--r--drivers/net/wireless/b43legacy/debugfs.c8
-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/3945-rs.c8
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c2
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c12
-rw-r--r--drivers/net/wireless/iwlegacy/common.c31
-rw-r--r--drivers/net/wireless/iwlegacy/debug.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c12
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c14
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c9
-rw-r--r--drivers/net/wireless/libertas/debugfs.c10
-rw-r--r--drivers/net/wireless/mwifiex/debugfs.c18
-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/net/wireless/wl1251/debugfs.c14
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c38
-rw-r--r--drivers/net/xen-netfront.c2
83 files changed, 1159 insertions, 724 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0c76186bb9e7..62d2409bb293 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 /*
@@ -2028,6 +2034,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
2028 write_unlock_bh(&bond->lock); 2034 write_unlock_bh(&bond->lock);
2029 unblock_netpoll_tx(); 2035 unblock_netpoll_tx();
2030 2036
2037 if (bond->slave_cnt == 0)
2038 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
2039
2031 bond_compute_features(bond); 2040 bond_compute_features(bond);
2032 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && 2041 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
2033 (old_features & NETIF_F_VLAN_CHALLENGED)) 2042 (old_features & NETIF_F_VLAN_CHALLENGED))
@@ -3001,7 +3010,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
3001 trans_start + delta_in_ticks)) || 3010 trans_start + delta_in_ticks)) ||
3002 bond->curr_active_slave != slave) { 3011 bond->curr_active_slave != slave) {
3003 slave->link = BOND_LINK_UP; 3012 slave->link = BOND_LINK_UP;
3004 bond->current_arp_slave = NULL; 3013 if (bond->current_arp_slave) {
3014 bond_set_slave_inactive_flags(
3015 bond->current_arp_slave);
3016 bond->current_arp_slave = NULL;
3017 }
3005 3018
3006 pr_info("%s: link status definitely up for interface %s.\n", 3019 pr_info("%s: link status definitely up for interface %s.\n",
3007 bond->dev->name, slave->dev->name); 3020 bond->dev->name, slave->dev->name);
@@ -3695,17 +3708,52 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
3695 read_unlock(&bond->lock); 3708 read_unlock(&bond->lock);
3696} 3709}
3697 3710
3698static int bond_neigh_setup(struct net_device *dev, struct neigh_parms *parms) 3711static int bond_neigh_init(struct neighbour *n)
3699{ 3712{
3700 struct bonding *bond = netdev_priv(dev); 3713 struct bonding *bond = netdev_priv(n->dev);
3701 struct slave *slave = bond->first_slave; 3714 struct slave *slave = bond->first_slave;
3715 const struct net_device_ops *slave_ops;
3716 struct neigh_parms parms;
3717 int ret;
3718
3719 if (!slave)
3720 return 0;
3721
3722 slave_ops = slave->dev->netdev_ops;
3723
3724 if (!slave_ops->ndo_neigh_setup)
3725 return 0;
3726
3727 parms.neigh_setup = NULL;
3728 parms.neigh_cleanup = NULL;
3729 ret = slave_ops->ndo_neigh_setup(slave->dev, &parms);
3730 if (ret)
3731 return ret;
3732
3733 /*
3734 * Assign slave's neigh_cleanup to neighbour in case cleanup is called
3735 * after the last slave has been detached. Assumes that all slaves
3736 * utilize the same neigh_cleanup (true at this writing as only user
3737 * is ipoib).
3738 */
3739 n->parms->neigh_cleanup = parms.neigh_cleanup;
3740
3741 if (!parms.neigh_setup)
3742 return 0;
3743
3744 return parms.neigh_setup(n);
3745}
3746
3747/*
3748 * The bonding ndo_neigh_setup is called at init time beofre any
3749 * slave exists. So we must declare proxy setup function which will
3750 * be used at run time to resolve the actual slave neigh param setup.
3751 */
3752static int bond_neigh_setup(struct net_device *dev,
3753 struct neigh_parms *parms)
3754{
3755 parms->neigh_setup = bond_neigh_init;
3702 3756
3703 if (slave) {
3704 const struct net_device_ops *slave_ops
3705 = slave->dev->netdev_ops;
3706 if (slave_ops->ndo_neigh_setup)
3707 return slave_ops->ndo_neigh_setup(slave->dev, parms);
3708 }
3709 return 0; 3757 return 0;
3710} 3758}
3711 3759
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 96391c36fa74..b71ce9bf0afb 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -127,12 +127,6 @@ static inline void dev_debugfs_rem(struct cfspi *cfspi)
127 debugfs_remove(cfspi->dbgfs_dir); 127 debugfs_remove(cfspi->dbgfs_dir);
128} 128}
129 129
130static int dbgfs_open(struct inode *inode, struct file *file)
131{
132 file->private_data = inode->i_private;
133 return 0;
134}
135
136static ssize_t dbgfs_state(struct file *file, char __user *user_buf, 130static ssize_t dbgfs_state(struct file *file, char __user *user_buf,
137 size_t count, loff_t *ppos) 131 size_t count, loff_t *ppos)
138{ 132{
@@ -243,13 +237,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf,
243} 237}
244 238
245static const struct file_operations dbgfs_state_fops = { 239static const struct file_operations dbgfs_state_fops = {
246 .open = dbgfs_open, 240 .open = simple_open,
247 .read = dbgfs_state, 241 .read = dbgfs_state,
248 .owner = THIS_MODULE 242 .owner = THIS_MODULE
249}; 243};
250 244
251static const struct file_operations dbgfs_frame_fops = { 245static const struct file_operations dbgfs_frame_fops = {
252 .open = dbgfs_open, 246 .open = simple_open,
253 .read = dbgfs_frame, 247 .read = dbgfs_frame,
254 .owner = THIS_MODULE 248 .owner = THIS_MODULE
255}; 249};
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index a59cf961a436..f219d38acf58 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 e37161f19250..2c9ee552dffc 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 f1f3ca65667a..4b054812713a 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 }
@@ -1866,7 +1874,6 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1866 * bnx2x_periodic_task(). 1874 * bnx2x_periodic_task().
1867 */ 1875 */
1868 smp_mb(); 1876 smp_mb();
1869 queue_delayed_work(bnx2x_wq, &bp->period_task, 0);
1870 } else 1877 } else
1871 bp->port.pmf = 0; 1878 bp->port.pmf = 0;
1872 1879
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 8b163388659a..5c27454d2ec2 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_fw_defs.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h
index cd6dfa9eaa3a..b9b263323436 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h
@@ -25,31 +25,31 @@
25 (IRO[149].base + ((funcId) * IRO[149].m1)) 25 (IRO[149].base + ((funcId) * IRO[149].m1))
26#define CSTORM_IGU_MODE_OFFSET (IRO[157].base) 26#define CSTORM_IGU_MODE_OFFSET (IRO[157].base)
27#define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ 27#define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \
28 (IRO[315].base + ((pfId) * IRO[315].m1))
29#define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \
30 (IRO[316].base + ((pfId) * IRO[316].m1)) 28 (IRO[316].base + ((pfId) * IRO[316].m1))
29#define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \
30 (IRO[317].base + ((pfId) * IRO[317].m1))
31#define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \ 31#define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \
32 (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2)) 32 (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2))
33#define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \ 33#define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \
34 (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2)) 34 (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2))
35#define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \ 35#define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \
36 (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2)) 36 (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2))
37#define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \ 37#define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \
38 (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2)) 38 (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2))
39#define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \ 39#define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \
40 (IRO[307].base + ((pfId) * IRO[307].m1) + ((iscsiEqId) * IRO[307].m2)) 40 (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2))
41#define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \ 41#define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \
42 (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2)) 42 (IRO[314].base + ((pfId) * IRO[314].m1) + ((iscsiEqId) * IRO[314].m2))
43#define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \ 43#define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \
44 (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2)) 44 (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2))
45#define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ 45#define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \
46 (IRO[314].base + ((pfId) * IRO[314].m1)) 46 (IRO[315].base + ((pfId) * IRO[315].m1))
47#define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ 47#define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \
48 (IRO[306].base + ((pfId) * IRO[306].m1)) 48 (IRO[307].base + ((pfId) * IRO[307].m1))
49#define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ 49#define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \
50 (IRO[305].base + ((pfId) * IRO[305].m1)) 50 (IRO[306].base + ((pfId) * IRO[306].m1))
51#define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ 51#define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \
52 (IRO[304].base + ((pfId) * IRO[304].m1)) 52 (IRO[305].base + ((pfId) * IRO[305].m1))
53#define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ 53#define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \
54 (IRO[151].base + ((funcId) * IRO[151].m1)) 54 (IRO[151].base + ((funcId) * IRO[151].m1))
55#define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \ 55#define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \
@@ -96,37 +96,37 @@
96#define TSTORM_FUNC_EN_OFFSET(funcId) \ 96#define TSTORM_FUNC_EN_OFFSET(funcId) \
97 (IRO[103].base + ((funcId) * IRO[103].m1)) 97 (IRO[103].base + ((funcId) * IRO[103].m1))
98#define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ 98#define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \
99 (IRO[271].base + ((pfId) * IRO[271].m1))
100#define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \
101 (IRO[272].base + ((pfId) * IRO[272].m1)) 99 (IRO[272].base + ((pfId) * IRO[272].m1))
102#define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \ 100#define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \
103 (IRO[273].base + ((pfId) * IRO[273].m1)) 101 (IRO[273].base + ((pfId) * IRO[273].m1))
104#define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \ 102#define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \
105 (IRO[274].base + ((pfId) * IRO[274].m1)) 103 (IRO[274].base + ((pfId) * IRO[274].m1))
104#define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \
105 (IRO[275].base + ((pfId) * IRO[275].m1))
106#define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ 106#define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \
107 (IRO[270].base + ((pfId) * IRO[270].m1)) 107 (IRO[271].base + ((pfId) * IRO[271].m1))
108#define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ 108#define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \
109 (IRO[269].base + ((pfId) * IRO[269].m1)) 109 (IRO[270].base + ((pfId) * IRO[270].m1))
110#define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ 110#define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \
111 (IRO[268].base + ((pfId) * IRO[268].m1)) 111 (IRO[269].base + ((pfId) * IRO[269].m1))
112#define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ 112#define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \
113 (IRO[267].base + ((pfId) * IRO[267].m1)) 113 (IRO[268].base + ((pfId) * IRO[268].m1))
114#define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \ 114#define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \
115 (IRO[276].base + ((pfId) * IRO[276].m1)) 115 (IRO[277].base + ((pfId) * IRO[277].m1))
116#define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ 116#define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \
117 (IRO[263].base + ((pfId) * IRO[263].m1))
118#define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \
119 (IRO[264].base + ((pfId) * IRO[264].m1)) 117 (IRO[264].base + ((pfId) * IRO[264].m1))
120#define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \ 118#define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \
121 (IRO[265].base + ((pfId) * IRO[265].m1)) 119 (IRO[265].base + ((pfId) * IRO[265].m1))
122#define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ 120#define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \
123 (IRO[266].base + ((pfId) * IRO[266].m1)) 121 (IRO[266].base + ((pfId) * IRO[266].m1))
122#define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \
123 (IRO[267].base + ((pfId) * IRO[267].m1))
124#define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \ 124#define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \
125 (IRO[202].base + ((pfId) * IRO[202].m1)) 125 (IRO[202].base + ((pfId) * IRO[202].m1))
126#define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ 126#define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \
127 (IRO[105].base + ((funcId) * IRO[105].m1)) 127 (IRO[105].base + ((funcId) * IRO[105].m1))
128#define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \ 128#define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \
129 (IRO[216].base + ((pfId) * IRO[216].m1)) 129 (IRO[217].base + ((pfId) * IRO[217].m1))
130#define TSTORM_VF_TO_PF_OFFSET(funcId) \ 130#define TSTORM_VF_TO_PF_OFFSET(funcId) \
131 (IRO[104].base + ((funcId) * IRO[104].m1)) 131 (IRO[104].base + ((funcId) * IRO[104].m1))
132#define USTORM_AGG_DATA_OFFSET (IRO[206].base) 132#define USTORM_AGG_DATA_OFFSET (IRO[206].base)
@@ -140,29 +140,29 @@
140#define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \ 140#define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \
141 (IRO[183].base + ((portId) * IRO[183].m1)) 141 (IRO[183].base + ((portId) * IRO[183].m1))
142#define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \ 142#define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \
143 (IRO[317].base + ((pfId) * IRO[317].m1)) 143 (IRO[318].base + ((pfId) * IRO[318].m1))
144#define USTORM_FUNC_EN_OFFSET(funcId) \ 144#define USTORM_FUNC_EN_OFFSET(funcId) \
145 (IRO[178].base + ((funcId) * IRO[178].m1)) 145 (IRO[178].base + ((funcId) * IRO[178].m1))
146#define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ 146#define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \
147 (IRO[281].base + ((pfId) * IRO[281].m1))
148#define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \
149 (IRO[282].base + ((pfId) * IRO[282].m1)) 147 (IRO[282].base + ((pfId) * IRO[282].m1))
148#define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \
149 (IRO[283].base + ((pfId) * IRO[283].m1))
150#define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ 150#define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \
151 (IRO[286].base + ((pfId) * IRO[286].m1)) 151 (IRO[287].base + ((pfId) * IRO[287].m1))
152#define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \ 152#define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \
153 (IRO[283].base + ((pfId) * IRO[283].m1)) 153 (IRO[284].base + ((pfId) * IRO[284].m1))
154#define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ 154#define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \
155 (IRO[279].base + ((pfId) * IRO[279].m1)) 155 (IRO[280].base + ((pfId) * IRO[280].m1))
156#define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ 156#define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \
157 (IRO[278].base + ((pfId) * IRO[278].m1)) 157 (IRO[279].base + ((pfId) * IRO[279].m1))
158#define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ 158#define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \
159 (IRO[277].base + ((pfId) * IRO[277].m1)) 159 (IRO[278].base + ((pfId) * IRO[278].m1))
160#define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ 160#define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \
161 (IRO[280].base + ((pfId) * IRO[280].m1)) 161 (IRO[281].base + ((pfId) * IRO[281].m1))
162#define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \ 162#define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \
163 (IRO[284].base + ((pfId) * IRO[284].m1))
164#define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \
165 (IRO[285].base + ((pfId) * IRO[285].m1)) 163 (IRO[285].base + ((pfId) * IRO[285].m1))
164#define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \
165 (IRO[286].base + ((pfId) * IRO[286].m1))
166#define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \ 166#define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \
167 (IRO[182].base + ((pfId) * IRO[182].m1)) 167 (IRO[182].base + ((pfId) * IRO[182].m1))
168#define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ 168#define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \
@@ -188,39 +188,39 @@
188#define XSTORM_FUNC_EN_OFFSET(funcId) \ 188#define XSTORM_FUNC_EN_OFFSET(funcId) \
189 (IRO[47].base + ((funcId) * IRO[47].m1)) 189 (IRO[47].base + ((funcId) * IRO[47].m1))
190#define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ 190#define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \
191 (IRO[294].base + ((pfId) * IRO[294].m1)) 191 (IRO[295].base + ((pfId) * IRO[295].m1))
192#define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \ 192#define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \
193 (IRO[297].base + ((pfId) * IRO[297].m1))
194#define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \
195 (IRO[298].base + ((pfId) * IRO[298].m1)) 193 (IRO[298].base + ((pfId) * IRO[298].m1))
196#define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \ 194#define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \
197 (IRO[299].base + ((pfId) * IRO[299].m1)) 195 (IRO[299].base + ((pfId) * IRO[299].m1))
198#define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \ 196#define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \
199 (IRO[300].base + ((pfId) * IRO[300].m1)) 197 (IRO[300].base + ((pfId) * IRO[300].m1))
200#define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \ 198#define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \
201 (IRO[301].base + ((pfId) * IRO[301].m1)) 199 (IRO[301].base + ((pfId) * IRO[301].m1))
202#define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \ 200#define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \
203 (IRO[302].base + ((pfId) * IRO[302].m1)) 201 (IRO[302].base + ((pfId) * IRO[302].m1))
204#define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \ 202#define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \
205 (IRO[303].base + ((pfId) * IRO[303].m1)) 203 (IRO[303].base + ((pfId) * IRO[303].m1))
204#define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \
205 (IRO[304].base + ((pfId) * IRO[304].m1))
206#define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ 206#define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \
207 (IRO[293].base + ((pfId) * IRO[293].m1)) 207 (IRO[294].base + ((pfId) * IRO[294].m1))
208#define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ 208#define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \
209 (IRO[292].base + ((pfId) * IRO[292].m1)) 209 (IRO[293].base + ((pfId) * IRO[293].m1))
210#define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ 210#define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \
211 (IRO[291].base + ((pfId) * IRO[291].m1)) 211 (IRO[292].base + ((pfId) * IRO[292].m1))
212#define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ 212#define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \
213 (IRO[296].base + ((pfId) * IRO[296].m1)) 213 (IRO[297].base + ((pfId) * IRO[297].m1))
214#define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \ 214#define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \
215 (IRO[295].base + ((pfId) * IRO[295].m1)) 215 (IRO[296].base + ((pfId) * IRO[296].m1))
216#define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \ 216#define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \
217 (IRO[290].base + ((pfId) * IRO[290].m1)) 217 (IRO[291].base + ((pfId) * IRO[291].m1))
218#define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ 218#define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \
219 (IRO[289].base + ((pfId) * IRO[289].m1)) 219 (IRO[290].base + ((pfId) * IRO[290].m1))
220#define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \ 220#define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \
221 (IRO[288].base + ((pfId) * IRO[288].m1)) 221 (IRO[289].base + ((pfId) * IRO[289].m1))
222#define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \ 222#define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \
223 (IRO[287].base + ((pfId) * IRO[287].m1)) 223 (IRO[288].base + ((pfId) * IRO[288].m1))
224#define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \ 224#define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \
225 (IRO[44].base + ((pfId) * IRO[44].m1)) 225 (IRO[44].base + ((pfId) * IRO[44].m1))
226#define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ 226#define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 5d71b7d43237..dbff5915b81a 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 beb4cdbdb6e1..ad95324dc042 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
@@ -1372,7 +1371,14 @@ static void bnx2x_update_pfc_xmac(struct link_params *params,
1372 pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN | 1371 pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN |
1373 XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN | 1372 XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN |
1374 XMAC_PFC_CTRL_HI_REG_RX_PFC_EN | 1373 XMAC_PFC_CTRL_HI_REG_RX_PFC_EN |
1375 XMAC_PFC_CTRL_HI_REG_TX_PFC_EN; 1374 XMAC_PFC_CTRL_HI_REG_TX_PFC_EN |
1375 XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON;
1376 /* Write pause and PFC registers */
1377 REG_WR(bp, xmac_base + XMAC_REG_PAUSE_CTRL, pause_val);
1378 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val);
1379 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val);
1380 pfc1_val &= ~XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON;
1381
1376 } 1382 }
1377 1383
1378 /* Write pause and PFC registers */ 1384 /* Write pause and PFC registers */
@@ -3649,6 +3655,33 @@ static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy,
3649 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { 3655 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) {
3650 bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); 3656 bnx2x_cl22_read(bp, phy, 0x4, &ld_pause);
3651 bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); 3657 bnx2x_cl22_read(bp, phy, 0x5, &lp_pause);
3658 } else if (CHIP_IS_E3(bp) &&
3659 SINGLE_MEDIA_DIRECT(params)) {
3660 u8 lane = bnx2x_get_warpcore_lane(phy, params);
3661 u16 gp_status, gp_mask;
3662 bnx2x_cl45_read(bp, phy,
3663 MDIO_AN_DEVAD, MDIO_WC_REG_GP2_STATUS_GP_2_4,
3664 &gp_status);
3665 gp_mask = (MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL |
3666 MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP) <<
3667 lane;
3668 if ((gp_status & gp_mask) == gp_mask) {
3669 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
3670 MDIO_AN_REG_ADV_PAUSE, &ld_pause);
3671 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
3672 MDIO_AN_REG_LP_AUTO_NEG, &lp_pause);
3673 } else {
3674 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
3675 MDIO_AN_REG_CL37_FC_LD, &ld_pause);
3676 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
3677 MDIO_AN_REG_CL37_FC_LP, &lp_pause);
3678 ld_pause = ((ld_pause &
3679 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH)
3680 << 3);
3681 lp_pause = ((lp_pause &
3682 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH)
3683 << 3);
3684 }
3652 } else { 3685 } else {
3653 bnx2x_cl45_read(bp, phy, 3686 bnx2x_cl45_read(bp, phy,
3654 MDIO_AN_DEVAD, 3687 MDIO_AN_DEVAD,
@@ -3699,7 +3732,23 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
3699 u16 val16 = 0, lane, bam37 = 0; 3732 u16 val16 = 0, lane, bam37 = 0;
3700 struct bnx2x *bp = params->bp; 3733 struct bnx2x *bp = params->bp;
3701 DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); 3734 DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n");
3702 3735 /* Set to default registers that may be overriden by 10G force */
3736 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3737 MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7);
3738 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
3739 MDIO_WC_REG_PAR_DET_10G_CTRL, 0);
3740 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3741 MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0);
3742 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3743 MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff);
3744 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3745 MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555);
3746 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD,
3747 MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0);
3748 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3749 MDIO_WC_REG_RX66_CONTROL, 0x7415);
3750 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3751 MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190);
3703 /* Disable Autoneg: re-enable it after adv is done. */ 3752 /* Disable Autoneg: re-enable it after adv is done. */
3704 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, 3753 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
3705 MDIO_WC_REG_IEEE0BLK_MIICNTL, 0); 3754 MDIO_WC_REG_IEEE0BLK_MIICNTL, 0);
@@ -3945,13 +3994,13 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy,
3945 3994
3946 } else { 3995 } else {
3947 misc1_val |= 0x9; 3996 misc1_val |= 0x9;
3948 tap_val = ((0x12 << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) | 3997 tap_val = ((0x0f << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) |
3949 (0x2d << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) | 3998 (0x2b << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) |
3950 (0x00 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET)); 3999 (0x02 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET));
3951 tx_driver_val = 4000 tx_driver_val =
3952 ((0x02 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | 4001 ((0x03 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) |
3953 (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | 4002 (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) |
3954 (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET)); 4003 (0x06 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET));
3955 } 4004 }
3956 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, 4005 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3957 MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val); 4006 MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val);
@@ -4369,7 +4418,7 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy,
4369 switch (serdes_net_if) { 4418 switch (serdes_net_if) {
4370 case PORT_HW_CFG_NET_SERDES_IF_KR: 4419 case PORT_HW_CFG_NET_SERDES_IF_KR:
4371 /* Enable KR Auto Neg */ 4420 /* Enable KR Auto Neg */
4372 if (params->loopback_mode == LOOPBACK_NONE) 4421 if (params->loopback_mode != LOOPBACK_EXT)
4373 bnx2x_warpcore_enable_AN_KR(phy, params, vars); 4422 bnx2x_warpcore_enable_AN_KR(phy, params, vars);
4374 else { 4423 else {
4375 DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); 4424 DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n");
@@ -6167,12 +6216,14 @@ int bnx2x_set_led(struct link_params *params,
6167 6216
6168 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); 6217 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
6169 if (params->phy[EXT_PHY1].type == 6218 if (params->phy[EXT_PHY1].type ==
6170 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) 6219 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE)
6171 EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp & 0xfff1); 6220 tmp &= ~(EMAC_LED_1000MB_OVERRIDE |
6172 else { 6221 EMAC_LED_100MB_OVERRIDE |
6173 EMAC_WR(bp, EMAC_REG_EMAC_LED, 6222 EMAC_LED_10MB_OVERRIDE);
6174 (tmp | EMAC_LED_OVERRIDE)); 6223 else
6175 } 6224 tmp |= EMAC_LED_OVERRIDE;
6225
6226 EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp);
6176 break; 6227 break;
6177 6228
6178 case LED_MODE_OPER: 6229 case LED_MODE_OPER:
@@ -6227,10 +6278,15 @@ int bnx2x_set_led(struct link_params *params,
6227 hw_led_mode); 6278 hw_led_mode);
6228 } else if ((params->phy[EXT_PHY1].type == 6279 } else if ((params->phy[EXT_PHY1].type ==
6229 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && 6280 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) &&
6230 (mode != LED_MODE_OPER)) { 6281 (mode == LED_MODE_ON)) {
6231 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); 6282 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0);
6232 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); 6283 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
6233 EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp | 0x3); 6284 EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp |
6285 EMAC_LED_OVERRIDE | EMAC_LED_1000MB_OVERRIDE);
6286 /* Break here; otherwise, it'll disable the
6287 * intended override.
6288 */
6289 break;
6234 } else 6290 } else
6235 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 6291 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4,
6236 hw_led_mode); 6292 hw_led_mode);
@@ -6245,13 +6301,9 @@ int bnx2x_set_led(struct link_params *params,
6245 LED_BLINK_RATE_VAL_E1X_E2); 6301 LED_BLINK_RATE_VAL_E1X_E2);
6246 REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + 6302 REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 +
6247 port*4, 1); 6303 port*4, 1);
6248 if ((params->phy[EXT_PHY1].type != 6304 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
6249 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && 6305 EMAC_WR(bp, EMAC_REG_EMAC_LED,
6250 (mode != LED_MODE_OPER)) { 6306 (tmp & (~EMAC_LED_OVERRIDE)));
6251 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
6252 EMAC_WR(bp, EMAC_REG_EMAC_LED,
6253 (tmp & (~EMAC_LED_OVERRIDE)));
6254 }
6255 6307
6256 if (CHIP_IS_E1(bp) && 6308 if (CHIP_IS_E1(bp) &&
6257 ((speed == SPEED_2500) || 6309 ((speed == SPEED_2500) ||
@@ -6844,6 +6896,12 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
6844 SINGLE_MEDIA_DIRECT(params)) && 6896 SINGLE_MEDIA_DIRECT(params)) &&
6845 (phy_vars[active_external_phy].fault_detected == 0)); 6897 (phy_vars[active_external_phy].fault_detected == 0));
6846 6898
6899 /* Update the PFC configuration in case it was changed */
6900 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED)
6901 vars->link_status |= LINK_STATUS_PFC_ENABLED;
6902 else
6903 vars->link_status &= ~LINK_STATUS_PFC_ENABLED;
6904
6847 if (vars->link_up) 6905 if (vars->link_up)
6848 rc = bnx2x_update_link_up(params, vars, link_10g_plus); 6906 rc = bnx2x_update_link_up(params, vars, link_10g_plus);
6849 else 6907 else
@@ -8031,7 +8089,9 @@ static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy,
8031 netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," 8089 netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected,"
8032 " Port %d from %s part number %s\n", 8090 " Port %d from %s part number %s\n",
8033 params->port, vendor_name, vendor_pn); 8091 params->port, vendor_name, vendor_pn);
8034 phy->flags |= FLAGS_SFP_NOT_APPROVED; 8092 if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) !=
8093 PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG)
8094 phy->flags |= FLAGS_SFP_NOT_APPROVED;
8035 return -EINVAL; 8095 return -EINVAL;
8036} 8096}
8037 8097
@@ -9091,6 +9151,12 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy,
9091 tmp2 &= 0xFFEF; 9151 tmp2 &= 0xFFEF;
9092 bnx2x_cl45_write(bp, phy, 9152 bnx2x_cl45_write(bp, phy,
9093 MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); 9153 MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2);
9154 bnx2x_cl45_read(bp, phy,
9155 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER,
9156 &tmp2);
9157 bnx2x_cl45_write(bp, phy,
9158 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER,
9159 (tmp2 & 0x7fff));
9094 } 9160 }
9095 9161
9096 return 0; 9162 return 0;
@@ -9271,12 +9337,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy,
9271 MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, 9337 MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL,
9272 ((1<<5) | (1<<2))); 9338 ((1<<5) | (1<<2)));
9273 } 9339 }
9274 DP(NETIF_MSG_LINK, "Enabling 8727 TX laser if SFP is approved\n"); 9340
9275 bnx2x_8727_specific_func(phy, params, ENABLE_TX); 9341 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) {
9276 /* If transmitter is disabled, ignore false link up indication */ 9342 DP(NETIF_MSG_LINK, "Enabling 8727 TX laser\n");
9277 bnx2x_cl45_read(bp, phy, 9343 bnx2x_sfp_set_transmitter(params, phy, 1);
9278 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &val1); 9344 } else {
9279 if (val1 & (1<<15)) {
9280 DP(NETIF_MSG_LINK, "Tx is disabled\n"); 9345 DP(NETIF_MSG_LINK, "Tx is disabled\n");
9281 return 0; 9346 return 0;
9282 } 9347 }
@@ -9370,8 +9435,7 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy,
9370 9435
9371 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { 9436 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {
9372 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); 9437 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1);
9373 bnx2x_save_spirom_version(bp, port, 9438 bnx2x_save_spirom_version(bp, port, fw_ver1 & 0xfff,
9374 ((fw_ver1 & 0xf000)>>5) | (fw_ver1 & 0x7f),
9375 phy->ver_addr); 9439 phy->ver_addr);
9376 } else { 9440 } else {
9377 /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ 9441 /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */
@@ -9794,6 +9858,15 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy,
9794 other_shmem_base_addr)); 9858 other_shmem_base_addr));
9795 9859
9796 u32 shmem_base_path[2]; 9860 u32 shmem_base_path[2];
9861
9862 /* Work around for 84833 LED failure inside RESET status */
9863 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
9864 MDIO_AN_REG_8481_LEGACY_MII_CTRL,
9865 MDIO_AN_REG_8481_MII_CTRL_FORCE_1G);
9866 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
9867 MDIO_AN_REG_8481_1G_100T_EXT_CTRL,
9868 MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF);
9869
9797 shmem_base_path[0] = params->shmem_base; 9870 shmem_base_path[0] = params->shmem_base;
9798 shmem_base_path[1] = other_shmem_base_addr; 9871 shmem_base_path[1] = other_shmem_base_addr;
9799 9872
@@ -10104,7 +10177,7 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy,
10104 u8 port; 10177 u8 port;
10105 u16 val16; 10178 u16 val16;
10106 10179
10107 if (!(CHIP_IS_E1(bp))) 10180 if (!(CHIP_IS_E1x(bp)))
10108 port = BP_PATH(bp); 10181 port = BP_PATH(bp);
10109 else 10182 else
10110 port = params->port; 10183 port = params->port;
@@ -10131,7 +10204,7 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
10131 u16 val; 10204 u16 val;
10132 u8 port; 10205 u8 port;
10133 10206
10134 if (!(CHIP_IS_E1(bp))) 10207 if (!(CHIP_IS_E1x(bp)))
10135 port = BP_PATH(bp); 10208 port = BP_PATH(bp);
10136 else 10209 else
10137 port = params->port; 10210 port = params->port;
@@ -12050,6 +12123,9 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
12050 12123
12051 bnx2x_emac_init(params, vars); 12124 bnx2x_emac_init(params, vars);
12052 12125
12126 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED)
12127 vars->link_status |= LINK_STATUS_PFC_ENABLED;
12128
12053 if (params->num_phys == 0) { 12129 if (params->num_phys == 0) {
12054 DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); 12130 DP(NETIF_MSG_LINK, "No phy found for initialization !!\n");
12055 return -EINVAL; 12131 return -EINVAL;
@@ -12129,10 +12205,10 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
12129 * Hold it as vars low 12205 * Hold it as vars low
12130 */ 12206 */
12131 /* clear link led */ 12207 /* clear link led */
12208 bnx2x_set_mdio_clk(bp, params->chip_id, port);
12132 bnx2x_set_led(params, vars, LED_MODE_OFF, 0); 12209 bnx2x_set_led(params, vars, LED_MODE_OFF, 0);
12133 12210
12134 if (reset_ext_phy) { 12211 if (reset_ext_phy) {
12135 bnx2x_set_mdio_clk(bp, params->chip_id, port);
12136 for (phy_index = EXT_PHY1; phy_index < params->num_phys; 12212 for (phy_index = EXT_PHY1; phy_index < params->num_phys;
12137 phy_index++) { 12213 phy_index++) {
12138 if (params->phy[phy_index].link_reset) { 12214 if (params->phy[phy_index].link_reset) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
index 7ba557a610da..763535ee4832 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 f7f9aa807264..e077d2508727 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 fd7fb4581849..c25803b9c0ca 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 */
@@ -5352,6 +5354,7 @@
5352#define XMAC_CTRL_REG_TX_EN (0x1<<0) 5354#define XMAC_CTRL_REG_TX_EN (0x1<<0)
5353#define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) 5355#define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18)
5354#define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) 5356#define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17)
5357#define XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON (0x1<<1)
5355#define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0) 5358#define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0)
5356#define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3) 5359#define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3)
5357#define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4) 5360#define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4)
@@ -5606,6 +5609,7 @@
5606/* [RC 32] Parity register #0 read clear */ 5609/* [RC 32] Parity register #0 read clear */
5607#define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 5610#define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128
5608#define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 5611#define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138
5612#define MCPR_ACCESS_LOCK_LOCK (1L<<31)
5609#define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) 5613#define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0)
5610#define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) 5614#define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1)
5611#define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) 5615#define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0)
@@ -5732,6 +5736,7 @@
5732#define MISC_REGISTERS_GPIO_PORT_SHIFT 4 5736#define MISC_REGISTERS_GPIO_PORT_SHIFT 4
5733#define MISC_REGISTERS_GPIO_SET_POS 8 5737#define MISC_REGISTERS_GPIO_SET_POS 8
5734#define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 5738#define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588
5739#define MISC_REGISTERS_RESET_REG_1_RST_BRB1 (0x1<<0)
5735#define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) 5740#define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19)
5736#define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) 5741#define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29)
5737#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) 5742#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7)
@@ -6816,10 +6821,13 @@ Theotherbitsarereservedandshouldbezero*/
6816 6821
6817#define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020 6822#define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020
6818#define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 6823#define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0
6824#define MDIO_AN_REG_8481_MII_CTRL_FORCE_1G 0x40
6819#define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1 6825#define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1
6820#define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 6826#define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4
6821#define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6 6827#define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6
6822#define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 6828#define MDIO_AN_REG_8481_1000T_CTRL 0xffe9
6829#define MDIO_AN_REG_8481_1G_100T_EXT_CTRL 0xfff0
6830#define MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF 0x0008
6823#define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 6831#define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5
6824#define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 6832#define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7
6825#define MDIO_AN_REG_8481_AUX_CTRL 0xfff8 6833#define MDIO_AN_REG_8481_AUX_CTRL 0xfff8
@@ -6939,6 +6947,10 @@ Theotherbitsarereservedandshouldbezero*/
6939#define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2 6947#define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2
6940#define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3 6948#define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3
6941#define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4 6949#define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4
6950#define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL 0x1000
6951#define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CMPL 0x0100
6952#define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP 0x0010
6953#define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CAP 0x1
6942#define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE 6954#define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE
6943#define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0 6955#define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0
6944#define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2 6956#define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 3f52fadee3ed..513573321625 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 4e4bb3875868..062ac333fde6 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/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 05ff076af06d..b126b98065a9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2000,13 +2000,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
2000/* 2000/*
2001 * debugfs support 2001 * debugfs support
2002 */ 2002 */
2003
2004static int mem_open(struct inode *inode, struct file *file)
2005{
2006 file->private_data = inode->i_private;
2007 return 0;
2008}
2009
2010static ssize_t mem_read(struct file *file, char __user *buf, size_t count, 2003static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
2011 loff_t *ppos) 2004 loff_t *ppos)
2012{ 2005{
@@ -2050,7 +2043,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
2050 2043
2051static const struct file_operations mem_debugfs_fops = { 2044static const struct file_operations mem_debugfs_fops = {
2052 .owner = THIS_MODULE, 2045 .owner = THIS_MODULE,
2053 .open = mem_open, 2046 .open = simple_open,
2054 .read = mem_read, 2047 .read = mem_read,
2055 .llseek = default_llseek, 2048 .llseek = default_llseek,
2056}; 2049};
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 9eb815941df5..f7f0bf5d037b 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/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 4e3cd2f8debb..17a46e76123f 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3945,6 +3945,8 @@ static int ucc_geth_probe(struct platform_device* ofdev)
3945 } 3945 }
3946 3946
3947 if (max_speed == SPEED_1000) { 3947 if (max_speed == SPEED_1000) {
3948 unsigned int snums = qe_get_num_of_snums();
3949
3948 /* configure muram FIFOs for gigabit operation */ 3950 /* configure muram FIFOs for gigabit operation */
3949 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; 3951 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
3950 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; 3952 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
@@ -3954,11 +3956,11 @@ static int ucc_geth_probe(struct platform_device* ofdev)
3954 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; 3956 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT;
3955 ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; 3957 ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4;
3956 3958
3957 /* If QE's snum number is 46 which means we need to support 3959 /* If QE's snum number is 46/76 which means we need to support
3958 * 4 UECs at 1000Base-T simultaneously, we need to allocate 3960 * 4 UECs at 1000Base-T simultaneously, we need to allocate
3959 * more Threads to Rx. 3961 * more Threads to Rx.
3960 */ 3962 */
3961 if (qe_get_num_of_snums() == 46) 3963 if ((snums == 76) || (snums == 46))
3962 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6; 3964 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6;
3963 else 3965 else
3964 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; 3966 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 0e9aec8f6917..4348b6fd44fa 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/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 86cdd4793992..b83897f76ee3 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -161,6 +161,12 @@ struct e1000_info;
161/* Time to wait before putting the device into D3 if there's no link (in ms). */ 161/* Time to wait before putting the device into D3 if there's no link (in ms). */
162#define LINK_TIMEOUT 100 162#define LINK_TIMEOUT 100
163 163
164/*
165 * Count for polling __E1000_RESET condition every 10-20msec.
166 * Experimentation has shown the reset can take approximately 210msec.
167 */
168#define E1000_CHECK_RESET_COUNT 25
169
164#define DEFAULT_RDTR 0 170#define DEFAULT_RDTR 0
165#define DEFAULT_RADV 8 171#define DEFAULT_RADV 8
166#define BURST_RDTR 0x20 172#define BURST_RDTR 0x20
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 7152eb11b7b9..19ab2154802c 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[] = {
@@ -1054,6 +1059,13 @@ static void e1000_print_hw_hang(struct work_struct *work)
1054 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); 1059 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
1055 /* execute the writes immediately */ 1060 /* execute the writes immediately */
1056 e1e_flush(); 1061 e1e_flush();
1062 /*
1063 * Due to rare timing issues, write to TIDV again to ensure
1064 * the write is successful
1065 */
1066 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
1067 /* execute the writes immediately */
1068 e1e_flush();
1057 adapter->tx_hang_recheck = true; 1069 adapter->tx_hang_recheck = true;
1058 return; 1070 return;
1059 } 1071 }
@@ -3611,6 +3623,16 @@ static void e1000e_flush_descriptors(struct e1000_adapter *adapter)
3611 3623
3612 /* execute the writes immediately */ 3624 /* execute the writes immediately */
3613 e1e_flush(); 3625 e1e_flush();
3626
3627 /*
3628 * due to rare timing issues, write to TIDV/RDTR again to ensure the
3629 * write is successful
3630 */
3631 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
3632 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
3633
3634 /* execute the writes immediately */
3635 e1e_flush();
3614} 3636}
3615 3637
3616static void e1000e_update_stats(struct e1000_adapter *adapter); 3638static void e1000e_update_stats(struct e1000_adapter *adapter);
@@ -3963,6 +3985,10 @@ static int e1000_close(struct net_device *netdev)
3963{ 3985{
3964 struct e1000_adapter *adapter = netdev_priv(netdev); 3986 struct e1000_adapter *adapter = netdev_priv(netdev);
3965 struct pci_dev *pdev = adapter->pdev; 3987 struct pci_dev *pdev = adapter->pdev;
3988 int count = E1000_CHECK_RESET_COUNT;
3989
3990 while (test_bit(__E1000_RESETTING, &adapter->state) && count--)
3991 usleep_range(10000, 20000);
3966 3992
3967 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); 3993 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
3968 3994
@@ -5467,6 +5493,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake,
5467 netif_device_detach(netdev); 5493 netif_device_detach(netdev);
5468 5494
5469 if (netif_running(netdev)) { 5495 if (netif_running(netdev)) {
5496 int count = E1000_CHECK_RESET_COUNT;
5497
5498 while (test_bit(__E1000_RESETTING, &adapter->state) && count--)
5499 usleep_range(10000, 20000);
5500
5470 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); 5501 WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
5471 e1000e_down(adapter); 5502 e1000e_down(adapter);
5472 e1000_free_irq(adapter); 5503 e1000_free_irq(adapter);
@@ -6172,7 +6203,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
6172 adapter->hw.adapter = adapter; 6203 adapter->hw.adapter = adapter;
6173 adapter->hw.mac.type = ei->mac; 6204 adapter->hw.mac.type = ei->mac;
6174 adapter->max_hw_frame_size = ei->max_hw_frame_size; 6205 adapter->max_hw_frame_size = ei->max_hw_frame_size;
6175 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; 6206 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
6176 6207
6177 mmio_start = pci_resource_start(pdev, 0); 6208 mmio_start = pci_resource_start(pdev, 0);
6178 mmio_len = pci_resource_len(pdev, 0); 6209 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 c4902411d749..5ec31598ee47 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 217c143686d2..d61ca2a732f0 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 82aaa792cbf3..5fce363d810a 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 80e26ff30ebf..74e192107f9a 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_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index dde65f951400..652e4b09546d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -44,62 +44,94 @@
44#define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ 44#define DCB_NO_HW_CHG 1 /* DCB configuration did not change */
45#define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ 45#define DCB_HW_CHG 2 /* DCB configuration changed, no reset */
46 46
47int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, 47int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg,
48 struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) 48 struct ixgbe_dcb_config *dcfg, int tc_max)
49{ 49{
50 struct tc_configuration *src_tc_cfg = NULL; 50 struct tc_configuration *src = NULL;
51 struct tc_configuration *dst_tc_cfg = NULL; 51 struct tc_configuration *dst = NULL;
52 int i; 52 int i, j;
53 int tx = DCB_TX_CONFIG;
54 int rx = DCB_RX_CONFIG;
55 int changes = 0;
53 56
54 if (!src_dcb_cfg || !dst_dcb_cfg) 57 if (!scfg || !dcfg)
55 return -EINVAL; 58 return changes;
56 59
57 for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { 60 for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) {
58 src_tc_cfg = &src_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; 61 src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0];
59 dst_tc_cfg = &dst_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; 62 dst = &dcfg->tc_config[i - DCB_PG_ATTR_TC_0];
60 63
61 dst_tc_cfg->path[DCB_TX_CONFIG].prio_type = 64 if (dst->path[tx].prio_type != src->path[tx].prio_type) {
62 src_tc_cfg->path[DCB_TX_CONFIG].prio_type; 65 dst->path[tx].prio_type = src->path[tx].prio_type;
66 changes |= BIT_PG_TX;
67 }
63 68
64 dst_tc_cfg->path[DCB_TX_CONFIG].bwg_id = 69 if (dst->path[tx].bwg_id != src->path[tx].bwg_id) {
65 src_tc_cfg->path[DCB_TX_CONFIG].bwg_id; 70 dst->path[tx].bwg_id = src->path[tx].bwg_id;
71 changes |= BIT_PG_TX;
72 }
66 73
67 dst_tc_cfg->path[DCB_TX_CONFIG].bwg_percent = 74 if (dst->path[tx].bwg_percent != src->path[tx].bwg_percent) {
68 src_tc_cfg->path[DCB_TX_CONFIG].bwg_percent; 75 dst->path[tx].bwg_percent = src->path[tx].bwg_percent;
76 changes |= BIT_PG_TX;
77 }
69 78
70 dst_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap = 79 if (dst->path[tx].up_to_tc_bitmap !=
71 src_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap; 80 src->path[tx].up_to_tc_bitmap) {
81 dst->path[tx].up_to_tc_bitmap =
82 src->path[tx].up_to_tc_bitmap;
83 changes |= (BIT_PG_TX | BIT_PFC | BIT_APP_UPCHG);
84 }
72 85
73 dst_tc_cfg->path[DCB_RX_CONFIG].prio_type = 86 if (dst->path[rx].prio_type != src->path[rx].prio_type) {
74 src_tc_cfg->path[DCB_RX_CONFIG].prio_type; 87 dst->path[rx].prio_type = src->path[rx].prio_type;
88 changes |= BIT_PG_RX;
89 }
75 90
76 dst_tc_cfg->path[DCB_RX_CONFIG].bwg_id = 91 if (dst->path[rx].bwg_id != src->path[rx].bwg_id) {
77 src_tc_cfg->path[DCB_RX_CONFIG].bwg_id; 92 dst->path[rx].bwg_id = src->path[rx].bwg_id;
93 changes |= BIT_PG_RX;
94 }
78 95
79 dst_tc_cfg->path[DCB_RX_CONFIG].bwg_percent = 96 if (dst->path[rx].bwg_percent != src->path[rx].bwg_percent) {
80 src_tc_cfg->path[DCB_RX_CONFIG].bwg_percent; 97 dst->path[rx].bwg_percent = src->path[rx].bwg_percent;
98 changes |= BIT_PG_RX;
99 }
81 100
82 dst_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap = 101 if (dst->path[rx].up_to_tc_bitmap !=
83 src_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap; 102 src->path[rx].up_to_tc_bitmap) {
103 dst->path[rx].up_to_tc_bitmap =
104 src->path[rx].up_to_tc_bitmap;
105 changes |= (BIT_PG_RX | BIT_PFC | BIT_APP_UPCHG);
106 }
84 } 107 }
85 108
86 for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { 109 for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) {
87 dst_dcb_cfg->bw_percentage[DCB_TX_CONFIG] 110 j = i - DCB_PG_ATTR_BW_ID_0;
88 [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage 111 if (dcfg->bw_percentage[tx][j] != scfg->bw_percentage[tx][j]) {
89 [DCB_TX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; 112 dcfg->bw_percentage[tx][j] = scfg->bw_percentage[tx][j];
90 dst_dcb_cfg->bw_percentage[DCB_RX_CONFIG] 113 changes |= BIT_PG_TX;
91 [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage 114 }
92 [DCB_RX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; 115 if (dcfg->bw_percentage[rx][j] != scfg->bw_percentage[rx][j]) {
116 dcfg->bw_percentage[rx][j] = scfg->bw_percentage[rx][j];
117 changes |= BIT_PG_RX;
118 }
93 } 119 }
94 120
95 for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { 121 for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) {
96 dst_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc = 122 j = i - DCB_PFC_UP_ATTR_0;
97 src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; 123 if (dcfg->tc_config[j].dcb_pfc != scfg->tc_config[j].dcb_pfc) {
124 dcfg->tc_config[j].dcb_pfc = scfg->tc_config[j].dcb_pfc;
125 changes |= BIT_PFC;
126 }
98 } 127 }
99 128
100 dst_dcb_cfg->pfc_mode_enable = src_dcb_cfg->pfc_mode_enable; 129 if (dcfg->pfc_mode_enable != scfg->pfc_mode_enable) {
130 dcfg->pfc_mode_enable = scfg->pfc_mode_enable;
131 changes |= BIT_PFC;
132 }
101 133
102 return 0; 134 return changes;
103} 135}
104 136
105static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) 137static u8 ixgbe_dcbnl_get_state(struct net_device *netdev)
@@ -179,20 +211,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc,
179 if (up_map != DCB_ATTR_VALUE_UNDEFINED) 211 if (up_map != DCB_ATTR_VALUE_UNDEFINED)
180 adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = 212 adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap =
181 up_map; 213 up_map;
182
183 if ((adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type !=
184 adapter->dcb_cfg.tc_config[tc].path[0].prio_type) ||
185 (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id !=
186 adapter->dcb_cfg.tc_config[tc].path[0].bwg_id) ||
187 (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent !=
188 adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) ||
189 (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap !=
190 adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap))
191 adapter->dcb_set_bitmap |= BIT_PG_TX;
192
193 if (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap !=
194 adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)
195 adapter->dcb_set_bitmap |= BIT_PFC | BIT_APP_UPCHG;
196} 214}
197 215
198static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, 216static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id,
@@ -201,10 +219,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id,
201 struct ixgbe_adapter *adapter = netdev_priv(netdev); 219 struct ixgbe_adapter *adapter = netdev_priv(netdev);
202 220
203 adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; 221 adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct;
204
205 if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] !=
206 adapter->dcb_cfg.bw_percentage[0][bwg_id])
207 adapter->dcb_set_bitmap |= BIT_PG_TX;
208} 222}
209 223
210static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, 224static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc,
@@ -223,20 +237,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc,
223 if (up_map != DCB_ATTR_VALUE_UNDEFINED) 237 if (up_map != DCB_ATTR_VALUE_UNDEFINED)
224 adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = 238 adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap =
225 up_map; 239 up_map;
226
227 if ((adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type !=
228 adapter->dcb_cfg.tc_config[tc].path[1].prio_type) ||
229 (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id !=
230 adapter->dcb_cfg.tc_config[tc].path[1].bwg_id) ||
231 (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent !=
232 adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) ||
233 (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap !=
234 adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap))
235 adapter->dcb_set_bitmap |= BIT_PG_RX;
236
237 if (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap !=
238 adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)
239 adapter->dcb_set_bitmap |= BIT_PFC;
240} 240}
241 241
242static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, 242static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id,
@@ -245,10 +245,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id,
245 struct ixgbe_adapter *adapter = netdev_priv(netdev); 245 struct ixgbe_adapter *adapter = netdev_priv(netdev);
246 246
247 adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; 247 adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct;
248
249 if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] !=
250 adapter->dcb_cfg.bw_percentage[1][bwg_id])
251 adapter->dcb_set_bitmap |= BIT_PG_RX;
252} 248}
253 249
254static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, 250static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc,
@@ -298,10 +294,8 @@ static void ixgbe_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority,
298 294
299 adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; 295 adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting;
300 if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != 296 if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc !=
301 adapter->dcb_cfg.tc_config[priority].dcb_pfc) { 297 adapter->dcb_cfg.tc_config[priority].dcb_pfc)
302 adapter->dcb_set_bitmap |= BIT_PFC;
303 adapter->temp_dcb_cfg.pfc_mode_enable = true; 298 adapter->temp_dcb_cfg.pfc_mode_enable = true;
304 }
305} 299}
306 300
307static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, 301static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority,
@@ -336,7 +330,8 @@ static void ixgbe_dcbnl_devreset(struct net_device *dev)
336static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) 330static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
337{ 331{
338 struct ixgbe_adapter *adapter = netdev_priv(netdev); 332 struct ixgbe_adapter *adapter = netdev_priv(netdev);
339 int ret, i; 333 int ret = DCB_NO_HW_CHG;
334 int i;
340#ifdef IXGBE_FCOE 335#ifdef IXGBE_FCOE
341 struct dcb_app app = { 336 struct dcb_app app = {
342 .selector = DCB_APP_IDTYPE_ETHTYPE, 337 .selector = DCB_APP_IDTYPE_ETHTYPE,
@@ -355,12 +350,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
355 350
356 /* Fail command if not in CEE mode */ 351 /* Fail command if not in CEE mode */
357 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 352 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
358 return 1; 353 return ret;
359 354
360 ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, 355 adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg,
361 MAX_TRAFFIC_CLASS); 356 &adapter->dcb_cfg,
362 if (ret) 357 MAX_TRAFFIC_CLASS);
363 return DCB_NO_HW_CHG; 358 if (!adapter->dcb_set_bitmap)
359 return ret;
364 360
365 if (adapter->dcb_cfg.pfc_mode_enable) { 361 if (adapter->dcb_cfg.pfc_mode_enable) {
366 switch (adapter->hw.mac.type) { 362 switch (adapter->hw.mac.type) {
@@ -420,6 +416,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
420 416
421 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) 417 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
422 netdev_set_prio_tc_map(netdev, i, prio_tc[i]); 418 netdev_set_prio_tc_map(netdev, i, prio_tc[i]);
419
420 ret = DCB_HW_CHG_RST;
423 } 421 }
424 422
425 if (adapter->dcb_set_bitmap & BIT_PFC) { 423 if (adapter->dcb_set_bitmap & BIT_PFC) {
@@ -430,7 +428,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
430 DCB_TX_CONFIG, prio_tc); 428 DCB_TX_CONFIG, prio_tc);
431 ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); 429 ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en);
432 ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); 430 ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc);
433 ret = DCB_HW_CHG; 431 if (ret != DCB_HW_CHG_RST)
432 ret = DCB_HW_CHG;
434 } 433 }
435 434
436 if (adapter->dcb_cfg.pfc_mode_enable) 435 if (adapter->dcb_cfg.pfc_mode_enable)
@@ -531,9 +530,6 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
531 struct ixgbe_adapter *adapter = netdev_priv(netdev); 530 struct ixgbe_adapter *adapter = netdev_priv(netdev);
532 531
533 adapter->temp_dcb_cfg.pfc_mode_enable = state; 532 adapter->temp_dcb_cfg.pfc_mode_enable = state;
534 if (adapter->temp_dcb_cfg.pfc_mode_enable !=
535 adapter->dcb_cfg.pfc_mode_enable)
536 adapter->dcb_set_bitmap |= BIT_PFC;
537} 533}
538 534
539/** 535/**
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 398fc223cab9..3e26b1f9ac75 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 581c65976bb4..307611ae831d 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 423a1a2a702e..c9b504e2dfc3 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);
@@ -2468,6 +2469,17 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2468 return err; 2469 return err;
2469} 2470}
2470 2471
2472static inline bool needs_copy(const struct rx_ring_info *re,
2473 unsigned length)
2474{
2475#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
2476 /* Some architectures need the IP header to be aligned */
2477 if (!IS_ALIGNED(re->data_addr + ETH_HLEN, sizeof(u32)))
2478 return true;
2479#endif
2480 return length < copybreak;
2481}
2482
2471/* For small just reuse existing skb for next receive */ 2483/* For small just reuse existing skb for next receive */
2472static struct sk_buff *receive_copy(struct sky2_port *sky2, 2484static struct sk_buff *receive_copy(struct sky2_port *sky2,
2473 const struct rx_ring_info *re, 2485 const struct rx_ring_info *re,
@@ -2598,7 +2610,7 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2598 goto error; 2610 goto error;
2599 2611
2600okay: 2612okay:
2601 if (length < copybreak) 2613 if (needs_copy(re, length))
2602 skb = receive_copy(sky2, re, length); 2614 skb = receive_copy(sky2, re, length);
2603 else 2615 else
2604 skb = receive_new(sky2, re, length); 2616 skb = receive_new(sky2, re, length);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 9e2b911a1230..d69fee41f24a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -83,8 +83,9 @@
83 83
84#define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ) 84#define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ)
85 85
86#define MLX4_EN_ALLOC_ORDER 2 86/* Use the maximum between 16384 and a single page */
87#define MLX4_EN_ALLOC_SIZE (PAGE_SIZE << MLX4_EN_ALLOC_ORDER) 87#define MLX4_EN_ALLOC_SIZE PAGE_ALIGN(16384)
88#define MLX4_EN_ALLOC_ORDER get_order(MLX4_EN_ALLOC_SIZE)
88 89
89#define MLX4_EN_MAX_LRO_DESCRIPTORS 32 90#define MLX4_EN_MAX_LRO_DESCRIPTORS 32
90 91
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 69444247c20b..6dfc26d85e47 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/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 7b23554f80b6..f54509377efa 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5810,7 +5810,10 @@ static void __rtl8169_resume(struct net_device *dev)
5810 5810
5811 rtl_pll_power_up(tp); 5811 rtl_pll_power_up(tp);
5812 5812
5813 rtl_lock_work(tp);
5814 napi_enable(&tp->napi);
5813 set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); 5815 set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
5816 rtl_unlock_work(tp);
5814 5817
5815 rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); 5818 rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
5816} 5819}
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
index 9755b49bbefb..3fb2355af37e 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 8615961c1287..d63e09b29a96 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 57dc26261116..0fa14afce23d 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/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e85ffbd54830..48d56da62f08 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1737,10 +1737,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
1737 struct mac_device_info *mac; 1737 struct mac_device_info *mac;
1738 1738
1739 /* Identify the MAC HW device */ 1739 /* Identify the MAC HW device */
1740 if (priv->plat->has_gmac) 1740 if (priv->plat->has_gmac) {
1741 priv->dev->priv_flags |= IFF_UNICAST_FLT;
1741 mac = dwmac1000_setup(priv->ioaddr); 1742 mac = dwmac1000_setup(priv->ioaddr);
1742 else 1743 } else {
1743 mac = dwmac100_setup(priv->ioaddr); 1744 mac = dwmac100_setup(priv->ioaddr);
1745 }
1744 if (!mac) 1746 if (!mac)
1745 return -ENOMEM; 1747 return -ENOMEM;
1746 1748
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 261356c2dc99..3d501ec7fad7 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -342,6 +342,21 @@ inline int __netio_fastio1(u32 fastio_index, u32 arg0)
342} 342}
343 343
344 344
345static void tile_net_return_credit(struct tile_net_cpu *info)
346{
347 struct tile_netio_queue *queue = &info->queue;
348 netio_queue_user_impl_t *qup = &queue->__user_part;
349
350 /* Return four credits after every fourth packet. */
351 if (--qup->__receive_credit_remaining == 0) {
352 u32 interval = qup->__receive_credit_interval;
353 qup->__receive_credit_remaining = interval;
354 __netio_fastio_return_credits(qup->__fastio_index, interval);
355 }
356}
357
358
359
345/* 360/*
346 * Provide a linux buffer to LIPP. 361 * Provide a linux buffer to LIPP.
347 */ 362 */
@@ -433,7 +448,7 @@ static bool tile_net_provide_needed_buffer(struct tile_net_cpu *info,
433 struct sk_buff **skb_ptr; 448 struct sk_buff **skb_ptr;
434 449
435 /* Request 96 extra bytes for alignment purposes. */ 450 /* Request 96 extra bytes for alignment purposes. */
436 skb = netdev_alloc_skb(info->napi->dev, len + padding); 451 skb = netdev_alloc_skb(info->napi.dev, len + padding);
437 if (skb == NULL) 452 if (skb == NULL)
438 return false; 453 return false;
439 454
@@ -864,19 +879,11 @@ static bool tile_net_poll_aux(struct tile_net_cpu *info, int index)
864 879
865 stats->rx_packets++; 880 stats->rx_packets++;
866 stats->rx_bytes += len; 881 stats->rx_bytes += len;
867
868 if (small)
869 info->num_needed_small_buffers++;
870 else
871 info->num_needed_large_buffers++;
872 } 882 }
873 883
874 /* Return four credits after every fourth packet. */ 884 /* ISSUE: It would be nice to defer this until the packet has */
875 if (--qup->__receive_credit_remaining == 0) { 885 /* actually been processed. */
876 u32 interval = qup->__receive_credit_interval; 886 tile_net_return_credit(info);
877 qup->__receive_credit_remaining = interval;
878 __netio_fastio_return_credits(qup->__fastio_index, interval);
879 }
880 887
881 /* Consume this packet. */ 888 /* Consume this packet. */
882 qup->__packet_receive_read = index2; 889 qup->__packet_receive_read = index2;
@@ -1543,7 +1550,7 @@ static int tile_net_drain_lipp_buffers(struct tile_net_priv *priv)
1543 1550
1544 /* Drain all the LIPP buffers. */ 1551 /* Drain all the LIPP buffers. */
1545 while (true) { 1552 while (true) {
1546 int buffer; 1553 unsigned int buffer;
1547 1554
1548 /* NOTE: This should never fail. */ 1555 /* NOTE: This should never fail. */
1549 if (hv_dev_pread(priv->hv_devhdl, 0, (HV_VirtAddr)&buffer, 1556 if (hv_dev_pread(priv->hv_devhdl, 0, (HV_VirtAddr)&buffer,
@@ -1707,7 +1714,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags,
1707 if (!hash_default) { 1714 if (!hash_default) {
1708 void *va = pfn_to_kaddr(pfn) + f->page_offset; 1715 void *va = pfn_to_kaddr(pfn) + f->page_offset;
1709 BUG_ON(PageHighMem(skb_frag_page(f))); 1716 BUG_ON(PageHighMem(skb_frag_page(f)));
1710 finv_buffer_remote(va, f->size, 0); 1717 finv_buffer_remote(va, skb_frag_size(f), 0);
1711 } 1718 }
1712 1719
1713 cpa = ((phys_addr_t)pfn << PAGE_SHIFT) + f->page_offset; 1720 cpa = ((phys_addr_t)pfn << PAGE_SHIFT) + f->page_offset;
@@ -1735,8 +1742,8 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags,
1735 * Sometimes, if "sendfile()" requires copying, we will be called with 1742 * Sometimes, if "sendfile()" requires copying, we will be called with
1736 * "data" containing the header and payload, with "frags" being empty. 1743 * "data" containing the header and payload, with "frags" being empty.
1737 * 1744 *
1738 * In theory, "sh->nr_frags" could be 3, but in practice, it seems 1745 * Sometimes, for example when using NFS over TCP, a single segment can
1739 * that this will never actually happen. 1746 * span 3 fragments, which must be handled carefully in LEPP.
1740 * 1747 *
1741 * See "emulate_large_send_offload()" for some reference code, which 1748 * See "emulate_large_send_offload()" for some reference code, which
1742 * does not handle checksumming. 1749 * does not handle checksumming.
@@ -1844,10 +1851,8 @@ static int tile_net_tx_tso(struct sk_buff *skb, struct net_device *dev)
1844 1851
1845 spin_lock_irqsave(&priv->eq_lock, irqflags); 1852 spin_lock_irqsave(&priv->eq_lock, irqflags);
1846 1853
1847 /* 1854 /* Handle completions if needed to make room. */
1848 * Handle completions if needed to make room. 1855 /* NOTE: Return NETDEV_TX_BUSY if there is still no room. */
1849 * HACK: Spin until there is sufficient room.
1850 */
1851 if (lepp_num_free_comp_slots(eq) == 0) { 1856 if (lepp_num_free_comp_slots(eq) == 0) {
1852 nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); 1857 nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0);
1853 if (nolds == 0) { 1858 if (nolds == 0) {
@@ -1861,6 +1866,7 @@ busy:
1861 cmd_tail = eq->cmd_tail; 1866 cmd_tail = eq->cmd_tail;
1862 1867
1863 /* Prepare to advance, detecting full queue. */ 1868 /* Prepare to advance, detecting full queue. */
1869 /* NOTE: Return NETDEV_TX_BUSY if the queue is full. */
1864 cmd_next = cmd_tail + cmd_size; 1870 cmd_next = cmd_tail + cmd_size;
1865 if (cmd_tail < cmd_head && cmd_next >= cmd_head) 1871 if (cmd_tail < cmd_head && cmd_next >= cmd_head)
1866 goto busy; 1872 goto busy;
@@ -2023,10 +2029,8 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
2023 2029
2024 spin_lock_irqsave(&priv->eq_lock, irqflags); 2030 spin_lock_irqsave(&priv->eq_lock, irqflags);
2025 2031
2026 /* 2032 /* Handle completions if needed to make room. */
2027 * Handle completions if needed to make room. 2033 /* NOTE: Return NETDEV_TX_BUSY if there is still no room. */
2028 * HACK: Spin until there is sufficient room.
2029 */
2030 if (lepp_num_free_comp_slots(eq) == 0) { 2034 if (lepp_num_free_comp_slots(eq) == 0) {
2031 nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); 2035 nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0);
2032 if (nolds == 0) { 2036 if (nolds == 0) {
@@ -2040,6 +2044,7 @@ busy:
2040 cmd_tail = eq->cmd_tail; 2044 cmd_tail = eq->cmd_tail;
2041 2045
2042 /* Copy the commands, or fail. */ 2046 /* Copy the commands, or fail. */
2047 /* NOTE: Return NETDEV_TX_BUSY if the queue is full. */
2043 for (i = 0; i < num_frags; i++) { 2048 for (i = 0; i < num_frags; i++) {
2044 2049
2045 /* Prepare to advance, detecting full queue. */ 2050 /* Prepare to advance, detecting full queue. */
@@ -2261,6 +2266,23 @@ static int tile_net_get_mac(struct net_device *dev)
2261 return 0; 2266 return 0;
2262} 2267}
2263 2268
2269
2270#ifdef CONFIG_NET_POLL_CONTROLLER
2271/*
2272 * Polling 'interrupt' - used by things like netconsole to send skbs
2273 * without having to re-enable interrupts. It's not called while
2274 * the interrupt routine is executing.
2275 */
2276static void tile_net_netpoll(struct net_device *dev)
2277{
2278 struct tile_net_priv *priv = netdev_priv(dev);
2279 disable_percpu_irq(priv->intr_id);
2280 tile_net_handle_ingress_interrupt(priv->intr_id, dev);
2281 enable_percpu_irq(priv->intr_id, 0);
2282}
2283#endif
2284
2285
2264static const struct net_device_ops tile_net_ops = { 2286static const struct net_device_ops tile_net_ops = {
2265 .ndo_open = tile_net_open, 2287 .ndo_open = tile_net_open,
2266 .ndo_stop = tile_net_stop, 2288 .ndo_stop = tile_net_stop,
@@ -2269,7 +2291,10 @@ static const struct net_device_ops tile_net_ops = {
2269 .ndo_get_stats = tile_net_get_stats, 2291 .ndo_get_stats = tile_net_get_stats,
2270 .ndo_change_mtu = tile_net_change_mtu, 2292 .ndo_change_mtu = tile_net_change_mtu,
2271 .ndo_tx_timeout = tile_net_tx_timeout, 2293 .ndo_tx_timeout = tile_net_tx_timeout,
2272 .ndo_set_mac_address = tile_net_set_mac_address 2294 .ndo_set_mac_address = tile_net_set_mac_address,
2295#ifdef CONFIG_NET_POLL_CONTROLLER
2296 .ndo_poll_controller = tile_net_netpoll,
2297#endif
2273}; 2298};
2274 2299
2275 2300
@@ -2409,7 +2434,7 @@ static void tile_net_cleanup(void)
2409 */ 2434 */
2410static int tile_net_init_module(void) 2435static int tile_net_init_module(void)
2411{ 2436{
2412 pr_info("Tilera IPP Net Driver\n"); 2437 pr_info("Tilera Network Driver\n");
2413 2438
2414 tile_net_devs[0] = tile_net_dev_init("xgbe0"); 2439 tile_net_devs[0] = tile_net_dev_init("xgbe0");
2415 tile_net_devs[1] = tile_net_dev_init("xgbe1"); 2440 tile_net_devs[1] = tile_net_dev_init("xgbe1");
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 39b8cf3dafcd..fcfa01f7ceb6 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/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index a0d1913a58d3..e25067552b20 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -147,7 +147,7 @@ static void sa1100_irda_dma_start(struct sa1100_buf *buf,
147 struct dma_async_tx_descriptor *desc; 147 struct dma_async_tx_descriptor *desc;
148 struct dma_chan *chan = buf->chan; 148 struct dma_chan *chan = buf->chan;
149 149
150 desc = chan->device->device_prep_slave_sg(chan, &buf->sg, 1, dir, 150 desc = dmaengine_prep_slave_sg(chan, &buf->sg, 1, dir,
151 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 151 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
152 if (desc) { 152 if (desc) {
153 desc->callback = cb; 153 desc->callback = cb;
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index 0856e1b7a849..f08c85acf761 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -162,7 +162,8 @@ static int ip101a_g_config_init(struct phy_device *phydev)
162 /* Enable Auto Power Saving mode */ 162 /* Enable Auto Power Saving mode */
163 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 163 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
164 c |= IP101A_G_APS_ON; 164 c |= IP101A_G_APS_ON;
165 return c; 165
166 return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
166} 167}
167 168
168static int ip175c_read_status(struct phy_device *phydev) 169static int ip175c_read_status(struct phy_device *phydev)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 159da2905fe9..33f8c51968b6 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -235,7 +235,7 @@ struct ppp_net {
235/* Prototypes. */ 235/* Prototypes. */
236static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, 236static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
237 struct file *file, unsigned int cmd, unsigned long arg); 237 struct file *file, unsigned int cmd, unsigned long arg);
238static void ppp_xmit_process(struct ppp *ppp); 238static int ppp_xmit_process(struct ppp *ppp);
239static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); 239static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb);
240static void ppp_push(struct ppp *ppp); 240static void ppp_push(struct ppp *ppp);
241static void ppp_channel_push(struct channel *pch); 241static void ppp_channel_push(struct channel *pch);
@@ -968,9 +968,9 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
968 proto = npindex_to_proto[npi]; 968 proto = npindex_to_proto[npi];
969 put_unaligned_be16(proto, pp); 969 put_unaligned_be16(proto, pp);
970 970
971 netif_stop_queue(dev);
972 skb_queue_tail(&ppp->file.xq, skb); 971 skb_queue_tail(&ppp->file.xq, skb);
973 ppp_xmit_process(ppp); 972 if (!ppp_xmit_process(ppp))
973 netif_stop_queue(dev);
974 return NETDEV_TX_OK; 974 return NETDEV_TX_OK;
975 975
976 outf: 976 outf:
@@ -1048,10 +1048,11 @@ static void ppp_setup(struct net_device *dev)
1048 * Called to do any work queued up on the transmit side 1048 * Called to do any work queued up on the transmit side
1049 * that can now be done. 1049 * that can now be done.
1050 */ 1050 */
1051static void 1051static int
1052ppp_xmit_process(struct ppp *ppp) 1052ppp_xmit_process(struct ppp *ppp)
1053{ 1053{
1054 struct sk_buff *skb; 1054 struct sk_buff *skb;
1055 int ret = 0;
1055 1056
1056 ppp_xmit_lock(ppp); 1057 ppp_xmit_lock(ppp);
1057 if (!ppp->closing) { 1058 if (!ppp->closing) {
@@ -1061,10 +1062,13 @@ ppp_xmit_process(struct ppp *ppp)
1061 ppp_send_frame(ppp, skb); 1062 ppp_send_frame(ppp, skb);
1062 /* If there's no work left to do, tell the core net 1063 /* If there's no work left to do, tell the core net
1063 code that we can accept some more. */ 1064 code that we can accept some more. */
1064 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) 1065 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) {
1065 netif_wake_queue(ppp->dev); 1066 netif_wake_queue(ppp->dev);
1067 ret = 1;
1068 }
1066 } 1069 }
1067 ppp_xmit_unlock(ppp); 1070 ppp_xmit_unlock(ppp);
1071 return ret;
1068} 1072}
1069 1073
1070static inline struct sk_buff * 1074static inline struct sk_buff *
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index a57f05726b57..91d25888a1b9 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 3886b30ed373..3e41b00c6806 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 439690be519f..685a4e22c768 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 6dda2fe5b15b..d363b31053da 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 c3197ce0e2ad..34db195fb8b0 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 019da012669f..4de2760c5937 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/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 129ba36bd04d..4b66ab1d0e5c 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -53,17 +53,6 @@ struct dentry *debugfs_create_netdev_queue_stopped(
53 &fops_netdev_queue_stopped); 53 &fops_netdev_queue_stopped);
54} 54}
55 55
56
57/*
58 * inode->i_private has the @data argument to debugfs_create_file()
59 */
60static
61int i2400m_stats_open(struct inode *inode, struct file *filp)
62{
63 filp->private_data = inode->i_private;
64 return 0;
65}
66
67/* 56/*
68 * We don't allow partial reads of this file, as then the reader would 57 * We don't allow partial reads of this file, as then the reader would
69 * get weirdly confused data as it is updated. 58 * get weirdly confused data as it is updated.
@@ -117,7 +106,7 @@ ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer,
117static 106static
118const struct file_operations i2400m_rx_stats_fops = { 107const struct file_operations i2400m_rx_stats_fops = {
119 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
120 .open = i2400m_stats_open, 109 .open = simple_open,
121 .read = i2400m_rx_stats_read, 110 .read = i2400m_rx_stats_read,
122 .write = i2400m_rx_stats_write, 111 .write = i2400m_rx_stats_write,
123 .llseek = default_llseek, 112 .llseek = default_llseek,
@@ -170,7 +159,7 @@ ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer,
170static 159static
171const struct file_operations i2400m_tx_stats_fops = { 160const struct file_operations i2400m_tx_stats_fops = {
172 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
173 .open = i2400m_stats_open, 162 .open = simple_open,
174 .read = i2400m_tx_stats_read, 163 .read = i2400m_tx_stats_read,
175 .write = i2400m_tx_stats_write, 164 .write = i2400m_tx_stats_write,
176 .llseek = default_llseek, 165 .llseek = default_llseek,
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
index 63e4b709efa9..1d76ae855f07 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 2c1b8b687646..29b1e033a10b 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/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 8c5ce8b0c734..e5e8f45d86ac 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -71,13 +71,6 @@ static unsigned int ath5k_debug;
71module_param_named(debug, ath5k_debug, uint, 0); 71module_param_named(debug, ath5k_debug, uint, 0);
72 72
73 73
74static int ath5k_debugfs_open(struct inode *inode, struct file *file)
75{
76 file->private_data = inode->i_private;
77 return 0;
78}
79
80
81/* debugfs: registers */ 74/* debugfs: registers */
82 75
83struct reg { 76struct reg {
@@ -265,7 +258,7 @@ static ssize_t write_file_beacon(struct file *file,
265static const struct file_operations fops_beacon = { 258static const struct file_operations fops_beacon = {
266 .read = read_file_beacon, 259 .read = read_file_beacon,
267 .write = write_file_beacon, 260 .write = write_file_beacon,
268 .open = ath5k_debugfs_open, 261 .open = simple_open,
269 .owner = THIS_MODULE, 262 .owner = THIS_MODULE,
270 .llseek = default_llseek, 263 .llseek = default_llseek,
271}; 264};
@@ -285,7 +278,7 @@ static ssize_t write_file_reset(struct file *file,
285 278
286static const struct file_operations fops_reset = { 279static const struct file_operations fops_reset = {
287 .write = write_file_reset, 280 .write = write_file_reset,
288 .open = ath5k_debugfs_open, 281 .open = simple_open,
289 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
290 .llseek = noop_llseek, 283 .llseek = noop_llseek,
291}; 284};
@@ -365,7 +358,7 @@ static ssize_t write_file_debug(struct file *file,
365static const struct file_operations fops_debug = { 358static const struct file_operations fops_debug = {
366 .read = read_file_debug, 359 .read = read_file_debug,
367 .write = write_file_debug, 360 .write = write_file_debug,
368 .open = ath5k_debugfs_open, 361 .open = simple_open,
369 .owner = THIS_MODULE, 362 .owner = THIS_MODULE,
370 .llseek = default_llseek, 363 .llseek = default_llseek,
371}; 364};
@@ -477,7 +470,7 @@ static ssize_t write_file_antenna(struct file *file,
477static const struct file_operations fops_antenna = { 470static const struct file_operations fops_antenna = {
478 .read = read_file_antenna, 471 .read = read_file_antenna,
479 .write = write_file_antenna, 472 .write = write_file_antenna,
480 .open = ath5k_debugfs_open, 473 .open = simple_open,
481 .owner = THIS_MODULE, 474 .owner = THIS_MODULE,
482 .llseek = default_llseek, 475 .llseek = default_llseek,
483}; 476};
@@ -532,7 +525,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
532 525
533static const struct file_operations fops_misc = { 526static const struct file_operations fops_misc = {
534 .read = read_file_misc, 527 .read = read_file_misc,
535 .open = ath5k_debugfs_open, 528 .open = simple_open,
536 .owner = THIS_MODULE, 529 .owner = THIS_MODULE,
537}; 530};
538 531
@@ -647,7 +640,7 @@ static ssize_t write_file_frameerrors(struct file *file,
647static const struct file_operations fops_frameerrors = { 640static const struct file_operations fops_frameerrors = {
648 .read = read_file_frameerrors, 641 .read = read_file_frameerrors,
649 .write = write_file_frameerrors, 642 .write = write_file_frameerrors,
650 .open = ath5k_debugfs_open, 643 .open = simple_open,
651 .owner = THIS_MODULE, 644 .owner = THIS_MODULE,
652 .llseek = default_llseek, 645 .llseek = default_llseek,
653}; 646};
@@ -810,7 +803,7 @@ static ssize_t write_file_ani(struct file *file,
810static const struct file_operations fops_ani = { 803static const struct file_operations fops_ani = {
811 .read = read_file_ani, 804 .read = read_file_ani,
812 .write = write_file_ani, 805 .write = write_file_ani,
813 .open = ath5k_debugfs_open, 806 .open = simple_open,
814 .owner = THIS_MODULE, 807 .owner = THIS_MODULE,
815 .llseek = default_llseek, 808 .llseek = default_llseek,
816}; 809};
@@ -881,7 +874,7 @@ static ssize_t write_file_queue(struct file *file,
881static const struct file_operations fops_queue = { 874static const struct file_operations fops_queue = {
882 .read = read_file_queue, 875 .read = read_file_queue,
883 .write = write_file_queue, 876 .write = write_file_queue,
884 .open = ath5k_debugfs_open, 877 .open = simple_open,
885 .owner = THIS_MODULE, 878 .owner = THIS_MODULE,
886 .llseek = default_llseek, 879 .llseek = default_llseek,
887}; 880};
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 552adb3f80d0..d01403a263ff 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -217,12 +217,6 @@ void dump_cred_dist_stats(struct htc_target *target)
217 target->credit_info->cur_free_credits); 217 target->credit_info->cur_free_credits);
218} 218}
219 219
220static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
221{
222 file->private_data = inode->i_private;
223 return 0;
224}
225
226void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) 220void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
227{ 221{
228 switch (war) { 222 switch (war) {
@@ -263,7 +257,7 @@ static ssize_t read_file_war_stats(struct file *file, char __user *user_buf,
263 257
264static const struct file_operations fops_war_stats = { 258static const struct file_operations fops_war_stats = {
265 .read = read_file_war_stats, 259 .read = read_file_war_stats,
266 .open = ath6kl_debugfs_open, 260 .open = simple_open,
267 .owner = THIS_MODULE, 261 .owner = THIS_MODULE,
268 .llseek = default_llseek, 262 .llseek = default_llseek,
269}; 263};
@@ -488,7 +482,7 @@ static ssize_t ath6kl_fwlog_mask_write(struct file *file,
488} 482}
489 483
490static const struct file_operations fops_fwlog_mask = { 484static const struct file_operations fops_fwlog_mask = {
491 .open = ath6kl_debugfs_open, 485 .open = simple_open,
492 .read = ath6kl_fwlog_mask_read, 486 .read = ath6kl_fwlog_mask_read,
493 .write = ath6kl_fwlog_mask_write, 487 .write = ath6kl_fwlog_mask_write,
494 .owner = THIS_MODULE, 488 .owner = THIS_MODULE,
@@ -634,7 +628,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
634 628
635static const struct file_operations fops_tgt_stats = { 629static const struct file_operations fops_tgt_stats = {
636 .read = read_file_tgt_stats, 630 .read = read_file_tgt_stats,
637 .open = ath6kl_debugfs_open, 631 .open = simple_open,
638 .owner = THIS_MODULE, 632 .owner = THIS_MODULE,
639 .llseek = default_llseek, 633 .llseek = default_llseek,
640}; 634};
@@ -699,7 +693,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
699 693
700static const struct file_operations fops_credit_dist_stats = { 694static const struct file_operations fops_credit_dist_stats = {
701 .read = read_file_credit_dist_stats, 695 .read = read_file_credit_dist_stats,
702 .open = ath6kl_debugfs_open, 696 .open = simple_open,
703 .owner = THIS_MODULE, 697 .owner = THIS_MODULE,
704 .llseek = default_llseek, 698 .llseek = default_llseek,
705}; 699};
@@ -802,7 +796,7 @@ static ssize_t ath6kl_endpoint_stats_write(struct file *file,
802} 796}
803 797
804static const struct file_operations fops_endpoint_stats = { 798static const struct file_operations fops_endpoint_stats = {
805 .open = ath6kl_debugfs_open, 799 .open = simple_open,
806 .read = ath6kl_endpoint_stats_read, 800 .read = ath6kl_endpoint_stats_read,
807 .write = ath6kl_endpoint_stats_write, 801 .write = ath6kl_endpoint_stats_write,
808 .owner = THIS_MODULE, 802 .owner = THIS_MODULE,
@@ -875,7 +869,7 @@ static ssize_t ath6kl_regread_write(struct file *file,
875static const struct file_operations fops_diag_reg_read = { 869static const struct file_operations fops_diag_reg_read = {
876 .read = ath6kl_regread_read, 870 .read = ath6kl_regread_read,
877 .write = ath6kl_regread_write, 871 .write = ath6kl_regread_write,
878 .open = ath6kl_debugfs_open, 872 .open = simple_open,
879 .owner = THIS_MODULE, 873 .owner = THIS_MODULE,
880 .llseek = default_llseek, 874 .llseek = default_llseek,
881}; 875};
@@ -999,7 +993,7 @@ static ssize_t ath6kl_lrssi_roam_read(struct file *file,
999static const struct file_operations fops_lrssi_roam_threshold = { 993static const struct file_operations fops_lrssi_roam_threshold = {
1000 .read = ath6kl_lrssi_roam_read, 994 .read = ath6kl_lrssi_roam_read,
1001 .write = ath6kl_lrssi_roam_write, 995 .write = ath6kl_lrssi_roam_write,
1002 .open = ath6kl_debugfs_open, 996 .open = simple_open,
1003 .owner = THIS_MODULE, 997 .owner = THIS_MODULE,
1004 .llseek = default_llseek, 998 .llseek = default_llseek,
1005}; 999};
@@ -1061,7 +1055,7 @@ static ssize_t ath6kl_regwrite_write(struct file *file,
1061static const struct file_operations fops_diag_reg_write = { 1055static const struct file_operations fops_diag_reg_write = {
1062 .read = ath6kl_regwrite_read, 1056 .read = ath6kl_regwrite_read,
1063 .write = ath6kl_regwrite_write, 1057 .write = ath6kl_regwrite_write,
1064 .open = ath6kl_debugfs_open, 1058 .open = simple_open,
1065 .owner = THIS_MODULE, 1059 .owner = THIS_MODULE,
1066 .llseek = default_llseek, 1060 .llseek = default_llseek,
1067}; 1061};
@@ -1166,7 +1160,7 @@ static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
1166 1160
1167static const struct file_operations fops_roam_table = { 1161static const struct file_operations fops_roam_table = {
1168 .read = ath6kl_roam_table_read, 1162 .read = ath6kl_roam_table_read,
1169 .open = ath6kl_debugfs_open, 1163 .open = simple_open,
1170 .owner = THIS_MODULE, 1164 .owner = THIS_MODULE,
1171 .llseek = default_llseek, 1165 .llseek = default_llseek,
1172}; 1166};
@@ -1204,7 +1198,7 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
1204 1198
1205static const struct file_operations fops_force_roam = { 1199static const struct file_operations fops_force_roam = {
1206 .write = ath6kl_force_roam_write, 1200 .write = ath6kl_force_roam_write,
1207 .open = ath6kl_debugfs_open, 1201 .open = simple_open,
1208 .owner = THIS_MODULE, 1202 .owner = THIS_MODULE,
1209 .llseek = default_llseek, 1203 .llseek = default_llseek,
1210}; 1204};
@@ -1244,7 +1238,7 @@ static ssize_t ath6kl_roam_mode_write(struct file *file,
1244 1238
1245static const struct file_operations fops_roam_mode = { 1239static const struct file_operations fops_roam_mode = {
1246 .write = ath6kl_roam_mode_write, 1240 .write = ath6kl_roam_mode_write,
1247 .open = ath6kl_debugfs_open, 1241 .open = simple_open,
1248 .owner = THIS_MODULE, 1242 .owner = THIS_MODULE,
1249 .llseek = default_llseek, 1243 .llseek = default_llseek,
1250}; 1244};
@@ -1286,7 +1280,7 @@ static ssize_t ath6kl_keepalive_write(struct file *file,
1286} 1280}
1287 1281
1288static const struct file_operations fops_keepalive = { 1282static const struct file_operations fops_keepalive = {
1289 .open = ath6kl_debugfs_open, 1283 .open = simple_open,
1290 .read = ath6kl_keepalive_read, 1284 .read = ath6kl_keepalive_read,
1291 .write = ath6kl_keepalive_write, 1285 .write = ath6kl_keepalive_write,
1292 .owner = THIS_MODULE, 1286 .owner = THIS_MODULE,
@@ -1331,7 +1325,7 @@ static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
1331} 1325}
1332 1326
1333static const struct file_operations fops_disconnect_timeout = { 1327static const struct file_operations fops_disconnect_timeout = {
1334 .open = ath6kl_debugfs_open, 1328 .open = simple_open,
1335 .read = ath6kl_disconnect_timeout_read, 1329 .read = ath6kl_disconnect_timeout_read,
1336 .write = ath6kl_disconnect_timeout_write, 1330 .write = ath6kl_disconnect_timeout_write,
1337 .owner = THIS_MODULE, 1331 .owner = THIS_MODULE,
@@ -1512,7 +1506,7 @@ static ssize_t ath6kl_create_qos_write(struct file *file,
1512 1506
1513static const struct file_operations fops_create_qos = { 1507static const struct file_operations fops_create_qos = {
1514 .write = ath6kl_create_qos_write, 1508 .write = ath6kl_create_qos_write,
1515 .open = ath6kl_debugfs_open, 1509 .open = simple_open,
1516 .owner = THIS_MODULE, 1510 .owner = THIS_MODULE,
1517 .llseek = default_llseek, 1511 .llseek = default_llseek,
1518}; 1512};
@@ -1560,7 +1554,7 @@ static ssize_t ath6kl_delete_qos_write(struct file *file,
1560 1554
1561static const struct file_operations fops_delete_qos = { 1555static const struct file_operations fops_delete_qos = {
1562 .write = ath6kl_delete_qos_write, 1556 .write = ath6kl_delete_qos_write,
1563 .open = ath6kl_debugfs_open, 1557 .open = simple_open,
1564 .owner = THIS_MODULE, 1558 .owner = THIS_MODULE,
1565 .llseek = default_llseek, 1559 .llseek = default_llseek,
1566}; 1560};
@@ -1593,7 +1587,7 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file,
1593 1587
1594static const struct file_operations fops_bgscan_int = { 1588static const struct file_operations fops_bgscan_int = {
1595 .write = ath6kl_bgscan_int_write, 1589 .write = ath6kl_bgscan_int_write,
1596 .open = ath6kl_debugfs_open, 1590 .open = simple_open,
1597 .owner = THIS_MODULE, 1591 .owner = THIS_MODULE,
1598 .llseek = default_llseek, 1592 .llseek = default_llseek,
1599}; 1593};
@@ -1651,7 +1645,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
1651static const struct file_operations fops_listen_int = { 1645static const struct file_operations fops_listen_int = {
1652 .read = ath6kl_listen_int_read, 1646 .read = ath6kl_listen_int_read,
1653 .write = ath6kl_listen_int_write, 1647 .write = ath6kl_listen_int_write,
1654 .open = ath6kl_debugfs_open, 1648 .open = simple_open,
1655 .owner = THIS_MODULE, 1649 .owner = THIS_MODULE,
1656 .llseek = default_llseek, 1650 .llseek = default_llseek,
1657}; 1651};
@@ -1711,7 +1705,7 @@ static ssize_t ath6kl_power_params_write(struct file *file,
1711 1705
1712static const struct file_operations fops_power_params = { 1706static const struct file_operations fops_power_params = {
1713 .write = ath6kl_power_params_write, 1707 .write = ath6kl_power_params_write,
1714 .open = ath6kl_debugfs_open, 1708 .open = simple_open,
1715 .owner = THIS_MODULE, 1709 .owner = THIS_MODULE,
1716 .llseek = default_llseek, 1710 .llseek = default_llseek,
1717}; 1711};
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 2f4b48e6fb03..e5cceb077574 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/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 35d1c8e91d1c..ff47b32ecaf4 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -26,11 +26,6 @@
26#define REG_READ_D(_ah, _reg) \ 26#define REG_READ_D(_ah, _reg) \
27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
28 28
29static int ath9k_debugfs_open(struct inode *inode, struct file *file)
30{
31 file->private_data = inode->i_private;
32 return 0;
33}
34 29
35static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, 30static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
36 size_t count, loff_t *ppos) 31 size_t count, loff_t *ppos)
@@ -83,7 +78,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
83static const struct file_operations fops_debug = { 78static const struct file_operations fops_debug = {
84 .read = read_file_debug, 79 .read = read_file_debug,
85 .write = write_file_debug, 80 .write = write_file_debug,
86 .open = ath9k_debugfs_open, 81 .open = simple_open,
87 .owner = THIS_MODULE, 82 .owner = THIS_MODULE,
88 .llseek = default_llseek, 83 .llseek = default_llseek,
89}; 84};
@@ -129,7 +124,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use
129static const struct file_operations fops_tx_chainmask = { 124static const struct file_operations fops_tx_chainmask = {
130 .read = read_file_tx_chainmask, 125 .read = read_file_tx_chainmask,
131 .write = write_file_tx_chainmask, 126 .write = write_file_tx_chainmask,
132 .open = ath9k_debugfs_open, 127 .open = simple_open,
133 .owner = THIS_MODULE, 128 .owner = THIS_MODULE,
134 .llseek = default_llseek, 129 .llseek = default_llseek,
135}; 130};
@@ -172,7 +167,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use
172static const struct file_operations fops_rx_chainmask = { 167static const struct file_operations fops_rx_chainmask = {
173 .read = read_file_rx_chainmask, 168 .read = read_file_rx_chainmask,
174 .write = write_file_rx_chainmask, 169 .write = write_file_rx_chainmask,
175 .open = ath9k_debugfs_open, 170 .open = simple_open,
176 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
177 .llseek = default_llseek, 172 .llseek = default_llseek,
178}; 173};
@@ -223,7 +218,7 @@ static ssize_t write_file_disable_ani(struct file *file,
223static const struct file_operations fops_disable_ani = { 218static const struct file_operations fops_disable_ani = {
224 .read = read_file_disable_ani, 219 .read = read_file_disable_ani,
225 .write = write_file_disable_ani, 220 .write = write_file_disable_ani,
226 .open = ath9k_debugfs_open, 221 .open = simple_open,
227 .owner = THIS_MODULE, 222 .owner = THIS_MODULE,
228 .llseek = default_llseek, 223 .llseek = default_llseek,
229}; 224};
@@ -324,7 +319,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
324 319
325static const struct file_operations fops_dma = { 320static const struct file_operations fops_dma = {
326 .read = read_file_dma, 321 .read = read_file_dma,
327 .open = ath9k_debugfs_open, 322 .open = simple_open,
328 .owner = THIS_MODULE, 323 .owner = THIS_MODULE,
329 .llseek = default_llseek, 324 .llseek = default_llseek,
330}; 325};
@@ -446,7 +441,7 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
446 441
447static const struct file_operations fops_interrupt = { 442static const struct file_operations fops_interrupt = {
448 .read = read_file_interrupt, 443 .read = read_file_interrupt,
449 .open = ath9k_debugfs_open, 444 .open = simple_open,
450 .owner = THIS_MODULE, 445 .owner = THIS_MODULE,
451 .llseek = default_llseek, 446 .llseek = default_llseek,
452}; 447};
@@ -852,28 +847,28 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
852 847
853static const struct file_operations fops_xmit = { 848static const struct file_operations fops_xmit = {
854 .read = read_file_xmit, 849 .read = read_file_xmit,
855 .open = ath9k_debugfs_open, 850 .open = simple_open,
856 .owner = THIS_MODULE, 851 .owner = THIS_MODULE,
857 .llseek = default_llseek, 852 .llseek = default_llseek,
858}; 853};
859 854
860static const struct file_operations fops_stations = { 855static const struct file_operations fops_stations = {
861 .read = read_file_stations, 856 .read = read_file_stations,
862 .open = ath9k_debugfs_open, 857 .open = simple_open,
863 .owner = THIS_MODULE, 858 .owner = THIS_MODULE,
864 .llseek = default_llseek, 859 .llseek = default_llseek,
865}; 860};
866 861
867static const struct file_operations fops_misc = { 862static const struct file_operations fops_misc = {
868 .read = read_file_misc, 863 .read = read_file_misc,
869 .open = ath9k_debugfs_open, 864 .open = simple_open,
870 .owner = THIS_MODULE, 865 .owner = THIS_MODULE,
871 .llseek = default_llseek, 866 .llseek = default_llseek,
872}; 867};
873 868
874static const struct file_operations fops_reset = { 869static const struct file_operations fops_reset = {
875 .read = read_file_reset, 870 .read = read_file_reset,
876 .open = ath9k_debugfs_open, 871 .open = simple_open,
877 .owner = THIS_MODULE, 872 .owner = THIS_MODULE,
878 .llseek = default_llseek, 873 .llseek = default_llseek,
879}; 874};
@@ -1016,7 +1011,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
1016 1011
1017static const struct file_operations fops_recv = { 1012static const struct file_operations fops_recv = {
1018 .read = read_file_recv, 1013 .read = read_file_recv,
1019 .open = ath9k_debugfs_open, 1014 .open = simple_open,
1020 .owner = THIS_MODULE, 1015 .owner = THIS_MODULE,
1021 .llseek = default_llseek, 1016 .llseek = default_llseek,
1022}; 1017};
@@ -1055,7 +1050,7 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
1055static const struct file_operations fops_regidx = { 1050static const struct file_operations fops_regidx = {
1056 .read = read_file_regidx, 1051 .read = read_file_regidx,
1057 .write = write_file_regidx, 1052 .write = write_file_regidx,
1058 .open = ath9k_debugfs_open, 1053 .open = simple_open,
1059 .owner = THIS_MODULE, 1054 .owner = THIS_MODULE,
1060 .llseek = default_llseek, 1055 .llseek = default_llseek,
1061}; 1056};
@@ -1102,7 +1097,7 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
1102static const struct file_operations fops_regval = { 1097static const struct file_operations fops_regval = {
1103 .read = read_file_regval, 1098 .read = read_file_regval,
1104 .write = write_file_regval, 1099 .write = write_file_regval,
1105 .open = ath9k_debugfs_open, 1100 .open = simple_open,
1106 .owner = THIS_MODULE, 1101 .owner = THIS_MODULE,
1107 .llseek = default_llseek, 1102 .llseek = default_llseek,
1108}; 1103};
@@ -1191,7 +1186,7 @@ static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf,
1191 1186
1192static const struct file_operations fops_dump_nfcal = { 1187static const struct file_operations fops_dump_nfcal = {
1193 .read = read_file_dump_nfcal, 1188 .read = read_file_dump_nfcal,
1194 .open = ath9k_debugfs_open, 1189 .open = simple_open,
1195 .owner = THIS_MODULE, 1190 .owner = THIS_MODULE,
1196 .llseek = default_llseek, 1191 .llseek = default_llseek,
1197}; 1192};
@@ -1219,7 +1214,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
1219 1214
1220static const struct file_operations fops_base_eeprom = { 1215static const struct file_operations fops_base_eeprom = {
1221 .read = read_file_base_eeprom, 1216 .read = read_file_base_eeprom,
1222 .open = ath9k_debugfs_open, 1217 .open = simple_open,
1223 .owner = THIS_MODULE, 1218 .owner = THIS_MODULE,
1224 .llseek = default_llseek, 1219 .llseek = default_llseek,
1225}; 1220};
@@ -1247,7 +1242,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
1247 1242
1248static const struct file_operations fops_modal_eeprom = { 1243static const struct file_operations fops_modal_eeprom = {
1249 .read = read_file_modal_eeprom, 1244 .read = read_file_modal_eeprom,
1250 .open = ath9k_debugfs_open, 1245 .open = simple_open,
1251 .owner = THIS_MODULE, 1246 .owner = THIS_MODULE,
1252 .llseek = default_llseek, 1247 .llseek = default_llseek,
1253}; 1248};
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c
index 106d031d834a..4364c103ed33 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_debug.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c
@@ -60,16 +60,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
60 return retval; 60 return retval;
61} 61}
62 62
63static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file)
64{
65 file->private_data = inode->i_private;
66
67 return 0;
68}
69
70static const struct file_operations fops_dfs_stats = { 63static const struct file_operations fops_dfs_stats = {
71 .read = read_file_dfs, 64 .read = read_file_dfs,
72 .open = ath9k_dfs_debugfs_open, 65 .open = simple_open,
73 .owner = THIS_MODULE, 66 .owner = THIS_MODULE,
74 .llseek = default_llseek, 67 .llseek = default_llseek,
75}; 68};
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index d3ff33c71aa5..3035deb7a0cd 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -16,12 +16,6 @@
16 16
17#include "htc.h" 17#include "htc.h"
18 18
19static int ath9k_debugfs_open(struct inode *inode, struct file *file)
20{
21 file->private_data = inode->i_private;
22 return 0;
23}
24
25static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, 19static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
26 size_t count, loff_t *ppos) 20 size_t count, loff_t *ppos)
27{ 21{
@@ -75,7 +69,7 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
75 69
76static const struct file_operations fops_tgt_int_stats = { 70static const struct file_operations fops_tgt_int_stats = {
77 .read = read_file_tgt_int_stats, 71 .read = read_file_tgt_int_stats,
78 .open = ath9k_debugfs_open, 72 .open = simple_open,
79 .owner = THIS_MODULE, 73 .owner = THIS_MODULE,
80 .llseek = default_llseek, 74 .llseek = default_llseek,
81}; 75};
@@ -145,7 +139,7 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
145 139
146static const struct file_operations fops_tgt_tx_stats = { 140static const struct file_operations fops_tgt_tx_stats = {
147 .read = read_file_tgt_tx_stats, 141 .read = read_file_tgt_tx_stats,
148 .open = ath9k_debugfs_open, 142 .open = simple_open,
149 .owner = THIS_MODULE, 143 .owner = THIS_MODULE,
150 .llseek = default_llseek, 144 .llseek = default_llseek,
151}; 145};
@@ -191,7 +185,7 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
191 185
192static const struct file_operations fops_tgt_rx_stats = { 186static const struct file_operations fops_tgt_rx_stats = {
193 .read = read_file_tgt_rx_stats, 187 .read = read_file_tgt_rx_stats,
194 .open = ath9k_debugfs_open, 188 .open = simple_open,
195 .owner = THIS_MODULE, 189 .owner = THIS_MODULE,
196 .llseek = default_llseek, 190 .llseek = default_llseek,
197}; 191};
@@ -243,7 +237,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
243 237
244static const struct file_operations fops_xmit = { 238static const struct file_operations fops_xmit = {
245 .read = read_file_xmit, 239 .read = read_file_xmit,
246 .open = ath9k_debugfs_open, 240 .open = simple_open,
247 .owner = THIS_MODULE, 241 .owner = THIS_MODULE,
248 .llseek = default_llseek, 242 .llseek = default_llseek,
249}; 243};
@@ -364,7 +358,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
364 358
365static const struct file_operations fops_recv = { 359static const struct file_operations fops_recv = {
366 .read = read_file_recv, 360 .read = read_file_recv,
367 .open = ath9k_debugfs_open, 361 .open = simple_open,
368 .owner = THIS_MODULE, 362 .owner = THIS_MODULE,
369 .llseek = default_llseek, 363 .llseek = default_llseek,
370}; 364};
@@ -399,7 +393,7 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf,
399 393
400static const struct file_operations fops_slot = { 394static const struct file_operations fops_slot = {
401 .read = read_file_slot, 395 .read = read_file_slot,
402 .open = ath9k_debugfs_open, 396 .open = simple_open,
403 .owner = THIS_MODULE, 397 .owner = THIS_MODULE,
404 .llseek = default_llseek, 398 .llseek = default_llseek,
405}; 399};
@@ -446,7 +440,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
446 440
447static const struct file_operations fops_queue = { 441static const struct file_operations fops_queue = {
448 .read = read_file_queue, 442 .read = read_file_queue,
449 .open = ath9k_debugfs_open, 443 .open = simple_open,
450 .owner = THIS_MODULE, 444 .owner = THIS_MODULE,
451 .llseek = default_llseek, 445 .llseek = default_llseek,
452}; 446};
@@ -487,7 +481,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
487static const struct file_operations fops_debug = { 481static const struct file_operations fops_debug = {
488 .read = read_file_debug, 482 .read = read_file_debug,
489 .write = write_file_debug, 483 .write = write_file_debug,
490 .open = ath9k_debugfs_open, 484 .open = simple_open,
491 .owner = THIS_MODULE, 485 .owner = THIS_MODULE,
492 .llseek = default_llseek, 486 .llseek = default_llseek,
493}; 487};
@@ -636,7 +630,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
636 630
637static const struct file_operations fops_base_eeprom = { 631static const struct file_operations fops_base_eeprom = {
638 .read = read_file_base_eeprom, 632 .read = read_file_base_eeprom,
639 .open = ath9k_debugfs_open, 633 .open = simple_open,
640 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
641 .llseek = default_llseek, 635 .llseek = default_llseek,
642}; 636};
@@ -917,7 +911,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
917 911
918static const struct file_operations fops_modal_eeprom = { 912static const struct file_operations fops_modal_eeprom = {
919 .read = read_file_modal_eeprom, 913 .read = read_file_modal_eeprom,
920 .open = ath9k_debugfs_open, 914 .open = simple_open,
921 .owner = THIS_MODULE, 915 .owner = THIS_MODULE,
922 .llseek = default_llseek, 916 .llseek = default_llseek,
923}; 917};
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 60159f4ee532..cb006458fc4b 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 38794850f005..215eb2536b1e 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/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 4f848493fece..08bb45532701 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1480,12 +1480,6 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1480 1480
1481#ifdef CONFIG_ATH9K_DEBUGFS 1481#ifdef CONFIG_ATH9K_DEBUGFS
1482 1482
1483static int ath9k_debugfs_open(struct inode *inode, struct file *file)
1484{
1485 file->private_data = inode->i_private;
1486 return 0;
1487}
1488
1489static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, 1483static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
1490 size_t count, loff_t *ppos) 1484 size_t count, loff_t *ppos)
1491{ 1485{
@@ -1553,7 +1547,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
1553 1547
1554static const struct file_operations fops_rcstat = { 1548static const struct file_operations fops_rcstat = {
1555 .read = read_file_rcstat, 1549 .read = read_file_rcstat,
1556 .open = ath9k_debugfs_open, 1550 .open = simple_open,
1557 .owner = THIS_MODULE 1551 .owner = THIS_MODULE
1558}; 1552};
1559 1553
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index f4ae3ba994a8..1c4583c7ff7c 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/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index 3c164226687f..93fe6003a493 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -48,11 +48,6 @@
48#define ADD(buf, off, max, fmt, args...) \ 48#define ADD(buf, off, max, fmt, args...) \
49 off += snprintf(&buf[off], max - off, fmt, ##args); 49 off += snprintf(&buf[off], max - off, fmt, ##args);
50 50
51static int carl9170_debugfs_open(struct inode *inode, struct file *file)
52{
53 file->private_data = inode->i_private;
54 return 0;
55}
56 51
57struct carl9170_debugfs_fops { 52struct carl9170_debugfs_fops {
58 unsigned int read_bufsize; 53 unsigned int read_bufsize;
@@ -178,7 +173,7 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
178 .attr = _attr, \ 173 .attr = _attr, \
179 .req_dev_state = _dstate, \ 174 .req_dev_state = _dstate, \
180 .fops = { \ 175 .fops = { \
181 .open = carl9170_debugfs_open, \ 176 .open = simple_open, \
182 .read = carl9170_debugfs_read, \ 177 .read = carl9170_debugfs_read, \
183 .write = carl9170_debugfs_write, \ 178 .write = carl9170_debugfs_write, \
184 .owner = THIS_MODULE \ 179 .owner = THIS_MODULE \
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index e751fdee89b2..e807bd930647 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -500,12 +500,6 @@ out:
500 500
501#undef fappend 501#undef fappend
502 502
503static int b43_debugfs_open(struct inode *inode, struct file *file)
504{
505 file->private_data = inode->i_private;
506 return 0;
507}
508
509static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, 503static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
510 size_t count, loff_t *ppos) 504 size_t count, loff_t *ppos)
511{ 505{
@@ -624,7 +618,7 @@ out_unlock:
624 .read = _read, \ 618 .read = _read, \
625 .write = _write, \ 619 .write = _write, \
626 .fops = { \ 620 .fops = { \
627 .open = b43_debugfs_open, \ 621 .open = simple_open, \
628 .read = b43_debugfs_read, \ 622 .read = b43_debugfs_read, \
629 .write = b43_debugfs_write, \ 623 .write = b43_debugfs_write, \
630 .llseek = generic_file_llseek, \ 624 .llseek = generic_file_llseek, \
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index 5e28ad0d6d17..1965edb765a2 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -197,12 +197,6 @@ static int restart_write_file(struct b43legacy_wldev *dev, const char *buf, size
197 197
198#undef fappend 198#undef fappend
199 199
200static int b43legacy_debugfs_open(struct inode *inode, struct file *file)
201{
202 file->private_data = inode->i_private;
203 return 0;
204}
205
206static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, 200static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
207 size_t count, loff_t *ppos) 201 size_t count, loff_t *ppos)
208{ 202{
@@ -331,7 +325,7 @@ out_unlock:
331 .read = _read, \ 325 .read = _read, \
332 .write = _write, \ 326 .write = _write, \
333 .fops = { \ 327 .fops = { \
334 .open = b43legacy_debugfs_open, \ 328 .open = simple_open, \
335 .read = b43legacy_debugfs_read, \ 329 .read = b43legacy_debugfs_read, \
336 .write = b43legacy_debugfs_write, \ 330 .write = b43legacy_debugfs_write, \
337 .llseek = generic_file_llseek, \ 331 .llseek = generic_file_llseek, \
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 4fcdac63a300..2b022571a859 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 0c1209390169..faec40467208 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/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 70bee1a4d876..4b10157d8686 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -821,12 +821,6 @@ out:
821} 821}
822 822
823#ifdef CONFIG_MAC80211_DEBUGFS 823#ifdef CONFIG_MAC80211_DEBUGFS
824static int
825il3945_open_file_generic(struct inode *inode, struct file *file)
826{
827 file->private_data = inode->i_private;
828 return 0;
829}
830 824
831static ssize_t 825static ssize_t
832il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, 826il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
@@ -862,7 +856,7 @@ il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
862 856
863static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 857static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
864 .read = il3945_sta_dbgfs_stats_table_read, 858 .read = il3945_sta_dbgfs_stats_table_read,
865 .open = il3945_open_file_generic, 859 .open = simple_open,
866 .llseek = default_llseek, 860 .llseek = default_llseek,
867}; 861};
868 862
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 17f1c6853182..c46275a92565 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/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index d7e2856e41d3..11ab1247fae1 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2518,12 +2518,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta)
2518} 2518}
2519 2519
2520#ifdef CONFIG_MAC80211_DEBUGFS 2520#ifdef CONFIG_MAC80211_DEBUGFS
2521static int
2522il4965_open_file_generic(struct inode *inode, struct file *file)
2523{
2524 file->private_data = inode->i_private;
2525 return 0;
2526}
2527 2521
2528static void 2522static void
2529il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) 2523il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx)
@@ -2695,7 +2689,7 @@ il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf,
2695static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 2689static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
2696 .write = il4965_rs_sta_dbgfs_scale_table_write, 2690 .write = il4965_rs_sta_dbgfs_scale_table_write,
2697 .read = il4965_rs_sta_dbgfs_scale_table_read, 2691 .read = il4965_rs_sta_dbgfs_scale_table_read,
2698 .open = il4965_open_file_generic, 2692 .open = simple_open,
2699 .llseek = default_llseek, 2693 .llseek = default_llseek,
2700}; 2694};
2701 2695
@@ -2740,7 +2734,7 @@ il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
2740 2734
2741static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 2735static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
2742 .read = il4965_rs_sta_dbgfs_stats_table_read, 2736 .read = il4965_rs_sta_dbgfs_stats_table_read,
2743 .open = il4965_open_file_generic, 2737 .open = simple_open,
2744 .llseek = default_llseek, 2738 .llseek = default_llseek,
2745}; 2739};
2746 2740
@@ -2768,7 +2762,7 @@ il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file,
2768 2762
2769static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 2763static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
2770 .read = il4965_rs_sta_dbgfs_rate_scale_data_read, 2764 .read = il4965_rs_sta_dbgfs_rate_scale_data_read,
2771 .open = il4965_open_file_generic, 2765 .open = simple_open,
2772 .llseek = default_llseek, 2766 .llseek = default_llseek,
2773}; 2767};
2774 2768
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index e5ac04739bcc..eaf249452e51 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/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c
index 229849150aac..eff26501d60a 100644
--- a/drivers/net/wireless/iwlegacy/debug.c
+++ b/drivers/net/wireless/iwlegacy/debug.c
@@ -160,18 +160,12 @@ static ssize_t il_dbgfs_##name##_write(struct file *file, \
160 const char __user *user_buf, \ 160 const char __user *user_buf, \
161 size_t count, loff_t *ppos); 161 size_t count, loff_t *ppos);
162 162
163static int
164il_dbgfs_open_file_generic(struct inode *inode, struct file *file)
165{
166 file->private_data = inode->i_private;
167 return 0;
168}
169 163
170#define DEBUGFS_READ_FILE_OPS(name) \ 164#define DEBUGFS_READ_FILE_OPS(name) \
171 DEBUGFS_READ_FUNC(name); \ 165 DEBUGFS_READ_FUNC(name); \
172static const struct file_operations il_dbgfs_##name##_ops = { \ 166static const struct file_operations il_dbgfs_##name##_ops = { \
173 .read = il_dbgfs_##name##_read, \ 167 .read = il_dbgfs_##name##_read, \
174 .open = il_dbgfs_open_file_generic, \ 168 .open = simple_open, \
175 .llseek = generic_file_llseek, \ 169 .llseek = generic_file_llseek, \
176}; 170};
177 171
@@ -179,7 +173,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \
179 DEBUGFS_WRITE_FUNC(name); \ 173 DEBUGFS_WRITE_FUNC(name); \
180static const struct file_operations il_dbgfs_##name##_ops = { \ 174static const struct file_operations il_dbgfs_##name##_ops = { \
181 .write = il_dbgfs_##name##_write, \ 175 .write = il_dbgfs_##name##_write, \
182 .open = il_dbgfs_open_file_generic, \ 176 .open = simple_open, \
183 .llseek = generic_file_llseek, \ 177 .llseek = generic_file_llseek, \
184}; 178};
185 179
@@ -189,7 +183,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \
189static const struct file_operations il_dbgfs_##name##_ops = { \ 183static const struct file_operations il_dbgfs_##name##_ops = { \
190 .write = il_dbgfs_##name##_write, \ 184 .write = il_dbgfs_##name##_write, \
191 .read = il_dbgfs_##name##_read, \ 185 .read = il_dbgfs_##name##_read, \
192 .open = il_dbgfs_open_file_generic, \ 186 .open = simple_open, \
193 .llseek = generic_file_llseek, \ 187 .llseek = generic_file_llseek, \
194}; 188};
195 189
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 53f8c51cfcdb..7e590b349dd7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -3083,11 +3083,6 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
3083} 3083}
3084 3084
3085#ifdef CONFIG_MAC80211_DEBUGFS 3085#ifdef CONFIG_MAC80211_DEBUGFS
3086static int open_file_generic(struct inode *inode, struct file *file)
3087{
3088 file->private_data = inode->i_private;
3089 return 0;
3090}
3091static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 3086static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
3092 u32 *rate_n_flags, int index) 3087 u32 *rate_n_flags, int index)
3093{ 3088{
@@ -3226,7 +3221,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
3226static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 3221static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
3227 .write = rs_sta_dbgfs_scale_table_write, 3222 .write = rs_sta_dbgfs_scale_table_write,
3228 .read = rs_sta_dbgfs_scale_table_read, 3223 .read = rs_sta_dbgfs_scale_table_read,
3229 .open = open_file_generic, 3224 .open = simple_open,
3230 .llseek = default_llseek, 3225 .llseek = default_llseek,
3231}; 3226};
3232static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, 3227static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
@@ -3269,7 +3264,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
3269 3264
3270static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 3265static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
3271 .read = rs_sta_dbgfs_stats_table_read, 3266 .read = rs_sta_dbgfs_stats_table_read,
3272 .open = open_file_generic, 3267 .open = simple_open,
3273 .llseek = default_llseek, 3268 .llseek = default_llseek,
3274}; 3269};
3275 3270
@@ -3295,7 +3290,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
3295 3290
3296static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 3291static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
3297 .read = rs_sta_dbgfs_rate_scale_data_read, 3292 .read = rs_sta_dbgfs_rate_scale_data_read,
3298 .open = open_file_generic, 3293 .open = simple_open,
3299 .llseek = default_llseek, 3294 .llseek = default_llseek,
3300}; 3295};
3301 3296
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index b7b1c04f2fba..2bbaebd99ad4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -84,17 +84,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
84 size_t count, loff_t *ppos); 84 size_t count, loff_t *ppos);
85 85
86 86
87static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
88{
89 file->private_data = inode->i_private;
90 return 0;
91}
92
93#define DEBUGFS_READ_FILE_OPS(name) \ 87#define DEBUGFS_READ_FILE_OPS(name) \
94 DEBUGFS_READ_FUNC(name); \ 88 DEBUGFS_READ_FUNC(name); \
95static const struct file_operations iwl_dbgfs_##name##_ops = { \ 89static const struct file_operations iwl_dbgfs_##name##_ops = { \
96 .read = iwl_dbgfs_##name##_read, \ 90 .read = iwl_dbgfs_##name##_read, \
97 .open = iwl_dbgfs_open_file_generic, \ 91 .open = simple_open, \
98 .llseek = generic_file_llseek, \ 92 .llseek = generic_file_llseek, \
99}; 93};
100 94
@@ -102,7 +96,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
102 DEBUGFS_WRITE_FUNC(name); \ 96 DEBUGFS_WRITE_FUNC(name); \
103static const struct file_operations iwl_dbgfs_##name##_ops = { \ 97static const struct file_operations iwl_dbgfs_##name##_ops = { \
104 .write = iwl_dbgfs_##name##_write, \ 98 .write = iwl_dbgfs_##name##_write, \
105 .open = iwl_dbgfs_open_file_generic, \ 99 .open = simple_open, \
106 .llseek = generic_file_llseek, \ 100 .llseek = generic_file_llseek, \
107}; 101};
108 102
@@ -113,7 +107,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
113static const struct file_operations iwl_dbgfs_##name##_ops = { \ 107static const struct file_operations iwl_dbgfs_##name##_ops = { \
114 .write = iwl_dbgfs_##name##_write, \ 108 .write = iwl_dbgfs_##name##_write, \
115 .read = iwl_dbgfs_##name##_read, \ 109 .read = iwl_dbgfs_##name##_read, \
116 .open = iwl_dbgfs_open_file_generic, \ 110 .open = simple_open, \
117 .llseek = generic_file_llseek, \ 111 .llseek = generic_file_llseek, \
118}; 112};
119 113
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index b4f796c82e1e..4d7b30d3e648 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1898,17 +1898,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
1898 size_t count, loff_t *ppos); 1898 size_t count, loff_t *ppos);
1899 1899
1900 1900
1901static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
1902{
1903 file->private_data = inode->i_private;
1904 return 0;
1905}
1906
1907#define DEBUGFS_READ_FILE_OPS(name) \ 1901#define DEBUGFS_READ_FILE_OPS(name) \
1908 DEBUGFS_READ_FUNC(name); \ 1902 DEBUGFS_READ_FUNC(name); \
1909static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1903static const struct file_operations iwl_dbgfs_##name##_ops = { \
1910 .read = iwl_dbgfs_##name##_read, \ 1904 .read = iwl_dbgfs_##name##_read, \
1911 .open = iwl_dbgfs_open_file_generic, \ 1905 .open = simple_open, \
1912 .llseek = generic_file_llseek, \ 1906 .llseek = generic_file_llseek, \
1913}; 1907};
1914 1908
@@ -1916,7 +1910,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1916 DEBUGFS_WRITE_FUNC(name); \ 1910 DEBUGFS_WRITE_FUNC(name); \
1917static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1911static const struct file_operations iwl_dbgfs_##name##_ops = { \
1918 .write = iwl_dbgfs_##name##_write, \ 1912 .write = iwl_dbgfs_##name##_write, \
1919 .open = iwl_dbgfs_open_file_generic, \ 1913 .open = simple_open, \
1920 .llseek = generic_file_llseek, \ 1914 .llseek = generic_file_llseek, \
1921}; 1915};
1922 1916
@@ -1926,7 +1920,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1926static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1920static const struct file_operations iwl_dbgfs_##name##_ops = { \
1927 .write = iwl_dbgfs_##name##_write, \ 1921 .write = iwl_dbgfs_##name##_write, \
1928 .read = iwl_dbgfs_##name##_read, \ 1922 .read = iwl_dbgfs_##name##_read, \
1929 .open = iwl_dbgfs_open_file_generic, \ 1923 .open = simple_open, \
1930 .llseek = generic_file_llseek, \ 1924 .llseek = generic_file_llseek, \
1931}; 1925};
1932 1926
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index 87eef5773a02..b6199d124bb9 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -99,12 +99,6 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iwm_dbg_modules,
99 iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, 99 iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write,
100 "%llu\n"); 100 "%llu\n");
101 101
102static int iwm_generic_open(struct inode *inode, struct file *filp)
103{
104 filp->private_data = inode->i_private;
105 return 0;
106}
107
108 102
109static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, 103static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer,
110 size_t count, loff_t *ppos) 104 size_t count, loff_t *ppos)
@@ -401,28 +395,28 @@ out:
401 395
402static const struct file_operations iwm_debugfs_txq_fops = { 396static const struct file_operations iwm_debugfs_txq_fops = {
403 .owner = THIS_MODULE, 397 .owner = THIS_MODULE,
404 .open = iwm_generic_open, 398 .open = simple_open,
405 .read = iwm_debugfs_txq_read, 399 .read = iwm_debugfs_txq_read,
406 .llseek = default_llseek, 400 .llseek = default_llseek,
407}; 401};
408 402
409static const struct file_operations iwm_debugfs_tx_credit_fops = { 403static const struct file_operations iwm_debugfs_tx_credit_fops = {
410 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
411 .open = iwm_generic_open, 405 .open = simple_open,
412 .read = iwm_debugfs_tx_credit_read, 406 .read = iwm_debugfs_tx_credit_read,
413 .llseek = default_llseek, 407 .llseek = default_llseek,
414}; 408};
415 409
416static const struct file_operations iwm_debugfs_rx_ticket_fops = { 410static const struct file_operations iwm_debugfs_rx_ticket_fops = {
417 .owner = THIS_MODULE, 411 .owner = THIS_MODULE,
418 .open = iwm_generic_open, 412 .open = simple_open,
419 .read = iwm_debugfs_rx_ticket_read, 413 .read = iwm_debugfs_rx_ticket_read,
420 .llseek = default_llseek, 414 .llseek = default_llseek,
421}; 415};
422 416
423static const struct file_operations iwm_debugfs_fw_err_fops = { 417static const struct file_operations iwm_debugfs_fw_err_fops = {
424 .owner = THIS_MODULE, 418 .owner = THIS_MODULE,
425 .open = iwm_generic_open, 419 .open = simple_open,
426 .read = iwm_debugfs_fw_err_read, 420 .read = iwm_debugfs_fw_err_read,
427 .llseek = default_llseek, 421 .llseek = default_llseek,
428}; 422};
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index 764b40dd24ad..0042f204b07f 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -264,13 +264,6 @@ static int if_sdio_send_chunk(struct iwm_priv *iwm, u8 *buf, int count)
264 return ret; 264 return ret;
265} 265}
266 266
267/* debugfs hooks */
268static int iwm_debugfs_sdio_open(struct inode *inode, struct file *filp)
269{
270 filp->private_data = inode->i_private;
271 return 0;
272}
273
274static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, 267static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer,
275 size_t count, loff_t *ppos) 268 size_t count, loff_t *ppos)
276{ 269{
@@ -363,7 +356,7 @@ err:
363 356
364static const struct file_operations iwm_debugfs_sdio_fops = { 357static const struct file_operations iwm_debugfs_sdio_fops = {
365 .owner = THIS_MODULE, 358 .owner = THIS_MODULE,
366 .open = iwm_debugfs_sdio_open, 359 .open = simple_open,
367 .read = iwm_debugfs_sdio_read, 360 .read = iwm_debugfs_sdio_read,
368 .llseek = default_llseek, 361 .llseek = default_llseek,
369}; 362};
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index c192671610fc..a06cc283e23d 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -21,12 +21,6 @@ static char *szStates[] = {
21static void lbs_debug_init(struct lbs_private *priv); 21static void lbs_debug_init(struct lbs_private *priv);
22#endif 22#endif
23 23
24static int open_file_generic(struct inode *inode, struct file *file)
25{
26 file->private_data = inode->i_private;
27 return 0;
28}
29
30static ssize_t write_file_dummy(struct file *file, const char __user *buf, 24static ssize_t write_file_dummy(struct file *file, const char __user *buf,
31 size_t count, loff_t *ppos) 25 size_t count, loff_t *ppos)
32{ 26{
@@ -696,7 +690,7 @@ out_unlock:
696 690
697#define FOPS(fread, fwrite) { \ 691#define FOPS(fread, fwrite) { \
698 .owner = THIS_MODULE, \ 692 .owner = THIS_MODULE, \
699 .open = open_file_generic, \ 693 .open = simple_open, \
700 .read = (fread), \ 694 .read = (fread), \
701 .write = (fwrite), \ 695 .write = (fwrite), \
702 .llseek = generic_file_llseek, \ 696 .llseek = generic_file_llseek, \
@@ -962,7 +956,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
962 956
963static const struct file_operations lbs_debug_fops = { 957static const struct file_operations lbs_debug_fops = {
964 .owner = THIS_MODULE, 958 .owner = THIS_MODULE,
965 .open = open_file_generic, 959 .open = simple_open,
966 .write = lbs_debugfs_write, 960 .write = lbs_debugfs_write,
967 .read = lbs_debugfs_read, 961 .read = lbs_debugfs_read,
968 .llseek = default_llseek, 962 .llseek = default_llseek,
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index d26a78b6b3c4..1a845074c52a 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -140,18 +140,6 @@ static struct mwifiex_debug_data items[] = {
140static int num_of_items = ARRAY_SIZE(items); 140static int num_of_items = ARRAY_SIZE(items);
141 141
142/* 142/*
143 * Generic proc file open handler.
144 *
145 * This function is called every time a file is accessed for read or write.
146 */
147static int
148mwifiex_open_generic(struct inode *inode, struct file *file)
149{
150 file->private_data = inode->i_private;
151 return 0;
152}
153
154/*
155 * Proc info file read handler. 143 * Proc info file read handler.
156 * 144 *
157 * This function is called when the 'info' file is opened for reading. 145 * This function is called when the 'info' file is opened for reading.
@@ -676,19 +664,19 @@ done:
676static const struct file_operations mwifiex_dfs_##name##_fops = { \ 664static const struct file_operations mwifiex_dfs_##name##_fops = { \
677 .read = mwifiex_##name##_read, \ 665 .read = mwifiex_##name##_read, \
678 .write = mwifiex_##name##_write, \ 666 .write = mwifiex_##name##_write, \
679 .open = mwifiex_open_generic, \ 667 .open = simple_open, \
680}; 668};
681 669
682#define MWIFIEX_DFS_FILE_READ_OPS(name) \ 670#define MWIFIEX_DFS_FILE_READ_OPS(name) \
683static const struct file_operations mwifiex_dfs_##name##_fops = { \ 671static const struct file_operations mwifiex_dfs_##name##_fops = { \
684 .read = mwifiex_##name##_read, \ 672 .read = mwifiex_##name##_read, \
685 .open = mwifiex_open_generic, \ 673 .open = simple_open, \
686}; 674};
687 675
688#define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ 676#define MWIFIEX_DFS_FILE_WRITE_OPS(name) \
689static const struct file_operations mwifiex_dfs_##name##_fops = { \ 677static const struct file_operations mwifiex_dfs_##name##_fops = { \
690 .write = mwifiex_##name##_write, \ 678 .write = mwifiex_##name##_write, \
691 .open = mwifiex_open_generic, \ 679 .open = simple_open, \
692}; 680};
693 681
694 682
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index dd6c64ac406e..88e3ad2d1db8 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 cd490abced91..001735f7a661 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 1eec3a06d1f3..4c016241f340 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 34591eeb8376..28fc5fb8057b 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/net/wireless/wl1251/debugfs.c b/drivers/net/wireless/wl1251/debugfs.c
index 6c274007d200..448da1f8c22f 100644
--- a/drivers/net/wireless/wl1251/debugfs.c
+++ b/drivers/net/wireless/wl1251/debugfs.c
@@ -47,7 +47,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
47 \ 47 \
48static const struct file_operations name## _ops = { \ 48static const struct file_operations name## _ops = { \
49 .read = name## _read, \ 49 .read = name## _read, \
50 .open = wl1251_open_file_generic, \ 50 .open = simple_open, \
51 .llseek = generic_file_llseek, \ 51 .llseek = generic_file_llseek, \
52}; 52};
53 53
@@ -84,7 +84,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
84 \ 84 \
85static const struct file_operations sub## _ ##name## _ops = { \ 85static const struct file_operations sub## _ ##name## _ops = { \
86 .read = sub## _ ##name## _read, \ 86 .read = sub## _ ##name## _read, \
87 .open = wl1251_open_file_generic, \ 87 .open = simple_open, \
88 .llseek = generic_file_llseek, \ 88 .llseek = generic_file_llseek, \
89}; 89};
90 90
@@ -117,12 +117,6 @@ out:
117 mutex_unlock(&wl->mutex); 117 mutex_unlock(&wl->mutex);
118} 118}
119 119
120static int wl1251_open_file_generic(struct inode *inode, struct file *file)
121{
122 file->private_data = inode->i_private;
123 return 0;
124}
125
126DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); 120DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u");
127 121
128DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); 122DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u");
@@ -235,7 +229,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
235 229
236static const struct file_operations tx_queue_len_ops = { 230static const struct file_operations tx_queue_len_ops = {
237 .read = tx_queue_len_read, 231 .read = tx_queue_len_read,
238 .open = wl1251_open_file_generic, 232 .open = simple_open,
239 .llseek = generic_file_llseek, 233 .llseek = generic_file_llseek,
240}; 234};
241 235
@@ -257,7 +251,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf,
257 251
258static const struct file_operations tx_queue_status_ops = { 252static const struct file_operations tx_queue_status_ops = {
259 .read = tx_queue_status_read, 253 .read = tx_queue_status_read,
260 .open = wl1251_open_file_generic, 254 .open = simple_open,
261 .llseek = generic_file_llseek, 255 .llseek = generic_file_llseek,
262}; 256};
263 257
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index e1cf72765965..564d49575c94 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -63,7 +63,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
63 \ 63 \
64static const struct file_operations name## _ops = { \ 64static const struct file_operations name## _ops = { \
65 .read = name## _read, \ 65 .read = name## _read, \
66 .open = wl1271_open_file_generic, \ 66 .open = simple_open, \
67 .llseek = generic_file_llseek, \ 67 .llseek = generic_file_llseek, \
68}; 68};
69 69
@@ -96,7 +96,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
96 \ 96 \
97static const struct file_operations sub## _ ##name## _ops = { \ 97static const struct file_operations sub## _ ##name## _ops = { \
98 .read = sub## _ ##name## _read, \ 98 .read = sub## _ ##name## _read, \
99 .open = wl1271_open_file_generic, \ 99 .open = simple_open, \
100 .llseek = generic_file_llseek, \ 100 .llseek = generic_file_llseek, \
101}; 101};
102 102
@@ -126,12 +126,6 @@ out:
126 mutex_unlock(&wl->mutex); 126 mutex_unlock(&wl->mutex);
127} 127}
128 128
129static int wl1271_open_file_generic(struct inode *inode, struct file *file)
130{
131 file->private_data = inode->i_private;
132 return 0;
133}
134
135DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); 129DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u");
136 130
137DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); 131DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u");
@@ -243,7 +237,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
243 237
244static const struct file_operations tx_queue_len_ops = { 238static const struct file_operations tx_queue_len_ops = {
245 .read = tx_queue_len_read, 239 .read = tx_queue_len_read,
246 .open = wl1271_open_file_generic, 240 .open = simple_open,
247 .llseek = default_llseek, 241 .llseek = default_llseek,
248}; 242};
249 243
@@ -289,7 +283,7 @@ static ssize_t gpio_power_write(struct file *file,
289static const struct file_operations gpio_power_ops = { 283static const struct file_operations gpio_power_ops = {
290 .read = gpio_power_read, 284 .read = gpio_power_read,
291 .write = gpio_power_write, 285 .write = gpio_power_write,
292 .open = wl1271_open_file_generic, 286 .open = simple_open,
293 .llseek = default_llseek, 287 .llseek = default_llseek,
294}; 288};
295 289
@@ -308,7 +302,7 @@ static ssize_t start_recovery_write(struct file *file,
308 302
309static const struct file_operations start_recovery_ops = { 303static const struct file_operations start_recovery_ops = {
310 .write = start_recovery_write, 304 .write = start_recovery_write,
311 .open = wl1271_open_file_generic, 305 .open = simple_open,
312 .llseek = default_llseek, 306 .llseek = default_llseek,
313}; 307};
314 308
@@ -372,7 +366,7 @@ out:
372static const struct file_operations dynamic_ps_timeout_ops = { 366static const struct file_operations dynamic_ps_timeout_ops = {
373 .read = dynamic_ps_timeout_read, 367 .read = dynamic_ps_timeout_read,
374 .write = dynamic_ps_timeout_write, 368 .write = dynamic_ps_timeout_write,
375 .open = wl1271_open_file_generic, 369 .open = simple_open,
376 .llseek = default_llseek, 370 .llseek = default_llseek,
377}; 371};
378 372
@@ -441,7 +435,7 @@ out:
441static const struct file_operations forced_ps_ops = { 435static const struct file_operations forced_ps_ops = {
442 .read = forced_ps_read, 436 .read = forced_ps_read,
443 .write = forced_ps_write, 437 .write = forced_ps_write,
444 .open = wl1271_open_file_generic, 438 .open = simple_open,
445 .llseek = default_llseek, 439 .llseek = default_llseek,
446}; 440};
447 441
@@ -483,7 +477,7 @@ static ssize_t split_scan_timeout_write(struct file *file,
483static const struct file_operations split_scan_timeout_ops = { 477static const struct file_operations split_scan_timeout_ops = {
484 .read = split_scan_timeout_read, 478 .read = split_scan_timeout_read,
485 .write = split_scan_timeout_write, 479 .write = split_scan_timeout_write,
486 .open = wl1271_open_file_generic, 480 .open = simple_open,
487 .llseek = default_llseek, 481 .llseek = default_llseek,
488}; 482};
489 483
@@ -566,7 +560,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
566 560
567static const struct file_operations driver_state_ops = { 561static const struct file_operations driver_state_ops = {
568 .read = driver_state_read, 562 .read = driver_state_read,
569 .open = wl1271_open_file_generic, 563 .open = simple_open,
570 .llseek = default_llseek, 564 .llseek = default_llseek,
571}; 565};
572 566
@@ -675,7 +669,7 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf,
675 669
676static const struct file_operations vifs_state_ops = { 670static const struct file_operations vifs_state_ops = {
677 .read = vifs_state_read, 671 .read = vifs_state_read,
678 .open = wl1271_open_file_generic, 672 .open = simple_open,
679 .llseek = default_llseek, 673 .llseek = default_llseek,
680}; 674};
681 675
@@ -733,7 +727,7 @@ static ssize_t dtim_interval_write(struct file *file,
733static const struct file_operations dtim_interval_ops = { 727static const struct file_operations dtim_interval_ops = {
734 .read = dtim_interval_read, 728 .read = dtim_interval_read,
735 .write = dtim_interval_write, 729 .write = dtim_interval_write,
736 .open = wl1271_open_file_generic, 730 .open = simple_open,
737 .llseek = default_llseek, 731 .llseek = default_llseek,
738}; 732};
739 733
@@ -791,7 +785,7 @@ static ssize_t suspend_dtim_interval_write(struct file *file,
791static const struct file_operations suspend_dtim_interval_ops = { 785static const struct file_operations suspend_dtim_interval_ops = {
792 .read = suspend_dtim_interval_read, 786 .read = suspend_dtim_interval_read,
793 .write = suspend_dtim_interval_write, 787 .write = suspend_dtim_interval_write,
794 .open = wl1271_open_file_generic, 788 .open = simple_open,
795 .llseek = default_llseek, 789 .llseek = default_llseek,
796}; 790};
797 791
@@ -849,7 +843,7 @@ static ssize_t beacon_interval_write(struct file *file,
849static const struct file_operations beacon_interval_ops = { 843static const struct file_operations beacon_interval_ops = {
850 .read = beacon_interval_read, 844 .read = beacon_interval_read,
851 .write = beacon_interval_write, 845 .write = beacon_interval_write,
852 .open = wl1271_open_file_generic, 846 .open = simple_open,
853 .llseek = default_llseek, 847 .llseek = default_llseek,
854}; 848};
855 849
@@ -904,7 +898,7 @@ static ssize_t rx_streaming_interval_read(struct file *file,
904static const struct file_operations rx_streaming_interval_ops = { 898static const struct file_operations rx_streaming_interval_ops = {
905 .read = rx_streaming_interval_read, 899 .read = rx_streaming_interval_read,
906 .write = rx_streaming_interval_write, 900 .write = rx_streaming_interval_write,
907 .open = wl1271_open_file_generic, 901 .open = simple_open,
908 .llseek = default_llseek, 902 .llseek = default_llseek,
909}; 903};
910 904
@@ -959,7 +953,7 @@ static ssize_t rx_streaming_always_read(struct file *file,
959static const struct file_operations rx_streaming_always_ops = { 953static const struct file_operations rx_streaming_always_ops = {
960 .read = rx_streaming_always_read, 954 .read = rx_streaming_always_read,
961 .write = rx_streaming_always_write, 955 .write = rx_streaming_always_write,
962 .open = wl1271_open_file_generic, 956 .open = simple_open,
963 .llseek = default_llseek, 957 .llseek = default_llseek,
964}; 958};
965 959
@@ -1003,7 +997,7 @@ out:
1003 997
1004static const struct file_operations beacon_filtering_ops = { 998static const struct file_operations beacon_filtering_ops = {
1005 .write = beacon_filtering_write, 999 .write = beacon_filtering_write,
1006 .open = wl1271_open_file_generic, 1000 .open = simple_open,
1007 .llseek = default_llseek, 1001 .llseek = default_llseek,
1008}; 1002};
1009 1003
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 663b32c2e931..0ebbb1906c30 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1965,7 +1965,7 @@ static int __init netif_init(void)
1965 if (xen_initial_domain()) 1965 if (xen_initial_domain())
1966 return 0; 1966 return 0;
1967 1967
1968 if (!xen_platform_pci_unplug) 1968 if (xen_hvm_domain() && !xen_platform_pci_unplug)
1969 return -ENODEV; 1969 return -ENODEV;
1970 1970
1971 printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n"); 1971 printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");