2022-03-08 23:46:49

by Keith Busch

[permalink] [raw]
Subject: Re: [PATCHv4 6/8] crypto: add rocksoft 64b crc guard tag framework

On Tue, Mar 08, 2022 at 12:27:47PM -0800, Keith Busch wrote:
> On Tue, Mar 08, 2022 at 09:21:41PM +0100, Vasily Gorbik wrote:
> > On Thu, Mar 03, 2022 at 12:13:10PM -0800, Keith Busch wrote:
> > > Hardware specific features may be able to calculate a crc64, so provide
> > > a framework for drivers to register their implementation. If nothing is
> > > registered, fallback to the generic table lookup implementation. The
> > > implementation is modeled after the crct10dif equivalent.
> >
> > Hi Keith,
> >
> > this is failing on big-endian systems. I get the following on s390:
>
> Oh, I see the put_unaligned_le64() in chksum_final() was not the correct
> action. I'll send an update, thank you for the report.

I'll set up a BE qemu target this week, but in the meantime, would you
be able to confirm if the following is successful?

---
diff --git a/crypto/crc64_rocksoft_generic.c b/crypto/crc64_rocksoft_generic.c
index 9e812bb26dba..12a8b0575ad1 100644
--- a/crypto/crc64_rocksoft_generic.c
+++ b/crypto/crc64_rocksoft_generic.c
@@ -28,14 +28,14 @@ static int chksum_final(struct shash_desc *desc, u8 *out)
{
u64 *crc = shash_desc_ctx(desc);

- put_unaligned_le64(*crc, out);
+ put_unaligned(*crc, (u64 *)out);
return 0;
}

static int __chksum_finup(u64 crc, const u8 *data, unsigned int len, u8 *out)
{
crc = crc64_rocksoft_generic(crc, data, len);
- put_unaligned_le64(crc, out);
+ put_unaligned(crc, (u64 *)out);
return 0;
}

--


2022-03-09 00:49:57

by Vasily Gorbik

[permalink] [raw]
Subject: Re: [PATCHv4 6/8] crypto: add rocksoft 64b crc guard tag framework

On Tue, Mar 08, 2022 at 01:46:12PM -0800, Keith Busch wrote:
> On Tue, Mar 08, 2022 at 12:27:47PM -0800, Keith Busch wrote:
> > On Tue, Mar 08, 2022 at 09:21:41PM +0100, Vasily Gorbik wrote:
> > > On Thu, Mar 03, 2022 at 12:13:10PM -0800, Keith Busch wrote:
> > > > Hardware specific features may be able to calculate a crc64, so provide
> > > > a framework for drivers to register their implementation. If nothing is
> > > > registered, fallback to the generic table lookup implementation. The
> > > > implementation is modeled after the crct10dif equivalent.
> > >
> > > Hi Keith,
> > >
> > > this is failing on big-endian systems. I get the following on s390:
> >
> > Oh, I see the put_unaligned_le64() in chksum_final() was not the correct
> > action. I'll send an update, thank you for the report.
>
> I'll set up a BE qemu target this week, but in the meantime, would you
> be able to confirm if the following is successful?

Sure,

[ 0.543862] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[ 0.543864] crc32: self tests passed, processed 225944 bytes in 118678 nsec
[ 0.543986] crc32c: CRC_LE_BITS = 64
[ 0.543987] crc32c: self tests passed, processed 112972 bytes in 58932 nsec
[ 0.569479] crc32_combine: 8373 self tests passed
[ 0.595330] crc32c_combine: 8373 self tests passed

it does the trick. Thanks!