]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
net: ethernet: Use existing define with polynomial
authorKrzysztof Kozlowski <krzk@kernel.org>
Tue, 17 Jul 2018 16:05:39 +0000 (18:05 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 27 Jul 2018 11:16:37 +0000 (19:16 +0800)
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>
drivers/net/ethernet/amd/xgbe/xgbe-dev.c
drivers/net/ethernet/apple/bmac.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/fs_enet/fec.h
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
drivers/net/ethernet/micrel/ks8851_mll.c
drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c

index e107e180e2c8e5e0071f38dd96557a13b64baae2..1e929a1e4ca78145f5c8214e5562c740472bfc97 100644 (file)
 #include <linux/clk.h>
 #include <linux/bitrev.h>
 #include <linux/crc32.h>
+#include <linux/crc32poly.h>
 
 #include "xgbe.h"
 #include "xgbe-common.h"
@@ -887,7 +888,6 @@ static int xgbe_disable_rx_vlan_filtering(struct xgbe_prv_data *pdata)
 
 static u32 xgbe_vid_crc32_le(__le16 vid_le)
 {
-       u32 poly = 0xedb88320;  /* CRCPOLY_LE */
        u32 crc = ~0;
        u32 temp = 0;
        unsigned char *data = (unsigned char *)&vid_le;
@@ -904,7 +904,7 @@ static u32 xgbe_vid_crc32_le(__le16 vid_le)
                data_byte >>= 1;
 
                if (temp)
-                       crc ^= poly;
+                       crc ^= CRC32_POLY_LE;
        }
 
        return crc;
index 5a655d289dd589d281843031ad0e0a188f4d54b9..024998d6d8c6ed959c555c82b66f687cb0a85c2c 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/crc32.h>
+#include <linux/crc32poly.h>
 #include <linux/bitrev.h>
 #include <linux/ethtool.h>
 #include <linux/slab.h>
 #define trunc_page(x)  ((void *)(((unsigned long)(x)) & ~((unsigned long)(PAGE_SIZE - 1))))
 #define round_page(x)  trunc_page(((unsigned long)(x)) + ((unsigned long)(PAGE_SIZE - 1)))
 
-/*
- * CRC polynomial - used in working out multicast filter bits.
- */
-#define ENET_CRCPOLY 0x04c11db7
-
 /* switch to use multicast code lifted from sunhme driver */
 #define SUNHME_MULTICAST
 
@@ -838,7 +834,7 @@ crc416(unsigned int curval, unsigned short nxtval)
                next = next >> 1;
 
                /* do the XOR */
-               if (high_crc_set ^ low_data_set) cur = cur ^ ENET_CRCPOLY;
+               if (high_crc_set ^ low_data_set) cur = cur ^ CRC32_POLY_BE;
        }
        return cur;
 }
index 3be87efdc93d6347da8417ddcd101ed90cc12d8c..af8134d202ae635e31bc7011dd0f36affb2c8c30 100644 (file)
@@ -50,6 +50,7 @@
 #include <linux/ssb/ssb_driver_gige.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
+#include <linux/crc32poly.h>
 
 #include <net/checksum.h>
 #include <net/ip.h>
@@ -9707,7 +9708,7 @@ static inline u32 calc_crc(unsigned char *buf, int len)
                        reg >>= 1;
 
                        if (tmp)
-                               reg ^= 0xedb88320;
+                               reg ^= CRC32_POLY_LE;
                }
        }
 
index c729665107f59c4431529b971a765059bee837c1..a7cb378ef881afa71686a16fff867319e23078d5 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/clk.h>
+#include <linux/crc32poly.h>
 #include <linux/platform_device.h>
 #include <linux/mdio.h>
 #include <linux/phy.h>
@@ -2949,7 +2950,6 @@ fec_enet_close(struct net_device *ndev)
  */
 
 #define FEC_HASH_BITS  6               /* #bits in hash */
-#define CRC32_POLY     0xEDB88320
 
 static void set_multicast_list(struct net_device *ndev)
 {
@@ -2989,7 +2989,7 @@ static void set_multicast_list(struct net_device *ndev)
                        data = ha->addr[i];
                        for (bit = 0; bit < 8; bit++, data >>= 1) {
                                crc = (crc >> 1) ^
-                               (((crc ^ data) & 1) ? CRC32_POLY : 0);
+                               (((crc ^ data) & 1) ? CRC32_POLY_LE : 0);
                        }
                }
 
index 7832db71dcb95c68449ae5918a0f81ec7b2bb2a6..1dbee5d898b3b6085a4bd467ef116935b24bc73e 100644 (file)
@@ -2,9 +2,6 @@
 #ifndef FS_ENET_FEC_H
 #define FS_ENET_FEC_H
 
-/* CRC polynomium used by the FEC for the multicast group filtering */
-#define FEC_CRC_POLY   0x04C11DB7
-
 #define FEC_MAX_MULTICAST_ADDRS        64
 
 /* Interrupt events/masks.
index 1fc27c97e3b23205fe3466ddf9f5bb45f72faf09..05093e5fc9dd1919325aa75530341945b01b9fed 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/string.h>
 #include <linux/ptrace.h>
 #include <linux/errno.h>
+#include <linux/crc32poly.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
@@ -187,7 +188,7 @@ static void set_multicast_one(struct net_device *dev, const u8 *mac)
                        msb = crc >> 31;
                        crc <<= 1;
                        if (msb ^ (byte & 0x1))
-                               crc ^= FEC_CRC_POLY;
+                               crc ^= CRC32_POLY_BE;
                        byte >>= 1;
                }
        }
index f3e9dd47b56f03a5d856e2a89ad9c164000a8ce1..0e9719fbc624382ff9ee63be06698e4515c8a922 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/ethtool.h>
 #include <linux/cache.h>
 #include <linux/crc32.h>
+#include <linux/crc32poly.h>
 #include <linux/mii.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
@@ -1078,7 +1079,7 @@ static void ks_stop_rx(struct ks_net *ks)
 
 }  /* ks_stop_rx */
 
-static unsigned long const ethernet_polynomial = 0x04c11db7U;
+static unsigned long const ethernet_polynomial = CRC32_POLY_BE;
 
 static unsigned long ether_gen_crc(int length, u8 *data)
 {
index 458a7844260aadfeabdeebe05ef42db155bd0287..99d86e39ff541c29a239b176ccfcb704c50e4ce8 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/clk.h>
 #include <linux/bitrev.h>
 #include <linux/crc32.h>
+#include <linux/crc32poly.h>
 #include <linux/dcbnl.h>
 
 #include "dwc-xlgmac.h"
@@ -193,7 +194,6 @@ static u32 xlgmac_vid_crc32_le(__le16 vid_le)
 {
        unsigned char *data = (unsigned char *)&vid_le;
        unsigned char data_byte = 0;
-       u32 poly = 0xedb88320;
        u32 crc = ~0;
        u32 temp = 0;
        int i, bits;
@@ -208,7 +208,7 @@ static u32 xlgmac_vid_crc32_le(__le16 vid_le)
                data_byte >>= 1;
 
                if (temp)
-                       crc ^= poly;
+                       crc ^= CRC32_POLY_LE;
        }
 
        return crc;