diff mbox series

[v2,4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2

Message ID 20230201185656.17164-5-arinc.unal@arinc9.com (mailing list archive)
State New, archived
Headers show
Series arm: dts: mt7623: relocate gmacs, mt7530 switch, and mux phy | expand

Commit Message

Arınç ÜNAL Feb. 1, 2023, 6:56 p.m. UTC
From: Arınç ÜNAL <arinc.unal@arinc9.com>

Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.

With this, the interface name to access phy0 changes from wan to eth1.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Frank Wunderlich Feb. 3, 2023, 3:36 p.m. UTC | #1
Am 1. Februar 2023 19:56:55 MEZ schrieb arinc9.unal@gmail.com:
>From: Arınç ÜNAL <arinc.unal@arinc9.com>
>
>Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
>This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.
>
>With this, the interface name to access phy0 changes from wan to eth1.
>
>Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>---
> arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
>diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>index dc9b4f99eb8b..64700253fd35 100644
>--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>@@ -182,6 +182,12 @@ fixed-link {
> 	};
> };
> 
>+&gmac1 {
>+	status = "okay";
>+	phy-mode = "rgmii";
>+	phy-handle = <&ethphy0>;
>+};
>+
> &eth {
> 	status = "okay";
> 
>@@ -189,6 +195,10 @@ mdio-bus {
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
>+		ethphy0: ethernet-phy@0 {
>+			reg = <0>;
>+		};
>+
> 		switch@1f {
> 			compatible = "mediatek,mt7530";
> 			reg = <0x1f>;
>@@ -200,11 +210,6 @@ ports {
> 				#address-cells = <1>;
> 				#size-cells = <0>;
> 
>-				port@0 {
>-					reg = <0>;
>-					label = "wan";
>-				};
>-
> 				port@1 {
> 					reg = <1>;
> 					label = "lan0";

Hi

I still see Problem with "renaming" the wan from users PoV. I got another way of using second gmac for wan some time ago using vlan-aware bridge (have not tested with recent kernel versions).

Maybe this works for you too? If yes imho it will be a better way.

https://github.com/frank-w/BPI-Router-Linux/commit/c92b648bac996b34dc75a4fff15d7fb429bfe74b

Have same for r64/mt7622 in my tree...

It should use eth1 for wan-traffic too but is full userspace configuration without breaking userspace for users not wanting it.
regards Frank
Arınç ÜNAL Feb. 3, 2023, 6:20 p.m. UTC | #2
On 3.02.2023 18:36, Frank Wunderlich wrote:
> Am 1. Februar 2023 19:56:55 MEZ schrieb arinc9.unal@gmail.com:
>> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>>
>> Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
>> This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.
>>
>> With this, the interface name to access phy0 changes from wan to eth1.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>> arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 15 ++++++++++-----
>> 1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>> index dc9b4f99eb8b..64700253fd35 100644
>> --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>> +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>> @@ -182,6 +182,12 @@ fixed-link {
>> 	};
>> };
>>
>> +&gmac1 {
>> +	status = "okay";
>> +	phy-mode = "rgmii";
>> +	phy-handle = <&ethphy0>;
>> +};
>> +
>> &eth {
>> 	status = "okay";
>>
>> @@ -189,6 +195,10 @@ mdio-bus {
>> 		#address-cells = <1>;
>> 		#size-cells = <0>;
>>
>> +		ethphy0: ethernet-phy@0 {
>> +			reg = <0>;
>> +		};
>> +
>> 		switch@1f {
>> 			compatible = "mediatek,mt7530";
>> 			reg = <0x1f>;
>> @@ -200,11 +210,6 @@ ports {
>> 				#address-cells = <1>;
>> 				#size-cells = <0>;
>>
>> -				port@0 {
>> -					reg = <0>;
>> -					label = "wan";
>> -				};
>> -
>> 				port@1 {
>> 					reg = <1>;
>> 					label = "lan0";
> 
> Hi
> 
> I still see Problem with "renaming" the wan from users PoV. I got another way of using second gmac for wan some time ago using vlan-aware bridge (have not tested with recent kernel versions).
> 
> Maybe this works for you too? If yes imho it will be a better way.
> 
> https://github.com/frank-w/BPI-Router-Linux/commit/c92b648bac996b34dc75a4fff15d7fb429bfe74b

Frank, the comment section of that page is full of my comments testing 
it out and chatting with you. I don't understand why you're wording it 
like it's new to me.

> 
> Have same for r64/mt7622 in my tree...
> 
> It should use eth1 for wan-traffic too but is full userspace configuration without breaking userspace for users not wanting it.

If your argument is that connecting the wan port to the second mac 
should stay off mainline and to be left to the individual to do so, to 
not break the existing userspace configuration, this hack will need much 
more complex changes to the userspace configuration compared to this patch.

On top of this, you still need to change the devicetree to enable gmac1. 
And it will cause issues due to the nature of this method. Frames with 
the same MAC address will appear on different interfaces which will 
flood the kernel log, if eth1 were to be put in a bridge with other 
interfaces.

To summarise:
					This patch	Your method
Changes to the devicetree		Yes	(-)	Yes	(-)
Changes to the userspace configuration	Yes	(-)	Yes	(-)
Changes required in userspace		Simple	(+)	Complex	(-)
Does it work properly?			Yes	(+)	No	(-)

Using this patch would be the proper way to connect the wan port to the 
second mac.

I can also argue that I see no good reason to not want this, therefore 
this should be the default way. The UTP port for the wan port is 
seperated from the other 4 ports which already supports that this 
should've been there when the DT of this device was added in the first 
place.

If someone were to not want this, they could change the devicetree to 
fit their own purpose.

I did this on GnuBee GB-PC1 and it was easily addressed on gnubee-tools, 
a tool for building a firmware image for the said device.

https://github.com/neilbrown/gnubee-tools/commit/e1cdab9fd5f03ec4582176ab6eac9157df2a6f21

To conclude, in my opinion, gaining 2 Gbps total bandwidth to the CPU at 
the expense of a tiny change in userspace configuration is absolutely 
worth it. You clearly don't think that way and that's fine. It's up to 
the maintainer, Matthias, to decide. Matthias can take the remaining 
patches if they please.

Arınç
Frank Wunderlich Feb. 3, 2023, 6:54 p.m. UTC | #3
Am 3. Februar 2023 19:20:48 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:
>On 3.02.2023 18:36, Frank Wunderlich wrote:
>> Am 1. Februar 2023 19:56:55 MEZ schrieb arinc9.unal@gmail.com:
>>> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>>> 
>>> Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
>>> This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.
>>> 
>>> With this, the interface name to access phy0 changes from wan to eth1.
>>> 
>>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>>> ---
>>> arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 15 ++++++++++-----
>>> 1 file changed, 10 insertions(+), 5 deletions(-)
>>> 
>>> diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>>> index dc9b4f99eb8b..64700253fd35 100644
>>> --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>>> +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
>>> @@ -182,6 +182,12 @@ fixed-link {
>>> 	};
>>> };
>>> 
>>> +&gmac1 {
>>> +	status = "okay";
>>> +	phy-mode = "rgmii";
>>> +	phy-handle = <&ethphy0>;
>>> +};
>>> +
>>> &eth {
>>> 	status = "okay";
>>> 
>>> @@ -189,6 +195,10 @@ mdio-bus {
>>> 		#address-cells = <1>;
>>> 		#size-cells = <0>;
>>> 
>>> +		ethphy0: ethernet-phy@0 {
>>> +			reg = <0>;
>>> +		};
>>> +
>>> 		switch@1f {
>>> 			compatible = "mediatek,mt7530";
>>> 			reg = <0x1f>;
>>> @@ -200,11 +210,6 @@ ports {
>>> 				#address-cells = <1>;
>>> 				#size-cells = <0>;
>>> 
>>> -				port@0 {
>>> -					reg = <0>;
>>> -					label = "wan";
>>> -				};
>>> -
>>> 				port@1 {
>>> 					reg = <1>;
>>> 					label = "lan0";
>> 
>> Hi
>> 
>> I still see Problem with "renaming" the wan from users PoV. I got another way of using second gmac for wan some time ago using vlan-aware bridge (have not tested with recent kernel versions).
>> 
>> Maybe this works for you too? If yes imho it will be a better way.
>> 
>> https://github.com/frank-w/BPI-Router-Linux/commit/c92b648bac996b34dc75a4fff15d7fb429bfe74b
>
>Frank, the comment section of that page is full of my comments testing it out and chatting with you. I don't understand why you're wording it like it's new to me.

Not new,but you have not told me the issues you have with this way.

>> 
>> Have same for r64/mt7622 in my tree...
>> 
>> It should use eth1 for wan-traffic too but is full userspace configuration without breaking userspace for users not wanting it.
>
>If your argument is that connecting the wan port to the second mac should stay off mainline and to be left to the individual to do so, to not break the existing userspace configuration, this hack will need much more complex changes to the userspace configuration compared to this patch.

Yes,userspace config is more complex,but till now i thought both ways had same result except that user can decide if he wants interface name changed. I try to find some time to test your approach this weekend.

>On top of this, you still need to change the devicetree to enable gmac1. And it will cause issues due to the nature of this method. Frames with the same MAC address will appear on different interfaces which will flood the kernel log, if eth1 were to be put in a bridge with other interfaces.

This information is new to me. Had only made some basic tests with the way in my repo and did not noticed this flooding.

>To summarise:
>					This patch	Your method
>Changes to the devicetree		Yes	(-)	Yes	(-)
>Changes to the userspace configuration	Yes	(-)	Yes	(-)
>Changes required in userspace		Simple	(+)	Complex	(-)
>Does it work properly?			Yes	(+)	No	(-)
>
>Using this patch would be the proper way to connect the wan port to the second mac.
>
>I can also argue that I see no good reason to not want this, therefore this should be the default way. The UTP port for the wan port is seperated from the other 4 ports which already supports that this should've been there when the DT of this device was added in the first place.

There was a hope that dsa will support multiple cpu ports some time and there are several attempts to get it into mainline.

>If someone were to not want this, they could change the devicetree to fit their own purpose.
>
>To conclude, in my opinion, gaining 2 Gbps total bandwidth to the CPU at the expense of a tiny change in userspace configuration is absolutely worth it. You clearly don't think that way and that's fine. It's up to the maintainer, Matthias, to decide. Matthias can take the remaining patches if they please.

I appreciate you efforts to getting better performance here. Idk how many users will benefit from it...i have only 25mbit/s connection and can configure my dt/userspace...only thought about users not able to do so and may confused by this and do not "need" the change.

>Arınç


regards Frank
Frank Wunderlich Feb. 4, 2023, 10:27 a.m. UTC | #4
Hi aranc,

have tested this series, basicly it works, but i get only ~620 Mbits/sec (much more i will need on wan) in tx-mode of r2, rx-mode (iperf3 -c IP -R on r2) gets full 939 Mbits/sec. Both no retransmitts.

tried with my laptop which gets 940Mbit/sec in tx mode too...other end is a R2 with 5.15 connected to lan0 (and eth1+aux enabled, dmesg clean so far...for the "kernel log flooded"-comment).

maybe gmac1 needs to be tweaked a bit (clock-settings)?

can you confirm this with your board?

regards Frank
Frank Wunderlich Feb. 4, 2023, 11:43 a.m. UTC | #5
> Gesendet: Samstag, 04. Februar 2023 um 11:27 Uhr
> Von: "Frank Wunderlich" <frank-w@public-files.de>
> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>
> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
> Betreff: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>
> Hi aranc,
> 
> have tested this series, basicly it works, but i get only ~620 Mbits/sec (much more i will need on wan) in tx-mode of r2, rx-mode (iperf3 -c IP -R on r2) gets full 939 Mbits/sec. Both no retransmitts.
> 
> tried with my laptop which gets 940Mbit/sec in tx mode too...other end is a R2 with 5.15 connected to lan0 (and eth1+aux enabled, dmesg clean so far...for the "kernel log flooded"-comment).
> 
> maybe gmac1 needs to be tweaked a bit (clock-settings)?
> 
> can you confirm this with your board?

tested the vlan_aware way with 5.15.80 and got better result

ip link add br0 type bridge vlan_filtering 1
ip l set aux master br0
ip l set wan master br0
bridge vlan add vid 99 dev wan
bridge vlan add vid 99 dev aux
bridge vlan
ip l s eth1 up
ip l s wan up
ip a a 192.168.0.11/24 dev eth1
ip l s br0 up
ip l s aux up

i see traffic on eth1 increasing and iperf3 shows in both directions ~940Mbit/s, no strange mesages in dmesg while testing...where do you see these?

tested vlan-way with 6.2 and felix' Patches to more comparable with your test...and got same result (~625Mbit/s in tx and 940Mbit/s in rx-mode=-R on r2)...so it seems anything between 5.15 and 6.2 reduced gmac1 tx bandwidth.

to summarize:

i get same result with your patches and my old vlan_bridge way with same codebase...how do i see your problem with the vlan-bridge-way? Do you test with bpi-r2 or only any other board and change r2 to have same DT?

regards Frank
Arınç ÜNAL Feb. 4, 2023, 12:12 p.m. UTC | #6
On 4.02.2023 14:43, Frank Wunderlich wrote:
>> Gesendet: Samstag, 04. Februar 2023 um 11:27 Uhr
>> Von: "Frank Wunderlich" <frank-w@public-files.de>
>> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>
>> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
>> Betreff: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>>
>> Hi aranc,
>>
>> have tested this series, basicly it works, but i get only ~620 Mbits/sec (much more i will need on wan) in tx-mode of r2, rx-mode (iperf3 -c IP -R on r2) gets full 939 Mbits/sec. Both no retransmitts.
>>
>> tried with my laptop which gets 940Mbit/sec in tx mode too...other end is a R2 with 5.15 connected to lan0 (and eth1+aux enabled, dmesg clean so far...for the "kernel log flooded"-comment).
>>
>> maybe gmac1 needs to be tweaked a bit (clock-settings)?
>>
>> can you confirm this with your board?
> 
> tested the vlan_aware way with 5.15.80 and got better result
> 
> ip link add br0 type bridge vlan_filtering 1
> ip l set aux master br0
> ip l set wan master br0
> bridge vlan add vid 99 dev wan
> bridge vlan add vid 99 dev aux
> bridge vlan
> ip l s eth1 up
> ip l s wan up
> ip a a 192.168.0.11/24 dev eth1
> ip l s br0 up
> ip l s aux up
> 
> i see traffic on eth1 increasing and iperf3 shows in both directions ~940Mbit/s, no strange mesages in dmesg while testing...where do you see these?

You didn't put eth1 on a bridge. I suggest you read my mails with higher 
attention so both of our time is spent efficiently.

> 
> tested vlan-way with 6.2 and felix' Patches to more comparable with your test...and got same result (~625Mbit/s in tx and 940Mbit/s in rx-mode=-R on r2)...so it seems anything between 5.15 and 6.2 reduced gmac1 tx bandwidth.

I don't see an incentive to investigate unless the issue is confirmed on 
a daily netdev/net-next.git main tree.

> 
> to summarize:
> 
> i get same result with your patches and my old vlan_bridge way with same codebase...how do i see your problem with the vlan-bridge-way? Do you test with bpi-r2 or only any other board and change r2 to have same DT?

I tested this only on a Bananapi BPI-R2 using the devicetree with this 
series applied on a few days old netdev/net-next.git main tree.

Arınç
Frank Wunderlich Feb. 4, 2023, 1:07 p.m. UTC | #7
Hi

> Gesendet: Samstag, 04. Februar 2023 um 13:12 Uhr
> Von: "Arınç ÜNAL" <arinc.unal@arinc9.com>
> An: "Frank Wunderlich" <frank-w@public-files.de>
> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
> Betreff: Re: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>
> On 4.02.2023 14:43, Frank Wunderlich wrote:
> >> Gesendet: Samstag, 04. Februar 2023 um 11:27 Uhr
> >> Von: "Frank Wunderlich" <frank-w@public-files.de>
> >> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>
> >> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
> >> Betreff: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
> >>
> >> Hi aranc,
> >>
> >> have tested this series, basicly it works, but i get only ~620 Mbits/sec (much more i will need on wan) in tx-mode of r2, rx-mode (iperf3 -c IP -R on r2) gets full 939 Mbits/sec. Both no retransmitts.
> >>
> >> tried with my laptop which gets 940Mbit/sec in tx mode too...other end is a R2 with 5.15 connected to lan0 (and eth1+aux enabled, dmesg clean so far...for the "kernel log flooded"-comment).
> >>
> >> maybe gmac1 needs to be tweaked a bit (clock-settings)?
> >>
> >> can you confirm this with your board?
> > 
> > tested the vlan_aware way with 5.15.80 and got better result
> > 
> > ip link add br0 type bridge vlan_filtering 1
> > ip l set aux master br0
> > ip l set wan master br0
> > bridge vlan add vid 99 dev wan
> > bridge vlan add vid 99 dev aux
> > bridge vlan
> > ip l s eth1 up
> > ip l s wan up
> > ip a a 192.168.0.11/24 dev eth1
> > ip l s br0 up
> > ip l s aux up
> > 
> > i see traffic on eth1 increasing and iperf3 shows in both directions ~940Mbit/s, no strange mesages in dmesg while testing...where do you see these?
> 
> You didn't put eth1 on a bridge. I suggest you read my mails with higher 
> attention so both of our time is spent efficiently.

sorry if i misseed this detail, but it was not part of the instructions i got from mtk and did not found it in our mail-conversion. why do i need to add the gmac into the bridge??

the gmac is connected physically to mt7531 p5, and my vlan_aware bridge bridges this port (aux=p5) with wan, 
so i see no need to add eth1 to this bridge too...traffic on wan is tagged with vlan 99 and leaving untagged
on aux which is arriving eth1...

> > tested vlan-way with 6.2 and felix' Patches to more comparable with your test...and got same result (~625Mbit/s in tx and 940Mbit/s in rx-mode=-R on r2)...so it seems anything between 5.15 and 6.2 reduced gmac1 tx bandwidth.
> 
> I don't see an incentive to investigate unless the issue is confirmed on 
> a daily netdev/net-next.git main tree.

have same result on net-next/main with your series, no additional patches on top except adding my build-script and defconfig.

> > 
> > to summarize:
> > 
> > i get same result with your patches and my old vlan_bridge way with same codebase...how do i see your problem with the vlan-bridge-way? Do you test with bpi-r2 or only any other board and change r2 to have same DT?
> 
> I tested this only on a Bananapi BPI-R2 using the devicetree with this 
> series applied on a few days old netdev/net-next.git main tree.

btw. i do this in my currently very limited free time in short chunks, so please forgive me if i miss a detail.

> Arınç
Arınç ÜNAL Feb. 4, 2023, 3:50 p.m. UTC | #8
On 4.02.2023 16:07, Frank Wunderlich wrote:
> Hi
> 
>> Gesendet: Samstag, 04. Februar 2023 um 13:12 Uhr
>> Von: "Arınç ÜNAL" <arinc.unal@arinc9.com>
>> An: "Frank Wunderlich" <frank-w@public-files.de>
>> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
>> Betreff: Re: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>>
>> On 4.02.2023 14:43, Frank Wunderlich wrote:
>>>> Gesendet: Samstag, 04. Februar 2023 um 11:27 Uhr
>>>> Von: "Frank Wunderlich" <frank-w@public-files.de>
>>>> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>
>>>> Cc: arinc9.unal@gmail.com, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
>>>> Betreff: Aw: Re: [PATCH v2 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>>>>
>>>> Hi aranc,
>>>>
>>>> have tested this series, basicly it works, but i get only ~620 Mbits/sec (much more i will need on wan) in tx-mode of r2, rx-mode (iperf3 -c IP -R on r2) gets full 939 Mbits/sec. Both no retransmitts.
>>>>
>>>> tried with my laptop which gets 940Mbit/sec in tx mode too...other end is a R2 with 5.15 connected to lan0 (and eth1+aux enabled, dmesg clean so far...for the "kernel log flooded"-comment).
>>>>
>>>> maybe gmac1 needs to be tweaked a bit (clock-settings)?
>>>>
>>>> can you confirm this with your board?
>>>
>>> tested the vlan_aware way with 5.15.80 and got better result
>>>
>>> ip link add br0 type bridge vlan_filtering 1
>>> ip l set aux master br0
>>> ip l set wan master br0
>>> bridge vlan add vid 99 dev wan
>>> bridge vlan add vid 99 dev aux
>>> bridge vlan
>>> ip l s eth1 up
>>> ip l s wan up
>>> ip a a 192.168.0.11/24 dev eth1
>>> ip l s br0 up
>>> ip l s aux up
>>>
>>> i see traffic on eth1 increasing and iperf3 shows in both directions ~940Mbit/s, no strange mesages in dmesg while testing...where do you see these?
>>
>> You didn't put eth1 on a bridge. I suggest you read my mails with higher
>> attention so both of our time is spent efficiently.
> 
> sorry if i misseed this detail, but it was not part of the instructions i got from mtk and did not found it in our mail-conversion. why do i need to add the gmac into the bridge??

I was going to say, to put the host(s) connected to the wan port on the 
same network as other ports, but using the wan interface for that 
instead would work. Cool, we can cross this off the list.

> 
> the gmac is connected physically to mt7531 p5, and my vlan_aware bridge bridges this port (aux=p5) with wan,
> so i see no need to add eth1 to this bridge too...traffic on wan is tagged with vlan 99 and leaving untagged
> on aux which is arriving eth1...
> 
>>> tested vlan-way with 6.2 and felix' Patches to more comparable with your test...and got same result (~625Mbit/s in tx and 940Mbit/s in rx-mode=-R on r2)...so it seems anything between 5.15 and 6.2 reduced gmac1 tx bandwidth.
>>
>> I don't see an incentive to investigate unless the issue is confirmed on
>> a daily netdev/net-next.git main tree.
> 
> have same result on net-next/main with your series, no additional patches on top except adding my build-script and defconfig.

Finding the cause of reduced network performance is quite a challenging 
task. The only person I know that gives this a serious approach is Rafał 
Miłecki. There are scripts and things they share on the openwrt-devel 
mailing list along with details of their investigation, usually for 
Broadcom SoCs.

I'm no good in this so I'm not going to do anything about it. There are 
issues with the MediaTek ethernet and MT7530 DSA subdriver that 
completely break communication which I want to have them addressed.

Arınç
Arınç ÜNAL Feb. 8, 2023, 6:47 p.m. UTC | #9
OK, hold this patch series, I'm going to send v3 soon with enabling both 
CPU ports to support changing the DSA master. We've got developments on 
the MediaTek ethernet driver and MT7530 DSA subdriver that surpassed my 
expectations.

Arınç

On 1.02.2023 21:56, arinc9.unal@gmail.com wrote:
> From: Arınç ÜNAL <arinc.unal@arinc9.com>
> 
> Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
> This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.
> 
> With this, the interface name to access phy0 changes from wan to eth1.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>   arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> index dc9b4f99eb8b..64700253fd35 100644
> --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> @@ -182,6 +182,12 @@ fixed-link {
>   	};
>   };
>   
> +&gmac1 {
> +	status = "okay";
> +	phy-mode = "rgmii";
> +	phy-handle = <&ethphy0>;
> +};
> +
>   &eth {
>   	status = "okay";
>   
> @@ -189,6 +195,10 @@ mdio-bus {
>   		#address-cells = <1>;
>   		#size-cells = <0>;
>   
> +		ethphy0: ethernet-phy@0 {
> +			reg = <0>;
> +		};
> +
>   		switch@1f {
>   			compatible = "mediatek,mt7530";
>   			reg = <0x1f>;
> @@ -200,11 +210,6 @@ ports {
>   				#address-cells = <1>;
>   				#size-cells = <0>;
>   
> -				port@0 {
> -					reg = <0>;
> -					label = "wan";
> -				};
> -
>   				port@1 {
>   					reg = <1>;
>   					label = "lan0";
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
index dc9b4f99eb8b..64700253fd35 100644
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
@@ -182,6 +182,12 @@  fixed-link {
 	};
 };
 
+&gmac1 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&ethphy0>;
+};
+
 &eth {
 	status = "okay";
 
@@ -189,6 +195,10 @@  mdio-bus {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		ethphy0: ethernet-phy@0 {
+			reg = <0>;
+		};
+
 		switch@1f {
 			compatible = "mediatek,mt7530";
 			reg = <0x1f>;
@@ -200,11 +210,6 @@  ports {
 				#address-cells = <1>;
 				#size-cells = <0>;
 
-				port@0 {
-					reg = <0>;
-					label = "wan";
-				};
-
 				port@1 {
 					reg = <1>;
 					label = "lan0";