Skip to contentSkip to conversation

Address issues with reset on systems with high completion timeout times

PATCH New Alexander Duyck 6 participants 9 messages Jul 20, 2018 – Jul 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Address issues with reset on systems with high completion timeout times

This patch series is meant to address issues seen with ixgbe on systems with high completion timeout times. Specifically the Tx and Rx queue disable functions are supposed to poll until the enable bit is actually cleared, and isntead of doing that we were failing immediately after just 100us in the case of Rx and weren't bothering to test in the case of Tx. Instead this patch set adds polling logic with the upper bounds defined using the intervals defined in the completion timeout logic.

In addition I have reorganized the code to parallelize this as much as possible so that the Tx and Rx should hopefully flush out at around the same time so we only experience on wait for all of the queues instead of waiting per queue.

---

Alexander Duyck (2):
ixgbe: Reorder Tx/Rx shutdown to reduce time needed to stop device
ixgbe: Refactor queue disable logic to take completion time into account

 drivers/net/ethernet/intel/ixgbe/ixgbe.h         |    3 
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   32 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |  290 +++++++++++++++++-----
 3 files changed, 229 insertions(+), 96 deletions(-)

--

#1 lore raw

PATCH 1/2 ixgbe: Reorder Tx/Rx shutdown to reduce time needed to stop device

This change is meant to help reduce the time needed to shutdown the transmit and receive paths for the device. Specifically what we now do after this patch is disable the transmit path first at the netdev level, and then work on disabling the Rx. This way while we are waiting on the Rx queues to be disabled the Tx queues have an opportunity to drain out.

In addition I have droped the 10ms timeout that was left in the ixgbe_down function that seems to have been carried through from back in e1000 as far as I can tell. We shouldn't need it since we don't actually disable the Tx until much later and we have additional logic in place for verifying the Tx queues have been disabled.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +7 -7
index 372174c..7eef089 100644
@@ -5814,6 +5814,13 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 	if (test_and_set_bit(__IXGBE_DOWN, &adapter->state))
 		return; /* do nothing if already down */
 
+	/* Shut off incoming Tx traffic */
+	netif_tx_stop_all_queues(netdev);
+
+	/* call carrier off first to avoid false dev_watchdog timeouts */
+	netif_carrier_off(netdev);
+	netif_tx_disable(netdev);
+
 	/* disable receives */
 	hw->mac.ops.disable_rx(hw);
 
@@ -5822,16 +5829,9 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 		/* this call also flushes the previous write */
 		ixgbe_disable_rx_queue(adapter, adapter->rx_ring[i]);
 
-	usleep_range(10000, 20000);
-
 	/* synchronize_sched() needed for pending XDP buffers to drain */
 	if (adapter->xdp_ring[0])
 		synchronize_sched();
-	netif_tx_stop_all_queues(netdev);
-
-	/* call carrier off first to avoid false dev_watchdog timeouts */
-	netif_carrier_off(netdev);
-	netif_tx_disable(netdev);
 
 	ixgbe_irq_disable(adapter);
 
#2 lore raw

PATCH 2/2 ixgbe: Refactor queue disable logic to take completion time into account

In reply to Alexander Duyck

This change is meant to allow us to take completion time into account when disabling queues. Previously we were just working with hard coded values for how long we should wait. This worked fine for the standard case where completion timeout was operating in the 50us to 50ms range, however on platforms that have higher completion timeout times this was resulting in Rx queues disable messages being displayed as we weren't waiting long enough for outstanding Rx DMA completions.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h         |    3 
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   32 +--
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |  280 +++++++++++++++++-----
 3 files changed, 224 insertions(+), 91 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -1
index 144d5fe..4fc906c 100644
@@ -855,7 +855,8 @@ enum ixgbe_boards {
 void ixgbe_free_tx_resources(struct ixgbe_ring *);
 void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
 void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
-void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *);
+void ixgbe_disable_rx(struct ixgbe_adapter *adapter);
+void ixgbe_disable_tx(struct ixgbe_adapter *adapter);
 void ixgbe_update_stats(struct ixgbe_adapter *adapter);
 int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
 bool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +7 -25
