diff mbox series

[2/2] ARM: dts: BCM5301X: Set fixed-link for extra Netgear R8000 CPU ports

Message ID 20231013103314.10306-2-zajec5@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] ARM: dts: BCM5301X: Explicitly disable unused switch CPU ports | expand

Commit Message

Rafał Miłecki Oct. 13, 2023, 10:33 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

While switch ports 5 and 7 are disabled (vendor designed port 8 to be
used for CPU traffic) they could be used strictly technically. For some
reason however both those ports need forcing link to be usable.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Andrew Lunn Oct. 14, 2023, 4:50 p.m. UTC | #1
On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
> used for CPU traffic) they could be used strictly technically. For some
> reason however both those ports need forcing link to be usable.

This explanation is not making much sense to me.

I assume this board does not have an RJ45 for these two ports? But
does it have a header so you can access the MII interface?

     Andrew
Rafał Miłecki Oct. 16, 2023, 3:36 p.m. UTC | #2
On 2023-10-14 18:50, Andrew Lunn wrote:
> On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>> 
>> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
>> used for CPU traffic) they could be used strictly technically. For 
>> some
>> reason however both those ports need forcing link to be usable.
> 
> This explanation is not making much sense to me.
> 
> I assume this board does not have an RJ45 for these two ports? But
> does it have a header so you can access the MII interface?

This PATCH as it is requires a basic familiarity with Northstar platform
or checking bcm-ns.dtsi.

