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 40 enum 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 55 struct 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 67 struct rx_ip_sa { 68 __be32 ipaddr[4]; 69 u32 ref_cnt; 70 bool used; 71 }; 72 73 struct tx_sa { 74 struct xfrm_state *xs; 75 u32 key[4]; 76 u32 salt; 77 bool encrypt; 78 bool used; 79 }; 80 81 struct ixgbe_ipsec_tx_data { 82 u32 flags; 83 u16 trailer_len; 84 u16 sa_idx; 85 }; 86 87 struct 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_ */ 96