Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp919895imb; Fri, 1 Mar 2019 19:20:38 -0800 (PST) X-Google-Smtp-Source: APXvYqzm2dZykxGgjXJsNAkWtTumQHXVfjx1DV6NhvSlUZ62nu0SxwSzM7JIaGnnr+Lu+aLWiHTK X-Received: by 2002:aa7:918b:: with SMTP id x11mr9396523pfa.228.1551496837983; Fri, 01 Mar 2019 19:20:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551496837; cv=none; d=google.com; s=arc-20160816; b=XWBrtVk0pqoygHy7FhGihEelLKvwvZHySxAWj3o7rGAP0U1kPtelSi+1P9x3msHbxy ViSYJ912cQImWIARQss51Fl2EG9OpVbaCV91a8BNA7m3yCLdMbSOErmuJENdY16fqH1o 84yR4qdO/Op3CGAZDpLoTbmi6sCVZWs9Xq39ENCznbSwV5kcpdvtShszzc3dGma1yZyQ RYHjza7vGn1vJ37uGRK3fFSJ4mzXfAbiv06WMa7qGVy10r69IBOyxJKaKElu8EQW++Mq XrA54Aoy53XKerwg4zcV5ojBHyDc3k70Xm+zPJuo8qx2oHGK9wnscNkYj1ZujRvEL32x kC5A== 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:to:subject :dkim-signature; bh=R8mlpSPGD/WOluqVKoUAMbg7xYny1QOi9BjF5XMYnRY=; b=tfdHlEaa2Pk+wsVifgp8vL19oQKQ43OePkD1+W6kkD7SA7QwBPsNr/mK+SrecVfe+Q NOCjt26xMYP5vg+2wWdU7Feb8C1RgdPw+ToIxx6nTzwhO1jvCcZ5rSKjNeppPgP+V4yo 3VHb3f8b141vOYVj3thcucWDnbvWioJz6evoBXhH0EVNdmOZQOTrxr/EwctYFk7AhQ3M IvyJFJG25wAg9canwi+v5yylpV0yQRuxn98wdPtuPQ4Q5Y7DEfulmk0PtoU/8PhhcD5I h1brPCD5O4dqVFG9hH8VsEGdF04rtVyttt+7BQabdV+p6V3TjOjd164mclhyp4cFcLPc rfMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HyvumV8G; 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 w62si17458880pgd.330.2019.03.01.19.20.21; Fri, 01 Mar 2019 19:20:37 -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=HyvumV8G; 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 S1727739AbfCBDUC (ORCPT + 99 others); Fri, 1 Mar 2019 22:20:02 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42507 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfCBDUC (ORCPT ); Fri, 1 Mar 2019 22:20:02 -0500 Received: by mail-ed1-f66.google.com with SMTP id j89so21677702edb.9; Fri, 01 Mar 2019 19:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=R8mlpSPGD/WOluqVKoUAMbg7xYny1QOi9BjF5XMYnRY=; b=HyvumV8GOWZg7Wr0AB/1OBXO0RGMEAlPF3RlqyUyJGncKToZUEzKuT0/ZxNFT35/98 wTqK6VqmZr0Y6g5z7QQSuv2OcIwFrlWaQoOyTSRsGABGffW1Ib8pW9GAzUmoEOJnwMlW oeVmfKpsy4vRD827VTfc5Lo7S3QefDPCBcrlRraH6UBrxrYLwWYJ+4qc99Ja7EogX2K5 EBKUFrS0ly59xLWC9vYACXlVrAX4+mOUsQgwjzWpxa9+RJjwYeQ3ffQaJLPna45BOJGq P6HEPoAVk1Ax2k4YwBcvjCoUIACf5TXi3EL0M1fRwmF/Ku8uRGxJNqIE/QTetdQ9ME5b qhxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=R8mlpSPGD/WOluqVKoUAMbg7xYny1QOi9BjF5XMYnRY=; b=ll7AKbX3Iyl1XdMXAsD8ynnpV5wtCemSPNVYYbdfepGRwXV4JPNno4IKxCmS7TD5KA bEdBCV7u+sKRfM3+kLqdKNFK8TZdQ0t3h3d6+1aWdi5MQtcLRJwhYJl5veMgaKJLqY5u TGuuCTo2fw+56CC+810MZktP0u4UeryQWlulsk2qES6NEnfEvTp3bIAPithQhracq7kc sl8opgkgj/Rf4k+jz/CZvKESTI4omquHcuREP7H8yXZVQzubrxOsn6+kFz45H5f9xvWO nAfWZWyd+YW8GpWOKCqOPLTUTQZO6bv6lMgPYV+C78D+bGuMkRI8TXx7YSbejfKjZtPD ADcQ== X-Gm-Message-State: APjAAAW9HFEA+Fdi7AWF1yDOv8uRTQiAztmIENj8sZP8RpxBpGxJsNxA fFNYZs3OBJJiNpyrTFqG+24= X-Received: by 2002:a05:6402:1205:: with SMTP id c5mr6808211edw.19.1551496799325; Fri, 01 Mar 2019 19:19:59 -0800 (PST) Received: from [10.230.26.115] ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id e21sm6381538edb.27.2019.03.01.19.19.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Mar 2019 19:19:58 -0800 (PST) Subject: Re: [PATCH net-next 2/6] net: 8021q: vlan_dev: add vid tag to addresses of uc and mc lists To: davem@davemloft.net, grygorii.strashko@ti.com, 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-3-ivan.khoronzhuk@linaro.org> <72ecf925-f818-3d6b-4f96-b01daabd21f2@gmail.com> <20190301122417.GB4851@khorivan> 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 aW1lCAsJCAcDAgEKAhkBBReAAAAAGRhsZGFwOi8va2V5cy5icm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c2S31lAupzfCw8lmZsP1PRz1GmF/KmDD9J9N/ b8IehhWQqrBQjMjn2K2XkvN75HnAMHKFYfHZR3ZHtK52ZP1crV7THtbtrnPXVDq+vO4QPmdC +SEACgkQgTG1xCm8ZqC6BwgAl3kRh7oozpjpG8jpO8en5CBtTl3G+OpKJK9qbQyzdCsuJ0K1 qe1wZPZbP/Y+VtmqSgnExBzjStt9drjFBK8liPQZalp2sMlS9S7csSy6cMLF1auZubAZEqpm tpXagbtgR12YOo57Reb83F5KhtwwiWdoTpXRTx/nM0cHtjjrImONhP8OzVMmjem/B68NY++/ qt0F5XTsP2zjd+tRLrFh3W4XEcLt1lhYmNmbJR/l6+vVbWAKDAtcbQ8SL2feqbPWV6VDyVKh ya/EEq0xtf84qEB+4/+IjCdOzDD3kDZJo+JBkDnU3LBXw4WCw3QhOXY+VnhOn2EcREN7qdAK w0j9Sw== Message-ID: <3b3dcc51-39d9-0f23-ab5a-6d0375593c79@gmail.com> Date: Fri, 1 Mar 2019 19:19:50 -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: <20190301122417.GB4851@khorivan> 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 3/1/2019 4:24 AM, Ivan Khoronzhuk wrote: > On Wed, Feb 27, 2019 at 08:09:44PM -0800, Florian Fainelli wrote: >> >> >> 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 >>> --- >> >> [snip] >> >>> >>> +u16 vlan_dev_get_addr_vid(struct net_device *dev, const u8 *addr) >> >> Having some kernel doc comment here would also be nice. > > yes can be: vlan_dev_get_addr_vid - get vlan id the address belongs to > > >> >>> +{ >>> +    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? > > and then return -1, not sure, just because it's 0 or directly set by vlan > layer and is verified anyway. But no harm to verify even it looks like > redundancy. I would have thought that there would be an existing helper function to put/get a VLAN identifier into/from two bytes but that is fine as-is. > >> >> [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? > > It shouldn't be part of netdev addr module, no any > vlan_dev_vlan_id(vlan_dev) > should be there. > > It's scaled becouse bond/team ...etc, are ethernet devices and have IVDF > enabled while configuration. Address propagation always is from leafs to > real root device, every underneeth device knows nothing about above, so > check is only in one direction. > OK, indeed stacked devices would lead to that, thanks for explaining! -- Florian