Skip to content

Commit 85bc266

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
ixgbe: register ipsec offload with the xfrm subsystem
With all the support code in place we can now link in the ipsec offload operations and set the ESP feature flag for the XFRM subsystem to see. Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent a8a43fd commit 85bc266

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,23 @@ static bool ixgbe_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
718718
return true;
719719
}
720720

721+
/**
722+
* ixgbe_ipsec_free - called by xfrm garbage collections
723+
* @xs: pointer to transformer state struct
724+
*
725+
* We don't have any garbage to collect, so we shouldn't bother
726+
* implementing this function, but the XFRM code doesn't check for
727+
* existence before calling the API callback.
728+
**/
729+
static void ixgbe_ipsec_free(struct xfrm_state *xs)
730+
{
731+
}
732+
721733
static const struct xfrmdev_ops ixgbe_xfrmdev_ops = {
722734
.xdo_dev_state_add = ixgbe_ipsec_add_sa,
723735
.xdo_dev_state_delete = ixgbe_ipsec_del_sa,
724736
.xdo_dev_offload_ok = ixgbe_ipsec_offload_ok,
737+
.xdo_dev_state_free = ixgbe_ipsec_free,
725738
};
726739

727740
/**
@@ -895,6 +908,10 @@ void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter)
895908
ixgbe_ipsec_stop_engine(adapter);
896909
ixgbe_ipsec_clear_hw_tables(adapter);
897910

911+
adapter->netdev->xfrmdev_ops = &ixgbe_xfrmdev_ops;
912+
adapter->netdev->features |= NETIF_F_HW_ESP;
913+
adapter->netdev->hw_enc_features |= NETIF_F_HW_ESP;
914+
898915
return;
899916

900917
err2:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9895,6 +9895,12 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
98959895
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
98969896
features &= ~NETIF_F_TSO;
98979897

9898+
#ifdef CONFIG_XFRM_OFFLOAD
9899+
/* IPsec offload doesn't get along well with others *yet* */
9900+
if (skb->sp)
9901+
features &= ~(NETIF_F_TSO | NETIF_F_HW_CSUM);
9902+
#endif
9903+
98989904
return features;
98999905
}
99009906

0 commit comments

Comments
 (0)