Article View: linux.kernel.netdev
Article #8198Re: [PATCH v3 3/7] net: dsa: mediatek: add support for passthrough mode
From: Caleb James DeLisle
Date: Wed, 28 Oct 2026 11:08
Date: Wed, 28 Oct 2026 11:08
94 lines
12185 bytes
12185 bytes
Hello,
Thanks for the review.
On 28/10/2026 03:15, Andrew Lunn wrote:
>> @@ -199,6 +199,9 @@ static void mt7530_port_fast_age(struct dsa_switch *ds, int port)
>> u32 val;
>> int ret;
>>
>> + if (priv->is_passthrough)
>> + return;
>> +
>> mutex_lock(&priv->reg_mutex);
>>
>> /* Flush all non-static MAC address entries */
>> @@ -970,6 +973,9 @@ mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
>> unsigned int age_count;
>> unsigned int age_unit;
>>
>> + if (priv->is_passthrough)
>> + return 0;
>> +
>> @@ -1386,11 +1446,14 @@ mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
>> int length;
>> u32 val;
>>
>> + if (priv->is_passthrough)
>> + return 0;
>> +
> What is actually left?
In v2 I was using special switch ops, and it looked like this:
/* No manipulation of forwarding rules allowed in passthrough mode */
static const struct dsa_switch_ops mt7530_passthrough_switch_ops = {
.get_tag_protocol = mtk_get_tag_protocol,
.setup = mt753x_setup,
.teardown = mt753x_teardown,
.preferred_default_local_cpu_port =
mt753x_preferred_default_local_cpu_port,
.get_strings = mt7530_get_strings,
.get_ethtool_stats = mt7530_get_ethtool_stats,
.get_sset_count = mt7530_get_sset_count,
.get_eth_mac_stats = mt7530_get_eth_mac_stats,
.get_rmon_stats = mt7530_get_rmon_stats,
.get_eth_ctrl_stats = mt7530_get_eth_ctrl_stats,
.get_stats64 = mt7530_get_stats64,
.port_enable = mt7530_port_enable,
.port_disable = mt7530_port_disable,
.phylink_get_caps = mt753x_phylink_get_caps,
.support_eee = dsa_supports_eee,
.set_mac_eee = mt753x_set_mac_eee,
.conduit_state_change = mt753x_conduit_state_change,
};
>
> Is there sufficient code reuse that this makes sense?
>
> Would it be simpler to have a much simpler DSA driver just for pass
> through? Or the mt7530 driver has a second dsa_switch_ops instance
> with all these functions set to NULL?
After sending v2, I discovered that some switch config runs across the
whole switch tree, and NULL configurators causes those ops to log an
error and exit early.
As far as making a "passthrough driver", there are a few things going
against it. As you can see there is still quite a bit of shared code,
also it would be inconvenient to use a different compatible because some
chip packages exclude the MCM switch and have 3x 10/100 ports and 1x
gigabit port, so its better for the DT to pretend that the mt7530 can
simply do full hierarchies, though (per the big commit message) that
doesn't actually work and we're relying on the fact that hardware
integrators will not require something that can't be done.
Lastly, the TRGMII calibration requires poking registers on one switch
and reading values off the other (patch 7) so I think that mess is best
kept all inside of one C file.
Thanks,
Caleb
>
> Andrew
Technical Details
Message-ID:
<18472c61-efe2-4529-971b-82d877df6b15@cjdns.fr>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352817-linux-kernel-netdev=dewy.ruReferences:
<20261028011317.1557238-1-cjd@cjdns.fr> <20261028011317.1557238-4-cjd@cjdns.fr> <734d4f06-26af-4bea-9c83-eb92c1b3b894@lunn.ch>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352817-linux-kernel-netdev=dewy.ru From: cjd@cjdns.fr (Caleb James DeLisle) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v3 3/7] net: dsa: mediatek: add support for passthrough mode Date: Wed, 28 Oct 2026 12:08:29 +0100 Organization: Usenet Network Message-ID: <18472c61-efe2-4529-971b-82d877df6b15@cjdns.fr> References: <20261028011317.1557238-1-cjd@cjdns.fr> <20261028011317.1557238-4-cjd@cjdns.fr> <734d4f06-26af-4bea-9c83-eb92c1b3b894@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1755386"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:SYSH6aKExnE75EFIicaNYmwI/wk= sha256:MWAfGvxNJy83rBy5NiHN6v8yx6+oW4L9JU6JQVCcbSc= sha1:oYvsk09Pbp1UxxYDDcDj2HdCDZg= sha256:GHtv2gX+geM/JdfjEAAIzxKkcuEKoz34sGBYxrEj6M0= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8571D125C33; Wed, 28 Oct 2026 14:09:12 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=cjdns.fr X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6C1z_l_MsIms; Wed, 28 Oct 2026 14:09:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-352817-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cjdns.fr X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 75BC5125C32; Wed, 28 Oct 2026 14:08:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id DC3826019C3; Wed, 28 Oct 2026 11:08:50 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793185728; b=loPh11tNsDuFz0+JA41Xwrp+a0LmO2W9vw4fe6TRCj1hW/9OgnwN0FRZltqJG7DHC/O7 zRkihslib1dF5L3maPsScgmI9Uer7dPHCN4kLZJFYL6pnMgNQ4sDowSWBLxi8Zyae5YJ4 hOvi0/hK+NCs7F4iuqLDR+xluTyXjh1HAKzQd2r8Rd/Hws6UPyjKynLu/OFLHLxTYC29x bHzEKqu2ZYsmz3gAJMfUmMqvssWYWNobtnDwQn81QZnlVHUei9JTluh5r9UvcmympL/ub 00B56+/yq0cyKrFPz1QYXyPAc5/USZecddFyPncq/bqAvjy+vuIcA+yWzeJB7hpTWTA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793185728; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=siORJd7LZwDgICSKGjyivx+vmAgZhVMEqu8f43biolo=; b=QWytw6vjTP0B3NMHOYe541IjSSKTeYCW793I4WoTDRYxWLexqzOPLSQwV0UNZ/OFIvaO jHRKHCp5RB3l4IJoieJui1usfMvtZOUaoCzEH9CXNVojiMpZMR5jkcfr18v/mhpbK+idx x+rrr/tYH8XKFxexNVs9YVuE8vFd9V873lfjW4Q93kPtKpPmm9CAQGGbQ8B6DgXQL2wux J/DL71TkqAhaqam33kGI+8zrLk8wvSOu+mZCkznmGmlsK2a3kLZBN7Q+1apDMxAA6Up0+ XktU8yj3vt0y6CkU2TCtlyAu7AqfaYwcvxlN8roDqQleCbPDZqg3j5vZhM9SgJAT1uw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=cjdns.fr header.i=@cjdns.fr header.a=rsa-sha256 header.s=dkim header.b=jKNYHHxm; dmarc=pass header.from=cjdns.fr; spf=pass smtp.mailfrom=cjdns.fr; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8B3B606A338; Wed, 28 Oct 2026 11:08:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=cjdns.fr header.i=@cjdns.fr header.a=rsa-sha256 header.s=dkim header.b=jKNYHHxm X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=5.135.140.105 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793185722; b=Rq2OPVTnS8g+LgaDjNfbm6uvy+odNuwAT6d/l1q63X+8UAWJeCtrs4qp+mIuIQYGI3zn 0SMI+mFAFbMYhyakkzoQGb+wO2PQlhFNboC/0WbmL3Z6GcotEOS5lIlVi/P1CMjkKCs+4 VMwJCGE524rT+CTGtzUnJznrYcztXO4euQmEJaZHgu6m0SiF6Xvm6pSY0lyDPihvOqGub ySakh44JJHpDgkL3rjzyW9MaWvlXxVYp9s04BGPFtRjxL2cs8hMzZwvKbiHtV459eDTiz cu+KLHdKxUjl9z9KO5XdKkmXQKyBViEEtCfjyKDi6aKCBDdHfwqfUFtytqDYg77rbhw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793185722; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=siORJd7LZwDgICSKGjyivx+vmAgZhVMEqu8f43biolo=; b=uyFW37pQuWJ/vt1bH7euu7w8vHmkwEMzILCyGEmmr8rDxMxltsUrxbndZFHjJofjH3nr Ujp8ljgB4Jpox3goEeai6a8eUZYq2FG/vBCSEiMNdh+omE4xjClgC+EepZXga6SDABBuk ECXgQb4OcfhJQfPVyIMGGvNqczs64MyXtMzL5Q9cw/Zlcf8Ykl+yO0qjgPqQs24Jy5aq/ 0KEcWHa42afvU/b04VfSK+ZeYwiwdYjHJ7fOJSkT9zaV0mXYlQWOB8l6THEYmTkf+lmrq zRgsYAuU0tjv8kuYwq035TfvyEy6pzosG/l5ULyKRzoYt7e/klmclla/R5ISIMYMiFA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cjdns.fr; spf=pass smtp.mailfrom=cjdns.fr; dkim=pass header.d=cjdns.fr header.i=@cjdns.fr header.a=rsa-sha256 header.s=dkim header.b=jKNYHHxm; arc=none smtp.remote-ip=5.135.140.105 X-Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4FD4606A31A; Wed, 28 Oct 2026 11:08:41 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E4FD4606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cjdns.fr X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 88AA3156FED; Wed, 28 Oct 2026 12:08:30 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1793185718; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=siORJd7LZwDgICSKGjyivx+vmAgZhVMEqu8f43biolo=; b=jKNYHHxmaC2APW0DVeupNPPz7wHexAQ7EnvAF8hRbuuPMiugJWw7ltkYK7lAd7fMF5mXyk pTIQZszFTsew90Dnnu+spQO5bb/5NHTB6MiWVz8Tq4FRygwp/GpnOsBAfyc4HNcAuxQWBE 1M2zTnZgWI7NWzIKvSmzBeZbhngzRfS3CjU3B//8GhotEV+1J50qnp09KLvTUKGJmn97Gb zPVHK9KwXHVL4+JbRw1UJY3eQ4IQ6+Q/ruyqRsfWSZsfZFydkVAjKz3RiCbTMZFvAEQlxl ldUq5P1pCV9NStB6xLGl/eVM940SawUj4VDm7TaeL8IpFnitrgjDdp00bn0Ujg== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird Beta X-Cc: netdev@vger.kernel.org, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, chester.a.unal@arinc9.com, daniel@makrotopia.org, linux@armlinux.org.uk, arinc.unal@arinc9.com, Landen.Chao@mediatek.com, dqfext@gmail.com, sean.wang@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, naseefkm@gmail.com, b.larsson@gmx.com X-In-Reply-To: <734d4f06-26af-4bea-9c83-eb92c1b3b894@lunn.ch> X-Last-TLS-Session-Version: TLSv1.3