btrfs-progs: crypto: make the PCL implementation default for crc32c
Drop the old native intel implementation and use the PCL one. Remove the artifical CPU flags. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
992be8b50a
commit
83ac6e0a72
|
@ -58,7 +58,6 @@ void cpu_print_flags(void) {
|
|||
FLAG(SHA);
|
||||
FLAG(AVX);
|
||||
FLAG(AVX2);
|
||||
FLAG(CRC32C_PCL);
|
||||
putchar(10);
|
||||
}
|
||||
#undef FLAG
|
||||
|
@ -89,7 +88,6 @@ void cpu_detect_flags(void)
|
|||
if (b & (1UL << 29))
|
||||
__cpu_flags |= CPU_FLAG_SHA;
|
||||
|
||||
__cpu_flags |= CPU_FLAG_CRC32C_PCL;
|
||||
__cpu_flags_orig = __cpu_flags;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,6 @@ enum cpu_feature {
|
|||
ENUM_CPU_BIT(CPU_FLAG_SHA),
|
||||
ENUM_CPU_BIT(CPU_FLAG_AVX),
|
||||
ENUM_CPU_BIT(CPU_FLAG_AVX2),
|
||||
|
||||
/* Special features */
|
||||
ENUM_CPU_BIT(CPU_FLAG_CRC32C_PCL),
|
||||
};
|
||||
|
||||
#undef ENUM_CPU_BIT
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "crypto/crc32c.h"
|
||||
#include "common/cpu-utils.h"
|
||||
|
||||
uint32_t __crc32c_le(uint32_t crc, unsigned char const *data, uint32_t length);
|
||||
static uint32_t __crc32c_le(uint32_t crc, unsigned char const *data, uint32_t length);
|
||||
static uint32_t (*crc_function)(uint32_t crc, unsigned char const *data, uint32_t length) = __crc32c_le;
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
@ -96,7 +96,7 @@ void crc32c_init_accel(void)
|
|||
*/
|
||||
if (0) {
|
||||
#ifdef __GLIBC__
|
||||
} else if (cpu_has_feature(CPU_FLAG_CRC32C_PCL)) {
|
||||
} else if (cpu_has_feature(CPU_FLAG_SSE42)) {
|
||||
/* printf("CRC32C: pcl\n"); */
|
||||
crc_function = crc32c_pcl;
|
||||
#else
|
||||
|
@ -196,11 +196,11 @@ static const uint32_t crc32c_table[256] = {
|
|||
};
|
||||
|
||||
/*
|
||||
* Steps through buffer one byte at at time, calculates reflected
|
||||
* crc using table.
|
||||
* Steps through buffer one byte at at time, calculates reflected crc using
|
||||
* table.
|
||||
*/
|
||||
|
||||
uint32_t __crc32c_le(uint32_t crc, unsigned char const *data, uint32_t length)
|
||||
static uint32_t __crc32c_le(uint32_t crc, unsigned char const *data, uint32_t length)
|
||||
{
|
||||
while (length--)
|
||||
crc =
|
||||
|
|
|
@ -191,8 +191,6 @@ int main(int argc, char **argv) {
|
|||
.cpu_flag = CPU_FLAG_NONE },
|
||||
{ .name = "CRC32C-NI", .digest = hash_crc32c, .digest_size = 4,
|
||||
.cpu_flag = CPU_FLAG_SSE42 },
|
||||
{ .name = "CRC32C-PCL", .digest = hash_crc32c, .digest_size = 4,
|
||||
.cpu_flag = CPU_FLAG_CRC32C_PCL },
|
||||
{ .name = "XXHASH", .digest = hash_xxhash, .digest_size = 8 },
|
||||
{ .name = "SHA256-ref", .digest = hash_sha256, .digest_size = 32,
|
||||
.cpu_flag = CPU_FLAG_NONE, .backend = CRYPTOPROVIDER_BUILTIN + 1 },
|
||||
|
|
|
@ -444,13 +444,6 @@ static const struct hash_testspec test_spec[] = {
|
|||
.count = ARRAY_SIZE(crc32c_tv),
|
||||
.cpu_flag = CPU_FLAG_SSE42,
|
||||
.hash = hash_crc32c
|
||||
}, {
|
||||
.name = "CRC32C-PCL",
|
||||
.digest_size = 4,
|
||||
.testvec = crc32c_tv,
|
||||
.count = ARRAY_SIZE(crc32c_tv),
|
||||
.cpu_flag = CPU_FLAG_CRC32C_PCL,
|
||||
.hash = hash_crc32c
|
||||
}, {
|
||||
.name = "XXHASH",
|
||||
.digest_size = 8,
|
||||
|
|
Loading…
Reference in New Issue