From: Eric Biggers <ebiggers@kernel.org>
To: dsterba@suse.cz, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Can crypto API provide information about hw acceleration?
Date: Tue, 14 May 2019 14:34:10 -0700 [thread overview]
Message-ID: <20190514213409.GA115510@gmail.com> (raw)
In-Reply-To: <20190514163348.GM3138@twin.jikos.cz>
On Tue, May 14, 2019 at 06:33:48PM +0200, David Sterba wrote:
> Hi,
>
> Q: is there a way to query the crypto layer whether a given algorithm
> (digest, crypto) is accelerated by the driver?
>
> This information can be used to decide if eg. a checksum should can be
> calculated right away or offloaded to a thread. This is done in btrfs,
> (fs/btrfs/disk-io.c:check_async_write).
>
> At this moment it contains a static check for a cpu feature, and only
> for x86. I briefly searched the arch/ directory for implementations of
> crc32c that possibly use hw aid and there are several of them. Adding a
> static check a-la x86 for the other architectures (arm, ppc, mips,
> sparc, s390) is wrong, so I'm looking for a clean solution.
>
> The struct shash_alg definition of the algorithms does not say anything
> about the acceleration. The closest thing is the cra_priority, but I
> don't know if this is reliable information. The default implementations
> seem to have 100, and acceleated 200 or 300.
>
> This would be probably sufficient, but I'd like a confirmation from
> crypto people.
>
There's only one default implementation of crc32c, not multiple, and it has
priority 100. All other crc32c implementations have priority > 100. So yes,
you can check the priority (which would require adding a function to
lib/libcrc32c.c to get it). Alternatively you could check whether the driver
name is "crc32c-generic" or not.
- Eric
next prev parent reply other threads:[~2019-05-14 21:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 16:33 Can crypto API provide information about hw acceleration? David Sterba
2019-05-14 21:34 ` Eric Biggers [this message]
2019-05-15 12:55 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514213409.GA115510@gmail.com \
--to=ebiggers@kernel.org \
--cc=dsterba@suse.cz \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.