FreeBSD kernel CXGBE device code
t4_crypto.c File Reference
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/sglist.h>
#include <opencrypto/cryptodev.h>
#include <opencrypto/xform.h>
#include "cryptodev_if.h"
#include "common/common.h"
#include "crypto/t4_crypto.h"
Include dependency graph for t4_crypto.c:

Go to the source code of this file.

Data Structures

struct  ccr_session_hmac
 
struct  ccr_session_gmac
 
struct  ccr_session_ccm_mac
 
struct  ccr_session_cipher
 
struct  ccr_port
 
struct  ccr_session
 
struct  ccr_softc
 

Macros

#define MAX_AAD_LEN   511
 
#define MAX_RX_PHYS_DSGL_SGE   32
 
#define DSGL_SGE_MAXLEN   2048
 
#define MAX_REQUEST_SIZE   65535
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_CCR, "ccr", "Chelsio T6 crypto")
 
static int ccr_populate_sglist (struct sglist *sg, struct crypto_buffer *cb)
 
static int ccr_count_sgl (struct sglist *sg, int maxsegsize)
 
static int ccr_phys_dsgl_len (int nsegs)
 
static void ccr_write_phys_dsgl (struct ccr_session *s, void *dst, int nsegs)
 
static int ccr_ulptx_sgl_len (int nsegs)
 
static void ccr_write_ulptx_sgl (struct ccr_session *s, void *dst, int nsegs)
 
static bool ccr_use_imm_data (u_int transhdr_len, u_int input_len)
 
static void ccr_populate_wreq (struct ccr_softc *sc, struct ccr_session *s, struct chcr_wr *crwr, u_int kctx_len, u_int wr_len, u_int imm_len, u_int sgl_len, u_int hash_size, struct cryptop *crp)
 
