Commit 0aa4024b authored by Eric Biggers's avatar Eric Biggers Committed by Jakub Kicinski
Browse files

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: default avatarEric Biggers <ebiggers@google.com>
Link: https://patch.msgid.link/20250513041402.541527-1-ebiggers@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 685e7b15
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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.
+2 −21
Original line number Diff line number Diff line
@@ -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)