[OpenWrt-Devel] RFC: Put both Carambola2 eth ports in hardware switch

Harald Welte laforge at gnumonks.org
Sun Sep 7 00:10:20 EDT 2014


Hi all,

in the OpenWRT Carambola2 machine code, the two physical ethernet ports
are configured to appear as separate Ethernet devices under Linux.  eth0
is the MAC that connects to the internal switch, of which port 2 is
physically routed to the ethernet pads of the module.  eth1 is another
MAC which connects directly to one PHY, bypassing the switch and
accessible via another set of ethernet pads on the module

However, in some applications, the two ports of the Carambola2 module
would need to be used in a switched configuration.  Rather than
configuring a software bridge under Linux and suffering the associated
CPU overhead, we can make a slight change to the board setup code and
achieve this.  The proof-of-concept patch below implements this.

Of course, this feature should not be a standard feature, as most people
probably don't want this.  So the question is how would you want to
represent this in the codebase?
* should it become a Kconfig option with associated #ifdefs ?
* should it depend on a kernel boot command line argument? If so, do you
  have a preferred naming scheme?
* should it use yet some other mechanism?

I would prefer the kernel command line option, as it means that one
kernel can run on all machines, and it would just be a change to the
u-boot environemnt on those devices where needed.

Please let me know what is your preferred approach and I'll submit a
proper patch.

Regards,
	Harald

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c
index babe101..4a5faf2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c
@@ -69,7 +69,7 @@ static void __init carambola2_common_setup(void)
 	ath79_register_wmac(art + CARAMBOLA2_CALDATA_OFFSET,
 			    art + CARAMBOLA2_WMAC_MAC_OFFSET);
 
-	ath79_setup_ar933x_phy4_switch(true, true);
+	ath79_setup_ar933x_phy4_switch(false, false);
 
 	ath79_init_mac(ath79_eth0_data.mac_addr, art + CARAMBOLA2_MAC0_OFFSET, 0);
 	ath79_init_mac(ath79_eth1_data.mac_addr, art + CARAMBOLA2_MAC1_OFFSET, 0);
@@ -78,9 +78,6 @@ static void __init carambola2_common_setup(void)
 
 	/* LAN ports */
 	ath79_register_eth(1);
-
-	/* WAN port */
-	ath79_register_eth(0);
 }
 
 static void __init carambola2_setup(void)
-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list