Commit 858c3dda authored by Don Skidmore's avatar Don Skidmore Committed by David S. Miller

ixgbevf: add wait for Rx queue disable

New function was added to wait for Rx queues to be disabled before
disabling NAPI. This function also allows us to  modify
ixgbevf_rx_desc_queue_enable() to better match ixgbe.  I also cleaned up
some msleep calls to usleep_range while I was in this code anyway.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Tested-by: default avatarStephen Ko <stephen.s.ko@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c7bb417d
...@@ -1302,27 +1302,51 @@ static void ixgbevf_configure(struct ixgbevf_adapter *adapter) ...@@ -1302,27 +1302,51 @@ static void ixgbevf_configure(struct ixgbevf_adapter *adapter)
} }
} }
#define IXGBE_MAX_RX_DESC_POLL 10 #define IXGBEVF_MAX_RX_DESC_POLL 10
static inline void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
int rxr) int rxr)
{ {
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
u32 rxdctl;
int j = adapter->rx_ring[rxr].reg_idx; int j = adapter->rx_ring[rxr].reg_idx;
int k;
for (k = 0; k < IXGBE_MAX_RX_DESC_POLL; k++) { do {
if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)) & IXGBE_RXDCTL_ENABLE) usleep_range(1000, 2000);
break; rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j));
else } while (--wait_loop && !(rxdctl & IXGBE_RXDCTL_ENABLE));
msleep(1);
} if (!wait_loop)
if (k >= IXGBE_MAX_RX_DESC_POLL) { hw_dbg(hw, "RXDCTL.ENABLE queue %d not set while polling\n",
hw_dbg(hw, "RXDCTL.ENABLE on Rx queue %d " rxr);
"not set within the polling period\n", rxr);
} ixgbevf_release_rx_desc(&adapter->hw, &adapter->rx_ring[rxr],
(adapter->rx_ring[rxr].count - 1));
}
ixgbevf_release_rx_desc(hw, &adapter->rx_ring[rxr], static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter,
adapter->rx_ring[rxr].count - 1); struct ixgbevf_ring *ring)
{
struct ixgbe_hw *hw = &adapter->hw;
int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
u32 rxdctl;
u8 reg_idx = ring->reg_idx;
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
rxdctl &= ~IXGBE_RXDCTL_ENABLE;
/* write value back with RXDCTL.ENABLE bit cleared */
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl);
/* the hardware may take up to 100us to really disable the rx queue */
do {
udelay(10);
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
} while (--wait_loop && (rxdctl & IXGBE_RXDCTL_ENABLE));
if (!wait_loop)
hw_dbg(hw, "RXDCTL.ENABLE queue %d not cleared while polling\n",
reg_idx);
} }
static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter) static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter)
...@@ -1654,7 +1678,10 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter) ...@@ -1654,7 +1678,10 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter)
/* signal that we are down to the interrupt handler */ /* signal that we are down to the interrupt handler */
set_bit(__IXGBEVF_DOWN, &adapter->state); set_bit(__IXGBEVF_DOWN, &adapter->state);
/* disable receives */
/* disable all enabled rx queues */
for (i = 0; i < adapter->num_rx_queues; i++)
ixgbevf_disable_rx_queue(adapter, &adapter->rx_ring[i]);
netif_tx_disable(netdev); netif_tx_disable(netdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment