84 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/* Copyright(c) 2017 Oracle and/or its affiliates. All rights reserved. */3 4#ifndef _IXGBE_IPSEC_H_5#define _IXGBE_IPSEC_H_6 7#define IXGBE_IPSEC_MAX_SA_COUNT 10248#define IXGBE_IPSEC_MAX_RX_IP_COUNT 1289#define IXGBE_IPSEC_BASE_RX_INDEX 010#define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT11#define IXGBE_IPSEC_AUTH_BITS 12812 13#define IXGBE_RXTXIDX_IPS_EN 0x0000000114#define IXGBE_RXIDX_TBL_SHIFT 115enum ixgbe_ipsec_tbl_sel {16 ips_rx_ip_tbl = 0x01,17 ips_rx_spi_tbl = 0x02,18 ips_rx_key_tbl = 0x03,19};20 21#define IXGBE_RXTXIDX_IDX_SHIFT 322#define IXGBE_RXTXIDX_READ 0x4000000023#define IXGBE_RXTXIDX_WRITE 0x8000000024 25#define IXGBE_RXMOD_VALID 0x0000000126#define IXGBE_RXMOD_PROTO_ESP 0x0000000427#define IXGBE_RXMOD_DECRYPT 0x0000000828#define IXGBE_RXMOD_IPV6 0x0000001029#define IXGBE_RXTXMOD_VF 0x0000002030 31struct rx_sa {32 struct hlist_node hlist;33 struct xfrm_state *xs;34 __be32 ipaddr[4];35 u32 key[4];36 u32 salt;37 u32 mode;38 u8 iptbl_ind;39 bool used;40 bool decrypt;41 u32 vf;42};43 44struct rx_ip_sa {45 __be32 ipaddr[4];46 u32 ref_cnt;47 bool used;48};49 50struct tx_sa {51 struct xfrm_state *xs;52 u32 key[4];53 u32 salt;54 u32 mode;55 bool encrypt;56 bool used;57 u32 vf;58};59 60struct ixgbe_ipsec_tx_data {61 u32 flags;62 u16 trailer_len;63 u16 sa_idx;64};65 66struct ixgbe_ipsec {67 u16 num_rx_sa;68 u16 num_tx_sa;69 struct rx_ip_sa *ip_tbl;70 struct rx_sa *rx_tbl;71 struct tx_sa *tx_tbl;72 DECLARE_HASHTABLE(rx_sa_list, 10);73};74 75struct sa_mbx_msg {76 __be32 spi;77 u8 dir;78 u8 proto;79 u16 family;80 __be32 addr[4];81 u32 key[5];82};83#endif /* _IXGBE_IPSEC_H_ */84