GNU Linux-libre 5.10.215-gnu1
[releases.git] / drivers / net / ethernet / intel / ixgbevf / ipsec.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2018 Oracle and/or its affiliates. All rights reserved. */
3
4 #ifndef _IXGBEVF_IPSEC_H_
5 #define _IXGBEVF_IPSEC_H_
6
7 #define IXGBE_IPSEC_MAX_SA_COUNT        1024
8 #define IXGBE_IPSEC_BASE_RX_INDEX       0
9 #define IXGBE_IPSEC_BASE_TX_INDEX       IXGBE_IPSEC_MAX_SA_COUNT
10 #define IXGBE_IPSEC_AUTH_BITS           128
11
12 #define IXGBE_RXMOD_VALID               0x00000001
13 #define IXGBE_RXMOD_PROTO_ESP           0x00000004
14 #define IXGBE_RXMOD_DECRYPT             0x00000008
15 #define IXGBE_RXMOD_IPV6                0x00000010
16
17 struct rx_sa {
18         struct hlist_node hlist;
19         struct xfrm_state *xs;
20         __be32 ipaddr[4];
21         u32 key[4];
22         u32 salt;
23         u32 mode;
24         u32 pfsa;
25         bool used;
26         bool decrypt;
27 };
28
29 struct rx_ip_sa {
30         __be32 ipaddr[4];
31         u32 ref_cnt;
32         bool used;
33 };
34
35 struct tx_sa {
36         struct xfrm_state *xs;
37         u32 key[4];
38         u32 salt;
39         u32 pfsa;
40         bool encrypt;
41         bool used;
42 };
43
44 struct ixgbevf_ipsec_tx_data {
45         u32 flags;
46         u16 trailer_len;
47         u16 pfsa;
48 };
49
50 struct ixgbevf_ipsec {
51         u16 num_rx_sa;
52         u16 num_tx_sa;
53         struct rx_sa *rx_tbl;
54         struct tx_sa *tx_tbl;
55         DECLARE_HASHTABLE(rx_sa_list, 10);
56 };
57
58 struct sa_mbx_msg {
59         __be32 spi;
60         u8 flags;
61         u8 proto;
62         u16 family;
63         __be32 addr[4];
64         u32 key[5];
65 };
66 #endif /* _IXGBEVF_IPSEC_H_ */