Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at nocache-cleanup 35 lines 873 B view raw
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * CRC-T10DIF using [V]PCLMULQDQ instructions 4 * 5 * Copyright 2024 Google LLC 6 */ 7 8#include "crc-pclmul-template.h" 9 10static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 11 12DECLARE_CRC_PCLMUL_FUNCS(crc16_msb, u16); 13 14static inline u16 crc_t10dif_arch(u16 crc, const u8 *p, size_t len) 15{ 16 CRC_PCLMUL(crc, p, len, crc16_msb, crc16_msb_0x8bb7_consts, 17 have_pclmulqdq); 18 return crc_t10dif_generic(crc, p, len); 19} 20 21#define crc_t10dif_mod_init_arch crc_t10dif_mod_init_arch 22static void crc_t10dif_mod_init_arch(void) 23{ 24 if (boot_cpu_has(X86_FEATURE_PCLMULQDQ)) { 25 static_branch_enable(&have_pclmulqdq); 26 if (have_vpclmul()) { 27 if (have_avx512()) 28 static_call_update(crc16_msb_pclmul, 29 crc16_msb_vpclmul_avx512); 30 else 31 static_call_update(crc16_msb_pclmul, 32 crc16_msb_vpclmul_avx2); 33 } 34 } 35}