index 1d68884..e5a8461 100644
@@ -1698,35 +1698,17 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
 
 static void ixgbe_free_desc_rings(struct ixgbe_adapter *adapter)
 {
-	struct ixgbe_ring *tx_ring = &adapter->test_tx_ring;
-	struct ixgbe_ring *rx_ring = &adapter->test_rx_ring;
-	struct ixgbe_hw *hw = &adapter->hw;
-	u32 reg_ctl;
-
-	/* shut down the DMA engines now so they can be reinitialized later */
+	/* Shut down the DMA engines now so they can be reinitialized later,
+	 * since the test rings and normally used rings should overlap on
+	 * queue 0 we can just use the standard disable Rx/Tx calls and they
+	 * will take care of disabling the test rings for us.
+	 */
 
 	/* first Rx */
-	hw->mac.ops.disable_rx(hw);
-	ixgbe_disable_rx_queue(adapter, rx_ring);
+	ixgbe_disable_rx(adapter);
 
 	/* now Tx */
-	reg_ctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(tx_ring->reg_idx));
-	reg_ctl &= ~IXGBE_TXDCTL_ENABLE;
-	IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(tx_ring->reg_idx), reg_ctl);
-
-	switch (hw->mac.type) {
-	case ixgbe_mac_82599EB:
-	case ixgbe_mac_X540:
-	case ixgbe_mac_X550:
-	case ixgbe_mac_X550EM_x:
-	case ixgbe_mac_x550em_a:
-		reg_ctl = IXGBE_READ_REG(hw, IXGBE_DMATXCTL);
-		reg_ctl &= ~IXGBE_DMATXCTL_TE;
-		IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL, reg_ctl);
-		break;
-	default:
-		break;
-	}
+	ixgbe_disable_tx(adapter);
 
 	ixgbe_reset(adapter);
 
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +215 -65

311 lines not on this page · raw message

#3 lore raw

[Intel-wired-lan] [jkirsher/next-queue PATCH 2/2] ixgbe: Refactor queue disable logic to take completion time into account

Thank you for the patch! Perhaps something to improve:

Hi Alexander,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on jkirsher-next-queue/dev-queue]
[also build test WARNING on v4.18-rc5 next-20180720]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Duyck/ixgbe-Reorder-Tx-Rx-shutdown-to-reduce-time-needed-to-stop-device/20180721-074030
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2723:19: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2723:19: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3181:35: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3205:16: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3205:16: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:4823:16: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:4990:29: sparse: expression using sizeof(void)

>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:5608:15: sparse: symbol 'ixgbe_get_completion_timeout' was not declared. Should it be static?

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:6167:15: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:6167:15: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:6172:16: sparse: expression using sizeof(void) include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow' drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:8140:24: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:8140:24: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9575:19: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9575:19: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9979:42: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9979:42: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9983:42: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9983:42: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:10681:26: sparse: expression using sizeof(void) drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:10766:32: sparse: expression using sizeof(void) include/linux/slab.h:631:13: sparse: call with no type!

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

[Intel-wired-lan] [RFC PATCH] ixgbe: ixgbe_get_completion_timeout() can be static

In reply to Alexander Duyck
Fixes: 23f3effc3f69 ("ixgbe: Refactor queue disable logic to take completion time into account")
Fixes 23f3effc3f69 ("ixgbe: Refactor queue disable logic to take completion time into account")
---
 ixgbe_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -1
index d4395f1..e3fac6a 100644
@@ -5605,7 +5605,7 @@ void ixgbe_up(struct ixgbe_adapter *adapter)
 	ixgbe_up_complete(adapter);
 }
 
