aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
diff options
context:
space:
mode:
authorJitendra Kalsaria <jitendra.kalsaria@qlogic.com>2013-06-22 04:12:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-23 21:29:58 -0400
commit52e493d01cbf85871f0d1fdaeffdf376444e5d50 (patch)
treeb3c81b56adac55289a611895e9e5cca68c242582 /drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
parentb6b4316c8b2fa6af5cee71e7defd09527b9d1cf9 (diff)
qlcnic: Secondary unicast MAC address support.
Add support for configuring secondary unicast address which will use existing HW filters to store all the unicast MAC addresses and prevent device going into promiscuous mode. Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 218978db2963..e7f305d5bb5f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -499,6 +499,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr, u16 vlan)
499void __qlcnic_set_multi(struct net_device *netdev, u16 vlan) 499void __qlcnic_set_multi(struct net_device *netdev, u16 vlan)
500{ 500{
501 struct qlcnic_adapter *adapter = netdev_priv(netdev); 501 struct qlcnic_adapter *adapter = netdev_priv(netdev);
502 struct qlcnic_hardware_context *ahw = adapter->ahw;
502 struct netdev_hw_addr *ha; 503 struct netdev_hw_addr *ha;
503 static const u8 bcast_addr[ETH_ALEN] = { 504 static const u8 bcast_addr[ETH_ALEN] = {
504 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 505 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
@@ -515,25 +516,30 @@ void __qlcnic_set_multi(struct net_device *netdev, u16 vlan)
515 if (netdev->flags & IFF_PROMISC) { 516 if (netdev->flags & IFF_PROMISC) {
516 if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) 517 if (!(adapter->flags & QLCNIC_PROMISC_DISABLED))
517 mode = VPORT_MISS_MODE_ACCEPT_ALL; 518 mode = VPORT_MISS_MODE_ACCEPT_ALL;
518 goto send_fw_cmd; 519 } else if (netdev->flags & IFF_ALLMULTI) {
519 } 520 if (netdev_mc_count(netdev) > ahw->max_mc_count) {
520 521 mode = VPORT_MISS_MODE_ACCEPT_MULTI;
521 if ((netdev->flags & IFF_ALLMULTI) || 522 } else if (!netdev_mc_empty(netdev) &&
522 (netdev_mc_count(netdev) > adapter->ahw->max_mc_count)) { 523 !qlcnic_sriov_vf_check(adapter)) {
523 mode = VPORT_MISS_MODE_ACCEPT_MULTI; 524 netdev_for_each_mc_addr(ha, netdev)
524 goto send_fw_cmd; 525 qlcnic_nic_add_mac(adapter, ha->addr,
526 vlan);
527 }
528 if (mode != VPORT_MISS_MODE_ACCEPT_MULTI &&
529 qlcnic_sriov_vf_check(adapter))
530 qlcnic_vf_add_mc_list(netdev, vlan);
525 } 531 }
526 532
527 if (!netdev_mc_empty(netdev) && !qlcnic_sriov_vf_check(adapter)) { 533 /* configure unicast MAC address, if there is not sufficient space
528 netdev_for_each_mc_addr(ha, netdev) { 534 * to store all the unicast addresses then enable promiscuous mode
535 */
536 if (netdev_uc_count(netdev) > ahw->max_uc_count) {
537 mode = VPORT_MISS_MODE_ACCEPT_ALL;
538 } else if (!netdev_uc_empty(netdev)) {
539 netdev_for_each_uc_addr(ha, netdev)
529 qlcnic_nic_add_mac(adapter, ha->addr, vlan); 540 qlcnic_nic_add_mac(adapter, ha->addr, vlan);
530 }
531 } 541 }
532 542
533 if (qlcnic_sriov_vf_check(adapter))
534 qlcnic_vf_add_mc_list(netdev, vlan);
535
536send_fw_cmd:
537 if (!qlcnic_sriov_vf_check(adapter)) { 543 if (!qlcnic_sriov_vf_check(adapter)) {
538 if (mode == VPORT_MISS_MODE_ACCEPT_ALL && 544 if (mode == VPORT_MISS_MODE_ACCEPT_ALL &&
539 !adapter->fdb_mac_learn) { 545 !adapter->fdb_mac_learn) {