Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp969616pxk; Thu, 1 Oct 2020 19:45:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTWEVV7iOjpaZKpLIhqUaKwLv7abf0IVNOQUAhaaE7v47FJsnrXUyiks4nMGI52qOBTs5l X-Received: by 2002:a17:906:3553:: with SMTP id s19mr16467eja.178.1601606749092; Thu, 01 Oct 2020 19:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601606749; cv=none; d=google.com; s=arc-20160816; b=Tr7WI466T4DvAk9ZOXxcBCf5TAx5it3kseIDZ3eZGgAl3w+O53eY7+bvyQr5n81Iwp rXs5T5S9tiDv9BEeeOwVqGCYcDwij1Z0mNPeWKdQ2sJVAd+9ydttYh+OYDij3QTs37ch acId13PmdH6aMBhahkfEGAPq3KPhr7DCJd5ZFhqSpNN/6sCN7CpVQCJXLxnlk+sqnOea D+CXEUXquCP5a+Y5s+E7nDDoU9VBaFLLUqSv75DW6qw8NRp1WmJMLvn/0sjy6zbgR0LU jsjPWpL/tXrIewEee3eeZPoVzRwdThRWtkIBqfkYNzvnP1gRAEe4Kf5Vdle4t8Se0AYp qnnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pNIFCfbxn/994O6tOncE60q/cKfHn8CJSzrbaSDB3Bc=; b=IWNVz1FQHzwjglNOhW7MSkBNeIPTqYOVmrA+RbA8bUs2xCxp3ZzS00XAYEQJf9ydvg iEDVabvsZdBWiA8v/6zlzscDEGhpw9W8EeLhC8YlcGkKQcXaFW7bZuj8x8Dspdxbms0l V/giBo/CaDzDUhnCwiCqamCA7dnKNgQcGy5hO3Dl59x6rZLQfiepz4lZ6XTmYzq6CTwD r16rnqRop9Zoo2ZquF0XhsFMhnUZ2wA95W8VE6NWkD0hWS+QcpivpWR7iTY9Yei6sCXG AdM7l8P2nn/hJP4alFYuHmxmqMQUteY4IGr8q4SNRt9ZCIeIU/BscYqvblvayjk9Zcox nGXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIAxAI3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ly27si57682ejb.672.2020.10.01.19.45.26; Thu, 01 Oct 2020 19:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIAxAI3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2387635AbgJBCm5 (ORCPT + 99 others); Thu, 1 Oct 2020 22:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387623AbgJBCmt (ORCPT ); Thu, 1 Oct 2020 22:42:49 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB6D6C0613D0; Thu, 1 Oct 2020 19:42:47 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id q4so173272pjh.5; Thu, 01 Oct 2020 19:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pNIFCfbxn/994O6tOncE60q/cKfHn8CJSzrbaSDB3Bc=; b=ZIAxAI3LB542ee7hXFPsZjEdnq9/UH8jbb3Stpq8hN1b/FBaLPqG+SIsRK0wtRCS53 Tz56f9PKsbKDcZQokW3WzR8jm6PcdRT5LPMhSPf2IFYv7u0XmGP0Ms/b5tpgrKx4aSUZ ds7nRnT8Pk8zrErOCMbJ989MkywmIIVipUxVYqp6FJCkiKF0+QaEk1C/sxhR1v+Oysf7 7z6Uq444AzF71+PM/YbsopVzY4cjdNwi5dQcBSsVMDdTHy0ZLz97jhhP1K2RoG3AWrL0 Db3YpVJYMU2fvoGPCYaALZFIxr8gnXMAPGuUfPXuCOF5Wpm185jLl6X/FZEaXtHKVYEJ K/cA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=pNIFCfbxn/994O6tOncE60q/cKfHn8CJSzrbaSDB3Bc=; b=R3QLZI1AGlTuf0IraZGCtwJbnxlqORVKwTjoo5fG+vXiTC9QKvEHUW2vajB4/GD12U x3RkUeXaGnL+0gZ5GCqYuSVvEoV4perRK7w8mDlCEtC8bu2iUezGgG53id85pIZQ8ubq Fj4uxfVDsqFNLZJ/BjnRwlwgtfspogOXRE50lRLJvjc/heLIBDkcARVTmAa1unP5xC4Z hxmG4vrdpQECyzZzQclpQ/SmNrYDoCi6W7vL6O5Bm8V0HK4kmrAkgVUkQR2NRpQxc2br OJ1Fo1t1tmblpi7h/gRcls3dRCc+JKRE/eIoRjTk/swsUEhC+TVw2yMAoNqgGEGhfqRz 5m/w== X-Gm-Message-State: AOAM533RUgvCEILulpBx+QGn19lQrGve3DFqEHi0sAJx9O6DKd6yeShY 99jME0YrdqUFBFFC8YjN58IAtENXSY16nw== X-Received: by 2002:a17:90a:f486:: with SMTP id bx6mr344996pjb.130.1601606567011; Thu, 01 Oct 2020 19:42:47 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id gt11sm150185pjb.48.2020.10.01.19.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 19:42:46 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org (open list), vladimir.oltean@nxp.com, olteanv@gmail.com Subject: [PATCH net-next 4/4] net: dsa: Utilize __vlan_find_dev_deep_rcu() Date: Thu, 1 Oct 2020 19:42:15 -0700 Message-Id: <20201002024215.660240-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201002024215.660240-1-f.fainelli@gmail.com> References: <20201002024215.660240-1-f.fainelli@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we are guaranteed that dsa_untag_bridge_pvid() is called after eth_type_trans() we can utilize __vlan_find_dev_deep_rcu() which will take care of finding an 802.1Q upper on top of a bridge master. A common use case, prior to 12a1526d067 ("net: dsa: untag the bridge pvid from rx skbs") was to configure a bridge 802.1Q upper like this: ip link add name br0 type bridge vlan_filtering 0 ip link add link br0 name br0.1 type vlan id 1 in order to pop the default_pvid VLAN tag. With this change we restore that behavior while still allowing the DSA receive path to automatically pop the VLAN tag. Signed-off-by: Florian Fainelli --- net/dsa/dsa_priv.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index d6ce8c2a2590..12998bf04e55 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -204,7 +204,6 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb) struct net_device *br = dp->bridge_dev; struct net_device *dev = skb->dev; struct net_device *upper_dev; - struct list_head *iter; u16 vid, pvid, proto; int err; @@ -246,13 +245,9 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb) * supports because vlan_filtering is 0. In that case, we should * definitely keep the tag, to make sure it keeps working. */ - netdev_for_each_upper_dev_rcu(dev, upper_dev, iter) { - if (!is_vlan_dev(upper_dev)) - continue; - - if (vid == vlan_dev_vlan_id(upper_dev)) - return skb; - } + upper_dev = __vlan_find_dev_deep_rcu(br, htons(proto), vid); + if (upper_dev) + return skb; __vlan_hwaccel_clear_tag(skb); -- 2.25.1