Skip to content

Commit 7269824

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
ixgbe: add VF IPsec offload request message handling
Add an add and a delete message for IPsec offload requests from the VF. These call into the IPsec functions that can translate the message buffer into a useful IPsec offload. These new messages bump the mbox API version to 1.4. Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 9e4e30c commit 7269824

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,15 +1004,24 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
10041004
struct sk_buff *skb);
10051005
int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
10061006
struct ixgbe_ipsec_tx_data *itd);
1007+
void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter, u32 vf);
1008+
int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
1009+
int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
10071010
#else
1008-
static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { };
1009-
static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { };
1010-
static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { };
1011+
static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { }
1012+
static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { }
1013+
static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { }
10111014
static inline void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
10121015
union ixgbe_adv_rx_desc *rx_desc,
1013-
struct sk_buff *skb) { };
1016+
struct sk_buff *skb) { }
10141017
static inline int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
10151018
struct ixgbe_tx_buffer *first,
1016-
struct ixgbe_ipsec_tx_data *itd) { return 0; };
1019+
struct ixgbe_ipsec_tx_data *itd) { return 0; }
1020+
static inline void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter,
1021+
u32 vf) { }
1022+
static inline int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter,
1023+
u32 *mbuf, u32 vf) { return -EACCES; }
1024+
static inline int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter,
1025+
u32 *mbuf, u32 vf) { return -EACCES; }
10171026
#endif /* CONFIG_XFRM_OFFLOAD */
10181027
#endif /* _IXGBE_H_ */

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum ixgbe_pfvf_api_rev {
5050
ixgbe_mbox_api_11, /* API version 1.1, linux/freebsd VF driver */
5151
ixgbe_mbox_api_12, /* API version 1.2, linux/freebsd VF driver */
5252
ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */
53+
ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */
5354
/* This value should always be last */
5455
ixgbe_mbox_api_unknown, /* indicates that API version is not known */
5556
};
@@ -80,6 +81,10 @@ enum ixgbe_pfvf_api_rev {
8081

8182
#define IXGBE_VF_UPDATE_XCAST_MODE 0x0c
8283

84+
/* mailbox API, version 1.4 VF requests */
85+
#define IXGBE_VF_IPSEC_ADD 0x0d
86+
#define IXGBE_VF_IPSEC_DEL 0x0e
87+
8388
/* length of permanent address message returned from PF */
8489
#define IXGBE_VF_PERMADDR_MSG_LEN 4
8590
/* word in permanent address message with the current multicast type */

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
496496
case ixgbe_mbox_api_11:
497497
case ixgbe_mbox_api_12:
498498
case ixgbe_mbox_api_13:
499+
case ixgbe_mbox_api_14:
499500
/* Version 1.1 supports jumbo frames on VFs if PF has
500501
* jumbo frames enabled which means legacy VFs are
501502
* disabled
@@ -728,6 +729,9 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
728729
/* reset multicast table array for vf */
729730
adapter->vfinfo[vf].num_vf_mc_hashes = 0;
730731

732+
/* clear any ipsec table info */
733+
ixgbe_ipsec_vf_clear(adapter, vf);
734+
731735
/* Flush and reset the mta with the new values */
732736
ixgbe_set_rx_mode(adapter->netdev);
733737

@@ -1000,6 +1004,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter,
10001004
case ixgbe_mbox_api_11:
10011005
case ixgbe_mbox_api_12:
10021006
case ixgbe_mbox_api_13:
1007+
case ixgbe_mbox_api_14:
10031008
adapter->vfinfo[vf].vf_api = api;
10041009
return 0;
10051010
default:
@@ -1025,6 +1030,7 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter,
10251030
case ixgbe_mbox_api_11:
10261031
case ixgbe_mbox_api_12:
10271032
case ixgbe_mbox_api_13:
1033+
case ixgbe_mbox_api_14:
10281034
break;
10291035
default:
10301036
return -1;
@@ -1065,6 +1071,7 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
10651071

10661072
/* verify the PF is supporting the correct API */
10671073
switch (adapter->vfinfo[vf].vf_api) {
1074+
case ixgbe_mbox_api_14:
10681075
case ixgbe_mbox_api_13:
10691076
case ixgbe_mbox_api_12:
10701077
break;
@@ -1097,6 +1104,7 @@ static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter,
10971104

10981105
/* verify the PF is supporting the correct API */
10991106
switch (adapter->vfinfo[vf].vf_api) {
1107+
case ixgbe_mbox_api_14:
11001108
case ixgbe_mbox_api_13:
11011109
case ixgbe_mbox_api_12:
11021110
break;
@@ -1122,8 +1130,9 @@ static int ixgbe_update_vf_xcast_mode(struct ixgbe_adapter *adapter,
11221130
/* promisc introduced in 1.3 version */
11231131
if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
11241132
return -EOPNOTSUPP;
1125-
/* Fall threw */
1133+
/* Fall through */
11261134
case ixgbe_mbox_api_13:
1135+
case ixgbe_mbox_api_14:
11271136
break;
11281137
default:
11291138
return -EOPNOTSUPP;
@@ -1249,6 +1258,12 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
12491258
case IXGBE_VF_UPDATE_XCAST_MODE:
12501259
retval = ixgbe_update_vf_xcast_mode(adapter, msgbuf, vf);
12511260
break;
1261+
case IXGBE_VF_IPSEC_ADD:
1262+
retval = ixgbe_ipsec_vf_add_sa(adapter, msgbuf, vf);
1263+
break;
1264+
case IXGBE_VF_IPSEC_DEL:
1265+
retval = ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf);
1266+
break;
12521267
default:
12531268
e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
12541269
retval = IXGBE_ERR_MBX;

0 commit comments

Comments
 (0)