diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-17 07:27:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 18:59:48 -0500 |
commit | 0988d26978561d568efed45cc5576d85ea7b609d (patch) | |
tree | d6b658928b8ab50d81db521c1ea9547df9a9aec0 /drivers | |
parent | e4a474f82ddaaef65433b0b4f5169f2f6cd8ddb0 (diff) |
cxgb3: convert to use netdev_for_each_addr
Removed whole t3_rx_mode structure and appropriate helpers cause they are no
longer needed.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/cxgb3/common.h | 28 | ||||
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 8 | ||||
-rw-r--r-- | drivers/net/cxgb3/xgmac.c | 15 |
3 files changed, 11 insertions, 40 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h index 6ff356d4c7ab..fe08a004b0dd 100644 --- a/drivers/net/cxgb3/common.h +++ b/drivers/net/cxgb3/common.h | |||
@@ -67,32 +67,6 @@ | |||
67 | /* Additional NETIF_MSG_* categories */ | 67 | /* Additional NETIF_MSG_* categories */ |
68 | #define NETIF_MSG_MMIO 0x8000000 | 68 | #define NETIF_MSG_MMIO 0x8000000 |
69 | 69 | ||
70 | struct t3_rx_mode { | ||
71 | struct net_device *dev; | ||
72 | struct dev_mc_list *mclist; | ||
73 | unsigned int idx; | ||
74 | }; | ||
75 | |||
76 | static inline void init_rx_mode(struct t3_rx_mode *p, struct net_device *dev, | ||
77 | struct dev_mc_list *mclist) | ||
78 | { | ||
79 | p->dev = dev; | ||
80 | p->mclist = mclist; | ||
81 | p->idx = 0; | ||
82 | } | ||
83 | |||
84 | static inline u8 *t3_get_next_mcaddr(struct t3_rx_mode *rm) | ||
85 | { | ||
86 | u8 *addr = NULL; | ||
87 | |||
88 | if (rm->mclist && rm->idx < rm->dev->mc_count) { | ||
89 | addr = rm->mclist->dmi_addr; | ||
90 | rm->mclist = rm->mclist->next; | ||
91 | rm->idx++; | ||
92 | } | ||
93 | return addr; | ||
94 | } | ||
95 | |||
96 | enum { | 70 | enum { |
97 | MAX_NPORTS = 2, /* max # of ports */ | 71 | MAX_NPORTS = 2, /* max # of ports */ |
98 | MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ | 72 | MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ |
@@ -746,7 +720,7 @@ void t3_mac_enable_exact_filters(struct cmac *mac); | |||
746 | int t3_mac_enable(struct cmac *mac, int which); | 720 | int t3_mac_enable(struct cmac *mac, int which); |
747 | int t3_mac_disable(struct cmac *mac, int which); | 721 | int t3_mac_disable(struct cmac *mac, int which); |
748 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); | 722 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); |
749 | int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm); | 723 | int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev); |
750 | int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); | 724 | int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); |
751 | int t3_mac_set_num_ucast(struct cmac *mac, int n); | 725 | int t3_mac_set_num_ucast(struct cmac *mac, int n); |
752 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); | 726 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 73622f5312cb..6fd968abb073 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -324,11 +324,9 @@ void t3_os_phymod_changed(struct adapter *adap, int port_id) | |||
324 | 324 | ||
325 | static void cxgb_set_rxmode(struct net_device *dev) | 325 | static void cxgb_set_rxmode(struct net_device *dev) |
326 | { | 326 | { |
327 | struct t3_rx_mode rm; | ||
328 | struct port_info *pi = netdev_priv(dev); | 327 | struct port_info *pi = netdev_priv(dev); |
329 | 328 | ||
330 | init_rx_mode(&rm, dev, dev->mc_list); | 329 | t3_mac_set_rx_mode(&pi->mac, dev); |
331 | t3_mac_set_rx_mode(&pi->mac, &rm); | ||
332 | } | 330 | } |
333 | 331 | ||
334 | /** | 332 | /** |
@@ -339,17 +337,15 @@ static void cxgb_set_rxmode(struct net_device *dev) | |||
339 | */ | 337 | */ |
340 | static void link_start(struct net_device *dev) | 338 | static void link_start(struct net_device *dev) |
341 | { | 339 | { |
342 | struct t3_rx_mode rm; | ||
343 | struct port_info *pi = netdev_priv(dev); | 340 | struct port_info *pi = netdev_priv(dev); |
344 | struct cmac *mac = &pi->mac; | 341 | struct cmac *mac = &pi->mac; |
345 | 342 | ||
346 | init_rx_mode(&rm, dev, dev->mc_list); | ||
347 | t3_mac_reset(mac); | 343 | t3_mac_reset(mac); |
348 | t3_mac_set_num_ucast(mac, MAX_MAC_IDX); | 344 | t3_mac_set_num_ucast(mac, MAX_MAC_IDX); |
349 | t3_mac_set_mtu(mac, dev->mtu); | 345 | t3_mac_set_mtu(mac, dev->mtu); |
350 | t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr); | 346 | t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr); |
351 | t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr); | 347 | t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr); |
352 | t3_mac_set_rx_mode(mac, &rm); | 348 | t3_mac_set_rx_mode(mac, dev); |
353 | t3_link_start(&pi->phy, mac, &pi->link_config); | 349 | t3_link_start(&pi->phy, mac, &pi->link_config); |
354 | t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); | 350 | t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); |
355 | } | 351 | } |
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index 0c08de5d09fd..c142a2132e9f 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
@@ -297,29 +297,30 @@ static int hash_hw_addr(const u8 * addr) | |||
297 | return hash; | 297 | return hash; |
298 | } | 298 | } |
299 | 299 | ||
300 | int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm) | 300 | int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev) |
301 | { | 301 | { |
302 | u32 val, hash_lo, hash_hi; | 302 | u32 val, hash_lo, hash_hi; |
303 | struct adapter *adap = mac->adapter; | 303 | struct adapter *adap = mac->adapter; |
304 | unsigned int oft = mac->offset; | 304 | unsigned int oft = mac->offset; |
305 | 305 | ||
306 | val = t3_read_reg(adap, A_XGM_RX_CFG + oft) & ~F_COPYALLFRAMES; | 306 | val = t3_read_reg(adap, A_XGM_RX_CFG + oft) & ~F_COPYALLFRAMES; |
307 | if (rm->dev->flags & IFF_PROMISC) | 307 | if (dev->flags & IFF_PROMISC) |
308 | val |= F_COPYALLFRAMES; | 308 | val |= F_COPYALLFRAMES; |
309 | t3_write_reg(adap, A_XGM_RX_CFG + oft, val); | 309 | t3_write_reg(adap, A_XGM_RX_CFG + oft, val); |
310 | 310 | ||
311 | if (rm->dev->flags & IFF_ALLMULTI) | 311 | if (dev->flags & IFF_ALLMULTI) |
312 | hash_lo = hash_hi = 0xffffffff; | 312 | hash_lo = hash_hi = 0xffffffff; |
313 | else { | 313 | else { |
314 | u8 *addr; | 314 | struct dev_mc_list *dmi; |
315 | int exact_addr_idx = mac->nucast; | 315 | int exact_addr_idx = mac->nucast; |
316 | 316 | ||
317 | hash_lo = hash_hi = 0; | 317 | hash_lo = hash_hi = 0; |
318 | while ((addr = t3_get_next_mcaddr(rm))) | 318 | netdev_for_each_mc_addr(dmi, dev) |
319 | if (exact_addr_idx < EXACT_ADDR_FILTERS) | 319 | if (exact_addr_idx < EXACT_ADDR_FILTERS) |
320 | set_addr_filter(mac, exact_addr_idx++, addr); | 320 | set_addr_filter(mac, exact_addr_idx++, |
321 | dmi->dmi_addr); | ||
321 | else { | 322 | else { |
322 | int hash = hash_hw_addr(addr); | 323 | int hash = hash_hw_addr(dmi->dmi_addr); |
323 | 324 | ||
324 | if (hash < 32) | 325 | if (hash < 32) |
325 | hash_lo |= (1 << hash); | 326 | hash_lo |= (1 << hash); |