linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst
@ 2025-08-20 16:26 Rakuram Eswaran
  2025-08-21  3:59 ` Eric Biggers
  0 siblings, 1 reply; 4+ messages in thread
From: Rakuram Eswaran @ 2025-08-20 16:26 UTC (permalink / raw)
  To: linux-crypto
  Cc: linux-doc, ardb, ebiggers, corbet, skhan, linux-kernel-mentees,
	rakuram.e96

In Documentation/staging/crc32.rst, below errors have been corrected:

1. Line 37: from "to being" to "to bring"

2. Line 119:  Incorrect citation date:
   It must be August 1988 instead of August 1998

Signed-off-by: Rakuram Eswaran <rakuram.e96@gmail.com>
---
 Documentation/staging/crc32.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/staging/crc32.rst b/Documentation/staging/crc32.rst
index 7542220967cb..64f3dd430a6c 100644
--- a/Documentation/staging/crc32.rst
+++ b/Documentation/staging/crc32.rst
@@ -34,7 +34,7 @@ do it in the right order, matching the endianness.
 Just like with ordinary division, you proceed one digit (bit) at a time.
 Each step of the division you take one more digit (bit) of the dividend
 and append it to the current remainder.  Then you figure out the
-appropriate multiple of the divisor to subtract to being the remainder
+appropriate multiple of the divisor to subtract to bring the remainder
 back into range.  In binary, this is easy - it has to be either 0 or 1,
 and to make the XOR cancel, it's just a copy of bit 32 of the remainder.
 
@@ -116,7 +116,7 @@ for any fractional bytes at the end.
 To reduce the number of conditional branches, software commonly uses
 the byte-at-a-time table method, popularized by Dilip V. Sarwate,
 "Computation of Cyclic Redundancy Checks via Table Look-Up", Comm. ACM
-v.31 no.8 (August 1998) p. 1008-1013.
+v.31 no.8 (August 1988) p. 1008-1013.
 
 Here, rather than just shifting one bit of the remainder to decide
 in the correct multiple to subtract, we can shift a byte at a time.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst
  2025-08-20 16:26 [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst Rakuram Eswaran
@ 2025-08-21  3:59 ` Eric Biggers
  2025-08-23  9:18   ` Rakuram Eswaran
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2025-08-21  3:59 UTC (permalink / raw)
  To: Rakuram Eswaran
  Cc: linux-crypto, linux-doc, ardb, corbet, skhan,
	linux-kernel-mentees

On Wed, Aug 20, 2025 at 09:56:13PM +0530, Rakuram Eswaran wrote:
> In Documentation/staging/crc32.rst, below errors have been corrected:
> 
> 1. Line 37: from "to being" to "to bring"
> 
> 2. Line 119:  Incorrect citation date:
>    It must be August 1988 instead of August 1998
> 
> Signed-off-by: Rakuram Eswaran <rakuram.e96@gmail.com>
> ---
>  Documentation/staging/crc32.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Sure, why not.  Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

Note that this file is somewhat dated and is due for a rewrite.  It
doesn't describe how most of the optimized CRC code actually works these
days, using carryless multiplication or dedicated instructions.

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst
  2025-08-21  3:59 ` Eric Biggers
@ 2025-08-23  9:18   ` Rakuram Eswaran
  2025-08-24  2:36     ` Eric Biggers
  0 siblings, 1 reply; 4+ messages in thread
From: Rakuram Eswaran @ 2025-08-23  9:18 UTC (permalink / raw)
  To: ebiggers
  Cc: ardb, corbet, linux-crypto, linux-doc, linux-kernel-mentees,
	rakuram.e96, skhan

Thanks for applying my patch!

I noticed your comment about the file being dated. 
I’d be interested in helping to update it to cover the more modern 
CRC implementations — things like carryless multiplication and 
hardware CRC instructions on x86, ARM, etc.

Since I’m not very familiar yet with these optimized approaches. 
Could you suggest a good starting point for exploring this in the kernel 
(or any references you recommend)? 

I was planning to look at lib/crc32.c and the arch-specific 
implementations, but would appreciate your guidance.

Best Regards,
Rakuram 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst
  2025-08-23  9:18   ` Rakuram Eswaran
@ 2025-08-24  2:36     ` Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2025-08-24  2:36 UTC (permalink / raw)
  To: Rakuram Eswaran
  Cc: ardb, corbet, linux-crypto, linux-doc, linux-kernel-mentees,
	skhan

Hi Rakuram,

On Sat, Aug 23, 2025 at 02:48:32PM +0530, Rakuram Eswaran wrote:
> Thanks for applying my patch!
> 
> I noticed your comment about the file being dated. 
> I’d be interested in helping to update it to cover the more modern 
> CRC implementations — things like carryless multiplication and 
> hardware CRC instructions on x86, ARM, etc.
> 
> Since I’m not very familiar yet with these optimized approaches. 
> Could you suggest a good starting point for exploring this in the kernel 
> (or any references you recommend)? 
> 
> I was planning to look at lib/crc32.c and the arch-specific 
> implementations, but would appreciate your guidance.
> 
> Best Regards,
> Rakuram 

https://www.corsix.org/content/alternative-exposition-crc32_4k_pclmulqdq
has a fairly good explanation.

In the kernel, x86 uses crc32 instructions for crc32c(), and arm64 uses
crc32 instructions for crc32c(), crc32_le(), and crc32_be().

x86, arm, arm64, powerpc, s390, and riscv all have CRC implementations
using carryless multiplication instructions.  The riscv one might be the
easiest to read since it is mostly written in C, rather than assembly.
See: lib/crc/riscv/crc-clmul-template.h

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-24  2:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 16:26 [PATCH] Documentation/staging: Fix typo and incorrect citation in crc32.rst Rakuram Eswaran
2025-08-21  3:59 ` Eric Biggers
2025-08-23  9:18   ` Rakuram Eswaran
2025-08-24  2:36     ` Eric Biggers

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).