Skip to content

Commit 1489542

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
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 <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 4e039c1 commit 1489542

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,24 +1064,12 @@ static u64 ixgbe_get_tx_completed(struct ixgbe_ring *ring)
10641064

10651065
static u64 ixgbe_get_tx_pending(struct ixgbe_ring *ring)
10661066
{
1067-
struct ixgbe_adapter *adapter;
1068-
struct ixgbe_hw *hw;
1069-
u32 head, tail;
1067+
unsigned int head, tail;
10701068

1071-
if (ring->l2_accel_priv)
1072-
adapter = ring->l2_accel_priv->real_adapter;
1073-
else
1074-
adapter = netdev_priv(ring->netdev);
1069+
head = ring->next_to_clean;
1070+
tail = ring->next_to_use;
10751071

1076-
hw = &adapter->hw;
1077-
head = IXGBE_READ_REG(hw, IXGBE_TDH(ring->reg_idx));
1078-
tail = IXGBE_READ_REG(hw, IXGBE_TDT(ring->reg_idx));
1079-
1080-
if (head != tail)
1081-
return (head < tail) ?
1082-
tail - head : (tail + ring->count - head);
1083-
1084-
return 0;
1072+
return ((head <= tail) ? tail : tail + ring->count) - head;
10851073
}
10861074

10871075
static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)

0 commit comments

Comments
 (0)