Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp204870img; Wed, 27 Feb 2019 20:24:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ7+uXUeV9nCmF7E/Fl7LZvTshyptFDf3Tu7y7ZJXXLf4Hjw2kLF4nd8N8l/Vv+CfvsGI7g X-Received: by 2002:a65:40c5:: with SMTP id u5mr6416160pgp.275.1551327886697; Wed, 27 Feb 2019 20:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551327886; cv=none; d=google.com; s=arc-20160816; b=KOkes1VjIArOr2jT2dJzCwe+CkopVXB7aJrblHjZFVjY7sygTJJ3go+T8DieVSnPZl KVHLAk6bl/L35XSlJyemV2PkBHfZ7FE0mRIZIALXZtp0NivYmE14NgQ9X1SpjfRba5oe 8eqrAoiRmc+obIkCWOgImISkfiDp1hOF0SH429M0wDgE+wuQTTDK/phz+8X0ZJESqGQw JvKQu/rIrDWrc081bW4bzkmkJxosObGzkCOjBClgVE8y5+FqO9mW7VAx7VZa5O4lJz0h jirtWT1KPoFMsm9c97KRTfQNtLu08V93PAmqV2eqs7RYSq8XJxd4g7ahPulFJRlkjcXf 6J1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=hondb2Ic3gDonFR8/NUO3xcJ7vQ4YJ5I/Ejp68ypJwU=; b=hXe48bKVmKMAavq7N648nPuMystLTPtNzhGgF0I7YGfIdl9odA3F1Rg1uaxa/Husfm D4KpXqc/QaoPFtIa/Vjv7BbHV3VjXDS7hUP7rPjongMb7LMoVXLoOzWf54vlzHKZV31z VecyHHnHvF76nI9ri6vTsd/xhJEu6YgNVmvzuVjiMfIM+GcZfAoE0vIflAFY8rTjCvSS Ux9rUan4EjE7d6QvLRT5CbuPsfWMHy3XnuqeDEWWVlEhan59xrTPPloH9YLS6rab8OcU 8G/B+uZuIqcAhU5Tvd4IVpyvKwcRKofDFXjeOy4nOmsDY5oHmOk92frW4AiHKpTpnWUH 41Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XA/fguBj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g130si15848705pgc.204.2019.02.27.20.24.30; Wed, 27 Feb 2019 20:24:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XA/fguBj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730463AbfB1EYK (ORCPT + 99 others); Wed, 27 Feb 2019 23:24:10 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43220 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727672AbfB1EYK (ORCPT ); Wed, 27 Feb 2019 23:24:10 -0500 Received: by mail-pl1-f193.google.com with SMTP id m10so9069446plt.10; Wed, 27 Feb 2019 20:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hondb2Ic3gDonFR8/NUO3xcJ7vQ4YJ5I/Ejp68ypJwU=; b=XA/fguBjlepNWHzCNeRAsUSys966l5OS//NRnjvm7U7DShRPhMGPzcyhRn09ixrFHO Dk+jhpgvyLvaO88QSl5Eu6b/nJu9J7w4uU5Q7pzAi+FkqfT43la37vxbjHl1M59+b6ve ZcwDgHmOySseLs2fM6u5uCWE68pZf8/HDzMf4GE6EZqhhyOC7wgRGo2nFuLN5mK0Dnyb naXB9RrKUxP0VgUokn8b/yXrdUm2FXKa/d2DGcXyuc+O5YPO8NluxBE7fOEUeCHQ/Nce BmaDbgSlUnMqtfyCZtdjAd2jJpOsQaDGG2mT+YODlbNiGbkfh2vxSojkIh6Q2liRwq2B Kzng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=hondb2Ic3gDonFR8/NUO3xcJ7vQ4YJ5I/Ejp68ypJwU=; b=kXsksG39gEebMfZOWy9zXjiQowN2vbJb7xZXH9Yy/7od2ZbsGs0RKuu+MzFpUYZnPl tJpYHP4vh/R/l9HRozS1i1is/1bmY42Yl0DRDAb2G/UhGNMneIOLJWxfTSOKBTtqwmF0 tzeIpYmwvzSml6DflekG6oC/pSesHhWlSs0aVVbxIDg0btikrXD4bXRGrdIk2a+ZED6w Ckh9bRkvRzB6Dlg5kyPHNJ9htGUVceEQAYRjUk80VMNzIt+9TTcnLdq2EjgVmDzb6Jko 5Hkw3Vb+7mcRrWUfuEAmMyevUGvOWvX49xRHIQnC3CD5fHmB/N4DbURpjUZfnEVM+yuz vGUA== X-Gm-Message-State: AHQUAuYP5xx39Ugl2WGy27t8NTp9ZvHkZmKXPK0utpFebZwYXauWamQm jfNKo6aifVi+e5J3w73dmJs= X-Received: by 2002:a17:902:7686:: with SMTP id m6mr5927778pll.262.1551327849347; Wed, 27 Feb 2019 20:24:09 -0800 (PST) Received: from [10.230.1.150] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id h3sm19550105pgv.38.2019.02.27.20.24.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Feb 2019 20:24:08 -0800 (PST) Subject: Re: [PATCH net-next 1/6] net: core: dev_addr_lists: add VID to device address To: Ivan Khoronzhuk , 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 References: <20190226184556.16082-1-ivan.khoronzhuk@linaro.org> <20190226184556.16082-2-ivan.khoronzhuk@linaro.org> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; keydata= mQENBFPAG8ABCAC3EO02urEwipgbUNJ1r6oI2Vr/+uE389lSEShN2PmL3MVnzhViSAtrYxeT M0Txqn1tOWoIc4QUl6Ggqf5KP6FoRkCrgMMTnUAINsINYXK+3OLe7HjP10h2jDRX4Ajs4Ghs JrZOBru6rH0YrgAhr6O5gG7NE1jhly+EsOa2MpwOiXO4DE/YKZGuVe6Bh87WqmILs9KvnNrQ PcycQnYKTVpqE95d4M824M5cuRB6D1GrYovCsjA9uxo22kPdOoQRAu5gBBn3AdtALFyQj9DQ KQuc39/i/Kt6XLZ/RsBc6qLs+p+JnEuPJngTSfWvzGjpx0nkwCMi4yBb+xk7Hki4kEslABEB AAG0KEZsb3JpYW4gRmFpbmVsbGkgPGZhaW5lbGxpQGJyb2FkY29tLmNvbT6JAccEEAECALEF AlPAG9YXCgABv0jL/n0t8VEFmtDa8j7qERo7AN0gFAAAAAAAFgABa2V5LXVzYWdlLW1hc2tA cGdwLmNvbY4wFIAAAAAAIAAHcHJlZmVycmVkLWVtYWlsLWVuY29kaW5nQHBncC5jb21wZ3Bt aW1lCAsJCAcDAgEKAhkBBReAAAAAGRhsZGFwOi8va2V5cy5icm9hZGNvbS5jb20FGwMAAAAD FgIB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/KmDD9J9N/ b8IehhWQqrBQjMjn2K2XkvN75HnAMHKFYfHZR3ZHtK52ZP1crV7THtbtrnPXVDq+vO4QPmdC +SEACgkQgTG1xCm8ZqC6BwgAl3kRh7oozpjpG8jpO8en5CBtTl3G+OpKJK9qbQyzdCsuJ0K1 qe1wZPZbP/Y+VtmqSgnExBzjStt9drjFBK8liPQZalp2sMlS9S7csSy6cMLF1auZubAZEqpm tpXagbtgR12YOo57Reb83F5KhtwwiWdoTpXRTx/nM0cHtjjrImONhP8OzVMmjem/B68NY++/ qt0F5XTsP2zjd+tRLrFh3W4XEcLt1lhYmNmbJR/l6+vVbWAKDAtcbQ8SL2feqbPWV6VDyVKh ya/EEq0xtf84qEB+4/+IjCdOzDD3kDZJo+JBkDnU3LBXw4WCw3QhOXY+VnhOn2EcREN7qdAK w0j9Sw== Message-ID: <462e8b28-fc15-9321-2144-038a18e37170@gmail.com> Date: Wed, 27 Feb 2019 20:24:00 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.2 MIME-Version: 1.0 In-Reply-To: <20190226184556.16082-2-ivan.khoronzhuk@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/26/2019 10:45 AM, Ivan Khoronzhuk wrote: > Despite this is supposed to be used for Ethernet VLANs, not Ethernet > addresses with space for VID also can reuse this, so VID is considered > as virtual ID extension, not belonging strictly to Ethernet VLAN VIDs, > and overall change can be named individual virtual device filtering > (IVDF). > > This patch adds VID tag at the end of each address. The actual > reserved address size is 32 bytes. For Ethernet addresses with 6 bytes > long that's possible to add tag w/o increasing address size. Thus, > each address for the case has 32 - 6 = 26 bytes to hold additional > info, say VID for virtual device addresses. > > Therefore, when addresses are synced to the address list of parent > device the address list of latter can contain separate addresses for > virtual devices. It allows to track separate address tables for > virtual devices if they present and the device can be placed on > any place of device tree as the address is propagated to to the end > real device thru *_sync()/ndo_set_rx_mode() APIs. Also it simplifies > handling VID addresses at real device when it supports IVDF. > > If parent device doesn't want to have virtual addresses in its address > space the vid_len has to be 0, thus its address space is "shrunk" to > the state as before this patch. For now it's 0 for every device. It > allows two devices with and w/o IVDF to be part of same bond device > for instance. > > The end real device supporting IVDF can retrieve VID tag from an > address and set it for a given virtual device only. By default, vid 0 > is used for real devices to distinguish it from virtual addresses. > > See next patches to see how it's used. > > Signed-off-by: Ivan Khoronzhuk > --- [snip] > @@ -1889,6 +1890,7 @@ struct net_device { > unsigned char perm_addr[MAX_ADDR_LEN]; > unsigned char addr_assign_type; > unsigned char addr_len; > + unsigned char vid_len; Have not compiled or tested this patch series yet, but did you check that adding this member does not change the structure layout (you can use pahole for that purpose). > unsigned short neigh_priv_len; > unsigned short dev_id; > unsigned short dev_port; > @@ -4141,8 +4143,10 @@ int dev_addr_init(struct net_device *dev); > > /* Functions used for unicast addresses handling */ > int dev_uc_add(struct net_device *dev, const unsigned char *addr); > +int dev_vid_uc_add(struct net_device *dev, const unsigned char *addr); > int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); > int dev_uc_del(struct net_device *dev, const unsigned char *addr); > +int dev_vid_uc_del(struct net_device *dev, const unsigned char *addr); > int dev_uc_sync(struct net_device *to, struct net_device *from); > int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); > void dev_uc_unsync(struct net_device *to, struct net_device *from); > diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c > index a6723b306717..e3c80e044b8c 100644 > --- a/net/core/dev_addr_lists.c > +++ b/net/core/dev_addr_lists.c > @@ -545,6 +545,26 @@ int dev_addr_del(struct net_device *dev, const unsigned char *addr, > } > EXPORT_SYMBOL(dev_addr_del); > > +static int get_addr_len(struct net_device *dev) > +{ > + return dev->addr_len + dev->vid_len; > +} > + > +static int set_vid_addr(struct net_device *dev, const unsigned char *addr, > + unsigned char *naddr) Having some kernel doc comments here would be nice to indicate that the return value is dev->addr_len, it was not obvious until I saw in the next function how you used it. > +{ > + int i; > + > + if (!dev->vid_len) > + return dev->addr_len; > + > + memcpy(naddr, addr, dev->addr_len); > + for (i = 0; i < dev->vid_len; i++) > + naddr[dev->addr_len + i] = 0; memset(naddr + dev->addr_len, 0, dev->vid_len) would be more compact and maybe a little less error prone too? -- Florian