All Northstar (BCM5301X) devices have 3 Ethernet interfaces. 99% of them
have:
1. gmac0 connected to port 5
2. gmac1 connected to port 7
3. gmac2 connected to port 8
(it's described in bcm-ns.dtsi).


Some vendors decide to use gmac0 and switch port 5. They fill NVRAM with
MAC for gmac0.

Some vendors decide to use gmac2 & port 8. They set MAC for gmac2.


Netgear decided to use gmac2 & port 8 for R8000. They fill NVRAM with
MAC for gmac2.

If you however insist on using gmac0 you could do that. That just
requires setting up gmac0 with a custom/random MAC and forcing link for
switch ports as described in this PATCH.


Does it make sense now? Should I reword this commit somehow?
Andrew Lunn Oct. 16, 2023, 3:45 p.m. UTC | #3
On Mon, Oct 16, 2023 at 05:36:24PM +0200, Rafał Miłecki wrote:
> On 2023-10-14 18:50, Andrew Lunn wrote:
> > On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
> > > From: Rafał Miłecki <rafal@milecki.pl>
> > > 
> > > While switch ports 5 and 7 are disabled (vendor designed port 8 to be
> > > used for CPU traffic) they could be used strictly technically. For
> > > some
> > > reason however both those ports need forcing link to be usable.
> > 
> > This explanation is not making much sense to me.
> > 
> > I assume this board does not have an RJ45 for these two ports? But
> > does it have a header so you can access the MII interface?
> 
> This PATCH as it is requires a basic familiarity with Northstar platform
> or checking bcm-ns.dtsi.
> 
> All Northstar (BCM5301X) devices have 3 Ethernet interfaces. 99% of them
> have:
> 1. gmac0 connected to port 5
> 2. gmac1 connected to port 7
> 3. gmac2 connected to port 8
> (it's described in bcm-ns.dtsi).
> 
> 
> Some vendors decide to use gmac0 and switch port 5. They fill NVRAM with
> MAC for gmac0.
> 
> Some vendors decide to use gmac2 & port 8. They set MAC for gmac2.
> 
> 
> Netgear decided to use gmac2 & port 8 for R8000. They fill NVRAM with
> MAC for gmac2.
> 
> If you however insist on using gmac0 you could do that. That just
> requires setting up gmac0 with a custom/random MAC and forcing link for
> switch ports as described in this PATCH.

If the ports are not used, you have them set to disabled, why do they
need a fixed-link? That is what i don't understand yet.

     Andrew
Florian Fainelli Oct. 18, 2023, 6:10 p.m. UTC | #4
On 10/16/23 08:45, Andrew Lunn wrote:
> On Mon, Oct 16, 2023 at 05:36:24PM +0200, Rafał Miłecki wrote:
>> On 2023-10-14 18:50, Andrew Lunn wrote:
>>> On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>
>>>> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
>>>> used for CPU traffic) they could be used strictly technically. For
>>>> some
>>>> reason however both those ports need forcing link to be usable.
>>>
>>> This explanation is not making much sense to me.
>>>
>>> I assume this board does not have an RJ45 for these two ports? But
>>> does it have a header so you can access the MII interface?
>>
>> This PATCH as it is requires a basic familiarity with Northstar platform
>> or checking bcm-ns.dtsi.
>>
>> All Northstar (BCM5301X) devices have 3 Ethernet interfaces. 99% of them
>> have:
>> 1. gmac0 connected to port 5
>> 2. gmac1 connected to port 7
>> 3. gmac2 connected to port 8
>> (it's described in bcm-ns.dtsi).
>>
>>
>> Some vendors decide to use gmac0 and switch port 5. They fill NVRAM with
>> MAC for gmac0.
>>
>> Some vendors decide to use gmac2 & port 8. They set MAC for gmac2.
>>
>>
>> Netgear decided to use gmac2 & port 8 for R8000. They fill NVRAM with
>> MAC for gmac2.
>>
>> If you however insist on using gmac0 you could do that. That just
>> requires setting up gmac0 with a custom/random MAC and forcing link for
>> switch ports as described in this PATCH.
> 
> If the ports are not used, you have them set to disabled, why do they
> need a fixed-link? That is what i don't understand yet.

It seems to me like the commit message could be reworded such that:

Even though ports 5 and 7 are disabled and the system is intended to use 
port 8, make it possible for users to experiment with using ports 5 
and/or 7 if they desire so by ensuring that they have the necessary 
'fixed-link' properties to describe the internal connection within the 
SoC between the switch ports and the two Ethernet controllers.

Rafal, does that capture the intent? If so I can amend the commit 
message while applying.
Rafał Miłecki Oct. 18, 2023, 8:04 p.m. UTC | #5
On 2023-10-16 17:45, Andrew Lunn wrote:
> On Mon, Oct 16, 2023 at 05:36:24PM +0200, Rafał Miłecki wrote:
>> On 2023-10-14 18:50, Andrew Lunn wrote:
>> > On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
>> > > From: Rafał Miłecki <rafal@milecki.pl>
>> > >
>> > > While switch ports 5 and 7 are disabled (vendor designed port 8 to be
>> > > used for CPU traffic) they could be used strictly technically. For
>> > > some
>> > > reason however both those ports need forcing link to be usable.
>> >
>> > This explanation is not making much sense to me.
>> >
>> > I assume this board does not have an RJ45 for these two ports? But
>> > does it have a header so you can access the MII interface?
>> 
>> This PATCH as it is requires a basic familiarity with Northstar 
>> platform
>> or checking bcm-ns.dtsi.
>> 
>> All Northstar (BCM5301X) devices have 3 Ethernet interfaces. 99% of 
>> them
>> have:
>> 1. gmac0 connected to port 5
>> 2. gmac1 connected to port 7
>> 3. gmac2 connected to port 8
>> (it's described in bcm-ns.dtsi).
>> 
>> 
>> Some vendors decide to use gmac0 and switch port 5. They fill NVRAM 
>> with
>> MAC for gmac0.
>> 
>> Some vendors decide to use gmac2 & port 8. They set MAC for gmac2.
>> 
>> 
>> Netgear decided to use gmac2 & port 8 for R8000. They fill NVRAM with
>> MAC for gmac2.
>> 
>> If you however insist on using gmac0 you could do that. That just
>> requires setting up gmac0 with a custom/random MAC and forcing link 
>> for
>> switch ports as described in this PATCH.
> 
> If the ports are not used, you have them set to disabled, why do they
> need a fixed-link? That is what i don't understand yet.

So developers/hackers can use them for custom needs by just dropping
"disabled" bit. That's a pretty simple step compared to figuring out
that a fixed link is needed.

I can imagine advanced users using extra ports and interfaces to get
higher speeds. If you use a single switch port and single interface
you're limited to 1 Gbps. By using two you can exceed that limitation.

This is clearly some corner case but I don't think it really violates
what DT is for. We just describe hardware more clearly. There is a fixed
link after all. That port just happens to be disabled.
Rafał Miłecki Oct. 18, 2023, 8:08 p.m. UTC | #6
On 2023-10-18 20:10, Florian Fainelli wrote:
> On 10/16/23 08:45, Andrew Lunn wrote:
>> On Mon, Oct 16, 2023 at 05:36:24PM +0200, Rafał Miłecki wrote:
>>> On 2023-10-14 18:50, Andrew Lunn wrote:
>>>> On Fri, Oct 13, 2023 at 12:33:14PM +0200, Rafał Miłecki wrote:
>>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>> 
>>>>> While switch ports 5 and 7 are disabled (vendor designed port 8 to 
>>>>> be
>>>>> used for CPU traffic) they could be used strictly technically. For
>>>>> some
>>>>> reason however both those ports need forcing link to be usable.
>>>> 
>>>> This explanation is not making much sense to me.
>>>> 
>>>> I assume this board does not have an RJ45 for these two ports? But
>>>> does it have a header so you can access the MII interface?
>>> 
>>> This PATCH as it is requires a basic familiarity with Northstar 
>>> platform
>>> or checking bcm-ns.dtsi.
>>> 
>>> All Northstar (BCM5301X) devices have 3 Ethernet interfaces. 99% of 
>>> them
>>> have:
>>> 1. gmac0 connected to port 5
>>> 2. gmac1 connected to port 7
>>> 3. gmac2 connected to port 8
>>> (it's described in bcm-ns.dtsi).
>>> 
>>> 
>>> Some vendors decide to use gmac0 and switch port 5. They fill NVRAM 
>>> with
>>> MAC for gmac0.
>>> 
>>> Some vendors decide to use gmac2 & port 8. They set MAC for gmac2.
>>> 
>>> 
>>> Netgear decided to use gmac2 & port 8 for R8000. They fill NVRAM with
>>> MAC for gmac2.
>>> 
>>> If you however insist on using gmac0 you could do that. That just
>>> requires setting up gmac0 with a custom/random MAC and forcing link 
>>> for
>>> switch ports as described in this PATCH.
>> 
>> If the ports are not used, you have them set to disabled, why do they
>> need a fixed-link? That is what i don't understand yet.
> 
> It seems to me like the commit message could be reworded such that:
> 
> Even though ports 5 and 7 are disabled and the system is intended to
> use port 8, make it possible for users to experiment with using ports
> 5 and/or 7 if they desire so by ensuring that they have the necessary
> 'fixed-link' properties to describe the internal connection within the
> SoC between the switch ports and the two Ethernet controllers.
> 
> Rafal, does that capture the intent? If so I can amend the commit
> message while applying.

I believe so. You're correct that in practice it's for experimenting
mainly. Formally it also describes hardware which DT is for.

I'm sure we can find a lot of *disabled* hardware blocks in Linux's DTS
files that are still described for the sake of documenting it.
Andrew Lunn Oct. 18, 2023, 8:09 p.m. UTC | #7
> So developers/hackers can use them for custom needs by just dropping
> "disabled" bit. That's a pretty simple step compared to figuring out
> that a fixed link is needed.
> 
> I can imagine advanced users using extra ports and interfaces to get
> higher speeds. If you use a single switch port and single interface
> you're limited to 1 Gbps. By using two you can exceed that limitation.
> 
> This is clearly some corner case but I don't think it really violates
> what DT is for. We just describe hardware more clearly. There is a fixed
> link after all. That port just happens to be disabled.

Please reformulate this into the commit message. Then it becomes a
good answer to the question `Why?` which is what the commit message is
all about.

    Andrew
Florian Fainelli Oct. 23, 2023, 6:33 p.m. UTC | #8
From: Florian Fainelli <f.fainelli@gmail.com>

On Fri, 13 Oct 2023 12:33:14 +0200, Rafał Miłecki <zajec5@gmail.com> wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
> used for CPU traffic) they could be used strictly technically. For some
> reason however both those ports need forcing link to be usable.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---

Applied to https://github.com/Broadcom/stblinux/commits/devicetree/next, thanks!
--
Florian
Florian Fainelli Oct. 23, 2023, 6:36 p.m. UTC | #9
On 10/23/23 11:33, Florian Fainelli wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> 
> On Fri, 13 Oct 2023 12:33:14 +0200, Rafał Miłecki <zajec5@gmail.com> wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
>> used for CPU traffic) they could be used strictly technically. For some
>> reason however both those ports need forcing link to be usable.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
> 
> Applied to https://github.com/Broadcom/stblinux/commits/devicetree/next, thanks!

Ended up with the following commit message:

Ports 5 and 7 are disabled by default because the standard use case is
for port 8 to manage all CPU directed traffic. For experimentation
purposes however it is desirable to provide adequate properties such
that people can experiment with using different ports without having to
figure out their configuration. Some of the use cases include but are
not limited to doubling or tripling the bandwidth by leveraging the
additional ports/Ethernet MAC combinations.


let me know if I should rephrase it before pushing this to the the ARM 
SoC maintainers (tomorrow).
Rafał Miłecki Oct. 23, 2023, 7:48 p.m. UTC | #10
On 2023-10-23 20:36, Florian Fainelli wrote:
> On 10/23/23 11:33, Florian Fainelli wrote:
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> 
>> On Fri, 13 Oct 2023 12:33:14 +0200, Rafał Miłecki <zajec5@gmail.com> 
>> wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>> 
>>> While switch ports 5 and 7 are disabled (vendor designed port 8 to be
>>> used for CPU traffic) they could be used strictly technically. For 
>>> some
>>> reason however both those ports need forcing link to be usable.
>>> 
>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>> ---
>> 
>> Applied to 
>> https://github.com/Broadcom/stblinux/commits/devicetree/next, thanks!
> 
> Ended up with the following commit message:
> 
> Ports 5 and 7 are disabled by default because the standard use case is
> for port 8 to manage all CPU directed traffic. For experimentation
> purposes however it is desirable to provide adequate properties such
> that people can experiment with using different ports without having to
> figure out their configuration. Some of the use cases include but are
> not limited to doubling or tripling the bandwidth by leveraging the
> additional ports/Ethernet MAC combinations.
> 
> 
> let me know if I should rephrase it before pushing this to the the ARM
> SoC maintainers (tomorrow).

Looks good, thank you!
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts b/arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts
index 55fc9f44cbc7..127ca8741220 100644
--- a/arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts
+++ b/arch/arm/boot/dts/broadcom/bcm4709-netgear-r8000.dts
@@ -229,10 +229,20 @@  port@4 {
 
 		port@5 {
 			status = "disabled";
+
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
 		};
 
 		port@7 {
 			status = "disabled";
+
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
 		};
 
 		port@8 {