diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-05-05 09:03:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-06 00:22:33 -0400 |
commit | 62538d2490d071e822d85651445c8a0bb4ed5a4b (patch) | |
tree | 196a439484585ceb3eb1caf1599e271cdf432a9a /drivers/net/octeon | |
parent | 7f01648aa32185b8047aea384237ad58e430e07f (diff) |
netdev: octeon_mgmt: Use proper MAC addresses.
The original implementation incorrectly uses netdev->dev_addrs.
Use netdev->uc instead. Also use netdev_for_each_uc_addr to iterate
over the addresses. Fix comment.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/octeon')
-rw-r--r-- | drivers/net/octeon/octeon_mgmt.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c index 6b1d443f2ce5..bbbd737210f9 100644 --- a/drivers/net/octeon/octeon_mgmt.c +++ b/drivers/net/octeon/octeon_mgmt.c | |||
@@ -475,12 +475,11 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | |||
475 | unsigned int multicast_mode = 1; /* 1 - Reject all multicast. */ | 475 | unsigned int multicast_mode = 1; /* 1 - Reject all multicast. */ |
476 | struct octeon_mgmt_cam_state cam_state; | 476 | struct octeon_mgmt_cam_state cam_state; |
477 | struct netdev_hw_addr *ha; | 477 | struct netdev_hw_addr *ha; |
478 | struct list_head *pos; | ||
479 | int available_cam_entries; | 478 | int available_cam_entries; |
480 | 479 | ||
481 | memset(&cam_state, 0, sizeof(cam_state)); | 480 | memset(&cam_state, 0, sizeof(cam_state)); |
482 | 481 | ||
483 | if ((netdev->flags & IFF_PROMISC) || netdev->dev_addrs.count > 7) { | 482 | if ((netdev->flags & IFF_PROMISC) || netdev->uc.count > 7) { |
484 | cam_mode = 0; | 483 | cam_mode = 0; |
485 | available_cam_entries = 8; | 484 | available_cam_entries = 8; |
486 | } else { | 485 | } else { |
@@ -488,13 +487,13 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | |||
488 | * One CAM entry for the primary address, leaves seven | 487 | * One CAM entry for the primary address, leaves seven |
489 | * for the secondary addresses. | 488 | * for the secondary addresses. |
490 | */ | 489 | */ |
491 | available_cam_entries = 7 - netdev->dev_addrs.count; | 490 | available_cam_entries = 7 - netdev->uc.count; |
492 | } | 491 | } |
493 | 492 | ||
494 | if (netdev->flags & IFF_MULTICAST) { | 493 | if (netdev->flags & IFF_MULTICAST) { |
495 | if (cam_mode == 0 || (netdev->flags & IFF_ALLMULTI) || | 494 | if (cam_mode == 0 || (netdev->flags & IFF_ALLMULTI) || |
496 | netdev_mc_count(netdev) > available_cam_entries) | 495 | netdev_mc_count(netdev) > available_cam_entries) |
497 | multicast_mode = 2; /* 1 - Accept all multicast. */ | 496 | multicast_mode = 2; /* 2 - Accept all multicast. */ |
498 | else | 497 | else |
499 | multicast_mode = 0; /* 0 - Use CAM. */ | 498 | multicast_mode = 0; /* 0 - Use CAM. */ |
500 | } | 499 | } |
@@ -502,12 +501,8 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | |||
502 | if (cam_mode == 1) { | 501 | if (cam_mode == 1) { |
503 | /* Add primary address. */ | 502 | /* Add primary address. */ |
504 | octeon_mgmt_cam_state_add(&cam_state, netdev->dev_addr); | 503 | octeon_mgmt_cam_state_add(&cam_state, netdev->dev_addr); |
505 | list_for_each(pos, &netdev->dev_addrs.list) { | 504 | netdev_for_each_uc_addr(ha, netdev) |
506 | struct netdev_hw_addr *hw_addr; | 505 | octeon_mgmt_cam_state_add(&cam_state, ha->addr); |
507 | hw_addr = list_entry(pos, struct netdev_hw_addr, list); | ||
508 | octeon_mgmt_cam_state_add(&cam_state, hw_addr->addr); | ||
509 | list = list->next; | ||
510 | } | ||
511 | } | 506 | } |
512 | if (multicast_mode == 0) { | 507 | if (multicast_mode == 0) { |
513 | netdev_for_each_mc_addr(ha, netdev) | 508 | netdev_for_each_mc_addr(ha, netdev) |