Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6497756ybv; Wed, 12 Feb 2020 13:28:52 -0800 (PST) X-Google-Smtp-Source: APXvYqx+FJAmCOVeb5d9B21i/DQM8KK6dmniO2WSHNqAeayvZxqpNxNuz9uGTk7HY7FkAvnCgGEm X-Received: by 2002:a05:6830:114f:: with SMTP id x15mr10519723otq.291.1581542932639; Wed, 12 Feb 2020 13:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581542932; cv=none; d=google.com; s=arc-20160816; b=LnDkmTX3K5gQMjl1+IcG8mo9TfpfiBzC/zeCd0+68zUyaHhuIbKFDqGRJEmaByw64t e7ihF7QzrMo1x46w9fdkjmHVtGBN4DJdjU0xBIob//VToFg63b01iVqFZ3QvW6akjIj0 eqKDl+667NcsO1kL+y0EyMrrK/SOkpl4ZfvV0Wk6M/dMbaunct7QlUKrvIX0EQzYBf7O VFEWHGpe1J0M74Ffdw+i9pQ3C7wzqizeZxJt0fojmS9Otfz2+IfCEBQbyztB4fV53U1F blyZIk8RNr18whPly5bORx/30TXOdN6jxnYldoNpMqf/4KCNRAtA+455g5uzRiwXny8Z Qaqg== 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:from:references:cc:to:subject:dkim-signature; bh=zA+YU8ReUi/0ae6CAaxfuHRSGLgBv7ovkCkn/iNPxhk=; b=WsJX5x9zqTUP824ScIQ6vqt6MwJORXfiITfWzJUWFKzA581QCsBHTrpfxu/DFHMP1K uHCwi2CqV+WbdviFrmtCqJ1IHxvdNkZ2rJvvbtO2ohaGRLCjtL/0I9B3mZ55xGTUgjKh bOuHh8SHzggxPb31xERl+chpEcftzTlo2ExEjwhCKAo/DfE1+SmUOi7k2DXR9tq4llBS PDfYY/lWrxLB3Oq9Tb8wXPZUDlAqWkuCn+5CNkoVILtMVjIu55Z2BzgRWurnpB0b6LOl QCNB/FIv9vxfa3wbebVHYmjEu4gUcPJpnZphmKCS/aWG5bbOZ3E9FQ9iVmm9AQf3rARz L0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bUqvP+q7; 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 l21si23148otk.142.2020.02.12.13.28.39; Wed, 12 Feb 2020 13:28:52 -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=bUqvP+q7; 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 S1728977AbgBLV2d (ORCPT + 99 others); Wed, 12 Feb 2020 16:28:33 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42567 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbgBLV2c (ORCPT ); Wed, 12 Feb 2020 16:28:32 -0500 Received: by mail-ed1-f66.google.com with SMTP id e10so4121917edv.9; Wed, 12 Feb 2020 13:28:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zA+YU8ReUi/0ae6CAaxfuHRSGLgBv7ovkCkn/iNPxhk=; b=bUqvP+q735g2EZjRvjKosa+gPsciGyFK/4/a4/uFXxYp6YZcu6lU8zAx1UDzAOmGOy COmV5v71fGmEWgMXtvoMBU0llOWUtqQmOX/Fu4EQYO+2X+ib05iPuS4vO21/BX8swWq0 IEkF4tU2ml6QMjQb3YhZaHakCtRLCeE4qTCdlR/oFmxvKBExMQ0uzhsKEvSVPgfaRu3x umiBuovJy6SeY40a/nQgzcufmkdpb3Xy02cYdrhbiEJGl/PmS0PvJOaDW3HQbRvT640L p4UrHzB9rihKxWOrjVnHby0sLkdzl3dzXg4CtH/R2UdQlDdKeH73Z0zwT+LLavK52gaU hNHw== 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:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=zA+YU8ReUi/0ae6CAaxfuHRSGLgBv7ovkCkn/iNPxhk=; b=gwZYgr/jKKF07sZsC85AughwehMfnAsUigz0tqWOwbrJZXYFemVvmoY9m/PnDvXeda 6aBNiUd2SdusEzAGP8rX/eecUB8UhFmtRnFDTJVqRPhDWcSr7L/nVONZ8muQEj62WCx+ xrys7PzgA3W393SCJbmMrR2Q668+yqOB+793PcBigHTfSkOwv5ZHt0BBL4pZcycEhWNM fbUxT9F5KTs5S5z5McpWhG13Yb5No9rG4FqPAv2WgThEav0OfEuNiuHn4/ZJlo6rHfFf iURJEWZNheYLZ5L8o/QfrTOIhpgGKKR5EhIw71PZSPu9Y7sYRobzXl2st8V09AbYgNDi 8Aeg== X-Gm-Message-State: APjAAAXICQjVtGt8nHWy9hDGY9yEEjenhzUB7y8aSuCwW6eL6jNJdDHH fYLzy55zK/sQbc8BSRb2QsiIALiy X-Received: by 2002:a50:cfc1:: with SMTP id i1mr12607102edk.369.1581542909672; Wed, 12 Feb 2020 13:28:29 -0800 (PST) Received: from [10.67.50.49] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id l11sm33520edi.28.2020.02.12.13.28.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 13:28:29 -0800 (PST) Subject: Re: [PATCH net] net: dsa: Treat VLAN ID 0 as PVID untagged To: Vladimir Oltean Cc: netdev , Heiner Kallweit , michal.vokac@ysoft.com, Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , open list References: <20200212200555.2393-1-f.fainelli@gmail.com> From: Florian Fainelli Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBnbWFpbC5jb20+wmYEExECACYCGyMGCwkIBwMCBBUCCAME FgIDAQIeAQIXgAUCVF/S8QUJHlwd3wAKCRBhV5kVtWN2DvCVAJ4u4/bPF4P3jxb4qEY8I2gS 6hG0gACffNWlqJ2T4wSSn+3o7C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nGcJi61Pnjkz82hena8OmsnsBIucsz4N0wE+hVd6AbDYN8ZcFNIDyt7+oGD1+c PfqLz2df6qjXzq27BBUboklbGUObNwADBQ//V45Z51Q4fRl/6/+oY5q+FPbRLDPlUF2lV6mb hymkpqIzi1Aj/2FUKOyImGjbLAkuBQj3uMqy+BSSXyQLG3sg8pDDe8AJwXDpG2fQTyTzQm6l OnaMCzosvALk2EOPJryMkOCI52+hk67cSFA0HjgTbkAv4Mssd52y/5VZR28a+LW+mJIZDurI Y14UIe50G99xYxjuD1lNdTa/Yv6qFfEAqNdjEBKNuOEUQOlTLndOsvxOOPa1mRUk8Bqm9BUt LHk3GDb8bfDwdos1/h2QPEi+eI+O/bm8YX7qE7uZ13bRWBY+S4+cd+Cyj8ezKYAJo9B+0g4a RVhdhc3AtW44lvZo1h2iml9twMLfewKkGV3oG35CcF9mOd7n6vDad3teeNpYd/5qYhkopQrG k2oRBqxyvpSLrJepsyaIpfrt5NNaH7yTCtGXcxlGf2jzGdei6H4xQPjDcVq2Ra5GJohnb/ix uOc0pWciL80ohtpSspLlWoPiIowiKJu/D/Y0bQdatUOZcGadkywCZc/dg5hcAYNYchc8AwA4 2dp6w8SlIsm1yIGafWlNnfvqbRBglSTnxFuKqVggiz2zk+1wa/oP+B96lm7N4/3Aw6uy7lWC HvsHIcv4lxCWkFXkwsuWqzEKK6kxVpRDoEQPDj+Oy/ZJ5fYuMbkdHrlegwoQ64LrqdmiVVPC TwQYEQIADwIbDAUCVF/S8QUJHlwd3wAKCRBhV5kVtWN2Do+FAJ956xSz2XpDHql+Wg/2qv3b G10n8gCguORqNGMsVRxrlLs7/himep7MrCc= Message-ID: <6ba11003-48fd-0b93-332d-3bc485bcb577@gmail.com> Date: Wed, 12 Feb 2020 13:28:19 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: 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/12/20 12:47 PM, Vladimir Oltean wrote: > Hi Florian, > > On Wed, 12 Feb 2020 at 22:06, Florian Fainelli wrote: >> >> VLAN ID 0 is special by all kinds and is really meant to be the default >> ingress and egress untagged VLAN. We were not configuring it that way >> and so we would be ingress untagged but egress tagged. >> >> When our devices are interfaced with other link partners such as switch >> devices, the results would be entirely equipment dependent. Some >> switches are completely fine with accepting an egress tagged frame with >> VLAN ID 0 and would send their responses untagged, so everything works, >> but other devices are not so tolerant and would typically reject a VLAN >> ID 0 tagged frame. > > Are you sure that it's not in fact those devices that are not doing > what they're supposed to? VID 0 should be sent as tagged and no port > membership checks should be enforced on it. Where everything works what I see is the following: - Linux on egress sends an untagged frame (as captured by tcpdump) but the VLAN entry for VID 0 makes it egress tagged and the machine on the other sees it as such as well - the response from that machine is also ingress tagged as captured from the DSA master network device what I do not have visibility into are systems where this does not work but will try to request that. Breaking users is obviously bad which prompted me for doing this specification violating frame. I am not sure whether DSA standalone ports qualify as managed ports or not, sounds like no given we have not added support for doing much UC/MC filtering unlike what NICs do. > >> >> Fixes: 061f6a505ac3 ("net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation") >> Signed-off-by: Florian Fainelli >> --- >> Hi all, >> >> After looking at all DSA drivers and how they implement port_vlan_add() >> I think this is the right change to do, but would appreciate if you >> could test this on your respective platforms to ensure this is not >> problematic. > > I'm pretty sure this is problematic, for the simple reason that with > this change, DSA is insisting that the default PVID is 0, contrary to > the bridge core which insists it is 1. And some switches, like the > Microchip Ocelot/Felix, don't support more than 1 egress-untagged > VLAN, so adding one of the VIDs 0 or 1 will fail (I don't know the > exact order off-hand). See 1c44ce560b4d ("net: mscc: ocelot: fix > vlan_filtering when enslaving to bridge before link is up") for more > details of how that is going to work. OK, I do wonder if we would be better off just skipping the VLAN programming for VID = 0 and/or just defining a different reserved/default VLAN ID for switches that have global VLAN filtering. > >> >> Thank you >> >> >> net/dsa/slave.c | 9 ++++++++- >> 1 file changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/net/dsa/slave.c b/net/dsa/slave.c >> index 088c886e609e..d3a2782eb94d 100644 >> --- a/net/dsa/slave.c >> +++ b/net/dsa/slave.c >> @@ -1100,6 +1100,7 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, >> { >> struct dsa_port *dp = dsa_slave_to_port(dev); >> struct bridge_vlan_info info; >> + u16 flags = 0; >> int ret; >> >> /* Check for a possible bridge VLAN entry now since there is no >> @@ -1118,7 +1119,13 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, >> return -EBUSY; >> } >> >> - ret = dsa_port_vid_add(dp, vid, 0); >> + /* VLAN ID 0 is special and should be the default egress and ingress >> + * untagged VLAN, make sure it gets programmed as such. >> + */ >> + if (vid == 0) >> + flags = BRIDGE_VLAN_INFO_PVID | BRIDGE_VLAN_INFO_UNTAGGED; > > IEEE 802.1Q-2018, page 247, Table 9-2—Reserved VID values: > > The null VID. Indicates that the tag header contains only priority > information; no VID is > present in the frame. This VID value shall not be configured as a PVID > or a member of a VID > Set, or configured in any FDB entry, or used in any Management operation. > >> + >> + ret = dsa_port_vid_add(dp, vid, flags); >> if (ret) >> return ret; >> >> -- >> 2.17.1 >> > > Is this a test? Of course, I am always testing you, that way you do not know if I am incredibly smart or stupid. -- Florian