From: Shannon Nelson <shannon.nelson@oracle.com>
To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com
Cc: steffen.klassert@secunet.com, sowmini.varadhan@oracle.com,
netdev@vger.kernel.org
Subject: [next-queue 06/10] ixgbe: restore offloaded SAs after a reset
Date: Mon, 4 Dec 2017 21:35:12 -0800 [thread overview]
Message-ID: <1512452116-14795-7-git-send-email-shannon.nelson@oracle.com> (raw)
In-Reply-To: <1512452116-14795-1-git-send-email-shannon.nelson@oracle.com>
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 <shannon.nelson@oracle.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 53 ++++++++++++++++++++++++++
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 1 +
3 files changed, 56 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 9487750..7e8bca7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -1009,7 +1009,9 @@ s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
#ifdef CONFIG_XFRM_OFFLOAD
void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter);
+void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter);
#else
static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { };
+static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { };
#endif /* CONFIG_XFRM_OFFLOAD */
#endif /* _IXGBE_H_ */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index 7b01d92..b93ee7f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -292,6 +292,59 @@ static void ixgbe_ipsec_start_engine(struct ixgbe_adapter *adapter)
}
/**
+ * ixgbe_ipsec_restore - restore the ipsec HW settings after a reset
+ * @adapter: board private structure
+ **/
+void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter)
+{
+ struct ixgbe_ipsec *ipsec = adapter->ipsec;
+ struct ixgbe_hw *hw = &adapter->hw;
+ u32 zbuf[4] = {0, 0, 0, 0};
+ int i;
+
+ if (!(adapter->flags2 & IXGBE_FLAG2_IPSEC_ENABLED))
+ return;
+
+ /* clean up the engine settings */
+ ixgbe_ipsec_stop_engine(adapter);
+
+ /* start the engine */
+ ixgbe_ipsec_start_engine(adapter);
+
+ /* reload the IP addrs */
+ for (i = 0; i < IXGBE_IPSEC_MAX_RX_IP_COUNT; i++) {
+ struct rx_ip_sa *ipsa = &ipsec->ip_tbl[i];
+
+ if (ipsa->used)
+ ixgbe_ipsec_set_rx_ip(hw, i, ipsa->ipaddr);
+ else
+ ixgbe_ipsec_set_rx_ip(hw, i, zbuf);
+ }
+
+ /* reload the Rx keys */
+ for (i = 0; i < IXGBE_IPSEC_MAX_SA_COUNT; i++) {
+ struct rx_sa *rsa = &ipsec->rx_tbl[i];
+
+ if (rsa->used)
+ ixgbe_ipsec_set_rx_sa(hw, i, rsa->xs->id.spi,
+ rsa->key, rsa->salt,
+ rsa->mode, rsa->iptbl_ind);
+ else
+ ixgbe_ipsec_set_rx_sa(hw, i, 0, zbuf, 0, 0, 0);
+ }
+
+ /* reload the Tx keys */
+ for (i = 0; i < IXGBE_IPSEC_MAX_SA_COUNT; i++) {
+ struct tx_sa *tsa = &ipsec->tx_tbl[i];
+
+ if (tsa->used)
+ ixgbe_ipsec_set_tx_sa(hw, i, tsa->key, tsa->salt);
+ else
+ ixgbe_ipsec_set_tx_sa(hw, i, zbuf, 0);
+ }
+}
+
+/**
* ixgbe_ipsec_find_empty_idx - find the first unused security parameter index
* @ipsec: pointer to ipsec struct
* @rxtable: true if we need to look in the Rx table
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 01fd89b..6eabf92 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5347,6 +5347,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
ixgbe_set_rx_mode(adapter->netdev);
ixgbe_restore_vlan(adapter);
+ ixgbe_ipsec_restore(adapter);
switch (hw->mac.type) {
case ixgbe_mac_82599EB:
--
2.7.4
next prev parent reply other threads:[~2017-12-05 5:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 5:35 [next-queue 00/10] ixgbe: Add ipsec offload Shannon Nelson
2017-12-05 5:35 ` [next-queue 01/10] ixgbe: clean up ipsec defines Shannon Nelson
2017-12-05 5:35 ` [next-queue 02/10] ixgbe: add ipsec register access routines Shannon Nelson
2017-12-05 16:24 ` [Intel-wired-lan] " Rustad, Mark D
2017-12-05 16:56 ` Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-07 16:02 ` Alexander Duyck
2017-12-07 17:03 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 03/10] ixgbe: add ipsec engine start and stop routines Shannon Nelson
2017-12-05 16:22 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 04/10] ixgbe: add ipsec data structures Shannon Nelson
2017-12-05 17:03 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 05/10] ixgbe: implement ipsec add and remove of offloaded SA Shannon Nelson
2017-12-05 17:26 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-05 5:35 ` Shannon Nelson [this message]
2017-12-05 17:30 ` [Intel-wired-lan] [next-queue 06/10] ixgbe: restore offloaded SAs after a reset Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-07 17:16 ` Alexander Duyck
2017-12-07 18:47 ` Shannon Nelson
2017-12-07 21:52 ` Alexander Duyck
2017-12-07 22:19 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 07/10] ixgbe: process the Rx ipsec offload Shannon Nelson
2017-12-05 17:40 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-07 17:20 ` Alexander Duyck
2017-12-05 5:35 ` [next-queue 08/10] ixgbe: process the Tx " Shannon Nelson
2017-12-05 18:13 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-07 17:56 ` Alexander Duyck
2017-12-07 18:50 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 09/10] ixgbe: ipsec offload stats Shannon Nelson
2017-12-05 19:53 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
2017-12-05 5:35 ` [next-queue 10/10] ixgbe: register ipsec offload with the xfrm subsystem Shannon Nelson
2017-12-05 20:11 ` [Intel-wired-lan] " Alexander Duyck
2017-12-07 5:43 ` Shannon Nelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1512452116-14795-7-git-send-email-shannon.nelson@oracle.com \
--to=shannon.nelson@oracle.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).