Re: [PATCH net-next 1/2] net: hns3: adds support for dynamic VLAN mode

From: tanhuazhong
Date: Wed May 20 2020 - 22:26:17 EST




On 2020/5/21 9:36, Jakub Kicinski wrote:
On Thu, 21 May 2020 09:33:14 +0800 tanhuazhong wrote:
On 2020/5/21 5:06, Jakub Kicinski wrote:
On Wed, 20 May 2020 09:20:12 +0800 Huazhong Tan wrote:
From: GuoJia Liao <liaoguojia@xxxxxxxxxx>

There is a scenario which needs vNICs enable the VLAN filter
in access port, while disable the VLAN filter in trunk port.
Access port and trunk port can switch according to the user's
configuration.

This patch adds support for the dynamic VLAN mode. then the
HNS3 driver can support two VLAN modes: default VLAN mode and
dynamic VLAN mode. User can switch the mode through the
configuration file.

What configuration file? Sounds like you're reimplementing trusted
VFs (ndo_set_vf_trust).

Hi, Jakub.

Maybe this configuration file here is a little misleading,
this VLAN mode is decided by the firmware, the driver will
query the VLAN mode from firmware during intializing.

And the FW got that configuration from?


It depends on the user's demand, the user can choose the firmware
which supports the default VLAN mode or the dynamic VLAN mode.

I will modified this description in V2. BTW, is there any
other suggestion about this patch?

The other suggestion was to trusted vf. What's the difference between
trusted VF and "dynamic VLAN mode"?


Trust VF is not related to dynamic VLAN mode. So far it's only
be used for privilege checking for the VF promisc. And dynamic
VLAN mode is designed to adapt specified scenario which want
enable/disable VLAN filter base on VLAN used.

Thanks.

In default VLAN mode, port based VLAN filter and VF VLAN
filter should always be enabled.

In dynamic VLAN mode, port based VLAN filter is disabled, and
VF VLAN filter is disabled defaultly, and should be enabled
when there is a non-zero VLAN ID. In addition, VF VLAN filter
is enabled if PVID is enabled for vNIC.

When enable promisc, VLAN filter should be disabled. When disable
promisc, VLAN filter's status depends on the value of
'vport->vf_vlan_en', which is used to record the VF VLAN filter
status.

In default VLAN mode, 'vport->vf_vlan_en' always be 'true', so
VF VLAN filter will set to be enabled after disabling promisc.

In dynamic VLAN mode, 'vport->vf_vlan_en' lies on whether there
is a non-zero VLAN ID.

Signed-off-by: GuoJia Liao <liaoguojia@xxxxxxxxxx>
Signed-off-by: Huazhong Tan <tanhuazhong@xxxxxxxxxx>


.