From patchwork Mon Sep 13 14:42:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 509790 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp668788jao; Mon, 13 Sep 2021 08:34:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPZlque5pujGedS1MlQEQ/6NUs9pUyUhxVS0+tFkwZ0sRg42WfRISEUDjwkbxFLk6vIvsr X-Received: by 2002:a05:6402:14c3:: with SMTP id f3mr14010166edx.312.1631547262568; Mon, 13 Sep 2021 08:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631547262; cv=none; d=google.com; s=arc-20160816; b=rU9JX2Wv+bUPrr9meuw9/pnhm636STXOFVSbtvFQgBilCP28C+fcsCSOHc4h4grJZv mvSpF2jGPQCNQsrBmsG2GbCnM79Tbup8LwypVOiNnpzn2OuJysjBYnH5Gq3QCHFhmmKw HlOllheCTbgxnLeeDwhrFhNvLVqROk+P6uGC09/2+m+u/LAMbZqyxCVhlBWo7vuitDsv 1PdeI+p9MINQKOhYao5YUV1777zr2UGQxGtNd50W8RTLtsbVZe+fUDqyFQicirhSphzF pWhU9X/nALYzAplTJ7t4sUkEUjzD1eaLFCCzydbsNi/7wBnfVw0tv1R4e/4NLVcOWjWz 40ZQ== 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=YNvGPe0Dq+6R5la8j1qftPJtr3gJu4sNPynYBEMsuh0=; b=JDYBB/VDRpAzIxpVLva6rS1bo2nxtwOkit3ZITQjEC16Vtv7zI8/Cz60T5C5Y9P5ea WgNLNZB1z4IFzWlfQWA35iRQIGxttVsMXxlMjYbM/zFA5Uc+Q3ThDsTIzHzKQmgFWNWy +UBNHeRqqi1LD42ShVvdqlbIfPeZbtx04eLsLPi3qNUFCsD2u2GCmilkRYFvRtH+m9bk phLNCUSxFudGqG4YzTXnRjUzPhlRz21znwT5N+gJzQKSC6NIp9/5XjRIAC2m/PbMy93p SWYbiPynQtWO9/JMdGwB/FChCAjQ/dvxEXucNf+zY3u97Px5JT16lRoNuSqI23S2SiD2 GTGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EmYBJUcX; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si7844974eji.452.2021.09.13.08.34.22; Mon, 13 Sep 2021 08:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=EmYBJUcX; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240932AbhIMPfh (ORCPT + 8 others); Mon, 13 Sep 2021 11:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233162AbhIMPf0 (ORCPT ); Mon, 13 Sep 2021 11:35:26 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6672EC12C74C for ; Mon, 13 Sep 2021 07:45:36 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id s12so17845609ljg.0 for ; Mon, 13 Sep 2021 07:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YNvGPe0Dq+6R5la8j1qftPJtr3gJu4sNPynYBEMsuh0=; b=EmYBJUcXWwb3PoCDeCt8UrFdPtMwJ9RW5MD/Kdz37bvUEcrNFPvZ9KFgNvSSDufN9l PCBc9iN09/6aGspKx1kbSlW6EKkUbbL3wlGL7x+A552PWbBTK8iM3CYXckh/8lBWA9GM 8efrVIKiWKNM5HsHi/9U/8OKJ2Uhxw1hBeSL30SuDD2tgaNMBFiBxLcJS9mw8Kd5aCP0 aI+xItrm148Aq8LWcs5R4Y6p2gLNYDIW6Novj7/AP5PpPijpT73t1TK/gJK6ROuHA0Nu YQ8fWTKoXPpLxgwNF1LS2Lf5S0YYn47SnJwFiXT11GQak43hc8TKkAHD4NMlMNDRiuVo VNnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YNvGPe0Dq+6R5la8j1qftPJtr3gJu4sNPynYBEMsuh0=; b=6G6yCIdPJrAy/OSJQV0EK96rIJo6d8jGI67+Ic2uwW4mX/GAHnFTT7nsCepjm3dPkq wTbooz9gZBaGeTSOGCyzqKSeeskDpstEj1HTnZ/0/mUaw3GimZ+CnoxTI8K4+BihjcPv 9fvU8yLMMWssKC9hVf9dAF0z3GldSHDF77/GfnERgBMorpfA0N0a0RhKsr271BEqRr0z QOBG6yjeIvpOtjYSW3FuoOjLHkJ27u+dYMhVpUIBxLRr2+JilicjoKUIiE/ESBisA4P5 yMC4C0qKDQ7+8SEJKYu+VF7YXT4C0NqTvPhegrivdruhS3Zq3Z8loXfMv0eU+e7i9pAP 8Cvg== X-Gm-Message-State: AOAM5335fcuMJr+PqTwOseg1VRPaWbcwFGD+6DSEhOwORdu95d3YCZ2A GQP+8TWMInq9qQ3udOB8+zAvVw== X-Received: by 2002:a2e:9549:: with SMTP id t9mr10789580ljh.404.1631544334724; Mon, 13 Sep 2021 07:45:34 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:34 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , DENG Qingfang , =?utf-8?q?Alvin_=C5=A0ipraga?= Subject: [PATCH net-next 2/8] net: dsa: rtl8366: Drop custom VLAN set-up Date: Mon, 13 Sep 2021 16:42:54 +0200 Message-Id: <20210913144300.1265143-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This hacky default VLAN setup was done in order to direct packets to the right ports and provide port isolation, both which we now support properly using custom tags and proper bridge port isolation. We can drop the custom VLAN code and leave all VLAN handling alone, as users expect things to be. We can also drop ds->configure_vlan_while_not_filtering = false; and let the core deal with any VLANs it wants. Cc: Mauri Sandberg Cc: DENG Qingfang Reviewed-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - No changes ChangeLog v2->v3: - Collect a bunch of reviewed-by tags ChangeLog v1->v2: - No changes. --- drivers/net/dsa/realtek-smi-core.h | 1 - drivers/net/dsa/rtl8366.c | 48 ------------------------------ drivers/net/dsa/rtl8366rb.c | 4 +-- 3 files changed, 1 insertion(+), 52 deletions(-) -- 2.31.1 diff --git a/drivers/net/dsa/realtek-smi-core.h b/drivers/net/dsa/realtek-smi-core.h index fcf465f7f922..c8fbd7b9fd0b 100644 --- a/drivers/net/dsa/realtek-smi-core.h +++ b/drivers/net/dsa/realtek-smi-core.h @@ -129,7 +129,6 @@ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port, int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable); int rtl8366_enable_vlan(struct realtek_smi *smi, bool enable); int rtl8366_reset_vlan(struct realtek_smi *smi); -int rtl8366_init_vlan(struct realtek_smi *smi); int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack); int rtl8366_vlan_add(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 75897a369096..59c5bc4f7b71 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -292,54 +292,6 @@ int rtl8366_reset_vlan(struct realtek_smi *smi) } EXPORT_SYMBOL_GPL(rtl8366_reset_vlan); -int rtl8366_init_vlan(struct realtek_smi *smi) -{ - int port; - int ret; - - ret = rtl8366_reset_vlan(smi); - if (ret) - return ret; - - /* Loop over the available ports, for each port, associate - * it with the VLAN (port+1) - */ - for (port = 0; port < smi->num_ports; port++) { - u32 mask; - - if (port == smi->cpu_port) - /* For the CPU port, make all ports members of this - * VLAN. - */ - mask = GENMASK((int)smi->num_ports - 1, 0); - else - /* For all other ports, enable itself plus the - * CPU port. - */ - mask = BIT(port) | BIT(smi->cpu_port); - - /* For each port, set the port as member of VLAN (port+1) - * and untagged, except for the CPU port: the CPU port (5) is - * member of VLAN 6 and so are ALL the other ports as well. - * Use filter 0 (no filter). - */ - dev_info(smi->dev, "VLAN%d port mask for port %d, %08x\n", - (port + 1), port, mask); - ret = rtl8366_set_vlan(smi, (port + 1), mask, mask, 0); - if (ret) - return ret; - - dev_info(smi->dev, "VLAN%d port %d, PVID set to %d\n", - (port + 1), port, (port + 1)); - ret = rtl8366_set_pvid(smi, port, (port + 1)); - if (ret) - return ret; - } - - return rtl8366_enable_vlan(smi, true); -} -EXPORT_SYMBOL_GPL(rtl8366_init_vlan); - int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) { diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index b930050cfd1b..a5b7d7ff8884 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -985,7 +985,7 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return ret; } - ret = rtl8366_init_vlan(smi); + ret = rtl8366_reset_vlan(smi); if (ret) return ret; @@ -999,8 +999,6 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return -ENODEV; } - ds->configure_vlan_while_not_filtering = false; - return 0; }