Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/crypto/t4_crypto.c
Show All 30 Lines | |||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/sglist.h> | #include <sys/sglist.h> | ||||
#include <machine/vmparam.h> | |||||
#include <opencrypto/cryptodev.h> | #include <opencrypto/cryptodev.h> | ||||
#include <opencrypto/xform.h> | #include <opencrypto/xform.h> | ||||
#include "cryptodev_if.h" | #include "cryptodev_if.h" | ||||
#include "common/common.h" | #include "common/common.h" | ||||
#include "crypto/t4_crypto.h" | #include "crypto/t4_crypto.h" | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | case CRYPTO_BUF_MBUF: | ||||
error = sglist_append_mbuf(sg, cb->cb_mbuf); | error = sglist_append_mbuf(sg, cb->cb_mbuf); | ||||
break; | break; | ||||
case CRYPTO_BUF_UIO: | case CRYPTO_BUF_UIO: | ||||
error = sglist_append_uio(sg, cb->cb_uio); | error = sglist_append_uio(sg, cb->cb_uio); | ||||
break; | break; | ||||
case CRYPTO_BUF_CONTIG: | case CRYPTO_BUF_CONTIG: | ||||
error = sglist_append(sg, cb->cb_buf, cb->cb_buf_len); | error = sglist_append(sg, cb->cb_buf, cb->cb_buf_len); | ||||
break; | break; | ||||
#if PMAP_HAS_DMAP | |||||
kib: Look at e.g. sys/powerpc/include/vmparam.h. PMAP_HAS_DMAP can be runtime value. | |||||
Done Inline ActionsDarn! Ok, I can make it a runtime check. Unfortunately, that's going to add a bunch of useless code for arches like x86 where the dmap is never defined. asomers: Darn! Ok, I can make it a runtime check. Unfortunately, that's going to add a bunch of… | |||||
Not Done Inline ActionsYou can make the check conditional on a compile-time define that the particular arch needs it. mjg: You can make the check conditional on a compile-time define that the particular arch needs it. | |||||
Not Done Inline ActionsI think you want #ifdef PMAP_HAS_DMAP if (PMAP_HAS_DMAP) { ... } #endif kib: I think you want
```
#ifdef PMAP_HAS_DMAP
if (PMAP_HAS_DMAP) {
...
}
#endif
``` | |||||
Done Inline ActionsNo, that won't work, because it's defined on all arches. It's just that on some it's defined to 0. At least on those arches, the compiler can eliminate some of the code as dead. asomers: No, that won't work, because it's defined on all arches. It's just that on some it's defined… | |||||
Not Done Inline Actions#if PMAP_HAS_DMAP if (PMAP_HAS_DMAP) { ... } #endif (#if instead of #ifdef) kib: ```
#if PMAP_HAS_DMAP
if (PMAP_HAS_DMAP) {
...
}
#endif
```
(#if instead of #ifdef) | |||||
case CRYPTO_BUF_VMPAGE: | |||||
error = sglist_append_vmpages(sg, cb->cb_vm_page, | |||||
cb->cb_vm_page_len, cb->cb_vm_page_offset); | |||||
break; | |||||
#endif /* PMAP_HAS_DMAP */ | |||||
default: | default: | ||||
error = EINVAL; | error = EINVAL; | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Segments in 'sg' larger than 'maxsegsize' are counted as multiple | * Segments in 'sg' larger than 'maxsegsize' are counted as multiple | ||||
▲ Show 20 Lines • Show All 2,650 Lines • Show Last 20 Lines |
Look at e.g. sys/powerpc/include/vmparam.h. PMAP_HAS_DMAP can be runtime value.