diff mbox

[LEDE-DEV] lantiq: fix network in failsafe

Message ID 1466346655-25914-1-git-send-email-dev@kresin.me
State Accepted
Headers show

Commit Message

Mathias Kresin June 19, 2016, 2:30 p.m. UTC
So far the network in failsafe is setup only for one board. Use the
eth0 interface as lan interface for all boards for now.

If a board has its lan interface(s) on another eth, a special
handling based on the board name can be added.

Signed-off-by: Mathias Kresin <dev@kresin.me>
---
 .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Zhao, Gang June 20, 2016, 3:15 a.m. UTC | #1
Hi, Mathias Kresin

On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
> So far the network in failsafe is setup only for one board. Use the
> eth0 interface as lan interface for all boards for now.
>
> If a board has its lan interface(s) on another eth, a special
> handling based on the board name can be added.
>
> Signed-off-by: Mathias Kresin <dev@kresin.me>
> ---
>  .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
> index 3d7fabf..7ed0fab 100644
> --- a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
> +++ b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
> @@ -3,15 +3,7 @@
>  . /lib/functions/lantiq.sh
>
>  set_preinit_iface() {
> -
> -       board=$(lantiq_board_name)
> -
> -       case "$board" in
> -       TDW8970)
> -               ifname=eth0
> -               ;;
> -       esac
> -
> +       ifname=eth0

What about to add a default branch in case statement?

*)
    ifname=eth0
;;

>  }
>
>  boot_hook_add preinit_main set_preinit_iface
> --
> 1.9.1
>
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
John Crispin June 20, 2016, 5:19 a.m. UTC | #2
On 20/06/2016 05:15, Zhao, Gang wrote:
> Hi, Mathias Kresin
> 
> On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
>> So far the network in failsafe is setup only for one board. Use the
>> eth0 interface as lan interface for all boards for now.
>>
>> If a board has its lan interface(s) on another eth, a special
>> handling based on the board name can be added.
>>
>> Signed-off-by: Mathias Kresin <dev@kresin.me>
>> ---
>>  .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  | 10 +---------
>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> index 3d7fabf..7ed0fab 100644
>> --- a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> +++ b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> @@ -3,15 +3,7 @@
>>  . /lib/functions/lantiq.sh
>>
>>  set_preinit_iface() {
>> -
>> -       board=$(lantiq_board_name)
>> -
>> -       case "$board" in
>> -       TDW8970)
>> -               ifname=eth0
>> -               ;;
>> -       esac
>> -
>> +       ifname=eth0
> 
> What about to add a default branch in case statement?
> 
> *)
>     ifname=eth0
> ;;
> 

i am wondering if we should add a switch default config here or simply
reset the switch with vlans turned off

	John

>>  }
>>
>>  boot_hook_add preinit_main set_preinit_iface
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
>
Mathias Kresin June 20, 2016, 5:39 a.m. UTC | #3
Am 20.06.2016 um 07:19 schrieb John Crispin:
>
>
> On 20/06/2016 05:15, Zhao, Gang wrote:
>> Hi, Mathias Kresin
>>
>> On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
>>> So far the network in failsafe is setup only for one board. Use the
>>> eth0 interface as lan interface for all boards for now.
>>>
>>> If a board has its lan interface(s) on another eth, a special
>>> handling based on the board name can be added.
>>>
>>> Signed-off-by: Mathias Kresin <dev@kresin.me>
>>> ---
>>>   .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  | 10 +---------
>>>   1 file changed, 1 insertion(+), 9 deletions(-)
>>>
>>> diff --git a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>> index 3d7fabf..7ed0fab 100644
>>> --- a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>> +++ b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>> @@ -3,15 +3,7 @@
>>>   . /lib/functions/lantiq.sh
>>>
>>>   set_preinit_iface() {
>>> -
>>> -       board=$(lantiq_board_name)
>>> -
>>> -       case "$board" in
>>> -       TDW8970)
>>> -               ifname=eth0
>>> -               ;;
>>> -       esac
>>> -
>>> +       ifname=eth0
>>
>> What about to add a default branch in case statement?
>>
>> *)
>>      ifname=eth0
>> ;;
>>
>
> i am wondering if we should add a switch default config here or simply
> reset the switch with vlans turned off

Is it really necessary? I mean the failsafe kicks in long before the 
network config and vlan setup is done.

I've tested this with a board using the xrx200 in-SoC switch and a board 
using a RTL8306G switch. In both cases it wasn't necessary to turn off 
the vlans since they had not yet been configured.

Mathias
John Crispin June 20, 2016, 5:40 a.m. UTC | #4
On 20/06/2016 07:39, Mathias Kresin wrote:
> Am 20.06.2016 um 07:19 schrieb John Crispin:
>>
>>
>> On 20/06/2016 05:15, Zhao, Gang wrote:
>>> Hi, Mathias Kresin
>>>
>>> On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
>>>> So far the network in failsafe is setup only for one board. Use the
>>>> eth0 interface as lan interface for all boards for now.
>>>>
>>>> If a board has its lan interface(s) on another eth, a special
>>>> handling based on the board name can be added.
>>>>
>>>> Signed-off-by: Mathias Kresin <dev@kresin.me>
>>>> ---
>>>>   .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  |
>>>> 10 +---------
>>>>   1 file changed, 1 insertion(+), 9 deletions(-)
>>>>
>>>> diff --git
>>>> a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>> b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>
>>>> index 3d7fabf..7ed0fab 100644
>>>> ---
>>>> a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>
>>>> +++
>>>> b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>
>>>> @@ -3,15 +3,7 @@
>>>>   . /lib/functions/lantiq.sh
>>>>
>>>>   set_preinit_iface() {
>>>> -
>>>> -       board=$(lantiq_board_name)
>>>> -
>>>> -       case "$board" in
>>>> -       TDW8970)
>>>> -               ifname=eth0
>>>> -               ;;
>>>> -       esac
>>>> -
>>>> +       ifname=eth0
>>>
>>> What about to add a default branch in case statement?
>>>
>>> *)
>>>      ifname=eth0
>>> ;;
>>>
>>
>> i am wondering if we should add a switch default config here or simply
>> reset the switch with vlans turned off
> 
> Is it really necessary? I mean the failsafe kicks in long before the
> network config and vlan setup is done.
> 
> I've tested this with a board using the xrx200 in-SoC switch and a board
> using a RTL8306G switch. In both cases it wasn't necessary to turn off
> the vlans since they had not yet been configured.
> 
> Mathias
> 
this code also runs on danubes with rtl and ar8327 switches. some of
which have a default vlan setup provided by the bootloader

	John
