Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 498d8e23 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller
Browse files

drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr



There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it. This patch covers all
remaining network drivers still containing such a check.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 40f5d72a
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -594,7 +594,6 @@ static void lance_load_multicast (struct net_device *dev)
        volatile struct lance_init_block *ib = lp->init_block;
        volatile struct lance_init_block *ib = lp->init_block;
        volatile u16 *mcast_table = (u16 *)&ib->filter;
        volatile u16 *mcast_table = (u16 *)&ib->filter;
	struct netdev_hw_addr *ha;
	struct netdev_hw_addr *ha;
        char *addrs;
        u32 crc;
        u32 crc;


        /* set all multicast bits */
        /* set all multicast bits */
@@ -609,13 +608,7 @@ static void lance_load_multicast (struct net_device *dev)


        /* Add addresses */
        /* Add addresses */
	netdev_for_each_mc_addr(ha, dev) {
	netdev_for_each_mc_addr(ha, dev) {
		addrs = ha->addr;
		crc = ether_crc_le(6, ha->addr);

                /* multicast address? */
                if (!(*addrs & 1))
                        continue;

		crc = ether_crc_le(6, addrs);
                crc = crc >> 26;
                crc = crc >> 26;
                mcast_table [crc >> 4] |= 1 << (crc & 0xf);
                mcast_table [crc >> 4] |= 1 << (crc & 0xf);
        }
        }
+1 −8
Original line number Original line Diff line number Diff line
@@ -587,7 +587,6 @@ static void lance_load_multicast(struct net_device *dev)
	volatile struct lance_init_block *ib = lp->init_block;
	volatile struct lance_init_block *ib = lp->init_block;
	volatile u16 *mcast_table = (u16 *)&ib->filter;
	volatile u16 *mcast_table = (u16 *)&ib->filter;
	struct netdev_hw_addr *ha;
	struct netdev_hw_addr *ha;
	char *addrs;
	u32 crc;
	u32 crc;


	/* set all multicast bits */
	/* set all multicast bits */
@@ -602,13 +601,7 @@ static void lance_load_multicast(struct net_device *dev)


	/* Add addresses */
	/* Add addresses */
	netdev_for_each_mc_addr(ha, dev) {
	netdev_for_each_mc_addr(ha, dev) {
		addrs = ha->addr;
		crc = ether_crc_le(6, ha->addr);

		/* multicast address? */
		if (!(*addrs & 1))
			continue;

		crc = ether_crc_le(6, addrs);
		crc = crc >> 26;
		crc = crc >> 26;
		mcast_table[crc >> 4] |= 1 << (crc & 0xf);
		mcast_table[crc >> 4] |= 1 << (crc & 0xf);
	}
	}
+1 −7
Original line number Original line Diff line number Diff line
@@ -1015,7 +1015,6 @@ static void bmac_set_multicast(struct net_device *dev)
static void bmac_set_multicast(struct net_device *dev)
static void bmac_set_multicast(struct net_device *dev)
{
{
	struct netdev_hw_addr *ha;
	struct netdev_hw_addr *ha;
	char *addrs;
	int i;
	int i;
	unsigned short rx_cfg;
	unsigned short rx_cfg;
	u32 crc;
	u32 crc;
@@ -1039,12 +1038,7 @@ static void bmac_set_multicast(struct net_device *dev)
		for(i = 0; i < 4; i++) hash_table[i] = 0;
		for(i = 0; i < 4; i++) hash_table[i] = 0;


		netdev_for_each_mc_addr(ha, dev) {
		netdev_for_each_mc_addr(ha, dev) {
			addrs = ha->addr;
			crc = ether_crc_le(6, ha->addr);

			if(!(*addrs & 1))
				continue;

			crc = ether_crc_le(6, addrs);
			crc >>= 26;
			crc >>= 26;
			hash_table[crc >> 4] |= 1 << (crc & 0xf);
			hash_table[crc >> 4] |= 1 << (crc & 0xf);
		}
		}
+1 −8
Original line number Original line Diff line number Diff line
@@ -946,7 +946,6 @@ static void lance_load_multicast(struct net_device *dev)
	struct lance_private *lp = netdev_priv(dev);
	struct lance_private *lp = netdev_priv(dev);
	volatile u16 *ib = (volatile u16 *)dev->mem_start;
	volatile u16 *ib = (volatile u16 *)dev->mem_start;
	struct netdev_hw_addr *ha;
	struct netdev_hw_addr *ha;
	char *addrs;
	u32 crc;
	u32 crc;


	/* set all multicast bits */
	/* set all multicast bits */
@@ -965,13 +964,7 @@ static void lance_load_multicast(struct net_device *dev)


	/* Add addresses */
	/* Add addresses */
	netdev_for_each_mc_addr(ha, dev) {
	netdev_for_each_mc_addr(ha, dev) {
		addrs = ha->addr;
		crc = ether_crc_le(ETH_ALEN, ha->addr);

		/* multicast address? */
		if (!(*addrs & 1))
			continue;

		crc = ether_crc_le(ETH_ALEN, addrs);
		crc = crc >> 26;
		crc = crc >> 26;
		*lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
		*lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
	}
	}
+14 −17
Original line number Original line Diff line number Diff line
@@ -1169,7 +1169,7 @@ static void SetMulticastFilter(struct net_device *dev)
	struct netdev_hw_addr *ha;
	struct netdev_hw_addr *ha;
	u_long iobase = dev->base_addr;
	u_long iobase = dev->base_addr;
	int i;
	int i;
	char *addrs, bit, byte;
	char bit, byte;
	short __iomem *p = lp->mctbl;
	short __iomem *p = lp->mctbl;
	u16 hashcode;
	u16 hashcode;
	u32 crc;
	u32 crc;
@@ -1211,9 +1211,7 @@ static void SetMulticastFilter(struct net_device *dev)


		/* Update table */
		/* Update table */
		netdev_for_each_mc_addr(ha, dev) {
		netdev_for_each_mc_addr(ha, dev) {
			addrs = ha->addr;
			crc = ether_crc_le(ETH_ALEN, ha->addr);
			if ((*addrs & 0x01) == 1) {	/* multicast address? */
				crc = ether_crc_le(ETH_ALEN, addrs);
			hashcode = crc & ((1 << 9) - 1);	/* hashcode is 9 LSb of CRC */
			hashcode = crc & ((1 << 9) - 1);	/* hashcode is 9 LSb of CRC */


			byte = hashcode >> 3;	/* bit[3-8] -> byte in filter */
			byte = hashcode >> 3;	/* bit[3-8] -> byte in filter */
@@ -1232,7 +1230,6 @@ static void SetMulticastFilter(struct net_device *dev)
			}
			}
		}
		}
	}
	}
	}


	spin_unlock_irq(&lp->hw_lock);
	spin_unlock_irq(&lp->hw_lock);
}
}
Loading