-unsigned long ixgbe_get_completion_timeout(struct ixgbe_adapter *adapter)
+static unsigned long ixgbe_get_completion_timeout(struct ixgbe_adapter *adapter)
 {
 	u16 devctl2;
 
#5 lore raw

RFC PATCH 1/1 ixgbe: ixgbe_get_completion_timeout() can be static

Quoted 3 lines · kbuild test robot
Fixes 23f3effc3f69 ("ixgbe: Refactor queue disable logic to take completion time into account")

Jeff do you think you could fold this into the current completion timeout patch?

Thanks.

- Alex

#6 lore raw

RFC PATCH 1/1 ixgbe: ixgbe_get_completion_timeout() can be static

Quoted 9 lines · Alexander Duyck
Quoted 4 lines · kbuild test robot
Fixes 23f3effc3f69 ("ixgbe: Refactor queue disable logic to take

completion time into account")

Jeff do you think you could fold this into the current completion timeout patch?

Yes, I can do that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20180723/b1d30cb7/attachment-0001.asc>

#7 lore raw

PATCH 2/2 ixgbe: Refactor queue disable logic to take completion time into account

In reply to Alexander Duyck
Quoted 10 lines · Alexander Duyck

This change is meant to allow us to take completion time into account when disabling queues. Previously we were just working with hard coded values for how long we should wait. This worked fine for the standard case where completion timeout was operating in the 50us to 50ms range, however on platforms that have higher completion timeout times this was resulting in Rx queues disable messages being displayed as we weren't waiting long enough for outstanding Rx DMA completions.

---

[...]

Quoted 18 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +18 -0
+
+void ixgbe_disable_tx(struct ixgbe_adapter *adapter)
+{
+	unsigned long wait_delay, delay_interval;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int i, wait_loop;
+	u32 txdctl;
+
+	if (ixgbe_removed(hw->hw_addr))
+		return;
+
+	/* disable all enabled Tx queues */
+	for (i = 0; i < adapter->num_tx_queues; i++) {
+		struct ixgbe_ring *ring = adapter->tx_ring[i];
+		u8 reg_idx = ring->reg_idx;
+
+		IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), IXGBE_TXDCTL_SWFLSH);
+	}

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c void ixgbe_up(struct ixgbe_adapter *adapter) · line 5743

Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +10 -0
+
+	/* disable all enabled XDP Tx queues */
+	for (i = 0; i < adapter->num_xdp_queues; i++) {
+		struct ixgbe_ring *ring = adapter->xdp_ring[i];
+		u8 reg_idx = ring->reg_idx;
+
+		IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), IXGBE_TXDCTL_SWFLSH);
+	}
+
+	/* If the link is now up there shouldn't be much in the way of

I think you mean "not" up rather than "now" up, which has the opposite meaning and could be a bit confusing.

Quoted 58 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +58 -0
+	 * pending transactions. Those that are left will be flushed out
+	 * when the reset logic goes through the flush sequence to clean out
+	 * the pending Tx transactions.
+	 */
+	if (!(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP))
+		goto dma_engine_disable;
+
+	/* Determine our minimum delay interval. We will increase this value
+	 * with each subsequent test. This way if the device returns quickly
+	 * we should spend as little time as possible waiting, however as
+	 * the time increases we will wait for larger periods of time.
+	 *
+	 * The trick here is that we increase the interval using the
+	 * following pattern: 1x 3x 5x 7x 9x 11x 13x 15x 17x 19x. The result
+	 * of that wait is that it totals up to 100x whatever interval we
+	 * choose. Since our minimum wait is 100us we can just divide the
+	 * total timeout by 100 to get our minimum delay interval.
+	 */
+	delay_interval = ixgbe_get_completion_timeout(adapter) / 100;
+
+	wait_loop = IXGBE_MAX_RX_DESC_POLL;
+	wait_delay = delay_interval;
+
+	while (wait_loop--) {
+		usleep_range(wait_delay, wait_delay + 10);
+		wait_delay += delay_interval * 2;
+		txdctl = 0;
+
+		/* OR together the reading of all the active TXDCTL registers,
+		 * and then test the result. We need the disable to complete
+		 * before we start freeing the memory and invalidating the
+		 * DMA mappings.
+		 */
+		for (i = 0; i < adapter->num_tx_queues; i++) {
+			struct ixgbe_ring *ring = adapter->tx_ring[i];
+			u8 reg_idx = ring->reg_idx;
+
+			txdctl |= IXGBE_READ_REG(hw, IXGBE_TXDCTL(reg_idx));
+		}
+		for (i = 0; i < adapter->num_xdp_queues; i++) {
+			struct ixgbe_ring *ring = adapter->xdp_ring[i];
+			u8 reg_idx = ring->reg_idx;
+
+			txdctl |= IXGBE_READ_REG(hw, IXGBE_TXDCTL(reg_idx));
+		}
+
+		if (!(txdctl & IXGBE_TXDCTL_ENABLE))
+			goto dma_engine_disable;
+	}
+
+	e_err(drv,
+	      "TXDCTL.ENABLE for one or more queues not cleared within the polling period\n");
+
+dma_engine_disable:
+	/* Disable the Tx DMA engine on 82599 and later MAC */
+	switch (hw->mac.type) {
+	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X540:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c void ixgbe_up(struct ixgbe_adapter *adapter) · line 5811

Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +10 -0
+	case ixgbe_mac_X550:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_x550em_a:
+		IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
+				(IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
+				 ~IXGBE_DMATXCTL_TE));
+		/* fall through */
+	default:
+		break;
+	}

