diff mbox series

[iwl-net,v1] ice: Fix RDMA VSI removal during queue rebuild

Message ID 20230703093546.74984-1-kamil.maziarz@intel.com
State Accepted
Delegated to: Anthony Nguyen
Headers show
Series [iwl-net,v1] ice: Fix RDMA VSI removal during queue rebuild | expand

Commit Message

Kamil Maziarz July 3, 2023, 9:35 a.m. UTC
From: Rafal Rogalski <rafalx.rogalski@intel.com>

During qdisc create/delete, it is necessary to rebuild the queue
of VSIs. An error occurred because the VSIs created by RDMA were
still active.

Added check if RDMA is active. If yes, it disallows qdisc changes
and writes a message in the system logs.

Fixes: 348048e724a0 ("ice: Implement iidc operations")
Signed-off-by: Rafal Rogalski <rafalx.rogalski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Signed-off-by: Kamil Maziarz <kamil.maziarz@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Sreenivas, Bharathi July 27, 2023, 10 a.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Kamil Maziarz
> Sent: Monday, July 3, 2023 3:06 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Maziarz, Kamil <kamil.maziarz@intel.com>; Rogalski, RafalX
> <rafalx.rogalski@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-net v1] ice: Fix RDMA VSI removal
> during queue rebuild
> 
> From: Rafal Rogalski <rafalx.rogalski@intel.com>
> 
> During qdisc create/delete, it is necessary to rebuild the queue of VSIs. An
> error occurred because the VSIs created by RDMA were still active.
> 
> Added check if RDMA is active. If yes, it disallows qdisc changes and writes a
> message in the system logs.
> 
> Fixes: 348048e724a0 ("ice: Implement iidc operations")
> Signed-off-by: Rafal Rogalski <rafalx.rogalski@intel.com>
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
> Signed-off-by: Kamil Maziarz <kamil.maziarz@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index a1f7c8edc22f..23f41393395f 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -9031,6 +9031,7 @@  ice_setup_tc(struct net_device *netdev, enum tc_setup_type type,
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
 	struct ice_pf *pf = np->vsi->back;
+	bool locked = false;
 	int err;
 
 	switch (type) {
@@ -9040,10 +9041,27 @@  ice_setup_tc(struct net_device *netdev, enum tc_setup_type type,
 						  ice_setup_tc_block_cb,
 						  np, np, true);
 	case TC_SETUP_QDISC_MQPRIO:
+		if (pf->adev) {
+			mutex_lock(&pf->adev_mutex);
+			device_lock(&pf->adev->dev);
+			locked = true;
+			if (pf->adev->dev.driver) {
+				netdev_err(netdev, "Cannot change qdisc when RDMA is active\n");
+				err = -EBUSY;
+				goto adev_unlock;
+			}
+		}
+
 		/* setup traffic classifier for receive side */
 		mutex_lock(&pf->tc_mutex);
 		err = ice_setup_tc_mqprio_qdisc(netdev, type_data);
 		mutex_unlock(&pf->tc_mutex);
+
+adev_unlock:
+		if (locked) {
+			device_unlock(&pf->adev->dev);
+			mutex_unlock(&pf->adev_mutex);
+		}
 		return err;
 	default:
 		return -EOPNOTSUPP;