From: Andrew Morton <akpm@linux-foundation.org>
To: Coly Li <colyli@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org,
linux-block@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Lyle <mlyle@lyle.org>,
Kent Overstreet <kent.overstreet@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Kate Stewart <kstewart@linuxfoundation.org>,
Eric Biggers <ebiggers3@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v5 1/2] lib: add crc64 calculation routines
Date: Thu, 26 Jul 2018 13:02:10 -0700 [thread overview]
Message-ID: <20180726130210.97450a74c164a02d7cfd79c1@linux-foundation.org> (raw)
In-Reply-To: <20180726053352.2781-2-colyli@suse.de>
On Thu, 26 Jul 2018 13:33:51 +0800 Coly Li <colyli@suse.de> wrote:
> This patch adds the re-write crc64 calculation routines for Linux kernel.
> The CRC64 polynomial arithmetic follows ECMA-182 specification, inspired
> by CRC paper of Dr. Ross N. Williams
> (see http://www.ross.net/crc/download/crc_v3.txt) and other public domain
> implementations.
>
> All the changes work in this way,
> - When Linux kernel is built, host program lib/gen_crc64table.c will be
> compiled to lib/gen_crc64table and executed.
> - The output of gen_crc64table execution is an array called as lookup
> table (a.k.a POLY 0x42f0e1eba9ea369) which contain 256 64-bit long
> numbers, this talbe is dumped into header file lib/crc64table.h.
> - Then the header file is included by lib/crc64.c for normal 64bit crc
> calculation.
> - Function declaration of the crc64 calculation routines is placed in
> include/linux/crc64.h
>
> Currently bcache is the only user of crc64_be(), another potential user
> is bcachefs which is on the way to be in mainline kernel. Therefore it
> makes sense to move crc64 calculation into lib/crc64.c as public code.
delta from v4:
--- a/include/linux/crc64.h~lib-add-crc64-calculation-routines-v5
+++ a/include/linux/crc64.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
- * See lib/crc64.c for the related specification and polynomical arithmetic.
+ * See lib/crc64.c for the related specification and polynomial arithmetic.
*/
#ifndef _LINUX_CRC64_H
#define _LINUX_CRC64_H
--- a/lib/crc64.c~lib-add-crc64-calculation-routines-v5
+++ a/lib/crc64.c
@@ -12,7 +12,7 @@
* from,
* http://www.ross.net/crc/download/crc_v3.txt
*
- * crc64table[256] is the lookup table of a table-driver 64-bit CRC
+ * crc64table[256] is the lookup table of a table-driven 64-bit CRC
* calculation, which is generated by gen_crc64table.c in kernel build
* time. The polynomial of crc64 arithmetic is from ECMA-182 specification
* as well, which is defined as,
@@ -35,8 +35,8 @@ MODULE_LICENSE("GPL v2");
/**
* crc64_be - Calculate bitwise big-endian ECMA-182 CRC64
- * @crc: seed value for computation. 0 for a new CRC computing, or the
- * previous crc64 value if computing incrementally.
+ * @crc: seed value for computation. 0 or (u64)~0 for a new CRC calculation,
+ or the previous crc64 value if computing incrementally.
* @p: pointer to buffer over which CRC64 is run
* @len: length of buffer @p
*/
--- a/lib/gen_crc64table.c~lib-add-crc64-calculation-routines-v5
+++ a/lib/gen_crc64table.c
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Generate lookup table for the talbe-driven CRC64 calculation.
+ * Generate lookup table for the table-driven CRC64 calculation.
*
* gen_crc64table is executed in kernel build time and generates
* lib/crc64table.h. This header is included by lib/crc64.c for
- * the table-driver CRC64 calculation.
+ * the table-driven CRC64 calculation.
*
* See lib/crc64.c for more information about which specification
- * and polynomical arithmetic that gen_crc64table.c follows to
+ * and polynomial arithmetic that gen_crc64table.c follows to
* generate the lookup table.
*
* Copyright 2018 SUSE Linux.
@@ -20,7 +20,7 @@
#define CRC64_ECMA182_POLY 0x42F0E1EBA9EA3693ULL
-static int64_t crc64_table[256] = {0};
+static uint64_t crc64_table[256] = {0};
static void generate_crc64_table(void)
{
next prev parent reply other threads:[~2018-07-26 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 5:33 [PATCH v5 0/2] add crc64 calculation as kernel library Coly Li
2018-07-26 5:33 ` [PATCH v5 1/2] lib: add crc64 calculation routines Coly Li
2018-07-26 20:02 ` Andrew Morton [this message]
2018-12-29 2:58 ` NeilBrown
2018-12-29 3:57 ` Coly Li
2018-07-26 5:33 ` [PATCH v5 2/2] bcache: use routines from lib/crc64.c for CRC64 calculation Coly Li
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=20180726130210.97450a74c164a02d7cfd79c1@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=colyli@suse.de \
--cc=ebiggers3@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kent.overstreet@gmail.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlyle@lyle.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).