Picky bike-shed thoughts: I realize you're just moving the previously existing code, but with the comment "... and later MAC" I would think the translation to code puts all the later MACs into the default and have the WRITE_REG() as the default action. This would make it default to the correct action for any new MACs if someone forgot to fix up this part of the code.

	switch (hw->mac.type) {
	case ixgbe_mac_82598EB:
		break;

	case ixgbe_mac_82599EB:
	case ixgbe_mac_X540:
	case ixgbe_mac_X550:
	case ixgbe_mac_X550EM_x:
	case ixgbe_mac_x550em_a:
	default:
		IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
				(IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
				 ~IXGBE_DMATXCTL_TE));
		break;
	}

Or even simpler,

	if (hw->mac.type != ixgbe_mac_82598EB)
		IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
				(IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
				 ~IXGBE_DMATXCTL_TE));

Okay, I'll stop now.

Cheers,
sln

#8 lore raw

PATCH 2/2 ixgbe: Refactor queue disable logic to take completion time into account

Quoted 43 lines · Shannon Nelson
Quoted 11 lines · Alexander Duyck

This change is meant to allow us to take completion time into account when disabling queues. Previously we were just working with hard coded values for how long we should wait. This worked fine for the standard case where completion timeout was operating in the 50us to 50ms range, however on platforms that have higher completion timeout times this was resulting in Rx queues disable messages being displayed as we weren't waiting long enough for outstanding Rx DMA completions.

---

[...]

Quoted 26 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +17 -0
+
+void ixgbe_disable_tx(struct ixgbe_adapter *adapter)
+{
+       unsigned long wait_delay, delay_interval;
+       struct ixgbe_hw *hw = &adapter->hw;
+       int i, wait_loop;
+       u32 txdctl;
+
+       if (ixgbe_removed(hw->hw_addr))
+               return;
+
+       /* disable all enabled Tx queues */
+       for (i = 0; i < adapter->num_tx_queues; i++) {
+               struct ixgbe_ring *ring = adapter->tx_ring[i];
+               u8 reg_idx = ring->reg_idx;
+
+               IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx),

IXGBE_TXDCTL_SWFLSH);

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -0
+       }
+
+       /* disable all enabled XDP Tx queues */
+       for (i = 0; i < adapter->num_xdp_queues; i++) {
+               struct ixgbe_ring *ring = adapter->xdp_ring[i];
+               u8 reg_idx = ring->reg_idx;
+
+               IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx),
Quoted 8 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c void ixgbe_up(struct ixgbe_adapter *adapter) · line 5743

Quoted 4 lines

