Page MenuHomeFreeBSD

LinuxKPI: Creating crc16.h for amdkfd support
ClosedPublic

Authored by siri_racha.ca on Sat, Oct 3, 8:46 AM.
Referenced Files
F175091939: D60275.diff
Thu, Oct 8, 5:10 AM
F175086752: D60275.diff
Thu, Oct 8, 4:18 AM
F175074923: D60275.id188678.diff
Thu, Oct 8, 1:56 AM
Unknown Object (File)
Wed, Oct 7, 10:47 AM
Unknown Object (File)
Wed, Oct 7, 6:55 AM
Unknown Object (File)
Wed, Oct 7, 5:27 AM
Unknown Object (File)
Wed, Oct 7, 1:34 AM
Unknown Object (File)
Tue, Oct 6, 11:16 PM
Subscribers

Details

Summary

Created & implemented crc16.h, there are some new functions which I could not
find already implemented in the FreeBSD base system

Test Plan

Ran a build test with no issues.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Created & implemented crc16.h, there are some new functions which I could not find already implemented in the FreeBSD base system

crc16() is implemented in sys/crc16.h
crc16_byte() is not used in drm-kmod and has been removed from Linux after v6.15

It looks all that`s needed is to change crc16() len parameter type from unsigned int to size_t in sys/sys/crc16.h and add #include <sys/crc16.h> line to linux/crc16.h

Created & implemented crc16.h, there are some new functions which I could not find already implemented in the FreeBSD base system

crc16() is implemented in sys/crc16.h
crc16_byte() is not used in drm-kmod and has been removed from Linux after v6.15

It looks all that`s needed is to change crc16() len parameter type from unsigned int to size_t in sys/sys/crc16.h and add #include <sys/crc16.h> line to linux/crc16.h

Sounds good, I did not know it got removed in v6.15, I was only looking at v6.12. I'll make the changes on my local machine and test to make sure it still works.

It looks all that`s needed is to change crc16() len parameter type from unsigned int to size_t in sys/sys/crc16.h and add #include <sys/crc16.h> line to linux/crc16.h

I have a small concern with this, firstly we'd be changing the KBI (I think) on systems where sizeof(unsigned int) != size_t. Which changes the behaviour, but otherwise it sounds good, and seems reasonable.
I'm not fully sure if this breaks KBI given that it's a inline'd function in both cases, let me know what you think. I'll increment __FreeBSD_version if it does break KBI.

I will make the change, run a few tests on my machine to make sure my drm-kmod fork compiles & revise the patch

Sorry, thank you!

firstly we'd be changing the KBI (I think) on systems where sizeof(unsigned int) != size_t.

crc16() is static inline. It should not have KBI unless maybe exotic cases like -O0 or execution via pointer.

siri_racha.ca updated this revision to Diff 188678.

firstly we'd be changing the KBI (I think) on systems where sizeof(unsigned int) != size_t.

crc16() is static inline. It should not have KBI unless maybe exotic cases like -O0 or execution via pointer.

Sounds good, wanted to be sure it did not break anything down stream. Changes have been made.
Thank you!

This revision is now accepted and ready to land.Mon, Oct 5, 11:55 AM

fwiw crc16.h is used in (only)
sys/dev/atopcase/atopcase.c
sys/fs/ext2fs/ext2_csum.c

This revision was automatically updated to reflect the committed changes.