ixgbe: Use ring values to test for Tx pending

This patch simplifies the check for Tx pending traffic and makes it more
holistic as there being any difference between next_to_use and
next_to_clean is much more informative than if head and tail are equal, as
it is possible for us to either not update tail, or not be notified of
completed work in which case next_to_clean would not be equal to head.

In addition the simplification makes it so that we don't have to read
hardware which allows us to drop a number of variables that were previously
being used in the call.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
Alexander Duyck 2017-11-22 10:56:46 -08:00 committed by Jeff Kirsher
parent 4e039c1675
commit 1489542b9c
1 changed files with 4 additions and 16 deletions

View File

@ -1064,24 +1064,12 @@ static u64 ixgbe_get_tx_completed(struct ixgbe_ring *ring)
static u64 ixgbe_get_tx_pending(struct ixgbe_ring *ring) static u64 ixgbe_get_tx_pending(struct ixgbe_ring *ring)
{ {
struct ixgbe_adapter *adapter; unsigned int head, tail;
struct ixgbe_hw *hw;
u32 head, tail;
if (ring->l2_accel_priv) head = ring->next_to_clean;
adapter = ring->l2_accel_priv->real_adapter; tail = ring->next_to_use;
else
adapter = netdev_priv(ring->netdev);
hw = &adapter->hw; return ((head <= tail) ? tail : tail + ring->count) - head;
head = IXGBE_READ_REG(hw, IXGBE_TDH(ring->reg_idx));
tail = IXGBE_READ_REG(hw, IXGBE_TDT(ring->reg_idx));
if (head != tail)
return (head < tail) ?
tail - head : (tail + ring->count - head);
return 0;
} }
static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring) static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)