提交 3b9a7728 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net/arm: convert to use netdev_for_each_mc_addr

Signed-off-by: NJiri Pirko <jpirko@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0bc88e4a
...@@ -351,13 +351,13 @@ static struct net_device_stats *am79c961_getstats (struct net_device *dev) ...@@ -351,13 +351,13 @@ static struct net_device_stats *am79c961_getstats (struct net_device *dev)
return &priv->stats; return &priv->stats;
} }
static void am79c961_mc_hash(struct dev_mc_list *dmi, unsigned short *hash) static void am79c961_mc_hash(char *addr, unsigned short *hash)
{ {
if (dmi->dmi_addrlen == ETH_ALEN && dmi->dmi_addr[0] & 0x01) { if (addr[0] & 0x01) {
int idx, bit; int idx, bit;
u32 crc; u32 crc;
crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr); crc = ether_crc_le(ETH_ALEN, addr);
idx = crc >> 30; idx = crc >> 30;
bit = (crc >> 26) & 15; bit = (crc >> 26) & 15;
...@@ -387,8 +387,8 @@ static void am79c961_setmulticastlist (struct net_device *dev) ...@@ -387,8 +387,8 @@ static void am79c961_setmulticastlist (struct net_device *dev)
memset(multi_hash, 0x00, sizeof(multi_hash)); memset(multi_hash, 0x00, sizeof(multi_hash));
for (dmi = dev->mc_list; dmi; dmi = dmi->next) netdev_for_each_mc_addr(dmi, dev)
am79c961_mc_hash(dmi, multi_hash); am79c961_mc_hash(dmi->dmi_addr, multi_hash);
} }
spin_lock_irqsave(&priv->chip_lock, flags); spin_lock_irqsave(&priv->chip_lock, flags);
......
...@@ -558,14 +558,11 @@ static void at91ether_sethashtable(struct net_device *dev) ...@@ -558,14 +558,11 @@ static void at91ether_sethashtable(struct net_device *dev)
{ {
struct dev_mc_list *curr; struct dev_mc_list *curr;
unsigned long mc_filter[2]; unsigned long mc_filter[2];
unsigned int i, bitnr; unsigned int bitnr;
mc_filter[0] = mc_filter[1] = 0; mc_filter[0] = mc_filter[1] = 0;
curr = dev->mc_list; netdev_for_each_mc_addr(curr, dev) {
for (i = 0; i < netdev_mc_count(dev); i++, curr = curr->next) {
if (!curr) break; /* unexpected end of list */
bitnr = hash_get_index(curr->dmi_addr); bitnr = hash_get_index(curr->dmi_addr);
mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
} }
......
...@@ -735,22 +735,25 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -735,22 +735,25 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
static void eth_set_mcast_list(struct net_device *dev) static void eth_set_mcast_list(struct net_device *dev)
{ {
struct port *port = netdev_priv(dev); struct port *port = netdev_priv(dev);
struct dev_mc_list *mclist = dev->mc_list; struct dev_mc_list *mclist;
u8 diffs[ETH_ALEN], *addr; u8 diffs[ETH_ALEN], *addr;
int cnt = netdev_mc_count(dev), i; int i;
if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) { if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
__raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
&port->regs->rx_control[0]); &port->regs->rx_control[0]);
return; return;
} }
memset(diffs, 0, ETH_ALEN); memset(diffs, 0, ETH_ALEN);
addr = mclist->dmi_addr; /* first MAC address */
while (--cnt && (mclist = mclist->next)) addr = NULL;
netdev_for_each_mc_addr(mclist, dev) {
if (!addr)
addr = mclist->dmi_addr; /* first MAC address */
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; diffs[i] |= addr[i] ^ mclist->dmi_addr[i];
}
for (i = 0; i < ETH_ALEN; i++) { for (i = 0; i < ETH_ALEN; i++) {
__raw_writel(addr[i], &port->regs->mcast_addr[i]); __raw_writel(addr[i], &port->regs->mcast_addr[i]);
......
...@@ -327,25 +327,24 @@ ks8695_refill_rxbuffers(struct ks8695_priv *ksp) ...@@ -327,25 +327,24 @@ ks8695_refill_rxbuffers(struct ks8695_priv *ksp)
*/ */
static void static void
ks8695_init_partial_multicast(struct ks8695_priv *ksp, ks8695_init_partial_multicast(struct ks8695_priv *ksp,
struct dev_mc_list *addr, struct net_device *ndev)
int nr_addr)
{ {
u32 low, high; u32 low, high;
int i; int i;
struct dev_mc_list *dmi;
for (i = 0; i < nr_addr; i++, addr = addr->next) { i = 0;
/* Ran out of addresses? */ netdev_for_each_mc_addr(dmi, ndev) {
if (!addr)
break;
/* Ran out of space in chip? */ /* Ran out of space in chip? */
BUG_ON(i == KS8695_NR_ADDRESSES); BUG_ON(i == KS8695_NR_ADDRESSES);
low = (addr->dmi_addr[2] << 24) | (addr->dmi_addr[3] << 16) | low = (dmi->dmi_addr[2] << 24) | (dmi->dmi_addr[3] << 16) |
(addr->dmi_addr[4] << 8) | (addr->dmi_addr[5]); (dmi->dmi_addr[4] << 8) | (dmi->dmi_addr[5]);
high = (addr->dmi_addr[0] << 8) | (addr->dmi_addr[1]); high = (dmi->dmi_addr[0] << 8) | (dmi->dmi_addr[1]);
ks8695_writereg(ksp, KS8695_AAL_(i), low); ks8695_writereg(ksp, KS8695_AAL_(i), low);
ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high); ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high);
i++;
} }
/* Clear the remaining Additional Station Addresses */ /* Clear the remaining Additional Station Addresses */
...@@ -1215,8 +1214,7 @@ ks8695_set_multicast(struct net_device *ndev) ...@@ -1215,8 +1214,7 @@ ks8695_set_multicast(struct net_device *ndev)
} else { } else {
/* enable specific multicasts */ /* enable specific multicasts */
ctrl &= ~DRXC_RM; ctrl &= ~DRXC_RM;
ks8695_init_partial_multicast(ksp, ndev->mc_list, ks8695_init_partial_multicast(ksp, ndev);
netdev_mc_count(ndev));
} }
ks8695_writereg(ksp, KS8695_DRXC, ctrl); ks8695_writereg(ksp, KS8695_DRXC, ctrl);
......
...@@ -858,10 +858,10 @@ static void w90p910_ether_set_multicast_list(struct net_device *dev) ...@@ -858,10 +858,10 @@ static void w90p910_ether_set_multicast_list(struct net_device *dev)
if (dev->flags & IFF_PROMISC) if (dev->flags & IFF_PROMISC)
rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
else if ((dev->flags & IFF_ALLMULTI) || dev->mc_list) else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev))
rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
else else
rx_mode = CAMCMR_ECMP | CAMCMR_ABP; rx_mode = CAMCMR_ECMP | CAMCMR_ABP;
__raw_writel(rx_mode, ether->reg + REG_CAMCMR); __raw_writel(rx_mode, ether->reg + REG_CAMCMR);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册