All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-03 (ice)
@ 2023-01-03 23:07 Tony Nguyen
  2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tony Nguyen @ 2023-01-03 23:07 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet; +Cc: Tony Nguyen, netdev

This series contains updates to ice driver only.

Dave prevents modifying channels when RDMA is active as this will break
RDMA traffic.

Mateusz replaces unregister_netdev() call with call to clear rings as
there can be a deadlock with the former call.

Michal fixes a broken URL.
---
v2:
- Dropped, previous, patch 1.
- Replace RDMA patch to disallow change instead of replugging aux device

v1: https://lore.kernel.org/netdev/20221207211040.1099708-1-anthony.l.nguyen@intel.com/

The following are changes since commit c7dd13805f8b8fc1ce3b6d40f6aff47e66b72ad2:
  usb: rndis_host: Secure rndis_query check against int overflow
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE

Dave Ertman (1):
  ice: Prevent set_channel from changing queues while RDMA active

Mateusz Palczewski (1):
  ice: Fix deadlock on the rtnl_mutex

Michal Wilczynski (1):
  ice: Fix broken link in ice NAPI doc

 .../device_drivers/ethernet/intel/ice.rst      |  2 +-
 drivers/net/ethernet/intel/ice/ice_ethtool.c   | 18 +++++++++++++++---
 drivers/net/ethernet/intel/ice/ice_lib.c       | 10 ++++------
 3 files changed, 20 insertions(+), 10 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active
  2023-01-03 23:07 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-03 (ice) Tony Nguyen
