Skip to content

Commit 6d73a15

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
ixgbe: restore offloaded SAs after a reset
On a chip reset most of the table contents are lost, so must be restored. This scans the driver's ipsec tables and restores both the filled and empty table slots to their pre-reset values. Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 63a67fe commit 6d73a15

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,10 @@ s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
10201020
#ifdef CONFIG_XFRM_OFFLOAD
10211021
void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter);
10221022
void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter);
1023+
void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter);
10231024
#else
10241025
static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { };
10251026
static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { };
1027+
static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { };
10261028
#endif /* CONFIG_XFRM_OFFLOAD */
10271029
#endif /* _IXGBE_H_ */

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,47 @@ static void ixgbe_ipsec_start_engine(struct ixgbe_adapter *adapter)
298298
IXGBE_WRITE_FLUSH(hw);
299299
}
300300

301+
/**
302+
* ixgbe_ipsec_restore - restore the ipsec HW settings after a reset
303+
* @adapter: board private structure
304+
**/
305+
void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter)
306+
{
307+
struct ixgbe_ipsec *ipsec = adapter->ipsec;
308+
struct ixgbe_hw *hw = &adapter->hw;
309+
int i;
310+
311+
if (!(adapter->flags2 & IXGBE_FLAG2_IPSEC_ENABLED))
312+
return;
313+
314+
/* clean up and restart the engine */
315+
ixgbe_ipsec_stop_engine(adapter);
316+
ixgbe_ipsec_clear_hw_tables(adapter);
317+
ixgbe_ipsec_start_engine(adapter);
318+
319+
/* reload the IP addrs */
320+
for (i = 0; i < IXGBE_IPSEC_MAX_RX_IP_COUNT; i++) {
321+
struct rx_ip_sa *ipsa = &ipsec->ip_tbl[i];
322+
323+
if (ipsa->used)
324+
ixgbe_ipsec_set_rx_ip(hw, i, ipsa->ipaddr);
325+
}
326+
327+
/* reload the Rx and Tx keys */
328+
for (i = 0; i < IXGBE_IPSEC_MAX_SA_COUNT; i++) {
329+
struct rx_sa *rsa = &ipsec->rx_tbl[i];
330+
struct tx_sa *tsa = &ipsec->tx_tbl[i];
331+
332+
if (rsa->used)
333+
ixgbe_ipsec_set_rx_sa(hw, i, rsa->xs->id.spi,
334+
rsa->key, rsa->salt,
335+
rsa->mode, rsa->iptbl_ind);
336+
337+
if (tsa->used)
338+
ixgbe_ipsec_set_tx_sa(hw, i, tsa->key, tsa->salt);
339+
}
340+
}
341+
301342
/**
302343
* ixgbe_ipsec_find_empty_idx - find the first unused security parameter index
303344
* @ipsec: pointer to ipsec struct

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5425,6 +5425,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
54255425

54265426
ixgbe_set_rx_mode(adapter->netdev);
54275427
ixgbe_restore_vlan(adapter);
5428+
ixgbe_ipsec_restore(adapter);
54285429

54295430
switch (hw->mac.type) {
54305431
case ixgbe_mac_82599EB:

0 commit comments

Comments
 (0)