aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorSathya Perla <sathyap@serverengines.com>2009-11-22 17:01:10 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-23 13:44:18 -0500
commite7b909a68cfb83e4bafdadac39534969ce260518 (patch)
treeab8e12fdcb4524598de8b8c867c27ada237e8b1d /drivers/net/benet/be_main.c
parent9d4fb27db90043cd2640e4bc778f9c755d3c17c1 (diff)
be2net: support configuration of 64 multicast addresses instead of 32
To send upto 64 addresses in the multicast-set cmd, the non-embeeded cmd format that provides for a bigger buffer is used instead of an embedded format. 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.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 921103c40195..919fd82ebbae 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -562,13 +562,15 @@ static void be_set_multicast_list(struct net_device *netdev)
562 be_cmd_promiscuous_config(adapter, adapter->port_num, 0); 562 be_cmd_promiscuous_config(adapter, adapter->port_num, 0);
563 } 563 }
564 564
565 if (netdev->flags & IFF_ALLMULTI) { 565 /* Enable multicast promisc if num configured exceeds what we support */
566 be_cmd_multicast_set(adapter, adapter->if_handle, NULL, 0); 566 if (netdev->flags & IFF_ALLMULTI || netdev->mc_count > BE_MAX_MC) {
567 be_cmd_multicast_set(adapter, adapter->if_handle, NULL, 0,
568 &adapter->mc_cmd_mem);
567 goto done; 569 goto done;
568 } 570 }
569 571
570 be_cmd_multicast_set(adapter, adapter->if_handle, netdev->mc_list, 572 be_cmd_multicast_set(adapter, adapter->if_handle, netdev->mc_list,
571 netdev->mc_count); 573 netdev->mc_count, &adapter->mc_cmd_mem);
572done: 574done:
573 return; 575 return;
574} 576}
@@ -2009,34 +2011,61 @@ static void be_ctrl_cleanup(struct be_adapter *adapter)
2009 if (mem->va) 2011 if (mem->va)
2010 pci_free_consistent(adapter->pdev, mem->size, 2012 pci_free_consistent(adapter->pdev, mem->size,
2011 mem->va, mem->dma); 2013 mem->va, mem->dma);
2014
2015 mem = &adapter->mc_cmd_mem;
2016 if (mem->va)
2017 pci_free_consistent(adapter->pdev, mem->size,
2018 mem->va, mem->dma);
2012} 2019}
2013 2020
2014static int be_ctrl_init(struct be_adapter *adapter) 2021static int be_ctrl_init(struct be_adapter *adapter)
2015{ 2022{
2016 struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced; 2023 struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced;
2017 struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem; 2024 struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem;
2025 struct be_dma_mem *mc_cmd_mem = &adapter->mc_cmd_mem;
2018 int status; 2026 int status;
2019 2027
2020 status = be_map_pci_bars(adapter); 2028 status = be_map_pci_bars(adapter);
2021 if (status) 2029 if (status)
2022 return status; 2030 goto done;
2023 2031
2024 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16; 2032 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
2025 mbox_mem_alloc->va = pci_alloc_consistent(adapter->pdev, 2033 mbox_mem_alloc->va = pci_alloc_consistent(adapter->pdev,
2026 mbox_mem_alloc->size, &mbox_mem_alloc->dma); 2034 mbox_mem_alloc->size, &mbox_mem_alloc->dma);
2027 if (!mbox_mem_alloc->va) { 2035 if (!mbox_mem_alloc->va) {
2028 be_unmap_pci_bars(adapter); 2036 status = -ENOMEM;
2029 return -1; 2037 goto unmap_pci_bars;
2030 } 2038 }
2039
2031 mbox_mem_align->size = sizeof(struct be_mcc_mailbox); 2040 mbox_mem_align->size = sizeof(struct be_mcc_mailbox);
2032 mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16); 2041 mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16);
2033 mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16); 2042 mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16);
2034 memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox)); 2043 memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
2044
2045 mc_cmd_mem->size = sizeof(struct be_cmd_req_mcast_mac_config);
2046 mc_cmd_mem->va = pci_alloc_consistent(adapter->pdev, mc_cmd_mem->size,
2047 &mc_cmd_mem->dma);
2048 if (mc_cmd_mem->va == NULL) {
2049 status = -ENOMEM;
2050 goto free_mbox;
2051 }
2052 memset(mc_cmd_mem->va, 0, mc_cmd_mem->size);
2053
2035 spin_lock_init(&adapter->mbox_lock); 2054 spin_lock_init(&adapter->mbox_lock);
2036 spin_lock_init(&adapter->mcc_lock); 2055 spin_lock_init(&adapter->mcc_lock);
2037 spin_lock_init(&adapter->mcc_cq_lock); 2056 spin_lock_init(&adapter->mcc_cq_lock);
2038 2057
2039 return 0; 2058 return 0;
2059
2060free_mbox:
2061 pci_free_consistent(adapter->pdev, mbox_mem_alloc->size,
2062 mbox_mem_alloc->va, mbox_mem_alloc->dma);
2063
2064unmap_pci_bars:
2065 be_unmap_pci_bars(adapter);
2066
2067done:
2068 return status;
2040} 2069}
2041 2070
2042static void be_stats_cleanup(struct be_adapter *adapter) 2071static void be_stats_cleanup(struct be_adapter *adapter)