Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2017 Oracle and/or its affiliates. All rights reserved. */
0003 
0004 #ifndef _IXGBE_IPSEC_H_
0005 #define _IXGBE_IPSEC_H_
0006 
0007 #define IXGBE_IPSEC_MAX_SA_COUNT    1024
0008 #define IXGBE_IPSEC_MAX_RX_IP_COUNT 128
0009 #define IXGBE_IPSEC_BASE_RX_INDEX   0
0010 #define IXGBE_IPSEC_BASE_TX_INDEX   IXGBE_IPSEC_MAX_SA_COUNT
0011 #define IXGBE_IPSEC_AUTH_BITS       128
0012 
0013 #define IXGBE_RXTXIDX_IPS_EN        0x00000001
0014 #define IXGBE_RXIDX_TBL_SHIFT       1
0015 enum ixgbe_ipsec_tbl_sel {
0016     ips_rx_ip_tbl   =   0x01,
0017     ips_rx_spi_tbl  =   0x02,
0018     ips_rx_key_tbl  =   0x03,
0019 };
0020 
0021 #define IXGBE_RXTXIDX_IDX_SHIFT     3
0022 #define IXGBE_RXTXIDX_READ      0x40000000
0023 #define IXGBE_RXTXIDX_WRITE     0x80000000
0024 
0025 #define IXGBE_RXMOD_VALID       0x00000001
0026 #define IXGBE_RXMOD_PROTO_ESP       0x00000004
0027 #define IXGBE_RXMOD_DECRYPT     0x00000008
0028 #define IXGBE_RXMOD_IPV6        0x00000010
0029 #define IXGBE_RXTXMOD_VF        0x00000020
0030 
0031 struct rx_sa {
0032     struct hlist_node hlist;
0033     struct xfrm_state *xs;
0034     __be32 ipaddr[4];
0035     u32 key[4];
0036     u32 salt;
0037     u32 mode;
0038     u8  iptbl_ind;
0039     bool used;
0040     bool decrypt;
0041     u32 vf;
0042 };
0043 
0044 struct rx_ip_sa {
0045     __be32 ipaddr[4];
0046     u32 ref_cnt;
0047     bool used;
0048 };
0049 
0050 struct tx_sa {
0051     struct xfrm_state *xs;
0052     u32 key[4];
0053     u32 salt;
0054     u32 mode;
0055     bool encrypt;
0056     bool used;
0057     u32 vf;
0058 };
0059 
0060 struct ixgbe_ipsec_tx_data {
0061     u32 flags;
0062     u16 trailer_len;
0063     u16 sa_idx;
0064 };
0065 
0066 struct ixgbe_ipsec {
0067     u16 num_rx_sa;
0068     u16 num_tx_sa;
0069     struct rx_ip_sa *ip_tbl;
0070     struct rx_sa *rx_tbl;
0071     struct tx_sa *tx_tbl;
0072     DECLARE_HASHTABLE(rx_sa_list, 10);
0073 };
0074 
0075 struct sa_mbx_msg {
0076     __be32 spi;
0077     u8 dir;
0078     u8 proto;
0079     u16 family;
0080     __be32 addr[4];
0081     u32 key[5];
0082 };
0083 #endif /* _IXGBE_IPSEC_H_ */