aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorSathya Perla <sathyap@serverengines.com>2009-06-17 20:09:25 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-19 03:18:41 -0400
commit24307eef74bd38e3fc6a6df8f8a1bfc48967f9f6 (patch)
tree86583877a2178f8ea1baff35e2262a6b1de8bd58 /drivers/net/benet/be_main.c
parent6ac7b687cb3acc437a586794949a43f5249956bb (diff)
be2net: cleanup multicast_set cmd to avoid mc_list copy
Cleanup multicast_set method to avoid an extra copy of mc_list and unwanted promiscuos sets to BE. Signed-off-by: Sathya Perla <sathyap@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r--drivers/net/benet/be_main.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a4ce80e776b6..3dc68034c21d 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -549,47 +549,32 @@ static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
549 be_vid_config(netdev); 549 be_vid_config(netdev);
550} 550}
551 551
552static void be_set_multicast_filter(struct net_device *netdev) 552static void be_set_multicast_list(struct net_device *netdev)
553{ 553{
554 struct be_adapter *adapter = netdev_priv(netdev); 554 struct be_adapter *adapter = netdev_priv(netdev);
555 struct dev_mc_list *mc_ptr; 555 struct be_ctrl_info *ctrl = &adapter->ctrl;
556 u8 mac_addr[32][ETH_ALEN];
557 int i = 0;
558 556
559 if (netdev->flags & IFF_ALLMULTI) { 557 if (netdev->flags & IFF_PROMISC) {
560 /* set BE in Multicast promiscuous */ 558 be_cmd_promiscuous_config(ctrl, adapter->port_num, 1);
561 be_cmd_mcast_mac_set(&adapter->ctrl, 559 adapter->promiscuous = true;
562 adapter->if_handle, NULL, 0, true); 560 goto done;
563 return;
564 } 561 }
565 562
566 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 563 /* BE was previously in promiscous mode; disable it */
567 memcpy(&mac_addr[i][0], mc_ptr->dmi_addr, ETH_ALEN); 564 if (adapter->promiscuous) {
568 if (++i >= 32) { 565 adapter->promiscuous = false;
569 be_cmd_mcast_mac_set(&adapter->ctrl, 566 be_cmd_promiscuous_config(ctrl, adapter->port_num, 0);
570 adapter->if_handle, &mac_addr[0][0], i, false);
571 i = 0;
572 }
573
574 } 567 }
575 568
576 if (i) { 569 if (netdev->flags & IFF_ALLMULTI) {
577 /* reset the promiscuous mode also. */ 570 be_cmd_multicast_set(ctrl, adapter->if_handle, NULL, 0);
578 be_cmd_mcast_mac_set(&adapter->ctrl, 571 goto done;
579 adapter->if_handle, &mac_addr[0][0], i, false);
580 } 572 }
581}
582
583static void be_set_multicast_list(struct net_device *netdev)
584{
585 struct be_adapter *adapter = netdev_priv(netdev);
586 573
587 if (netdev->flags & IFF_PROMISC) { 574 be_cmd_multicast_set(ctrl, adapter->if_handle, netdev->mc_list,
588 be_cmd_promiscuous_config(&adapter->ctrl, adapter->port_num, 1); 575 netdev->mc_count);
589 } else { 576done:
590 be_cmd_promiscuous_config(&adapter->ctrl, adapter->port_num, 0); 577 return;
591 be_set_multicast_filter(netdev);
592 }
593} 578}
594 579
595static void be_rx_rate_update(struct be_adapter *adapter) 580static void be_rx_rate_update(struct be_adapter *adapter)