ixgbe_ipsec.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #define IXGBE_RXTXMOD_VF 0x00000020
  25. struct rx_sa {
  26. struct hlist_node hlist;
  27. struct xfrm_state *xs;
  28. __be32 ipaddr[4];
  29. u32 key[4];
  30. u32 salt;
  31. u32 mode;
  32. u8 iptbl_ind;
  33. bool used;
  34. bool decrypt;
  35. u32 vf;
  36. };
  37. struct rx_ip_sa {
  38. __be32 ipaddr[4];
  39. u32 ref_cnt;
  40. bool used;
  41. };
  42. struct tx_sa {
  43. struct xfrm_state *xs;
  44. u32 key[4];
  45. u32 salt;
  46. u32 mode;
  47. bool encrypt;
  48. bool used;
  49. u32 vf;
  50. };
  51. struct ixgbe_ipsec_tx_data {
  52. u32 flags;
  53. u16 trailer_len;
  54. u16 sa_idx;
  55. };
  56. struct ixgbe_ipsec {
  57. u16 num_rx_sa;
  58. u16 num_tx_sa;
  59. struct rx_ip_sa *ip_tbl;
  60. struct rx_sa *rx_tbl;
  61. struct tx_sa *tx_tbl;
  62. DECLARE_HASHTABLE(rx_sa_list, 10);
  63. };
  64. struct sa_mbx_msg {
  65. __be32 spi;
  66. u8 flags;
  67. u8 proto;
  68. u16 family;
  69. __be32 addr[4];
  70. u32 key[5];
  71. };
  72. #endif /* _IXGBE_IPSEC_H_ */