@ 2023-01-03 23:07 ` Tony Nguyen
  2023-01-04  7:45   ` Leon Romanovsky
  2023-01-05  4:42   ` Jakub Kicinski
  2023-01-03 23:07 ` [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex Tony Nguyen
  2023-01-03 23:07 ` [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc Tony Nguyen
  2 siblings, 2 replies; 10+ messages in thread
From: Tony Nguyen @ 2023-01-03 23:07 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Dave Ertman, netdev, anthony.l.nguyen, shiraz.saleem,
	mustafa.ismail, jgg, leonro, linux-rdma, Gurucharan G

From: Dave Ertman <david.m.ertman@intel.com>

The PF controls the set of queues that the RDMA auxiliary_driver requests
resources from.  The set_channel command will alter that pool and trigger a
reconfiguration of the VSI, which breaks RDMA functionality.

Prevent set_channel from executing when RDMA driver bound to auxiliary
device.

Fixes: 348048e724a0 ("ice: Implement iidc operations")
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 4191994d8f3a..bb6252e9cf59 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3642,6 +3642,7 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
 	struct ice_pf *pf = vsi->back;
 	int new_rx = 0, new_tx = 0;
 	u32 curr_combined;
+	int ret = 0;
 
 	/* do not support changing channels in Safe Mode */
 	if (ice_is_safe_mode(pf)) {
@@ -3705,15 +3706,26 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
 		return -EINVAL;
 	}
 
+	mutex_lock(&pf->adev_mutex);
+	if (pf->adev && pf->adev->dev.driver) {
+		netdev_err(dev, "Cannot change channels when RDMA is active\n");
+		ret = -EINVAL;
+		goto adev_unlock;
+	}
+
 	ice_vsi_recfg_qs(vsi, new_rx, new_tx);
 
-	if (!netif_is_rxfh_configured(dev))
-		return ice_vsi_set_dflt_rss_lut(vsi, new_rx);
+	if (!netif_is_rxfh_configured(dev)) {
+		ret = ice_vsi_set_dflt_rss_lut(vsi, new_rx);
+		goto adev_unlock;
+	}
 
 	/* Update rss_size due to change in Rx queues */
 	vsi->rss_size = ice_get_valid_rss_size(&pf->hw, new_rx);
 
-	return 0;
+adev_unlock:
+	mutex_unlock(&pf->adev_mutex);
+	return ret;
 }
 
 /**
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex
  2023-01-03 23:07 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-03 (ice) Tony Nguyen
  2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
@ 2023-01-03 23:07 ` Tony Nguyen
  2023-01-04  7:44   ` Leon Romanovsky
  2023-01-03 23:07 ` [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc Tony Nguyen
  2 siblings, 1 reply; 10+ messages in thread
From: Tony Nguyen @ 2023-01-03 23:07 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Mateusz Palczewski, netdev, anthony.l.nguyen, Gurucharan G

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

There is a deadlock on rtnl_mutex when attempting to take the lock
in unregister_netdev() after it has already been taken by
ethnl_set_channels(). This happened when unregister_netdev() was
called inside of ice_vsi_rebuild().
Fix that by removing the unregister_netdev() usage and replace it with
ice_vsi_clear_rings() that deallocates the tx and rx rings for the VSI.

Fixes: df0f847915b4 ("ice: Move common functions out of ice_main.c part 6/7")
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 94aa834cd9a6..22bcb414546a 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -3619,12 +3619,10 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 err_vectors:
 	ice_vsi_free_q_vectors(vsi);
 err_rings:
-	if (vsi->netdev) {
-		vsi->current_netdev_flags = 0;
-		unregister_netdev(vsi->netdev);
-		free_netdev(vsi->netdev);
-		vsi->netdev = NULL;
-	}
+	ice_vsi_clear_rings(vsi);
+	set_bit(ICE_RESET_FAILED, pf->state);
+	kfree(coalesce);
+	return ret;
 err_vsi:
 	ice_vsi_clear(vsi);
 	set_bit(ICE_RESET_FAILED, pf->state);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc
  2023-01-03 23:07 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-03 (ice) Tony Nguyen
  2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
  2023-01-03 23:07 ` [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex Tony Nguyen
@ 2023-01-03 23:07 ` Tony Nguyen
  2023-01-04  2:02   ` Bagas Sanjaya
  2 siblings, 1 reply; 10+ messages in thread
From: Tony Nguyen @ 2023-01-03 23:07 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Michal Wilczynski, netdev, anthony.l.nguyen, corbet, linux-doc,
	Jesse Brandeburg

From: Michal Wilczynski <michal.wilczynski@intel.com>

Current link for NAPI documentation in ice driver doesn't work - it
returns 404. Update the link to the working one.

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 Documentation/networking/device_drivers/ethernet/intel/ice.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/networking/device_drivers/ethernet/intel/ice.rst b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
index dc2e60ced927..b481b81f3be5 100644
--- a/Documentation/networking/device_drivers/ethernet/intel/ice.rst
+++ b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
@@ -819,7 +819,7 @@ NAPI
 ----
 This driver supports NAPI (Rx polling mode).
 For more information on NAPI, see
-https://www.linuxfoundation.org/collaborate/workgroups/networking/napi
+https://wiki.linuxfoundation.org/networking/napi
 
 
 MACVLAN
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc
  2023-01-03 23:07 ` [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc Tony Nguyen
@ 2023-01-04  2:02   ` Bagas Sanjaya
  2023-01-05  4:43     ` Jakub Kicinski
  0 siblings, 1 reply; 10+ messages in thread
From: Bagas Sanjaya @ 2023-01-04  2:02 UTC (permalink / raw)
  To: Tony Nguyen, davem, kuba, pabeni, edumazet
  Cc: Michal Wilczynski, netdev, corbet, linux-doc, Jesse Brandeburg

On 1/4/23 06:07, Tony Nguyen wrote:
>  This driver supports NAPI (Rx polling mode).
>  For more information on NAPI, see
> -https://www.linuxfoundation.org/collaborate/workgroups/networking/napi
> +https://wiki.linuxfoundation.org/networking/napi
>  

Replace with LF wiki?

-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex
  2023-01-03 23:07 ` [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex Tony Nguyen
@ 2023-01-04  7:44   ` Leon Romanovsky
  0 siblings, 0 replies; 10+ messages in thread
From: Leon Romanovsky @ 2023-01-04  7:44 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, Mateusz Palczewski, netdev, Gurucharan G

On Tue, Jan 03, 2023 at 03:07:37PM -0800, Tony Nguyen wrote:
> From: Mateusz Palczewski <mateusz.palczewski@intel.com>
> 
> There is a deadlock on rtnl_mutex when attempting to take the lock
> in unregister_netdev() after it has already been taken by
> ethnl_set_channels(). This happened when unregister_netdev() was
> called inside of ice_vsi_rebuild().
> Fix that by removing the unregister_netdev() usage and replace it with
> ice_vsi_clear_rings() that deallocates the tx and rx rings for the VSI.
> 
> Fixes: df0f847915b4 ("ice: Move common functions out of ice_main.c part 6/7")
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
> Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 94aa834cd9a6..22bcb414546a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -3619,12 +3619,10 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
>  err_vectors:
>  	ice_vsi_free_q_vectors(vsi);
>  err_rings:
> -	if (vsi->netdev) {
> -		vsi->current_netdev_flags = 0;
> -		unregister_netdev(vsi->netdev);
> -		free_netdev(vsi->netdev);
> -		vsi->netdev = NULL;
> -	}
> +	ice_vsi_clear_rings(vsi);
> +	set_bit(ICE_RESET_FAILED, pf->state);
> +	kfree(coalesce);
> +	return ret;
>  err_vsi:

This is very odd error unwind idiom only to perform:
if (something)
   ice_vsi_clear_rings(vsi);
else
   ice_vsi_clear(vsi);

Please avoid putting "return ..." and same code in the middle of goto unwind.

Thanks

>  	ice_vsi_clear(vsi);
>  	set_bit(ICE_RESET_FAILED, pf->state);
> -- 
> 2.38.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active
  2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
@ 2023-01-04  7:45   ` Leon Romanovsky
  2023-01-05  4:42   ` Jakub Kicinski
  1 sibling, 0 replies; 10+ messages in thread
From: Leon Romanovsky @ 2023-01-04  7:45 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, Dave Ertman, netdev,
	shiraz.saleem, mustafa.ismail, jgg, linux-rdma, Gurucharan G

On Tue, Jan 03, 2023 at 03:07:36PM -0800, Tony Nguyen wrote:
> From: Dave Ertman <david.m.ertman@intel.com>
> 
> The PF controls the set of queues that the RDMA auxiliary_driver requests
> resources from.  The set_channel command will alter that pool and trigger a
> reconfiguration of the VSI, which breaks RDMA functionality.
> 
> Prevent set_channel from executing when RDMA driver bound to auxiliary
> device.
> 
> Fixes: 348048e724a0 ("ice: Implement iidc operations")
> Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
> Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active
  2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
  2023-01-04  7:45   ` Leon Romanovsky
@ 2023-01-05  4:42   ` Jakub Kicinski
  1 sibling, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2023-01-05  4:42 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, pabeni, edumazet, Dave Ertman, netdev, shiraz.saleem,
	mustafa.ismail, jgg, leonro, linux-rdma, Gurucharan G

On Tue,  3 Jan 2023 15:07:36 -0800 Tony Nguyen wrote:
> +	mutex_lock(&pf->adev_mutex);
> +	if (pf->adev && pf->adev->dev.driver) {
> +		netdev_err(dev, "Cannot change channels when RDMA is active\n");
> +		ret = -EINVAL;
> +		goto adev_unlock;

Since you're have to respin anyway - perhaps -EBUSY here?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc
  2023-01-04  2:02   ` Bagas Sanjaya
@ 2023-01-05  4:43     ` Jakub Kicinski
  2023-01-09  8:54       ` Wilczynski, Michal
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2023-01-05  4:43 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Tony Nguyen, davem, pabeni, edumazet, Michal Wilczynski, netdev,
	corbet, linux-doc, Jesse Brandeburg

On Wed, 4 Jan 2023 09:02:50 +0700 Bagas Sanjaya wrote:
> On 1/4/23 06:07, Tony Nguyen wrote:
> >  This driver supports NAPI (Rx polling mode).
> >  For more information on NAPI, see
> > -https://www.linuxfoundation.org/collaborate/workgroups/networking/napi
> > +https://wiki.linuxfoundation.org/networking/napi
> >    
> 
> Replace with LF wiki?

TBH I, for one, do not know what you mean.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc
  2023-01-05  4:43     ` Jakub Kicinski
@ 2023-01-09  8:54       ` Wilczynski, Michal
  0 siblings, 0 replies; 10+ messages in thread
From: Wilczynski, Michal @ 2023-01-09  8:54 UTC (permalink / raw)
  To: Jakub Kicinski, Bagas Sanjaya
  Cc: Tony Nguyen, davem, pabeni, edumazet, netdev, corbet, linux-doc,
	Jesse Brandeburg



On 1/5/2023 5:43 AM, Jakub Kicinski wrote:
> On Wed, 4 Jan 2023 09:02:50 +0700 Bagas Sanjaya wrote:
>> On 1/4/23 06:07, Tony Nguyen wrote:
>>>  This driver supports NAPI (Rx polling mode).
>>>  For more information on NAPI, see
>>> -https://www.linuxfoundation.org/collaborate/workgroups/networking/napi
>>> +https://wiki.linuxfoundation.org/networking/napi
>>>    
>> Replace with LF wiki?
> TBH I, for one, do not know what you mean.

Me too, if you have a better link for NAPI doc, please provide one.
BR,
Michał



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-09  9:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 23:07 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-03 (ice) Tony Nguyen
2023-01-03 23:07 ` [PATCH net v2 1/3] ice: Prevent set_channel from changing queues while RDMA active Tony Nguyen
2023-01-04  7:45   ` Leon Romanovsky
2023-01-05  4:42   ` Jakub Kicinski
2023-01-03 23:07 ` [PATCH net v2 2/3] ice: Fix deadlock on the rtnl_mutex Tony Nguyen
2023-01-04  7:44   ` Leon Romanovsky
2023-01-03 23:07 ` [PATCH net v2 3/3] ice: Fix broken link in ice NAPI doc Tony Nguyen
2023-01-04  2:02   ` Bagas Sanjaya
2023-01-05  4:43     ` Jakub Kicinski
2023-01-09  8:54       ` Wilczynski, Michal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.