Commit c3aaa403 authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

qed: Pass MAC hints to VFs

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: default avatarYuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d0b3fbb2
...@@ -1230,8 +1230,8 @@ static void qed_handle_bulletin_change(struct qed_hwfn *hwfn) ...@@ -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_exist = qed_vf_bulletin_get_forced_mac(hwfn, mac,
&is_mac_forced); &is_mac_forced);
if (is_mac_exist && is_mac_forced && cookie) if (is_mac_exist && cookie)
ops->force_mac(cookie, mac); ops->force_mac(cookie, mac, !!is_mac_forced);
/* Always update link configuration according to bulletin */ /* Always update link configuration according to bulletin */
qed_link_update(hwfn); qed_link_update(hwfn);
......
...@@ -171,10 +171,14 @@ static struct pci_driver qede_pci_driver = { ...@@ -171,10 +171,14 @@ static struct pci_driver qede_pci_driver = {
#endif #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; 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->ndev->dev_addr, mac);
ether_addr_copy(edev->primary_mac, mac); ether_addr_copy(edev->primary_mac, mac);
} }
......
...@@ -129,7 +129,7 @@ struct qed_tunn_params { ...@@ -129,7 +129,7 @@ struct qed_tunn_params {
struct qed_eth_cb_ops { struct qed_eth_cb_ops {
struct qed_common_cb_ops common; 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 #ifdef CONFIG_DCB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment