Skip to content

Commit 5d258b4

Browse files
krzkherbertx
authored andcommitted
net: ethernet: Use existing define with polynomial
Do not define again the polynomial but use header with existing define. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent f7aee87 commit 5d258b4

File tree

8 files changed

+14
-18
lines changed

8 files changed

+14
-18
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
#include <linux/clk.h>
120120
#include <linux/bitrev.h>
121121
#include <linux/crc32.h>
122+
#include <linux/crc32poly.h>
122123

123124
#include "xgbe.h"
124125
#include "xgbe-common.h"
@@ -887,7 +888,6 @@ static int xgbe_disable_rx_vlan_filtering(struct xgbe_prv_data *pdata)
887888

888889
static u32 xgbe_vid_crc32_le(__le16 vid_le)
889890
{
890-
u32 poly = 0xedb88320; /* CRCPOLY_LE */
891891
u32 crc = ~0;
892892
u32 temp = 0;
893893
unsigned char *data = (unsigned char *)&vid_le;
@@ -904,7 +904,7 @@ static u32 xgbe_vid_crc32_le(__le16 vid_le)
904904
data_byte >>= 1;
905905

906906
if (temp)
907-
crc ^= poly;
907+
crc ^= CRC32_POLY_LE;
908908
}
909909

910910
return crc;

drivers/net/ethernet/apple/bmac.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/init.h>
2020
#include <linux/spinlock.h>
2121
#include <linux/crc32.h>
22+
#include <linux/crc32poly.h>
2223
#include <linux/bitrev.h>
2324
#include <linux/ethtool.h>
2425
#include <linux/slab.h>
@@ -37,11 +38,6 @@
3738
#define trunc_page(x) ((void *)(((unsigned long)(x)) & ~((unsigned long)(PAGE_SIZE - 1))))
3839
#define round_page(x) trunc_page(((unsigned long)(x)) + ((unsigned long)(PAGE_SIZE - 1)))
3940

40-
/*
41-
* CRC polynomial - used in working out multicast filter bits.
42-
*/
43-
#define ENET_CRCPOLY 0x04c11db7
44-
4541
/* switch to use multicast code lifted from sunhme driver */
4642
#define SUNHME_MULTICAST
4743

@@ -838,7 +834,7 @@ crc416(unsigned int curval, unsigned short nxtval)
838834
next = next >> 1;
839835

840836
/* do the XOR */
841-
if (high_crc_set ^ low_data_set) cur = cur ^ ENET_CRCPOLY;
837+
if (high_crc_set ^ low_data_set) cur = cur ^ CRC32_POLY_BE;
842838
}
843839
return cur;
844840
}

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <linux/ssb/ssb_driver_gige.h>
5151
#include <linux/hwmon.h>
5252
#include <linux/hwmon-sysfs.h>
53+
#include <linux/crc32poly.h>
5354

5455
#include <net/checksum.h>
5556
#include <net/ip.h>
@@ -9707,7 +9708,7 @@ static inline u32 calc_crc(unsigned char *buf, int len)
97079708
reg >>= 1;
97089709

97099710
if (tmp)
9710-
reg ^= 0xedb88320;
9711+
reg ^= CRC32_POLY_LE;
97119712
}
97129713
}
97139714

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <linux/io.h>
4949
#include <linux/irq.h>
5050
#include <linux/clk.h>
51+
#include <linux/crc32poly.h>
5152
#include <linux/platform_device.h>
5253
#include <linux/mdio.h>
5354
#include <linux/phy.h>
@@ -2949,7 +2950,6 @@ fec_enet_close(struct net_device *ndev)
29492950
*/
29502951

29512952
#define FEC_HASH_BITS 6 /* #bits in hash */
2952-
#define CRC32_POLY 0xEDB88320
29532953

29542954
static void set_multicast_list(struct net_device *ndev)
29552955
{
@@ -2989,7 +2989,7 @@ static void set_multicast_list(struct net_device *ndev)
29892989
data = ha->addr[i];
29902990
for (bit = 0; bit < 8; bit++, data >>= 1) {
29912991
crc = (crc >> 1) ^
2992-
(((crc ^ data) & 1) ? CRC32_POLY : 0);
2992+
(((crc ^ data) & 1) ? CRC32_POLY_LE : 0);
29932993
}
29942994
}
29952995

drivers/net/ethernet/freescale/fs_enet/fec.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#ifndef FS_ENET_FEC_H
33
#define FS_ENET_FEC_H
44

5-
/* CRC polynomium used by the FEC for the multicast group filtering */
6-
#define FEC_CRC_POLY 0x04C11DB7
7-
85
#define FEC_MAX_MULTICAST_ADDRS 64
96

107
/* Interrupt events/masks.

drivers/net/ethernet/freescale/fs_enet/mac-fec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/string.h>
1919
#include <linux/ptrace.h>
2020
#include <linux/errno.h>
21+
#include <linux/crc32poly.h>
2122
#include <linux/ioport.h>
2223
#include <linux/interrupt.h>
2324
#include <linux/delay.h>
@@ -187,7 +188,7 @@ static void set_multicast_one(struct net_device *dev, const u8 *mac)
187188
msb = crc >> 31;
188189
crc <<= 1;
189190
if (msb ^ (byte & 0x1))
190-
crc ^= FEC_CRC_POLY;
191+
crc ^= CRC32_POLY_BE;
191192
byte >>= 1;
192193
}
193194
}

drivers/net/ethernet/micrel/ks8851_mll.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/ethtool.h>
3131
#include <linux/cache.h>
3232
#include <linux/crc32.h>
33+
#include <linux/crc32poly.h>
3334
#include <linux/mii.h>
3435
#include <linux/platform_device.h>
3536
#include <linux/delay.h>
@@ -1078,7 +1079,7 @@ static void ks_stop_rx(struct ks_net *ks)
10781079

10791080
} /* ks_stop_rx */
10801081

1081-
static unsigned long const ethernet_polynomial = 0x04c11db7U;
1082+
static unsigned long const ethernet_polynomial = CRC32_POLY_BE;
10821083

10831084
static unsigned long ether_gen_crc(int length, u8 *data)
10841085
{

drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/clk.h>
2121
#include <linux/bitrev.h>
2222
#include <linux/crc32.h>
23+
#include <linux/crc32poly.h>
2324
#include <linux/dcbnl.h>
2425

2526
#include "dwc-xlgmac.h"
@@ -193,7 +194,6 @@ static u32 xlgmac_vid_crc32_le(__le16 vid_le)
193194
{
194195
unsigned char *data = (unsigned char *)&vid_le;
195196
unsigned char data_byte = 0;
196-
u32 poly = 0xedb88320;
197197
u32 crc = ~0;
198198
u32 temp = 0;
199199
int i, bits;
@@ -208,7 +208,7 @@ static u32 xlgmac_vid_crc32_le(__le16 vid_le)
208208
data_byte >>= 1;
209209

210210
if (temp)
211-
crc ^= poly;
211+
crc ^= CRC32_POLY_LE;
212212
}
213213

214214
return crc;

0 commit comments

Comments
 (0)