Skip to content

Commit e9f655e

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe: Avoid loopback and fix boolean logic in ipsec_stop_data
This patch fixes two issues. First we add an early test for the Tx and Rx security block ready bits. By doing this we can avoid the need for waits or loopback in the event that the security block is already flushed out. Secondly we fix the boolean logic that was testing for the Tx OR Rx ready bits being set and change it so that we only exit if the Tx AND Rx ready bits are both set. Signed-off-by: Alexander Duyck <[email protected]> Acked-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent de7a7e3 commit e9f655e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,16 @@ static void ixgbe_ipsec_stop_data(struct ixgbe_adapter *adapter)
158158
reg |= IXGBE_SECRXCTRL_RX_DIS;
159159
IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, reg);
160160

161-
IXGBE_WRITE_FLUSH(hw);
161+
/* If both Tx and Rx are ready there are no packets
162+
* that we need to flush so the loopback configuration
163+
* below is not necessary.
164+
*/
165+
t_rdy = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT) &
166+
IXGBE_SECTXSTAT_SECTX_RDY;
167+
r_rdy = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT) &
168+
IXGBE_SECRXSTAT_SECRX_RDY;
169+
if (t_rdy && r_rdy)
170+
return;
162171

163172
/* If the tx fifo doesn't have link, but still has data,
164173
* we can't clear the tx sec block. Set the MAC loopback
@@ -185,7 +194,7 @@ static void ixgbe_ipsec_stop_data(struct ixgbe_adapter *adapter)
185194
IXGBE_SECTXSTAT_SECTX_RDY;
186195
r_rdy = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT) &
187196
IXGBE_SECRXSTAT_SECRX_RDY;
188-
} while (!t_rdy && !r_rdy && limit--);
197+
} while (!(t_rdy && r_rdy) && limit--);
189198

190199
/* undo loopback if we played with it earlier */
191200
if (!link) {

0 commit comments

Comments
 (0)