mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 09:33:31 +02:00
net/tg3: use crc32() instead of hand-rolled equivalent
The calculation done by calc_crc() is equivalent to ~crc32(~0, buf, len), so just use that instead. Signed-off-by: Eric Biggers <ebiggers@google.com> Link: https://patch.msgid.link/20250513041402.541527-1-ebiggers@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
685e7b1522
commit
0aa4024b43
|
|
@ -123,6 +123,7 @@ config TIGON3
|
|||
tristate "Broadcom Tigon3 support"
|
||||
depends on PCI
|
||||
depends on PTP_1588_CLOCK_OPTIONAL
|
||||
select CRC32
|
||||
select PHYLIB
|
||||
help
|
||||
This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
#include <linux/ssb/ssb_driver_gige.h>
|
||||
#include <linux/hwmon.h>
|
||||
#include <linux/hwmon-sysfs.h>
|
||||
#include <linux/crc32poly.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
#include <net/checksum.h>
|
||||
|
|
@ -9809,26 +9809,7 @@ static void tg3_setup_rxbd_thresholds(struct tg3 *tp)
|
|||
|
||||
static inline u32 calc_crc(unsigned char *buf, int len)
|
||||
{
|
||||
u32 reg;
|
||||
u32 tmp;
|
||||
int j, k;
|
||||
|
||||
reg = 0xffffffff;
|
||||
|
||||
for (j = 0; j < len; j++) {
|
||||
reg ^= buf[j];
|
||||
|
||||
for (k = 0; k < 8; k++) {
|
||||
tmp = reg & 0x01;
|
||||
|
||||
reg >>= 1;
|
||||
|
||||
if (tmp)
|
||||
reg ^= CRC32_POLY_LE;
|
||||
}
|
||||
}
|
||||
|
||||
return ~reg;
|
||||
return ~crc32(~0, buf, len);
|
||||
}
|
||||
|
||||
static void tg3_set_multi(struct tg3 *tp, unsigned int accept_all)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user