Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7444570imm; Tue, 28 Aug 2018 12:10:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYKtK4mNv4Fo5tCaE8a43hjUAt5cbhj3cyZBUbj1rjnB9SuRs8wWhlfLR4zBfBs1m58xXLg X-Received: by 2002:a63:f966:: with SMTP id q38-v6mr2635152pgk.213.1535483413703; Tue, 28 Aug 2018 12:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535483413; cv=none; d=google.com; s=arc-20160816; b=beVuWCY22lfKMdLRQ+665Ioe9e5wn9hi0MGVzMgnkyG9H33nwoy8PiroraP1pA3bSa XPCzhFz4R19QRe6Y8AY1gWAre46laz+g8qrqjBF6FWgy4tQ2Om8xjbSMM+ktj29f2+/m GvcdIRpRvS0mPiYVRvu3b4324SfluWDxxLxxBXnxx2wcHPeKpNfOdHhGpQ0yB55aaLRA l5JRIo4pu8WW7y9Kyd1CjwgyNBYXsIAbsfUdSyRHs9GJ9zyJwybiu7ws2mpaqaeZ5vH8 FuQ6HUFZk+cV7BI2qZhcHB7cfyFOa4c+ohLtuUi7/fVlbJl1E+loWAtqFehkMv3/Me4G d3Xg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=BSxVBb4fQeQXpE5T1xguoNWDwc6IZBEWA58+ov3Lm9A=; b=Z76m3efH/CTkyP13DWcaUbaNmbF6MaGWhYEyTHUOLAT/K+2MhyxZQb5IOJewOy1s/+ Oz6oM9B1Kg9JTHxkdUC44cvhRA+93A4TS/TlTTKWy+uaShNJ/ROiFH7WXYWiqerQiOZq LLdyiDLUwsSuw3/Vn6zOF903FdGDW6N1/zr4aP0RH6+hRAH1UCDqTi3L6ccQeqLPBrfB u+k8Lz9KxRFrW27kjP9OPA3rsXimsu2/HWQinbL2mAg0Jc0oxgURPSHobhppSoKWK4PT diD+UQQCjtboH/UV+75KnoBwJ1SRNn4j7Dr3U7gLtocnGVpGksBwldl6RJ7OB2rLbgBR O1jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=badwPffR; 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 u10-v6si1537617plr.58.2018.08.28.12.09.58; Tue, 28 Aug 2018 12:10:13 -0700 (PDT) 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=badwPffR; 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 S1727247AbeH1XBw (ORCPT + 99 others); Tue, 28 Aug 2018 19:01:52 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33968 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726807AbeH1XBw (ORCPT ); Tue, 28 Aug 2018 19:01:52 -0400 Received: by mail-oi0-f67.google.com with SMTP id 13-v6so4856300ois.1; Tue, 28 Aug 2018 12:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BSxVBb4fQeQXpE5T1xguoNWDwc6IZBEWA58+ov3Lm9A=; b=badwPffRDgVHAuV1z3+BAzqMnHrixT3TbyOk0hrUioVP+ftLy5JU8zx5vK402wtC6D sauR9IGJaOetRYzKho3+ykRiFWvq4wXsEv15varJN8RoqAFhRmjh8vPHthbQM3tRmU7p F9HATT1OoEUeF/FNaLtl6fELKC8pRybt0isQKrkuktQZHSE4GBb6E59eHY6xr9IBxKjs oOSnLk442OHT06gFkG/dhG/KdnMBKeevBcBH+LLnc3uzrVApK/gZ7uR5dMAGYSYxVMQo lKObPjozYxNxIPLBM7G2KPm18H2ZP2YEIkpAMiVABOP48nTFmc2iV+jIwcqzOvMuWeaa lV5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BSxVBb4fQeQXpE5T1xguoNWDwc6IZBEWA58+ov3Lm9A=; b=tjf2pMq8xOHmuL6J4Mlz5r3ODnT1oHzD1ygKXkJ58J6jg513fLxVwAkLsDhga9Q8eF 4dAicjitc0i7HgtPaLvD8LBQ6yOWwfJ1NIJc+i+IhtHjZM0OgUGqQcs2o4zXnWhJNzFz bgwVpHrFGLshGGKSTeo4HsEBYOkY0W5U58qtJIOPKKFhweTtR00j5yddf4O29ygznkON KE8z03SdGSz3G5tRtvEiT8QQ9FfEABuZEC3QydFS01H9KNkLPnq7wQz2L0pU9dg0NBGT f6hG6dyBYC75pNrZcyUJsZ+xB9oQ6ht/FtAvTAN+4hBZf574wZWveSI/VKj4PS4Ut+eh XQTw== X-Gm-Message-State: APzg51AdIiWBqEddFzDrEqLMZaY+oQ15SKbRSAZdQdBzZcRuSpA7KWbh x1oUpwiGEHpikq3ffZUSV2jqU8MMjOoLoWcI+no= X-Received: by 2002:aca:d9c5:: with SMTP id q188-v6mr2401189oig.239.1535483330631; Tue, 28 Aug 2018 12:08:50 -0700 (PDT) MIME-Version: 1.0 References: <20180624153339.13572-1-f.fainelli@gmail.com> <20180625091713.GA13442@apalos> <9ce291a4-b40d-81d8-1c1a-c4311e5cc113@gmail.com> <20180828083257.GA10872@apalos> In-Reply-To: From: Maxim Uvarov Date: Tue, 28 Aug 2018 22:08:38 +0300 Message-ID: Subject: Re: [PATCH RFT] net: dsa: Allow configuring CPU port VLANs To: Florian Fainelli Cc: Ilias Apalodimas , petrm@mellanox.com, netdev , jiri@mellanox.com, Andrew Lunn , Vivien Didelot , David Miller , kernel list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =D0=B2=D1=82, 28 =D0=B0=D0=B2=D0=B3. 2018 =D0=B3. =D0=B2 20:00, Florian Fai= nelli : > > On 08/28/2018 01:32 AM, Ilias Apalodimas wrote: > > On Fri, Aug 10, 2018 at 04:58:10PM -0700, Florian Fainelli wrote: > >> On 06/25/2018 02:17 AM, Ilias Apalodimas wrote: > >>> On Mon, Jun 25, 2018 at 12:13:10PM +0300, Petr Machata wrote: > >>>> Florian Fainelli writes: > >>>> > >>>>> if (netif_is_bridge_master(vlan->obj.orig_dev)) > >>>>> - return -EOPNOTSUPP; > >>>>> + info.port =3D dp->cpu_dp->index; > >>>> > >>>> The condition above will trigger also when a VLAN is added on a memb= er > >>>> port, and there's no other port with that VLAN. In that case the VLA= N > >>>> comes without the BRIDGE_VLAN_INFO_BRENTRY flag. In mlxsw we have th= is > >>>> to get the bridge VLANs: > >>>> > >>>> if (netif_is_bridge_master(orig_dev)) { > >>>> [...] > >>>> if ((vlan->flags & BRIDGE_VLAN_INFO_BRENTRY) && > >>>> [...] > >>>> > >>>> This doesn't appear to be done in DSA unless I'm missing something. > >>> Petr's right. This will trigger for VLANs added on 'not cpu ports' if= the VLAN > >>> is not already a member. > >>> > >>> This command has BRIDGE_VLAN_INFO_BRENTRY set: > >>> bridge vlan add dev br0 vid 100 pvid untagged self > >>> I had the same issue on my CPSW RFC and solved it > >>> exactly the same was as Petr suggested. > >> > >> Humm, there must be something obvious I am missing, but the following > >> don't exactly result in what I would expect after adding a check for > >> vlan->flags & BRIDGE_VLAN_INFO_BRENTRY: > >> > >> brctl addbr br0 > >> echo 1 > /sys/class/net/br0/bridge/vlan_filtering > >> brctl addif br0 lan1 > >> > >> #1 results in lan1 being programmed with VID 1, PVID, untagged, but no= t > >> the CPU port. I would have sort of expected that the bridge layer woul= d > >> also push the configuration to br0/CPU port since this is the default = VLAN: > >> > >> bridge vlan show dev br0 > >> port vlan ids > >> br0 1 PVID Egress Untagged > >> > >> But it does not. > >> > >> bridge vlan add vid 2 dev lan1 > >> > >> #2 same thing, results in only lan1 being programmed with VID 2, tagge= d > >> but that is expected because we are creating the VLAN only for the > >> user-facing port. > >> > >> bridge vlan add vid 3 dev br0 self > >> > >> #3 results in the CPU port being programmed with VID 3, tagged, again, > >> this is expected because we are only programming the bridge master/CPU > >> port here. > >> > >> Does #1 also happen for cpsw and mlxsw or do you actually get events > >> about the bridge's default VLAN configuration? Or does the switch driv= er > >> actually need to obtain that at the time the port is enslaved somehow? > > As long as ports are attached you get the events (one event per attache= d port > > iirc) > > if the event is checked against BRIDGE_VLAN_INFO_BRENTRY, the only way = to add a > > VLAN to the cpu port is via 'bridge vlan add vid 3 dev br0 self' > > Do we have a guarantee that upon port enslavement, whatever default_pvid > is configured on the bridge master device also happens to be the port's > default_pvid settings as well? I think default pvid is per port thing. I.e. each port can have it's own pvid (i.e. it will tag with vlan id not tagged incoming packet to that port), I did not exactly understand use case. With adding vlan filtering to cpu port you filter out packets from other vlan groups to cpu port. This might be useful only for multicast packes or missing fbd entry on some dsa port. Is filtering multicast a main problem to solve here? Linux is missing vlan ingress policy. I.e. filtering (echo 1 > /sys/br0/vlan_filter) has to be case of 3 policies: secure (default now), check and fallback. With current secure mode it might work, but with check mode it will be needed to add all vlans to cpu port. Btw, on some hardware vlan ingress policies are also per port, not per bridge. Best regards, Maxim. > -- > Florian --=20 Best regards, Maxim Uvarov