aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/3com/3c59x.c2
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c111
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c28
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c44
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h11
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c8
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c9
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad_ethtool.c10
-rw-r--r--drivers/net/ethernet/cisco/enic/enic.h2
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c38
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c6
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c3
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c1
-rw-r--r--drivers/net/ethernet/faraday/ftmac100.c1
-rw-r--r--drivers/net/ethernet/freescale/fec.c4
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c10
-rw-r--r--drivers/net/ethernet/intel/igb/Makefile2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_defines.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_hw.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_mac.c4
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_mac.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_mbx.c2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_mbx.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_nvm.c2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_nvm.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_phy.c2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_phy.h2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_regs.h2
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c13
-rw-r--r--drivers/net/ethernet/intel/igbvf/Makefile2
-rw-r--r--drivers/net/ethernet/intel/igbvf/defines.h2
-rw-r--r--drivers/net/ethernet/intel/igbvf/ethtool.c5
-rw-r--r--drivers/net/ethernet/intel/igbvf/igbvf.h2
-rw-r--r--drivers/net/ethernet/intel/igbvf/mbx.c2
-rw-r--r--drivers/net/ethernet/intel/igbvf/mbx.h2
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c9
-rw-r--r--drivers/net/ethernet/intel/igbvf/regs.h2
-rw-r--r--drivers/net/ethernet/intel/igbvf/vf.c2
-rw-r--r--drivers/net/ethernet/intel/igbvf/vf.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/Makefile2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.h4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c13
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c92
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c22
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c8
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_type.h34
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/Makefile2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/defines.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ethtool.c7
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf.h10
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c47
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/mbx.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/mbx.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/regs.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/vf.c28
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/vf.h4
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c14
-rw-r--r--drivers/net/ethernet/marvell/skge.c38
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c19
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c159
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_main.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c41
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c26
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c9
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mcg.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c14
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/pd.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/port.c23
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/profile.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c60
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/srq.c2
-rw-r--r--drivers/net/ethernet/micrel/Kconfig1
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c2
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c14
-rw-r--r--drivers/net/ethernet/octeon/octeon_mgmt.c4
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c17
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c4
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/enh_desc.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/norm_desc.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h5
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c7
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c205
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c12
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c23
-rw-r--r--drivers/net/ethernet/ti/cpmac.c4
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c3
-rw-r--r--drivers/net/ethernet/ti/davinci_mdio.c2
-rw-r--r--drivers/net/ethernet/toshiba/Kconfig2
-rw-r--r--drivers/net/ethernet/via/via-velocity.c3
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c3
124 files changed, 863 insertions, 624 deletions
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 8153a3e0a1a4..f9b74c0a8492 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1842,7 +1842,7 @@ vortex_timer(unsigned long data)
1842 ok = 1; 1842 ok = 1;
1843 } 1843 }
1844 1844
1845 if (!netif_carrier_ok(dev)) 1845 if (dev->flags & IFF_SLAVE || !netif_carrier_ok(dev))
1846 next_tick = 5*HZ; 1846 next_tick = 5*HZ;
1847 1847
1848 if (vp->medialock) 1848 if (vp->medialock)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 986019b2c849..c7ca7ec065ee 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -797,7 +797,7 @@ static int bcm_enet_open(struct net_device *dev)
797 if (priv->has_phy) { 797 if (priv->has_phy) {
798 /* connect to PHY */ 798 /* connect to PHY */
799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, 799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
800 priv->mac_id ? "1" : "0", priv->phy_id); 800 priv->mii_bus->id, priv->phy_id);
801 801
802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0, 802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0,
803 PHY_INTERFACE_MODE_MII); 803 PHY_INTERFACE_MODE_MII);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 2b731b253598..7aee46983be4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -523,7 +523,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
523 skb = build_skb(data); 523 skb = build_skb(data);
524 524
525 if (likely(skb)) { 525 if (likely(skb)) {
526
527#ifdef BNX2X_STOP_ON_ERROR 526#ifdef BNX2X_STOP_ON_ERROR
528 if (pad + len > fp->rx_buf_size) { 527 if (pad + len > fp->rx_buf_size) {
529 BNX2X_ERR("skb_put is about to fail... " 528 BNX2X_ERR("skb_put is about to fail... "
@@ -557,7 +556,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
557 556
558 return; 557 return;
559 } 558 }
560 559 kfree(new_data);
561drop: 560drop:
562 /* drop the packet and keep the buffer in the bin */ 561 /* drop the packet and keep the buffer in the bin */
563 DP(NETIF_MSG_RX_STATUS, 562 DP(NETIF_MSG_RX_STATUS,
@@ -3117,7 +3116,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
3117 int rx_ring_size = 0; 3116 int rx_ring_size = 0;
3118 3117
3119#ifdef BCM_CNIC 3118#ifdef BCM_CNIC
3120 if (IS_MF_ISCSI_SD(bp)) { 3119 if (!bp->rx_ring_size && IS_MF_ISCSI_SD(bp)) {
3121 rx_ring_size = MIN_RX_SIZE_NONTPA; 3120 rx_ring_size = MIN_RX_SIZE_NONTPA;
3122 bp->rx_ring_size = rx_ring_size; 3121 bp->rx_ring_size = rx_ring_size;
3123 } else 3122 } else
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index f99c6e312a5d..31a8b38ab15e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1738,7 +1738,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
1738 struct bnx2x_fp_txdata *txdata = &fp_tx->txdata[0]; 1738 struct bnx2x_fp_txdata *txdata = &fp_tx->txdata[0];
1739 u16 tx_start_idx, tx_idx; 1739 u16 tx_start_idx, tx_idx;
1740 u16 rx_start_idx, rx_idx; 1740 u16 rx_start_idx, rx_idx;
1741 u16 pkt_prod, bd_prod, rx_comp_cons; 1741 u16 pkt_prod, bd_prod;
1742 struct sw_tx_bd *tx_buf; 1742 struct sw_tx_bd *tx_buf;
1743 struct eth_tx_start_bd *tx_start_bd; 1743 struct eth_tx_start_bd *tx_start_bd;
1744 struct eth_tx_parse_bd_e1x *pbd_e1x = NULL; 1744 struct eth_tx_parse_bd_e1x *pbd_e1x = NULL;
@@ -1873,8 +1873,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
1873 if (rx_idx != rx_start_idx + num_pkts) 1873 if (rx_idx != rx_start_idx + num_pkts)
1874 goto test_loopback_exit; 1874 goto test_loopback_exit;
1875 1875
1876 rx_comp_cons = le16_to_cpu(fp_rx->rx_comp_cons); 1876 cqe = &fp_rx->rx_comp_ring[RCQ_BD(fp_rx->rx_comp_cons)];
1877 cqe = &fp_rx->rx_comp_ring[RCQ_BD(rx_comp_cons)];
1878 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags; 1877 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags;
1879 cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE; 1878 cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE;
1880 if (!CQE_TYPE_FAST(cqe_fp_type) || (cqe_fp_flags & ETH_RX_ERROR_FALGS)) 1879 if (!CQE_TYPE_FAST(cqe_fp_type) || (cqe_fp_flags & ETH_RX_ERROR_FALGS))
@@ -2121,18 +2120,16 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
2121 case ETH_SS_STATS: 2120 case ETH_SS_STATS:
2122 if (is_multi(bp)) { 2121 if (is_multi(bp)) {
2123 num_stats = bnx2x_num_stat_queues(bp) * 2122 num_stats = bnx2x_num_stat_queues(bp) *
2124 BNX2X_NUM_Q_STATS; 2123 BNX2X_NUM_Q_STATS;
2125 if (!IS_MF_MODE_STAT(bp)) 2124 } else
2126 num_stats += BNX2X_NUM_STATS; 2125 num_stats = 0;
2127 } else { 2126 if (IS_MF_MODE_STAT(bp)) {
2128 if (IS_MF_MODE_STAT(bp)) { 2127 for (i = 0; i < BNX2X_NUM_STATS; i++)
2129 num_stats = 0; 2128 if (IS_FUNC_STAT(i))
2130 for (i = 0; i < BNX2X_NUM_STATS; i++) 2129 num_stats++;
2131 if (IS_FUNC_STAT(i)) 2130 } else
2132 num_stats++; 2131 num_stats += BNX2X_NUM_STATS;
2133 } else 2132
2134 num_stats = BNX2X_NUM_STATS;
2135 }
2136 return num_stats; 2133 return num_stats;
2137 2134
2138 case ETH_SS_TEST: 2135 case ETH_SS_TEST:
@@ -2151,8 +2148,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
2151 2148
2152 switch (stringset) { 2149 switch (stringset) {
2153 case ETH_SS_STATS: 2150 case ETH_SS_STATS:
2151 k = 0;
2154 if (is_multi(bp)) { 2152 if (is_multi(bp)) {
2155 k = 0;
2156 for_each_eth_queue(bp, i) { 2153 for_each_eth_queue(bp, i) {
2157 memset(queue_name, 0, sizeof(queue_name)); 2154 memset(queue_name, 0, sizeof(queue_name));
2158 sprintf(queue_name, "%d", i); 2155 sprintf(queue_name, "%d", i);
@@ -2163,20 +2160,17 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
2163 queue_name); 2160 queue_name);
2164 k += BNX2X_NUM_Q_STATS; 2161 k += BNX2X_NUM_Q_STATS;
2165 } 2162 }
2166 if (IS_MF_MODE_STAT(bp))
2167 break;
2168 for (j = 0; j < BNX2X_NUM_STATS; j++)
2169 strcpy(buf + (k + j)*ETH_GSTRING_LEN,
2170 bnx2x_stats_arr[j].string);
2171 } else {
2172 for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
2173 if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
2174 continue;
2175 strcpy(buf + j*ETH_GSTRING_LEN,
2176 bnx2x_stats_arr[i].string);
2177 j++;
2178 }
2179 } 2163 }
2164
2165
2166 for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
2167 if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
2168 continue;
2169 strcpy(buf + (k + j)*ETH_GSTRING_LEN,
2170 bnx2x_stats_arr[i].string);
2171 j++;
2172 }
2173
2180 break; 2174 break;
2181 2175
2182 case ETH_SS_TEST: 2176 case ETH_SS_TEST:
@@ -2190,10 +2184,9 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
2190{ 2184{
2191 struct bnx2x *bp = netdev_priv(dev); 2185 struct bnx2x *bp = netdev_priv(dev);
2192 u32 *hw_stats, *offset; 2186 u32 *hw_stats, *offset;
2193 int i, j, k; 2187 int i, j, k = 0;
2194 2188
2195 if (is_multi(bp)) { 2189 if (is_multi(bp)) {
2196 k = 0;
2197 for_each_eth_queue(bp, i) { 2190 for_each_eth_queue(bp, i) {
2198 hw_stats = (u32 *)&bp->fp[i].eth_q_stats; 2191 hw_stats = (u32 *)&bp->fp[i].eth_q_stats;
2199 for (j = 0; j < BNX2X_NUM_Q_STATS; j++) { 2192 for (j = 0; j < BNX2X_NUM_Q_STATS; j++) {
@@ -2214,46 +2207,28 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
2214 } 2207 }
2215 k += BNX2X_NUM_Q_STATS; 2208 k += BNX2X_NUM_Q_STATS;
2216 } 2209 }
2217 if (IS_MF_MODE_STAT(bp)) 2210 }
2218 return; 2211
2219 hw_stats = (u32 *)&bp->eth_stats; 2212 hw_stats = (u32 *)&bp->eth_stats;
2220 for (j = 0; j < BNX2X_NUM_STATS; j++) { 2213 for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
2221 if (bnx2x_stats_arr[j].size == 0) { 2214 if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
2222 /* skip this counter */ 2215 continue;
2223 buf[k + j] = 0; 2216 if (bnx2x_stats_arr[i].size == 0) {
2224 continue; 2217 /* skip this counter */
2225 } 2218 buf[k + j] = 0;
2226 offset = (hw_stats + bnx2x_stats_arr[j].offset); 2219 j++;
2227 if (bnx2x_stats_arr[j].size == 4) { 2220 continue;
2228 /* 4-byte counter */
2229 buf[k + j] = (u64) *offset;
2230 continue;
2231 }
2232 /* 8-byte counter */
2233 buf[k + j] = HILO_U64(*offset, *(offset + 1));
2234 } 2221 }
2235 } else { 2222 offset = (hw_stats + bnx2x_stats_arr[i].offset);
2236 hw_stats = (u32 *)&bp->eth_stats; 2223 if (bnx2x_stats_arr[i].size == 4) {
2237 for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { 2224 /* 4-byte counter */
2238 if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) 2225 buf[k + j] = (u64) *offset;
2239 continue;
2240 if (bnx2x_stats_arr[i].size == 0) {
2241 /* skip this counter */
2242 buf[j] = 0;
2243 j++;
2244 continue;
2245 }
2246 offset = (hw_stats + bnx2x_stats_arr[i].offset);
2247 if (bnx2x_stats_arr[i].size == 4) {
2248 /* 4-byte counter */
2249 buf[j] = (u64) *offset;
2250 j++;
2251 continue;
2252 }
2253 /* 8-byte counter */
2254 buf[j] = HILO_U64(*offset, *(offset + 1));
2255 j++; 2226 j++;
2227 continue;
2256 } 2228 }
2229 /* 8-byte counter */
2230 buf[k + j] = HILO_U64(*offset, *(offset + 1));
2231 j++;
2257 } 2232 }
2258} 2233}
2259 2234
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index ffeaaa95ed96..254521319150 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -117,10 +117,6 @@ static int dropless_fc;
117module_param(dropless_fc, int, 0); 117module_param(dropless_fc, int, 0);
118MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring"); 118MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring");
119 119
120static int poll;
121module_param(poll, int, 0);
122MODULE_PARM_DESC(poll, " Use polling (for debug)");
123
124static int mrrs = -1; 120static int mrrs = -1;
125module_param(mrrs, int, 0); 121module_param(mrrs, int, 0);
126MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)"); 122MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)");
@@ -941,7 +937,7 @@ void bnx2x_panic_dump(struct bnx2x *bp)
941 struct sw_rx_bd *sw_bd = &fp->rx_buf_ring[j]; 937 struct sw_rx_bd *sw_bd = &fp->rx_buf_ring[j];
942 938
943 BNX2X_ERR("fp%d: rx_bd[%x]=[%x:%x] sw_bd=[%p]\n", 939 BNX2X_ERR("fp%d: rx_bd[%x]=[%x:%x] sw_bd=[%p]\n",
944 i, j, rx_bd[1], rx_bd[0], sw_bd->skb); 940 i, j, rx_bd[1], rx_bd[0], sw_bd->data);
945 } 941 }
946 942
947 start = RX_SGE(fp->rx_sge_prod); 943 start = RX_SGE(fp->rx_sge_prod);
@@ -4834,20 +4830,11 @@ void bnx2x_drv_pulse(struct bnx2x *bp)
4834 4830
4835static void bnx2x_timer(unsigned long data) 4831static void bnx2x_timer(unsigned long data)
4836{ 4832{
4837 u8 cos;
4838 struct bnx2x *bp = (struct bnx2x *) data; 4833 struct bnx2x *bp = (struct bnx2x *) data;
4839 4834
4840 if (!netif_running(bp->dev)) 4835 if (!netif_running(bp->dev))
4841 return; 4836 return;
4842 4837
4843 if (poll) {
4844 struct bnx2x_fastpath *fp = &bp->fp[0];
4845
4846 for_each_cos_in_tx_queue(fp, cos)
4847 bnx2x_tx_int(bp, &fp->txdata[cos]);
4848 bnx2x_rx_int(fp, 1000);
4849 }
4850
4851 if (!BP_NOMCP(bp)) { 4838 if (!BP_NOMCP(bp)) {
4852 int mb_idx = BP_FW_MB_IDX(bp); 4839 int mb_idx = BP_FW_MB_IDX(bp);
4853 u32 drv_pulse; 4840 u32 drv_pulse;
@@ -10063,7 +10050,6 @@ static void __devinit bnx2x_set_modes_bitmap(struct bnx2x *bp)
10063static int __devinit bnx2x_init_bp(struct bnx2x *bp) 10050static int __devinit bnx2x_init_bp(struct bnx2x *bp)
10064{ 10051{
10065 int func; 10052 int func;
10066 int timer_interval;
10067 int rc; 10053 int rc;
10068 10054
10069 mutex_init(&bp->port.phy_mutex); 10055 mutex_init(&bp->port.phy_mutex);
@@ -10139,8 +10125,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
10139 bp->tx_ticks = (50 / BNX2X_BTR) * BNX2X_BTR; 10125 bp->tx_ticks = (50 / BNX2X_BTR) * BNX2X_BTR;
10140 bp->rx_ticks = (25 / BNX2X_BTR) * BNX2X_BTR; 10126 bp->rx_ticks = (25 / BNX2X_BTR) * BNX2X_BTR;
10141 10127
10142 timer_interval = (CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ); 10128 bp->current_interval = CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ;
10143 bp->current_interval = (poll ? poll : timer_interval);
10144 10129
10145 init_timer(&bp->timer); 10130 init_timer(&bp->timer);
10146 bp->timer.expires = jiffies + bp->current_interval; 10131 bp->timer.expires = jiffies + bp->current_interval;
@@ -10536,6 +10521,9 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
10536{ 10521{
10537 struct bnx2x *bp; 10522 struct bnx2x *bp;
10538 int rc; 10523 int rc;
10524 bool chip_is_e1x = (board_type == BCM57710 ||
10525 board_type == BCM57711 ||
10526 board_type == BCM57711E);
10539 10527
10540 SET_NETDEV_DEV(dev, &pdev->dev); 10528 SET_NETDEV_DEV(dev, &pdev->dev);
10541 bp = netdev_priv(dev); 10529 bp = netdev_priv(dev);
@@ -10624,7 +10612,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
10624 REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0); 10612 REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0);
10625 REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0); 10613 REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0);
10626 10614
10627 if (CHIP_IS_E1x(bp)) { 10615 if (chip_is_e1x) {
10628 REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0); 10616 REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0);
10629 REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0); 10617 REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0);
10630 REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0); 10618 REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0);
@@ -10635,9 +10623,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
10635 * Enable internal target-read (in case we are probed after PF FLR). 10623 * Enable internal target-read (in case we are probed after PF FLR).
10636 * Must be done prior to any BAR read access. Only for 57712 and up 10624 * Must be done prior to any BAR read access. Only for 57712 and up
10637 */ 10625 */
10638 if (board_type != BCM57710 && 10626 if (!chip_is_e1x)
10639 board_type != BCM57711 &&
10640 board_type != BCM57711E)
10641 REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1); 10627 REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1);
10642 10628
10643 /* Reset the load counter */ 10629 /* Reset the load counter */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 5ac616093f9f..cb6339c35571 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -50,6 +50,7 @@ static inline void bnx2x_exe_queue_init(struct bnx2x *bp,
50 int exe_len, 50 int exe_len,
51 union bnx2x_qable_obj *owner, 51 union bnx2x_qable_obj *owner,
52 exe_q_validate validate, 52 exe_q_validate validate,
53 exe_q_remove remove,
53 exe_q_optimize optimize, 54 exe_q_optimize optimize,
54 exe_q_execute exec, 55 exe_q_execute exec,
55 exe_q_get get) 56 exe_q_get get)
@@ -66,6 +67,7 @@ static inline void bnx2x_exe_queue_init(struct bnx2x *bp,
66 67
67 /* Owner specific callbacks */ 68 /* Owner specific callbacks */
68 o->validate = validate; 69 o->validate = validate;
70 o->remove = remove;
69 o->optimize = optimize; 71 o->optimize = optimize;
70 o->execute = exec; 72 o->execute = exec;
71 o->get = get; 73 o->get = get;
@@ -1340,6 +1342,35 @@ static int bnx2x_validate_vlan_mac(struct bnx2x *bp,
1340 } 1342 }
1341} 1343}
1342 1344
1345static int bnx2x_remove_vlan_mac(struct bnx2x *bp,
1346 union bnx2x_qable_obj *qo,
1347 struct bnx2x_exeq_elem *elem)
1348{
1349 int rc = 0;
1350
1351 /* If consumption wasn't required, nothing to do */
1352 if (test_bit(BNX2X_DONT_CONSUME_CAM_CREDIT,
1353 &elem->cmd_data.vlan_mac.vlan_mac_flags))
1354 return 0;
1355
1356 switch (elem->cmd_data.vlan_mac.cmd) {
1357 case BNX2X_VLAN_MAC_ADD:
1358 case BNX2X_VLAN_MAC_MOVE:
1359 rc = qo->vlan_mac.put_credit(&qo->vlan_mac);
1360 break;
1361 case BNX2X_VLAN_MAC_DEL:
1362 rc = qo->vlan_mac.get_credit(&qo->vlan_mac);
1363 break;
1364 default:
1365 return -EINVAL;
1366 }
1367
1368 if (rc != true)
1369 return -EINVAL;
1370
1371 return 0;
1372}
1373
1343/** 1374/**
1344 * bnx2x_wait_vlan_mac - passivly wait for 5 seconds until all work completes. 1375 * bnx2x_wait_vlan_mac - passivly wait for 5 seconds until all work completes.
1345 * 1376 *
@@ -1801,8 +1832,14 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp,
1801 1832
1802 list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) { 1833 list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) {
1803 if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags == 1834 if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags ==
1804 *vlan_mac_flags) 1835 *vlan_mac_flags) {
1836 rc = exeq->remove(bp, exeq->owner, exeq_pos);
1837 if (rc) {
1838 BNX2X_ERR("Failed to remove command\n");
1839 return rc;
1840 }
1805 list_del(&exeq_pos->link); 1841 list_del(&exeq_pos->link);
1842 }
1806 } 1843 }
1807 1844
1808 spin_unlock_bh(&exeq->lock); 1845 spin_unlock_bh(&exeq->lock);
@@ -1908,6 +1945,7 @@ void bnx2x_init_mac_obj(struct bnx2x *bp,
1908 bnx2x_exe_queue_init(bp, 1945 bnx2x_exe_queue_init(bp,
1909 &mac_obj->exe_queue, 1, qable_obj, 1946 &mac_obj->exe_queue, 1, qable_obj,
1910 bnx2x_validate_vlan_mac, 1947 bnx2x_validate_vlan_mac,
1948 bnx2x_remove_vlan_mac,
1911 bnx2x_optimize_vlan_mac, 1949 bnx2x_optimize_vlan_mac,
1912 bnx2x_execute_vlan_mac, 1950 bnx2x_execute_vlan_mac,
1913 bnx2x_exeq_get_mac); 1951 bnx2x_exeq_get_mac);
@@ -1924,6 +1962,7 @@ void bnx2x_init_mac_obj(struct bnx2x *bp,
1924 bnx2x_exe_queue_init(bp, 1962 bnx2x_exe_queue_init(bp,
1925 &mac_obj->exe_queue, CLASSIFY_RULES_COUNT, 1963 &mac_obj->exe_queue, CLASSIFY_RULES_COUNT,
1926 qable_obj, bnx2x_validate_vlan_mac, 1964 qable_obj, bnx2x_validate_vlan_mac,
1965 bnx2x_remove_vlan_mac,
1927 bnx2x_optimize_vlan_mac, 1966 bnx2x_optimize_vlan_mac,
1928 bnx2x_execute_vlan_mac, 1967 bnx2x_execute_vlan_mac,
1929 bnx2x_exeq_get_mac); 1968 bnx2x_exeq_get_mac);
@@ -1963,6 +2002,7 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp,
1963 bnx2x_exe_queue_init(bp, 2002 bnx2x_exe_queue_init(bp,
1964 &vlan_obj->exe_queue, CLASSIFY_RULES_COUNT, 2003 &vlan_obj->exe_queue, CLASSIFY_RULES_COUNT,
1965 qable_obj, bnx2x_validate_vlan_mac, 2004 qable_obj, bnx2x_validate_vlan_mac,
2005 bnx2x_remove_vlan_mac,
1966 bnx2x_optimize_vlan_mac, 2006 bnx2x_optimize_vlan_mac,
1967 bnx2x_execute_vlan_mac, 2007 bnx2x_execute_vlan_mac,
1968 bnx2x_exeq_get_vlan); 2008 bnx2x_exeq_get_vlan);
@@ -2009,6 +2049,7 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
2009 bnx2x_exe_queue_init(bp, 2049 bnx2x_exe_queue_init(bp,
2010 &vlan_mac_obj->exe_queue, 1, qable_obj, 2050 &vlan_mac_obj->exe_queue, 1, qable_obj,
2011 bnx2x_validate_vlan_mac, 2051 bnx2x_validate_vlan_mac,
2052 bnx2x_remove_vlan_mac,
2012 bnx2x_optimize_vlan_mac, 2053 bnx2x_optimize_vlan_mac,
2013 bnx2x_execute_vlan_mac, 2054 bnx2x_execute_vlan_mac,
2014 bnx2x_exeq_get_vlan_mac); 2055 bnx2x_exeq_get_vlan_mac);
@@ -2025,6 +2066,7 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
2025 &vlan_mac_obj->exe_queue, 2066 &vlan_mac_obj->exe_queue,
2026 CLASSIFY_RULES_COUNT, 2067 CLASSIFY_RULES_COUNT,
2027 qable_obj, bnx2x_validate_vlan_mac, 2068 qable_obj, bnx2x_validate_vlan_mac,
2069 bnx2x_remove_vlan_mac,
2028 bnx2x_optimize_vlan_mac, 2070 bnx2x_optimize_vlan_mac,
2029 bnx2x_execute_vlan_mac, 2071 bnx2x_execute_vlan_mac,
2030 bnx2x_exeq_get_vlan_mac); 2072 bnx2x_exeq_get_vlan_mac);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
index 992308ff82e8..66da39f0c84a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
@@ -161,6 +161,10 @@ typedef int (*exe_q_validate)(struct bnx2x *bp,
161 union bnx2x_qable_obj *o, 161 union bnx2x_qable_obj *o,
162 struct bnx2x_exeq_elem *elem); 162 struct bnx2x_exeq_elem *elem);
163 163
164typedef int (*exe_q_remove)(struct bnx2x *bp,
165 union bnx2x_qable_obj *o,
166 struct bnx2x_exeq_elem *elem);
167
164/** 168/**
165 * @return positive is entry was optimized, 0 - if not, negative 169 * @return positive is entry was optimized, 0 - if not, negative
166 * in case of an error. 170 * in case of an error.
@@ -203,11 +207,18 @@ struct bnx2x_exe_queue_obj {
203 */ 207 */
204 exe_q_validate validate; 208 exe_q_validate validate;
205 209
210 /**
211 * Called before removing pending commands, cleaning allocated
212 * resources (e.g., credits from validate)
213 */
214 exe_q_remove remove;
206 215
207 /** 216 /**
208 * This will try to cancel the current pending commands list 217 * This will try to cancel the current pending commands list
209 * considering the new command. 218 * considering the new command.
210 * 219 *
220 * Returns the number of optimized commands or a negative error code
221 *
211 * Must run under exe_queue->lock 222 * Must run under exe_queue->lock
212 */ 223 */
213 exe_q_optimize optimize; 224 exe_q_optimize optimize;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index bc0121ac291e..1adef266fcd5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1081,17 +1081,17 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
1081 estats->rx_stat_ifhcinbadoctets_lo); 1081 estats->rx_stat_ifhcinbadoctets_lo);
1082 1082
1083 ADD_64(fstats->total_bytes_received_hi, 1083 ADD_64(fstats->total_bytes_received_hi,
1084 tfunc->rcv_error_bytes.hi, 1084 le32_to_cpu(tfunc->rcv_error_bytes.hi),
1085 fstats->total_bytes_received_lo, 1085 fstats->total_bytes_received_lo,
1086 tfunc->rcv_error_bytes.lo); 1086 le32_to_cpu(tfunc->rcv_error_bytes.lo));
1087 1087
1088 memcpy(estats, &(fstats->total_bytes_received_hi), 1088 memcpy(estats, &(fstats->total_bytes_received_hi),
1089 sizeof(struct host_func_stats) - 2*sizeof(u32)); 1089 sizeof(struct host_func_stats) - 2*sizeof(u32));
1090 1090
1091 ADD_64(estats->error_bytes_received_hi, 1091 ADD_64(estats->error_bytes_received_hi,
1092 tfunc->rcv_error_bytes.hi, 1092 le32_to_cpu(tfunc->rcv_error_bytes.hi),
1093 estats->error_bytes_received_lo, 1093 estats->error_bytes_received_lo,
1094 tfunc->rcv_error_bytes.lo); 1094 le32_to_cpu(tfunc->rcv_error_bytes.lo));
1095 1095
1096 ADD_64(estats->etherstatsoverrsizepkts_hi, 1096 ADD_64(estats->etherstatsoverrsizepkts_hi,
1097 estats->rx_stat_dot3statsframestoolong_hi, 1097 estats->rx_stat_dot3statsframestoolong_hi,
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d529af99157d..a1f2e0fed78b 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6667,14 +6667,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
6667 iph = ip_hdr(skb); 6667 iph = ip_hdr(skb);
6668 tcp_opt_len = tcp_optlen(skb); 6668 tcp_opt_len = tcp_optlen(skb);
6669 6669
6670 if (skb_is_gso_v6(skb)) { 6670 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN;
6671 hdr_len = skb_headlen(skb) - ETH_HLEN;
6672 } else {
6673 u32 ip_tcp_len;
6674
6675 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
6676 hdr_len = ip_tcp_len + tcp_opt_len;
6677 6671
6672 if (!skb_is_gso_v6(skb)) {
6678 iph->check = 0; 6673 iph->check = 0;
6679 iph->tot_len = htons(mss + hdr_len); 6674 iph->tot_len = htons(mss + hdr_len);
6680 } 6675 }
diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
index 9b44ec8096ba..803ea32aa99d 100644
--- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
+++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
@@ -946,7 +946,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
946 946
947 flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL); 947 flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL);
948 if (!flash_attr) 948 if (!flash_attr)
949 return -ENOMEM; 949 return 0;
950 950
951 fcomp.bnad = bnad; 951 fcomp.bnad = bnad;
952 fcomp.comp_status = 0; 952 fcomp.comp_status = 0;
@@ -958,7 +958,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
958 if (ret != BFA_STATUS_OK) { 958 if (ret != BFA_STATUS_OK) {
959 spin_unlock_irqrestore(&bnad->bna_lock, flags); 959 spin_unlock_irqrestore(&bnad->bna_lock, flags);
960 kfree(flash_attr); 960 kfree(flash_attr);
961 goto out_err; 961 return 0;
962 } 962 }
963 spin_unlock_irqrestore(&bnad->bna_lock, flags); 963 spin_unlock_irqrestore(&bnad->bna_lock, flags);
964 wait_for_completion(&fcomp.comp); 964 wait_for_completion(&fcomp.comp);
@@ -978,8 +978,6 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
978 } 978 }
979 kfree(flash_attr); 979 kfree(flash_attr);
980 return flash_part; 980 return flash_part;
981out_err:
982 return -EINVAL;
983} 981}
984 982
985static int 983static int
@@ -1006,7 +1004,7 @@ bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
1006 /* Query the flash partition based on the offset */ 1004 /* Query the flash partition based on the offset */
1007 flash_part = bnad_get_flash_partition_by_offset(bnad, 1005 flash_part = bnad_get_flash_partition_by_offset(bnad,
1008 eeprom->offset, &base_offset); 1006 eeprom->offset, &base_offset);
1009 if (flash_part <= 0) 1007 if (flash_part == 0)
1010 return -EFAULT; 1008 return -EFAULT;
1011 1009
1012 fcomp.bnad = bnad; 1010 fcomp.bnad = bnad;
@@ -1048,7 +1046,7 @@ bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
1048 /* Query the flash partition based on the offset */ 1046 /* Query the flash partition based on the offset */
1049 flash_part = bnad_get_flash_partition_by_offset(bnad, 1047 flash_part = bnad_get_flash_partition_by_offset(bnad,
1050 eeprom->offset, &base_offset); 1048 eeprom->offset, &base_offset);
1051 if (flash_part <= 0) 1049 if (flash_part == 0)
1052 return -EFAULT; 1050 return -EFAULT;
1053 1051
1054 fcomp.bnad = bnad; 1052 fcomp.bnad = bnad;
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index fe0c29acdbe6..ee93a2087fe6 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -32,7 +32,7 @@
32 32
33#define DRV_NAME "enic" 33#define DRV_NAME "enic"
34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" 34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
35#define DRV_VERSION "2.1.1.28" 35#define DRV_VERSION "2.1.1.31"
36#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" 36#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"
37 37
38#define ENIC_BARS_MAX 6 38#define ENIC_BARS_MAX 6
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 2fd9db4b1be5..ab3f67f980d8 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -57,11 +57,13 @@
57 57
58#define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043 /* ethernet vnic */ 58#define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043 /* ethernet vnic */
59#define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic */ 59#define PCI_DEVICE_ID_CISCO_VIC_ENET_DYN 0x0044 /* enet dynamic vnic */
60#define PCI_DEVICE_ID_CISCO_VIC_ENET_VF 0x0071 /* enet SRIOV VF */
60 61
61/* Supported devices */ 62/* Supported devices */
62static DEFINE_PCI_DEVICE_TABLE(enic_id_table) = { 63static DEFINE_PCI_DEVICE_TABLE(enic_id_table) = {
63 { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET) }, 64 { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET) },
64 { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_DYN) }, 65 { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_DYN) },
66 { PCI_VDEVICE(CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF) },
65 { 0, } /* end of table */ 67 { 0, } /* end of table */
66}; 68};
67 69
@@ -132,6 +134,11 @@ int enic_sriov_enabled(struct enic *enic)
132 return (enic->priv_flags & ENIC_SRIOV_ENABLED) ? 1 : 0; 134 return (enic->priv_flags & ENIC_SRIOV_ENABLED) ? 1 : 0;
133} 135}
134 136
137static int enic_is_sriov_vf(struct enic *enic)
138{
139 return enic->pdev->device == PCI_DEVICE_ID_CISCO_VIC_ENET_VF;
140}
141
135int enic_is_valid_vf(struct enic *enic, int vf) 142int enic_is_valid_vf(struct enic *enic, int vf)
136{ 143{
137#ifdef CONFIG_PCI_IOV 144#ifdef CONFIG_PCI_IOV
@@ -437,7 +444,7 @@ static void enic_mtu_check(struct enic *enic)
437 444
438 if (mtu && mtu != enic->port_mtu) { 445 if (mtu && mtu != enic->port_mtu) {
439 enic->port_mtu = mtu; 446 enic->port_mtu = mtu;
440 if (enic_is_dynamic(enic)) { 447 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) {
441 mtu = max_t(int, ENIC_MIN_MTU, 448 mtu = max_t(int, ENIC_MIN_MTU,
442 min_t(int, ENIC_MAX_MTU, mtu)); 449 min_t(int, ENIC_MAX_MTU, mtu));
443 if (mtu != netdev->mtu) 450 if (mtu != netdev->mtu)
@@ -849,7 +856,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr)
849{ 856{
850 struct enic *enic = netdev_priv(netdev); 857 struct enic *enic = netdev_priv(netdev);
851 858
852 if (enic_is_dynamic(enic)) { 859 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) {
853 if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr)) 860 if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr))
854 return -EADDRNOTAVAIL; 861 return -EADDRNOTAVAIL;
855 } else { 862 } else {
@@ -1608,7 +1615,7 @@ static int enic_open(struct net_device *netdev)
1608 for (i = 0; i < enic->rq_count; i++) 1615 for (i = 0; i < enic->rq_count; i++)
1609 vnic_rq_enable(&enic->rq[i]); 1616 vnic_rq_enable(&enic->rq[i]);
1610 1617
1611 if (!enic_is_dynamic(enic)) 1618 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
1612 enic_dev_add_station_addr(enic); 1619 enic_dev_add_station_addr(enic);
1613 1620
1614 enic_set_rx_mode(netdev); 1621 enic_set_rx_mode(netdev);
@@ -1659,7 +1666,7 @@ static int enic_stop(struct net_device *netdev)
1659 netif_carrier_off(netdev); 1666 netif_carrier_off(netdev);
1660 netif_tx_disable(netdev); 1667 netif_tx_disable(netdev);
1661 1668
1662 if (!enic_is_dynamic(enic)) 1669 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
1663 enic_dev_del_station_addr(enic); 1670 enic_dev_del_station_addr(enic);
1664 1671
1665 for (i = 0; i < enic->wq_count; i++) { 1672 for (i = 0; i < enic->wq_count; i++) {
@@ -1696,7 +1703,7 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)
1696 if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) 1703 if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU)
1697 return -EINVAL; 1704 return -EINVAL;
1698 1705
1699 if (enic_is_dynamic(enic)) 1706 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
1700 return -EOPNOTSUPP; 1707 return -EOPNOTSUPP;
1701 1708
1702 if (running) 1709 if (running)
@@ -2263,10 +2270,10 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2263 int using_dac = 0; 2270 int using_dac = 0;
2264 unsigned int i; 2271 unsigned int i;
2265 int err; 2272 int err;
2266 int num_pps = 1;
2267#ifdef CONFIG_PCI_IOV 2273#ifdef CONFIG_PCI_IOV
2268 int pos = 0; 2274 int pos = 0;
2269#endif 2275#endif
2276 int num_pps = 1;
2270 2277
2271 /* Allocate net device structure and initialize. Private 2278 /* Allocate net device structure and initialize. Private
2272 * instance data is initialized to zero. 2279 * instance data is initialized to zero.
@@ -2376,14 +2383,14 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2376 num_pps = enic->num_vfs; 2383 num_pps = enic->num_vfs;
2377 } 2384 }
2378 } 2385 }
2379
2380#endif 2386#endif
2387
2381 /* Allocate structure for port profiles */ 2388 /* Allocate structure for port profiles */
2382 enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL); 2389 enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL);
2383 if (!enic->pp) { 2390 if (!enic->pp) {
2384 pr_err("port profile alloc failed, aborting\n"); 2391 pr_err("port profile alloc failed, aborting\n");
2385 err = -ENOMEM; 2392 err = -ENOMEM;
2386 goto err_out_disable_sriov; 2393 goto err_out_disable_sriov_pp;
2387 } 2394 }
2388 2395
2389 /* Issue device open to get device in known state 2396 /* Issue device open to get device in known state
@@ -2392,7 +2399,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2392 err = enic_dev_open(enic); 2399 err = enic_dev_open(enic);
2393 if (err) { 2400 if (err) {
2394 dev_err(dev, "vNIC dev open failed, aborting\n"); 2401 dev_err(dev, "vNIC dev open failed, aborting\n");
2395 goto err_out_free_pp; 2402 goto err_out_disable_sriov;
2396 } 2403 }
2397 2404
2398 /* Setup devcmd lock 2405 /* Setup devcmd lock
@@ -2426,7 +2433,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2426 * called later by an upper layer. 2433 * called later by an upper layer.
2427 */ 2434 */
2428 2435
2429 if (!enic_is_dynamic(enic)) { 2436 if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) {
2430 err = vnic_dev_init(enic->vdev, 0); 2437 err = vnic_dev_init(enic->vdev, 0);
2431 if (err) { 2438 if (err) {
2432 dev_err(dev, "vNIC dev init failed, aborting\n"); 2439 dev_err(dev, "vNIC dev init failed, aborting\n");
@@ -2460,8 +2467,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2460 (void)enic_change_mtu(netdev, enic->port_mtu); 2467 (void)enic_change_mtu(netdev, enic->port_mtu);
2461 2468
2462#ifdef CONFIG_PCI_IOV 2469#ifdef CONFIG_PCI_IOV
2463 if (enic_is_dynamic(enic) && pdev->is_virtfn && 2470 if (enic_is_sriov_vf(enic) && is_zero_ether_addr(enic->mac_addr))
2464 is_zero_ether_addr(enic->mac_addr))
2465 random_ether_addr(enic->mac_addr); 2471 random_ether_addr(enic->mac_addr);
2466#endif 2472#endif
2467 2473
@@ -2474,7 +2480,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2474 enic->tx_coalesce_usecs = enic->config.intr_timer_usec; 2480 enic->tx_coalesce_usecs = enic->config.intr_timer_usec;
2475 enic->rx_coalesce_usecs = enic->tx_coalesce_usecs; 2481 enic->rx_coalesce_usecs = enic->tx_coalesce_usecs;
2476 2482
2477 if (enic_is_dynamic(enic)) 2483 if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
2478 netdev->netdev_ops = &enic_netdev_dynamic_ops; 2484 netdev->netdev_ops = &enic_netdev_dynamic_ops;
2479 else 2485 else
2480 netdev->netdev_ops = &enic_netdev_ops; 2486 netdev->netdev_ops = &enic_netdev_ops;
@@ -2516,17 +2522,17 @@ err_out_dev_deinit:
2516 enic_dev_deinit(enic); 2522 enic_dev_deinit(enic);
2517err_out_dev_close: 2523err_out_dev_close:
2518 vnic_dev_close(enic->vdev); 2524 vnic_dev_close(enic->vdev);
2519err_out_free_pp:
2520 kfree(enic->pp);
2521err_out_disable_sriov: 2525err_out_disable_sriov:
2526 kfree(enic->pp);
2527err_out_disable_sriov_pp:
2522#ifdef CONFIG_PCI_IOV 2528#ifdef CONFIG_PCI_IOV
2523 if (enic_sriov_enabled(enic)) { 2529 if (enic_sriov_enabled(enic)) {
2524 pci_disable_sriov(pdev); 2530 pci_disable_sriov(pdev);
2525 enic->priv_flags &= ~ENIC_SRIOV_ENABLED; 2531 enic->priv_flags &= ~ENIC_SRIOV_ENABLED;
2526 } 2532 }
2527err_out_vnic_unregister: 2533err_out_vnic_unregister:
2528 vnic_dev_unregister(enic->vdev);
2529#endif 2534#endif
2535 vnic_dev_unregister(enic->vdev);
2530err_out_iounmap: 2536err_out_iounmap:
2531 enic_iounmap(enic); 2537 enic_iounmap(enic);
2532err_out_release_regions: 2538err_out_release_regions:
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 6db6b6ae5e9b..802e5ddef8a8 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -716,12 +716,8 @@ static int
716be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) 716be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
717{ 717{
718 struct be_adapter *adapter = netdev_priv(netdev); 718 struct be_adapter *adapter = netdev_priv(netdev);
719 char file_name[ETHTOOL_FLASH_MAX_FILENAME];
720 719
721 file_name[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0; 720 return be_load_fw(adapter, efl->data);
722 strcpy(file_name, efl->data);
723
724 return be_load_fw(adapter, file_name);
725} 721}
726 722
727static int 723static int
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index a6bcdb5cd2be..e703d64434f8 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1786,8 +1786,7 @@ static void be_rx_queues_destroy(struct be_adapter *adapter)
1786static u32 be_num_rxqs_want(struct be_adapter *adapter) 1786static u32 be_num_rxqs_want(struct be_adapter *adapter)
1787{ 1787{
1788 if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) && 1788 if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) &&
1789 !sriov_enabled(adapter) && be_physfn(adapter) && 1789 !sriov_enabled(adapter) && be_physfn(adapter)) {
1790 !be_is_mc(adapter)) {
1791 return 1 + MAX_RSS_QS; /* one default non-RSS queue */ 1790 return 1 + MAX_RSS_QS; /* one default non-RSS queue */
1792 } else { 1791 } else {
1793 dev_warn(&adapter->pdev->dev, 1792 dev_warn(&adapter->pdev->dev,
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index fb5579a3b19d..47f85c337cf7 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -25,6 +25,7 @@
25#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
26#include <linux/ethtool.h> 26#include <linux/ethtool.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/interrupt.h>
28#include <linux/io.h> 29#include <linux/io.h>
29#include <linux/module.h> 30#include <linux/module.h>
30#include <linux/netdevice.h> 31#include <linux/netdevice.h>
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
index a127cb2476c7..bb336a0959c9 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -25,6 +25,7 @@
25#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
26#include <linux/ethtool.h> 26#include <linux/ethtool.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/interrupt.h>
28#include <linux/io.h> 29#include <linux/io.h>
29#include <linux/mii.h> 30#include <linux/mii.h>
30#include <linux/module.h> 31#include <linux/module.h>
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 7b25e9cf13f6..e92ef1bd732a 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -986,11 +986,11 @@ static int fec_enet_mii_probe(struct net_device *ndev)
986 printk(KERN_INFO 986 printk(KERN_INFO
987 "%s: no PHY, assuming direct connection to switch\n", 987 "%s: no PHY, assuming direct connection to switch\n",
988 ndev->name); 988 ndev->name);
989 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); 989 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
990 phy_id = 0; 990 phy_id = 0;
991 } 991 }
992 992
993 snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); 993 snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
994 phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0, 994 phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0,
995 fep->phy_interface); 995 fep->phy_interface);
996 if (IS_ERR(phy_dev)) { 996 if (IS_ERR(phy_dev)) {
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 669ca3800c01..d94d64b5d695 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -4740,12 +4740,14 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4740 e1000_setup_rctl(adapter); 4740 e1000_setup_rctl(adapter);
4741 e1000_set_rx_mode(netdev); 4741 e1000_set_rx_mode(netdev);
4742 4742
4743 rctl = er32(RCTL);
4744
4743 /* turn on all-multi mode if wake on multicast is enabled */ 4745 /* turn on all-multi mode if wake on multicast is enabled */
4744 if (wufc & E1000_WUFC_MC) { 4746 if (wufc & E1000_WUFC_MC)
4745 rctl = er32(RCTL);
4746 rctl |= E1000_RCTL_MPE; 4747 rctl |= E1000_RCTL_MPE;
4747 ew32(RCTL, rctl); 4748
4748 } 4749 /* enable receives in the hardware */
4750 ew32(RCTL, rctl | E1000_RCTL_EN);
4749 4751
4750 if (hw->mac_type >= e1000_82540) { 4752 if (hw->mac_type >= e1000_82540) {
4751 ctrl = er32(CTRL); 4753 ctrl = er32(CTRL);
diff --git a/drivers/net/ethernet/intel/igb/Makefile b/drivers/net/ethernet/intel/igb/Makefile
index c6e4621b6262..6565c463185c 100644
--- a/drivers/net/ethernet/intel/igb/Makefile
+++ b/drivers/net/ethernet/intel/igb/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# Intel 82575 PCI-Express Ethernet Linux driver 3# Intel 82575 PCI-Express Ethernet Linux driver
4# Copyright(c) 1999 - 2011 Intel Corporation. 4# Copyright(c) 1999 - 2012 Intel Corporation.
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms and conditions of the GNU General Public License, 7# under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index b8e20f037d0a..08bdc33715ee 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
index 08a757eb6608..b927d79ab536 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.h
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
index f5fc5725ea94..aed217449f0d 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
index 4519a1367170..f67cbd3fa307 100644
--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c
index 73aac082c44d..f57338afd71f 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mac.c
+++ b/drivers/net/ethernet/intel/igb/e1000_mac.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -151,7 +151,7 @@ void igb_clear_vfta_i350(struct e1000_hw *hw)
151 * Writes value at the given offset in the register array which stores 151 * Writes value at the given offset in the register array which stores
152 * the VLAN filter table. 152 * the VLAN filter table.
153 **/ 153 **/
154void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value) 154static void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)
155{ 155{
156 int i; 156 int i;
157 157
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.h b/drivers/net/ethernet/intel/igb/e1000_mac.h
index e45996b4ea34..cbddc4e51e30 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mac.h
+++ b/drivers/net/ethernet/intel/igb/e1000_mac.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_mbx.c b/drivers/net/ethernet/intel/igb/e1000_mbx.c
index 469d95eaa154..5988b8958baf 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mbx.c
+++ b/drivers/net/ethernet/intel/igb/e1000_mbx.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_mbx.h b/drivers/net/ethernet/intel/igb/e1000_mbx.h
index eddb0f83dcea..dbcfa3d5caec 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mbx.h
+++ b/drivers/net/ethernet/intel/igb/e1000_mbx.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_nvm.c b/drivers/net/ethernet/intel/igb/e1000_nvm.c
index 40407124e722..fa2c6ba62139 100644
--- a/drivers/net/ethernet/intel/igb/e1000_nvm.c
+++ b/drivers/net/ethernet/intel/igb/e1000_nvm.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_nvm.h b/drivers/net/ethernet/intel/igb/e1000_nvm.h
index a2a7ca9fa733..825b0228cac0 100644
--- a/drivers/net/ethernet/intel/igb/e1000_nvm.h
+++ b/drivers/net/ethernet/intel/igb/e1000_nvm.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2011 Intel Corporation. 4 Copyright(c) 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index b17d7c20f817..789de5b83aad 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h
index 8510797b9d81..4c32ac66ff39 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.h
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
index 0a860bc1198e..ccdf36d503fd 100644
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 3d12e67eebb4..8e33bdd33eea 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 7998bf4d5946..aa399a8a8f0d 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 01e5e89ef959..94be6c32fa7d 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) Gigabit Ethernet Linux driver 3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2011 Intel Corporation. 4 Copyright(c) 2007-2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -68,7 +68,7 @@ char igb_driver_name[] = "igb";
68char igb_driver_version[] = DRV_VERSION; 68char igb_driver_version[] = DRV_VERSION;
69static const char igb_driver_string[] = 69static const char igb_driver_string[] =
70 "Intel(R) Gigabit Ethernet Network Driver"; 70 "Intel(R) Gigabit Ethernet Network Driver";
71static const char igb_copyright[] = "Copyright (c) 2007-2011 Intel Corporation."; 71static const char igb_copyright[] = "Copyright (c) 2007-2012 Intel Corporation.";
72 72
73static const struct e1000_info *igb_info_tbl[] = { 73static const struct e1000_info *igb_info_tbl[] = {
74 [board_82575] = &e1000_82575_info, 74 [board_82575] = &e1000_82575_info,
@@ -4003,8 +4003,8 @@ set_itr_now:
4003 } 4003 }
4004} 4004}
4005 4005
4006void igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens, 4006static void igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens,
4007 u32 type_tucmd, u32 mss_l4len_idx) 4007 u32 type_tucmd, u32 mss_l4len_idx)
4008{ 4008{
4009 struct e1000_adv_tx_context_desc *context_desc; 4009 struct e1000_adv_tx_context_desc *context_desc;
4010 u16 i = tx_ring->next_to_use; 4010 u16 i = tx_ring->next_to_use;
@@ -5012,7 +5012,8 @@ static int igb_find_enabled_vfs(struct igb_adapter *adapter)
5012 vf_devfn = pdev->devfn + 0x80; 5012 vf_devfn = pdev->devfn + 0x80;
5013 pvfdev = pci_get_device(hw->vendor_id, device_id, NULL); 5013 pvfdev = pci_get_device(hw->vendor_id, device_id, NULL);
5014 while (pvfdev) { 5014 while (pvfdev) {
5015 if (pvfdev->devfn == vf_devfn) 5015 if (pvfdev->devfn == vf_devfn &&
5016 (pvfdev->bus->number >= pdev->bus->number))
5016 vfs_found++; 5017 vfs_found++;
5017 vf_devfn += vf_stride; 5018 vf_devfn += vf_stride;
5018 pvfdev = pci_get_device(hw->vendor_id, 5019 pvfdev = pci_get_device(hw->vendor_id,
@@ -5623,7 +5624,7 @@ static irqreturn_t igb_intr(int irq, void *data)
5623 return IRQ_HANDLED; 5624 return IRQ_HANDLED;
5624} 5625}
5625 5626
5626void igb_ring_irq_enable(struct igb_q_vector *q_vector) 5627static void igb_ring_irq_enable(struct igb_q_vector *q_vector)
5627{ 5628{
5628 struct igb_adapter *adapter = q_vector->adapter; 5629 struct igb_adapter *adapter = q_vector->adapter;
5629 struct e1000_hw *hw = &adapter->hw; 5630 struct e1000_hw *hw = &adapter->hw;
diff --git a/drivers/net/ethernet/intel/igbvf/Makefile b/drivers/net/ethernet/intel/igbvf/Makefile
index 0fa3db3dd8b6..044b0ad5fcb9 100644
--- a/drivers/net/ethernet/intel/igbvf/Makefile
+++ b/drivers/net/ethernet/intel/igbvf/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# Intel(R) 82576 Virtual Function Linux driver 3# Intel(R) 82576 Virtual Function Linux driver
4# Copyright(c) 2009 - 2010 Intel Corporation. 4# Copyright(c) 2009 - 2012 Intel Corporation.
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms and conditions of the GNU General Public License, 7# under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/defines.h b/drivers/net/ethernet/intel/igbvf/defines.h
index 79f2604673fe..33f40d3474ae 100644
--- a/drivers/net/ethernet/intel/igbvf/defines.h
+++ b/drivers/net/ethernet/intel/igbvf/defines.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 7b600a1f6366..db7dce2351c2 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -468,6 +468,5 @@ static const struct ethtool_ops igbvf_ethtool_ops = {
468 468
469void igbvf_set_ethtool_ops(struct net_device *netdev) 469void igbvf_set_ethtool_ops(struct net_device *netdev)
470{ 470{
471 /* have to "undeclare" const on this struct to remove warnings */ 471 SET_ETHTOOL_OPS(netdev, &igbvf_ethtool_ops);
472 SET_ETHTOOL_OPS(netdev, (struct ethtool_ops *)&igbvf_ethtool_ops);
473} 472}
diff --git a/drivers/net/ethernet/intel/igbvf/igbvf.h b/drivers/net/ethernet/intel/igbvf/igbvf.h
index fd4a7b780fdd..2c6d87e4d3d9 100644
--- a/drivers/net/ethernet/intel/igbvf/igbvf.h
+++ b/drivers/net/ethernet/intel/igbvf/igbvf.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/mbx.c b/drivers/net/ethernet/intel/igbvf/mbx.c
index 048aae248d06..b4b65bc9fc5d 100644
--- a/drivers/net/ethernet/intel/igbvf/mbx.c
+++ b/drivers/net/ethernet/intel/igbvf/mbx.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/mbx.h b/drivers/net/ethernet/intel/igbvf/mbx.h
index c2883c45d477..24370bcb0e22 100644
--- a/drivers/net/ethernet/intel/igbvf/mbx.h
+++ b/drivers/net/ethernet/intel/igbvf/mbx.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index fd3da3076c2f..4e9141cfe81d 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -53,7 +53,7 @@ const char igbvf_driver_version[] = DRV_VERSION;
53static const char igbvf_driver_string[] = 53static const char igbvf_driver_string[] =
54 "Intel(R) Gigabit Virtual Function Network Driver"; 54 "Intel(R) Gigabit Virtual Function Network Driver";
55static const char igbvf_copyright[] = 55static const char igbvf_copyright[] =
56 "Copyright (c) 2009 - 2011 Intel Corporation."; 56 "Copyright (c) 2009 - 2012 Intel Corporation.";
57 57
58static int igbvf_poll(struct napi_struct *napi, int budget); 58static int igbvf_poll(struct napi_struct *napi, int budget);
59static void igbvf_reset(struct igbvf_adapter *); 59static void igbvf_reset(struct igbvf_adapter *);
@@ -1194,11 +1194,6 @@ static int igbvf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1194 struct igbvf_adapter *adapter = netdev_priv(netdev); 1194 struct igbvf_adapter *adapter = netdev_priv(netdev);
1195 struct e1000_hw *hw = &adapter->hw; 1195 struct e1000_hw *hw = &adapter->hw;
1196 1196
1197 igbvf_irq_disable(adapter);
1198
1199 if (!test_bit(__IGBVF_DOWN, &adapter->state))
1200 igbvf_irq_enable(adapter);
1201
1202 if (hw->mac.ops.set_vfta(hw, vid, false)) { 1197 if (hw->mac.ops.set_vfta(hw, vid, false)) {
1203 dev_err(&adapter->pdev->dev, 1198 dev_err(&adapter->pdev->dev,
1204 "Failed to remove vlan id %d\n", vid); 1199 "Failed to remove vlan id %d\n", vid);
diff --git a/drivers/net/ethernet/intel/igbvf/regs.h b/drivers/net/ethernet/intel/igbvf/regs.h
index 77e18d3d6b15..7dc6341715dc 100644
--- a/drivers/net/ethernet/intel/igbvf/regs.h
+++ b/drivers/net/ethernet/intel/igbvf/regs.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c
index af3822f9ea9a..19551977b352 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.c
+++ b/drivers/net/ethernet/intel/igbvf/vf.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/igbvf/vf.h b/drivers/net/ethernet/intel/igbvf/vf.h
index d7ed58fcd9bb..57db3c68dfcd 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.h
+++ b/drivers/net/ethernet/intel/igbvf/vf.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel(R) 82576 Virtual Function Linux driver 3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 2009 - 2010 Intel Corporation. 4 Copyright(c) 2009 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile
index 7d7387fbdecd..7a16177a12a5 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# Intel 10 Gigabit PCI Express Linux driver 3# Intel 10 Gigabit PCI Express Linux driver
4# Copyright(c) 1999 - 2010 Intel Corporation. 4# Copyright(c) 1999 - 2012 Intel Corporation.
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms and conditions of the GNU General Public License, 7# under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 258164d6d45a..e6aeb64105a4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
index ef2afefb0cd4..b406c367b190 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index 772072147bea..4e59083a3de2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index a3aa6333073f..383b9413292e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
index 863f9c1f145b..2c834c46bba1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -75,7 +75,7 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw,
75s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); 75s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
76s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); 76s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
77s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); 77s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
78s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packtetbuf_num); 78s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num);
79s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw); 79s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw);
80 80
81s32 ixgbe_validate_mac_addr(u8 *mac_addr); 81s32 ixgbe_validate_mac_addr(u8 *mac_addr);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c
index 318caf4bf623..8bfaaee5ac5b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h
index e162775064da..24333b718166 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
index fcd0e479721f..d3695edfcb8b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.h
index 2f318935561a..ba835708fcac 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c
index 32cd97bc794d..888a419dc3d9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h
index a59d5dc59d04..4dec47faeb00 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index da31735311f1..79a92fe987b9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -112,6 +112,8 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev)
112static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) 112static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
113{ 113{
114 u8 err = 0; 114 u8 err = 0;
115 u8 prio_tc[MAX_USER_PRIORITY] = {0};
116 int i;
115 struct ixgbe_adapter *adapter = netdev_priv(netdev); 117 struct ixgbe_adapter *adapter = netdev_priv(netdev);
116 118
117 /* Fail command if not in CEE mode */ 119 /* Fail command if not in CEE mode */
@@ -122,10 +124,15 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
122 if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) 124 if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
123 return err; 125 return err;
124 126
125 if (state > 0) 127 if (state > 0) {
126 err = ixgbe_setup_tc(netdev, adapter->dcb_cfg.num_tcs.pg_tcs); 128 err = ixgbe_setup_tc(netdev, adapter->dcb_cfg.num_tcs.pg_tcs);
127 else 129 ixgbe_dcb_unpack_map(&adapter->dcb_cfg, DCB_TX_CONFIG, prio_tc);
130 } else {
128 err = ixgbe_setup_tc(netdev, 0); 131 err = ixgbe_setup_tc(netdev, 0);
132 }
133
134 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
135 netdev_set_prio_tc_map(netdev, i, prio_tc[i]);
129 136
130 return err; 137 return err;
131} 138}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index da7e580f517a..a62975480e37 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -58,7 +58,7 @@ struct ixgbe_stats {
58 sizeof(((struct rtnl_link_stats64 *)0)->m), \ 58 sizeof(((struct rtnl_link_stats64 *)0)->m), \
59 offsetof(struct rtnl_link_stats64, m) 59 offsetof(struct rtnl_link_stats64, m)
60 60
61static struct ixgbe_stats ixgbe_gstrings_stats[] = { 61static const struct ixgbe_stats ixgbe_gstrings_stats[] = {
62 {"rx_packets", IXGBE_NETDEV_STAT(rx_packets)}, 62 {"rx_packets", IXGBE_NETDEV_STAT(rx_packets)},
63 {"tx_packets", IXGBE_NETDEV_STAT(tx_packets)}, 63 {"tx_packets", IXGBE_NETDEV_STAT(tx_packets)},
64 {"rx_bytes", IXGBE_NETDEV_STAT(rx_bytes)}, 64 {"rx_bytes", IXGBE_NETDEV_STAT(rx_bytes)},
@@ -120,19 +120,23 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = {
120#endif /* IXGBE_FCOE */ 120#endif /* IXGBE_FCOE */
121}; 121};
122 122
123#define IXGBE_QUEUE_STATS_LEN \ 123/* ixgbe allocates num_tx_queues and num_rx_queues symmetrically so
124 ((((struct ixgbe_adapter *)netdev_priv(netdev))->num_tx_queues + \ 124 * we set the num_rx_queues to evaluate to num_tx_queues. This is
125 ((struct ixgbe_adapter *)netdev_priv(netdev))->num_rx_queues) * \ 125 * used because we do not have a good way to get the max number of
126 * rx queues with CONFIG_RPS disabled.
127 */
128#define IXGBE_NUM_RX_QUEUES netdev->num_tx_queues
129
130#define IXGBE_QUEUE_STATS_LEN ( \
131 (netdev->num_tx_queues + IXGBE_NUM_RX_QUEUES) * \
126 (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) 132 (sizeof(struct ixgbe_queue_stats) / sizeof(u64)))
127#define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats) 133#define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats)
128#define IXGBE_PB_STATS_LEN ( \ 134#define IXGBE_PB_STATS_LEN ( \
129 (((struct ixgbe_adapter *)netdev_priv(netdev))->flags & \ 135 (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \
130 IXGBE_FLAG_DCB_ENABLED) ? \ 136 sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \
131 (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \ 137 sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \
132 sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \ 138 sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \
133 sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \ 139 / sizeof(u64))
134 sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \
135 / sizeof(u64) : 0)
136#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + \ 140#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + \
137 IXGBE_PB_STATS_LEN + \ 141 IXGBE_PB_STATS_LEN + \
138 IXGBE_QUEUE_STATS_LEN) 142 IXGBE_QUEUE_STATS_LEN)
@@ -1078,8 +1082,15 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
1078 data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == 1082 data[i] = (ixgbe_gstrings_stats[i].sizeof_stat ==
1079 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 1083 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
1080 } 1084 }
1081 for (j = 0; j < adapter->num_tx_queues; j++) { 1085 for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) {
1082 ring = adapter->tx_ring[j]; 1086 ring = adapter->tx_ring[j];
1087 if (!ring) {
1088 data[i] = 0;
1089 data[i+1] = 0;
1090 i += 2;
1091 continue;
1092 }
1093
1083 do { 1094 do {
1084 start = u64_stats_fetch_begin_bh(&ring->syncp); 1095 start = u64_stats_fetch_begin_bh(&ring->syncp);
1085 data[i] = ring->stats.packets; 1096 data[i] = ring->stats.packets;
@@ -1087,8 +1098,15 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
1087 } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); 1098 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1088 i += 2; 1099 i += 2;
1089 } 1100 }
1090 for (j = 0; j < adapter->num_rx_queues; j++) { 1101 for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) {
1091 ring = adapter->rx_ring[j]; 1102 ring = adapter->rx_ring[j];
1103 if (!ring) {
1104 data[i] = 0;
1105 data[i+1] = 0;
1106 i += 2;
1107 continue;
1108 }
1109
1092 do { 1110 do {
1093 start = u64_stats_fetch_begin_bh(&ring->syncp); 1111 start = u64_stats_fetch_begin_bh(&ring->syncp);
1094 data[i] = ring->stats.packets; 1112 data[i] = ring->stats.packets;
@@ -1096,22 +1114,20 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
1096 } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); 1114 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1097 i += 2; 1115 i += 2;
1098 } 1116 }
1099 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 1117
1100 for (j = 0; j < MAX_TX_PACKET_BUFFERS; j++) { 1118 for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
1101 data[i++] = adapter->stats.pxontxc[j]; 1119 data[i++] = adapter->stats.pxontxc[j];
1102 data[i++] = adapter->stats.pxofftxc[j]; 1120 data[i++] = adapter->stats.pxofftxc[j];
1103 } 1121 }
1104 for (j = 0; j < MAX_RX_PACKET_BUFFERS; j++) { 1122 for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
1105 data[i++] = adapter->stats.pxonrxc[j]; 1123 data[i++] = adapter->stats.pxonrxc[j];
1106 data[i++] = adapter->stats.pxoffrxc[j]; 1124 data[i++] = adapter->stats.pxoffrxc[j];
1107 }
1108 } 1125 }
1109} 1126}
1110 1127
1111static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, 1128static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
1112 u8 *data) 1129 u8 *data)
1113{ 1130{
1114 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1115 char *p = (char *)data; 1131 char *p = (char *)data;
1116 int i; 1132 int i;
1117 1133
@@ -1126,31 +1142,29 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
1126 ETH_GSTRING_LEN); 1142 ETH_GSTRING_LEN);
1127 p += ETH_GSTRING_LEN; 1143 p += ETH_GSTRING_LEN;
1128 } 1144 }
1129 for (i = 0; i < adapter->num_tx_queues; i++) { 1145 for (i = 0; i < netdev->num_tx_queues; i++) {
1130 sprintf(p, "tx_queue_%u_packets", i); 1146 sprintf(p, "tx_queue_%u_packets", i);
1131 p += ETH_GSTRING_LEN; 1147 p += ETH_GSTRING_LEN;
1132 sprintf(p, "tx_queue_%u_bytes", i); 1148 sprintf(p, "tx_queue_%u_bytes", i);
1133 p += ETH_GSTRING_LEN; 1149 p += ETH_GSTRING_LEN;
1134 } 1150 }
1135 for (i = 0; i < adapter->num_rx_queues; i++) { 1151 for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) {
1136 sprintf(p, "rx_queue_%u_packets", i); 1152 sprintf(p, "rx_queue_%u_packets", i);
1137 p += ETH_GSTRING_LEN; 1153 p += ETH_GSTRING_LEN;
1138 sprintf(p, "rx_queue_%u_bytes", i); 1154 sprintf(p, "rx_queue_%u_bytes", i);
1139 p += ETH_GSTRING_LEN; 1155 p += ETH_GSTRING_LEN;
1140 } 1156 }
1141 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 1157 for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
1142 for (i = 0; i < MAX_TX_PACKET_BUFFERS; i++) { 1158 sprintf(p, "tx_pb_%u_pxon", i);
1143 sprintf(p, "tx_pb_%u_pxon", i); 1159 p += ETH_GSTRING_LEN;
1144 p += ETH_GSTRING_LEN; 1160 sprintf(p, "tx_pb_%u_pxoff", i);
1145 sprintf(p, "tx_pb_%u_pxoff", i); 1161 p += ETH_GSTRING_LEN;
1146 p += ETH_GSTRING_LEN; 1162 }
1147 } 1163 for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
1148 for (i = 0; i < MAX_RX_PACKET_BUFFERS; i++) { 1164 sprintf(p, "rx_pb_%u_pxon", i);
1149 sprintf(p, "rx_pb_%u_pxon", i); 1165 p += ETH_GSTRING_LEN;
1150 p += ETH_GSTRING_LEN; 1166 sprintf(p, "rx_pb_%u_pxoff", i);
1151 sprintf(p, "rx_pb_%u_pxoff", i); 1167 p += ETH_GSTRING_LEN;
1152 p += ETH_GSTRING_LEN;
1153 }
1154 } 1168 }
1155 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ 1169 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */
1156 break; 1170 break;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index d18d6157dd2c..4bc794249801 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h
index 261fd62dda18..1dbed17c8107 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 1ee5d0fbb905..3dc6cef58107 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -64,7 +64,7 @@ char ixgbe_default_device_descr[] =
64 __stringify(BUILD) "-k" 64 __stringify(BUILD) "-k"
65const char ixgbe_driver_version[] = DRV_VERSION; 65const char ixgbe_driver_version[] = DRV_VERSION;
66static const char ixgbe_copyright[] = 66static const char ixgbe_copyright[] =
67 "Copyright (c) 1999-2011 Intel Corporation."; 67 "Copyright (c) 1999-2012 Intel Corporation.";
68 68
69static const struct ixgbe_info *ixgbe_info_tbl[] = { 69static const struct ixgbe_info *ixgbe_info_tbl[] = {
70 [board_82598] = &ixgbe_82598_info, 70 [board_82598] = &ixgbe_82598_info,
@@ -2633,22 +2633,22 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
2633 /* 2633 /*
2634 * we must limit the number of descriptors so that the 2634 * we must limit the number of descriptors so that the
2635 * total size of max desc * buf_len is not greater 2635 * total size of max desc * buf_len is not greater
2636 * than 65535 2636 * than 65536
2637 */ 2637 */
2638 if (ring_is_ps_enabled(ring)) { 2638 if (ring_is_ps_enabled(ring)) {
2639#if (MAX_SKB_FRAGS > 16) 2639#if (PAGE_SIZE < 8192)
2640 rscctrl |= IXGBE_RSCCTL_MAXDESC_16; 2640 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2641#elif (MAX_SKB_FRAGS > 8) 2641#elif (PAGE_SIZE < 16384)
2642 rscctrl |= IXGBE_RSCCTL_MAXDESC_8; 2642 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2643#elif (MAX_SKB_FRAGS > 4) 2643#elif (PAGE_SIZE < 32768)
2644 rscctrl |= IXGBE_RSCCTL_MAXDESC_4; 2644 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2645#else 2645#else
2646 rscctrl |= IXGBE_RSCCTL_MAXDESC_1; 2646 rscctrl |= IXGBE_RSCCTL_MAXDESC_1;
2647#endif 2647#endif
2648 } else { 2648 } else {
2649 if (rx_buf_len < IXGBE_RXBUFFER_4K) 2649 if (rx_buf_len <= IXGBE_RXBUFFER_4K)
2650 rscctrl |= IXGBE_RSCCTL_MAXDESC_16; 2650 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2651 else if (rx_buf_len < IXGBE_RXBUFFER_8K) 2651 else if (rx_buf_len <= IXGBE_RXBUFFER_8K)
2652 rscctrl |= IXGBE_RSCCTL_MAXDESC_8; 2652 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2653 else 2653 else
2654 rscctrl |= IXGBE_RSCCTL_MAXDESC_4; 2654 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
@@ -2830,7 +2830,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
2830 IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl | vt_reg_bits); 2830 IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl | vt_reg_bits);
2831 2831
2832 vf_shift = adapter->num_vfs % 32; 2832 vf_shift = adapter->num_vfs % 32;
2833 reg_offset = (adapter->num_vfs > 32) ? 1 : 0; 2833 reg_offset = (adapter->num_vfs >= 32) ? 1 : 0;
2834 2834
2835 /* Enable only the PF's pool for Tx/Rx */ 2835 /* Enable only the PF's pool for Tx/Rx */
2836 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift)); 2836 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift));
@@ -4330,6 +4330,10 @@ static int ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
4330 adapter->num_tx_queues = 1; 4330 adapter->num_tx_queues = 1;
4331 4331
4332done: 4332done:
4333 if ((adapter->netdev->reg_state == NETREG_UNREGISTERED) ||
4334 (adapter->netdev->reg_state == NETREG_UNREGISTERING))
4335 return 0;
4336
4333 /* Notify the stack of the (possibly) reduced queue counts. */ 4337 /* Notify the stack of the (possibly) reduced queue counts. */
4334 netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); 4338 netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
4335 return netif_set_real_num_rx_queues(adapter->netdev, 4339 return netif_set_real_num_rx_queues(adapter->netdev,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c
index 3f725d48336d..1f3e32b576a5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
index b239bdac38da..310bdd961075 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 7cf1e1f56c69..b91773551a38 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
index 197bdd13106a..cc18165b4c05 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index cf6812dd1436..b01ecb4d2bb1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -67,7 +67,8 @@ static int ixgbe_find_enabled_vfs(struct ixgbe_adapter *adapter)
67 vf_devfn = pdev->devfn + 0x80; 67 vf_devfn = pdev->devfn + 0x80;
68 pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL); 68 pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL);
69 while (pvfdev) { 69 while (pvfdev) {
70 if (pvfdev->devfn == vf_devfn) 70 if (pvfdev->devfn == vf_devfn &&
71 (pvfdev->bus->number >= pdev->bus->number))
71 vfs_found++; 72 vfs_found++;
72 vf_devfn += 2; 73 vf_devfn += 2;
73 pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, 74 pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID,
@@ -646,6 +647,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
646 ixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false); 647 ixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false);
647 retval = ixgbe_set_vf_macvlan(adapter, vf, index, 648 retval = ixgbe_set_vf_macvlan(adapter, vf, index,
648 (unsigned char *)(&msgbuf[1])); 649 (unsigned char *)(&msgbuf[1]));
650 if (retval == -ENOSPC)
651 e_warn(drv, "VF %d has requested a MACVLAN filter "
652 "but there is no space for it\n", vf);
649 break; 653 break;
650 default: 654 default:
651 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); 655 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
index e8badab03359..2ab38d5fda92 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 802bfa0f62cc..9b95bef60970 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -161,19 +161,19 @@
161 161
162/* Receive DMA Registers */ 162/* Receive DMA Registers */
163#define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : \ 163#define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : \
164 (0x0D000 + ((_i - 64) * 0x40))) 164 (0x0D000 + (((_i) - 64) * 0x40)))
165#define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : \ 165#define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : \
166 (0x0D004 + ((_i - 64) * 0x40))) 166 (0x0D004 + (((_i) - 64) * 0x40)))
167#define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : \ 167#define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : \
168 (0x0D008 + ((_i - 64) * 0x40))) 168 (0x0D008 + (((_i) - 64) * 0x40)))
169#define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : \ 169#define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : \
170 (0x0D010 + ((_i - 64) * 0x40))) 170 (0x0D010 + (((_i) - 64) * 0x40)))
171#define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : \ 171#define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : \
172 (0x0D018 + ((_i - 64) * 0x40))) 172 (0x0D018 + (((_i) - 64) * 0x40)))
173#define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : \ 173#define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : \
174 (0x0D028 + ((_i - 64) * 0x40))) 174 (0x0D028 + (((_i) - 64) * 0x40)))
175#define IXGBE_RSCCTL(_i) (((_i) < 64) ? (0x0102C + ((_i) * 0x40)) : \ 175#define IXGBE_RSCCTL(_i) (((_i) < 64) ? (0x0102C + ((_i) * 0x40)) : \
176 (0x0D02C + ((_i - 64) * 0x40))) 176 (0x0D02C + (((_i) - 64) * 0x40)))
177#define IXGBE_RSCDBU 0x03028 177#define IXGBE_RSCDBU 0x03028
178#define IXGBE_RDDCC 0x02F20 178#define IXGBE_RDDCC 0x02F20
179#define IXGBE_RXMEMWRAP 0x03190 179#define IXGBE_RXMEMWRAP 0x03190
@@ -186,7 +186,7 @@
186 */ 186 */
187#define IXGBE_SRRCTL(_i) (((_i) <= 15) ? (0x02100 + ((_i) * 4)) : \ 187#define IXGBE_SRRCTL(_i) (((_i) <= 15) ? (0x02100 + ((_i) * 4)) : \
188 (((_i) < 64) ? (0x01014 + ((_i) * 0x40)) : \ 188 (((_i) < 64) ? (0x01014 + ((_i) * 0x40)) : \
189 (0x0D014 + ((_i - 64) * 0x40)))) 189 (0x0D014 + (((_i) - 64) * 0x40))))
190/* 190/*
191 * Rx DCA Control Register: 191 * Rx DCA Control Register:
192 * 00-15 : 0x02200 + n*4 192 * 00-15 : 0x02200 + n*4
@@ -195,7 +195,7 @@
195 */ 195 */
196#define IXGBE_DCA_RXCTRL(_i) (((_i) <= 15) ? (0x02200 + ((_i) * 4)) : \ 196#define IXGBE_DCA_RXCTRL(_i) (((_i) <= 15) ? (0x02200 + ((_i) * 4)) : \
197 (((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \ 197 (((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \
198 (0x0D00C + ((_i - 64) * 0x40)))) 198 (0x0D00C + (((_i) - 64) * 0x40))))
199#define IXGBE_RDRXCTL 0x02F00 199#define IXGBE_RDRXCTL 0x02F00
200#define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4)) 200#define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4))
201 /* 8 of these 0x03C00 - 0x03C1C */ 201 /* 8 of these 0x03C00 - 0x03C1C */
@@ -344,9 +344,9 @@
344 344
345#define IXGBE_WUPL 0x05900 345#define IXGBE_WUPL 0x05900
346#define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */ 346#define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */
347#define IXGBE_FHFT(_n) (0x09000 + (_n * 0x100)) /* Flex host filter table */ 347#define IXGBE_FHFT(_n) (0x09000 + ((_n) * 0x100)) /* Flex host filter table */
348#define IXGBE_FHFT_EXT(_n) (0x09800 + (_n * 0x100)) /* Ext Flexible Host 348#define IXGBE_FHFT_EXT(_n) (0x09800 + ((_n) * 0x100)) /* Ext Flexible Host
349 * Filter Table */ 349 * Filter Table */
350 350
351#define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 351#define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4
352#define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 352#define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2
@@ -1485,7 +1485,7 @@ enum {
1485#define IXGBE_LED_BLINK_BASE 0x00000080 1485#define IXGBE_LED_BLINK_BASE 0x00000080
1486#define IXGBE_LED_MODE_MASK_BASE 0x0000000F 1486#define IXGBE_LED_MODE_MASK_BASE 0x0000000F
1487#define IXGBE_LED_OFFSET(_base, _i) (_base << (8 * (_i))) 1487#define IXGBE_LED_OFFSET(_base, _i) (_base << (8 * (_i)))
1488#define IXGBE_LED_MODE_SHIFT(_i) (8*(_i)) 1488#define IXGBE_LED_MODE_SHIFT(_i) (8 * (_i))
1489#define IXGBE_LED_IVRT(_i) IXGBE_LED_OFFSET(IXGBE_LED_IVRT_BASE, _i) 1489#define IXGBE_LED_IVRT(_i) IXGBE_LED_OFFSET(IXGBE_LED_IVRT_BASE, _i)
1490#define IXGBE_LED_BLINK(_i) IXGBE_LED_OFFSET(IXGBE_LED_BLINK_BASE, _i) 1490#define IXGBE_LED_BLINK(_i) IXGBE_LED_OFFSET(IXGBE_LED_BLINK_BASE, _i)
1491#define IXGBE_LED_MODE_MASK(_i) IXGBE_LED_OFFSET(IXGBE_LED_MODE_MASK_BASE, _i) 1491#define IXGBE_LED_MODE_MASK(_i) IXGBE_LED_OFFSET(IXGBE_LED_MODE_MASK_BASE, _i)
@@ -2068,9 +2068,9 @@ enum {
2068 2068
2069/* SR-IOV specific macros */ 2069/* SR-IOV specific macros */
2070#define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4) 2070#define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4)
2071#define IXGBE_MBVFICR(_i) (0x00710 + (_i * 4)) 2071#define IXGBE_MBVFICR(_i) (0x00710 + ((_i) * 4))
2072#define IXGBE_VFLRE(_i) (((_i & 1) ? 0x001C0 : 0x00600)) 2072#define IXGBE_VFLRE(_i) ((((_i) & 1) ? 0x001C0 : 0x00600))
2073#define IXGBE_VFLREC(_i) (0x00700 + (_i * 4)) 2073#define IXGBE_VFLREC(_i) (0x00700 + ((_i) * 4))
2074 2074
2075enum ixgbe_fdir_pballoc_type { 2075enum ixgbe_fdir_pballoc_type {
2076 IXGBE_FDIR_PBALLOC_NONE = 0, 2076 IXGBE_FDIR_PBALLOC_NONE = 0,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
index 8cc5eccfd651..f838a2be8cfb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbevf/Makefile b/drivers/net/ethernet/intel/ixgbevf/Makefile
index 1f35d229e71a..4ce4c97ef5ad 100644
--- a/drivers/net/ethernet/intel/ixgbevf/Makefile
+++ b/drivers/net/ethernet/intel/ixgbevf/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# Intel 82599 Virtual Function driver 3# Intel 82599 Virtual Function driver
4# Copyright(c) 1999 - 2010 Intel Corporation. 4# Copyright(c) 1999 - 2012 Intel Corporation.
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms and conditions of the GNU General Public License, 7# under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbevf/defines.h b/drivers/net/ethernet/intel/ixgbevf/defines.h
index 2eb89cb94a0d..947b5c830735 100644
--- a/drivers/net/ethernet/intel/ixgbevf/defines.h
+++ b/drivers/net/ethernet/intel/ixgbevf/defines.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index dc8e6511c640..2bfe0d1d7958 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -56,7 +56,8 @@ struct ixgbe_stats {
56 offsetof(struct ixgbevf_adapter, m), \ 56 offsetof(struct ixgbevf_adapter, m), \
57 offsetof(struct ixgbevf_adapter, b), \ 57 offsetof(struct ixgbevf_adapter, b), \
58 offsetof(struct ixgbevf_adapter, r) 58 offsetof(struct ixgbevf_adapter, r)
59static struct ixgbe_stats ixgbe_gstrings_stats[] = { 59
60static const struct ixgbe_stats ixgbe_gstrings_stats[] = {
60 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc, 61 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc,
61 stats.saved_reset_vfgprc)}, 62 stats.saved_reset_vfgprc)},
62 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc, 63 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc,
@@ -671,7 +672,7 @@ static int ixgbevf_nway_reset(struct net_device *netdev)
671 return 0; 672 return 0;
672} 673}
673 674
674static struct ethtool_ops ixgbevf_ethtool_ops = { 675static const struct ethtool_ops ixgbevf_ethtool_ops = {
675 .get_settings = ixgbevf_get_settings, 676 .get_settings = ixgbevf_get_settings,
676 .get_drvinfo = ixgbevf_get_drvinfo, 677 .get_drvinfo = ixgbevf_get_drvinfo,
677 .get_regs_len = ixgbevf_get_regs_len, 678 .get_regs_len = ixgbevf_get_regs_len,
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index e6c9d1a927a9..dfed420a1bf6 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -279,12 +279,12 @@ enum ixgbevf_boards {
279 board_X540_vf, 279 board_X540_vf,
280}; 280};
281 281
282extern struct ixgbevf_info ixgbevf_82599_vf_info; 282extern const struct ixgbevf_info ixgbevf_82599_vf_info;
283extern struct ixgbevf_info ixgbevf_X540_vf_info; 283extern const struct ixgbevf_info ixgbevf_X540_vf_info;
284extern struct ixgbe_mbx_operations ixgbevf_mbx_ops; 284extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
285 285
286/* needed by ethtool.c */ 286/* needed by ethtool.c */
287extern char ixgbevf_driver_name[]; 287extern const char ixgbevf_driver_name[];
288extern const char ixgbevf_driver_version[]; 288extern const char ixgbevf_driver_version[];
289 289
290extern int ixgbevf_up(struct ixgbevf_adapter *adapter); 290extern int ixgbevf_up(struct ixgbevf_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 891162d1610c..e51d552410ae 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -53,14 +53,14 @@
53 53
54#include "ixgbevf.h" 54#include "ixgbevf.h"
55 55
56char ixgbevf_driver_name[] = "ixgbevf"; 56const char ixgbevf_driver_name[] = "ixgbevf";
57static const char ixgbevf_driver_string[] = 57static const char ixgbevf_driver_string[] =
58 "Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver"; 58 "Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver";
59 59
60#define DRV_VERSION "2.2.0-k" 60#define DRV_VERSION "2.2.0-k"
61const char ixgbevf_driver_version[] = DRV_VERSION; 61const char ixgbevf_driver_version[] = DRV_VERSION;
62static char ixgbevf_copyright[] = 62static char ixgbevf_copyright[] =
63 "Copyright (c) 2009 - 2010 Intel Corporation."; 63 "Copyright (c) 2009 - 2012 Intel Corporation.";
64 64
65static const struct ixgbevf_info *ixgbevf_info_tbl[] = { 65static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
66 [board_82599_vf] = &ixgbevf_82599_vf_info, 66 [board_82599_vf] = &ixgbevf_82599_vf_info,
@@ -917,32 +917,39 @@ static irqreturn_t ixgbevf_msix_mbx(int irq, void *data)
917 struct ixgbe_hw *hw = &adapter->hw; 917 struct ixgbe_hw *hw = &adapter->hw;
918 u32 eicr; 918 u32 eicr;
919 u32 msg; 919 u32 msg;
920 bool got_ack = false;
920 921
921 eicr = IXGBE_READ_REG(hw, IXGBE_VTEICS); 922 eicr = IXGBE_READ_REG(hw, IXGBE_VTEICS);
922 IXGBE_WRITE_REG(hw, IXGBE_VTEICR, eicr); 923 IXGBE_WRITE_REG(hw, IXGBE_VTEICR, eicr);
923 924
924 if (!hw->mbx.ops.check_for_ack(hw)) { 925 if (!hw->mbx.ops.check_for_ack(hw))
926 got_ack = true;
927
928 if (!hw->mbx.ops.check_for_msg(hw)) {
929 hw->mbx.ops.read(hw, &msg, 1);
930
931 if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG)
932 mod_timer(&adapter->watchdog_timer,
933 round_jiffies(jiffies + 1));
934
935 if (msg & IXGBE_VT_MSGTYPE_NACK)
936 pr_warn("Last Request of type %2.2x to PF Nacked\n",
937 msg & 0xFF);
925 /* 938 /*
926 * checking for the ack clears the PFACK bit. Place 939 * Restore the PFSTS bit in case someone is polling for a
927 * it back in the v2p_mailbox cache so that anyone 940 * return message from the PF
928 * polling for an ack will not miss it. Also
929 * avoid the read below because the code to read
930 * the mailbox will also clear the ack bit. This was
931 * causing lost acks. Just cache the bit and exit
932 * the IRQ handler.
933 */ 941 */
934 hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFACK; 942 hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFSTS;
935 goto out;
936 } 943 }
937 944
938 /* Not an ack interrupt, go ahead and read the message */ 945 /*
939 hw->mbx.ops.read(hw, &msg, 1); 946 * checking for the ack clears the PFACK bit. Place
940 947 * it back in the v2p_mailbox cache so that anyone
941 if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG) 948 * polling for an ack will not miss it
942 mod_timer(&adapter->watchdog_timer, 949 */
943 round_jiffies(jiffies + 1)); 950 if (got_ack)
951 hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFACK;
944 952
945out:
946 return IRQ_HANDLED; 953 return IRQ_HANDLED;
947} 954}
948 955
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c b/drivers/net/ethernet/intel/ixgbevf/mbx.c
index 930fa83f2568..9c955900fe64 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.c
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -26,6 +26,7 @@
26*******************************************************************************/ 26*******************************************************************************/
27 27
28#include "mbx.h" 28#include "mbx.h"
29#include "ixgbevf.h"
29 30
30/** 31/**
31 * ixgbevf_poll_for_msg - Wait for message notification 32 * ixgbevf_poll_for_msg - Wait for message notification
@@ -328,7 +329,7 @@ static s32 ixgbevf_init_mbx_params_vf(struct ixgbe_hw *hw)
328 return 0; 329 return 0;
329} 330}
330 331
331struct ixgbe_mbx_operations ixgbevf_mbx_ops = { 332const struct ixgbe_mbx_operations ixgbevf_mbx_ops = {
332 .init_params = ixgbevf_init_mbx_params_vf, 333 .init_params = ixgbevf_init_mbx_params_vf,
333 .read = ixgbevf_read_mbx_vf, 334 .read = ixgbevf_read_mbx_vf,
334 .write = ixgbevf_write_mbx_vf, 335 .write = ixgbevf_write_mbx_vf,
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
index 9d38a94a348a..cf9131c5c115 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbevf/regs.h b/drivers/net/ethernet/intel/ixgbevf/regs.h
index 5e4d5e5cdf38..debd8c0e1f28 100644
--- a/drivers/net/ethernet/intel/ixgbevf/regs.h
+++ b/drivers/net/ethernet/intel/ixgbevf/regs.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index 21533e300367..74be7411242a 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -26,6 +26,7 @@
26*******************************************************************************/ 26*******************************************************************************/
27 27
28#include "vf.h" 28#include "vf.h"
29#include "ixgbevf.h"
29 30
30/** 31/**
31 * ixgbevf_start_hw_vf - Prepare hardware for Tx/Rx 32 * ixgbevf_start_hw_vf - Prepare hardware for Tx/Rx
@@ -282,6 +283,17 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
282 return ret_val; 283 return ret_val;
283} 284}
284 285
286static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,
287 u32 *msg, u16 size)
288{
289 struct ixgbe_mbx_info *mbx = &hw->mbx;
290 u32 retmsg[IXGBE_VFMAILBOX_SIZE];
291 s32 retval = mbx->ops.write_posted(hw, msg, size);
292
293 if (!retval)
294 mbx->ops.read_posted(hw, retmsg, size);
295}
296
285/** 297/**
286 * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses 298 * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses
287 * @hw: pointer to the HW structure 299 * @hw: pointer to the HW structure
@@ -293,7 +305,6 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
293 struct net_device *netdev) 305 struct net_device *netdev)
294{ 306{
295 struct netdev_hw_addr *ha; 307 struct netdev_hw_addr *ha;
296 struct ixgbe_mbx_info *mbx = &hw->mbx;
297 u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; 308 u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
298 u16 *vector_list = (u16 *)&msgbuf[1]; 309 u16 *vector_list = (u16 *)&msgbuf[1];
299 u32 cnt, i; 310 u32 cnt, i;
@@ -320,7 +331,7 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
320 vector_list[i++] = ixgbevf_mta_vector(hw, ha->addr); 331 vector_list[i++] = ixgbevf_mta_vector(hw, ha->addr);
321 } 332 }
322 333
323 mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE); 334 ixgbevf_write_msg_read_ack(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
324 335
325 return 0; 336 return 0;
326} 337}
@@ -335,7 +346,6 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
335static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, 346static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
336 bool vlan_on) 347 bool vlan_on)
337{ 348{
338 struct ixgbe_mbx_info *mbx = &hw->mbx;
339 u32 msgbuf[2]; 349 u32 msgbuf[2];
340 350
341 msgbuf[0] = IXGBE_VF_SET_VLAN; 351 msgbuf[0] = IXGBE_VF_SET_VLAN;
@@ -343,7 +353,9 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
343 /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */ 353 /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
344 msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; 354 msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
345 355
346 return mbx->ops.write_posted(hw, msgbuf, 2); 356 ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
357
358 return 0;
347} 359}
348 360
349/** 361/**
@@ -401,7 +413,7 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw,
401 return 0; 413 return 0;
402} 414}
403 415
404static struct ixgbe_mac_operations ixgbevf_mac_ops = { 416static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
405 .init_hw = ixgbevf_init_hw_vf, 417 .init_hw = ixgbevf_init_hw_vf,
406 .reset_hw = ixgbevf_reset_hw_vf, 418 .reset_hw = ixgbevf_reset_hw_vf,
407 .start_hw = ixgbevf_start_hw_vf, 419 .start_hw = ixgbevf_start_hw_vf,
@@ -415,12 +427,12 @@ static struct ixgbe_mac_operations ixgbevf_mac_ops = {
415 .set_vfta = ixgbevf_set_vfta_vf, 427 .set_vfta = ixgbevf_set_vfta_vf,
416}; 428};
417 429
418struct ixgbevf_info ixgbevf_82599_vf_info = { 430const struct ixgbevf_info ixgbevf_82599_vf_info = {
419 .mac = ixgbe_mac_82599_vf, 431 .mac = ixgbe_mac_82599_vf,
420 .mac_ops = &ixgbevf_mac_ops, 432 .mac_ops = &ixgbevf_mac_ops,
421}; 433};
422 434
423struct ixgbevf_info ixgbevf_X540_vf_info = { 435const struct ixgbevf_info ixgbevf_X540_vf_info = {
424 .mac = ixgbe_mac_X540_vf, 436 .mac = ixgbe_mac_X540_vf,
425 .mac_ops = &ixgbevf_mac_ops, 437 .mac_ops = &ixgbevf_mac_ops,
426}; 438};
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 10306b492ee6..25c951daee5d 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2012 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -167,7 +167,7 @@ struct ixgbevf_hw_stats {
167 167
168struct ixgbevf_info { 168struct ixgbevf_info {
169 enum ixgbe_mac_type mac; 169 enum ixgbe_mac_type mac;
170 struct ixgbe_mac_operations *mac_ops; 170 const struct ixgbe_mac_operations *mac_ops;
171}; 171};
172 172
173#endif /* __IXGBE_VF_H__ */ 173#endif /* __IXGBE_VF_H__ */
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 9c049d2cb97d..9edecfa1f0f4 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -136,6 +136,8 @@ static char mv643xx_eth_driver_version[] = "1.4";
136#define INT_MASK 0x0068 136#define INT_MASK 0x0068
137#define INT_MASK_EXT 0x006c 137#define INT_MASK_EXT 0x006c
138#define TX_FIFO_URGENT_THRESHOLD 0x0074 138#define TX_FIFO_URGENT_THRESHOLD 0x0074
139#define RX_DISCARD_FRAME_CNT 0x0084
140#define RX_OVERRUN_FRAME_CNT 0x0088
139#define TXQ_FIX_PRIO_CONF_MOVED 0x00dc 141#define TXQ_FIX_PRIO_CONF_MOVED 0x00dc
140#define TX_BW_RATE_MOVED 0x00e0 142#define TX_BW_RATE_MOVED 0x00e0
141#define TX_BW_MTU_MOVED 0x00e8 143#define TX_BW_MTU_MOVED 0x00e8
@@ -334,6 +336,9 @@ struct mib_counters {
334 u32 bad_crc_event; 336 u32 bad_crc_event;
335 u32 collision; 337 u32 collision;
336 u32 late_collision; 338 u32 late_collision;
339 /* Non MIB hardware counters */
340 u32 rx_discard;
341 u32 rx_overrun;
337}; 342};
338 343
339struct lro_counters { 344struct lro_counters {
@@ -1225,6 +1230,10 @@ static void mib_counters_clear(struct mv643xx_eth_private *mp)
1225 1230
1226 for (i = 0; i < 0x80; i += 4) 1231 for (i = 0; i < 0x80; i += 4)
1227 mib_read(mp, i); 1232 mib_read(mp, i);
1233
1234 /* Clear non MIB hw counters also */
1235 rdlp(mp, RX_DISCARD_FRAME_CNT);
1236 rdlp(mp, RX_OVERRUN_FRAME_CNT);
1228} 1237}
1229 1238
1230static void mib_counters_update(struct mv643xx_eth_private *mp) 1239static void mib_counters_update(struct mv643xx_eth_private *mp)
@@ -1262,6 +1271,9 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1262 p->bad_crc_event += mib_read(mp, 0x74); 1271 p->bad_crc_event += mib_read(mp, 0x74);
1263 p->collision += mib_read(mp, 0x78); 1272 p->collision += mib_read(mp, 0x78);
1264 p->late_collision += mib_read(mp, 0x7c); 1273 p->late_collision += mib_read(mp, 0x7c);
1274 /* Non MIB hardware counters */
1275 p->rx_discard += rdlp(mp, RX_DISCARD_FRAME_CNT);
1276 p->rx_overrun += rdlp(mp, RX_OVERRUN_FRAME_CNT);
1265 spin_unlock_bh(&mp->mib_counters_lock); 1277 spin_unlock_bh(&mp->mib_counters_lock);
1266 1278
1267 mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); 1279 mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ);
@@ -1413,6 +1425,8 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
1413 MIBSTAT(bad_crc_event), 1425 MIBSTAT(bad_crc_event),
1414 MIBSTAT(collision), 1426 MIBSTAT(collision),
1415 MIBSTAT(late_collision), 1427 MIBSTAT(late_collision),
1428 MIBSTAT(rx_discard),
1429 MIBSTAT(rx_overrun),
1416 LROSTAT(lro_aggregated), 1430 LROSTAT(lro_aggregated),
1417 LROSTAT(lro_flushed), 1431 LROSTAT(lro_flushed),
1418 LROSTAT(lro_no_desc), 1432 LROSTAT(lro_no_desc),
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 18a87a57fc0a..33947ac595c0 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -2576,6 +2576,7 @@ static int skge_up(struct net_device *dev)
2576 } 2576 }
2577 2577
2578 /* Initialize MAC */ 2578 /* Initialize MAC */
2579 netif_carrier_off(dev);
2579 spin_lock_bh(&hw->phy_lock); 2580 spin_lock_bh(&hw->phy_lock);
2580 if (is_genesis(hw)) 2581 if (is_genesis(hw))
2581 genesis_mac_init(hw, port); 2582 genesis_mac_init(hw, port);
@@ -2797,6 +2798,8 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
2797 td->control = BMU_OWN | BMU_SW | BMU_STF | control | len; 2798 td->control = BMU_OWN | BMU_SW | BMU_STF | control | len;
2798 wmb(); 2799 wmb();
2799 2800
2801 netdev_sent_queue(dev, skb->len);
2802
2800 skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_START); 2803 skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_START);
2801 2804
2802 netif_printk(skge, tx_queued, KERN_DEBUG, skge->netdev, 2805 netif_printk(skge, tx_queued, KERN_DEBUG, skge->netdev,
@@ -2816,11 +2819,9 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
2816 2819
2817 2820
2818/* Free resources associated with this reing element */ 2821/* Free resources associated with this reing element */
2819static void skge_tx_free(struct skge_port *skge, struct skge_element *e, 2822static inline void skge_tx_unmap(struct pci_dev *pdev, struct skge_element *e,
2820 u32 control) 2823 u32 control)
2821{ 2824{
2822 struct pci_dev *pdev = skge->hw->pdev;
2823
2824 /* skb header vs. fragment */ 2825 /* skb header vs. fragment */
2825 if (control & BMU_STF) 2826 if (control & BMU_STF)
2826 pci_unmap_single(pdev, dma_unmap_addr(e, mapaddr), 2827 pci_unmap_single(pdev, dma_unmap_addr(e, mapaddr),
@@ -2830,13 +2831,6 @@ static void skge_tx_free(struct skge_port *skge, struct skge_element *e,
2830 pci_unmap_page(pdev, dma_unmap_addr(e, mapaddr), 2831 pci_unmap_page(pdev, dma_unmap_addr(e, mapaddr),
2831 dma_unmap_len(e, maplen), 2832 dma_unmap_len(e, maplen),
2832 PCI_DMA_TODEVICE); 2833 PCI_DMA_TODEVICE);
2833
2834 if (control & BMU_EOF) {
2835 netif_printk(skge, tx_done, KERN_DEBUG, skge->netdev,
2836 "tx done slot %td\n", e - skge->tx_ring.start);
2837
2838 dev_kfree_skb(e->skb);
2839 }
2840} 2834}
2841 2835
2842/* Free all buffers in transmit ring */ 2836/* Free all buffers in transmit ring */
@@ -2847,10 +2841,15 @@ static void skge_tx_clean(struct net_device *dev)
2847 2841
2848 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { 2842 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
2849 struct skge_tx_desc *td = e->desc; 2843 struct skge_tx_desc *td = e->desc;
2850 skge_tx_free(skge, e, td->control); 2844
2845 skge_tx_unmap(skge->hw->pdev, e, td->control);
2846
2847 if (td->control & BMU_EOF)
2848 dev_kfree_skb(e->skb);
2851 td->control = 0; 2849 td->control = 0;
2852 } 2850 }
2853 2851
2852 netdev_reset_queue(dev);
2854 skge->tx_ring.to_clean = e; 2853 skge->tx_ring.to_clean = e;
2855} 2854}
2856 2855
@@ -3111,6 +3110,7 @@ static void skge_tx_done(struct net_device *dev)
3111 struct skge_port *skge = netdev_priv(dev); 3110 struct skge_port *skge = netdev_priv(dev);
3112 struct skge_ring *ring = &skge->tx_ring; 3111 struct skge_ring *ring = &skge->tx_ring;
3113 struct skge_element *e; 3112 struct skge_element *e;
3113 unsigned int bytes_compl = 0, pkts_compl = 0;
3114 3114
3115 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); 3115 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F);
3116 3116
@@ -3120,8 +3120,20 @@ static void skge_tx_done(struct net_device *dev)
3120 if (control & BMU_OWN) 3120 if (control & BMU_OWN)
3121 break; 3121 break;
3122 3122
3123 skge_tx_free(skge, e, control); 3123 skge_tx_unmap(skge->hw->pdev, e, control);
3124
3125 if (control & BMU_EOF) {
3126 netif_printk(skge, tx_done, KERN_DEBUG, skge->netdev,
3127 "tx done slot %td\n",
3128 e - skge->tx_ring.start);
3129
3130 pkts_compl++;
3131 bytes_compl += e->skb->len;
3132
3133 dev_kfree_skb(e->skb);
3134 }
3124 } 3135 }
3136 netdev_completed_queue(dev, pkts_compl, bytes_compl);
3125 skge->tx_ring.to_clean = e; 3137 skge->tx_ring.to_clean = e;
3126 3138
3127 /* Can run lockless until we need to synchronize to restart queue. */ 3139 /* Can run lockless until we need to synchronize to restart queue. */
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 978f593094c0..eaf09d4f02d0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -1247,6 +1247,7 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
1247 u32 reply; 1247 u32 reply;
1248 u32 slave_status = 0; 1248 u32 slave_status = 0;
1249 u8 is_going_down = 0; 1249 u8 is_going_down = 0;
1250 int i;
1250 1251
1251 slave_state[slave].comm_toggle ^= 1; 1252 slave_state[slave].comm_toggle ^= 1;
1252 reply = (u32) slave_state[slave].comm_toggle << 31; 1253 reply = (u32) slave_state[slave].comm_toggle << 31;
@@ -1258,6 +1259,10 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
1258 if (cmd == MLX4_COMM_CMD_RESET) { 1259 if (cmd == MLX4_COMM_CMD_RESET) {
1259 mlx4_warn(dev, "Received reset from slave:%d\n", slave); 1260 mlx4_warn(dev, "Received reset from slave:%d\n", slave);
1260 slave_state[slave].active = false; 1261 slave_state[slave].active = false;
1262 for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i) {
1263 slave_state[slave].event_eq[i].eqn = -1;
1264 slave_state[slave].event_eq[i].token = 0;
1265 }
1261 /*check if we are in the middle of FLR process, 1266 /*check if we are in the middle of FLR process,
1262 if so return "retry" status to the slave*/ 1267 if so return "retry" status to the slave*/
1263 if (MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) { 1268 if (MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) {
@@ -1452,7 +1457,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
1452{ 1457{
1453 struct mlx4_priv *priv = mlx4_priv(dev); 1458 struct mlx4_priv *priv = mlx4_priv(dev);
1454 struct mlx4_slave_state *s_state; 1459 struct mlx4_slave_state *s_state;
1455 int i, err, port; 1460 int i, j, err, port;
1456 1461
1457 priv->mfunc.vhcr = dma_alloc_coherent(&(dev->pdev->dev), PAGE_SIZE, 1462 priv->mfunc.vhcr = dma_alloc_coherent(&(dev->pdev->dev), PAGE_SIZE,
1458 &priv->mfunc.vhcr_dma, 1463 &priv->mfunc.vhcr_dma,
@@ -1485,6 +1490,8 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
1485 for (i = 0; i < dev->num_slaves; ++i) { 1490 for (i = 0; i < dev->num_slaves; ++i) {
1486 s_state = &priv->mfunc.master.slave_state[i]; 1491 s_state = &priv->mfunc.master.slave_state[i];
1487 s_state->last_cmd = MLX4_COMM_CMD_RESET; 1492 s_state->last_cmd = MLX4_COMM_CMD_RESET;
1493 for (j = 0; j < MLX4_EVENT_TYPES_NUM; ++j)
1494 s_state->event_eq[j].eqn = -1;
1488 __raw_writel((__force u32) 0, 1495 __raw_writel((__force u32) 0,
1489 &priv->mfunc.comm[i].slave_write); 1496 &priv->mfunc.comm[i].slave_write);
1490 __raw_writel((__force u32) 0, 1497 __raw_writel((__force u32) 0,
@@ -1609,12 +1616,12 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev)
1609 kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); 1616 kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]);
1610 } 1617 }
1611 kfree(priv->mfunc.master.slave_state); 1618 kfree(priv->mfunc.master.slave_state);
1612 iounmap(priv->mfunc.comm);
1613 dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE,
1614 priv->mfunc.vhcr,
1615 priv->mfunc.vhcr_dma);
1616 priv->mfunc.vhcr = NULL;
1617 } 1619 }
1620
1621 iounmap(priv->mfunc.comm);
1622 dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE,
1623 priv->mfunc.vhcr, priv->mfunc.vhcr_dma);
1624 priv->mfunc.vhcr = NULL;
1618} 1625}
1619 1626
1620void mlx4_cmd_cleanup(struct mlx4_dev *dev) 1627void mlx4_cmd_cleanup(struct mlx4_dev *dev)
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
index 475f9d6af955..7e64033d7de3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
@@ -96,7 +96,7 @@ void mlx4_cq_event(struct mlx4_dev *dev, u32 cqn, int event_type)
96static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 96static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
97 int cq_num) 97 int cq_num)
98{ 98{
99 return mlx4_cmd(dev, mailbox->dma | dev->caps.function, cq_num, 0, 99 return mlx4_cmd(dev, mailbox->dma, cq_num, 0,
100 MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A, 100 MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A,
101 MLX4_CMD_WRAPPED); 101 MLX4_CMD_WRAPPED);
102} 102}
@@ -111,7 +111,7 @@ static int mlx4_MODIFY_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
111static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 111static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
112 int cq_num) 112 int cq_num)
113{ 113{
114 return mlx4_cmd_box(dev, dev->caps.function, mailbox ? mailbox->dma : 0, 114 return mlx4_cmd_box(dev, 0, mailbox ? mailbox->dma : 0,
115 cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ, 115 cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ,
116 MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED); 116 MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
117} 117}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 7dbc6a230779..70346fd7f9c4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -183,10 +183,11 @@ static int mlx4_en_set_wol(struct net_device *netdev,
183static int mlx4_en_get_sset_count(struct net_device *dev, int sset) 183static int mlx4_en_get_sset_count(struct net_device *dev, int sset)
184{ 184{
185 struct mlx4_en_priv *priv = netdev_priv(dev); 185 struct mlx4_en_priv *priv = netdev_priv(dev);
186 int bit_count = hweight64(priv->stats_bitmap);
186 187
187 switch (sset) { 188 switch (sset) {
188 case ETH_SS_STATS: 189 case ETH_SS_STATS:
189 return NUM_ALL_STATS + 190 return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) +
190 (priv->tx_ring_num + priv->rx_ring_num) * 2; 191 (priv->tx_ring_num + priv->rx_ring_num) * 2;
191 case ETH_SS_TEST: 192 case ETH_SS_TEST:
192 return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags 193 return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags
@@ -201,14 +202,34 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
201{ 202{
202 struct mlx4_en_priv *priv = netdev_priv(dev); 203 struct mlx4_en_priv *priv = netdev_priv(dev);
203 int index = 0; 204 int index = 0;
204 int i; 205 int i, j = 0;
205 206
206 spin_lock_bh(&priv->stats_lock); 207 spin_lock_bh(&priv->stats_lock);
207 208
208 for (i = 0; i < NUM_MAIN_STATS; i++) 209 if (!(priv->stats_bitmap)) {
209 data[index++] = ((unsigned long *) &priv->stats)[i]; 210 for (i = 0; i < NUM_MAIN_STATS; i++)
210 for (i = 0; i < NUM_PORT_STATS; i++) 211 data[index++] =
211 data[index++] = ((unsigned long *) &priv->port_stats)[i]; 212 ((unsigned long *) &priv->stats)[i];
213 for (i = 0; i < NUM_PORT_STATS; i++)
214 data[index++] =
215 ((unsigned long *) &priv->port_stats)[i];
216 for (i = 0; i < NUM_PKT_STATS; i++)
217 data[index++] =
218 ((unsigned long *) &priv->pkstats)[i];
219 } else {
220 for (i = 0; i < NUM_MAIN_STATS; i++) {
221 if ((priv->stats_bitmap >> j) & 1)
222 data[index++] =
223 ((unsigned long *) &priv->stats)[i];
224 j++;
225 }
226 for (i = 0; i < NUM_PORT_STATS; i++) {
227 if ((priv->stats_bitmap >> j) & 1)
228 data[index++] =
229 ((unsigned long *) &priv->port_stats)[i];
230 j++;
231 }
232 }
212 for (i = 0; i < priv->tx_ring_num; i++) { 233 for (i = 0; i < priv->tx_ring_num; i++) {
213 data[index++] = priv->tx_ring[i].packets; 234 data[index++] = priv->tx_ring[i].packets;
214 data[index++] = priv->tx_ring[i].bytes; 235 data[index++] = priv->tx_ring[i].bytes;
@@ -217,8 +238,6 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
217 data[index++] = priv->rx_ring[i].packets; 238 data[index++] = priv->rx_ring[i].packets;
218 data[index++] = priv->rx_ring[i].bytes; 239 data[index++] = priv->rx_ring[i].bytes;
219 } 240 }
220 for (i = 0; i < NUM_PKT_STATS; i++)
221 data[index++] = ((unsigned long *) &priv->pkstats)[i];
222 spin_unlock_bh(&priv->stats_lock); 241 spin_unlock_bh(&priv->stats_lock);
223 242
224} 243}
@@ -247,11 +266,29 @@ static void mlx4_en_get_strings(struct net_device *dev,
247 266
248 case ETH_SS_STATS: 267 case ETH_SS_STATS:
249 /* Add main counters */ 268 /* Add main counters */
250 for (i = 0; i < NUM_MAIN_STATS; i++) 269 if (!priv->stats_bitmap) {
251 strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); 270 for (i = 0; i < NUM_MAIN_STATS; i++)
252 for (i = 0; i< NUM_PORT_STATS; i++) 271 strcpy(data + (index++) * ETH_GSTRING_LEN,
253 strcpy(data + (index++) * ETH_GSTRING_LEN, 272 main_strings[i]);
254 main_strings[i + NUM_MAIN_STATS]); 273 for (i = 0; i < NUM_PORT_STATS; i++)
274 strcpy(data + (index++) * ETH_GSTRING_LEN,
275 main_strings[i +
276 NUM_MAIN_STATS]);
277 for (i = 0; i < NUM_PKT_STATS; i++)
278 strcpy(data + (index++) * ETH_GSTRING_LEN,
279 main_strings[i +
280 NUM_MAIN_STATS +
281 NUM_PORT_STATS]);
282 } else
283 for (i = 0; i < NUM_MAIN_STATS + NUM_PORT_STATS; i++) {
284 if ((priv->stats_bitmap >> i) & 1) {
285 strcpy(data +
286 (index++) * ETH_GSTRING_LEN,
287 main_strings[i]);
288 }
289 if (!(priv->stats_bitmap >> i))
290 break;
291 }
255 for (i = 0; i < priv->tx_ring_num; i++) { 292 for (i = 0; i < priv->tx_ring_num; i++) {
256 sprintf(data + (index++) * ETH_GSTRING_LEN, 293 sprintf(data + (index++) * ETH_GSTRING_LEN,
257 "tx%d_packets", i); 294 "tx%d_packets", i);
@@ -264,9 +301,6 @@ static void mlx4_en_get_strings(struct net_device *dev,
264 sprintf(data + (index++) * ETH_GSTRING_LEN, 301 sprintf(data + (index++) * ETH_GSTRING_LEN,
265 "rx%d_bytes", i); 302 "rx%d_bytes", i);
266 } 303 }
267 for (i = 0; i< NUM_PKT_STATS; i++)
268 strcpy(data + (index++) * ETH_GSTRING_LEN,
269 main_strings[i + NUM_MAIN_STATS + NUM_PORT_STATS]);
270 break; 304 break;
271 } 305 }
272} 306}
@@ -479,6 +513,95 @@ static void mlx4_en_get_ringparam(struct net_device *dev,
479 param->tx_pending = priv->tx_ring[0].size; 513 param->tx_pending = priv->tx_ring[0].size;
480} 514}
481 515
516static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev)
517{
518 struct mlx4_en_priv *priv = netdev_priv(dev);
519
520 return priv->rx_ring_num;
521}
522
523static int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index)
524{
525 struct mlx4_en_priv *priv = netdev_priv(dev);
526 struct mlx4_en_rss_map *rss_map = &priv->rss_map;
527 int rss_rings;
528 size_t n = priv->rx_ring_num;
529 int err = 0;
530
531 rss_rings = priv->prof->rss_rings ?: priv->rx_ring_num;
532
533 while (n--) {
534 ring_index[n] = rss_map->qps[n % rss_rings].qpn -
535 rss_map->base_qpn;
536 }
537
538 return err;
539}
540
541static int mlx4_en_set_rxfh_indir(struct net_device *dev,
542 const u32 *ring_index)
543{
544 struct mlx4_en_priv *priv = netdev_priv(dev);
545 struct mlx4_en_dev *mdev = priv->mdev;
546 int port_up = 0;
547 int err = 0;
548 int i;
549 int rss_rings = 0;
550
551 /* Calculate RSS table size and make sure flows are spread evenly
552 * between rings
553 */
554 for (i = 0; i < priv->rx_ring_num; i++) {
555 if (i > 0 && !ring_index[i] && !rss_rings)
556 rss_rings = i;
557
558 if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num)))
559 return -EINVAL;
560 }
561
562 if (!rss_rings)
563 rss_rings = priv->rx_ring_num;
564
565 /* RSS table size must be an order of 2 */
566 if (!is_power_of_2(rss_rings))
567 return -EINVAL;
568
569 mutex_lock(&mdev->state_lock);
570 if (priv->port_up) {
571 port_up = 1;
572 mlx4_en_stop_port(dev);
573 }
574
575 priv->prof->rss_rings = rss_rings;
576
577 if (port_up) {
578 err = mlx4_en_start_port(dev);
579 if (err)
580 en_err(priv, "Failed starting port\n");
581 }
582
583 mutex_unlock(&mdev->state_lock);
584 return err;
585}
586
587static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
588 u32 *rule_locs)
589{
590 struct mlx4_en_priv *priv = netdev_priv(dev);
591 int err = 0;
592
593 switch (cmd->cmd) {
594 case ETHTOOL_GRXRINGS:
595 cmd->data = priv->rx_ring_num;
596 break;
597 default:
598 err = -EOPNOTSUPP;
599 break;
600 }
601
602 return err;
603}
604
482const struct ethtool_ops mlx4_en_ethtool_ops = { 605const struct ethtool_ops mlx4_en_ethtool_ops = {
483 .get_drvinfo = mlx4_en_get_drvinfo, 606 .get_drvinfo = mlx4_en_get_drvinfo,
484 .get_settings = mlx4_en_get_settings, 607 .get_settings = mlx4_en_get_settings,
@@ -498,6 +621,10 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
498 .set_pauseparam = mlx4_en_set_pauseparam, 621 .set_pauseparam = mlx4_en_set_pauseparam,
499 .get_ringparam = mlx4_en_get_ringparam, 622 .get_ringparam = mlx4_en_get_ringparam,
500 .set_ringparam = mlx4_en_set_ringparam, 623 .set_ringparam = mlx4_en_set_ringparam,
624 .get_rxnfc = mlx4_en_get_rxnfc,
625 .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
626 .get_rxfh_indir = mlx4_en_get_rxfh_indir,
627 .set_rxfh_indir = mlx4_en_set_rxfh_indir,
501}; 628};
502 629
503 630
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index a06096fcc0b8..2097a7d3c5b8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -62,10 +62,6 @@ static const char mlx4_en_version[] =
62 * Device scope module parameters 62 * Device scope module parameters
63 */ 63 */
64 64
65
66/* Enable RSS TCP traffic */
67MLX4_EN_PARM_INT(tcp_rss, 1,
68 "Enable RSS for incomming TCP traffic or disabled (0)");
69/* Enable RSS UDP traffic */ 65/* Enable RSS UDP traffic */
70MLX4_EN_PARM_INT(udp_rss, 1, 66MLX4_EN_PARM_INT(udp_rss, 1,
71 "Enable RSS for incomming UDP traffic or disabled (0)"); 67 "Enable RSS for incomming UDP traffic or disabled (0)");
@@ -104,7 +100,6 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
104 struct mlx4_en_profile *params = &mdev->profile; 100 struct mlx4_en_profile *params = &mdev->profile;
105 int i; 101 int i;
106 102
107 params->tcp_rss = tcp_rss;
108 params->udp_rss = udp_rss; 103 params->udp_rss = udp_rss;
109 if (params->udp_rss && !(mdev->dev->caps.flags 104 if (params->udp_rss && !(mdev->dev->caps.flags
110 & MLX4_DEV_CAP_FLAG_UDP_RSS)) { 105 & MLX4_DEV_CAP_FLAG_UDP_RSS)) {
@@ -120,6 +115,7 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
120 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE; 115 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
121 params->prof[i].tx_ring_num = MLX4_EN_NUM_TX_RINGS + 116 params->prof[i].tx_ring_num = MLX4_EN_NUM_TX_RINGS +
122 (!!pfcrx) * MLX4_EN_NUM_PPP_RINGS; 117 (!!pfcrx) * MLX4_EN_NUM_PPP_RINGS;
118 params->prof[i].rss_rings = 0;
123 } 119 }
124 120
125 return 0; 121 return 0;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 72fa807b69ce..149e60da0a32 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -702,6 +702,8 @@ int mlx4_en_start_port(struct net_device *dev)
702 /* Schedule multicast task to populate multicast list */ 702 /* Schedule multicast task to populate multicast list */
703 queue_work(mdev->workqueue, &priv->mcast_task); 703 queue_work(mdev->workqueue, &priv->mcast_task);
704 704
705 mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
706
705 priv->port_up = true; 707 priv->port_up = true;
706 netif_tx_start_all_queues(dev); 708 netif_tx_start_all_queues(dev);
707 return 0; 709 return 0;
@@ -807,38 +809,50 @@ static void mlx4_en_restart(struct work_struct *work)
807 mutex_unlock(&mdev->state_lock); 809 mutex_unlock(&mdev->state_lock);
808} 810}
809 811
810 812static void mlx4_en_clear_stats(struct net_device *dev)
811static int mlx4_en_open(struct net_device *dev)
812{ 813{
813 struct mlx4_en_priv *priv = netdev_priv(dev); 814 struct mlx4_en_priv *priv = netdev_priv(dev);
814 struct mlx4_en_dev *mdev = priv->mdev; 815 struct mlx4_en_dev *mdev = priv->mdev;
815 int i; 816 int i;
816 int err = 0;
817
818 mutex_lock(&mdev->state_lock);
819
820 if (!mdev->device_up) {
821 en_err(priv, "Cannot open - device down/disabled\n");
822 err = -EBUSY;
823 goto out;
824 }
825 817
826 /* Reset HW statistics and performance counters */
827 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) 818 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
828 en_dbg(HW, priv, "Failed dumping statistics\n"); 819 en_dbg(HW, priv, "Failed dumping statistics\n");
829 820
830 memset(&priv->stats, 0, sizeof(priv->stats)); 821 memset(&priv->stats, 0, sizeof(priv->stats));
831 memset(&priv->pstats, 0, sizeof(priv->pstats)); 822 memset(&priv->pstats, 0, sizeof(priv->pstats));
823 memset(&priv->pkstats, 0, sizeof(priv->pkstats));
824 memset(&priv->port_stats, 0, sizeof(priv->port_stats));
832 825
833 for (i = 0; i < priv->tx_ring_num; i++) { 826 for (i = 0; i < priv->tx_ring_num; i++) {
834 priv->tx_ring[i].bytes = 0; 827 priv->tx_ring[i].bytes = 0;
835 priv->tx_ring[i].packets = 0; 828 priv->tx_ring[i].packets = 0;
829 priv->tx_ring[i].tx_csum = 0;
836 } 830 }
837 for (i = 0; i < priv->rx_ring_num; i++) { 831 for (i = 0; i < priv->rx_ring_num; i++) {
838 priv->rx_ring[i].bytes = 0; 832 priv->rx_ring[i].bytes = 0;
839 priv->rx_ring[i].packets = 0; 833 priv->rx_ring[i].packets = 0;
834 priv->rx_ring[i].csum_ok = 0;
835 priv->rx_ring[i].csum_none = 0;
836 }
837}
838
839static int mlx4_en_open(struct net_device *dev)
840{
841 struct mlx4_en_priv *priv = netdev_priv(dev);
842 struct mlx4_en_dev *mdev = priv->mdev;
843 int err = 0;
844
845 mutex_lock(&mdev->state_lock);
846
847 if (!mdev->device_up) {
848 en_err(priv, "Cannot open - device down/disabled\n");
849 err = -EBUSY;
850 goto out;
840 } 851 }
841 852
853 /* Reset HW statistics and SW counters */
854 mlx4_en_clear_stats(dev);
855
842 err = mlx4_en_start_port(dev); 856 err = mlx4_en_start_port(dev);
843 if (err) 857 if (err)
844 en_err(priv, "Failed starting port:%d\n", priv->port); 858 en_err(priv, "Failed starting port:%d\n", priv->port);
@@ -878,7 +892,8 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv)
878 892
879 for (i = 0; i < priv->rx_ring_num; i++) { 893 for (i = 0; i < priv->rx_ring_num; i++) {
880 if (priv->rx_ring[i].rx_info) 894 if (priv->rx_ring[i].rx_info)
881 mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i]); 895 mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i],
896 priv->prof->rx_ring_size, priv->stride);
882 if (priv->rx_cq[i].buf) 897 if (priv->rx_cq[i].buf)
883 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); 898 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]);
884 } 899 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index e8d6ad2dce0a..d4ad8c226b51 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -168,8 +168,12 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
168 return 0; 168 return 0;
169 169
170err: 170err:
171 while (i--) 171 while (i--) {
172 dma_addr_t dma = be64_to_cpu(rx_desc->data[i].addr);
173 pci_unmap_single(priv->mdev->pdev, dma, skb_frags[i].size,
174 PCI_DMA_FROMDEVICE);
172 put_page(skb_frags[i].page); 175 put_page(skb_frags[i].page);
176 }
173 return -ENOMEM; 177 return -ENOMEM;
174} 178}
175 179
@@ -380,12 +384,12 @@ err_allocator:
380} 384}
381 385
382void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, 386void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
383 struct mlx4_en_rx_ring *ring) 387 struct mlx4_en_rx_ring *ring, u32 size, u16 stride)
384{ 388{
385 struct mlx4_en_dev *mdev = priv->mdev; 389 struct mlx4_en_dev *mdev = priv->mdev;
386 390
387 mlx4_en_unmap_buffer(&ring->wqres.buf); 391 mlx4_en_unmap_buffer(&ring->wqres.buf);
388 mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size + TXBB_SIZE); 392 mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
389 vfree(ring->rx_info); 393 vfree(ring->rx_info);
390 ring->rx_info = NULL; 394 ring->rx_info = NULL;
391} 395}
@@ -853,6 +857,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
853 struct mlx4_en_rss_map *rss_map = &priv->rss_map; 857 struct mlx4_en_rss_map *rss_map = &priv->rss_map;
854 struct mlx4_qp_context context; 858 struct mlx4_qp_context context;
855 struct mlx4_rss_context *rss_context; 859 struct mlx4_rss_context *rss_context;
860 int rss_rings;
856 void *ptr; 861 void *ptr;
857 u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 | 862 u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 |
858 MLX4_RSS_TCP_IPV6); 863 MLX4_RSS_TCP_IPV6);
@@ -893,10 +898,15 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
893 mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn, 898 mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn,
894 priv->rx_ring[0].cqn, &context); 899 priv->rx_ring[0].cqn, &context);
895 900
901 if (!priv->prof->rss_rings || priv->prof->rss_rings > priv->rx_ring_num)
902 rss_rings = priv->rx_ring_num;
903 else
904 rss_rings = priv->prof->rss_rings;
905
896 ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path) 906 ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path)
897 + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH; 907 + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH;
898 rss_context = ptr; 908 rss_context = ptr;
899 rss_context->base_qpn = cpu_to_be32(ilog2(priv->rx_ring_num) << 24 | 909 rss_context->base_qpn = cpu_to_be32(ilog2(rss_rings) << 24 |
900 (rss_map->base_qpn)); 910 (rss_map->base_qpn));
901 rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn); 911 rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn);
902 if (priv->mdev->profile.udp_rss) { 912 if (priv->mdev->profile.udp_rss) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 1e9b55eb7217..8fa41f3082cf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -513,25 +513,22 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave,
513{ 513{
514 struct mlx4_priv *priv = mlx4_priv(dev); 514 struct mlx4_priv *priv = mlx4_priv(dev);
515 struct mlx4_slave_event_eq_info *event_eq = 515 struct mlx4_slave_event_eq_info *event_eq =
516 &priv->mfunc.master.slave_state[slave].event_eq; 516 priv->mfunc.master.slave_state[slave].event_eq;
517 u32 in_modifier = vhcr->in_modifier; 517 u32 in_modifier = vhcr->in_modifier;
518 u32 eqn = in_modifier & 0x1FF; 518 u32 eqn = in_modifier & 0x1FF;
519 u64 in_param = vhcr->in_param; 519 u64 in_param = vhcr->in_param;
520 int err = 0; 520 int err = 0;
521 int i;
521 522
522 if (slave == dev->caps.function) 523 if (slave == dev->caps.function)
523 err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn, 524 err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn,
524 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B, 525 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B,
525 MLX4_CMD_NATIVE); 526 MLX4_CMD_NATIVE);
526 if (!err) { 527 if (!err)
527 if (in_modifier >> 31) { 528 for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i)
528 /* unmap */ 529 if (in_param & (1LL << i))
529 event_eq->event_type &= ~in_param; 530 event_eq[i].eqn = in_modifier >> 31 ? -1 : eqn;
530 } else { 531
531 event_eq->eqn = eqn;
532 event_eq->event_type = in_param;
533 }
534 }
535 return err; 532 return err;
536} 533}
537 534
@@ -546,7 +543,7 @@ static int mlx4_MAP_EQ(struct mlx4_dev *dev, u64 event_mask, int unmap,
546static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 543static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
547 int eq_num) 544 int eq_num)
548{ 545{
549 return mlx4_cmd(dev, mailbox->dma | dev->caps.function, eq_num, 0, 546 return mlx4_cmd(dev, mailbox->dma, eq_num, 0,
550 MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, 547 MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A,
551 MLX4_CMD_WRAPPED); 548 MLX4_CMD_WRAPPED);
552} 549}
@@ -554,7 +551,7 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
554static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 551static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
555 int eq_num) 552 int eq_num)
556{ 553{
557 return mlx4_cmd_box(dev, dev->caps.function, mailbox->dma, eq_num, 554 return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num,
558 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, 555 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A,
559 MLX4_CMD_WRAPPED); 556 MLX4_CMD_WRAPPED);
560} 557}
@@ -818,8 +815,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
818 int err; 815 int err;
819 int i; 816 int i;
820 817
821 priv->eq_table.uar_map = kcalloc(sizeof *priv->eq_table.uar_map, 818 priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev),
822 mlx4_num_eq_uar(dev), GFP_KERNEL); 819 sizeof *priv->eq_table.uar_map,
820 GFP_KERNEL);
823 if (!priv->eq_table.uar_map) { 821 if (!priv->eq_table.uar_map) {
824 err = -ENOMEM; 822 err = -ENOMEM;
825 goto err_out_free; 823 goto err_out_free;
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index a424a19280cc..9ea7cabcaf3c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -158,7 +158,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
158 158
159#define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0 159#define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0
160#define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1 160#define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1
161#define QUERY_FUNC_CAP_FUNCTION_OFFSET 0x3
162#define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4 161#define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4
163#define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10 162#define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10
164#define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14 163#define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14
@@ -182,9 +181,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
182 field = 1 << 7; /* enable only ethernet interface */ 181 field = 1 << 7; /* enable only ethernet interface */
183 MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET); 182 MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET);
184 183
185 field = slave;
186 MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FUNCTION_OFFSET);
187
188 field = dev->caps.num_ports; 184 field = dev->caps.num_ports;
189 MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); 185 MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET);
190 186
@@ -249,9 +245,6 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, struct mlx4_func_cap *func_cap)
249 goto out; 245 goto out;
250 } 246 }
251 247
252 MLX4_GET(field, outbox, QUERY_FUNC_CAP_FUNCTION_OFFSET);
253 func_cap->function = field;
254
255 MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); 248 MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET);
256 func_cap->num_ports = field; 249 func_cap->num_ports = field;
257 250
@@ -692,7 +685,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
692 return err; 685 return err;
693} 686}
694 687
695static int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port) 688int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port)
696{ 689{
697 struct mlx4_cmd_mailbox *outbox = ptr; 690 struct mlx4_cmd_mailbox *outbox = ptr;
698 691
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h
index 119e0cc9fab3..e1a5fa56bcbc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.h
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.h
@@ -119,7 +119,6 @@ struct mlx4_dev_cap {
119}; 119};
120 120
121struct mlx4_func_cap { 121struct mlx4_func_cap {
122 u8 function;
123 u8 num_ports; 122 u8 num_ports;
124 u8 flags; 123 u8 flags;
125 u32 pf_context_behaviour; 124 u32 pf_context_behaviour;
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 6bb62c580e2d..678558b502fc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -108,7 +108,7 @@ static struct mlx4_profile default_profile = {
108 .num_cq = 1 << 16, 108 .num_cq = 1 << 16,
109 .num_mcg = 1 << 13, 109 .num_mcg = 1 << 13,
110 .num_mpt = 1 << 19, 110 .num_mpt = 1 << 19,
111 .num_mtt = 1 << 20, 111 .num_mtt = 1 << 20, /* It is really num mtt segements */
112}; 112};
113 113
114static int log_num_mac = 7; 114static int log_num_mac = 7;
@@ -471,7 +471,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
471 return -ENOSYS; 471 return -ENOSYS;
472 } 472 }
473 473
474 dev->caps.function = func_cap.function;
475 dev->caps.num_ports = func_cap.num_ports; 474 dev->caps.num_ports = func_cap.num_ports;
476 dev->caps.num_qps = func_cap.qp_quota; 475 dev->caps.num_qps = func_cap.qp_quota;
477 dev->caps.num_srqs = func_cap.srq_quota; 476 dev->caps.num_srqs = func_cap.srq_quota;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index 0785d9b2a265..ca574d850b39 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -136,7 +136,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 port,
136 u32 prot; 136 u32 prot;
137 int err; 137 int err;
138 138
139 s_steer = &mlx4_priv(dev)->steer[0]; 139 s_steer = &mlx4_priv(dev)->steer[port - 1];
140 new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL); 140 new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL);
141 if (!new_entry) 141 if (!new_entry)
142 return -ENOMEM; 142 return -ENOMEM;
@@ -220,7 +220,7 @@ static int existing_steering_entry(struct mlx4_dev *dev, u8 port,
220 struct mlx4_promisc_qp *pqp; 220 struct mlx4_promisc_qp *pqp;
221 struct mlx4_promisc_qp *dqp; 221 struct mlx4_promisc_qp *dqp;
222 222
223 s_steer = &mlx4_priv(dev)->steer[0]; 223 s_steer = &mlx4_priv(dev)->steer[port - 1];
224 224
225 pqp = get_promisc_qp(dev, 0, steer, qpn); 225 pqp = get_promisc_qp(dev, 0, steer, qpn);
226 if (!pqp) 226 if (!pqp)
@@ -265,7 +265,7 @@ static bool check_duplicate_entry(struct mlx4_dev *dev, u8 port,
265 struct mlx4_steer_index *tmp_entry, *entry = NULL; 265 struct mlx4_steer_index *tmp_entry, *entry = NULL;
266 struct mlx4_promisc_qp *dqp, *tmp_dqp; 266 struct mlx4_promisc_qp *dqp, *tmp_dqp;
267 267
268 s_steer = &mlx4_priv(dev)->steer[0]; 268 s_steer = &mlx4_priv(dev)->steer[port - 1];
269 269
270 /* if qp is not promisc, it cannot be duplicated */ 270 /* if qp is not promisc, it cannot be duplicated */
271 if (!get_promisc_qp(dev, 0, steer, qpn)) 271 if (!get_promisc_qp(dev, 0, steer, qpn))
@@ -306,7 +306,7 @@ static bool can_remove_steering_entry(struct mlx4_dev *dev, u8 port,
306 bool ret = false; 306 bool ret = false;
307 int i; 307 int i;
308 308
309 s_steer = &mlx4_priv(dev)->steer[0]; 309 s_steer = &mlx4_priv(dev)->steer[port - 1];
310 310
311 mailbox = mlx4_alloc_cmd_mailbox(dev); 311 mailbox = mlx4_alloc_cmd_mailbox(dev);
312 if (IS_ERR(mailbox)) 312 if (IS_ERR(mailbox))
@@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
361 int err; 361 int err;
362 struct mlx4_priv *priv = mlx4_priv(dev); 362 struct mlx4_priv *priv = mlx4_priv(dev);
363 363
364 s_steer = &mlx4_priv(dev)->steer[0]; 364 s_steer = &mlx4_priv(dev)->steer[port - 1];
365 365
366 mutex_lock(&priv->mcg_table.mutex); 366 mutex_lock(&priv->mcg_table.mutex);
367 367
@@ -466,7 +466,7 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 port,
466 int loc, i; 466 int loc, i;
467 int err; 467 int err;
468 468
469 s_steer = &mlx4_priv(dev)->steer[0]; 469 s_steer = &mlx4_priv(dev)->steer[port - 1];
470 mutex_lock(&priv->mcg_table.mutex); 470 mutex_lock(&priv->mcg_table.mutex);
471 471
472 pqp = get_promisc_qp(dev, 0, steer, qpn); 472 pqp = get_promisc_qp(dev, 0, steer, qpn);
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_promisc_remove);
1004 1004
1005int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port) 1005int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port)
1006{ 1006{
1007 if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) 1007 if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER))
1008 return 0; 1008 return 0;
1009 1009
1010 if (mlx4_is_mfunc(dev)) 1010 if (mlx4_is_mfunc(dev))
@@ -1016,7 +1016,7 @@ EXPORT_SYMBOL_GPL(mlx4_unicast_promisc_add);
1016 1016
1017int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port) 1017int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port)
1018{ 1018{
1019 if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) 1019 if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER))
1020 return 0; 1020 return 0;
1021 1021
1022 if (mlx4_is_mfunc(dev)) 1022 if (mlx4_is_mfunc(dev))
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index a80121a2b519..c92269f8c057 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -388,9 +388,8 @@ struct mlx4_slave_eqe {
388}; 388};
389 389
390struct mlx4_slave_event_eq_info { 390struct mlx4_slave_event_eq_info {
391 u32 eqn; 391 int eqn;
392 u16 token; 392 u16 token;
393 u64 event_type;
394}; 393};
395 394
396struct mlx4_profile { 395struct mlx4_profile {
@@ -449,6 +448,8 @@ struct mlx4_steer_index {
449 struct list_head duplicates; 448 struct list_head duplicates;
450}; 449};
451 450
451#define MLX4_EVENT_TYPES_NUM 64
452
452struct mlx4_slave_state { 453struct mlx4_slave_state {
453 u8 comm_toggle; 454 u8 comm_toggle;
454 u8 last_cmd; 455 u8 last_cmd;
@@ -461,7 +462,8 @@ struct mlx4_slave_state {
461 struct mlx4_slave_eqe eq[MLX4_MFUNC_MAX_EQES]; 462 struct mlx4_slave_eqe eq[MLX4_MFUNC_MAX_EQES];
462 struct list_head mcast_filters[MLX4_MAX_PORTS + 1]; 463 struct list_head mcast_filters[MLX4_MAX_PORTS + 1];
463 struct mlx4_vlan_fltr *vlan_filter[MLX4_MAX_PORTS + 1]; 464 struct mlx4_vlan_fltr *vlan_filter[MLX4_MAX_PORTS + 1];
464 struct mlx4_slave_event_eq_info event_eq; 465 /* event type to eq number lookup */
466 struct mlx4_slave_event_eq_info event_eq[MLX4_EVENT_TYPES_NUM];
465 u16 eq_pi; 467 u16 eq_pi;
466 u16 eq_ci; 468 u16 eq_ci;
467 spinlock_t lock; 469 spinlock_t lock;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index f2a8e65f5f88..d60335f3c473 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -325,11 +325,11 @@ struct mlx4_en_port_profile {
325 u8 rx_ppp; 325 u8 rx_ppp;
326 u8 tx_pause; 326 u8 tx_pause;
327 u8 tx_ppp; 327 u8 tx_ppp;
328 int rss_rings;
328}; 329};
329 330
330struct mlx4_en_profile { 331struct mlx4_en_profile {
331 int rss_xor; 332 int rss_xor;
332 int tcp_rss;
333 int udp_rss; 333 int udp_rss;
334 u8 rss_mask; 334 u8 rss_mask;
335 u32 active_ports; 335 u32 active_ports;
@@ -476,6 +476,7 @@ struct mlx4_en_priv {
476 struct mlx4_en_perf_stats pstats; 476 struct mlx4_en_perf_stats pstats;
477 struct mlx4_en_pkt_stats pkstats; 477 struct mlx4_en_pkt_stats pkstats;
478 struct mlx4_en_port_stats port_stats; 478 struct mlx4_en_port_stats port_stats;
479 u64 stats_bitmap;
479 char *mc_addrs; 480 char *mc_addrs;
480 int mc_addrs_cnt; 481 int mc_addrs_cnt;
481 struct mlx4_en_stat_out_mbox hw_stats; 482 struct mlx4_en_stat_out_mbox hw_stats;
@@ -527,7 +528,8 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
527 struct mlx4_en_rx_ring *ring, 528 struct mlx4_en_rx_ring *ring,
528 u32 size, u16 stride); 529 u32 size, u16 stride);
529void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, 530void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
530 struct mlx4_en_rx_ring *ring); 531 struct mlx4_en_rx_ring *ring,
532 u32 size, u16 stride);
531int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); 533int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
532void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, 534void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
533 struct mlx4_en_rx_ring *ring); 535 struct mlx4_en_rx_ring *ring);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 01df5567e16e..25a80d71fb2a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -291,7 +291,7 @@ static u32 key_to_hw_index(u32 key)
291static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 291static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
292 int mpt_index) 292 int mpt_index)
293{ 293{
294 return mlx4_cmd(dev, mailbox->dma | dev->caps.function , mpt_index, 294 return mlx4_cmd(dev, mailbox->dma, mpt_index,
295 0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B, 295 0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B,
296 MLX4_CMD_WRAPPED); 296 MLX4_CMD_WRAPPED);
297} 297}
@@ -304,7 +304,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); 304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
305} 305}
306 306
307static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, 307int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
308 u32 *base_mridx) 308 u32 *base_mridx)
309{ 309{
310 struct mlx4_priv *priv = mlx4_priv(dev); 310 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -320,14 +320,14 @@ static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
320} 320}
321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range); 321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range);
322 322
323static void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt) 323void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt)
324{ 324{
325 struct mlx4_priv *priv = mlx4_priv(dev); 325 struct mlx4_priv *priv = mlx4_priv(dev);
326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt); 326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt);
327} 327}
328EXPORT_SYMBOL_GPL(mlx4_mr_release_range); 328EXPORT_SYMBOL_GPL(mlx4_mr_release_range);
329 329
330static int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd, 330int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd,
331 u64 iova, u64 size, u32 access, int npages, 331 u64 iova, u64 size, u32 access, int npages,
332 int page_shift, struct mlx4_mr *mr) 332 int page_shift, struct mlx4_mr *mr)
333{ 333{
@@ -457,7 +457,7 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
457} 457}
458EXPORT_SYMBOL_GPL(mlx4_mr_alloc); 458EXPORT_SYMBOL_GPL(mlx4_mr_alloc);
459 459
460static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) 460void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr)
461{ 461{
462 int err; 462 int err;
463 463
@@ -852,7 +852,7 @@ err_free:
852} 852}
853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); 853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
854 854
855static int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, 855int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx,
856 u32 pd, u32 access, int max_pages, 856 u32 pd, u32 access, int max_pages,
857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr) 857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr)
858{ 858{
@@ -954,7 +954,7 @@ int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
954} 954}
955EXPORT_SYMBOL_GPL(mlx4_fmr_free); 955EXPORT_SYMBOL_GPL(mlx4_fmr_free);
956 956
957static int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 957int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
958{ 958{
959 if (fmr->maps) 959 if (fmr->maps)
960 return -EBUSY; 960 return -EBUSY;
diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c
index 5c9a54df17ab..db4746d0dca7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/pd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/pd.c
@@ -52,8 +52,7 @@ int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn)
52 *pdn = mlx4_bitmap_alloc(&priv->pd_bitmap); 52 *pdn = mlx4_bitmap_alloc(&priv->pd_bitmap);
53 if (*pdn == -1) 53 if (*pdn == -1)
54 return -ENOMEM; 54 return -ENOMEM;
55 if (mlx4_is_mfunc(dev)) 55
56 *pdn |= (dev->caps.function + 1) << NOT_MASKED_PD_BITS;
57 return 0; 56 return 0;
58} 57}
59EXPORT_SYMBOL_GPL(mlx4_pd_alloc); 58EXPORT_SYMBOL_GPL(mlx4_pd_alloc);
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
index 88b52e547524..f44ae555bf43 100644
--- a/drivers/net/ethernet/mellanox/mlx4/port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/port.c
@@ -44,6 +44,11 @@
44#define MLX4_VLAN_VALID (1u << 31) 44#define MLX4_VLAN_VALID (1u << 31)
45#define MLX4_VLAN_MASK 0xfff 45#define MLX4_VLAN_MASK 0xfff
46 46
47#define MLX4_STATS_TRAFFIC_COUNTERS_MASK 0xfULL
48#define MLX4_STATS_TRAFFIC_DROPS_MASK 0xc0ULL
49#define MLX4_STATS_ERROR_COUNTERS_MASK 0x1ffc30ULL
50#define MLX4_STATS_PORT_COUNTERS_MASK 0x1fe00000ULL
51
47void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) 52void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table)
48{ 53{
49 int i; 54 int i;
@@ -898,6 +903,24 @@ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, int slave,
898 struct mlx4_cmd_mailbox *outbox, 903 struct mlx4_cmd_mailbox *outbox,
899 struct mlx4_cmd_info *cmd) 904 struct mlx4_cmd_info *cmd)
900{ 905{
906 if (slave != dev->caps.function)
907 return 0;
901 return mlx4_common_dump_eth_stats(dev, slave, 908 return mlx4_common_dump_eth_stats(dev, slave,
902 vhcr->in_modifier, outbox); 909 vhcr->in_modifier, outbox);
903} 910}
911
912void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap)
913{
914 if (!mlx4_is_mfunc(dev)) {
915 *stats_bitmap = 0;
916 return;
917 }
918
919 *stats_bitmap = (MLX4_STATS_TRAFFIC_COUNTERS_MASK |
920 MLX4_STATS_TRAFFIC_DROPS_MASK |
921 MLX4_STATS_PORT_COUNTERS_MASK);
922
923 if (mlx4_is_master(dev))
924 *stats_bitmap |= MLX4_STATS_ERROR_COUNTERS_MASK;
925}
926EXPORT_SYMBOL(mlx4_set_stats_bitmap);
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c
index 66f91ca7a7c6..1129677daa62 100644
--- a/drivers/net/ethernet/mellanox/mlx4/profile.c
+++ b/drivers/net/ethernet/mellanox/mlx4/profile.c
@@ -110,7 +110,7 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
110 profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX); 110 profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
111 profile[MLX4_RES_DMPT].num = request->num_mpt; 111 profile[MLX4_RES_DMPT].num = request->num_mpt;
112 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS; 112 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS;
113 profile[MLX4_RES_MTT].num = request->num_mtt; 113 profile[MLX4_RES_MTT].num = request->num_mtt * (1 << log_mtts_per_seg);
114 profile[MLX4_RES_MCG].num = request->num_mcg; 114 profile[MLX4_RES_MCG].num = request->num_mcg;
115 115
116 for (i = 0; i < MLX4_RES_NUM; ++i) { 116 for (i = 0; i < MLX4_RES_NUM; ++i) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 6b03ac8b9002..738f950a1ce5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -162,7 +162,7 @@ static int __mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
162 ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn = 162 ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn =
163 cpu_to_be32(qp->qpn); 163 cpu_to_be32(qp->qpn);
164 164
165 ret = mlx4_cmd(dev, mailbox->dma | dev->caps.function, 165 ret = mlx4_cmd(dev, mailbox->dma,
166 qp->qpn | (!!sqd_event << 31), 166 qp->qpn | (!!sqd_event << 31),
167 new_state == MLX4_QP_STATE_RST ? 2 : 0, 167 new_state == MLX4_QP_STATE_RST ? 2 : 0,
168 op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native); 168 op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native);
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index ed20751a057d..bfdb7af19e49 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -73,6 +73,7 @@ struct res_gid {
73 struct list_head list; 73 struct list_head list;
74 u8 gid[16]; 74 u8 gid[16];
75 enum mlx4_protocol prot; 75 enum mlx4_protocol prot;
76 enum mlx4_steer_type steer;
76}; 77};
77 78
78enum res_qp_states { 79enum res_qp_states {
@@ -374,6 +375,7 @@ static struct res_common *alloc_qp_tr(int id)
374 375
375 ret->com.res_id = id; 376 ret->com.res_id = id;
376 ret->com.state = RES_QP_RESERVED; 377 ret->com.state = RES_QP_RESERVED;
378 ret->local_qpn = id;
377 INIT_LIST_HEAD(&ret->mcg_list); 379 INIT_LIST_HEAD(&ret->mcg_list);
378 spin_lock_init(&ret->mcg_spl); 380 spin_lock_init(&ret->mcg_spl);
379 381
@@ -1561,11 +1563,6 @@ static int mr_get_mtt_size(struct mlx4_mpt_entry *mpt)
1561 return be32_to_cpu(mpt->mtt_sz); 1563 return be32_to_cpu(mpt->mtt_sz);
1562} 1564}
1563 1565
1564static int mr_get_pdn(struct mlx4_mpt_entry *mpt)
1565{
1566 return be32_to_cpu(mpt->pd_flags) & 0xffffff;
1567}
1568
1569static int qp_get_mtt_addr(struct mlx4_qp_context *qpc) 1566static int qp_get_mtt_addr(struct mlx4_qp_context *qpc)
1570{ 1567{
1571 return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8; 1568 return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8;
@@ -1602,16 +1599,6 @@ static int qp_get_mtt_size(struct mlx4_qp_context *qpc)
1602 return total_pages; 1599 return total_pages;
1603} 1600}
1604 1601
1605static int qp_get_pdn(struct mlx4_qp_context *qpc)
1606{
1607 return be32_to_cpu(qpc->pd) & 0xffffff;
1608}
1609
1610static int pdn2slave(int pdn)
1611{
1612 return (pdn >> NOT_MASKED_PD_BITS) - 1;
1613}
1614
1615static int check_mtt_range(struct mlx4_dev *dev, int slave, int start, 1602static int check_mtt_range(struct mlx4_dev *dev, int slave, int start,
1616 int size, struct res_mtt *mtt) 1603 int size, struct res_mtt *mtt)
1617{ 1604{
@@ -1656,11 +1643,6 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave,
1656 mpt->mtt = mtt; 1643 mpt->mtt = mtt;
1657 } 1644 }
1658 1645
1659 if (pdn2slave(mr_get_pdn(inbox->buf)) != slave) {
1660 err = -EPERM;
1661 goto ex_put;
1662 }
1663
1664 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); 1646 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd);
1665 if (err) 1647 if (err)
1666 goto ex_put; 1648 goto ex_put;
@@ -1792,11 +1774,6 @@ int mlx4_RST2INIT_QP_wrapper(struct mlx4_dev *dev, int slave,
1792 if (err) 1774 if (err)
1793 goto ex_put_mtt; 1775 goto ex_put_mtt;
1794 1776
1795 if (pdn2slave(qp_get_pdn(qpc)) != slave) {
1796 err = -EPERM;
1797 goto ex_put_mtt;
1798 }
1799
1800 err = get_res(dev, slave, rcqn, RES_CQ, &rcq); 1777 err = get_res(dev, slave, rcqn, RES_CQ, &rcq);
1801 if (err) 1778 if (err)
1802 goto ex_put_mtt; 1779 goto ex_put_mtt;
@@ -2048,10 +2025,10 @@ int mlx4_GEN_EQE(struct mlx4_dev *dev, int slave, struct mlx4_eqe *eqe)
2048 if (!priv->mfunc.master.slave_state) 2025 if (!priv->mfunc.master.slave_state)
2049 return -EINVAL; 2026 return -EINVAL;
2050 2027
2051 event_eq = &priv->mfunc.master.slave_state[slave].event_eq; 2028 event_eq = &priv->mfunc.master.slave_state[slave].event_eq[eqe->type];
2052 2029
2053 /* Create the event only if the slave is registered */ 2030 /* Create the event only if the slave is registered */
2054 if ((event_eq->event_type & (1 << eqe->type)) == 0) 2031 if (event_eq->eqn < 0)
2055 return 0; 2032 return 0;
2056 2033
2057 mutex_lock(&priv->mfunc.master.gen_eqe_mutex[slave]); 2034 mutex_lock(&priv->mfunc.master.gen_eqe_mutex[slave]);
@@ -2289,11 +2266,6 @@ ex_put:
2289 return err; 2266 return err;
2290} 2267}
2291 2268
2292static int srq_get_pdn(struct mlx4_srq_context *srqc)
2293{
2294 return be32_to_cpu(srqc->pd) & 0xffffff;
2295}
2296
2297static int srq_get_mtt_size(struct mlx4_srq_context *srqc) 2269static int srq_get_mtt_size(struct mlx4_srq_context *srqc)
2298{ 2270{
2299 int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf; 2271 int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf;
@@ -2333,11 +2305,6 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave,
2333 if (err) 2305 if (err)
2334 goto ex_put_mtt; 2306 goto ex_put_mtt;
2335 2307
2336 if (pdn2slave(srq_get_pdn(srqc)) != slave) {
2337 err = -EPERM;
2338 goto ex_put_mtt;
2339 }
2340
2341 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); 2308 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd);
2342 if (err) 2309 if (err)
2343 goto ex_put_mtt; 2310 goto ex_put_mtt;
@@ -2514,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave,
2514} 2481}
2515 2482
2516static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2483static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2517 u8 *gid, enum mlx4_protocol prot) 2484 u8 *gid, enum mlx4_protocol prot,
2485 enum mlx4_steer_type steer)
2518{ 2486{
2519 struct res_gid *res; 2487 struct res_gid *res;
2520 int err; 2488 int err;
@@ -2530,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2530 } else { 2498 } else {
2531 memcpy(res->gid, gid, 16); 2499 memcpy(res->gid, gid, 16);
2532 res->prot = prot; 2500 res->prot = prot;
2501 res->steer = steer;
2533 list_add_tail(&res->list, &rqp->mcg_list); 2502 list_add_tail(&res->list, &rqp->mcg_list);
2534 err = 0; 2503 err = 0;
2535 } 2504 }
@@ -2539,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2539} 2508}
2540 2509
2541static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2510static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2542 u8 *gid, enum mlx4_protocol prot) 2511 u8 *gid, enum mlx4_protocol prot,
2512 enum mlx4_steer_type steer)
2543{ 2513{
2544 struct res_gid *res; 2514 struct res_gid *res;
2545 int err; 2515 int err;
2546 2516
2547 spin_lock_irq(&rqp->mcg_spl); 2517 spin_lock_irq(&rqp->mcg_spl);
2548 res = find_gid(dev, slave, rqp, gid); 2518 res = find_gid(dev, slave, rqp, gid);
2549 if (!res || res->prot != prot) 2519 if (!res || res->prot != prot || res->steer != steer)
2550 err = -EINVAL; 2520 err = -EINVAL;
2551 else { 2521 else {
2552 list_del(&res->list); 2522 list_del(&res->list);
@@ -2573,7 +2543,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2573 int attach = vhcr->op_modifier; 2543 int attach = vhcr->op_modifier;
2574 int block_loopback = vhcr->in_modifier >> 31; 2544 int block_loopback = vhcr->in_modifier >> 31;
2575 u8 steer_type_mask = 2; 2545 u8 steer_type_mask = 2;
2576 enum mlx4_steer_type type = gid[7] & steer_type_mask; 2546 enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1;
2577 2547
2578 qpn = vhcr->in_modifier & 0xffffff; 2548 qpn = vhcr->in_modifier & 0xffffff;
2579 err = get_res(dev, slave, qpn, RES_QP, &rqp); 2549 err = get_res(dev, slave, qpn, RES_QP, &rqp);
@@ -2582,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2582 2552
2583 qp.qpn = qpn; 2553 qp.qpn = qpn;
2584 if (attach) { 2554 if (attach) {
2585 err = add_mcg_res(dev, slave, rqp, gid, prot); 2555 err = add_mcg_res(dev, slave, rqp, gid, prot, type);
2586 if (err) 2556 if (err)
2587 goto ex_put; 2557 goto ex_put;
2588 2558
@@ -2591,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2591 if (err) 2561 if (err)
2592 goto ex_rem; 2562 goto ex_rem;
2593 } else { 2563 } else {
2594 err = rem_mcg_res(dev, slave, rqp, gid, prot); 2564 err = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2595 if (err) 2565 if (err)
2596 goto ex_put; 2566 goto ex_put;
2597 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); 2567 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type);
@@ -2602,7 +2572,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2602 2572
2603ex_rem: 2573ex_rem:
2604 /* ignore error return below, already in error */ 2574 /* ignore error return below, already in error */
2605 err1 = rem_mcg_res(dev, slave, rqp, gid, prot); 2575 err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2606ex_put: 2576ex_put:
2607 put_res(dev, slave, qpn, RES_QP); 2577 put_res(dev, slave, qpn, RES_QP);
2608 2578
@@ -2641,7 +2611,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp)
2641 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { 2611 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) {
2642 qp.qpn = rqp->local_qpn; 2612 qp.qpn = rqp->local_qpn;
2643 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, 2613 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot,
2644 MLX4_MC_STEER); 2614 rgid->steer);
2645 list_del(&rgid->list); 2615 list_del(&rgid->list);
2646 kfree(rgid); 2616 kfree(rgid);
2647 } 2617 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index 2823fffc6383..feda6c00829f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -67,7 +67,7 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
67static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, 67static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
68 int srq_num) 68 int srq_num)
69{ 69{
70 return mlx4_cmd(dev, mailbox->dma | dev->caps.function, srq_num, 0, 70 return mlx4_cmd(dev, mailbox->dma, srq_num, 0,
71 MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A, 71 MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A,
72 MLX4_CMD_WRAPPED); 72 MLX4_CMD_WRAPPED);
73} 73}
diff --git a/drivers/net/ethernet/micrel/Kconfig b/drivers/net/ethernet/micrel/Kconfig
index 1ea811cf515b..fe42fc00d8d3 100644
--- a/drivers/net/ethernet/micrel/Kconfig
+++ b/drivers/net/ethernet/micrel/Kconfig
@@ -42,7 +42,6 @@ config KS8851
42 select NET_CORE 42 select NET_CORE
43 select MII 43 select MII
44 select CRC32 44 select CRC32
45 select MISC_DEVICES
46 select EEPROM_93CX6 45 select EEPROM_93CX6
47 ---help--- 46 ---help---
48 SPI driver for Micrel KS8851 SPI attached network chip. 47 SPI driver for Micrel KS8851 SPI attached network chip.
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 6b35e7da9a9c..0c3e4005224d 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -583,7 +583,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
583 ks8851_dbg_dumpkkt(ks, rxpkt); 583 ks8851_dbg_dumpkkt(ks, rxpkt);
584 584
585 skb->protocol = eth_type_trans(skb, ks->netdev); 585 skb->protocol = eth_type_trans(skb, ks->netdev);
586 netif_rx(skb); 586 netif_rx_ni(skb);
587 587
588 ks->netdev->stats.rx_packets++; 588 ks->netdev->stats.rx_packets++;
589 ks->netdev->stats.rx_bytes += rxlen; 589 ks->netdev->stats.rx_bytes += rxlen;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index e58e78e5c930..231176fcd2ba 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -394,7 +394,6 @@ union ks_tx_hdr {
394 * @msg_enable : The message flags controlling driver output (see ethtool). 394 * @msg_enable : The message flags controlling driver output (see ethtool).
395 * @frame_cnt : number of frames received. 395 * @frame_cnt : number of frames received.
396 * @bus_width : i/o bus width. 396 * @bus_width : i/o bus width.
397 * @irq : irq number assigned to this device.
398 * @rc_rxqcr : Cached copy of KS_RXQCR. 397 * @rc_rxqcr : Cached copy of KS_RXQCR.
399 * @rc_txcr : Cached copy of KS_TXCR. 398 * @rc_txcr : Cached copy of KS_TXCR.
400 * @rc_ier : Cached copy of KS_IER. 399 * @rc_ier : Cached copy of KS_IER.
@@ -441,7 +440,6 @@ struct ks_net {
441 u32 msg_enable; 440 u32 msg_enable;
442 u32 frame_cnt; 441 u32 frame_cnt;
443 int bus_width; 442 int bus_width;
444 int irq;
445 443
446 u16 rc_rxqcr; 444 u16 rc_rxqcr;
447 u16 rc_txcr; 445 u16 rc_txcr;
@@ -907,10 +905,10 @@ static int ks_net_open(struct net_device *netdev)
907 netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__); 905 netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__);
908 906
909 /* reset the HW */ 907 /* reset the HW */
910 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); 908 err = request_irq(netdev->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev);
911 909
912 if (err) { 910 if (err) {
913 pr_err("Failed to request IRQ: %d: %d\n", ks->irq, err); 911 pr_err("Failed to request IRQ: %d: %d\n", netdev->irq, err);
914 return err; 912 return err;
915 } 913 }
916 914
@@ -955,7 +953,7 @@ static int ks_net_stop(struct net_device *netdev)
955 953
956 /* set powermode to soft power down to save power */ 954 /* set powermode to soft power down to save power */
957 ks_set_powermode(ks, PMECR_PM_SOFTDOWN); 955 ks_set_powermode(ks, PMECR_PM_SOFTDOWN);
958 free_irq(ks->irq, netdev); 956 free_irq(netdev->irq, netdev);
959 mutex_unlock(&ks->lock); 957 mutex_unlock(&ks->lock);
960 return 0; 958 return 0;
961} 959}
@@ -1545,10 +1543,10 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1545 if (!ks->hw_addr_cmd) 1543 if (!ks->hw_addr_cmd)
1546 goto err_ioremap1; 1544 goto err_ioremap1;
1547 1545
1548 ks->irq = platform_get_irq(pdev, 0); 1546 netdev->irq = platform_get_irq(pdev, 0);
1549 1547
1550 if (ks->irq < 0) { 1548 if (netdev->irq < 0) {
1551 err = ks->irq; 1549 err = netdev->irq;
1552 goto err_get_irq; 1550 goto err_get_irq;
1553 } 1551 }
1554 1552
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 212f43b308a3..cd827ff4a021 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -670,7 +670,7 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
670static int octeon_mgmt_init_phy(struct net_device *netdev) 670static int octeon_mgmt_init_phy(struct net_device *netdev)
671{ 671{
672 struct octeon_mgmt *p = netdev_priv(netdev); 672 struct octeon_mgmt *p = netdev_priv(netdev);
673 char phy_id[20]; 673 char phy_id[MII_BUS_ID_SIZE + 3];
674 674
675 if (octeon_is_simulation()) { 675 if (octeon_is_simulation()) {
676 /* No PHYs in the simulator. */ 676 /* No PHYs in the simulator. */
@@ -678,7 +678,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev)
678 return 0; 678 return 0;
679 } 679 }
680 680
681 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port); 681 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port);
682 682
683 p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, 683 p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
684 PHY_INTERFACE_MODE_MII); 684 PHY_INTERFACE_MODE_MII);
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 964e9c0948bc..3ead111111e1 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -1745,6 +1745,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
1745 struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; 1745 struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring;
1746 int err; 1746 int err;
1747 1747
1748 /* Ensure we have a valid MAC */
1749 if (!is_valid_ether_addr(adapter->hw.mac.addr)) {
1750 pr_err("Error: Invalid MAC address\n");
1751 return -EINVAL;
1752 }
1753
1748 /* hardware has been reset, we need to reload some things */ 1754 /* hardware has been reset, we need to reload some things */
1749 pch_gbe_set_multi(netdev); 1755 pch_gbe_set_multi(netdev);
1750 1756
@@ -2468,9 +2474,14 @@ static int pch_gbe_probe(struct pci_dev *pdev,
2468 2474
2469 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); 2475 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
2470 if (!is_valid_ether_addr(netdev->dev_addr)) { 2476 if (!is_valid_ether_addr(netdev->dev_addr)) {
2471 dev_err(&pdev->dev, "Invalid MAC Address\n"); 2477 /*
2472 ret = -EIO; 2478 * If the MAC is invalid (or just missing), display a warning
2473 goto err_free_adapter; 2479 * but do not abort setting up the device. pch_gbe_up will
2480 * prevent the interface from being brought up until a valid MAC
2481 * is set.
2482 */
2483 dev_err(&pdev->dev, "Invalid MAC address, "
2484 "interface disabled.\n");
2474 } 2485 }
2475 setup_timer(&adapter->watchdog_timer, pch_gbe_watchdog, 2486 setup_timer(&adapter->watchdog_timer, pch_gbe_watchdog,
2476 (unsigned long)adapter); 2487 (unsigned long)adapter);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 813d41c4a845..87b650131774 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -38,6 +38,7 @@
38#include <linux/pm_runtime.h> 38#include <linux/pm_runtime.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/ethtool.h> 40#include <linux/ethtool.h>
41#include <linux/if_vlan.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"
@@ -817,7 +818,8 @@ static int sh_eth_dev_init(struct net_device *ndev)
817 sh_eth_write(ndev, 0, TRIMD); 818 sh_eth_write(ndev, 0, TRIMD);
818 819
819 /* Recv frame limit set register */ 820 /* Recv frame limit set register */
820 sh_eth_write(ndev, RFLR_VALUE, RFLR); 821 sh_eth_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN,
822 RFLR);
821 823
822 sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); 824 sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
823 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); 825 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 47877b13ffad..cdbd844662a7 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -575,9 +575,6 @@ enum RPADIR_BIT {
575 RPADIR_PADR = 0x0003f, 575 RPADIR_PADR = 0x0003f,
576}; 576};
577 577
578/* RFLR */
579#define RFLR_VALUE 0x1000
580
581/* FDR */ 578/* FDR */
582#define DEFAULT_FDR_INIT 0x00000707 579#define DEFAULT_FDR_INIT 0x00000707
583 580
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index d0b814ef0675..0319d640f728 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -67,6 +67,7 @@ struct stmmac_extra_stats {
67 unsigned long ipc_csum_error; 67 unsigned long ipc_csum_error;
68 unsigned long rx_collision; 68 unsigned long rx_collision;
69 unsigned long rx_crc; 69 unsigned long rx_crc;
70 unsigned long dribbling_bit;
70 unsigned long rx_length; 71 unsigned long rx_length;
71 unsigned long rx_mii; 72 unsigned long rx_mii;
72 unsigned long rx_multicast; 73 unsigned long rx_multicast;
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index d87976364ec5..ad1b627f8ec2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -201,7 +201,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
201 201
202 if (unlikely(p->des01.erx.dribbling)) { 202 if (unlikely(p->des01.erx.dribbling)) {
203 CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n"); 203 CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n");
204 ret = discard_frame; 204 x->dribbling_bit++;
205 } 205 }
206 if (unlikely(p->des01.erx.sa_filter_fail)) { 206 if (unlikely(p->des01.erx.sa_filter_fail)) {
207 CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); 207 CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n");
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index fda5d2b31d3a..25953bb45a73 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -104,7 +104,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
104 ret = discard_frame; 104 ret = discard_frame;
105 } 105 }
106 if (unlikely(p->des01.rx.dribbling)) 106 if (unlikely(p->des01.rx.dribbling))
107 ret = discard_frame; 107 x->dribbling_bit++;
108 108
109 if (unlikely(p->des01.rx.length_error)) { 109 if (unlikely(p->des01.rx.length_error)) {
110 x->rx_length++; 110 x->rx_length++;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 120740020e2c..b4b095fdcf29 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -21,7 +21,7 @@
21*******************************************************************************/ 21*******************************************************************************/
22 22
23#define STMMAC_RESOURCE_NAME "stmmaceth" 23#define STMMAC_RESOURCE_NAME "stmmaceth"
24#define DRV_MODULE_VERSION "Dec_2011" 24#define DRV_MODULE_VERSION "Feb_2012"
25#include <linux/stmmac.h> 25#include <linux/stmmac.h>
26#include <linux/phy.h> 26#include <linux/phy.h>
27#include "common.h" 27#include "common.h"
@@ -97,4 +97,5 @@ int stmmac_resume(struct net_device *ndev);
97int stmmac_suspend(struct net_device *ndev); 97int stmmac_suspend(struct net_device *ndev);
98int stmmac_dvr_remove(struct net_device *ndev); 98int stmmac_dvr_remove(struct net_device *ndev);
99struct stmmac_priv *stmmac_dvr_probe(struct device *device, 99struct stmmac_priv *stmmac_dvr_probe(struct device *device,
100 struct plat_stmmacenet_data *plat_dat); 100 struct plat_stmmacenet_data *plat_dat,
101 void __iomem *addr);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 9573303a706b..f98e1511660f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -47,23 +47,25 @@ struct stmmac_stats {
47 offsetof(struct stmmac_priv, xstats.m)} 47 offsetof(struct stmmac_priv, xstats.m)}
48 48
49static const struct stmmac_stats stmmac_gstrings_stats[] = { 49static const struct stmmac_stats stmmac_gstrings_stats[] = {
50 /* Transmit errors */
50 STMMAC_STAT(tx_underflow), 51 STMMAC_STAT(tx_underflow),
51 STMMAC_STAT(tx_carrier), 52 STMMAC_STAT(tx_carrier),
52 STMMAC_STAT(tx_losscarrier), 53 STMMAC_STAT(tx_losscarrier),
53 STMMAC_STAT(vlan_tag), 54 STMMAC_STAT(vlan_tag),
54 STMMAC_STAT(tx_deferred), 55 STMMAC_STAT(tx_deferred),
55 STMMAC_STAT(tx_vlan), 56 STMMAC_STAT(tx_vlan),
56 STMMAC_STAT(rx_vlan),
57 STMMAC_STAT(tx_jabber), 57 STMMAC_STAT(tx_jabber),
58 STMMAC_STAT(tx_frame_flushed), 58 STMMAC_STAT(tx_frame_flushed),
59 STMMAC_STAT(tx_payload_error), 59 STMMAC_STAT(tx_payload_error),
60 STMMAC_STAT(tx_ip_header_error), 60 STMMAC_STAT(tx_ip_header_error),
61 /* Receive errors */
61 STMMAC_STAT(rx_desc), 62 STMMAC_STAT(rx_desc),
62 STMMAC_STAT(sa_filter_fail), 63 STMMAC_STAT(sa_filter_fail),
63 STMMAC_STAT(overflow_error), 64 STMMAC_STAT(overflow_error),
64 STMMAC_STAT(ipc_csum_error), 65 STMMAC_STAT(ipc_csum_error),
65 STMMAC_STAT(rx_collision), 66 STMMAC_STAT(rx_collision),
66 STMMAC_STAT(rx_crc), 67 STMMAC_STAT(rx_crc),
68 STMMAC_STAT(dribbling_bit),
67 STMMAC_STAT(rx_length), 69 STMMAC_STAT(rx_length),
68 STMMAC_STAT(rx_mii), 70 STMMAC_STAT(rx_mii),
69 STMMAC_STAT(rx_multicast), 71 STMMAC_STAT(rx_multicast),
@@ -73,6 +75,8 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
73 STMMAC_STAT(sa_rx_filter_fail), 75 STMMAC_STAT(sa_rx_filter_fail),
74 STMMAC_STAT(rx_missed_cntr), 76 STMMAC_STAT(rx_missed_cntr),
75 STMMAC_STAT(rx_overflow_cntr), 77 STMMAC_STAT(rx_overflow_cntr),
78 STMMAC_STAT(rx_vlan),
79 /* Tx/Rx IRQ errors */
76 STMMAC_STAT(tx_undeflow_irq), 80 STMMAC_STAT(tx_undeflow_irq),
77 STMMAC_STAT(tx_process_stopped_irq), 81 STMMAC_STAT(tx_process_stopped_irq),
78 STMMAC_STAT(tx_jabber_irq), 82 STMMAC_STAT(tx_jabber_irq),
@@ -82,6 +86,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
82 STMMAC_STAT(rx_watchdog_irq), 86 STMMAC_STAT(rx_watchdog_irq),
83 STMMAC_STAT(tx_early_irq), 87 STMMAC_STAT(tx_early_irq),
84 STMMAC_STAT(fatal_bus_error_irq), 88 STMMAC_STAT(fatal_bus_error_irq),
89 /* Extra info */
85 STMMAC_STAT(threshold), 90 STMMAC_STAT(threshold),
86 STMMAC_STAT(tx_pkt_n), 91 STMMAC_STAT(tx_pkt_n),
87 STMMAC_STAT(rx_pkt_n), 92 STMMAC_STAT(rx_pkt_n),
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 96fa2da30763..6ee593a55a64 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -241,7 +241,7 @@ static void stmmac_adjust_link(struct net_device *dev)
241 case 1000: 241 case 1000:
242 if (likely(priv->plat->has_gmac)) 242 if (likely(priv->plat->has_gmac))
243 ctrl &= ~priv->hw->link.port; 243 ctrl &= ~priv->hw->link.port;
244 stmmac_hw_fix_mac_speed(priv); 244 stmmac_hw_fix_mac_speed(priv);
245 break; 245 break;
246 case 100: 246 case 100:
247 case 10: 247 case 10:
@@ -785,7 +785,7 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
785 u32 uid = ((hwid & 0x0000ff00) >> 8); 785 u32 uid = ((hwid & 0x0000ff00) >> 8);
786 u32 synid = (hwid & 0x000000ff); 786 u32 synid = (hwid & 0x000000ff);
787 787
788 pr_info("STMMAC - user ID: 0x%x, Synopsys ID: 0x%x\n", 788 pr_info("stmmac - user ID: 0x%x, Synopsys ID: 0x%x\n",
789 uid, synid); 789 uid, synid);
790 790
791 return synid; 791 return synid;
@@ -869,38 +869,6 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
869 return hw_cap; 869 return hw_cap;
870} 870}
871 871
872/**
873 * stmmac_mac_device_setup
874 * @dev : device pointer
875 * Description: this is to attach the GMAC or MAC 10/100
876 * main core structures that will be completed during the
877 * open step.
878 */
879static int stmmac_mac_device_setup(struct net_device *dev)
880{
881 struct stmmac_priv *priv = netdev_priv(dev);
882
883 struct mac_device_info *device;
884
885 if (priv->plat->has_gmac)
886 device = dwmac1000_setup(priv->ioaddr);
887 else
888 device = dwmac100_setup(priv->ioaddr);
889
890 if (!device)
891 return -ENOMEM;
892
893 priv->hw = device;
894 priv->hw->ring = &ring_mode_ops;
895
896 if (device_can_wakeup(priv->device)) {
897 priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
898 enable_irq_wake(priv->wol_irq);
899 }
900
901 return 0;
902}
903
904static void stmmac_check_ether_addr(struct stmmac_priv *priv) 872static void stmmac_check_ether_addr(struct stmmac_priv *priv)
905{ 873{
906 /* verify if the MAC address is valid, in case of failures it 874 /* verify if the MAC address is valid, in case of failures it
@@ -930,20 +898,8 @@ static int stmmac_open(struct net_device *dev)
930 struct stmmac_priv *priv = netdev_priv(dev); 898 struct stmmac_priv *priv = netdev_priv(dev);
931 int ret; 899 int ret;
932 900
933 /* MAC HW device setup */
934 ret = stmmac_mac_device_setup(dev);
935 if (ret < 0)
936 return ret;
937
938 stmmac_check_ether_addr(priv); 901 stmmac_check_ether_addr(priv);
939 902
940 stmmac_verify_args();
941
942 /* Override with kernel parameters if supplied XXX CRS XXX
943 * this needs to have multiple instances */
944 if ((phyaddr >= 0) && (phyaddr <= 31))
945 priv->plat->phy_addr = phyaddr;
946
947 /* MDIO bus Registration */ 903 /* MDIO bus Registration */
948 ret = stmmac_mdio_register(dev); 904 ret = stmmac_mdio_register(dev);
949 if (ret < 0) { 905 if (ret < 0) {
@@ -976,44 +932,6 @@ static int stmmac_open(struct net_device *dev)
976 goto open_error; 932 goto open_error;
977 } 933 }
978 934
979 stmmac_get_synopsys_id(priv);
980
981 priv->hw_cap_support = stmmac_get_hw_features(priv);
982
983 if (priv->hw_cap_support) {
984 pr_info(" Support DMA HW capability register");
985
986 /* We can override some gmac/dma configuration fields: e.g.
987 * enh_desc, tx_coe (e.g. that are passed through the
988 * platform) with the values from the HW capability
989 * register (if supported).
990 */
991 priv->plat->enh_desc = priv->dma_cap.enh_desc;
992 priv->plat->tx_coe = priv->dma_cap.tx_coe;
993 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
994
995 /* By default disable wol on magic frame if not supported */
996 if (!priv->dma_cap.pmt_magic_frame)
997 priv->wolopts &= ~WAKE_MAGIC;
998
999 } else
1000 pr_info(" No HW DMA feature register supported");
1001
1002 /* Select the enhnaced/normal descriptor structures */
1003 stmmac_selec_desc_mode(priv);
1004
1005 /* PMT module is not integrated in all the MAC devices. */
1006 if (priv->plat->pmt) {
1007 pr_info(" Remote wake-up capable\n");
1008 device_set_wakeup_capable(priv->device, 1);
1009 }
1010
1011 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
1012 if (priv->rx_coe)
1013 pr_info(" Checksum Offload Engine supported\n");
1014 if (priv->plat->tx_coe)
1015 pr_info(" Checksum insertion supported\n");
1016
1017 /* Create and initialize the TX/RX descriptors chains. */ 935 /* Create and initialize the TX/RX descriptors chains. */
1018 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 936 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
1019 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 937 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
@@ -1030,14 +948,14 @@ static int stmmac_open(struct net_device *dev)
1030 948
1031 /* Copy the MAC addr into the HW */ 949 /* Copy the MAC addr into the HW */
1032 priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0); 950 priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
951
1033 /* If required, perform hw setup of the bus. */ 952 /* If required, perform hw setup of the bus. */
1034 if (priv->plat->bus_setup) 953 if (priv->plat->bus_setup)
1035 priv->plat->bus_setup(priv->ioaddr); 954 priv->plat->bus_setup(priv->ioaddr);
955
1036 /* Initialize the MAC Core */ 956 /* Initialize the MAC Core */
1037 priv->hw->mac->core_init(priv->ioaddr); 957 priv->hw->mac->core_init(priv->ioaddr);
1038 958
1039 netdev_update_features(dev);
1040
1041 /* Request the IRQ lines */ 959 /* Request the IRQ lines */
1042 ret = request_irq(dev->irq, stmmac_interrupt, 960 ret = request_irq(dev->irq, stmmac_interrupt,
1043 IRQF_SHARED, dev->name, dev); 961 IRQF_SHARED, dev->name, dev);
@@ -1047,6 +965,17 @@ static int stmmac_open(struct net_device *dev)
1047 goto open_error; 965 goto open_error;
1048 } 966 }
1049 967
968 /* Request the Wake IRQ in case of another line is used for WoL */
969 if (priv->wol_irq != dev->irq) {
970 ret = request_irq(priv->wol_irq, stmmac_interrupt,
971 IRQF_SHARED, dev->name, dev);
972 if (unlikely(ret < 0)) {
973 pr_err("%s: ERROR: allocating the ext WoL IRQ %d "
974 "(error: %d)\n", __func__, priv->wol_irq, ret);
975 goto open_error_wolirq;
976 }
977 }
978
1050 /* Enable the MAC Rx/Tx */ 979 /* Enable the MAC Rx/Tx */
1051 stmmac_set_mac(priv->ioaddr, true); 980 stmmac_set_mac(priv->ioaddr, true);
1052 981
@@ -1062,7 +991,7 @@ static int stmmac_open(struct net_device *dev)
1062#ifdef CONFIG_STMMAC_DEBUG_FS 991#ifdef CONFIG_STMMAC_DEBUG_FS
1063 ret = stmmac_init_fs(dev); 992 ret = stmmac_init_fs(dev);
1064 if (ret < 0) 993 if (ret < 0)
1065 pr_warning("\tFailed debugFS registration"); 994 pr_warning("%s: failed debugFS registration\n", __func__);
1066#endif 995#endif
1067 /* Start the ball rolling... */ 996 /* Start the ball rolling... */
1068 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); 997 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name);
@@ -1072,6 +1001,7 @@ static int stmmac_open(struct net_device *dev)
1072#ifdef CONFIG_STMMAC_TIMER 1001#ifdef CONFIG_STMMAC_TIMER
1073 priv->tm->timer_start(tmrate); 1002 priv->tm->timer_start(tmrate);
1074#endif 1003#endif
1004
1075 /* Dump DMA/MAC registers */ 1005 /* Dump DMA/MAC registers */
1076 if (netif_msg_hw(priv)) { 1006 if (netif_msg_hw(priv)) {
1077 priv->hw->mac->dump_regs(priv->ioaddr); 1007 priv->hw->mac->dump_regs(priv->ioaddr);
@@ -1087,6 +1017,9 @@ static int stmmac_open(struct net_device *dev)
1087 1017
1088 return 0; 1018 return 0;
1089 1019
1020open_error_wolirq:
1021 free_irq(dev->irq, dev);
1022
1090open_error: 1023open_error:
1091#ifdef CONFIG_STMMAC_TIMER 1024#ifdef CONFIG_STMMAC_TIMER
1092 kfree(priv->tm); 1025 kfree(priv->tm);
@@ -1127,6 +1060,8 @@ static int stmmac_release(struct net_device *dev)
1127 1060
1128 /* Free the IRQ lines */ 1061 /* Free the IRQ lines */
1129 free_irq(dev->irq, dev); 1062 free_irq(dev->irq, dev);
1063 if (priv->wol_irq != dev->irq)
1064 free_irq(priv->wol_irq, dev);
1130 1065
1131 /* Stop TX/RX DMA and clear the descriptors */ 1066 /* Stop TX/RX DMA and clear the descriptors */
1132 priv->hw->dma->stop_tx(priv->ioaddr); 1067 priv->hw->dma->stop_tx(priv->ioaddr);
@@ -1789,13 +1724,77 @@ static const struct net_device_ops stmmac_netdev_ops = {
1789}; 1724};
1790 1725
1791/** 1726/**
1727 * stmmac_hw_init - Init the MAC device
1728 * @priv : pointer to the private device structure.
1729 * Description: this function detects which MAC device
1730 * (GMAC/MAC10-100) has to attached, checks the HW capability
1731 * (if supported) and sets the driver's features (for example
1732 * to use the ring or chaine mode or support the normal/enh
1733 * descriptor structure).
1734 */
1735static int stmmac_hw_init(struct stmmac_priv *priv)
1736{
1737 int ret = 0;
1738 struct mac_device_info *mac;
1739
1740 /* Identify the MAC HW device */
1741 if (priv->plat->has_gmac)
1742 mac = dwmac1000_setup(priv->ioaddr);
1743 else
1744 mac = dwmac100_setup(priv->ioaddr);
1745 if (!mac)
1746 return -ENOMEM;
1747
1748 priv->hw = mac;
1749
1750 /* To use the chained or ring mode */
1751 priv->hw->ring = &ring_mode_ops;
1752
1753 /* Get and dump the chip ID */
1754 stmmac_get_synopsys_id(priv);
1755
1756 /* Get the HW capability (new GMAC newer than 3.50a) */
1757 priv->hw_cap_support = stmmac_get_hw_features(priv);
1758 if (priv->hw_cap_support) {
1759 pr_info(" DMA HW capability register supported");
1760
1761 /* We can override some gmac/dma configuration fields: e.g.
1762 * enh_desc, tx_coe (e.g. that are passed through the
1763 * platform) with the values from the HW capability
1764 * register (if supported).
1765 */
1766 priv->plat->enh_desc = priv->dma_cap.enh_desc;
1767 priv->plat->tx_coe = priv->dma_cap.tx_coe;
1768 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
1769 } else
1770 pr_info(" No HW DMA feature register supported");
1771
1772 /* Select the enhnaced/normal descriptor structures */
1773 stmmac_selec_desc_mode(priv);
1774
1775 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
1776 if (priv->rx_coe)
1777 pr_info(" RX Checksum Offload Engine supported\n");
1778 if (priv->plat->tx_coe)
1779 pr_info(" TX Checksum insertion supported\n");
1780
1781 if (priv->plat->pmt) {
1782 pr_info(" Wake-Up On Lan supported\n");
1783 device_set_wakeup_capable(priv->device, 1);
1784 }
1785
1786 return ret;
1787}
1788
1789/**
1792 * stmmac_dvr_probe 1790 * stmmac_dvr_probe
1793 * @device: device pointer 1791 * @device: device pointer
1794 * Description: this is the main probe function used to 1792 * Description: this is the main probe function used to
1795 * call the alloc_etherdev, allocate the priv structure. 1793 * call the alloc_etherdev, allocate the priv structure.
1796 */ 1794 */
1797struct stmmac_priv *stmmac_dvr_probe(struct device *device, 1795struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1798 struct plat_stmmacenet_data *plat_dat) 1796 struct plat_stmmacenet_data *plat_dat,
1797 void __iomem *addr)
1799{ 1798{
1800 int ret = 0; 1799 int ret = 0;
1801 struct net_device *ndev = NULL; 1800 struct net_device *ndev = NULL;
@@ -1815,10 +1814,27 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1815 1814
1816 ether_setup(ndev); 1815 ether_setup(ndev);
1817 1816
1818 ndev->netdev_ops = &stmmac_netdev_ops;
1819 stmmac_set_ethtool_ops(ndev); 1817 stmmac_set_ethtool_ops(ndev);
1818 priv->pause = pause;
1819 priv->plat = plat_dat;
1820 priv->ioaddr = addr;
1821 priv->dev->base_addr = (unsigned long)addr;
1822
1823 /* Verify driver arguments */
1824 stmmac_verify_args();
1825
1826 /* Override with kernel parameters if supplied XXX CRS XXX
1827 * this needs to have multiple instances */
1828 if ((phyaddr >= 0) && (phyaddr <= 31))
1829 priv->plat->phy_addr = phyaddr;
1830
1831 /* Init MAC and get the capabilities */
1832 stmmac_hw_init(priv);
1833
1834 ndev->netdev_ops = &stmmac_netdev_ops;
1820 1835
1821 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 1836 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1837 NETIF_F_RXCSUM;
1822 ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; 1838 ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
1823 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 1839 ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
1824#ifdef STMMAC_VLAN_TAG_USED 1840#ifdef STMMAC_VLAN_TAG_USED
@@ -1830,8 +1846,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1830 if (flow_ctrl) 1846 if (flow_ctrl)
1831 priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ 1847 priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */
1832 1848
1833 priv->pause = pause;
1834 priv->plat = plat_dat;
1835 netif_napi_add(ndev, &priv->napi, stmmac_poll, 64); 1849 netif_napi_add(ndev, &priv->napi, stmmac_poll, 64);
1836 1850
1837 spin_lock_init(&priv->lock); 1851 spin_lock_init(&priv->lock);
@@ -1839,15 +1853,10 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1839 1853
1840 ret = register_netdev(ndev); 1854 ret = register_netdev(ndev);
1841 if (ret) { 1855 if (ret) {
1842 pr_err("%s: ERROR %i registering the device\n", 1856 pr_err("%s: ERROR %i registering the device\n", __func__, ret);
1843 __func__, ret);
1844 goto error; 1857 goto error;
1845 } 1858 }
1846 1859
1847 DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n",
1848 ndev->name, (ndev->features & NETIF_F_SG) ? "on" : "off",
1849 (ndev->features & NETIF_F_IP_CSUM) ? "on" : "off");
1850
1851 return priv; 1860 return priv;
1852 1861
1853error: 1862error:
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index da4a1042523a..73195329aa46 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -154,7 +154,7 @@ int stmmac_mdio_register(struct net_device *ndev)
154 else 154 else
155 irqlist = priv->mii_irq; 155 irqlist = priv->mii_irq;
156 156
157 new_bus->name = "STMMAC MII Bus"; 157 new_bus->name = "stmmac";
158 new_bus->read = &stmmac_mdio_read; 158 new_bus->read = &stmmac_mdio_read;
159 new_bus->write = &stmmac_mdio_write; 159 new_bus->write = &stmmac_mdio_write;
160 new_bus->reset = &stmmac_mdio_reset; 160 new_bus->reset = &stmmac_mdio_reset;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 54a819a36487..50ad5b80cfaf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -96,13 +96,11 @@ static int __devinit stmmac_pci_probe(struct pci_dev *pdev,
96 96
97 stmmac_default_data(); 97 stmmac_default_data();
98 98
99 priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat); 99 priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr);
100 if (!priv) { 100 if (!priv) {
101 pr_err("%s: main drivr probe failed", __func__); 101 pr_err("%s: main driver probe failed", __func__);
102 goto err_out; 102 goto err_out;
103 } 103 }
104 priv->ioaddr = addr;
105 priv->dev->base_addr = (unsigned long)addr;
106 priv->dev->irq = pdev->irq; 104 priv->dev->irq = pdev->irq;
107 priv->wol_irq = pdev->irq; 105 priv->wol_irq = pdev->irq;
108 106
@@ -170,9 +168,9 @@ static int stmmac_pci_resume(struct pci_dev *pdev)
170#define STMMAC_DEVICE_ID 0x1108 168#define STMMAC_DEVICE_ID 0x1108
171 169
172static DEFINE_PCI_DEVICE_TABLE(stmmac_id_table) = { 170static DEFINE_PCI_DEVICE_TABLE(stmmac_id_table) = {
173 { 171 {PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)},
174 PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)}, { 172 {PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_MAC)},
175 } 173 {}
176}; 174};
177 175
178MODULE_DEVICE_TABLE(pci, stmmac_id_table); 176MODULE_DEVICE_TABLE(pci, stmmac_id_table);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac83243649a..3aad9810237c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -59,16 +59,20 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
59 goto out_release_region; 59 goto out_release_region;
60 } 60 }
61 plat_dat = pdev->dev.platform_data; 61 plat_dat = pdev->dev.platform_data;
62 priv = stmmac_dvr_probe(&(pdev->dev), plat_dat); 62
63 /* Custom initialisation (if needed)*/
64 if (plat_dat->init) {
65 ret = plat_dat->init(pdev);
66 if (unlikely(ret))
67 goto out_unmap;
68 }
69
70 priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
63 if (!priv) { 71 if (!priv) {
64 pr_err("%s: main drivr probe failed", __func__); 72 pr_err("%s: main driver probe failed", __func__);
65 goto out_unmap; 73 goto out_unmap;
66 } 74 }
67 75
68 priv->ioaddr = addr;
69 /* Set the I/O base addr */
70 priv->dev->base_addr = (unsigned long)addr;
71
72 /* Get the MAC information */ 76 /* Get the MAC information */
73 priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); 77 priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
74 if (priv->dev->irq == -ENXIO) { 78 if (priv->dev->irq == -ENXIO) {
@@ -92,13 +96,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
92 96
93 platform_set_drvdata(pdev, priv->dev); 97 platform_set_drvdata(pdev, priv->dev);
94 98
95 /* Custom initialisation */
96 if (priv->plat->init) {
97 ret = priv->plat->init(pdev);
98 if (unlikely(ret))
99 goto out_unmap;
100 }
101
102 pr_debug("STMMAC platform driver registration completed"); 99 pr_debug("STMMAC platform driver registration completed");
103 100
104 return 0; 101 return 0;
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 4d9a28ffd3c3..cbc8df78d84b 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1122,7 +1122,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1122 pdata = pdev->dev.platform_data; 1122 pdata = pdev->dev.platform_data;
1123 1123
1124 if (external_switch || dumb_switch) { 1124 if (external_switch || dumb_switch) {
1125 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ 1125 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
1126 phy_id = pdev->id; 1126 phy_id = pdev->id;
1127 } else { 1127 } else {
1128 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { 1128 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
@@ -1138,7 +1138,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1138 if (phy_id == PHY_MAX_ADDR) { 1138 if (phy_id == PHY_MAX_ADDR) {
1139 dev_err(&pdev->dev, "no PHY present, falling back " 1139 dev_err(&pdev->dev, "no PHY present, falling back "
1140 "to switch on MDIO bus 0\n"); 1140 "to switch on MDIO bus 0\n");
1141 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ 1141 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
1142 phy_id = pdev->id; 1142 phy_id = pdev->id;
1143 } 1143 }
1144 1144
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 794ac30a577b..4fa0bcb25dfc 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1600,8 +1600,9 @@ static int emac_dev_open(struct net_device *ndev)
1600 if (IS_ERR(priv->phydev)) { 1600 if (IS_ERR(priv->phydev)) {
1601 dev_err(emac_dev, "could not connect to phy %s\n", 1601 dev_err(emac_dev, "could not connect to phy %s\n",
1602 priv->phy_id); 1602 priv->phy_id);
1603 ret = PTR_ERR(priv->phydev);
1603 priv->phydev = NULL; 1604 priv->phydev = NULL;
1604 return PTR_ERR(priv->phydev); 1605 return ret;
1605 } 1606 }
1606 1607
1607 priv->link = 0; 1608 priv->link = 0;
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index ef7c9c17bfff..af8b8fc39eb2 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -318,9 +318,9 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
318 318
319 data->clk = clk_get(dev, NULL); 319 data->clk = clk_get(dev, NULL);
320 if (IS_ERR(data->clk)) { 320 if (IS_ERR(data->clk)) {
321 data->clk = NULL;
322 dev_err(dev, "failed to get device clock\n"); 321 dev_err(dev, "failed to get device clock\n");
323 ret = PTR_ERR(data->clk); 322 ret = PTR_ERR(data->clk);
323 data->clk = NULL;
324 goto bail_out; 324 goto bail_out;
325 } 325 }
326 326
diff --git a/drivers/net/ethernet/toshiba/Kconfig b/drivers/net/ethernet/toshiba/Kconfig
index 051764704559..74acb5cf6099 100644
--- a/drivers/net/ethernet/toshiba/Kconfig
+++ b/drivers/net/ethernet/toshiba/Kconfig
@@ -5,7 +5,7 @@
5config NET_VENDOR_TOSHIBA 5config NET_VENDOR_TOSHIBA
6 bool "Toshiba devices" 6 bool "Toshiba devices"
7 default y 7 default y
8 depends on PCI && (PPC_IBM_CELL_BLADE || PPC_CELLEB) || PPC_PS3 8 depends on PCI && (PPC_IBM_CELL_BLADE || PPC_CELLEB || MIPS) || PPC_PS3
9 ---help--- 9 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y 10 If you have a network (Ethernet) card belonging to this class, say Y
11 and read the Ethernet-HOWTO, available from 11 and read the Ethernet-HOWTO, available from
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 4128d6b8cc28..cb35b14b73bb 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -2491,9 +2491,6 @@ static int velocity_close(struct net_device *dev)
2491 if (dev->irq != 0) 2491 if (dev->irq != 0)
2492 free_irq(dev->irq, dev); 2492 free_irq(dev->irq, dev);
2493 2493
2494 /* Power down the chip */
2495 pci_set_power_state(vptr->pdev, PCI_D3hot);
2496
2497 velocity_free_rings(vptr); 2494 velocity_free_rings(vptr);
2498 2495
2499 vptr->flags &= (~VELOCITY_FLAGS_OPENED); 2496 vptr->flags &= (~VELOCITY_FLAGS_OPENED);
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 72a854f05bb8..41a8b5a9849e 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1416,7 +1416,8 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1416 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); 1416 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
1417 udelay(50); 1417 udelay(50);
1418 1418
1419 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); 1419 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
1420 mdio_bus->id, plat->phy);
1420 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, 1421 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
1421 PHY_INTERFACE_MODE_MII); 1422 PHY_INTERFACE_MODE_MII);
1422 if (IS_ERR(port->phydev)) { 1423 if (IS_ERR(port->phydev)) {