[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ee47c555-1b9c-ec97-1533-04aae2526406@arinc9.com>
Date: Mon, 14 Mar 2022 16:13:47 +0300
From: Arınç ÜNAL <arinc.unal@...nc9.com>
To: Vladimir Oltean <olteanv@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Alvin Šipraga <ALSI@...g-olufsen.dk>,
Linus Walleij <linus.walleij@...aro.org>,
Andrew Lunn <andrew@...n.ch>,
Luiz Angelo Daros de Luca <luizluca@...il.com>,
DENG Qingfang <dqfext@...il.com>, erkin.bozoglu@...ont.com,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>
Subject: Re: Isolating DSA Slave Interfaces on a Bridge with Bridge Offloading
Hey Vladimir,
On 13/03/2022 16:32, Vladimir Oltean wrote:
> Hello Arınç,
>
> On Sun, Mar 13, 2022 at 02:23:47PM +0300, Arınç ÜNAL wrote:
>> Hi all,
>>
>> The company I work with has got a product with a Mediatek MT7530 switch.
>> They want to offer isolation for the switch ports on a bridge. I have run a
>> test on a slightly modified 5.17-rc1 kernel. These commands below should
>> prevent communication between the two interfaces:
>>
>> bridge link set dev sw0p4 isolated on
>>
>> bridge link set dev sw0p3 isolated on
>>
>> However, computers connected to each of these ports can still communicate
>> with each other. Bridge TX forwarding offload is implemented on the MT7530
>> DSA driver.
>>
>> What I understand is isolation works on the software and because of the
>> bridge offloading feature, the frames never reach the CPU where we can block
>> it.
>>
>> Two solutions I can think of:
>>
>> - Disable bridge offloading when isolation is enabled on a DSA slave
>> interface. Not the best solution but seems easy to implement.
>>
>> - When isolation is enabled on a DSA slave interface, do not mirror the
>> related FDB entries to the switch hardware so we can keep the bridge
>> offloading feature for other ports.
>>
>> I suppose this could only be achieved on switch specific DSA drivers so the
>> implementation would differ by each driver.
>>
>> Cheers.
>> Arınç
>
> To be clear, are you talking about a patched or unpatched upstream
> kernel? Because mt7530 doesn't implement bridge TX forwarding offload.
> This can be seen because it is missing the "*tx_fwd_offload = true;"
> line from its ->port_bridge_join handler (of course, not only that).
I'm compiling the kernel using OpenWrt SDK so it's patched but mt7530
DSA driver is untouched. I've seen this commit which made me think of that:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/drivers/net/dsa/mt7530.c?id=b079922ba2acf072b23d82fa246a0d8de198f0a2
I'm very inexperienced in coding so I must've made a wrong assumption.
I've tested that mt7530 DSA driver delivers frames between switch ports
without the frames appearing on either the slave interfaces or the
master interface. I suppose I was confusing this feature with
tx_fwd_offload?
For example, the current state of the rtl8365mb DSA driver doesn't do
this. Each frame goes in and out of the DSA master interface to deliver
frames between the switch ports.
>
> You are probably confused as to why is the BR_ISOLATED brport flag is
> not rejected by a switchdev interface when it will only lead to
> incorrect behavior.
>
> In fact we've had this discussion with Qingfang, who sent this patch to
> allow switchdev drivers to *at the very least* reject the flag, but
> didn't want to write up a correct commit description for the change:
> https://lore.kernel.org/all/CALW65jbotyW0MSOd-bd1TH_mkiBWhhRCQ29jgn+d12rXdj2pZA@mail.gmail.com/T/
> https://patchwork.kernel.org/project/netdevbpf/patch/20210811135247.1703496-1-dqfext@gmail.com/
> https://patchwork.kernel.org/project/netdevbpf/patch/20210812142213.2251697-1-dqfext@gmail.com/
With v2 applied, when I issue the port isolation command, I get
"RTNETLINK answers: Not supported" as it's not implemented in mt7530 yet?
>
> As a result, currently not even the correctness issue has still not yet
> been fixed, let alone having any driver act upon the feature correctly.
It's unfortunate that this patch was put on hold just because of
incomplete commit description. In my eyes, this is a significant fix.
>
> In my opinion, it isn't mandatory that bridge ports with BR_ISOLATED
> have forwarding handled in software. All that needs to change is that
> their forwarding domain, as managed by the ->port_bridge_join and
> ->port_bridge_leave callbacks, is further restricted. Isolated ports can
> forward only to non-isolated ports, and non-isolated ports cannot
> forward to isolated ports. Things may become more interesting with
> bridge TX forwarding offload though, but as I mentioned, at least
> upstream this isn't a concern for mt7530 (yet).
Makes sense, thank you.
Arınç
Powered by blists - more mailing lists