]> git.karo-electronics.de Git - linux-beck.git/commitdiff
qed: Pass MAC hints to VFs
authorYuval Mintz <Yuval.Mintz@caviumnetworks.com>
Fri, 14 Oct 2016 09:19:17 +0000 (05:19 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Oct 2016 15:59:57 +0000 (11:59 -0400)
Some hypervisors can support MAC hints to their VFs.
Even though we don't have such a hypervisor API in linux, we add
sufficient logic for the VF to be able to receive such hints and
set the mac accordingly - as long as the VF has not been set with
a MAC already.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_vf.c
drivers/net/ethernet/qlogic/qede/qede_main.c
include/linux/qed/qed_eth_if.h

index abf5bf11f865669c33c9428f98776bc7858e3abe..f580bf4c97f0950b53c1b960f2a4cb3223723e79 100644 (file)
@@ -1230,8 +1230,8 @@ static void qed_handle_bulletin_change(struct qed_hwfn *hwfn)
 
        is_mac_exist = qed_vf_bulletin_get_forced_mac(hwfn, mac,
                                                      &is_mac_forced);
-       if (is_mac_exist && is_mac_forced && cookie)
-               ops->force_mac(cookie, mac);
+       if (is_mac_exist && cookie)
+               ops->force_mac(cookie, mac, !!is_mac_forced);
 
        /* Always update link configuration according to bulletin */
        qed_link_update(hwfn);
index 343038ca047d7ed79369a271c0d13d6ca6b80567..9866d952e3e14049c1a02986e34d70e015afbf11 100644 (file)
@@ -171,10 +171,14 @@ static struct pci_driver qede_pci_driver = {
 #endif
 };
 
-static void qede_force_mac(void *dev, u8 *mac)
+static void qede_force_mac(void *dev, u8 *mac, bool forced)
 {
        struct qede_dev *edev = dev;
 
+       /* MAC hints take effect only if we haven't set one already */
+       if (is_valid_ether_addr(edev->ndev->dev_addr) && !forced)
+               return;
+
        ether_addr_copy(edev->ndev->dev_addr, mac);
        ether_addr_copy(edev->primary_mac, mac);
 }
index 33c24ebc9b7f7be724eb02b40ff23a4ab54558e3..1c779486c30d142626737f90d95aee5a1cca82d0 100644 (file)
@@ -129,7 +129,7 @@ struct qed_tunn_params {
 
 struct qed_eth_cb_ops {
        struct qed_common_cb_ops common;
-       void (*force_mac) (void *dev, u8 *mac);
+       void (*force_mac) (void *dev, u8 *mac, bool forced);
 };
 
 #ifdef CONFIG_DCB