ixgbe_ipsec.h 2.4 KB

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