| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Accelerated CRC-T10DIF using ARM NEON and Crypto Extensions instructions |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #include <linux/crc-t10dif.h> |
|---|
| .. | .. |
|---|
| 15 | 12 | #include <linux/string.h> |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | #include <crypto/internal/hash.h> |
|---|
| 15 | +#include <crypto/internal/simd.h> |
|---|
| 18 | 16 | |
|---|
| 19 | 17 | #include <asm/neon.h> |
|---|
| 20 | 18 | #include <asm/simd.h> |
|---|
| 21 | 19 | |
|---|
| 22 | 20 | #define CRC_T10DIF_PMULL_CHUNK_SIZE 16U |
|---|
| 23 | 21 | |
|---|
| 24 | | -asmlinkage u16 crc_t10dif_pmull(u16 init_crc, const u8 buf[], u32 len); |
|---|
| 22 | +asmlinkage u16 crc_t10dif_pmull(u16 init_crc, const u8 *buf, size_t len); |
|---|
| 25 | 23 | |
|---|
| 26 | 24 | static int crct10dif_init(struct shash_desc *desc) |
|---|
| 27 | 25 | { |
|---|
| .. | .. |
|---|
| 36 | 34 | { |
|---|
| 37 | 35 | u16 *crc = shash_desc_ctx(desc); |
|---|
| 38 | 36 | |
|---|
| 39 | | - if (length >= CRC_T10DIF_PMULL_CHUNK_SIZE && may_use_simd()) { |
|---|
| 37 | + if (length >= CRC_T10DIF_PMULL_CHUNK_SIZE && crypto_simd_usable()) { |
|---|
| 40 | 38 | kernel_neon_begin(); |
|---|
| 41 | 39 | *crc = crc_t10dif_pmull(*crc, data, length); |
|---|
| 42 | 40 | kernel_neon_end(); |
|---|