Bug 212454 - [request] iSCSI hardware CRC32C support
Summary: [request] iSCSI hardware CRC32C support
Status: Closed DUPLICATE of bug 216467
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-scsi (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-07 13:58 UTC by Ben RUBSON
Modified: 2017-01-27 17:44 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben RUBSON 2016-09-07 13:58:12 UTC
Hello,

HeaderDigest and DataDigest are useful options for data integrity.
They are based on CRC32C.
Intel CPUs support iSCSI hardware CRC32C through SSE 4.2.

It would then really be nice to have hardware CRC32C supported on both initiator and target sides.

Thank you very much !

Best regards,

Ben
Comment 1 Ben RUBSON 2016-09-07 14:38:57 UTC
Some benchmarks with this :
https://github.com/laanwj/crcbench

On an Intel E5-2620v3 :

# ./crcbench 
CRC32C benchmarks
[sw] 65543000 bytes in 69730us monotonic 69726us CPU (940.0MB/s)
[hw-sse42] 65543000 bytes in 12619us monotonic 12618us CPU (5194.4MB/s)

On more data (10GB) :

# ./crcbench 
CRC32C benchmarks
[sw] 10485767000 bytes in 11179263us monotonic 11178667us CPU (938.0MB/s)
[hw-sse42] 10485767000 bytes in 2028412us monotonic 2028305us CPU (5169.7MB/s)

Sounds really interesting and promising.

Enabling HeaderDigest and DataDigest makes my iSCSI throughput drop from 300MB/s to 200MB/s.
Hardware CRC32C should help minimising this difference.

Thank you !

Ben
Comment 2 Ben RUBSON 2016-09-09 17:47:37 UTC
I tried to include crc32c_sse42.h from https://github.com/laanwj/crcbench, but I did not manage to make kernel compile with it.
I must miss some kernel dev knowledge :)
Goal was then as a test to replace function calculate_crc32c() (I think this is the one we are interested in) by the one provided in this header file.
Comment 3 Ben RUBSON 2017-01-25 10:26:42 UTC
Hi,

Some thoughts regarding this ?

Many thanks !

Ben
Comment 4 Edward Tomasz Napierala freebsd_committer freebsd_triage 2017-01-25 10:51:28 UTC
Not sure, to be honest.  I don't really plan on taking on this at this point, due to lack of time.  But I also think the PR is kind of titled wrong, for a number of reasons.  First, CRC32C is optional in iSCSI, and disabled by default - and for a reason, it can lower performance (obviously).  Second, I think we actually do have CRC32C offload, along with other iSCSI offloads, in cxgbei.  And third, iSCSI doesn't implement CRC32C; it just calls the calculate_crc32c() routine.

So it's actually just about implementing optimized versions of calculate_crc32c().
Comment 5 Ben RUBSON 2017-01-25 21:28:04 UTC
Thank you very much for your feedback !
Mmmmh unfortunately I do not run Chelsio but MLX adapters.
I agree with you, goal would be to have optimized versions of calculate_crc32c().
I then just opened the following request : 216467

Thank you !

*** This bug has been marked as a duplicate of bug 216467 ***
Comment 6 Ben RUBSON 2017-01-27 17:44:10 UTC
Just for info, has just been implemented by Conrad :
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216467
Really nice improvement !