1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2 /* Copyright (C) 2019 Netronome Systems, Inc. */ 3 4 #ifndef NFP_CRYPTO_H 5 #define NFP_CRYPTO_H 1 6 7 struct net_device; 8 struct nfp_net; 9 struct nfp_net_tls_resync_req; 10 11 struct nfp_net_tls_offload_ctx { 12 __be32 fw_handle[2]; 13 14 u8 rx_end[0]; 15 /* Tx only fields follow - Rx side does not have enough driver state 16 * to fit these 17 */ 18 19 u32 next_seq; 20 }; 21 22 #ifdef CONFIG_TLS_DEVICE 23 int nfp_net_tls_init(struct nfp_net *nn); 24 int nfp_net_tls_rx_resync_req(struct net_device *netdev, 25 struct nfp_net_tls_resync_req *req, 26 void *pkt, unsigned int pkt_len); 27 #else 28 static inline int nfp_net_tls_init(struct nfp_net *nn) 29 { 30 return 0; 31 } 32 33 static inline int 34 nfp_net_tls_rx_resync_req(struct net_device *netdev, 35 struct nfp_net_tls_resync_req *req, 36 void *pkt, unsigned int pkt_len) 37 { 38 return -EOPNOTSUPP; 39 } 40 #endif 41 42 /* IPsec related structures and functions */ 43 struct nfp_ipsec_offload { 44 u32 seq_hi; 45 u32 seq_low; 46 u32 handle; 47 }; 48 49 #ifndef CONFIG_NFP_NET_IPSEC 50 static inline void nfp_net_ipsec_init(struct nfp_net *nn) 51 { 52 } 53 54 static inline void nfp_net_ipsec_clean(struct nfp_net *nn) 55 { 56 } 57 #else 58 void nfp_net_ipsec_init(struct nfp_net *nn); 59 void nfp_net_ipsec_clean(struct nfp_net *nn); 60 bool nfp_net_ipsec_tx_prep(struct nfp_net_dp *dp, struct sk_buff *skb, 61 struct nfp_ipsec_offload *offload_info); 62 int nfp_net_ipsec_rx(struct nfp_meta_parsed *meta, struct sk_buff *skb); 63 #endif 64 65 #endif 66