How to correctly define switch ports in image?

Hi all,

I've been working on adding support to the Netgear EX6200 and documenting my adventures in this post).

I've thankfully got an initramfs install working and am poking around to see what works and what doesn't.

The first issue I've come across is that the ethernet devices do not display correctly. I see an eth0 but I do not see any switch ports (for reference this device has 5 LAN ports, no WAN port). The functionality is there; currently I have a cable from a working switch plugged into the device and two clients plugged in as well and both clients are able to receive an IP address from the upstream router. I cannot however remove switch ports from the bridge as they don't appear in the drop down.

My question is, where should I look to start chasing this down?

My first guess was to edit the 02_network file in board.d

I copied the configuration of another netgear device on here (understanding that the actual ports are wrong) just to see if the switch would appear but no dice.

negear,EX6200v2)
                ucidef_set_interface_lan "eth0"
                ucidef_add_switch "switch0" \
                        "0u@eth0" "2:lan" "3:lan" "4:lan"
                
                ;;

The other thought I had was that it might have to do with the dtsi file I used.
I used the ex61x0v2.dtsi as a starting point and I realize that the devices that that is written for (EX6100v2 and EX6200v2) have a single ethernet port so that might be a culprit. But before I dive too into the weeds, I wanted to ask the community to see which is the right tree I should be barking up.

I'm not an expert on this, since I've never worked on the ipq40xx target, but:

  1. you have a typo in your code, you called it "negear" instead of "netgear".
  2. This is the old syntax before the introduction of the DSA driver for the ipq40xx target. Have a look at the following commit how the conversion is done: https://github.com/openwrt/openwrt/commit/550253bdf99280b3017baf56dec36406fa395734

If you're working on adding new device support, you need to target master anyways (as that's the only way to get your changes merged) - and that changes the situation completely in regards to the switch setup (to the better), as master is using DSA already (where all these things finally work as expected).

thank you @andyboeh @slh, I think biggest takeaway from your responses is that I'm working out of an older branch; following a tutorial I selected 22.03.02 since that's what I use on other devices, I didn't realize that would result in so many headaches. Because of this, files weren't setup for DSA in what I was referencing, I've since recloned the repository and started over from the master.

What I see now is that the devices I was using as a starting point do not have a DSA setup so that's something I'll have to try to build out. For reference are DSA setups defined in .dts files?

define Device/netgear_ex6100v2
        $(call Device/netgear_ex61x0v2)
        DEVICE_MODEL := EX6100
        DEVICE_VARIANT := v2
endef
# Missing DSA Setup
#TARGET_DEVICES += netgear_ex6100v2

define Device/netgear_ex6150v2
        $(call Device/netgear_ex61x0v2)
        DEVICE_MODEL := EX6150
        DEVICE_VARIANT := v2
endef
# Missing DSA Setup
#TARGET_DEVICES += netgear_ex6150v2

To some extent, just check the git history for DSA conversions of similar (ipq40xx-) devices.

1 Like

Thankfully I was able to get this resolved the other day and got a working DSA setup and thus all 5 lan ports displaying in LUCI correctly.

This next task I'm trying to complete (LED behaviors) is unrelated to the title of this post so maybe it'll warrant another post, but for now I'll list it here.

I've identified the GPIO for LEDs, however I'm unable to figure out how to tie the on/off status to certain function; as of now all lights stay on. and yes I did check other commits to try to spot a difference but no luck. Below is a screenshot off the official manual which lists the default behaviors. I don't necessarily want to emulate the exact behavior but at least set the 2.4 and 5ghz lights to turn green when the radios are on, and the green 'Device to Extender' light to function as an activity light. I'd also like the usb light to only be active when a usb device is connected.

As I mentioned, with the current DTS and 01_led files (pasted below, respectively), all lights stay on. I suspect that the last entry for a ucidef_set_led_"device" is supposed to tie the light to a physical trigger but a) I'm not sure if this is a correct assumption and b) I'm not sure if I'm using the correct name for the physical trigger, is there a way I can see how these are defined so to be sure I'm using the correct names?

Or am I completely off track and are these light behaviors actually set elsewhere?

Another question on defining LEDs within the DTS file for my own enrichment; in the example below, I've seen different dts files use &tlmm and &led_gpio, I've tried both with no success, but I'm not sure what the difference between the two, I imagine the two aren't interchangeable but what's the difference & how would I determine which is correct?

gpios = <&tlmm 407 GPIO_ACTIVE_LOW>;
leds {
                compatible = "gpio-leds";
                power_amber: power_amber {
                        label = "amber:power";

                };

                power_green: power_green {
                        label = "green:power";

                };

                wlan2g_red {
                        label = "red:wlan2g";
                        gpios = <&tlmm 407 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };

                wlan2g_green {
                        label = "green:wlan2g";
                        gpios = <&tlmm 408 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };

                wlan5g_red {
                        label = "red:wlan5g";
                        gpios = <&tlmm 405 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };

                wlan5g_green {
                        label = "green:wlan5g";
                        gpios = <&tlmm 406 GPIO_ACTIVE_LOW>;
                default-state = "off";
                };
                

                usb_green {
                        label = "green:usb";
                        gpios = <&tlmm 404 GPIO_ACTIVE_LOW>;    
                        default-state = "off";
                };
router_green {
                        label = "green:router";
                        gpios = <&tlmm 409 GPIO_ACTIVE_LOW>;            
                };

                router_red {
                        label = "red:router";
                        gpios = <&tlmm 410 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };

                wps {
                        label = "green:wps";
                
                };
        };

netgear,ex6200v2)
        ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1"
        ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2"
        ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3"
        ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4"
        ucidef_set_led_netdev "lan5" "LAN5" "green:lan5" "lan5"
        ucidef_set_led_netdev "lan" "LAN" "green:router" "eth0"
        ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt"
        ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy1tpt"
        ucidef_set-led_usb "usb" "USB" "green:usb" "usbport"    
        ;;

Give the LEDs the correct dts label. so OpenWrt's default LED functions can make use of them - beyond that, keep it simple. Trying to replicate the OEM behaviour is difficult and easily more confusing than generic 'stock' OpenWrt behaviour.

thank you, that's good advice, I didn't realize OpenWrt had default functions and standard labels. Can you point me to the documentation (or at least what keywords to search for) to find what the correct dts labels should be?

1 Like

Can you write the details? How did you resolve this problem?

I am also learning to develop and I am running at the same problem, my router can see all WiFi interfaces but the Ethernet interfaces does not appear to work

1 Like