diff options
author | sam <sam@FreeBSD.org> | 2003-06-30 05:09:32 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-06-30 05:09:32 +0000 |
commit | e6dfb3860abe2078a8f73134b2a74981de357e28 (patch) | |
tree | 5f6e66583ac67766f3158c80d1f5db5a2c905add /sys/opencrypto | |
parent | 3764707074b08f5916418458d97a4853a7738e21 (diff) | |
download | FreeBSD-src-e6dfb3860abe2078a8f73134b2a74981de357e28.zip FreeBSD-src-e6dfb3860abe2078a8f73134b2a74981de357e28.tar.gz |
consolidate callback optimization check in one location by adding a flag
for crypto operations that indicates the crypto code should do the check
in crypto_done
MFC after: 1 day
Diffstat (limited to 'sys/opencrypto')
-rw-r--r-- | sys/opencrypto/crypto.c | 11 | ||||
-rw-r--r-- | sys/opencrypto/cryptodev.h | 13 |
2 files changed, 17 insertions, 7 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index e2683dc..3bb53bc 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -950,7 +950,16 @@ crypto_done(struct cryptop *crp) if (crypto_timing) crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp); #endif - if (crp->crp_flags & CRYPTO_F_CBIMM) { + /* + * CBIMM means unconditionally do the callback immediately; + * CBIFSYNC means do the callback immediately only if the + * operation was done synchronously. Both are used to avoid + * doing extraneous context switches; the latter is mostly + * used with the software crypto driver. + */ + if ((crp->crp_flags & CRYPTO_F_CBIMM) || + ((crp->crp_flags & CRYPTO_F_CBIFSYNC) && + (CRYPTO_SESID2CAPS(crp->crp_sid) & CRYPTOCAP_F_SYNC))) { /* * Do the callback directly. This is ok when the * callback routine does very little (e.g. the diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 2971abe..d281dd5 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -259,12 +259,13 @@ struct cryptop { */ int crp_flags; -#define CRYPTO_F_IMBUF 0x0001 /* Input/output are mbuf chains, otherwise contig */ -#define CRYPTO_F_IOV 0x0002 /* Input/output are uio */ -#define CRYPTO_F_REL 0x0004 /* Must return data in same place */ -#define CRYPTO_F_BATCH 0x0008 /* Batch op if possible */ -#define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */ -#define CRYPTO_F_DONE 0x0020 /* Operation completed */ +#define CRYPTO_F_IMBUF 0x0001 /* Input/output are mbuf chains */ +#define CRYPTO_F_IOV 0x0002 /* Input/output are uio */ +#define CRYPTO_F_REL 0x0004 /* Must return data in same place */ +#define CRYPTO_F_BATCH 0x0008 /* Batch op if possible */ +#define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */ +#define CRYPTO_F_DONE 0x0020 /* Operation completed */ +#define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */ caddr_t crp_buf; /* Data to be processed */ caddr_t crp_opaque; /* Opaque pointer, passed along */ |