ixgbe_ipsec.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 2017 Oracle and/or its affiliates. All rights reserved. */
  3. #ifndef _IXGBE_IPSEC_H_
  4. #define _IXGBE_IPSEC_H_
  5. #define IXGBE_IPSEC_MAX_SA_COUNT 1024
  6. #define IXGBE_IPSEC_MAX_RX_IP_COUNT 128
  7. #define IXGBE_IPSEC_BASE_RX_INDEX 0
  8. #define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT
  9. #define IXGBE_IPSEC_AUTH_BITS 128
  10. #define IXGBE_RXTXIDX_IPS_EN 0x00000001
  11. #define IXGBE_RXIDX_TBL_SHIFT 1
  12. enum ixgbe_ipsec_tbl_sel {
  13. ips_rx_ip_tbl = 0x01,
  14. ips_rx_spi_tbl = 0x02,
  15. ips_rx_key_tbl = 0x03,
  16. };
  17. #define IXGBE_RXTXIDX_IDX_SHIFT 3
  18. #define IXGBE_RXTXIDX_READ 0x40000000
  19. #define IXGBE_RXTXIDX_WRITE 0x80000000
  20. #define IXGBE_RXMOD_VALID 0x00000001
  21. #define IXGBE_RXMOD_PROTO_ESP 0x00000004
  22. #define IXGBE_RXMOD_DECRYPT 0x00000008
  23. #define IXGBE_RXMOD_IPV6 0x00000010
  24. struct rx_sa {
  25. struct hlist_node hlist;
  26. struct xfrm_state *xs;
  27. __be32 ipaddr[4];
  28. u32 key[4];
  29. u32 salt;
  30. u32 mode;
  31. u8 iptbl_ind;
  32. bool used;
  33. bool decrypt;
  34. };
  35. struct rx_ip_sa {
  36. __be32 ipaddr[4];
  37. u32 ref_cnt;
  38. bool used;
  39. };
  40. struct tx_sa {
  41. struct xfrm_state *xs;
  42. u32 key[4];
  43. u32 salt;
  44. bool encrypt;
  45. bool used;
  46. };
  47. struct ixgbe_ipsec_tx_data {
  48. u32 flags;
  49. u16 trailer_len;
  50. u16 sa_idx;
  51. };
  52. struct ixgbe_ipsec {
  53. u16 num_rx_sa;
  54. u16 num_tx_sa;
  55. struct rx_ip_sa *ip_tbl;
  56. struct rx_sa *rx_tbl;
  57. struct tx_sa *tx_tbl;
  58. DECLARE_HASHTABLE(rx_sa_list, 10);
  59. };
  60. #endif /* _IXGBE_IPSEC_H_ */