Skip to content

Commit 9e4e30c

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
ixgbe: add VF IPsec offload enable flag
Add a private flag to expressly enable support for VF IPsec offload. The VF will have to be "trusted" in order to use the hardware offload, but because of the general concerns of managing VF access, we want to be sure the user specifically is enabling the feature. This is likely a candidate for becoming a netdev feature flag. Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent eda0333 commit 9e4e30c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ struct ixgbe_adapter {
605605
#define IXGBE_FLAG2_EEE_ENABLED BIT(15)
606606
#define IXGBE_FLAG2_RX_LEGACY BIT(16)
607607
#define IXGBE_FLAG2_IPSEC_ENABLED BIT(17)
608+
#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18)
608609

609610
/* Tx fast path data */
610611
int num_tx_queues;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
136136
static const char ixgbe_priv_flags_strings[][ETH_GSTRING_LEN] = {
137137
#define IXGBE_PRIV_FLAGS_LEGACY_RX BIT(0)
138138
"legacy-rx",
139+
#define IXGBE_PRIV_FLAGS_VF_IPSEC_EN BIT(1)
140+
"vf-ipsec",
139141
};
140142

141143
#define IXGBE_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbe_priv_flags_strings)
@@ -3409,6 +3411,9 @@ static u32 ixgbe_get_priv_flags(struct net_device *netdev)
34093411
if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
34103412
priv_flags |= IXGBE_PRIV_FLAGS_LEGACY_RX;
34113413

3414+
if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED)
3415+
priv_flags |= IXGBE_PRIV_FLAGS_VF_IPSEC_EN;
3416+
34123417
return priv_flags;
34133418
}
34143419

@@ -3421,6 +3426,10 @@ static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags)
34213426
if (priv_flags & IXGBE_PRIV_FLAGS_LEGACY_RX)
34223427
flags2 |= IXGBE_FLAG2_RX_LEGACY;
34233428

3429+
flags2 &= ~IXGBE_FLAG2_VF_IPSEC_ENABLED;
3430+
if (priv_flags & IXGBE_PRIV_FLAGS_VF_IPSEC_EN)
3431+
flags2 |= IXGBE_FLAG2_VF_IPSEC_ENABLED;
3432+
34243433
if (flags2 != adapter->flags2) {
34253434
adapter->flags2 = flags2;
34263435

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,8 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
880880
int err;
881881

882882
sam = (struct sa_mbx_msg *)(&msgbuf[1]);
883-
if (!adapter->vfinfo[vf].trusted) {
883+
if (!adapter->vfinfo[vf].trusted ||
884+
!(adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED)) {
884885
e_warn(drv, "VF %d attempted to add an IPsec SA\n", vf);
885886
err = -EACCES;
886887
goto err_out;

0 commit comments

Comments
 (0)