Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3689188imm; Tue, 17 Jul 2018 08:44:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekvoazIyMaxc9R7pyUD8DTLMqcsfUZGIVmUftoDPkya7c3V6Wc9jq1owDeojUyrN0RmH30 X-Received: by 2002:a63:f002:: with SMTP id k2-v6mr2087231pgh.8.1531842280893; Tue, 17 Jul 2018 08:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531842280; cv=none; d=google.com; s=arc-20160816; b=tR4CSbAz9ENiS/taVqQ6KhYVx+lt3m4Ag9jP2cIyy77n1V4zo1ymqHnUZMIAVKIr8U nmYNJM7jv9PZW3yeb94UQZhiG9oRBHJ6QbOhE+tWysV4O4UMaqBY0xcX1RhxX66mM0pe Jt3tU9nxDDWquLHsKaDq/5jPixoaOs3B7Lx3jHWt5gwNgACFO2URigE6Q1pI2yKikFKV swfpbkskPDMYM+q+m6NTuq8C6CRVxaLceVtwfMeJ298oNeukYYl3ReogMGqr/iPu8Jnr Za1uJ3XKoqyU001ZCvc1xtW4Y8ocuRAGoaE2Otw16mLUxD7rBFVRAxthZnjmeMlwC/4H 8/Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=2OQl4FxP/3vi3/x2jauXAKgASm11vmFzd3LRE+EWudw=; b=Xo4F2mVAVc9R1XEdAWJhsnmUwxkI4Ot6UQ512Lkt4lbqFzeIxmIvLW/luwNm2kV98v 5Y6pT1MIgUtggATu1fkKxLEGz59p+7I/5Ob38yjBB0GaZLCGZI4LVbCbUKn0LJtPqpDI 0c4q/M2AZq73C+onEkznWgiGiZ5UDgc4hQYFSTBh5+PSnvHhg9M7xMtOZHHx1Hg2CFb4 Ix9onYgzg0yYi8TIld2Min9vPdpnOPoHKDEzszHplOzyxaB6IuiD1m0VFJA9JRv2DAJj A4duY5zXu2+LZsWkO62D3FN1Xlp6SJxmZzpJ/9CWRQIs+uIutHFPyfo29DDihw50ePwM BtLQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4-v6si1262449pfk.253.2018.07.17.08.44.25; Tue, 17 Jul 2018 08:44:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730880AbeGQQQY (ORCPT + 99 others); Tue, 17 Jul 2018 12:16:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:64704 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729755AbeGQQQY (ORCPT ); Tue, 17 Jul 2018 12:16:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 08:43:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,366,1526367600"; d="scan'208";a="55690109" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2018 08:43:06 -0700 Message-ID: <8f62965ad89f82b0f4bd73d6e5acf352dc2b767e.camel@linux.intel.com> Subject: Re: [PATCH v3 1/3] lib: add crc64 calculation routines From: Andy Shevchenko To: Coly Li , linux-kernel@vger.kernel.org Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Greg Kroah-Hartman , Michael Lyle , Kent Overstreet , Linus Torvalds , Thomas Gleixner , Kate Stewart , Eric Biggers Date: Tue, 17 Jul 2018 18:43:05 +0300 In-Reply-To: <20180717145525.50852-2-colyli@suse.de> References: <20180717145525.50852-1-colyli@suse.de> <20180717145525.50852-2-colyli@suse.de> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-07-17 at 22:55 +0800, Coly Li wrote: > This patch adds the re-write crc64 calculation routines for Linux > kernel. > The CRC64 polynomical 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 64bits-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 Thanks for an update! My comments below. > Co-developed-by: Andy Shevchenko As required by coding style this tag should be accompanied with SoB of co-developer(s). > +u64 __pure crc64_update(u64 crc, const void *_p, size_t len); For sake of consistency I would name _len as well. > + * Normal 64bit CRC calculation. I think 64-bit form is slightly better and more often $ git grep -n -w 64bit | wc -l 809 $ git grep -n -w 64-bit | wc -l 2957 > + * crc64table[256] is the lookup table of a table-driver 64bit CRC Ditto. > + * Copyright 2018 SUSE Linux. > + * Author: Coly Li > + * This (blank comment) line is not needed. > +u64 __pure crc64_update(u64 crc, const void *_p, size_t len) _len ? > + * Copyright 2018 SUSE Linux. > + * Author: Coly Li > + * Not needed line. > +#include > +#include + blank line? Would separate groups of headers logically. > +#include > +static int64_t crc64_table[256] = {0,}; I guess {0} would work as well (no comma). > + printf("#include \n"); > + printf("#include \n\n"); Do wee need these? CRC32 case seems fine without. -- Andy Shevchenko Intel Finland Oy