aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbevf
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-03-23 18:58:20 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-26 23:10:03 -0400
commit5c58c47a4f3758c81594402451d8fe0d8accb4e8 (patch)
tree08a5a5902776c4394ea843b6cadad29e868a306f /drivers/net/ixgbevf
parent2853eb892edb6be1ea13787d0c24fb72c1d1cca5 (diff)
ixgbevf: convert to use netdev_for_each_mc_addr
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbevf')
-rw-r--r--drivers/net/ixgbevf/ixgbevf_main.c24
-rw-r--r--drivers/net/ixgbevf/vf.c24
-rw-r--r--drivers/net/ixgbevf/vf.h4
3 files changed, 15 insertions, 37 deletions
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index 7cacb124e4cb..6ced5efc0e07 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -1495,22 +1495,6 @@ static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter)
1495 } 1495 }
1496} 1496}
1497 1497
1498static u8 *ixgbevf_addr_list_itr(struct ixgbe_hw *hw, u8 **mc_addr_ptr,
1499 u32 *vmdq)
1500{
1501 struct dev_mc_list *mc_ptr;
1502 u8 *addr = *mc_addr_ptr;
1503 *vmdq = 0;
1504
1505 mc_ptr = container_of(addr, struct dev_mc_list, dmi_addr[0]);
1506 if (mc_ptr->next)
1507 *mc_addr_ptr = mc_ptr->next->dmi_addr;
1508 else
1509 *mc_addr_ptr = NULL;
1510
1511 return addr;
1512}
1513
1514/** 1498/**
1515 * ixgbevf_set_rx_mode - Multicast set 1499 * ixgbevf_set_rx_mode - Multicast set
1516 * @netdev: network interface device structure 1500 * @netdev: network interface device structure
@@ -1523,16 +1507,10 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev)
1523{ 1507{
1524 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1508 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1525 struct ixgbe_hw *hw = &adapter->hw; 1509 struct ixgbe_hw *hw = &adapter->hw;
1526 u8 *addr_list = NULL;
1527 int addr_count = 0;
1528 1510
1529 /* reprogram multicast list */ 1511 /* reprogram multicast list */
1530 addr_count = netdev_mc_count(netdev);
1531 if (addr_count)
1532 addr_list = netdev->mc_list->dmi_addr;
1533 if (hw->mac.ops.update_mc_addr_list) 1512 if (hw->mac.ops.update_mc_addr_list)
1534 hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count, 1513 hw->mac.ops.update_mc_addr_list(hw, netdev);
1535 ixgbevf_addr_list_itr);
1536} 1514}
1537 1515
1538static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter) 1516static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter)
diff --git a/drivers/net/ixgbevf/vf.c b/drivers/net/ixgbevf/vf.c
index 4b5dec0ec140..f457c52b5ed4 100644
--- a/drivers/net/ixgbevf/vf.c
+++ b/drivers/net/ixgbevf/vf.c
@@ -252,22 +252,18 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
252/** 252/**
253 * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses 253 * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses
254 * @hw: pointer to the HW structure 254 * @hw: pointer to the HW structure
255 * @mc_addr_list: array of multicast addresses to program 255 * @netdev: pointer to net device structure
256 * @mc_addr_count: number of multicast addresses to program
257 * @next: caller supplied function to return next address in list
258 * 256 *
259 * Updates the Multicast Table Array. 257 * Updates the Multicast Table Array.
260 **/ 258 **/
261static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list, 259static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
262 u32 mc_addr_count, 260 struct net_device *netdev)
263 ixgbe_mc_addr_itr next)
264{ 261{
262 struct dev_addr_list *dmi;
265 struct ixgbe_mbx_info *mbx = &hw->mbx; 263 struct ixgbe_mbx_info *mbx = &hw->mbx;
266 u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; 264 u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
267 u16 *vector_list = (u16 *)&msgbuf[1]; 265 u16 *vector_list = (u16 *)&msgbuf[1];
268 u32 vector;
269 u32 cnt, i; 266 u32 cnt, i;
270 u32 vmdq;
271 267
272 /* Each entry in the list uses 1 16 bit word. We have 30 268 /* Each entry in the list uses 1 16 bit word. We have 30
273 * 16 bit words available in our HW msg buffer (minus 1 for the 269 * 16 bit words available in our HW msg buffer (minus 1 for the
@@ -278,13 +274,17 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
278 * addresses except for in large enterprise network environments. 274 * addresses except for in large enterprise network environments.
279 */ 275 */
280 276
281 cnt = (mc_addr_count > 30) ? 30 : mc_addr_count; 277 cnt = netdev_mc_count(netdev);
278 if (cnt > 30)
279 cnt = 30;
282 msgbuf[0] = IXGBE_VF_SET_MULTICAST; 280 msgbuf[0] = IXGBE_VF_SET_MULTICAST;
283 msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT; 281 msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT;
284 282
285 for (i = 0; i < cnt; i++) { 283 i = 0;
286 vector = ixgbevf_mta_vector(hw, next(hw, &mc_addr_list, &vmdq)); 284 netdev_for_each_mc_addr(dmi, netdev) {
287 vector_list[i] = vector; 285 if (i == cnt)
286 break;
287 vector_list[i++] = ixgbevf_mta_vector(hw, dmi->dmi_addr);
288 } 288 }
289 289
290 mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE); 290 mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h
index 1f31b052d4b4..94b750b8874f 100644
--- a/drivers/net/ixgbevf/vf.h
+++ b/drivers/net/ixgbevf/vf.h
@@ -32,6 +32,7 @@
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/if_ether.h> 34#include <linux/if_ether.h>
35#include <linux/netdevice.h>
35 36
36#include "defines.h" 37#include "defines.h"
37#include "regs.h" 38#include "regs.h"
@@ -62,8 +63,7 @@ struct ixgbe_mac_operations {
62 /* RAR, Multicast, VLAN */ 63 /* RAR, Multicast, VLAN */
63 s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32); 64 s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32);
64 s32 (*init_rx_addrs)(struct ixgbe_hw *); 65 s32 (*init_rx_addrs)(struct ixgbe_hw *);
65 s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, 66 s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
66 ixgbe_mc_addr_itr);
67 s32 (*enable_mc)(struct ixgbe_hw *); 67 s32 (*enable_mc)(struct ixgbe_hw *);
68 s32 (*disable_mc)(struct ixgbe_hw *); 68 s32 (*disable_mc)(struct ixgbe_hw *);
69 s32 (*clear_vfta)(struct ixgbe_hw *); 69 s32 (*clear_vfta)(struct ixgbe_hw *);