From: "Bjørn Mork" <bjorn@mork•no>
To: David Miller <davem@davemloft•net>
Cc: stephen@networkplumber•org, netdev@vger•kernel.org
Subject: Re: [PATCH net-next 01/10] net: etherdevice: add address inherit helper
Date: Wed, 28 Aug 2013 09:17:00 +0200 [thread overview]
Message-ID: <874naa2sk3.fsf@nemi.mork.no> (raw)
In-Reply-To: <20130827.143501.1692335946060457637.davem@davemloft.net> (David Miller's message of "Tue, 27 Aug 2013 14:35:01 -0400 (EDT)")
David Miller <davem@davemloft•net> writes:
> From: Bjørn Mork <bjorn@mork•no>
> Date: Sat, 24 Aug 2013 00:28:55 +0200
>
>> Stephen Hemminger <stephen@networkplumber•org> writes:
>>> On Fri, 23 Aug 2013 11:35:04 +0200
>>> Bjørn Mork <bjorn@mork•no> wrote:
>>>
>>>> /**
>>>> + * eth_hw_addr_inherit - Copy dev_addr from another net_device
>>>> + * @dst: pointer to net_device to copy dev_addr to
>>>> + * @src: pointer to net_device to copy dev_addr from
>>>> + *
>>>> + * Copy the Ethernet address from one net_device to another along with
>>>> + * the addr_assign_type.
>>>> + */
>>>> +static inline int eth_hw_addr_inherit(struct net_device *dst,
>>>> + struct net_device *src)
>>>> +{
>>>> + if (dst->addr_len != src->addr_len)
>>>> + return -EINVAL;
>>>> +
>>>> + dst->addr_assign_type = src->addr_assign_type;
>>>> + memcpy(dst->dev_addr, src->dev_addr, dst->addr_len);
>>>> + return 0;
>>>> +}
>>>> +
>>>
>>> Since all the other code in this file assumes addr_len == ETH_ALEN
>>> why does this code need to handle variable addresses. Trivial but
>>> then the memcpy is fixed size and can be optimized.
>>
>> Didn't know that. I'll make that change in the next version. Not that
>> optimization matters much here, but consistency is always good.
>
> You can bug check that addr_len ETH_ALEN if you want.
I don't think that is necessary.
> I realize that some drivers don't initialize it by this call point but
> that is arguably a bug.
Yes. But I don't believe another test is going to make those drivers
work, so it's better to just drop it.
Bjørn
next prev parent reply other threads:[~2013-08-28 7:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 9:35 [PATCH net-next 00/10] set addr_assign_type when inheriting a dev_addr Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 01/10] net: etherdevice: add address inherit helper Bjørn Mork
2013-08-23 19:24 ` Stephen Hemminger
2013-08-23 22:28 ` Bjørn Mork
2013-08-27 18:35 ` David Miller
2013-08-28 7:17 ` Bjørn Mork [this message]
2013-08-23 9:35 ` [PATCH net-next 02/10] net: vlan: inherit addr_assign_type along with dev_addr Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 03/10] net: dsa: " Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 04/10] net: macvlan: " Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 05/10] net: team: " Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 06/10] net: airo: " Bjørn Mork
[not found] ` <1377250513-3662-7-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-08-23 14:53 ` John W. Linville
2013-08-23 9:35 ` [PATCH net-next 07/10] net: hostap: " Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 08/10] net: libertas: " Bjørn Mork
2013-08-23 14:52 ` John W. Linville
2013-08-23 9:35 ` [PATCH net-next 09/10] staging: vt6655: " Bjørn Mork
2013-08-23 9:35 ` [PATCH net-next 10/10] staging: vt6656: " Bjørn Mork
2013-08-23 10:03 ` Dan Carpenter
2013-08-23 10:48 ` Bjørn Mork
2013-08-23 11:15 ` Dan Carpenter
2013-08-23 12:06 ` Bjørn Mork
2013-08-23 12:09 ` Dan Carpenter
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=874naa2sk3.fsf@nemi.mork.no \
--to=bjorn@mork$(echo .)no \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=stephen@networkplumber$(echo .)org \
/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