netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request: sfc-next-2.6 2011-05-17
@ 2011-05-17 15:59 Ben Hutchings
  2011-05-17 16:04 ` [PATCH net-next-2.6 1/3] sfc: Fix return value from efx_ethtool_set_rx_ntuple() Ben Hutchings
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-05-17 15:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

The following changes since commit 7be799a70ba3dd90a59e8d2c72bbe06020005b3f:

  ipv4: Remove rt->rt_dst reference from ip_forward_options(). (2011-05-13 17:31:02 -0400)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next-2.6.git master

Miscellaneous bug fixes.

Ben.

Ben Hutchings (3):
      sfc: Fix return value from efx_ethtool_set_rx_ntuple()
      sfc: Fix TX queue numbering when separate_tx_channels=1
      sfc: Use netif_device_{detach,attach}() around reset and self-test

 drivers/net/sfc/efx.c        |   21 +++++++++++++++------
 drivers/net/sfc/ethtool.c    |    5 +++--
 drivers/net/sfc/net_driver.h |    4 +---
 drivers/net/sfc/selftest.c   |   11 +++++------
 drivers/net/sfc/tx.c         |    9 +++++----
 5 files changed, 29 insertions(+), 21 deletions(-)

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next-2.6 1/3] sfc: Fix return value from efx_ethtool_set_rx_ntuple()
  2011-05-17 15:59 pull request: sfc-next-2.6 2011-05-17 Ben Hutchings
@ 2011-05-17 16:04 ` Ben Hutchings
  2011-05-17 16:05 ` [PATCH net-next-2.6 2/3] sfc: Fix TX queue numbering when separate_tx_channels=1 Ben Hutchings
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-05-17 16:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

ethtool_ops::set_rx_ntuple is supposed to return 0 on success, but it
currently returns the filter ID when it inserts or modifies a filter.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/ethtool.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 8c5e005..348437a 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,
 
 	if (ntuple->fs.action == ETHTOOL_RXNTUPLE_ACTION_CLEAR)
 		return efx_filter_remove_filter(efx, &filter);
-	else
-		return efx_filter_insert_filter(efx, &filter, true);
+
+	rc = efx_filter_insert_filter(efx, &filter, true);
+	return rc < 0 ? rc : 0;
 }
 
 static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev,
-- 
1.7.4



-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next-2.6 2/3] sfc: Fix TX queue numbering when separate_tx_channels=1
  2011-05-17 15:59 pull request: sfc-next-2.6 2011-05-17 Ben Hutchings
  2011-05-17 16:04 ` [PATCH net-next-2.6 1/3] sfc: Fix return value from efx_ethtool_set_rx_ntuple() Ben Hutchings
