diff mbox series

[LEDE-DEV,v2] ramips: fix GL-inet GL-MT300N-V2 LAN MAC address

Message ID 1521536054-31695-1-git-send-email-kysonlok@gmail.com
State Rejected
Delegated to: Mathias Kresin
Headers show
Series [LEDE-DEV,v2] ramips: fix GL-inet GL-MT300N-V2 LAN MAC address | expand

Commit Message

Kyson Lok March 20, 2018, 8:54 a.m. UTC
Override the LAN MAC to use the same address as WAN.
The stock firmware uses the same MAC address for all
interfaces.

Signed-off-by: Kyson Lok <kysonlok@gmail.com>
---
 target/linux/ramips/base-files/etc/board.d/02_network | 1 +
 1 file changed, 1 insertion(+)

Comments

Koen Vandeputte March 20, 2018, 9:22 a.m. UTC | #1
On 2018-03-20 09:54, Kyson Lok wrote:
> Override the LAN MAC to use the same address as WAN.
> The stock firmware uses the same MAC address for all
> interfaces.
Besides blindly following the stock firmware behavior,
is there *any* advantage in doing this?
>
> Signed-off-by: Kyson Lok <kysonlok@gmail.com>
> ---
>   target/linux/ramips/base-files/etc/board.d/02_network | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
> index 03f718e..c26d77f 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -441,6 +441,7 @@ ramips_setup_macs()
>   		wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
>   		;;
>   	gl-mt300n-v2)
> +		lan_mac=$(mtd_get_mac_binary factory 4)
>   		wan_mac=$(mtd_get_mac_binary factory 4)
>   		;;
>   	hc5*61|\
Kyson Lok March 20, 2018, 11 a.m. UTC | #2
Here is our customer's issue.

> Flash Openwrt snapshot from https://downloads.openwrt.org/snapshots/targets/ramips/mt76x8/openwrt-ramips-mt76x8-gl-mt300n-v2-squashfs-sysupgrade.bin
>
> Install luci, luci-sqm-app packages
>
> Configure SQM QoS by setting interface name to eth0.2 and entering download and upload speeds (my upload speed is lower than download)
>
> Click Save & Apply
>
> Start a large download or speedtest
>
> Actual results:
>
> Download speed is capped to the upload speed
>
> Expected results:
>
> Download speed should be close to the download speed entered
>
> Stock firmware does not have this bug. In stock firmware (I used 2.27-testing), /etc/config/network contains the section “config device ‘lan_dev’”.
> This section is missing in the Openwrt snapshots. Copying this 3-line section from stock firmware to Openwrt snapshot fixes the bug. The only
> drawback I found is that the MAC address cannot be changed with the luci interface, it can still be changed by editing /etc/config/network.


On Tue, Mar 20, 2018 at 5:22 PM, Koen Vandeputte
<koen.vandeputte@ncentric.com> wrote:
>
>
> On 2018-03-20 09:54, Kyson Lok wrote:
>>
>> Override the LAN MAC to use the same address as WAN.
>> The stock firmware uses the same MAC address for all
>> interfaces.
>
> Besides blindly following the stock firmware behavior,
> is there *any* advantage in doing this?
>
>>
>> Signed-off-by: Kyson Lok <kysonlok@gmail.com>
>> ---
>>   target/linux/ramips/base-files/etc/board.d/02_network | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network
>> b/target/linux/ramips/base-files/etc/board.d/02_network
>> index 03f718e..c26d77f 100755
>> --- a/target/linux/ramips/base-files/etc/board.d/02_network
>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
>> @@ -441,6 +441,7 @@ ramips_setup_macs()
>>                 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
>>                 ;;
>>         gl-mt300n-v2)
>> +               lan_mac=$(mtd_get_mac_binary factory 4)
>>                 wan_mac=$(mtd_get_mac_binary factory 4)
>>                 ;;
>>         hc5*61|\
>
>
Mathias Kresin March 20, 2018, 11:40 a.m. UTC | #3
20.03.2018 10:22, Koen Vandeputte:
> 
> 
> On 2018-03-20 09:54, Kyson Lok wrote:
>> Override the LAN MAC to use the same address as WAN.
>> The stock firmware uses the same MAC address for all
>> interfaces.
> Besides blindly following the stock firmware behavior,
> is there *any* advantage in doing this?

The general idea is to not use MAC-Addresses which are not assigned 
to/reserved for this particular board.

Mathias
Mathias Kresin March 20, 2018, 11:50 a.m. UTC | #4
20.03.2018 09:54, Kyson Lok:
> Override the LAN MAC to use the same address as WAN.
> The stock firmware uses the same MAC address for all
> interfaces.
> 
> Signed-off-by: Kyson Lok <kysonlok@gmail.com>
> ---
>   target/linux/ramips/base-files/etc/board.d/02_network | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
> index 03f718e..c26d77f 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -441,6 +441,7 @@ ramips_setup_macs()
>   		wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
>   		;;
>   	gl-mt300n-v2)
> +		lan_mac=$(mtd_get_mac_binary factory 4)
>   		wan_mac=$(mtd_get_mac_binary factory 4)
>   		;;
>   	hc5*61|\
> 

This change looks unnecessary to me. The very same MAC-Address should be 
already assigned via the dts:

88 &ethernet {
89         mtd-mac-address = <&factory 0x4>;
90 };

As far as I remember, the WAN MAC-Address is only set because the switch 
driver autoincrements the base MAC-Address for the second vlan (if not 
for each vlan). Hopefully I don't mix the different switch drivers here, 
at least one of the ramips switch driver does this autoincrement.

Long story short, I either fail hard or this change triggers something 
else which fixes your customers issue.

Mathias
diff mbox series

Patch

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 03f718e..c26d77f 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -441,6 +441,7 @@  ramips_setup_macs()
 		wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
 		;;
 	gl-mt300n-v2)
+		lan_mac=$(mtd_get_mac_binary factory 4)
 		wan_mac=$(mtd_get_mac_binary factory 4)
 		;;
 	hc5*61|\