netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>,
	davem@davemloft.net, grygorii.strashko@ti.com
Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, jiri@mellanox.com,
	ilias.apalodimas@linaro.org
Subject: Re: [PATCH net-next 2/6] net: 8021q: vlan_dev: add vid tag to addresses of uc and mc lists
Date: Wed, 27 Feb 2019 20:09:44 -0800	[thread overview]
Message-ID: <72ecf925-f818-3d6b-4f96-b01daabd21f2@gmail.com> (raw)
In-Reply-To: <20190226184556.16082-3-ivan.khoronzhuk@linaro.org>



On 2/26/2019 10:45 AM, Ivan Khoronzhuk wrote:
> Update vlan mc and uc addresses with VID tag while propagating
> addresses to lower devices, do this only if address is not synced.
> It allows at end driver level to distinguish addresses belonging
> to vlan devices.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---

[snip]

>  
> +u16 vlan_dev_get_addr_vid(struct net_device *dev, const u8 *addr)

Having some kernel doc comment here would also be nice.

> +{
> +	u16 vid = 0;
> +
> +	if (dev->vid_len != NET_8021Q_VID_TSIZE)
> +		return vid;
> +
> +	vid = addr[dev->addr_len];
> +	vid |= (addr[dev->addr_len + 1] & 0xf) << 8;

This uses knowledge of the maximum VLAN ID is 4095, which is fine, might
be a good idea to add a check on VID not exceeding the maximum VLAN ID
number instead of doing a silent truncation?

[snip]

> +static void vlan_dev_align_addr_vid(struct net_device *vlan_dev)
> +{
> +	struct net_device *real_dev = vlan_dev_real_dev(vlan_dev);
> +	struct netdev_hw_addr *ha;
> +
> +	if (!real_dev->vid_len)
> +		return;

Should not this check be moved to dev_{mc,uc}_sync? It does not seem to
me like this would scale really well across different stacked devices
(VLAN, bond, macvlan) as well as underlying drivers (cpsw, dsa, etc.).
Or maybe the check should be if vlan_dev->vid_len > real_dev->vid_len ->
error, right?
-- 
Florian

  reply	other threads:[~2019-02-28  4:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 18:45 [PATCH net-next 0/6] net: add individual virtual device filtering Ivan Khoronzhuk
2019-02-26 18:45 ` [PATCH net-next 1/6] net: core: dev_addr_lists: add VID to device address Ivan Khoronzhuk
2019-02-28  4:24   ` Florian Fainelli
2019-03-01 12:21     ` Ivan Khoronzhuk
2019-02-26 18:45 ` [PATCH net-next 2/6] net: 8021q: vlan_dev: add vid tag to addresses of uc and mc lists Ivan Khoronzhuk
2019-02-28  4:09   ` Florian Fainelli [this message]
2019-03-01 12:24     ` Ivan Khoronzhuk
2019-03-02  3:19       ` Florian Fainelli
2019-02-26 18:45 ` [PATCH net-next 3/6] net: 8021q: vlan_dev: add vid tag for vlan device own address Ivan Khoronzhuk
2019-02-28  4:13   ` Florian Fainelli
2019-03-01 12:28     ` Ivan Khoronzhuk
2019-03-02  3:24       ` Florian Fainelli
2019-02-26 18:45 ` [PATCH net-next 4/6] ethernet: eth: add default vid len for all ehternet kind devices Ivan Khoronzhuk
2019-02-28  4:29   ` Florian Fainelli
2019-03-01 13:11     ` Ivan Khoronzhuk
2019-03-02  3:33       ` Florian Fainelli
2019-02-26 18:45 ` [PATCH net-next 5/6] net: ethernet: ti: cpsw: update mc filtering to use IVDF Ivan Khoronzhuk
2019-02-28  4:17   ` Florian Fainelli
2019-02-26 18:45 ` [PATCH net-next 6/6] net: ethernet: ti: cpsw: add macvlan and ucast/vlan filtering support Ivan Khoronzhuk
2019-02-28  0:23 ` [PATCH net-next 0/6] net: add individual virtual device filtering Florian Fainelli

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=72ecf925-f818-3d6b-4f96-b01daabd21f2@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --cc=grygorii.strashko@ti.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=ivan.khoronzhuk@linaro.org \
    --cc=jiri@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).