#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/highmem.h>
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
#include <net/esp.h>
#include <net/xfrm.h>
#include <crypto/aes.h>
#include <crypto/hash.h>
#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/authenc.h>
#include <crypto/internal/aead.h>
#include <crypto/null.h>
#include <crypto/internal/skcipher.h>
#include <crypto/aead.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/hash.h>
#include "chcr_ipsec.h"
#define MAX_IMM_TX_PKT_LEN …
#define GCM_ESP_IV_SIZE …
static LIST_HEAD(uld_ctx_list);
static DEFINE_MUTEX(dev_mutex);
static bool ch_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *x);
static int ch_ipsec_uld_state_change(void *handle, enum cxgb4_state new_state);
static int ch_ipsec_xmit(struct sk_buff *skb, struct net_device *dev);
static void *ch_ipsec_uld_add(const struct cxgb4_lld_info *infop);
static void ch_ipsec_advance_esn_state(struct xfrm_state *x);
static void ch_ipsec_xfrm_free_state(struct xfrm_state *x);
static void ch_ipsec_xfrm_del_state(struct xfrm_state *x);
static int ch_ipsec_xfrm_add_state(struct xfrm_state *x,
struct netlink_ext_ack *extack);
static const struct xfrmdev_ops ch_ipsec_xfrmdev_ops = …;
static struct cxgb4_uld_info ch_ipsec_uld_info = …;
static void *ch_ipsec_uld_add(const struct cxgb4_lld_info *infop)
{ … }
static int ch_ipsec_uld_state_change(void *handle, enum cxgb4_state new_state)
{ … }
static int ch_ipsec_setauthsize(struct xfrm_state *x,
struct ipsec_sa_entry *sa_entry)
{ … }
static int ch_ipsec_setkey(struct xfrm_state *x,
struct ipsec_sa_entry *sa_entry)
{ … }
static int ch_ipsec_xfrm_add_state(struct xfrm_state *x,
struct netlink_ext_ack *extack)
{ … }
static void ch_ipsec_xfrm_del_state(struct xfrm_state *x)
{ … }
static void ch_ipsec_xfrm_free_state(struct xfrm_state *x)
{ … }
static bool ch_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
{ … }
static void ch_ipsec_advance_esn_state(struct xfrm_state *x)
{ … }
static int is_eth_imm(const struct sk_buff *skb,
struct ipsec_sa_entry *sa_entry)
{ … }
static unsigned int calc_tx_sec_flits(const struct sk_buff *skb,
struct ipsec_sa_entry *sa_entry,
bool *immediate)
{ … }
static void *copy_esn_pktxt(struct sk_buff *skb,
struct net_device *dev,
void *pos,
struct ipsec_sa_entry *sa_entry)
{ … }
static void *copy_cpltx_pktxt(struct sk_buff *skb,
struct net_device *dev,
void *pos,
struct ipsec_sa_entry *sa_entry)
{ … }
static void *copy_key_cpltx_pktxt(struct sk_buff *skb,
struct net_device *dev,
void *pos,
struct ipsec_sa_entry *sa_entry)
{ … }
static void *ch_ipsec_crypto_wreq(struct sk_buff *skb,
struct net_device *dev,
void *pos,
int credits,
struct ipsec_sa_entry *sa_entry)
{ … }
static unsigned int flits_to_desc(unsigned int n)
{ … }
static unsigned int txq_avail(const struct sge_txq *q)
{ … }
static void eth_txq_stop(struct sge_eth_txq *q)
{ … }
static void txq_advance(struct sge_txq *q, unsigned int n)
{ … }
int ch_ipsec_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static int __init ch_ipsec_init(void)
{ … }
static void __exit ch_ipsec_exit(void)
{ … }
module_init(…) …;
module_exit(ch_ipsec_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_VERSION(…);