Re: [PATCH net-next v2 4/4] selftests: hsr: Add test for VLAN

From: MD Danish Anwar
Date: Tue Nov 05 2024 - 06:15:26 EST




On 31/10/24 8:11 pm, Paolo Abeni wrote:
> On 10/24/24 12:30, MD Danish Anwar wrote:
>> @@ -183,9 +232,21 @@ trap cleanup_all_ns EXIT
>> setup_hsr_interfaces 0
>> do_complete_ping_test
>>
>> +# Run VLAN Test
>> +if $vlan; then
>> + setup_vlan_interfaces
>> + hsr_vlan_ping
>> +fi
>> +
>> setup_ns ns1 ns2 ns3
>>
>> setup_hsr_interfaces 1
>> do_complete_ping_test
>>
>> +# Run VLAN Test
>> +if $vlan; then
>> + setup_vlan_interfaces
>> + hsr_vlan_ping
>> +fi
>
> The new tests should be enabled by default. Indeed ideally the test
> script should be able to run successfully on kernel not supporting such
> feature; you could cope with that looking for the hsr exposed feature
> and skipping the vlan test when the relevant feature is not present.
>

Sure Paolo, I will make the new tests enabled by default. During the
test I will check the exposed feature `ethtool -k hsr1 | grep
"vlan-challenged"` and if vlan is not supported, skip the vlan test.

Below will be my API to run VLAN tests,

run_vlan_tests() {
vlan_challenged_hsr1=$(ip net exec "$ns1" ethtool -k hsr1 | grep
"vlan-challenged" | awk '{print $2}')
vlan_challenged_hsr2=$(ip net exec "$ns1" ethtool -k hsr2 | grep
"vlan-challenged" | awk '{print $2}')
vlan_challenged_hsr3=$(ip net exec "$ns1" ethtool -k hsr3 | grep
"vlan-challenged" | awk '{print $2}')

if [[ "$vlan_challenged_hsr1" = "off" || "$vlan_challenged_hsr2" =
"off" || "$vlan_challenged_hsr3" = "off" ]]; then
setup_vlan_interfaces
hsr_vlan_ping
else
echo "INFO: Not Running VLAN tests as the device does not support VLAN"
fi
}

I will call this function after the ping test.
Let me know if this looks okay to you.

Thanks for the review.

> Cheers,
>
> Paolo
>

--
Thanks and Regards,
Danish