diff mbox series

[I/J/Unstable,SRU,1/1] net/mlx5e: Unblock setting vid 0 for VF in case PF isn't eswitch manager

Message ID 20220125085425.75418-3-po-hsu.lin@canonical.com
State New
Headers show
Series Unblock setting vid 0 for VF in case PF isn't eswitch manager | expand

Commit Message

Po-Hsu Lin Jan. 25, 2022, 8:54 a.m. UTC
From: Maor Dickman <maord@nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/1957753

When using libvirt to passthrough VF to VM it will always set the VF vlan
to 0 even if user didn’t request it, this will cause libvirt to fail to
boot in case the PF isn't eswitch owner.

Example of such case is the DPU host PF which isn't eswitch manager, so
any attempt to passthrough VF of it using libvirt will fail.

Fix it by not returning error in case set VF vlan is called with vid 0.

Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
(cherry picked from commit 7846665d3504812acaebf920d1141851379a7f37)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Bader Jan. 26, 2022, 4:02 p.m. UTC | #1
On 25.01.22 09:54, Po-Hsu Lin wrote:
> From: Maor Dickman <maord@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1957753
> 
> When using libvirt to passthrough VF to VM it will always set the VF vlan
> to 0 even if user didn’t request it, this will cause libvirt to fail to
> boot in case the PF isn't eswitch owner.
> 
> Example of such case is the DPU host PF which isn't eswitch manager, so
> any attempt to passthrough VF of it using libvirt will fail.
> 
> Fix it by not returning error in case set VF vlan is called with vid 0.
> 
> Signed-off-by: Maor Dickman <maord@nvidia.com>
> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> (cherry picked from commit 7846665d3504812acaebf920d1141851379a7f37)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---

Applied to impish:linux/master-next. Thanks.

-Stefan

>   drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> index d9041b1..de68b32 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> @@ -430,7 +430,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
>   	int err = 0;
>   
>   	if (!mlx5_esw_allowed(esw))
> -		return -EPERM;
> +		return vlan ? -EPERM : 0;
>   
>   	if (vlan || qos)
>   		set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;
Stefan Bader Feb. 11, 2022, 3:49 p.m. UTC | #2
On 25.01.22 09:54, Po-Hsu Lin wrote:
> From: Maor Dickman <maord@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1957753
> 
> When using libvirt to passthrough VF to VM it will always set the VF vlan
> to 0 even if user didn’t request it, this will cause libvirt to fail to
> boot in case the PF isn't eswitch owner.
> 
> Example of such case is the DPU host PF which isn't eswitch manager, so
> any attempt to passthrough VF of it using libvirt will fail.
> 
> Fix it by not returning error in case set VF vlan is called with vid 0.
> 
> Signed-off-by: Maor Dickman <maord@nvidia.com>
> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> (cherry picked from commit 7846665d3504812acaebf920d1141851379a7f37)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---

That patch seems to have already been picked up via stable.

-Stefan

>   drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> index d9041b1..de68b32 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
> @@ -430,7 +430,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
>   	int err = 0;
>   
>   	if (!mlx5_esw_allowed(esw))
> -		return -EPERM;
> +		return vlan ? -EPERM : 0;
>   
>   	if (vlan || qos)
>   		set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
index d9041b1..de68b32 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c
@@ -430,7 +430,7 @@  int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
 	int err = 0;
 
 	if (!mlx5_esw_allowed(esw))
-		return -EPERM;
+		return vlan ? -EPERM : 0;
 
 	if (vlan || qos)
 		set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;