Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4506119imm; Sat, 25 Aug 2018 19:43:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYlCBPLbSn6p94ZenF6No31IRTugaH9UrXCgOgPxhPapbCuTW+aE8rulG0qIqKnKYAWWYND X-Received: by 2002:a65:594b:: with SMTP id g11-v6mr7475835pgu.260.1535251393312; Sat, 25 Aug 2018 19:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535251393; cv=none; d=google.com; s=arc-20160816; b=RbV/TQL0H9oU6X7BeK8+2tDoZTBM9jiq168kjrk8vetNfTgohmscN0WqthF0TBTj4n eCu0vy9SvH5ZdUKkElANrHbO07jACCN9WWAz2+WWNXpcMGut0ykavxx8IGMVpp/dTsqk Xh6tk6CTCwWJyrFJoGDimN3Ksea0coD2r9WGZcllDvbGbQW7KAsvHtcQOlLmmdAnbyra qhfEzkU9UTjHKcY7jRm3Ne6Xb21b0vhBopjGtTJFUWa72RdsPnpwgEEAzFcG2EFtCDPE 94Vw1GTjV/Kxzw518/iCu/BBj2n13ASsDFpAZZuj598aDJ+ScfgwG5YgPNG/VOv/tRff nY5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2e13kRzdgf6jvIJ2TgDjQEI+9y8ibJYSbmj/+EiFKtI=; b=xCasMsRXOo1cOnDth17q6SE7HkDJPXExRNVN2IbSpBM94xxML4Ja+p9H1CZJ0pX55J 1AcdiNTLquVyW+kANt0m9k1OHMH8Nxbs5rQLiIVAjXMRI+vWGXagbCLtKUNWZCELxBiY GIpdsl/xZ/wnaCv9m97eJdpUSIy/Gjxrmu8t25BERN5RXgWjpmBk03C0XeSxehU+oVsJ nTl53+wWo/1BW90jTBZA8Q34XZN+Ui2V2hv56ST/Q1VUppNzsOTQrWjbNKG35y/TtcX1 nji7B8rqTSWF9LPdMk1fIV2X1RqGen9+bw3B/3vgCe7NlYGMfMCutrS5oaToFhuK/bSt kiaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=KlPRHeBy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8-v6si10568813pls.137.2018.08.25.19.42.58; Sat, 25 Aug 2018 19:43:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=KlPRHeBy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbeHZGW2 (ORCPT + 99 others); Sun, 26 Aug 2018 02:22:28 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:42432 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726503AbeHZGW2 (ORCPT ); Sun, 26 Aug 2018 02:22:28 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7Q2cVhb018143; Sun, 26 Aug 2018 02:40:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=2e13kRzdgf6jvIJ2TgDjQEI+9y8ibJYSbmj/+EiFKtI=; b=KlPRHeBypunY3smQ4K7kdnlGUPMpJL36Hc/TAT91hzMyW9grIaPTSYfd+FpaHuqhq7S0 WjqyikDCS8pcLcWkiDgvihYExx1lFJM5OHOD0BrEJKapFqWuPoPPdyOKd8ATtQxzT8z/ dWLlh/us8dqXspfvfBJUHn6VRoTYPQljookyUcwcTBnOQcgFlFLV1YTq8cOVFI8ot9pi YtvlmK3gcOirBzNpRsB+42g0A513v29CXk+sq70zWV6knCJSXfMi9LPDlkdOsm4uVmru wwfranDBPLl+ZLzCHsBU3kkdzQbwmb70l1I44Qg1XqJpU+yuLs+fJmzqHG3GiDdWGRrM 0w== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2m2xht9mak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 26 Aug 2018 02:40:11 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7Q2eArH031921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 26 Aug 2018 02:40:10 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w7Q2eAos012424; Sun, 26 Aug 2018 02:40:10 GMT Received: from ca-mkp.ca.oracle.com (/10.156.108.201) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 25 Aug 2018 19:40:10 -0700 From: "Martin K. Petersen" To: herbert@gondor.apana.org.au Cc: Jeff.Lien@wdc.com, ard.biesheuvel@linaro.org, david.darrington@wdc.com, hch@infradead.org, jeff.furlong@wdc.com, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, martin.petersen@oracle.com, tim.c.chen@linux.intel.com Subject: [PATCH 3/4] crc-t10dif: Allow current transform to be inspected in sysfs Date: Sat, 25 Aug 2018 22:40:05 -0400 Message-Id: <20180826024006.13800-3-martin.petersen@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180826024006.13800-1-martin.petersen@oracle.com> References: <20180825061205.ygrjjazkooqghrqy@gondor.apana.org.au> <20180826024006.13800-1-martin.petersen@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8996 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808260028 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a way to print the currently active CRC algorithm in: /sys/module/crc_t10dif/parameters/transform Signed-off-by: Martin K. Petersen --- lib/crc-t10dif.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index 72076a902df5..21c9b35a656f 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c @@ -107,6 +107,17 @@ static void __exit crc_t10dif_mod_fini(void) module_init(crc_t10dif_mod_init); module_exit(crc_t10dif_mod_fini); +static int crc_t10dif_transform_show(char *buffer, const struct kernel_param *kp) +{ + if (static_key_false(&crct10dif_fallback)) + return sprintf(buffer, "fallback\n"); + + return sprintf(buffer, "%s\n", + crypto_tfm_alg_driver_name(crypto_shash_tfm(crct10dif_tfm))); +} + +module_param_call(transform, NULL, crc_t10dif_transform_show, NULL, 0644); + MODULE_DESCRIPTION("T10 DIF CRC calculation"); MODULE_LICENSE("GPL"); MODULE_SOFTDEP("pre: crct10dif"); -- 2.17.1