Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp378145pxb; Thu, 17 Feb 2022 06:10:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5g/rL9tJF6f3LSOYd1S8YOG1W6N/r5UhvJPD7NxDuMSGgl+Z6qahCMWJviDb9XIF/QB99 X-Received: by 2002:a17:902:a715:b0:14d:7b97:72c3 with SMTP id w21-20020a170902a71500b0014d7b9772c3mr3042518plq.93.1645107012685; Thu, 17 Feb 2022 06:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645107012; cv=none; d=google.com; s=arc-20160816; b=DLQlAeVnWrrEXOWO2/DnAYKOGS3QN6xZet+y/tR4ahI7TBd325X9uFuhATqVEW52jH erI3u1hQx2WPkpg6q7AHF2oH2Vly0aR5Rdhl309yFdxRbbQhyXOluJu3dUCYpu520L4/ SO+1CLR//CccnrXZd3N7KmZ7Iv3eiAAcK+Z0hxLM1rlC4rJxq4iqMkqZKcAnjtAarEvO tCwWQVMmG1liDEPZRC10HBNI1SyRN9lSTcqeRcZ363+Mhk2M00ntfa7R/liOW+4NnytA 9A8Al4KcODeF9bYI8xXBIf5jtM+b8cyJWabq2MPm8Fvl3cPGOLMSgw6YZa9IeJ5boA7W Q0gA== 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 :message-id:date:subject:to:from; bh=+LnQlC6QM5zCsS7/vyHT4q6xupLYAkbhJcwl3LW/fyY=; b=HiSby6cDhKf293CDwGAH/RmvRztr9PiyVtOrHOgkK1VtjK0e7zlxRa68qcxWTwnvbP MJXV2u8HSONIY3Wx2/44vN74PsDMu5FHwgnpULMBNIl1RVJ3M1C20rJRNhPf7oT6eumI S/9GdiAWCSpp5iElbHtf/Sh+6wwTzaeZoOQbeQfhGsovfhiC7ZnHd23oCLqXrtG9TYqU vPXVbWBYnEuxTiEyitTIEpI3H7GdTaelGfIeq2Wxl0TS/IZHL1cNHs1f6kxIpGGXy9j4 OznhgKuBVmxUNdb/ZKoTaf7hVPPh3TAB1XmCs3o/zbVNij3W14KZ4HDIZZxpIYifdkCt NXfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np6si1140403pjb.57.2022.02.17.06.09.56; Thu, 17 Feb 2022 06:10:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232874AbiBPUsk (ORCPT + 99 others); Wed, 16 Feb 2022 15:48:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232640AbiBPUsj (ORCPT ); Wed, 16 Feb 2022 15:48:39 -0500 X-Greylist: delayed 107328 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 16 Feb 2022 12:48:22 PST Received: from unicorn.mansr.com (unicorn.mansr.com [81.2.72.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F0DC3303; Wed, 16 Feb 2022 12:48:22 -0800 (PST) Received: from raven.mansr.com (raven.mansr.com [81.2.72.235]) by unicorn.mansr.com (Postfix) with ESMTPS id 4B99415360; Wed, 16 Feb 2022 20:48:20 +0000 (GMT) Received: by raven.mansr.com (Postfix, from userid 51770) id 13FBE219C0A; Wed, 16 Feb 2022 20:48:20 +0000 (GMT) From: Mans Rullgard To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Juergen Borleis , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device Date: Wed, 16 Feb 2022 20:48:18 +0000 Message-Id: <20220216204818.28746-1-mans@mansr.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the master device does VLAN filtering, the IDs used by the switch must be added for any frames to be received. Do this in the port_enable() function, and remove them in port_disable(). Signed-off-by: Mans Rullgard --- Changes: - Fix dependency on VLAN_8021Q - Add missing #include --- drivers/net/dsa/Kconfig | 1 + drivers/net/dsa/lan9303-core.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig index 8d51c1019dcd..37a3dabdce31 100644 --- a/drivers/net/dsa/Kconfig +++ b/drivers/net/dsa/Kconfig @@ -72,6 +72,7 @@ source "drivers/net/dsa/realtek/Kconfig" config NET_DSA_SMSC_LAN9303 tristate + depends on VLAN_8021Q || VLAN_8021Q=n select NET_DSA_TAG_LAN9303 select REGMAP help diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 873a5588171b..3969d89fa4db 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "lan9303.h" @@ -1083,21 +1084,27 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, static int lan9303_port_enable(struct dsa_switch *ds, int port, struct phy_device *phy) { + struct dsa_port *dp = dsa_to_port(ds, port); struct lan9303 *chip = ds->priv; - if (!dsa_is_user_port(ds, port)) + if (!dsa_port_is_user(dp)) return 0; + vlan_vid_add(dp->cpu_dp->master, htons(ETH_P_8021Q), port); + return lan9303_enable_processing_port(chip, port); } static void lan9303_port_disable(struct dsa_switch *ds, int port) { + struct dsa_port *dp = dsa_to_port(ds, port); struct lan9303 *chip = ds->priv; - if (!dsa_is_user_port(ds, port)) + if (!dsa_port_is_user(dp)) return; + vlan_vid_del(dp->cpu_dp->master, htons(ETH_P_8021Q), port); + lan9303_disable_processing_port(chip, port); lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN); } -- 2.35.1