IXGBE_TXDCTL_SWFLSH);

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -0
+       }
+
+       /* If the link is now up there shouldn't be much in the way of

I think you mean "not" up rather than "now" up, which has the opposite meaning and could be a bit confusing.

Yeah, that is a typo.

Quoted 110 lines
Quoted 68 lines
(quoted diff) +2 -0
+        * pending transactions. Those that are left will be flushed out
+        * when the reset logic goes through the flush sequence to clean

out

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -0
+        * the pending Tx transactions.
+        */
+       if (!(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP))
+               goto dma_engine_disable;
+
+       /* Determine our minimum delay interval. We will increase this

value
+ * with each subsequent test. This way if the device returns
quickly

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -0
+        * we should spend as little time as possible waiting, however as
+        * the time increases we will wait for larger periods of time.
+        *
+        * The trick here is that we increase the interval using the
+        * following pattern: 1x 3x 5x 7x 9x 11x 13x 15x 17x 19x. The

result

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +15 -0
+        * of that wait is that it totals up to 100x whatever interval we
+        * choose. Since our minimum wait is 100us we can just divide the
+        * total timeout by 100 to get our minimum delay interval.
+        */
+       delay_interval = ixgbe_get_completion_timeout(adapter) / 100;
+
+       wait_loop = IXGBE_MAX_RX_DESC_POLL;
+       wait_delay = delay_interval;
+
+       while (wait_loop--) {
+               usleep_range(wait_delay, wait_delay + 10);
+               wait_delay += delay_interval * 2;
+               txdctl = 0;
+
+               /* OR together the reading of all the active TXDCTL

registers,
+ * and then test the result. We need the disable to
complete

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -0
+                * before we start freeing the memory and invalidating the
+                * DMA mappings.
+                */
+               for (i = 0; i < adapter->num_tx_queues; i++) {
+                       struct ixgbe_ring *ring = adapter->tx_ring[i];
+                       u8 reg_idx = ring->reg_idx;
+
+                       txdctl |= IXGBE_READ_REG(hw,

IXGBE_TXDCTL(reg_idx));

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -0
+               }
+               for (i = 0; i < adapter->num_xdp_queues; i++) {
+                       struct ixgbe_ring *ring = adapter->xdp_ring[i];
+                       u8 reg_idx = ring->reg_idx;
+
+                       txdctl |= IXGBE_READ_REG(hw,

IXGBE_TXDCTL(reg_idx));

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -0
+               }
+
+               if (!(txdctl & IXGBE_TXDCTL_ENABLE))
+                       goto dma_engine_disable;
+       }
+
+       e_err(drv,
+             "TXDCTL.ENABLE for one or more queues not cleared within the

polling period\n");

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -0
+
+dma_engine_disable:
+       /* Disable the Tx DMA engine on 82599 and later MAC */
+       switch (hw->mac.type) {
+       case ixgbe_mac_82599EB:
+       case ixgbe_mac_X540:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c void ixgbe_up(struct ixgbe_adapter *adapter) · line 5811

Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +10 -0
+       case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_x550em_a:
+               IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
+                               (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
+                                ~IXGBE_DMATXCTL_TE));
+               /* fall through */
+       default:
+               break;
+       }

Picky bike-shed thoughts: I realize you're just moving the previously existing code, but with the comment "... and later MAC" I would think the translation to code puts all the later MACs into the default and have the WRITE_REG() as the default action. This would make it default to the correct action for any new MACs if someone forgot to fix up this part of the code.

        switch (hw->mac.type) {
        case ixgbe_mac_82598EB:
                break;

        case ixgbe_mac_82599EB:
        case ixgbe_mac_X540:
        case ixgbe_mac_X550:
        case ixgbe_mac_X550EM_x:
        case ixgbe_mac_x550em_a:
        default:
                IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
                                (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
                                 ~IXGBE_DMATXCTL_TE));
                break;
        }

Or even simpler,

        if (hw->mac.type != ixgbe_mac_82598EB)
                IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL,
                                (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) &
                                 ~IXGBE_DMATXCTL_TE));
Quoted 4 lines

Okay, I'll stop now.

Cheers,
sln

Yeah, for now I will probably leave the code as is, but this is something that could be updated int he future. Either that or you are always free to submit a patch.. :-)

- Alex