netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Piotr Gardocki <piotrx.gardocki@intel.com>
Cc: <netdev@vger.kernel.org>, <przemyslaw.kitszel@intel.com>,
	<michal.swiatkowski@linux.intel.com>, <pmenzel@molgen.mpg.de>,
	<kuba@kernel.org>, <anthony.l.nguyen@intel.com>,
	<simon.horman@corigine.com>, <aleksander.lobakin@intel.com>
Subject: Re: [PATCH net-next] net: add check for current MAC address in dev_set_mac_address
Date: Fri, 9 Jun 2023 19:00:11 +0200	[thread overview]
Message-ID: <ZINam0Qlz47WFafH@boxer> (raw)
In-Reply-To: <20230609165241.827338-1-piotrx.gardocki@intel.com>

On Fri, Jun 09, 2023 at 06:52:41PM +0200, Piotr Gardocki wrote:

Hey Piotr,

> 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>
> 
> Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com>
> ---
>  net/core/dev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 99d99b247bc9..c2c3ec61397b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -8820,6 +8820,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
>  		return -EINVAL;
>  	if (!netif_device_present(dev))
>  		return -ENODEV;
> +	if (ether_addr_equal(dev->dev_addr, sa->sa_data))
> +		return 0;

Now this check being in makes calls to ether_addr_equal() within driver's
ndo callbacks redundant.

I would rather see this as patchset send directly to netdev where you have
this patch followed by addressing driver's callbacks.

Moar commitz == moar glory ;)

>  	err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack);
>  	if (err)
>  		return err;
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-06-09 17:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 16:52 [PATCH net-next] net: add check for current MAC address in dev_set_mac_address Piotr Gardocki
2023-06-09 17:00 ` Maciej Fijalkowski [this message]
2023-06-09 17:11   ` Piotr Gardocki
2023-06-10  6:44 ` Jakub Kicinski
2023-06-12 14:49   ` Piotr Gardocki
2023-06-12 15:37     ` Maciej Fijalkowski
2023-06-12 16:43       ` Piotr Gardocki
2023-06-12 17:39         ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZINam0Qlz47WFafH@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=kuba@kernel.org \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=piotrx.gardocki@intel.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=simon.horman@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).