Mathias Kresin June 20, 2016, 5:52 a.m. UTC | #5
Am 20.06.2016 um 05:15 schrieb Zhao, Gang:
> Hi, Mathias Kresin
>
> On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
>> So far the network in failsafe is setup only for one board. Use the
>> eth0 interface as lan interface for all boards for now.
>>
>> If a board has its lan interface(s) on another eth, a special
>> handling based on the board name can be added.
>>
>> Signed-off-by: Mathias Kresin <dev@kresin.me>
>> ---
>>   .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  | 10 +---------
>>   1 file changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> index 3d7fabf..7ed0fab 100644
>> --- a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> +++ b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>> @@ -3,15 +3,7 @@
>>   . /lib/functions/lantiq.sh
>>
>>   set_preinit_iface() {
>> -
>> -       board=$(lantiq_board_name)
>> -
>> -       case "$board" in
>> -       TDW8970)
>> -               ifname=eth0
>> -               ;;
>> -       esac
>> -
>> +       ifname=eth0
>
> What about to add a default branch in case statement?
>
> *)
>      ifname=eth0
> ;;

Adding a default branch doesn't make any sense to me as long as the only 
value set in the default branch is the same as the one in the only 
conditional.

I had changed the case statement to only consists of a default case, to 
make obvious how to add a different config for a specific board. But in 
the end I dropped the whole case since it was just unused code.
Mathias Kresin June 20, 2016, 6:08 a.m. UTC | #6
Am 20.06.2016 um 07:40 schrieb John Crispin:
>
>
> On 20/06/2016 07:39, Mathias Kresin wrote:
>> Am 20.06.2016 um 07:19 schrieb John Crispin:
>>>
>>>
>>> On 20/06/2016 05:15, Zhao, Gang wrote:
>>>> Hi, Mathias Kresin
>>>>
>>>> On Sun, Jun 19, 2016 at 10:30 PM, Mathias Kresin <dev@kresin.me> wrote:
>>>>> So far the network in failsafe is setup only for one board. Use the
>>>>> eth0 interface as lan interface for all boards for now.
>>>>>
>>>>> If a board has its lan interface(s) on another eth, a special
>>>>> handling based on the board name can be added.
>>>>>
>>>>> Signed-off-by: Mathias Kresin <dev@kresin.me>
>>>>> ---
>>>>>    .../lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq  |
>>>>> 10 +---------
>>>>>    1 file changed, 1 insertion(+), 9 deletions(-)
>>>>>
>>>>> diff --git
>>>>> a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>> b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>>
>>>>> index 3d7fabf..7ed0fab 100644
>>>>> ---
>>>>> a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>>
>>>>> +++
>>>>> b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
>>>>>
>>>>> @@ -3,15 +3,7 @@
>>>>>    . /lib/functions/lantiq.sh
>>>>>
>>>>>    set_preinit_iface() {
>>>>> -
>>>>> -       board=$(lantiq_board_name)
>>>>> -
>>>>> -       case "$board" in
>>>>> -       TDW8970)
>>>>> -               ifname=eth0
>>>>> -               ;;
>>>>> -       esac
>>>>> -
>>>>> +       ifname=eth0
>>>>
>>>> What about to add a default branch in case statement?
>>>>
>>>> *)
>>>>       ifname=eth0
>>>> ;;
>>>>
>>>
>>> i am wondering if we should add a switch default config here or simply
>>> reset the switch with vlans turned off
>>
>> Is it really necessary? I mean the failsafe kicks in long before the
>> network config and vlan setup is done.
>>
>> I've tested this with a board using the xrx200 in-SoC switch and a board
>> using a RTL8306G switch. In both cases it wasn't necessary to turn off
>> the vlans since they had not yet been configured.
>>
>> Mathias
>>
> this code also runs on danubes with rtl and ar8327 switches. some of
> which have a default vlan setup provided by the bootloader
>
> 	John
>

Indeed, for these boards a reset of the vlan config, depending on the 
particular bootloader vlan config, might be necessary.

But I don't like the idea of adding a default switch config for boards 
where it isn't strictly required. Especially in a failsafe script. The 
more code we add, the more likely is a breakage or an unconsidered 
side-effect of a change.

Since I don't have any of the affected danube boards, adding support for 
this special case to the patch is out of scope for me. I don't like to 
add untested code.

Mathias
diff mbox

Patch

diff --git a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
index 3d7fabf..7ed0fab 100644
--- a/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
+++ b/target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
@@ -3,15 +3,7 @@ 
 . /lib/functions/lantiq.sh
 
 set_preinit_iface() {
-
-	board=$(lantiq_board_name)
-
-	case "$board" in
-	TDW8970)
-		ifname=eth0
-		;;
-	esac
-
+	ifname=eth0
 }
 
 boot_hook_add preinit_main set_preinit_iface