@ 2011-05-17 16:05 ` Ben Hutchings
  2011-05-17 16:06 ` [PATCH net-next-2.6 3/3] sfc: Use netif_device_{detach,attach}() around reset and self-test Ben Hutchings
  2011-05-17 18:00 ` pull request: sfc-next-2.6 2011-05-17 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-05-17 16:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

This option appears to have been broken by commit
8313aca38b3937947fffebca6e34bac8e24300c8 ('sfc: Allocate each channel
separately, along with its RX and TX queues').

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/efx.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 38a55e9..796c47e 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1319,8 +1319,20 @@ static void efx_remove_interrupts(struct efx_nic *efx)
 
 static void efx_set_channels(struct efx_nic *efx)
 {
+	struct efx_channel *channel;
+	struct efx_tx_queue *tx_queue;
+
 	efx->tx_channel_offset =
 		separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
+
+	/* We need to adjust the TX queue numbers if we have separate
+	 * RX-only and TX-only channels.
+	 */
+	efx_for_each_channel(channel, efx) {
+		efx_for_each_channel_tx_queue(tx_queue, channel)
+			tx_queue->queue -= (efx->tx_channel_offset *
+					    EFX_TXQ_TYPES);
+	}
 }
 
 static int efx_probe_nic(struct efx_nic *efx)
-- 
1.7.4



-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next-2.6 3/3] sfc: Use netif_device_{detach,attach}() around reset and self-test
  2011-05-17 15:59 pull request: sfc-next-2.6 2011-05-17 Ben Hutchings
  2011-05-17 16:04 ` [PATCH net-next-2.6 1/3] sfc: Fix return value from efx_ethtool_set_rx_ntuple() Ben Hutchings
  2011-05-17 16:05 ` [PATCH net-next-2.6 2/3] sfc: Fix TX queue numbering when separate_tx_channels=1 Ben Hutchings
@ 2011-05-17 16:06 ` Ben Hutchings
  2011-05-17 18:00 ` pull request: sfc-next-2.6 2011-05-17 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-05-17 16:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

We need to keep the TX queues stopped throughout a reset, without
triggering the TX watchdog and regardless of the link state.  The
proper way to do this is to use netif_device_{detach,attach}() just as
we do around suspend/resume, rather than the current bodge of faking
link-down.

Since we also need to do this during an offline self-test and we
perform a reset during that, add these function calls outside of
efx_reset_down() and efx_reset_up().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/efx.c        |    9 +++------
 drivers/net/sfc/net_driver.h |    4 +---
 drivers/net/sfc/selftest.c   |   11 +++++------
 drivers/net/sfc/tx.c         |    9 +++++----
 4 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 796c47e..05502b3 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)
 	if (!netif_running(efx->net_dev))
 		return;
 
-	if (efx->port_inhibited) {
-		netif_carrier_off(efx->net_dev);
-		return;
-	}
-
 	if (link_state->up != netif_carrier_ok(efx->net_dev)) {
 		efx->n_link_state_changes++;
 
@@ -1450,7 +1445,7 @@ static void efx_start_all(struct efx_nic *efx)
 	 * restart the transmit interface early so the watchdog timer stops */
 	efx_start_port(efx);
 
-	if (efx_dev_registered(efx) && !efx->port_inhibited)
+	if (efx_dev_registered(efx) && netif_device_present(efx->net_dev))
 		netif_tx_wake_all_queues(efx->net_dev);
 
 	efx_for_each_channel(channel, efx)
@@ -2114,6 +2109,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method)
 	netif_info(efx, drv, efx->net_dev, "resetting (%s)\n",
 		   RESET_TYPE(method));
 
+	netif_device_detach(efx->net_dev);
 	efx_reset_down(efx, method);
 
 	rc = efx->type->reset(efx, method);
@@ -2147,6 +2143,7 @@ out:
 		efx->state = STATE_DISABLED;
 	} else {
 		netif_dbg(efx, drv, efx->net_dev, "reset complete\n");
+		netif_device_attach(efx->net_dev);
 	}
 	return rc;
 }
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 5718260..ce9697b 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -670,13 +670,12 @@ struct efx_filter_state;
  * @mtd_list: List of MTDs attached to the NIC
  * @nic_data: Hardware dependent state
  * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode,
- *	@port_inhibited, efx_monitor() and efx_reconfigure_port()
+ *	efx_monitor() and efx_reconfigure_port()
  * @port_enabled: Port enabled indicator.
  *	Serialises efx_stop_all(), efx_start_all(), efx_monitor() and
  *	efx_mac_work() with kernel interfaces. Safe to read under any
  *	one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must
  *	be held to modify it.
- * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock
  * @port_initialized: Port initialized?
  * @net_dev: Operating system network device. Consider holding the rtnl lock
  * @stats_buffer: DMA buffer for statistics
@@ -764,7 +763,6 @@ struct efx_nic {
 	struct mutex mac_lock;
 	struct work_struct mac_work;
 	bool port_enabled;
-	bool port_inhibited;
 
 	bool port_initialized;
 	struct net_device *net_dev;
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 50ad3bc..822f6c2 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,
 	/* Offline (i.e. disruptive) testing
 	 * This checks MAC and PHY loopback on the specified port. */
 
-	/* force the carrier state off so the kernel doesn't transmit during
-	 * the loopback test, and the watchdog timeout doesn't fire. Also put
-	 * falcon into loopback for the register test.
+	/* Detach the device so the kernel doesn't transmit during the
+	 * loopback test and the watchdog timeout doesn't fire.
 	 */
+	netif_device_detach(efx->net_dev);
+
 	mutex_lock(&efx->mac_lock);
-	efx->port_inhibited = true;
 	if (efx->loopback_modes) {
 		/* We need the 312 clock from the PHY to test the XMAC
 		 * registers, so move into XGMII loopback if available */
@@ -750,12 +750,11 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
 	/* restore the PHY to the previous state */
 	mutex_lock(&efx->mac_lock);
 	efx->phy_mode = phy_mode;
-	efx->port_inhibited = false;
 	efx->loopback_mode = loopback_mode;
 	__efx_reconfigure_port(efx);
 	mutex_unlock(&efx->mac_lock);
 
-	netif_tx_wake_all_queues(efx->net_dev);
+	netif_device_attach(efx->net_dev);
 
 	return rc_test;
 }
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index d2c85df..84eb99e 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)
 					goto unwind;
 				}
 				smp_mb();
-				netif_tx_start_queue(tx_queue->core_txq);
+				if (likely(!efx->loopback_selftest))
+					netif_tx_start_queue(
+						tx_queue->core_txq);
 			}
 
 			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,
 	struct efx_tx_queue *tx_queue;
 	unsigned index, type;
 
-	if (unlikely(efx->port_inhibited))
-		return NETDEV_TX_BUSY;
+	EFX_WARN_ON_PARANOID(!netif_device_present(net_dev));
 
 	index = skb_get_queue_mapping(skb);
 	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)
 	smp_mb();
 	if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
 	    likely(efx->port_enabled) &&
-	    likely(!efx->port_inhibited)) {
+	    likely(netif_device_present(efx->net_dev))) {
 		fill_level = tx_queue->insert_count - tx_queue->read_count;
 		if (fill_level < EFX_TXQ_THRESHOLD(efx)) {
 			EFX_BUG_ON_PARANOID(!efx_dev_registered(efx));
-- 
1.7.4


-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: pull request: sfc-next-2.6 2011-05-17
  2011-05-17 15:59 pull request: sfc-next-2.6 2011-05-17 Ben Hutchings
                   ` (2 preceding siblings ...)
  2011-05-17 16:06 ` [PATCH net-next-2.6 3/3] sfc: Use netif_device_{detach,attach}() around reset and self-test Ben Hutchings
@ 2011-05-17 18:00 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-05-17 18:00 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 17 May 2011 16:59:48 +0100

> The following changes since commit 7be799a70ba3dd90a59e8d2c72bbe06020005b3f:
> 
>   ipv4: Remove rt->rt_dst reference from ip_forward_options(). (2011-05-13 17:31:02 -0400)
> 
> are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next-2.6.git master
> 
> Miscellaneous bug fixes.

Pulled, thanks Ben.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-17 18:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-17 15:59 pull request: sfc-next-2.6 2011-05-17 Ben Hutchings
2011-05-17 16:04 ` [PATCH net-next-2.6 1/3] sfc: Fix return value from efx_ethtool_set_rx_ntuple() Ben Hutchings
2011-05-17 16:05 ` [PATCH net-next-2.6 2/3] sfc: Fix TX queue numbering when separate_tx_channels=1 Ben Hutchings
2011-05-17 16:06 ` [PATCH net-next-2.6 3/3] sfc: Use netif_device_{detach,attach}() around reset and self-test Ben Hutchings
2011-05-17 18:00 ` pull request: sfc-next-2.6 2011-05-17 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).