iavf: Fix change VF's mac address
Subsystems (2)
PATCH v2 1/1 iavf: Fix change VF's mac address
From: Sylwester Dziedziuch <[email protected]>
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.
---
v2: Added missing signed-off-by, fixed commit message and moved parenthesis to the line where function is called
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +3 -6
@@ -1077,7 +1077,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p) {struct iavf_adapter *adapter =netdev_priv (netdev);struct sockaddr *addr = p; -bool handle_mac =iavf_is_mac_set_handled (netdev, addr->sa_data);int ret;if (!is_valid_ether_addr (addr->sa_data))
@@ -1094,10 +1093,9 @@ static int iavf_set_mac(struct net_device *netdev, void *p)return 0 ; } -if (handle_mac) - goto done; - - ret =wait_event_interruptible_timeout (adapter->vc_waitqueue, false,msecs_to_jiffies (2500 )); + ret =wait_event_interruptible_timeout (adapter->vc_waitqueue, +iavf_is_mac_set_handled (netdev, addr->sa_data), +msecs_to_jiffies (2500 ));/* If ret < 0 then it means wait was interrupted. * 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)if (!ret)return -EAGAIN ; -done:if (!ether_addr_equal (netdev->dev_addr, addr->sa_data))return -EACCES ;
Signature · 6 lines
2.27.0 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
drivers/net/ethernet/intel/iavf/iavf_main.c
Quoted 41 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Thursday, September 1, 2022 4:32 PM
To: [email protected]
Cc: Dziedziuch, SylwesterX <[email protected]>; Zulinski, NorbertX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] iavf: Fix change VF's mac addressFrom: Sylwester Dziedziuch <[email protected]>
Previously changing mac address gives false negative because ip link set <interface> address <MAC> return with
RTNLINK: Permission denied.
Iniavf_set_macwas 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_handledtowait_event_interruptible_timeoutinstead of false. Now it will wait for PF's response and then check if address was added or rejected.Fixes 35a2443d0910 ("iavf: Add waiting for response from PF in set mac")Signed-off-by Sylwester Dziedziuch <[email protected]>Co-developed-by Norbert Zulinski <[email protected]>Signed-off-by Norbert Zulinski <[email protected]>Signed-off-by Mateusz Palczewski <[email protected]>---
v2: Added missing signed-off-by, fixed commit message and moved
parenthesis to the line where function is called--- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/iavf/iavf_main.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan