123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- #ifndef __HIFN7751VAR_H__
- #define __HIFN7751VAR_H__
- #ifdef __KERNEL__
- #define HIFN_D_CMD_RSIZE 24
- #define HIFN_D_SRC_RSIZE ((HIFN_D_CMD_RSIZE * 7) / 2)
- #define HIFN_D_RES_RSIZE HIFN_D_CMD_RSIZE
- #define HIFN_D_DST_RSIZE HIFN_D_SRC_RSIZE
- #define HIFN_DES_KEY_LENGTH 8
- #define HIFN_3DES_KEY_LENGTH 24
- #define HIFN_MAX_CRYPT_KEY_LENGTH HIFN_3DES_KEY_LENGTH
- #define HIFN_IV_LENGTH 8
- #define HIFN_AES_IV_LENGTH 16
- #define HIFN_MAX_IV_LENGTH HIFN_AES_IV_LENGTH
- #define HIFN_MAC_KEY_LENGTH 64
- #define HIFN_MD5_LENGTH 16
- #define HIFN_SHA1_LENGTH 20
- #define HIFN_MAC_TRUNC_LENGTH 12
- #define MAX_SCATTER 64
- struct hifn_dma {
-
- struct hifn_desc cmdr[HIFN_D_CMD_RSIZE+1];
- struct hifn_desc srcr[HIFN_D_SRC_RSIZE+1];
- struct hifn_desc dstr[HIFN_D_DST_RSIZE+1];
- struct hifn_desc resr[HIFN_D_RES_RSIZE+1];
- struct hifn_command *hifn_commands[HIFN_D_RES_RSIZE];
- u_char command_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_COMMAND];
- u_char result_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_RESULT];
- u_int32_t slop[HIFN_D_CMD_RSIZE];
- u_int64_t test_src, test_dst;
-
- int cmdi, srci, dsti, resi;
- volatile int cmdu, srcu, dstu, resu;
- int cmdk, srck, dstk, resk;
- };
- struct hifn_session {
- int hs_used;
- int hs_mlen;
- };
- #define HIFN_RING_SYNC(sc, r, i, f) \
-
- #define HIFN_CMDR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), cmdr, (i), (f))
- #define HIFN_RESR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), resr, (i), (f))
- #define HIFN_SRCR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), srcr, (i), (f))
- #define HIFN_DSTR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), dstr, (i), (f))
- #define HIFN_CMD_SYNC(sc, i, f) \
-
- #define HIFN_RES_SYNC(sc, i, f) \
-
- typedef int bus_size_t;
- struct hifn_softc {
- softc_device_decl sc_dev;
- struct pci_dev *sc_pcidev;
- spinlock_t sc_mtx;
- int sc_num;
- ocf_iomem_t sc_bar0;
- bus_size_t sc_bar0_lastreg;
- ocf_iomem_t sc_bar1;
- bus_size_t sc_bar1_lastreg;
- int sc_irq;
- u_int32_t sc_dmaier;
- u_int32_t sc_drammodel;
- u_int32_t sc_pllconfig;
- struct hifn_dma *sc_dma;
- dma_addr_t sc_dma_physaddr;
- int sc_dmansegs;
- int32_t sc_cid;
- int sc_maxses;
- int sc_nsessions;
- struct hifn_session *sc_sessions;
- int sc_ramsize;
- int sc_flags;
- #define HIFN_HAS_RNG 0x1
- #define HIFN_HAS_PUBLIC 0x2
- #define HIFN_HAS_AES 0x4
- #define HIFN_IS_7811 0x8
- #define HIFN_IS_7956 0x10
- struct timer_list sc_tickto;
- int sc_rngfirst;
- int sc_rnghz;
- int sc_c_busy;
- int sc_s_busy;
- int sc_d_busy;
- int sc_r_busy;
- int sc_active;
- int sc_needwakeup;
- int sc_curbatch;
- int sc_suspended;
- #ifdef HIFN_VULCANDEV
- struct cdev *sc_pkdev;
- #endif
- };
- #define HIFN_LOCK(_sc) spin_lock_irqsave(&(_sc)->sc_mtx, l_flags)
- #define HIFN_UNLOCK(_sc) spin_unlock_irqrestore(&(_sc)->sc_mtx, l_flags)
- struct hifn_operand {
- union {
- struct sk_buff *skb;
- struct uio *io;
- unsigned char *buf;
- } u;
- void *map;
- bus_size_t mapsize;
- int nsegs;
- struct {
- dma_addr_t ds_addr;
- int ds_len;
- } segs[MAX_SCATTER];
- };
- struct hifn_command {
- u_int16_t session_num;
- u_int16_t base_masks, cry_masks, mac_masks;
- u_int8_t iv[HIFN_MAX_IV_LENGTH], *ck, mac[HIFN_MAC_KEY_LENGTH];
- int cklen;
- int sloplen, slopidx;
- struct hifn_operand src;
- struct hifn_operand dst;
- struct hifn_softc *softc;
- struct cryptop *crp;
- struct cryptodesc *enccrd, *maccrd;
- };
- #define src_skb src.u.skb
- #define src_io src.u.io
- #define src_map src.map
- #define src_mapsize src.mapsize
- #define src_segs src.segs
- #define src_nsegs src.nsegs
- #define src_buf src.u.buf
- #define dst_skb dst.u.skb
- #define dst_io dst.u.io
- #define dst_map dst.map
- #define dst_mapsize dst.mapsize
- #define dst_segs dst.segs
- #define dst_nsegs dst.nsegs
- #define dst_buf dst.u.buf
- #define HIFN_CRYPTO_SUCCESS 0
- #define HIFN_CRYPTO_BAD_INPUT (-1)
- #define HIFN_CRYPTO_RINGS_FULL (-2)
- #define HIFN_CARD(sid) (((sid) & 0xf0000000) >> 28)
- #define HIFN_SESSION(sid) ((sid) & 0x000007ff)
- #define HIFN_SID(crd,ses) (((crd) << 28) | ((ses) & 0x7ff))
- #endif
- struct hifn_stats {
- u_int64_t hst_ibytes;
- u_int64_t hst_obytes;
- u_int32_t hst_ipackets;
- u_int32_t hst_opackets;
- u_int32_t hst_invalid;
- u_int32_t hst_nomem;
- u_int32_t hst_abort;
- u_int32_t hst_noirq;
- u_int32_t hst_totbatch;
- u_int32_t hst_maxbatch;
- u_int32_t hst_unaligned;
-
- u_int32_t hst_nomem_map;
- u_int32_t hst_nomem_load;
- u_int32_t hst_nomem_mbuf;
- u_int32_t hst_nomem_mcl;
- u_int32_t hst_nomem_cr;
- u_int32_t hst_nomem_sd;
- };
- #endif
|