diff mbox series

[net] ice: fix enabling RX VLAN filtering

Message ID 20240325201901.39365-1-poros@redhat.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net] ice: fix enabling RX VLAN filtering | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 944 this patch: 944
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 955 this patch: 955
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 955 this patch: 955
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-26--00-00 (tests: 943)

Commit Message

Petr Oros March 25, 2024, 8:19 p.m. UTC
ice_port_vlan_on/off() was introduced in commit 2946204b3fa8 ("ice:
implement bridge port vlan"). But ice_port_vlan_on() incorrectly assigns
ena_rx_filtering to inner_vlan_ops in DVM mode.
This causes an error when rx_filtering cannot be enabled in legacy mode.

Reproducer:
 echo 1 > /sys/class/net/$PF/device/sriov_numvfs
 ip link set $PF vf 0 spoofchk off trust on vlan 3
dmesg:
 ice 0000:41:00.0: failed to enable Rx VLAN filtering for VF 0 VSI 9 during VF rebuild, error -95

Fixes: 2946204b3fa8 ("ice: implement bridge port vlan")
Signed-off-by: Petr Oros <poros@redhat.com>
---
 .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

Michal Swiatkowski March 25, 2024, 9:19 p.m. UTC | #1
On Mon, Mar 25, 2024 at 09:19:01PM +0100, Petr Oros wrote:
> ice_port_vlan_on/off() was introduced in commit 2946204b3fa8 ("ice:
> implement bridge port vlan"). But ice_port_vlan_on() incorrectly assigns
> ena_rx_filtering to inner_vlan_ops in DVM mode.
> This causes an error when rx_filtering cannot be enabled in legacy mode.
> 
> Reproducer:
>  echo 1 > /sys/class/net/$PF/device/sriov_numvfs
>  ip link set $PF vf 0 spoofchk off trust on vlan 3
> dmesg:
>  ice 0000:41:00.0: failed to enable Rx VLAN filtering for VF 0 VSI 9 during VF rebuild, error -95
> 
> Fixes: 2946204b3fa8 ("ice: implement bridge port vlan")
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
>  .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c   | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> index 80dc4bcdd3a41c..b3e1bdcb80f84d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> +++ b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> @@ -26,24 +26,22 @@ static void ice_port_vlan_on(struct ice_vsi *vsi)
>  	struct ice_vsi_vlan_ops *vlan_ops;
>  	struct ice_pf *pf = vsi->back;
>  
> -	if (ice_is_dvm_ena(&pf->hw)) {
> -		vlan_ops = &vsi->outer_vlan_ops;
> -
> -		/* setup outer VLAN ops */
> -		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
> -		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
> +	/* setup inner VLAN ops */
> +	vlan_ops = &vsi->inner_vlan_ops;
>  
> -		/* setup inner VLAN ops */
> -		vlan_ops = &vsi->inner_vlan_ops;
> +	if (ice_is_dvm_ena(&pf->hw)) {
>  		vlan_ops->add_vlan = noop_vlan_arg;
>  		vlan_ops->del_vlan = noop_vlan_arg;
>  		vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
>  		vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
>  		vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
>  		vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
> -	} else {
> -		vlan_ops = &vsi->inner_vlan_ops;
>  
> +		/* setup outer VLAN ops */
> +		vlan_ops = &vsi->outer_vlan_ops;
> +		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
> +		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
> +	} else {
>  		vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
>  		vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan;
>  	}

Thanks for fixing it.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

> -- 
> 2.43.2
>
Romanowski, Rafal April 3, 2024, 9:43 a.m. UTC | #2
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Michal Swiatkowski
> Sent: Monday, March 25, 2024 10:20 PM
> To: poros <poros@redhat.com>
> Cc: Drewek, Wojciech <wojciech.drewek@intel.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> edumazet@google.com; Nguyen, Anthony L <anthony.l.nguyen@intel.com>;
> horms@kernel.org; intel-wired-lan@lists.osuosl.org; kuba@kernel.org;
> pabeni@redhat.com; davem@davemloft.net
> Subject: Re: [Intel-wired-lan] [PATCH net] ice: fix enabling RX VLAN filtering
> 
> On Mon, Mar 25, 2024 at 09:19:01PM +0100, Petr Oros wrote:
> > ice_port_vlan_on/off() was introduced in commit 2946204b3fa8 ("ice:
> > implement bridge port vlan"). But ice_port_vlan_on() incorrectly
> > assigns ena_rx_filtering to inner_vlan_ops in DVM mode.
> > This causes an error when rx_filtering cannot be enabled in legacy mode.
> >
> > Reproducer:
> >  echo 1 > /sys/class/net/$PF/device/sriov_numvfs
> >  ip link set $PF vf 0 spoofchk off trust on vlan 3
> > dmesg:
> >  ice 0000:41:00.0: failed to enable Rx VLAN filtering for VF 0 VSI 9
> > during VF rebuild, error -95
> >
> > Fixes: 2946204b3fa8 ("ice: implement bridge port vlan")
> > Signed-off-by: Petr Oros <poros@redhat.com>
> > ---
> >  .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c   | 18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> > b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> > index 80dc4bcdd3a41c..b3e1bdcb80f84d 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
> > @@ -26,24 +26,22 @@ static void ice_port_vlan_on(struct ice_vsi *vsi)
> >  	struct ice_vsi_vlan_ops *vlan_ops;
> >  	struct ice_pf *pf = vsi->back;
> >
> > -	if (ice_is_dvm_ena(&pf->hw)) {
> > -		vlan_ops = &vsi->outer_vlan_ops;
> > -
> > -		/* setup outer VLAN ops */
> > -		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
> > -		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
> > +	/* setup inner VLAN ops */
> > +	vlan_ops = &vsi->inner_vlan_ops;
> >
> > -		/* setup inner VLAN ops */
> > -		vlan_ops = &vsi->inner_vlan_ops;
> > +	if (ice_is_dvm_ena(&pf->hw)) {
> >  		vlan_ops->add_vlan = noop_vlan_arg;
> >  		vlan_ops->del_vlan = noop_vlan_arg;
> >  		vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
> >  		vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
> >  		vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
> >  		vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
> > -	} else {
> > -		vlan_ops = &vsi->inner_vlan_ops;
> >
> > +		/* setup outer VLAN ops */
> > +		vlan_ops = &vsi->outer_vlan_ops;
> > +		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
> > +		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
> > +	} else {
> >  		vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
> >  		vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan;
> >  	}
> 
> Thanks for fixing it.
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> 
> > --
> > 2.43.2
> >


Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
index 80dc4bcdd3a41c..b3e1bdcb80f84d 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
@@ -26,24 +26,22 @@  static void ice_port_vlan_on(struct ice_vsi *vsi)
 	struct ice_vsi_vlan_ops *vlan_ops;
 	struct ice_pf *pf = vsi->back;
 
-	if (ice_is_dvm_ena(&pf->hw)) {
-		vlan_ops = &vsi->outer_vlan_ops;
-
-		/* setup outer VLAN ops */
-		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
-		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
+	/* setup inner VLAN ops */
+	vlan_ops = &vsi->inner_vlan_ops;
 
-		/* setup inner VLAN ops */
-		vlan_ops = &vsi->inner_vlan_ops;
+	if (ice_is_dvm_ena(&pf->hw)) {
 		vlan_ops->add_vlan = noop_vlan_arg;
 		vlan_ops->del_vlan = noop_vlan_arg;
 		vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
 		vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
 		vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
 		vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
-	} else {
-		vlan_ops = &vsi->inner_vlan_ops;
 
+		/* setup outer VLAN ops */
+		vlan_ops = &vsi->outer_vlan_ops;
+		vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
+		vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
+	} else {
 		vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
 		vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan;
 	}