aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/chelsio
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-17 06:56:45 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 18:59:48 -0500
commit305b0160932af0ed67259b4b13c471aed2a86588 (patch)
tree2a3965e812a6e8f747619a7714cbf5b35528b4a0 /drivers/net/chelsio
parent0988d26978561d568efed45cc5576d85ea7b609d (diff)
chelsio: convert to use netdev_for_each_mc_addr
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/chelsio')
-rw-r--r--drivers/net/chelsio/common.h16
-rw-r--r--drivers/net/chelsio/cxgb2.c2
-rw-r--r--drivers/net/chelsio/pm3393.c6
3 files changed, 5 insertions, 19 deletions
diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h
index bb159d9603bf..9f89fd600643 100644
--- a/drivers/net/chelsio/common.h
+++ b/drivers/net/chelsio/common.h
@@ -90,25 +90,13 @@
90typedef struct adapter adapter_t; 90typedef struct adapter adapter_t;
91 91
92struct t1_rx_mode { 92struct t1_rx_mode {
93 struct net_device *dev; 93 struct net_device *dev;
94 u32 idx;
95 struct dev_mc_list *list;
96}; 94};
97 95
98#define t1_rx_mode_promisc(rm) (rm->dev->flags & IFF_PROMISC) 96#define t1_rx_mode_promisc(rm) (rm->dev->flags & IFF_PROMISC)
99#define t1_rx_mode_allmulti(rm) (rm->dev->flags & IFF_ALLMULTI) 97#define t1_rx_mode_allmulti(rm) (rm->dev->flags & IFF_ALLMULTI)
100#define t1_rx_mode_mc_cnt(rm) (netdev_mc_count(rm->dev)) 98#define t1_rx_mode_mc_cnt(rm) (netdev_mc_count(rm->dev))
101 99#define t1_get_netdev(rm) (rm->dev)
102static inline u8 *t1_get_next_mcaddr(struct t1_rx_mode *rm)
103{
104 u8 *addr = NULL;
105
106 if (rm->idx++ < t1_rx_mode_mc_cnt(rm)) {
107 addr = rm->list->dmi_addr;
108 rm->list = rm->list->next;
109 }
110 return addr;
111}
112 100
113#define MAX_NPORTS 4 101#define MAX_NPORTS 4
114#define PORT_MASK ((1 << MAX_NPORTS) - 1) 102#define PORT_MASK ((1 << MAX_NPORTS) - 1)
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 082cdb28b510..a54a32b16498 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -125,8 +125,6 @@ static void t1_set_rxmode(struct net_device *dev)
125 struct t1_rx_mode rm; 125 struct t1_rx_mode rm;
126 126
127 rm.dev = dev; 127 rm.dev = dev;
128 rm.idx = 0;
129 rm.list = dev->mc_list;
130 mac->ops->set_rx_mode(mac, &rm); 128 mac->ops->set_rx_mode(mac, &rm);
131} 129}
132 130
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
index 2117c4fbb107..33d674f36722 100644
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -375,12 +375,12 @@ static int pm3393_set_rx_mode(struct cmac *cmac, struct t1_rx_mode *rm)
375 rx_mode |= SUNI1x10GEXP_BITMSK_RXXG_MHASH_EN; 375 rx_mode |= SUNI1x10GEXP_BITMSK_RXXG_MHASH_EN;
376 } else if (t1_rx_mode_mc_cnt(rm)) { 376 } else if (t1_rx_mode_mc_cnt(rm)) {
377 /* Accept one or more multicast(s). */ 377 /* Accept one or more multicast(s). */
378 u8 *addr; 378 struct dev_mc_list *dmi;
379 int bit; 379 int bit;
380 u16 mc_filter[4] = { 0, }; 380 u16 mc_filter[4] = { 0, };
381 381
382 while ((addr = t1_get_next_mcaddr(rm))) { 382 netdev_for_each_mc_addr(dmi, t1_get_netdev(rm)) {
383 bit = (ether_crc(ETH_ALEN, addr) >> 23) & 0x3f; /* bit[23:28] */ 383 bit = (ether_crc(ETH_ALEN, dmi->dmi_addr) >> 23) & 0x3f; /* bit[23:28] */
384 mc_filter[bit >> 4] |= 1 << (bit & 0xf); 384 mc_filter[bit >> 4] |= 1 << (bit & 0xf);
385 } 385 }
386 pmwrite(cmac, SUNI1x10GEXP_REG_RXXG_MULTICAST_HASH_LOW, mc_filter[0]); 386 pmwrite(cmac, SUNI1x10GEXP_REG_RXXG_MULTICAST_HASH_LOW, mc_filter[0]);