Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153438844
D40201.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D40201.diff
View Options
diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h
--- a/sys/opencrypto/cryptodev.h
+++ b/sys/opencrypto/cryptodev.h
@@ -302,6 +302,13 @@
#define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op)
#define CIOCCRYPTAEAD _IOWR('c', 109, struct crypt_aead)
+struct cryptotstat {
+ struct timespec acc; /* total accumulated time */
+ struct timespec min; /* min time */
+ struct timespec max; /* max time */
+ uint32_t count; /* number of observations */
+};
+
struct cryptostats {
uint64_t cs_ops; /* symmetric crypto ops submitted */
uint64_t cs_errs; /* symmetric crypto ops that failed */
@@ -311,6 +318,12 @@
uint64_t cs_rets; /* crypto return thread activations */
uint64_t cs_blocks; /* symmetric op driver block */
uint64_t cs_kblocks; /* symmetric op driver block */
+ uint32_t cs_drops; /* crypto ops dropped due to congestion */
+
+ struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */
+ struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */
+ struct cryptotstat cs_cb; /* crypto_done -> callback */
+ struct cryptotstat cs_finis; /* callback -> callback return */
};
#ifdef _KERNEL
diff --git a/tools/tools/crypto/cryptostats.c b/tools/tools/crypto/cryptostats.c
--- a/tools/tools/crypto/cryptostats.c
+++ b/tools/tools/crypto/cryptostats.c
@@ -46,7 +46,7 @@
static void
printt(const char* tag, struct cryptotstat *ts)
{
- uint64_t avg, min, max;
+ unsigned long long avg, min, max;
if (ts->count == 0)
return;
@@ -92,12 +92,12 @@
}
- printf("%u symmetric crypto ops (%u errors, %u times driver blocked)\n"
+ printf("%lu symmetric crypto ops (%lu errors, %lu times driver blocked)\n"
, stats.cs_ops, stats.cs_errs, stats.cs_blocks);
- printf("%u key ops (%u errors, %u times driver blocked)\n"
+ printf("%lu key ops (%lu errors, %lu times driver blocked)\n"
, stats.cs_kops, stats.cs_kerrs, stats.cs_kblocks);
- printf("%u crypto dispatch thread activations\n", stats.cs_intrs);
- printf("%u crypto return thread activations\n", stats.cs_rets);
+ printf("%lu crypto dispatch thread activations\n", stats.cs_intrs);
+ printf("%lu crypto return thread activations\n", stats.cs_rets);
if (stats.cs_invoke.count) {
printf("\n");
printt("dispatch->invoke", &stats.cs_invoke);
diff --git a/tools/tools/crypto/cryptotest.c b/tools/tools/crypto/cryptotest.c
--- a/tools/tools/crypto/cryptotest.c
+++ b/tools/tools/crypto/cryptotest.c
@@ -108,14 +108,12 @@
#define CHUNK 64 /* how much to display */
#define streq(a,b) (strcasecmp(a,b) == 0)
-void hexdump(char *, int);
+static int verbose = 0;
+static int opflags = 0;
+static int verify = 0;
+static int crid = CRYPTO_FLAG_HARDWARE;
-int verbose = 0;
-int opflags = 0;
-int verify = 0;
-int crid = CRYPTO_FLAG_HARDWARE;
-
-struct alg {
+static struct alg {
const char* name;
int ishash;
int blocksize;
@@ -145,6 +143,19 @@
{ "sha512", 1, 8, 64, 64, CRYPTO_SHA2_512_HMAC },
};
+struct alg* getalgbycode(int);
+static void usage(const char*);
+static struct alg* getalgbyname(const char*);
+static int devcrypto(void);
+static int crlookup(const char *);
+static const char * crfind(int);
+static char rdigit(void);
+static void runtest(struct alg *, struct alg *, int, int, u_long, struct timeval *);
+static void printt(const char *, struct cryptotstat *);
+static void runtests(struct alg *, struct alg *, int, int, u_long, int, int);
+static void resetstats(void);
+static void hexdump(char *, int);
+
void
usage(const char* cmd)
{
@@ -173,7 +184,7 @@
struct alg*
getalgbycode(int cipher)
{
- int i;
+ uint64_t i;
for (i = 0; i < nitems(algorithms); i++)
if (cipher == algorithms[i].code)
@@ -184,7 +195,7 @@
struct alg*
getalgbyname(const char* name)
{
- int i;
+ uint64_t i;
for (i = 0; i < nitems(algorithms); i++)
if (streq(name, algorithms[i].name))
@@ -223,12 +234,12 @@
}
const char *
-crfind(int crid)
+crfind(int id)
{
static struct crypt_find_op find;
bzero(&find, sizeof(find));
- find.crid = crid;
+ find.crid = id;
if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1)
err(1, "ioctl(CIOCFINDDEV): crid %d", crid);
return find.name;
@@ -247,8 +258,10 @@
void
runtest(struct alg *ealg, struct alg *alg, int count, int size, u_long cmd, struct timeval *tv)
{
+ uint32_t j;
+ uint64_t k;
int i, fd = devcrypto();
- struct timeval start, stop, dt;
+ struct timeval start, stop;
char *cleartext, *ciphertext, *originaltext, *key;
struct session2_op sop;
struct crypt_op cop;
@@ -267,8 +280,8 @@
key = (char *) malloc(sop.keylen);
if (key == NULL)
err(1, "malloc (key)");
- for (i = 0; i < sop.keylen; i++)
- key[i] = rdigit();
+ for (j = 0; j < sop.keylen; j++)
+ key[j] = rdigit();
sop.key = key;
sop.cipher = ealg->code;
}
@@ -315,8 +328,8 @@
for (i = 0; i < size; i++)
cleartext[i] = rdigit();
memcpy(originaltext, cleartext, size);
- for (i = 0; i < nitems(iv); i++)
- iv[i] = rdigit();
+ for (k = 0; k < nitems(iv); k++)
+ iv[k] = rdigit();
if (verbose) {
printf("session = 0x%x\n", sop.ses);
@@ -410,7 +423,7 @@
#ifdef __FreeBSD__
void
-resetstats()
+resetstats(void)
{
struct cryptostats stats;
size_t slen;
@@ -435,7 +448,7 @@
void
printt(const char* tag, struct cryptotstat *ts)
{
- uint64_t avg, min, max;
+ unsigned long long avg, min, max;
if (ts->count == 0)
return;
@@ -454,7 +467,6 @@
double t;
void *region;
struct timeval *tvp;
- struct timeval total;
int otiming;
if (size % alg->blocksize || (ealg && size % ealg->blocksize)) {
@@ -541,12 +553,14 @@
struct alg *alg = NULL, *ealg = NULL;
char *tmp;
int count = 1;
- int sizes[128], nsizes = 0;
+ int sizes[128];
+ uint64_t nsizes = 0;
u_long cmd = CIOCGSESSION2;
int testall = 0;
int maxthreads = 1;
int profile = 0;
- int i, ch;
+ int ch;
+ uint64_t i;
while ((ch = getopt(argc, argv, "cpzsva:bd:t:")) != -1) {
switch (ch) {
@@ -629,7 +643,7 @@
if (testall) {
for (i = 0; i < nitems(algorithms); i++) {
- int j;
+ uint64_t j;
alg = &algorithms[i];
for (j = 0; j < nsizes; j++)
runtests(ealg, alg, count, sizes[j], cmd, maxthreads, profile);
diff --git a/tools/tools/crypto/hifnstats.c b/tools/tools/crypto/hifnstats.c
--- a/tools/tools/crypto/hifnstats.c
+++ b/tools/tools/crypto/hifnstats.c
@@ -38,7 +38,7 @@
* Little program to dump the statistics block for the hifn driver.
*/
int
-main(int argc, char *argv[])
+main(void)
{
struct hifn_stats stats;
size_t slen;
@@ -47,9 +47,9 @@
if (sysctlbyname("hw.hifn.stats", &stats, &slen, NULL, 0) < 0)
err(1, "kern.hifn.stats");
- printf("input %llu bytes %u packets\n",
+ printf("input %lu bytes %u packets\n",
stats.hst_ibytes, stats.hst_ipackets);
- printf("output %llu bytes %u packets\n",
+ printf("output %lu bytes %u packets\n",
stats.hst_obytes, stats.hst_opackets);
printf("invalid %u nomem %u abort %u\n",
stats.hst_invalid, stats.hst_nomem, stats.hst_abort);
diff --git a/tools/tools/crypto/ipsecstats.c b/tools/tools/crypto/ipsecstats.c
--- a/tools/tools/crypto/ipsecstats.c
+++ b/tools/tools/crypto/ipsecstats.c
@@ -85,7 +85,7 @@
* Little program to dump the statistics block for fast ipsec.
*/
int
-main(int argc, char *argv[])
+main(void)
{
#define STAT(x,fmt) if (x) printf(fmt "\n", (uintmax_t)x)
struct ipsecstat ips;
diff --git a/tools/tools/crypto/safestats.c b/tools/tools/crypto/safestats.c
--- a/tools/tools/crypto/safestats.c
+++ b/tools/tools/crypto/safestats.c
@@ -38,7 +38,7 @@
* Little program to dump the statistics block for the safe driver.
*/
int
-main(int argc, char *argv[])
+main(void)
{
struct safe_stats stats;
size_t slen;
@@ -47,9 +47,9 @@
if (sysctlbyname("hw.safe.stats", &stats, &slen, NULL, 0) < 0)
err(1, "hw.safe.stats");
- printf("input %llu bytes %u packets\n",
+ printf("input %lu bytes %u packets\n",
stats.st_ibytes, stats.st_ipackets);
- printf("output %llu bytes %u packets\n",
+ printf("output %lu bytes %u packets\n",
stats.st_obytes, stats.st_opackets);
printf("invalid %u badsession %u badflags %u\n",
stats.st_invalid, stats.st_badsession, stats.st_badflags);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 4:31 AM (now)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31953447
Default Alt Text
D40201.diff (7 KB)
Attached To
Mode
D40201: Fixed crypto tool compilation errors.
Attached
Detach File
Event Timeline
Log In to Comment