Commit 0062e7cc authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

ixgbevf: add VF IPsec offload code

Add the IPsec offload support code.  This is based off of the similar
code in ixgbe, but instead of writing the SA registers, the VF asks
the PF to setup the offload by sending the offload information to the
PF via the standard mailbox.
Signed-off-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent adef9a26
...@@ -10,4 +10,5 @@ ixgbevf-objs := vf.o \ ...@@ -10,4 +10,5 @@ ixgbevf-objs := vf.o \
mbx.o \ mbx.o \
ethtool.o \ ethtool.o \
ixgbevf_main.o ixgbevf_main.o
ixgbevf-$(CONFIG_XFRM_OFFLOAD) += ipsec.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2018 Oracle and/or its affiliates. All rights reserved. */
#ifndef _IXGBEVF_IPSEC_H_
#define _IXGBEVF_IPSEC_H_
#define IXGBE_IPSEC_MAX_SA_COUNT 1024
#define IXGBE_IPSEC_BASE_RX_INDEX 0
#define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT
#define IXGBE_IPSEC_AUTH_BITS 128
#define IXGBE_RXMOD_VALID 0x00000001
#define IXGBE_RXMOD_PROTO_ESP 0x00000004
#define IXGBE_RXMOD_DECRYPT 0x00000008
#define IXGBE_RXMOD_IPV6 0x00000010
struct rx_sa {
struct hlist_node hlist;
struct xfrm_state *xs;
__be32 ipaddr[4];
u32 key[4];
u32 salt;
u32 mode;
u32 pfsa;
bool used;
bool decrypt;
};
struct rx_ip_sa {
__be32 ipaddr[4];
u32 ref_cnt;
bool used;
};
struct tx_sa {
struct xfrm_state *xs;
u32 key[4];
u32 salt;
u32 pfsa;
bool encrypt;
bool used;
};
struct ixgbevf_ipsec_tx_data {
u32 flags;
u16 trailer_len;
u16 pfsa;
};
struct ixgbevf_ipsec {
u16 num_rx_sa;
u16 num_tx_sa;
struct rx_sa *rx_tbl;
struct tx_sa *tx_tbl;
DECLARE_HASHTABLE(rx_sa_list, 10);
};
struct sa_mbx_msg {
__be32 spi;
u8 flags;
u8 proto;
u16 family;
__be32 addr[4];
u32 key[5];
};
#endif /* _IXGBEVF_IPSEC_H_ */
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <net/xdp.h> #include <net/xdp.h>
#include "vf.h" #include "vf.h"
#include "ipsec.h"
#define IXGBE_MAX_TXD_PWR 14 #define IXGBE_MAX_TXD_PWR 14
#define IXGBE_MAX_DATA_PER_TXD BIT(IXGBE_MAX_TXD_PWR) #define IXGBE_MAX_DATA_PER_TXD BIT(IXGBE_MAX_TXD_PWR)
...@@ -163,6 +164,7 @@ struct ixgbevf_ring { ...@@ -163,6 +164,7 @@ struct ixgbevf_ring {
#define IXGBE_TX_FLAGS_VLAN BIT(1) #define IXGBE_TX_FLAGS_VLAN BIT(1)
#define IXGBE_TX_FLAGS_TSO BIT(2) #define IXGBE_TX_FLAGS_TSO BIT(2)
#define IXGBE_TX_FLAGS_IPV4 BIT(3) #define IXGBE_TX_FLAGS_IPV4 BIT(3)
#define IXGBE_TX_FLAGS_IPSEC BIT(4)
#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000 #define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000 #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000
#define IXGBE_TX_FLAGS_VLAN_SHIFT 16 #define IXGBE_TX_FLAGS_VLAN_SHIFT 16
...@@ -338,6 +340,7 @@ struct ixgbevf_adapter { ...@@ -338,6 +340,7 @@ struct ixgbevf_adapter {
struct ixgbevf_ring *tx_ring[MAX_TX_QUEUES]; /* One per active queue */ struct ixgbevf_ring *tx_ring[MAX_TX_QUEUES]; /* One per active queue */
u64 restart_queue; u64 restart_queue;
u32 tx_timeout_count; u32 tx_timeout_count;
u64 tx_ipsec;
/* RX */ /* RX */
int num_rx_queues; int num_rx_queues;
...@@ -348,6 +351,7 @@ struct ixgbevf_adapter { ...@@ -348,6 +351,7 @@ struct ixgbevf_adapter {
u64 alloc_rx_page_failed; u64 alloc_rx_page_failed;
u64 alloc_rx_buff_failed; u64 alloc_rx_buff_failed;
u64 alloc_rx_page; u64 alloc_rx_page;
u64 rx_ipsec;
struct msix_entry *msix_entries; struct msix_entry *msix_entries;
...@@ -384,6 +388,10 @@ struct ixgbevf_adapter { ...@@ -384,6 +388,10 @@ struct ixgbevf_adapter {
u8 rss_indir_tbl[IXGBEVF_X550_VFRETA_SIZE]; u8 rss_indir_tbl[IXGBEVF_X550_VFRETA_SIZE];
u32 flags; u32 flags;
#define IXGBEVF_FLAGS_LEGACY_RX BIT(1) #define IXGBEVF_FLAGS_LEGACY_RX BIT(1)
#ifdef CONFIG_XFRM
struct ixgbevf_ipsec *ipsec;
#endif /* CONFIG_XFRM */
}; };
enum ixbgevf_state_t { enum ixbgevf_state_t {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment