optimize procedure of changing MAC address on interface
Subsystems (3)
v2 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.
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 v2 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.
This patch adds 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 v2 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.
This patch adds proper check to return fast from the function in these cases.
Please use imperative mood here - "add proper check..."
Quoted 8 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]>
I'll let Kuba ack it.
Quoted 20 lines
--- 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 v2 1/3] net: add check for current MAC address in dev_set_mac_address
Dear Maciej,
Am 13.06.23 um 15:10 schrieb Maciej Fijalkowski:
Quoted 9 lines · Piotr Gardocki
Quoted 6 lines
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.
This patch adds proper check to return fast from the function in these cases.
Please use imperative mood here - "add proper check..."
Just a note, that in “add check …” the verb *add* is already in imperative mood. (You can shorten “add noun …” often to just use the verb for the noun. In this case:
Check current MAC address in dev_set_mac_address
But it’s not specific enough. Maybe:
Avoid setting same MAC address
Kind regards,
Paul
Quoted 14 lines
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]>I'll let Kuba ack it.
Quoted 4 lines
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 16 lines
Quoted 16 lines
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
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RE: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 6 lines
Am 13.06.23 um 15:10 schrieb Maciej Fijalkowski:
Quoted 5 lines · Piotr Gardocki
Quoted 4 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
This patch adds proper check to return fast from the function in these cases.
Please use imperative mood here - "add proper check..."
Just a note, that in “add check …” the verb *add* is already in imperative mood. (You can shorten “add noun …” often to just use the verb for the noun. In this case:
I just meant to get rid of 'this patch...'
Quoted 27 lines
Check current MAC address in
dev_set_mac_addressBut it’s not specific enough. Maybe:
Avoid setting same MAC address
Kind regards,
Paul
Quoted 14 lines
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]>I'll let Kuba ack it.
Quoted 4 lines
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
net/core/dev.c +0
-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 ;Quoted 8 lines
Quoted 8 lines
net/core/dev.c +2
-1+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; --2.34.1
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
In reply to Piotr GardockiQuoted 7 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.
This patch adds 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]>
Hello Piotr,
I believe this patch has an (unintended?) side effect.
The early return in dev_set_mac_address() makes it so 'dev->addr_assign_type' doesn't get assigned with NET_ADDR_SET, I don't think this is the correct behavior.
Re: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 14 lines · Gal Pressman
Quoted 13 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.
This patch adds 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>
Quoted 8 lines
Quoted 1 line
Signed-off-by Piotr Gardocki <[email protected]>Hello Piotr,
I believe this patch has an (unintended?) side effect.
The early return indev_set_mac_address()makes it so 'dev->addr_assign_type' doesn't get assigned withNET_ADDR_SET, I don't think this is the correct behavior.
Hi Gal,
I checked it, you're right. When the addr_assign_type is PERM or RANDOM and user or some driver sets the same MAC address the type doesn't change to NET_ADDR_SET. In my testing I didn't notice issues with that, but I'm sure there are cases I didn't cover. Did you discover any useful cases that broke after this patch or did you just notice it in code?
The less invasive solution might be to skip only call to ndo_set_mac_address if the address doesn't change, but call everything else - I suppose the notifying mechanism would be required if we change addr_assign_type, right?
The patch set was already in v3 and it's applied to netdev next queue. I'll let maintainers decide how to proceed with it now. I can take care of it, but need to know whether to submit new patch or send v4.
@Jakub Kicinski, could you please take a look at request and give us some guidance?
Re: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 24 lines · Piotr Gardocki
Quoted 14 lines · Gal Pressman
Quoted 13 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.
This patch adds 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>Quoted 8 lines
Quoted 1 line
Signed-off-by Piotr Gardocki <[email protected]>Hello Piotr,
I believe this patch has an (unintended?) side effect.
The early return indev_set_mac_address()makes it so 'dev->addr_assign_type' doesn't get assigned withNET_ADDR_SET, I don't think this is the correct behavior.
Quoted 7 lines
Hi Gal,
I checked it, you're right. When the
addr_assign_typeis PERM or RANDOM and user or some driver sets the same MAC address the type doesn't change toNET_ADDR_SET. In my testing I didn't notice issues with that, but I'm sure there are cases I didn't cover. Did you discover any useful cases that broke after this patch or did you just notice it in code?
This behavior change was caught in our regression tests.
Jakub Kicinski
maintainerRe: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 7 lines · On Tue, 20 Jun 2023 13:42:14 +0300 Gal Pressman wrote:
Quoted 5 lines
I checked it, you're right. When the
addr_assign_typeis PERM or RANDOM and user or some driver sets the same MAC address the type doesn't change toNET_ADDR_SET. In my testing I didn't notice issues with that, but I'm sure there are cases I didn't cover. Did you discover any useful cases that broke after this patch or did you just notice it in code?This behavior change was caught in our regression tests.
Why was the regression test written this way?
I guess we won't flip it back to PERM if user sets a completely different address temporarily and then back to PERM - so for consistency going to SET even when the addr doesn't change may be reasonable.
Piotr, you'll need to send a new followup patch on top of net-next.
Re: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
Quoted 9 lines · Jakub Kicinski
Quoted 7 lines · On Tue, 20 Jun 2023 13:42:14 +0300 Gal Pressman wrote:
Quoted 5 lines
I checked it, you're right. When the
addr_assign_typeis PERM or RANDOM and user or some driver sets the same MAC address the type doesn't change toNET_ADDR_SET. In my testing I didn't notice issues with that, but I'm sure there are cases I didn't cover. Did you discover any useful cases that broke after this patch or did you just notice it in code?This behavior change was caught in our regression tests.
Quoted 7 lines
Why was the regression test written this way?
I guess we won't flip it back to PERM if user sets a completely different address temporarily and then back to PERM - so for consistency going to SET even when the addr doesn't change may be reasonable.
Piotr, you'll need to send a new followup patch on top of net-next.
Thanks, I'll prepare, test and send new patch tomorrow.
Re: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address
In reply to Jakub KicinskiQuoted 10 lines · Jakub Kicinski
Quoted 7 lines · On Tue, 20 Jun 2023 13:42:14 +0300 Gal Pressman wrote:
Quoted 5 lines
I checked it, you're right. When the
addr_assign_typeis PERM or RANDOM and user or some driver sets the same MAC address the type doesn't change toNET_ADDR_SET. In my testing I didn't notice issues with that, but I'm sure there are cases I didn't cover. Did you discover any useful cases that broke after this patch or did you just notice it in code?This behavior change was caught in our regression tests.
Why was the regression test written this way?
This test environment is quite good at detecting state/behavior changes.
The test isn't written in any specific way, AFAIU we hit this patch flow by default when using bonding (bond takes the first slave MAC address and then sets the same address to all slaves?), it's not a test that tries to set the same MAC address explicitly.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 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 v2 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]>
Quoted 24 lines
--- 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
PATCH v2 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 v2 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 23 lines
--- 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
Przemek Kitszel
maintainerRe: [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
In reply to Piotr GardockiQuoted 14 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]>--- drivers/net/ethernet/intel/ice/ice_main.c | 5 ----- 1 file changed, 5 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +0
-0@@ -5624,11 +5624,6 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)if (!is_valid_ether_addr (mac))
drivers/net/ethernet/intel/ice/ice_main.c static int ice_set_mac_address(struct net_device *netdev, void *pi) · line 5629
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-5return -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",
I would expect one patch that adds check in the core, then one patch that removes it in all, incl non-intel, drivers; with CC to their respective maintainers (like Tony for intel, ./scripts/get_maintainer.pl will help)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Przemek Kitszel
maintainerRe: [Intel-wired-lan] [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
Quoted 7 lines · Przemek Kitszel
Quoted 6 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]>---
drivers/net/ethernet/intel/ice/ice_main.c| 5 -----
[...]
Quoted 2 lines
I would expect one patch that adds check in the core, then one patch that removes it in all, incl non-intel, drivers; with CC to their respective maintainers (like Tony for intel,
./scripts/get_maintainer.plwill help)
I have checked, it's almost 200 handlers, which amounts to over 3500 lines of code (short-cutting analysis on eth_hw_addr_set()), what probably could warrant more than one patch/person to spread the work
anybody willing to see the above code-to-look-at, or wants to re-run it for their directory of interests, here is dirty bash script (which just approximates what's to be done, but rather closely to reality):
grep -InrE '\.'ndo_set_mac_address'\s+=' |
awk '!/NULL/ {gsub(/,$/, ""); print $NF}' |
sort -u |
xargs -I% bash -c 'grep -ERwIl %'"'"'\(struct net_device.+\)$'"'"' |
xargs -I @ awk '"'"'/%\(struct net_device.+\)$/,
/^}|eth_hw_addr_set\(/ { print "@:" NR $0 }'"'"' @' |
cat -n
@Piotr, perhaps resolve all intel drivers in your series?
Re: [Intel-wired-lan] [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
On 13.06.2023 17:10, Przemek Kitszel wrote:
[...]
Quoted 7 lines
Quoted 2 lines
I would expect one patch that adds check in the core, then one patch that removes it in all, incl non-intel, drivers; with CC to their respective maintainers (like Tony for intel,
./scripts/get_maintainer.plwill help)I have checked, it's almost 200 handlers, which amounts to over 3500 lines of code (short-cutting analysis on
eth_hw_addr_set()), what probably could warrant more than one patch/person to spread the workanybody willing to see the above code-to-look-at, or wants to re-run it for their directory of interests, here is dirty bash script (which just approximates what's to be done, but rather closely to reality):
Quoted 8 lines
grep -InrE '\.'ndo_set_mac_address'\s+=' |
awk '!/NULL/ {gsub(/,$/, ""); print $NF}' |
sort -u |
xargs -I% bash -c 'grep -ERwIl %'"'"'\(struct net_device.+\)$'"'"' |
xargs -I @ awk '"'"'/%\(struct net_device.+\)$/, /^}|eth_hw_addr_set\(/ { print "@:" NR $0 }'"'"' @' | cat -n@Piotr, perhaps resolve all intel drivers in your series?
Thanks for script, looks impressive :). Someone might really use it to detect all occurrences. As you said there are a lot of callbacks in kernel, so unfortunately I can't fix all of them. I fixed it for drivers/net/ethernet/intel directory, only i40e and ice had these checks. If you want me to check any other intel directory or if I missed something here, please let me know.
Przemek Kitszel
maintainerRe: [Intel-wired-lan] [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
Quoted 18 lines · Piotr Gardocki
On 13.06.2023 17:10, Przemek Kitszel wrote:
[...]Quoted 7 lines
Quoted 2 lines
I would expect one patch that adds check in the core, then one patch that removes it in all, incl non-intel, drivers; with CC to their respective maintainers (like Tony for intel,
./scripts/get_maintainer.plwill help)I have checked, it's almost 200 handlers, which amounts to over 3500 lines of code (short-cutting analysis on
eth_hw_addr_set()), what probably could warrant more than one patch/person to spread the workanybody willing to see the above code-to-look-at, or wants to re-run it for their directory of interests, here is dirty bash script (which just approximates what's to be done, but rather closely to reality):
Quoted 8 lines
grep -InrE '\.'ndo_set_mac_address'\s+=' |
awk '!/NULL/ {gsub(/,$/, ""); print $NF}' |
sort -u |
xargs -I% bash -c 'grep -ERwIl %'"'"'\(struct net_device.+\)$'"'"' |
xargs -I @ awk '"'"'/%\(struct net_device.+\)$/, /^}|eth_hw_addr_set\(/ { print "@:" NR $0 }'"'"' @' |
cat -n@Piotr, perhaps resolve all intel drivers in your series?
Quoted 7 lines
Thanks for script, looks impressive :). Someone might really use it to detect all occurrences. As you said there are a lot of callbacks in kernel, so unfortunately I can't fix all of them. I fixed it for
drivers/net/ethernet/inteldirectory, only i40e and ice had these checks. If you want me to check any other intel directory or if I missed something here, please let me know.
there is ether_addr_equal() call in iavf_set_mac(), even if not exactly before eth_hw_addr_set(), it still should be removed ;)
Anyway, I would fix all 3 drivers with one patch.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
Quoted 27 lines · Przemek Kitszel
Quoted 18 lines · Piotr Gardocki
On 13.06.2023 17:10, Przemek Kitszel wrote:
[...]Quoted 7 lines
Quoted 2 lines
I would expect one patch that adds check in the core, then one patch that removes it in all, incl non-intel, drivers; with CC to their respective maintainers (like Tony for intel,
./scripts/get_maintainer.plwill help)I have checked, it's almost 200 handlers, which amounts to over 3500 lines of code (short-cutting analysis on
eth_hw_addr_set()), what probably could warrant more than one patch/person to spread the workanybody willing to see the above code-to-look-at, or wants to re-run it for their directory of interests, here is dirty bash script (which just approximates what's to be done, but rather closely to reality):
Quoted 8 lines
grep -InrE '\.'ndo_set_mac_address'\s+=' |
awk '!/NULL/ {gsub(/,$/, ""); print $NF}' |
sort -u |
xargs -I% bash -c 'grep -ERwIl %'"'"'\(struct net_device.+\)$'"'"' |
xargs -I @ awk '"'"'/%\(struct net_device.+\)$/, /^}|eth_hw_addr_set\(/ { print "@:" NR $0 }'"'"' @' | cat -n@Piotr, perhaps resolve all intel drivers in your series?
Quoted 7 lines
Thanks for script, looks impressive :). Someone might really use it to detect all occurrences. As you said there are a lot of callbacks in kernel, so unfortunately I can't fix all of them. I fixed it for
drivers/net/ethernet/inteldirectory, only i40e and ice had these checks. If you want me to check any other intel directory or if I missed something here, please let me know.
Quoted 3 lines
there is
ether_addr_equal()call iniavf_set_mac(), even if not exactly beforeeth_hw_addr_set(), it still should be removed ;)Anyway, I would fix all 3 drivers with one patch.
I guess you're looking at old version of dev-queue branch on Tony's tree :) Regarding ice and i40e I made two patches to have different prefixes in titles. I don't mind merging them, but I'll wait for someone else speaking up about this.
Jakub Kicinski
maintainerRe: [Intel-wired-lan] [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC
Quoted 9 lines · On Tue, 13 Jun 2023 17:32:50 +0200 Piotr Gardocki wrote:
Quoted 4 lines
there is
ether_addr_equal()call iniavf_set_mac(), even if not exactly beforeeth_hw_addr_set(), it still should be removed ;)Anyway, I would fix all 3 drivers with one patch.
I guess you're looking at old version of dev-queue branch on Tony's tree :) Regarding ice and i40e I made two patches to have different prefixes in titles. I don't mind merging them, but I'll wait for someone else speaking up about this.
I think the series is good enough, FWIW. We're already at -rc6, seems more important to give syzbot and testers time to exercise the core change than fishing out more drivers.