Commit f66b98c8 authored by Sylwester Dziedziuch's avatar Sylwester Dziedziuch Committed by Tony Nguyen

iavf: Fix change VF's mac address

Previously changing mac address gives false negative because
ip link set <interface> address <MAC> return with
RTNLINK: Permission denied.
In iavf_set_mac was check if PF handled our mac set request,
even before filter was added to list.
Because this check returns always true and it never waits for
PF's response.

Move iavf_is_mac_handled to wait_event_interruptible_timeout
instead of false. Now it will wait for PF's response and then
check if address was added or rejected.

Fixes: 35a2443d ("iavf: Add waiting for response from PF in set mac")
Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Co-developed-by: default avatarNorbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: default avatarNorbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent a509702c
...@@ -1077,7 +1077,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p) ...@@ -1077,7 +1077,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
{ {
struct iavf_adapter *adapter = netdev_priv(netdev); struct iavf_adapter *adapter = netdev_priv(netdev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
bool handle_mac = iavf_is_mac_set_handled(netdev, addr->sa_data);
int ret; int ret;
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
...@@ -1094,10 +1093,9 @@ static int iavf_set_mac(struct net_device *netdev, void *p) ...@@ -1094,10 +1093,9 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
return 0; return 0;
} }
if (handle_mac) ret = wait_event_interruptible_timeout(adapter->vc_waitqueue,
goto done; iavf_is_mac_set_handled(netdev, addr->sa_data),
msecs_to_jiffies(2500));
ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, false, msecs_to_jiffies(2500));
/* If ret < 0 then it means wait was interrupted. /* If ret < 0 then it means wait was interrupted.
* If ret == 0 then it means we got a timeout. * If ret == 0 then it means we got a timeout.
...@@ -1111,7 +1109,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p) ...@@ -1111,7 +1109,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
if (!ret) if (!ret)
return -EAGAIN; return -EAGAIN;
done:
if (!ether_addr_equal(netdev->dev_addr, addr->sa_data)) if (!ether_addr_equal(netdev->dev_addr, addr->sa_data))
return -EACCES; return -EACCES;
......
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