From: Ding Tianhong <dingtianhong@huawei•com>
To: Toshiaki Makita <makita.toshiaki@lab•ntt.co.jp>,
<kaber@trash•net>, <davem@davemloft•net>, <edumazet@google•com>,
<vyasevic@redhat•com>
Cc: <netdev@vger•kernel.org>
Subject: Re: [PATCH net-next 2/4] net: dev: don't set the same mac address for netdev
Date: Thu, 5 Jun 2014 17:50:18 +0800 [thread overview]
Message-ID: <53903D5A.7050702@huawei.com> (raw)
In-Reply-To: <539033BC.3000703@lab.ntt.co.jp>
On 2014/6/5 17:09, Toshiaki Makita wrote:
> (2014/06/05 15:50), Ding Tianhong wrote:
>> Most of netdev just like bond, team, vlan will set the mac address
>> and propagate to the upperdev or lowerdev regardless the mac address
>> is same or not, I could not find that the same mac address could
>> make affect, so add equal check when set mac address.
>>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei•com>
>> ---
>> net/core/dev.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 5367bfb..4008a51 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -5570,6 +5570,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_64bits(dev->dev_addr, sa->sa_data))
>> + return 0;
>> err = ops->ndo_set_mac_address(dev, sa);
>> if (err)
>> return err;
>>
>
> Bridge uses addr_assign_type to check if bridge_id can be propageted by
> bridge ports. If user set mac address, and even if it is the same as
> current one, bridge uses the fact that the mac address is set by user.
>
OK
> Although I'm not aware of a driver that needs calling of
> ndo_set_mac_address() for the same mac address, this change looks a bit
> risky to me.
> (For example, old bridge code needed this call because it managed
> BR_SET_MAC_ADDR in bridge flags.)
>
Except the old bridge, I still don't think any other driver need to call ndo_set_mac_address()
for the same mac address, if the dev_set_mac_address() don't do anything for the same address,
I think some drivers should ignore the same mac address themselves just like bonding, macvlan, vlan and so on.
Ding
> Thanks,
> Toshiaki Makita
>
next prev parent reply other threads:[~2014-06-05 9:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 6:50 [PATCH net-next 0/4] macvlan: fix some problem if mac address changes Ding Tianhong
2014-06-05 6:50 ` [PATCH net-next 1/4] macvlan: don't update the uc and vlan list for L2 forwarding offload Ding Tianhong
2014-06-05 13:52 ` Vlad Yasevich
2014-06-05 14:12 ` John Fastabend
2014-06-05 6:50 ` [PATCH net-next 2/4] net: dev: don't set the same mac address for netdev Ding Tianhong
2014-06-05 9:09 ` Toshiaki Makita
2014-06-05 9:50 ` Ding Tianhong [this message]
2014-06-05 10:51 ` Toshiaki Makita
2014-06-05 11:42 ` Ding Tianhong
2014-06-05 14:06 ` Vlad Yasevich
2014-06-06 3:54 ` Ding Tianhong
2014-06-06 14:09 ` Vlad Yasevich
2014-06-07 5:53 ` Ding Tianhong
2014-06-05 6:50 ` [PATCH net-next 3/4] net: dev: revert the mac address when notifier failed Ding Tianhong
2014-06-05 6:50 ` [PATCH net-next 4/4] macvlan: don't set the same mac address for non-passthru mode Ding Tianhong
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=53903D5A.7050702@huawei.com \
--to=dingtianhong@huawei$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=kaber@trash$(echo .)net \
--cc=makita.toshiaki@lab$(echo .)ntt.co.jp \
--cc=netdev@vger$(echo .)kernel.org \
--cc=vyasevic@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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