aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-17 14:17:05 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-17 14:17:05 -0400
commitc8144a36821b11e8124b38fdbf0b7cad546bbd2f (patch)
tree52d46cb87da1ae05852ba9158967bc7c04753a94 /drivers
parentf56e03e8dc149bf0ac2888d6843584f48c8700fc (diff)
parente4abce8538496ba90cb89909894ea42e00f96a7d (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next-2.6
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sfc/efx.c21
-rw-r--r--drivers/net/sfc/ethtool.c5
-rw-r--r--drivers/net/sfc/net_driver.h4
-rw-r--r--drivers/net/sfc/selftest.c11
-rw-r--r--drivers/net/sfc/tx.c9
5 files changed, 29 insertions, 21 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 38a55e9e89e4..05502b359b9e 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -798,11 +798,6 @@ void efx_link_status_changed(struct efx_nic *efx)
798 if (!netif_running(efx->net_dev)) 798 if (!netif_running(efx->net_dev))
799 return; 799 return;
800 800
801 if (efx->port_inhibited) {
802 netif_carrier_off(efx->net_dev);
803 return;
804 }
805
806 if (link_state->up != netif_carrier_ok(efx->net_dev)) { 801 if (link_state->up != netif_carrier_ok(efx->net_dev)) {
807 efx->n_link_state_changes++; 802 efx->n_link_state_changes++;
808 803
@@ -1319,8 +1314,20 @@ static void efx_remove_interrupts(struct efx_nic *efx)
1319 1314
1320static void efx_set_channels(struct efx_nic *efx) 1315static void efx_set_channels(struct efx_nic *efx)
1321{ 1316{
1317 struct efx_channel *channel;
1318 struct efx_tx_queue *tx_queue;
1319
1322 efx->tx_channel_offset = 1320 efx->tx_channel_offset =
1323 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0; 1321 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
1322
1323 /* We need to adjust the TX queue numbers if we have separate
1324 * RX-only and TX-only channels.
1325 */
1326 efx_for_each_channel(channel, efx) {
1327 efx_for_each_channel_tx_queue(tx_queue, channel)
1328 tx_queue->queue -= (efx->tx_channel_offset *
1329 EFX_TXQ_TYPES);
1330 }
1324} 1331}
1325 1332
1326static int efx_probe_nic(struct efx_nic *efx) 1333static int efx_probe_nic(struct efx_nic *efx)
@@ -1438,7 +1445,7 @@ static void efx_start_all(struct efx_nic *efx)
1438 * restart the transmit interface early so the watchdog timer stops */ 1445 * restart the transmit interface early so the watchdog timer stops */
1439 efx_start_port(efx); 1446 efx_start_port(efx);
1440 1447
1441 if (efx_dev_registered(efx) && !efx->port_inhibited) 1448 if (efx_dev_registered(efx) && netif_device_present(efx->net_dev))
1442 netif_tx_wake_all_queues(efx->net_dev); 1449 netif_tx_wake_all_queues(efx->net_dev);
1443 1450
1444 efx_for_each_channel(channel, efx) 1451 efx_for_each_channel(channel, efx)
@@ -2102,6 +2109,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method)
2102 netif_info(efx, drv, efx->net_dev, "resetting (%s)\n", 2109 netif_info(efx, drv, efx->net_dev, "resetting (%s)\n",
2103 RESET_TYPE(method)); 2110 RESET_TYPE(method));
2104 2111
2112 netif_device_detach(efx->net_dev);
2105 efx_reset_down(efx, method); 2113 efx_reset_down(efx, method);
2106 2114
2107 rc = efx->type->reset(efx, method); 2115 rc = efx->type->reset(efx, method);
@@ -2135,6 +2143,7 @@ out:
2135 efx->state = STATE_DISABLED; 2143 efx->state = STATE_DISABLED;
2136 } else { 2144 } else {
2137 netif_dbg(efx, drv, efx->net_dev, "reset complete\n"); 2145 netif_dbg(efx, drv, efx->net_dev, "reset complete\n");
2146 netif_device_attach(efx->net_dev);
2138 } 2147 }
2139 return rc; 2148 return rc;
2140} 2149}
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 8c5e0052c44a..348437a8117e 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -955,8 +955,9 @@ static int efx_ethtool_set_rx_ntuple(struct net_device *net_dev,
955 955
956 if (ntuple->fs.action == ETHTOOL_RXNTUPLE_ACTION_CLEAR) 956 if (ntuple->fs.action == ETHTOOL_RXNTUPLE_ACTION_CLEAR)
957 return efx_filter_remove_filter(efx, &filter); 957 return efx_filter_remove_filter(efx, &filter);
958 else 958
959 return efx_filter_insert_filter(efx, &filter, true); 959 rc = efx_filter_insert_filter(efx, &filter, true);
960 return rc < 0 ? rc : 0;
960} 961}
961 962
962static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev, 963static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev,
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 5718260298c4..ce9697bac1b9 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -670,13 +670,12 @@ struct efx_filter_state;
670 * @mtd_list: List of MTDs attached to the NIC 670 * @mtd_list: List of MTDs attached to the NIC
671 * @nic_data: Hardware dependent state 671 * @nic_data: Hardware dependent state
672 * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, 672 * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode,
673 * @port_inhibited, efx_monitor() and efx_reconfigure_port() 673 * efx_monitor() and efx_reconfigure_port()
674 * @port_enabled: Port enabled indicator. 674 * @port_enabled: Port enabled indicator.
675 * Serialises efx_stop_all(), efx_start_all(), efx_monitor() and 675 * Serialises efx_stop_all(), efx_start_all(), efx_monitor() and
676 * efx_mac_work() with kernel interfaces. Safe to read under any 676 * efx_mac_work() with kernel interfaces. Safe to read under any
677 * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must 677 * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must
678 * be held to modify it. 678 * be held to modify it.
679 * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock
680 * @port_initialized: Port initialized? 679 * @port_initialized: Port initialized?
681 * @net_dev: Operating system network device. Consider holding the rtnl lock 680 * @net_dev: Operating system network device. Consider holding the rtnl lock
682 * @stats_buffer: DMA buffer for statistics 681 * @stats_buffer: DMA buffer for statistics
@@ -764,7 +763,6 @@ struct efx_nic {
764 struct mutex mac_lock; 763 struct mutex mac_lock;
765 struct work_struct mac_work; 764 struct work_struct mac_work;
766 bool port_enabled; 765 bool port_enabled;
767 bool port_inhibited;
768 766
769 bool port_initialized; 767 bool port_initialized;
770 struct net_device *net_dev; 768 struct net_device *net_dev;
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 50ad3bcaf68a..822f6c2a6a7c 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -695,12 +695,12 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
695 /* Offline (i.e. disruptive) testing 695 /* Offline (i.e. disruptive) testing
696 * This checks MAC and PHY loopback on the specified port. */ 696 * This checks MAC and PHY loopback on the specified port. */
697 697
698 /* force the carrier state off so the kernel doesn't transmit during 698 /* Detach the device so the kernel doesn't transmit during the
699 * the loopback test, and the watchdog timeout doesn't fire. Also put 699 * loopback test and the watchdog timeout doesn't fire.
700 * falcon into loopback for the register test.
701 */ 700 */
701 netif_device_detach(efx->net_dev);
702
702 mutex_lock(&efx->mac_lock); 703 mutex_lock(&efx->mac_lock);
703 efx->port_inhibited = true;
704 if (efx->loopback_modes) { 704 if (efx->loopback_modes) {
705 /* We need the 312 clock from the PHY to test the XMAC 705 /* We need the 312 clock from the PHY to test the XMAC
706 * registers, so move into XGMII loopback if available */ 706 * registers, so move into XGMII loopback if available */
@@ -750,12 +750,11 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
750 /* restore the PHY to the previous state */ 750 /* restore the PHY to the previous state */
751 mutex_lock(&efx->mac_lock); 751 mutex_lock(&efx->mac_lock);
752 efx->phy_mode = phy_mode; 752 efx->phy_mode = phy_mode;
753 efx->port_inhibited = false;
754 efx->loopback_mode = loopback_mode; 753 efx->loopback_mode = loopback_mode;
755 __efx_reconfigure_port(efx); 754 __efx_reconfigure_port(efx);
756 mutex_unlock(&efx->mac_lock); 755 mutex_unlock(&efx->mac_lock);
757 756
758 netif_tx_wake_all_queues(efx->net_dev); 757 netif_device_attach(efx->net_dev);
759 758
760 return rc_test; 759 return rc_test;
761} 760}
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index d2c85dfdf3bf..84eb99e0f8d2 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -205,7 +205,9 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
205 goto unwind; 205 goto unwind;
206 } 206 }
207 smp_mb(); 207 smp_mb();
208 netif_tx_start_queue(tx_queue->core_txq); 208 if (likely(!efx->loopback_selftest))
209 netif_tx_start_queue(
210 tx_queue->core_txq);
209 } 211 }
210 212
211 insert_ptr = tx_queue->insert_count & tx_queue->ptr_mask; 213 insert_ptr = tx_queue->insert_count & tx_queue->ptr_mask;
@@ -338,8 +340,7 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
338 struct efx_tx_queue *tx_queue; 340 struct efx_tx_queue *tx_queue;
339 unsigned index, type; 341 unsigned index, type;
340 342
341 if (unlikely(efx->port_inhibited)) 343 EFX_WARN_ON_PARANOID(!netif_device_present(net_dev));
342 return NETDEV_TX_BUSY;
343 344
344 index = skb_get_queue_mapping(skb); 345 index = skb_get_queue_mapping(skb);
345 type = skb->ip_summed == CHECKSUM_PARTIAL ? EFX_TXQ_TYPE_OFFLOAD : 0; 346 type = skb->ip_summed == CHECKSUM_PARTIAL ? EFX_TXQ_TYPE_OFFLOAD : 0;
@@ -436,7 +437,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
436 smp_mb(); 437 smp_mb();
437 if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) && 438 if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
438 likely(efx->port_enabled) && 439 likely(efx->port_enabled) &&
439 likely(!efx->port_inhibited)) { 440 likely(netif_device_present(efx->net_dev))) {
440 fill_level = tx_queue->insert_count - tx_queue->read_count; 441 fill_level = tx_queue->insert_count - tx_queue->read_count;
441 if (fill_level < EFX_TXQ_THRESHOLD(efx)) { 442 if (fill_level < EFX_TXQ_THRESHOLD(efx)) {
442 EFX_BUG_ON_PARANOID(!efx_dev_registered(efx)); 443 EFX_BUG_ON_PARANOID(!efx_dev_registered(efx));