Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6432332ybv; Wed, 12 Feb 2020 12:06:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzINTM+Ko92N2HNeC0kHsHvqhJoBJODpEOD4NU5pEYkVOT9ge85O/dOabkduMVE8lGevZMZ X-Received: by 2002:a9d:65cf:: with SMTP id z15mr11064094oth.238.1581538011281; Wed, 12 Feb 2020 12:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581538011; cv=none; d=google.com; s=arc-20160816; b=uxYqpH6a+/oVtZECa1jMCI4a4HyyJmp7T2uxNPnobXt3961H5l+8kw9n5Gecpjw6RY QIZyrzH3N4vIOSDUECEj3pMdwq693wW4pgL9S6UOz3u5Xobhy1tJsghcbZuMFTcO+Eg2 sv+bjjNY7SvWRaZfqV9zZQMozdqjtYXK3UzD05ZipR0qUqUwTC6I/IzyYuduohTpgJRA UE23Dmbbp1tpGag1QCk2nr+eIxGMLRtJVsG1unqhgvqWMQhKGxPUkn+fGhpWvDoXES4P GODHdRu0z6YW6i2UEkvlmwBJ3WX/W+FoW6h9HS7JAYTH34CZhynOc6w7TBtvAJtPcjVM PHJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=B5E+DB4+vknXt88petGEGI+dIA4MgxXGZFZRi0jSQkc=; b=MfMBZtW0KMMJ6Y00UEV9lIhgoTcVbLH2ZbDMeGYbdavNJuFcEduJKBlaxtWnDG7f4i 5Dlw9NuL99aILxFIh7znEvorOS6Vz7spXYhjzsZSN6vu6RJ7wYlbJrjVeiSkiMm1ENOO cVMtMFVU1X1pjtg6XPnvhnZ+ojjF1EUliGrHXKb086QT3taKMymuxA7PeOOI/v1EwPGM gXRQKZ+8VvhmPUXomC2WB1NE1WpBQrZYdq2W5qxJmW+MRr1PGY3RYN1k9iIx+T4UtEWX A3vq1arl0Xos+R5Gz5GnkrkbOlxMI5LfNsS0yJXkddXJUG/ii7TrAqWUMyCThKGGY6Dh waHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aJiaddZT; 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 g6si694707otk.171.2020.02.12.12.06.38; Wed, 12 Feb 2020 12:06:51 -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=aJiaddZT; 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 S1728984AbgBLUG2 (ORCPT + 99 others); Wed, 12 Feb 2020 15:06:28 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46305 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727439AbgBLUG2 (ORCPT ); Wed, 12 Feb 2020 15:06:28 -0500 Received: by mail-pf1-f193.google.com with SMTP id k29so1748369pfp.13; Wed, 12 Feb 2020 12:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=B5E+DB4+vknXt88petGEGI+dIA4MgxXGZFZRi0jSQkc=; b=aJiaddZTO7Hg7BNimGLLTGUBqNLBZOj0cNtWV/YmN+qhdYCfTQ52ZCVoKC7w0h23ny UqNGD3iJo7AysaIjnH4YPQdN0f62CG+i/yZCF1/Zs54Px4vvNZ3hUzZKQass1O0RX6Oh MQMFiux29AAgrp9Yacl0GLeEFXJ6uPDXkIUPLT3QxYzeqgOYLkF0yeNFeFWrCaMX0yyb alcUP7IfbwiAEyEAnnncoM4TosiULvfev5y6nzvF71Ux9da6yT9Pt2PrE5xtejcPxKAp K90piSZN1VlwX57Q3mOU7/AtYWsS29z5hMsZ8hfJVZxPkOskgfZx+r8Lj9a6sgkd6FyS d6UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=B5E+DB4+vknXt88petGEGI+dIA4MgxXGZFZRi0jSQkc=; b=f2zhLTwWOUhbQOpPYIv8xlQ444I+l7hJLHosnytsF9sqD78N+H6ZOfeaae76U5xJgi 5Fn8TdPSaHQU+9CdJXC0u4W8+5VOc5FTnMlQcjnEErFWsaL1yYTRNf4t2ztm55BhA7wz jF/Fx+NhpGxg6j1F2yDtTM4sS9k9leT0wrioCenMKh12qDpYtY1p2cyj7UX08GfO7hZd faMyf9WxUHuy85nF0fPkRh1GAp85KlmWjDCxfXdEnCX6B9xRgvxhBRv1PQ5eN+FrKvi8 Z0sxRdM0Xdgt2M9NpS2mJScFIChdxxYZm/Kh77hGYzV4sBIy3hD8QbfiqMjIVzRkIjSY at6w== X-Gm-Message-State: APjAAAX9l8M7FuNRCMjw8Pj0n+g9n+pwl2EslPg0fAAcNxzp7mGu0BG9 Ds9GtH9AptEF5sIN6aI7UXguDFNU X-Received: by 2002:a63:2a13:: with SMTP id q19mr13455341pgq.82.1581537987047; Wed, 12 Feb 2020 12:06:27 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x7sm77557pfp.93.2020.02.12.12.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 12:06:26 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: olteanv@gmail.com, hkallweit1@gmail.com, michal.vokac@ysoft.com, Florian Fainelli , Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net] net: dsa: Treat VLAN ID 0 as PVID untagged Date: Wed, 12 Feb 2020 12:05:55 -0800 Message-Id: <20200212200555.2393-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. 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; + + ret = dsa_port_vid_add(dp, vid, flags); if (ret) return ret; -- 2.17.1