diff options
author | Sam Leffler <sam@FreeBSD.org> | 2003-06-27 20:07:10 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2003-06-27 20:07:10 +0000 |
commit | 07d0c94a4621a47d1b967e5c7cc7c17f26812f95 (patch) | |
tree | abc501f01c8b5f6abaa2809bc2c82a2c09eaf55e /sys/opencrypto/cryptodev.h | |
parent | 23252eeabe2b8e19d509f9ff49d995def75481ae (diff) | |
download | src-07d0c94a4621a47d1b967e5c7cc7c17f26812f95.tar.gz src-07d0c94a4621a47d1b967e5c7cc7c17f26812f95.zip |
Add support to eliminate a context switch per crypto op when using the
software crypto device:
o record crypto device capabilities in each session id
o add a capability that indicates if the crypto driver operates synchronously
o tag the software crypto driver as operating synchronously
This commit also introduces crypto session id macros that cleanup their
construction and querying.
Notes
Notes:
svn path=/head/; revision=116924
Diffstat (limited to 'sys/opencrypto/cryptodev.h')
-rw-r--r-- | sys/opencrypto/cryptodev.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index d7894a6b1b41..2971abe33e25 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -317,8 +317,9 @@ struct cryptocap { u_int8_t cc_flags; u_int8_t cc_qblocked; /* symmetric q blocked */ u_int8_t cc_kqblocked; /* asymmetric q blocked */ -#define CRYPTOCAP_F_CLEANUP 0x1 -#define CRYPTOCAP_F_SOFTWARE 0x02 +#define CRYPTOCAP_F_CLEANUP 0x01 /* needs resource cleanup */ +#define CRYPTOCAP_F_SOFTWARE 0x02 /* software implementation */ +#define CRYPTOCAP_F_SYNC 0x04 /* operates synchronously */ void *cc_arg; /* callback argument */ int (*cc_newsession)(void*, u_int32_t*, struct cryptoini*); @@ -328,6 +329,17 @@ struct cryptocap { int (*cc_kprocess) (void*, struct cryptkop *, int); }; +/* + * Session ids are 64 bits. The lower 32 bits contain a "local id" which + * is a driver-private session identifier. The upper 32 bits contain a + * "hardware id" used by the core crypto code to identify the driver and + * a copy of the driver's capabilities that can be used by client code to + * optimize operation. + */ +#define CRYPTO_SESID2HID(_sid) (((_sid) >> 32) & 0xffffff) +#define CRYPTO_SESID2CAPS(_sid) (((_sid) >> 56) & 0xff) +#define CRYPTO_SESID2LID(_sid) (((u_int32_t) (_sid)) & 0xffffffff) + MALLOC_DECLARE(M_CRYPTO_DATA); extern int crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard); |