optimize procedure of changing MAC address on interface
Subsystems (3)
v3 cover optimize procedure of changing MAC address on interface
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.
v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and ice
Piotr Gardocki (3):
net: add check for current MAC address in dev_set_mac_address
i40e: remove unnecessary check for old MAC == new MAC
ice: remove unnecessary check for old MAC == new MAC
drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------ drivers/net/ethernet/intel/ice/ice_main.c | 5 ----- net/core/dev.c | 2 ++ 3 files changed, 2 insertions(+), 11 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/3 net: add check for current MAC address in dev_set_mac_address
In some cases it is possible for kernel to come with request to change primary MAC address to the address that is already set on the given interface.
Add proper check to return fast from the function in these cases.
An example of such case is adding an interface to bonding channel in balance-alb mode:
modprobe bonding mode=balance-alb miimon=100 max_bonds=1 ip link set bond0 up
ifenslave bond0 <eth>
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
@@ -8754,6 +8754,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,return -EINVAL ;if (!netif_device_present (dev))return -ENODEV ; +if (!memcmp (dev->dev_addr, sa->sa_data, dev->addr_len)) +return 0 ; err =dev_pre_changeaddr_notify (dev, sa->sa_data, extack);if (err)return err;
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 6 lines · Piotr Gardocki
In some cases it is possible for kernel to come with request to change primary MAC address to the address that is already set on the given interface.
Add proper check to return fast from the function in these cases.
Quoted 7 lines
An example of such case is adding an interface to bonding channel in balance-alb mode:
modprobe bonding mode=balance-alb miimon=100 max_bonds=1 ip link set bond0 up
ifenslave bond0 <eth>Signed-off-by Piotr Gardocki <[email protected]>
PATCH v3 2/3 i40e: remove unnecessary check for old MAC == new MAC
In reply to Piotr GardockiThe check has been moved to core. The ndo_set_mac_address callback is not being called with new MAC address equal to the old one anymore.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -6
@@ -1788,12 +1788,6 @@ static int i40e_set_mac(struct net_device *netdev, void *p)if (!is_valid_ether_addr (addr->sa_data))return -EADDRNOTAVAIL ; -if (ether_addr_equal (netdev->dev_addr, addr->sa_data)) { -netdev_info (netdev,"already using mac address %pM\n" , - addr->sa_data); -return 0 ; - } -if (test_bit (__I40E_DOWN, pf->state) ||test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state))return -EADDRNOTAVAIL ;
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 2/3] i40e: remove unnecessary check for old MAC == new MAC
Quoted 4 lines · Piotr Gardocki
The check has been moved to core. The
ndo_set_mac_addresscallback is not being called with new MAC address equal to the old one anymore.Signed-off-by Piotr Gardocki <[email protected]>
PATCH v3 3/3 ice: remove unnecessary check for old MAC == new MAC
In reply to Piotr GardockiThe check has been moved to core. The ndo_set_mac_address callback is not being called with new MAC address equal to the old one anymore.
--- drivers/net/ethernet/intel/ice/ice_main.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -5
@@ -5624,11 +5624,6 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)if (!is_valid_ether_addr (mac))return -EADDRNOTAVAIL ; -if (ether_addr_equal (netdev->dev_addr, mac)) { -netdev_dbg (netdev,"already using mac %pM\n" , mac); -return 0 ; - } -if (test_bit (ICE_DOWN , pf->state) ||ice_is_reset_in_progress (pf->state)) { netdev_err(netdev, "can't set mac %pM. device not ready\n",
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 3/3] ice: remove unnecessary check for old MAC == new MAC
Quoted 4 lines · Piotr Gardocki
The check has been moved to core. The
ndo_set_mac_addresscallback is not being called with new MAC address equal to the old one anymore.Signed-off-by Piotr Gardocki <[email protected]>
Quoted 8 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and ice
Any particular reason for not including my rev-by tags on driver patches?
Quoted 14 lines
Piotr Gardocki (3):
net: add check for current MAC address indev_set_mac_address
i40e: remove unnecessary check for old MAC == new MAC
ice: remove unnecessary check for old MAC == new MACdrivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------ drivers/net/ethernet/intel/ice/ice_main.c | 5 ----- net/core/dev.c | 2 ++ 3 files changed, 2 insertions(+), 11 deletions(-)Signature · 1 line
2.34.1
Quoted 11 lines · Maciej Fijalkowski
Quoted 8 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and iceAny particular reason for not including my rev-by tags on driver patches?
No, I just forgot I can include them when I'm not changing the entire patch set. I'm sorry :(
Quoted 7 lines · Piotr Gardocki
Quoted 6 lines · Maciej Fijalkowski
Quoted 5 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and iceAny particular reason for not including my rev-by tags on driver patches?
No, I just forgot I can include them when I'm not changing the entire patch set. I'm sorry :(
No worries, I think we can ask Jakub to include them if he thinks current state of this work is fine.
Quoted 4 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.
Hi Pitor,
I am wondering if you audited other drivers to see if they could also be updated in a similar way to the Intel changes in this patch-set.
Quoted 11 lines · Simon Horman
Quoted 4 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.Hi Pitor,
I am wondering if you audited other drivers to see if they could also be updated in a similar way to the Intel changes in this patch-set.
Hi Simon,
We already discussed this in "[PATCH net-next v2 3/3]". Other drivers should be audited at one point, but there are hundreds of ndo_set_mac_address callbacks in kernel and I don't have resources to review all of them. I just fixed Intel drivers for now.
When this patch set is applied someone else can work on that.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 13 lines · Piotr Gardocki
Quoted 11 lines · Simon Horman
Quoted 4 lines · Piotr Gardocki
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.Hi Pitor,
I am wondering if you audited other drivers to see if they could also be updated in a similar way to the Intel changes in this patch-set.
Quoted 7 lines
Hi Simon,
We already discussed this in "[PATCH net-next v2 3/3]". Other drivers should be audited at one point, but there are hundreds of
ndo_set_mac_addresscallbacks in kernel and I don't have resources to review all of them. I just fixed Intel drivers for now.
When this patch set is applied someone else can work on that.
Sorry, I forgot about that discussion.
Of course this is fine.
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Wed, 14 Jun 2023 16:52:59 +0200 you wrote:
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and ice[...]
Here is the summary with links:
- [net-next,v3,1/3] net: add check for current MAC address in dev_set_mac_address
https://git.kernel.org/netdev/net-next/c/ad72c4a06acc - [net-next,v3,2/3] i40e: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/c45a6d1a23c5 - [net-next,v3,3/3] ice: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/96868cca7971
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 18 lines
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Wed, 14 Jun 2023 16:52:59 +0200 you wrote:
The first patch adds an if statement in core to skip early when the MAC address is not being changes.
The remaining patches remove such checks from Intel drivers as they're redundant at this point.v3: removed "This patch ..." from first patch to simplify sentence.
v2: modified check in core to support addresses of any length, removed redundant checks in i40e and ice[...]
Quoted 7 lines
Here is the summary with links:
- [net-next,v3,1/3] net: add check for current MAC address indev_set_mac_addresshttps://git.kernel.org/netdev/net-next/c/ad72c4a06acc - [net-next,v3,2/3] i40e: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/c45a6d1a23c5 - [net-next,v3,3/3] ice: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/96868cca7971
Ah, so next time I will respond to each revision with rev-by tags 😉
Quoted 7 lines
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Jakub Kicinski
maintainerQuoted 9 lines · Maciej
Quoted 7 lines
Here is the summary with links:
- [net-next,v3,1/3] net: add check for current MAC address indev_set_mac_addresshttps://git.kernel.org/netdev/net-next/c/ad72c4a06acc - [net-next,v3,2/3] i40e: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/c45a6d1a23c5 - [net-next,v3,3/3] ice: remove unnecessary check for old MAC == new MAC https://git.kernel.org/netdev/net-next/c/96868cca7971Ah, so next time I will respond to each revision with rev-by tags 😉
I may have done this slightly out of spite :P
You tell the man that he didn't keep your R-b tag, why not throw it in again in one of your responses? It's bit of a PITA for me to add it manually. One tag in reply to the cover letter is enough FWIW (at least on netdev, I explained to BPF folks how to get the tag propagation from cover letter to work but I'm not 100% sure they set it up for themselves).