static int ccr_hash (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 
static int ccr_hash_done (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error)
 
static int ccr_cipher (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 
static int ccr_cipher_done (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error)
 
static int ccr_hmac_ctrl (unsigned int hashsize, unsigned int authsize)
 
static int ccr_eta (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 
static int ccr_eta_done (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error)
 
static int ccr_gcm (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 
static int ccr_gcm_done (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error)
 
static int ccr_ccm_hmac_ctrl (unsigned int authsize)
 
static void generate_ccm_b0 (struct cryptop *crp, u_int hash_size_in_response, const char *iv, char *b0)
 
static int ccr_ccm (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 
static int ccr_ccm_done (struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error)
 
static int ccr_soft_done (struct cryptop *crp)
 
static void ccr_soft (struct ccr_session *s, struct cryptop *crp)
 
static void ccr_identify (driver_t *driver, device_t parent)
 
static int ccr_probe (device_t dev)
 
static void ccr_sysctls (struct ccr_softc *sc)
 
static void ccr_init_port (struct ccr_softc *sc, int port)
 
static int ccr_attach (device_t dev)
 
static void ccr_free_port (struct ccr_softc *sc, int port)
 
static int ccr_detach (device_t dev)
 
static void ccr_init_hash_digest (struct ccr_session *s)
 
static bool ccr_aes_check_keylen (int alg, int klen)
 
static void ccr_aes_setkey (struct ccr_session *s, const void *key, int klen)
 
static bool ccr_auth_supported (const struct crypto_session_params *csp)
 
static bool ccr_cipher_supported (const struct crypto_session_params *csp)
 
static int ccr_cipher_mode (const struct crypto_session_params *csp)
 
static int ccr_probesession (device_t dev, const struct crypto_session_params *csp)
 
static struct ccr_portccr_choose_port (struct ccr_softc *sc)
 
static void ccr_delete_session (struct ccr_session *s)
 
static int ccr_newsession (device_t dev, crypto_session_t cses, const struct crypto_session_params *csp)
 
static void ccr_freesession (device_t dev, crypto_session_t cses)
 
static int ccr_process (device_t dev, struct cryptop *crp, int hint)
 
static int do_cpl6_fw_pld (struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 
static int ccr_modevent (module_t mod, int cmd, void *arg)
 
 DRIVER_MODULE (ccr, t6nex, ccr_driver, ccr_devclass, ccr_modevent, NULL)
 
 MODULE_VERSION (ccr, 1)
 
 MODULE_DEPEND (ccr, crypto, 1, 1, 1)
 
 MODULE_DEPEND (ccr, t6nex, 1, 1, 1)
 

Variables

static device_method_t ccr_methods []
 
static driver_t ccr_driver
 
static devclass_t ccr_devclass
 

Macro Definition Documentation

◆ DSGL_SGE_MAXLEN

#define DSGL_SGE_MAXLEN   2048

Definition at line 131 of file t4_crypto.c.

◆ MAX_AAD_LEN

#define MAX_AAD_LEN   511

Definition at line 122 of file t4_crypto.c.

◆ MAX_REQUEST_SIZE

#define MAX_REQUEST_SIZE   65535

Definition at line 138 of file t4_crypto.c.

◆ MAX_RX_PHYS_DSGL_SGE

#define MAX_RX_PHYS_DSGL_SGE   32

Definition at line 130 of file t4_crypto.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ ccr_aes_check_keylen()

static bool ccr_aes_check_keylen ( int  alg,
int  klen 
)
static

Definition at line 2062 of file t4_crypto.c.

Referenced by ccr_cipher_supported().

Here is the caller graph for this function:

◆ ccr_aes_setkey()

◆ ccr_attach()

◆ ccr_auth_supported()

static bool ccr_auth_supported ( const struct crypto_session_params *  csp)
static

Definition at line 2161 of file t4_crypto.c.

Referenced by ccr_probesession().

Here is the caller graph for this function:

◆ ccr_ccm()

static int ccr_ccm ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 1447 of file t4_crypto.c.

References cpl_tx_sec_pdu::aadstart_cipherstop_hi, ccr_softc::adapter, alloc_wrqe(), CCM_AAD_FIELD_SIZE, CCM_B0_SIZE, ccr_session::ccm_mac, ccr_ccm_hmac_ctrl(), ccr_count_sgl(), ccr_phys_dsgl_len(), ccr_populate_wreq(), ccr_ulptx_sgl_len(), ccr_use_imm_data(), ccr_write_phys_dsgl(), ccr_write_ulptx_sgl(), CHCR_DECRYPT_OP, CHCR_ENCRYPT_OP, CHCR_MAX_CRYPTO_IV_LEN, ccr_session::cipher, CIPHER_TRANSHDR_SIZE, cpl_tx_sec_pdu::cipherstop_lo_authinsert, ulptx_idata::cmd_more, CPL_TX_SEC_PDU, _key_ctx::ctx_hdr, DSGL_SGE_MAXLEN, ccr_session_cipher::enckey, generate_ccm_b0(), ccr_session_ccm_mac::hash_len, cpl_tx_sec_pdu::ivgen_hdrlen, _key_ctx::key, chcr_wr::key_ctx, ccr_session_cipher::key_ctx_hdr, ccr_session_cipher::key_len, ulptx_idata::len, MAX_AAD_LEN, MAX_REQUEST_SIZE, MAX_RX_PHYS_DSGL_SGE, cpl_tx_sec_pdu::op_ivinsrtofst, cpl_tx_sec_pdu::pldlen, ccr_session::port, ccr_port::rx_channel_id, SCMD_AUTH_MODE_CBCMAC, SCMD_CIPH_MODE_AES_CCM, SCMD_PROTO_VERSION_GENERIC, chcr_wr::sec_cpl, cpl_tx_sec_pdu::seqno_numivs, ccr_session::sg_dsgl, ccr_session::sg_input, ccr_softc::sg_iv_aad, ccr_session::sg_output, ccr_session::sg_ulptx, SGE_MAX_WR_LEN, ccr_softc::stats_wr_nomem, t4_wrq_tx(), ccr_port::txq, ULP_TX_SC_NOOP, V_CPL_TX_SEC_PDU_AADSTART, V_CPL_TX_SEC_PDU_AADSTOP, V_CPL_TX_SEC_PDU_ACKFOLLOWS, V_CPL_TX_SEC_PDU_AUTHINSERT, V_CPL_TX_SEC_PDU_AUTHSTART, V_CPL_TX_SEC_PDU_AUTHSTOP, V_CPL_TX_SEC_PDU_CIPHERSTART, V_CPL_TX_SEC_PDU_CIPHERSTOP_HI, V_CPL_TX_SEC_PDU_CIPHERSTOP_LO, V_CPL_TX_SEC_PDU_CPLLEN, V_CPL_TX_SEC_PDU_IVINSRTOFST, V_CPL_TX_SEC_PDU_OPCODE, V_CPL_TX_SEC_PDU_PLACEHOLDER, V_CPL_TX_SEC_PDU_RXCHID, V_CPL_TX_SEC_PDU_ULPTXLPBK, V_SCMD_AADIVDROP, V_SCMD_AUTH_MODE, V_SCMD_CIPH_AUTH_SEQ_CTRL, V_SCMD_CIPH_MODE, V_SCMD_ENC_DEC_CTRL, V_SCMD_HDR_LEN, V_SCMD_HMAC_CTRL, V_SCMD_IV_GEN_CTRL, V_SCMD_IV_SIZE, V_SCMD_LAST_FRAG, V_SCMD_MAC_ONLY, V_SCMD_MORE_FRAGS, V_SCMD_NUM_IVS, V_SCMD_PROTO_VERSION, V_SCMD_SEQ_NO_CTRL, V_ULPTX_CMD, wrqe::wr_len, and wrtod().

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_ccm_done()

static int ccr_ccm_done ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp,
const struct cpl_fw6_pld cpl,
int  error 
)
static

Definition at line 1744 of file t4_crypto.c.

Referenced by do_cpl6_fw_pld().

Here is the caller graph for this function:

◆ ccr_ccm_hmac_ctrl()

static int ccr_ccm_hmac_ctrl ( unsigned int  authsize)
static

Definition at line 1392 of file t4_crypto.c.

References SCMD_HMAC_CTRL_DIV2, SCMD_HMAC_CTRL_IPSEC_96BIT, SCMD_HMAC_CTRL_NO_TRUNC, SCMD_HMAC_CTRL_PL1, SCMD_HMAC_CTRL_PL2, SCMD_HMAC_CTRL_PL3, and SCMD_HMAC_CTRL_TRUNC_RFC4366.

Referenced by ccr_ccm().

Here is the caller graph for this function:

◆ ccr_choose_port()

static struct ccr_port * ccr_choose_port ( struct ccr_softc sc)
static

Definition at line 2273 of file t4_crypto.c.

References ccr_port::active_sessions, sge_iq::adapter, sge_wrq::adapter, sge_rxq::iq, ccr_softc::lock, ccr_softc::port_mask, ccr_softc::ports, ccr_port::rxq, and ccr_port::txq.

Referenced by ccr_newsession().

Here is the caller graph for this function:

◆ ccr_cipher()

static int ccr_cipher ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 622 of file t4_crypto.c.

References cpl_tx_sec_pdu::aadstart_cipherstop_hi, ccr_softc::adapter, alloc_wrqe(), ccr_count_sgl(), ccr_phys_dsgl_len(), ccr_populate_wreq(), ccr_ulptx_sgl_len(), ccr_use_imm_data(), ccr_write_phys_dsgl(), ccr_write_ulptx_sgl(), CHCR_DECRYPT_OP, CHCR_ENCRYPT_OP, CHCR_MAX_CRYPTO_IV_LEN, ccr_session::cipher, ccr_session_cipher::cipher_mode, CIPHER_TRANSHDR_SIZE, cpl_tx_sec_pdu::cipherstop_lo_authinsert, CPL_TX_SEC_PDU, _key_ctx::ctx_hdr, ccr_session_cipher::deckey, DSGL_SGE_MAXLEN, ccr_session_cipher::enckey, ccr_session_cipher::iv_len, cpl_tx_sec_pdu::ivgen_hdrlen, _key_ctx::key, chcr_wr::key_ctx, ccr_session_cipher::key_ctx_hdr, ccr_session_cipher::key_len, MAX_REQUEST_SIZE, MAX_RX_PHYS_DSGL_SGE, cpl_tx_sec_pdu::op_ivinsrtofst, cpl_tx_sec_pdu::pldlen, ccr_session::port, ccr_port::rx_channel_id, SCMD_AUTH_MODE_NOP, SCMD_CIPH_MODE_AES_CBC, SCMD_CIPH_MODE_AES_CTR, SCMD_CIPH_MODE_AES_XTS, SCMD_HMAC_CTRL_NOP, SCMD_PROTO_VERSION_GENERIC, chcr_wr::sec_cpl, cpl_tx_sec_pdu::seqno_numivs, ccr_session::sg_dsgl, ccr_session::sg_input, ccr_session::sg_output, ccr_session::sg_ulptx, SGE_MAX_WR_LEN, ccr_softc::stats_wr_nomem, t4_wrq_tx(), ccr_port::txq, V_CPL_TX_SEC_PDU_ACKFOLLOWS, V_CPL_TX_SEC_PDU_CIPHERSTART, V_CPL_TX_SEC_PDU_CIPHERSTOP_HI, V_CPL_TX_SEC_PDU_CIPHERSTOP_LO, V_CPL_TX_SEC_PDU_CPLLEN, V_CPL_TX_SEC_PDU_IVINSRTOFST, V_CPL_TX_SEC_PDU_OPCODE, V_CPL_TX_SEC_PDU_PLACEHOLDER, V_CPL_TX_SEC_PDU_RXCHID, V_CPL_TX_SEC_PDU_ULPTXLPBK, V_SCMD_AADIVDROP, V_SCMD_AUTH_MODE, V_SCMD_CIPH_MODE, V_SCMD_ENC_DEC_CTRL, V_SCMD_HDR_LEN, V_SCMD_HMAC_CTRL, V_SCMD_IV_GEN_CTRL, V_SCMD_IV_SIZE, V_SCMD_LAST_FRAG, V_SCMD_MAC_ONLY, V_SCMD_MORE_FRAGS, V_SCMD_NUM_IVS, V_SCMD_PROTO_VERSION, V_SCMD_SEQ_NO_CTRL, wrqe::wr_len, and wrtod().

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_cipher_done()

static int ccr_cipher_done ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp,
const struct cpl_fw6_pld cpl,
int  error 
)
static

Definition at line 784 of file t4_crypto.c.

Referenced by do_cpl6_fw_pld().

Here is the caller graph for this function:

◆ ccr_cipher_mode()

static int ccr_cipher_mode ( const struct crypto_session_params *  csp)
static

Definition at line 2207 of file t4_crypto.c.

References SCMD_CIPH_MODE_AES_CBC, SCMD_CIPH_MODE_AES_CCM, SCMD_CIPH_MODE_AES_CTR, SCMD_CIPH_MODE_AES_GCM, SCMD_CIPH_MODE_AES_XTS, and SCMD_CIPH_MODE_NOP.

Referenced by ccr_newsession(), and ccr_probesession().

Here is the caller graph for this function:

◆ ccr_cipher_supported()

static bool ccr_cipher_supported ( const struct crypto_session_params *  csp)
static

Definition at line 2183 of file t4_crypto.c.

References ccr_aes_check_keylen().

Referenced by ccr_probesession().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_count_sgl()

static int ccr_count_sgl ( struct sglist *  sg,
int  maxsegsize 
)
static

Definition at line 311 of file t4_crypto.c.

Referenced by ccr_ccm(), ccr_cipher(), ccr_eta(), and ccr_gcm().

Here is the caller graph for this function:

◆ ccr_delete_session()

static void ccr_delete_session ( struct ccr_session s)
static

Definition at line 2307 of file t4_crypto.c.

References ccr_session::lock, ccr_session::sg_dsgl, ccr_session::sg_input, ccr_session::sg_output, ccr_session::sg_ulptx, and ccr_session::sw_session.

Referenced by ccr_freesession(), and ccr_newsession().

Here is the caller graph for this function:

◆ ccr_detach()

◆ ccr_eta()

static int ccr_eta ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 814 of file t4_crypto.c.

References cpl_tx_sec_pdu::aadstart_cipherstop_hi, ccr_softc::adapter, alloc_wrqe(), ccr_session_hmac::auth_hash, ccr_session_hmac::auth_mode, ccr_count_sgl(), ccr_hmac_ctrl(), ccr_phys_dsgl_len(), ccr_populate_wreq(), ccr_ulptx_sgl_len(), ccr_use_imm_data(), ccr_write_phys_dsgl(), ccr_write_ulptx_sgl(), CHCR_DECRYPT_OP, CHCR_ENCRYPT_OP, CHCR_MAX_CRYPTO_IV_LEN, ccr_session::cipher, ccr_session_cipher::cipher_mode, CIPHER_TRANSHDR_SIZE, cpl_tx_sec_pdu::cipherstop_lo_authinsert, CPL_TX_SEC_PDU, _key_ctx::ctx_hdr, ccr_session_cipher::deckey, DSGL_SGE_MAXLEN, ccr_session_cipher::enckey, ccr_session_hmac::hash_len, ccr_session::hmac, ccr_session_cipher::iv_len, cpl_tx_sec_pdu::ivgen_hdrlen, _key_ctx::key, chcr_wr::key_ctx, ccr_session_cipher::key_ctx_hdr, ccr_session_cipher::key_len, MAX_AAD_LEN, MAX_REQUEST_SIZE, MAX_RX_PHYS_DSGL_SGE, cpl_tx_sec_pdu::op_ivinsrtofst, ccr_session_hmac::pads, ccr_session_hmac::partial_digest_len, cpl_tx_sec_pdu::pldlen, ccr_session::port, ccr_port::rx_channel_id, SCMD_CIPH_MODE_AES_CBC, SCMD_CIPH_MODE_AES_CTR, SCMD_CIPH_MODE_AES_XTS, SCMD_PROTO_VERSION_GENERIC, chcr_wr::sec_cpl, cpl_tx_sec_pdu::seqno_numivs, ccr_session::sg_dsgl, ccr_session::sg_input, ccr_softc::sg_iv_aad, ccr_session::sg_output, ccr_session::sg_ulptx, SGE_MAX_WR_LEN, ccr_softc::stats_wr_nomem, t4_wrq_tx(), ccr_port::txq, V_CPL_TX_SEC_PDU_AADSTART, V_CPL_TX_SEC_PDU_AADSTOP, V_CPL_TX_SEC_PDU_ACKFOLLOWS, V_CPL_TX_SEC_PDU_AUTHINSERT, V_CPL_TX_SEC_PDU_AUTHSTART, V_CPL_TX_SEC_PDU_AUTHSTOP, V_CPL_TX_SEC_PDU_CIPHERSTART, V_CPL_TX_SEC_PDU_CIPHERSTOP_HI, V_CPL_TX_SEC_PDU_CIPHERSTOP_LO, V_CPL_TX_SEC_PDU_CPLLEN, V_CPL_TX_SEC_PDU_IVINSRTOFST, V_CPL_TX_SEC_PDU_OPCODE, V_CPL_TX_SEC_PDU_PLACEHOLDER, V_CPL_TX_SEC_PDU_RXCHID, V_CPL_TX_SEC_PDU_ULPTXLPBK, V_SCMD_AADIVDROP, V_SCMD_AUTH_MODE, V_SCMD_CIPH_AUTH_SEQ_CTRL, V_SCMD_CIPH_MODE, V_SCMD_ENC_DEC_CTRL, V_SCMD_HDR_LEN, V_SCMD_HMAC_CTRL, V_SCMD_IV_GEN_CTRL, V_SCMD_IV_SIZE, V_SCMD_LAST_FRAG, V_SCMD_MAC_ONLY, V_SCMD_MORE_FRAGS, V_SCMD_NUM_IVS, V_SCMD_PROTO_VERSION, V_SCMD_SEQ_NO_CTRL, and wrtod().

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_eta_done()

static int ccr_eta_done ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp,
const struct cpl_fw6_pld cpl,
int  error 
)
static

Definition at line 1107 of file t4_crypto.c.

Referenced by do_cpl6_fw_pld().

Here is the caller graph for this function:

◆ ccr_free_port()

static void ccr_free_port ( struct ccr_softc sc,
int  port 
)
static

Definition at line 2001 of file t4_crypto.c.

References port, ccr_softc::ports, ccr_port::stats_completed, and ccr_port::stats_queued.

Referenced by ccr_detach().

Here is the caller graph for this function:

◆ ccr_freesession()

static void ccr_freesession ( device_t  dev,
crypto_session_t  cses 
)
static

Definition at line 2506 of file t4_crypto.c.

References ccr_port::active_sessions, ccr_delete_session(), ccr_softc::lock, and ccr_session::port.

Here is the call graph for this function:

◆ ccr_gcm()

static int ccr_gcm ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 1119 of file t4_crypto.c.

References cpl_tx_sec_pdu::aadstart_cipherstop_hi, ccr_softc::adapter, alloc_wrqe(), ccr_count_sgl(), ccr_hmac_ctrl(), ccr_phys_dsgl_len(), ccr_populate_wreq(), ccr_ulptx_sgl_len(), ccr_use_imm_data(), ccr_write_phys_dsgl(), ccr_write_ulptx_sgl(), CHCR_DECRYPT_OP, CHCR_ENCRYPT_OP, CHCR_MAX_CRYPTO_IV_LEN, ccr_session::cipher, CIPHER_TRANSHDR_SIZE, cpl_tx_sec_pdu::cipherstop_lo_authinsert, CPL_TX_SEC_PDU, _key_ctx::ctx_hdr, DSGL_SGE_MAXLEN, ccr_session_cipher::enckey, ccr_session_gmac::ghash_h, ccr_session::gmac, ccr_session_gmac::hash_len, cpl_tx_sec_pdu::ivgen_hdrlen, _key_ctx::key, chcr_wr::key_ctx, ccr_session_cipher::key_ctx_hdr, ccr_session_cipher::key_len, MAX_AAD_LEN, MAX_REQUEST_SIZE, MAX_RX_PHYS_DSGL_SGE, cpl_tx_sec_pdu::op_ivinsrtofst, cpl_tx_sec_pdu::pldlen, ccr_session::port, ccr_port::rx_channel_id, SCMD_AUTH_MODE_GHASH, SCMD_CIPH_MODE_AES_GCM, SCMD_PROTO_VERSION_GENERIC, chcr_wr::sec_cpl, cpl_tx_sec_pdu::seqno_numivs, ccr_session::sg_dsgl, ccr_session::sg_input, ccr_softc::sg_iv_aad, ccr_session::sg_output, ccr_session::sg_ulptx, SGE_MAX_WR_LEN, ccr_softc::stats_wr_nomem, t4_wrq_tx(), ccr_port::txq, V_CPL_TX_SEC_PDU_AADSTART, V_CPL_TX_SEC_PDU_AADSTOP, V_CPL_TX_SEC_PDU_ACKFOLLOWS, V_CPL_TX_SEC_PDU_AUTHINSERT, V_CPL_TX_SEC_PDU_AUTHSTART, V_CPL_TX_SEC_PDU_AUTHSTOP, V_CPL_TX_SEC_PDU_CIPHERSTART, V_CPL_TX_SEC_PDU_CIPHERSTOP_HI, V_CPL_TX_SEC_PDU_CIPHERSTOP_LO, V_CPL_TX_SEC_PDU_CPLLEN, V_CPL_TX_SEC_PDU_IVINSRTOFST, V_CPL_TX_SEC_PDU_OPCODE, V_CPL_TX_SEC_PDU_PLACEHOLDER, V_CPL_TX_SEC_PDU_RXCHID, V_CPL_TX_SEC_PDU_ULPTXLPBK, V_SCMD_AADIVDROP, V_SCMD_AUTH_MODE, V_SCMD_CIPH_AUTH_SEQ_CTRL, V_SCMD_CIPH_MODE, V_SCMD_ENC_DEC_CTRL, V_SCMD_HDR_LEN, V_SCMD_HMAC_CTRL, V_SCMD_IV_GEN_CTRL, V_SCMD_IV_SIZE, V_SCMD_LAST_FRAG, V_SCMD_MAC_ONLY, V_SCMD_MORE_FRAGS, V_SCMD_NUM_IVS, V_SCMD_PROTO_VERSION, V_SCMD_SEQ_NO_CTRL, wrqe::wr_len, and wrtod().

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_gcm_done()

static int ccr_gcm_done ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp,
const struct cpl_fw6_pld cpl,
int  error 
)
static

Definition at line 1378 of file t4_crypto.c.

Referenced by do_cpl6_fw_pld().

Here is the caller graph for this function:

◆ ccr_hash()

static int ccr_hash ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 478 of file t4_crypto.c.

References ccr_softc::adapter, alloc_wrqe(), ccr_session_hmac::auth_hash, ccr_session_hmac::auth_mode, ccr_populate_wreq(), ccr_ulptx_sgl_len(), ccr_use_imm_data(), ccr_write_ulptx_sgl(), CHCR_KEYCTX_NO_KEY, cpl_tx_sec_pdu::cipherstop_lo_authinsert, CPL_TX_SEC_PDU, _key_ctx::ctx_hdr, DUMMY_BYTES, HASH_TRANSHDR_SIZE, ccr_session::hmac, cpl_tx_sec_pdu::ivgen_hdrlen, _key_ctx::key, chcr_wr::key_ctx, MAX_REQUEST_SIZE, ccr_session_hmac::mk_size, ccr_session::mode, cpl_tx_sec_pdu::op_ivinsrtofst, ccr_session_hmac::pads, ccr_session_hmac::partial_digest_len, cpl_tx_sec_pdu::pldlen, ccr_session::port, ccr_port::rx_channel_id, SCMD_CIPH_MODE_NOP, SCMD_HMAC_CTRL_NO_TRUNC, SCMD_HMAC_CTRL_NOP, SCMD_PROTO_VERSION_GENERIC, chcr_wr::sec_cpl, cpl_tx_sec_pdu::seqno_numivs, ccr_session::sg_input, ccr_session::sg_ulptx, SGE_MAX_WR_LEN, ccr_softc::stats_wr_nomem, t4_wrq_tx(), ccr_port::txq, V_CPL_TX_SEC_PDU_ACKFOLLOWS, V_CPL_TX_SEC_PDU_AUTHSTART, V_CPL_TX_SEC_PDU_AUTHSTOP, V_CPL_TX_SEC_PDU_CPLLEN, V_CPL_TX_SEC_PDU_IVINSRTOFST, V_CPL_TX_SEC_PDU_OPCODE, V_CPL_TX_SEC_PDU_PLACEHOLDER, V_CPL_TX_SEC_PDU_RXCHID, V_CPL_TX_SEC_PDU_ULPTXLPBK, V_KEY_CONTEXT_CK_SIZE, V_KEY_CONTEXT_CTX_LEN, V_KEY_CONTEXT_MK_SIZE, V_KEY_CONTEXT_OPAD_PRESENT, V_KEY_CONTEXT_SALT_PRESENT, V_KEY_CONTEXT_VALID, V_SCMD_AUTH_MODE, V_SCMD_CIPH_MODE, V_SCMD_HMAC_CTRL, V_SCMD_LAST_FRAG, V_SCMD_MAC_ONLY, V_SCMD_MORE_FRAGS, V_SCMD_PROTO_VERSION, V_SCMD_SEQ_NO_CTRL, and wrtod().

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_hash_done()

static int ccr_hash_done ( struct ccr_softc sc,
struct ccr_session s,
struct cryptop *  crp,
const struct cpl_fw6_pld cpl,
int  error 
)
static

Definition at line 602 of file t4_crypto.c.

References ccr_session_hmac::hash_len, and ccr_session::hmac.

Referenced by do_cpl6_fw_pld().

Here is the caller graph for this function:

◆ ccr_hmac_ctrl()

static int ccr_hmac_ctrl ( unsigned int  hashsize,
unsigned int  authsize 
)
static

Definition at line 801 of file t4_crypto.c.

References SCMD_HMAC_CTRL_DIV2, SCMD_HMAC_CTRL_IPSEC_96BIT, SCMD_HMAC_CTRL_NO_TRUNC, and SCMD_HMAC_CTRL_TRUNC_RFC4366.

Referenced by ccr_eta(), and ccr_gcm().

Here is the caller graph for this function:

◆ ccr_identify()

static void ccr_identify ( driver_t *  driver,
device_t  parent 
)
static

Definition at line 1803 of file t4_crypto.c.

References adapter::cryptocaps, and FW_CAPS_CONFIG_CRYPTO_LOOKASIDE.

◆ ccr_init_hash_digest()

static void ccr_init_hash_digest ( struct ccr_session s)
static

Definition at line 2051 of file t4_crypto.c.

References ccr_session_hmac::auth_hash, ccr_session::hmac, ccr_session_hmac::pads, and t4_copy_partial_hash().

Referenced by ccr_newsession().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_init_port()

◆ ccr_modevent()

static int ccr_modevent ( module_t  mod,
int  cmd,
void *  arg 
)
static

Definition at line 2715 of file t4_crypto.c.

References CPL_FW6_PLD, do_cpl6_fw_pld(), and t4_register_cpl_handler().

Here is the call graph for this function:

◆ ccr_newsession()

◆ ccr_phys_dsgl_len()

static int ccr_phys_dsgl_len ( int  nsegs)
inlinestatic

Definition at line 323 of file t4_crypto.c.

Referenced by ccr_ccm(), ccr_cipher(), ccr_eta(), and ccr_gcm().

Here is the caller graph for this function:

◆ ccr_populate_sglist()

static int ccr_populate_sglist ( struct sglist *  sg,
struct crypto_buffer *  cb 
)
static

Definition at line 278 of file t4_crypto.c.

Referenced by ccr_process().

Here is the caller graph for this function:

◆ ccr_populate_wreq()

static void ccr_populate_wreq ( struct ccr_softc sc,
struct ccr_session s,
struct chcr_wr crwr,
u_int  kctx_len,
u_int  wr_len,
u_int  imm_len,
u_int  sgl_len,
u_int  hash_size,
struct cryptop *  crp 
)
static

◆ ccr_probe()

static int ccr_probe ( device_t  dev)
static

Definition at line 1814 of file t4_crypto.c.

References adapter::dev.

◆ ccr_probesession()

static int ccr_probesession ( device_t  dev,
const struct crypto_session_params *  csp 
)
static

Definition at line 2227 of file t4_crypto.c.

References ccr_auth_supported(), ccr_cipher_mode(), ccr_cipher_supported(), and SCMD_CIPH_MODE_NOP.

Here is the call graph for this function:

◆ ccr_process()

◆ ccr_soft()

static void ccr_soft ( struct ccr_session s,
struct cryptop *  crp 
)
static

Definition at line 1775 of file t4_crypto.c.

References ccr_soft_done(), and ccr_session::sw_session.

Referenced by ccr_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ccr_soft_done()

static int ccr_soft_done ( struct cryptop *  crp)
static

Definition at line 1763 of file t4_crypto.c.

Referenced by ccr_soft().

Here is the caller graph for this function:

◆ ccr_sysctls()

◆ ccr_ulptx_sgl_len()

static int ccr_ulptx_sgl_len ( int  nsegs)
inlinestatic

Definition at line 385 of file t4_crypto.c.

Referenced by ccr_ccm(), ccr_cipher(), ccr_eta(), ccr_gcm(), and ccr_hash().

Here is the caller graph for this function:

◆ ccr_use_imm_data()

static bool ccr_use_imm_data ( u_int  transhdr_len,
u_int  input_len 
)
static

Definition at line 419 of file t4_crypto.c.

References CRYPTO_MAX_IMM_TX_PKT_LEN, and SGE_MAX_WR_LEN.

Referenced by ccr_ccm(), ccr_cipher(), ccr_eta(), ccr_gcm(), and ccr_hash().

Here is the caller graph for this function:

◆ ccr_write_phys_dsgl()

◆ ccr_write_ulptx_sgl()

static void ccr_write_ulptx_sgl ( struct ccr_session s,
void *  dst,
int  nsegs 
)
static

◆ do_cpl6_fw_pld()

static int do_cpl6_fw_pld ( struct sge_iq iq,
const struct rss_header rss,
struct mbuf *  m 
)
static

◆ DRIVER_MODULE()

DRIVER_MODULE ( ccr  ,
t6nex  ,
ccr_driver  ,
ccr_devclass  ,
ccr_modevent  ,
NULL   
)

◆ generate_ccm_b0()

static void generate_ccm_b0 ( struct cryptop *  crp,
u_int  hash_size_in_response,
const char *  iv,
char *  b0 
)
static

Definition at line 1415 of file t4_crypto.c.

References CCM_B0_SIZE.

Referenced by ccr_ccm().

Here is the caller graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_CCR  ,
"ccr"  ,
"Chelsio T6 crypto"   
)
static

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( ccr  ,
crypto  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( ccr  ,
t6nex  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( ccr  ,
 
)

Variable Documentation

◆ ccr_devclass

devclass_t ccr_devclass
static

Definition at line 2750 of file t4_crypto.c.

◆ ccr_driver

driver_t ccr_driver
static
Initial value:
= {
"ccr",
sizeof(struct ccr_softc)
}
static device_method_t ccr_methods[]
Definition: t4_crypto.c:2730

Definition at line 2744 of file t4_crypto.c.

◆ ccr_methods

device_method_t ccr_methods[]
static
Initial value:
= {
DEVMETHOD(device_identify, ccr_identify),
DEVMETHOD(device_probe, ccr_probe),
DEVMETHOD(device_attach, ccr_attach),
DEVMETHOD(device_detach, ccr_detach),
DEVMETHOD(cryptodev_probesession, ccr_probesession),
DEVMETHOD(cryptodev_newsession, ccr_newsession),
DEVMETHOD(cryptodev_freesession, ccr_freesession),
DEVMETHOD(cryptodev_process, ccr_process),
DEVMETHOD_END
}
static int ccr_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp)
Definition: t4_crypto.c:2318
static void ccr_freesession(device_t dev, crypto_session_t cses)
Definition: t4_crypto.c:2506
static int ccr_process(device_t dev, struct cryptop *crp, int hint)
Definition: t4_crypto.c:2526
static int ccr_detach(device_t dev)
Definition: t4_crypto.c:2009
static int ccr_attach(device_t dev)
Definition: t4_crypto.c:1947
static int ccr_probesession(device_t dev, const struct crypto_session_params *csp)
Definition: t4_crypto.c:2227
static void ccr_identify(driver_t *driver, device_t parent)
Definition: t4_crypto.c:1803
static int ccr_probe(device_t dev)
Definition: t4_crypto.c:1814

Definition at line 2730 of file t4_crypto.c.