Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright(c) 2017 Oracle and/or its affiliates. All rights reserved. */
3
4#ifndef _IXGBE_IPSEC_H_
5#define _IXGBE_IPSEC_H_
6
7#define IXGBE_IPSEC_MAX_SA_COUNT 1024
8#define IXGBE_IPSEC_MAX_RX_IP_COUNT 128
9#define IXGBE_IPSEC_BASE_RX_INDEX 0
10#define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT
11#define IXGBE_IPSEC_AUTH_BITS 128
12
13#define IXGBE_RXTXIDX_IPS_EN 0x00000001
14#define IXGBE_RXIDX_TBL_SHIFT 1
15enum ixgbe_ipsec_tbl_sel {
16 ips_rx_ip_tbl = 0x01,
17 ips_rx_spi_tbl = 0x02,
18 ips_rx_key_tbl = 0x03,
19};
20
21#define IXGBE_RXTXIDX_IDX_SHIFT 3
22#define IXGBE_RXTXIDX_READ 0x40000000
23#define IXGBE_RXTXIDX_WRITE 0x80000000
24
25#define IXGBE_RXMOD_VALID 0x00000001
26#define IXGBE_RXMOD_PROTO_ESP 0x00000004
27#define IXGBE_RXMOD_DECRYPT 0x00000008
28#define IXGBE_RXMOD_IPV6 0x00000010
29#define IXGBE_RXTXMOD_VF 0x00000020
30
31struct rx_sa {
32 struct hlist_node hlist;
33 struct xfrm_state *xs;
34 __be32 ipaddr[4];
35 u32 key[4];
36 u32 salt;
37 u32 mode;
38 u8 iptbl_ind;
39 bool used;
40 bool decrypt;
41 u32 vf;
42};
43
44struct rx_ip_sa {
45 __be32 ipaddr[4];
46 u32 ref_cnt;
47 bool used;
48};
49
50struct tx_sa {
51 struct xfrm_state *xs;
52 u32 key[4];
53 u32 salt;
54 u32 mode;
55 bool encrypt;
56 bool used;
57 u32 vf;
58};
59
60struct ixgbe_ipsec_tx_data {
61 u32 flags;
62 u16 trailer_len;
63 u16 sa_idx;
64};
65
66struct ixgbe_ipsec {
67 u16 num_rx_sa;
68 u16 num_tx_sa;
69 struct rx_ip_sa *ip_tbl;
70 struct rx_sa *rx_tbl;
71 struct tx_sa *tx_tbl;
72 DECLARE_HASHTABLE(rx_sa_list, 10);
73};
74
75struct sa_mbx_msg {
76 __be32 spi;
77 u8 dir;
78 u8 proto;
79 u16 family;
80 __be32 addr[4];
81 u32 key[5];
82};
83#endif /* _IXGBE_IPSEC_H_ */
1/* SPDX-License-Identifier: GPL-2.0 */
2/*******************************************************************************
3
4 Intel 10 Gigabit PCI Express Linux driver
5 Copyright(c) 2017 Oracle and/or its affiliates. All rights reserved.
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms and conditions of the GNU General Public License,
9 version 2, as published by the Free Software Foundation.
10
11 This program is distributed in the hope it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along with
17 this program. If not, see <http://www.gnu.org/licenses/>.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28
29#ifndef _IXGBE_IPSEC_H_
30#define _IXGBE_IPSEC_H_
31
32#define IXGBE_IPSEC_MAX_SA_COUNT 1024
33#define IXGBE_IPSEC_MAX_RX_IP_COUNT 128
34#define IXGBE_IPSEC_BASE_RX_INDEX 0
35#define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT
36#define IXGBE_IPSEC_AUTH_BITS 128
37
38#define IXGBE_RXTXIDX_IPS_EN 0x00000001
39#define IXGBE_RXIDX_TBL_SHIFT 1
40enum ixgbe_ipsec_tbl_sel {
41 ips_rx_ip_tbl = 0x01,
42 ips_rx_spi_tbl = 0x02,
43 ips_rx_key_tbl = 0x03,
44};
45
46#define IXGBE_RXTXIDX_IDX_SHIFT 3
47#define IXGBE_RXTXIDX_READ 0x40000000
48#define IXGBE_RXTXIDX_WRITE 0x80000000
49
50#define IXGBE_RXMOD_VALID 0x00000001
51#define IXGBE_RXMOD_PROTO_ESP 0x00000004
52#define IXGBE_RXMOD_DECRYPT 0x00000008
53#define IXGBE_RXMOD_IPV6 0x00000010
54
55struct rx_sa {
56 struct hlist_node hlist;
57 struct xfrm_state *xs;
58 __be32 ipaddr[4];
59 u32 key[4];
60 u32 salt;
61 u32 mode;
62 u8 iptbl_ind;
63 bool used;
64 bool decrypt;
65};
66
67struct rx_ip_sa {
68 __be32 ipaddr[4];
69 u32 ref_cnt;
70 bool used;
71};
72
73struct tx_sa {
74 struct xfrm_state *xs;
75 u32 key[4];
76 u32 salt;
77 bool encrypt;
78 bool used;
79};
80
81struct ixgbe_ipsec_tx_data {
82 u32 flags;
83 u16 trailer_len;
84 u16 sa_idx;
85};
86
87struct ixgbe_ipsec {
88 u16 num_rx_sa;
89 u16 num_tx_sa;
90 struct rx_ip_sa *ip_tbl;
91 struct rx_sa *rx_tbl;
92 struct tx_sa *tx_tbl;
93 DECLARE_HASHTABLE(rx_sa_list, 10);
94};
95#endif /* _IXGBE_IPSEC_H_ */