From: Krzysztof Kozlowski <krzk@kernel.org> Date: 2018-07-23 16:20:49
Use generic kernel CRC32 implementation because it:
1. Should be faster (uses lookup tables),
2. Removes duplicated CRC generation code,
3. Uses well-proven algorithm instead of coding it one more time.
Suggested-by: Eric Biggers <redacted>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
Not tested on hardware.
---
drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
From: David Laight <hidden> Date: 2018-07-24 11:04:28
From: Krzysztof Kozlowski
Sent: 23 July 2018 17:20
Use generic kernel CRC32 implementation because it:
1. Should be faster (uses lookup tables),
Are you sure?
The lookup tables are unlikely to be in the data cache and
the 6 cache misses kill performance.
(Not that it particularly matters when setting up multicast hash tables).
2. Removes duplicated CRC generation code,
3. Uses well-proven algorithm instead of coding it one more time.
...
=20
Not tested on hardware.
Have you verified that the old and new functions give the
same result for a few mac addresses?
It is very easy to use the wrong bits in crc calculations
or generate the output in the wrong bit order.
=09David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1=
PT, UK
Registration No: 1397386 (Wales)
From: Krzysztof Kozlowski <krzk@kernel.org> Date: 2018-07-24 11:11:54
On 24 July 2018 at 13:05, David Laight [off-list ref] wrote:
From: Krzysztof Kozlowski
quoted
Sent: 23 July 2018 17:20
Use generic kernel CRC32 implementation because it:
1. Should be faster (uses lookup tables),
Are you sure?
The lookup tables are unlikely to be in the data cache and
the 6 cache misses kill performance.
(Not that it particularly matters when setting up multicast hash tables).
Good point, so this statement should be rather "Could be faster"... I
did not run any performance tests so this is not backed up by any
data.
I think the main benefit is rather easier code maintenance by removing
duplicated, custom code.
quoted
2. Removes duplicated CRC generation code,
3. Uses well-proven algorithm instead of coding it one more time.
...
quoted
Not tested on hardware.
Have you verified that the old and new functions give the
same result for a few mac addresses?
It is very easy to use the wrong bits in crc calculations
or generate the output in the wrong bit order.
I copied the original code and new one onto a different driver and run
this in a loop for thousands of data input (although not all possible
MAC combinations). The output was the same. I agree however that real
testing would be important.
Best regards,
Krzysztof
Use generic kernel CRC32 implementation because it:
1. Should be faster (uses lookup tables),
2. Removes duplicated CRC generation code,
3. Uses well-proven algorithm instead of coding it one more time.
Suggested-by: Eric Biggers <redacted>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>