From patchwork Fri Jul 28 17:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13332178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C085C0015E for ; Fri, 28 Jul 2023 17:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjG1RTM (ORCPT ); Fri, 28 Jul 2023 13:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230221AbjG1RTI (ORCPT ); Fri, 28 Jul 2023 13:19:08 -0400 Received: from mgamail.intel.com (unknown [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F38188; Fri, 28 Jul 2023 10:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690564747; x=1722100747; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jgRNOMQ1SQm5ITQcDKK7Rl0K6TkyC//9Yvh0aOrBvPI=; b=gBt/rw2G8aag+ExUmVNGa6rzSJOSsqhQo/pgdyMiHg+qjVkucLTc8XAm aaGN12YzHoUDCyAS4wkAyLNCSuvyHX/ZM4RqBzKpJDPfSq5i8SWRxduBI zGGXxHNlUSeheTOKG61Pm8IB9p84FgqymeoCC/kmWeFCLxnwb1iNJMsIh CMgdmwf589wbgAe1hd0Yia56gdvMoTVaunTFOz0q/esAacUaY0532axXB a8wDU795apxuCEt1z8AbbyWBB4B6SIKNyUcU0fcZ1oSyFZpOtTyuFMajK 95j2ZX8K9yw1cPbshkIteWuZ7B/abnUOcUvqcpYBgI0Z0YlPlD7qozO5O g==; X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="371342852" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="371342852" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2023 10:19:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="851287722" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="851287722" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga004.jf.intel.com with ESMTP; 28 Jul 2023 10:19:06 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Rafal Rogalski , anthony.l.nguyen@intel.com, david.m.ertman@intel.com, shiraz.saleem@intel.com, mustafa.ismail@intel.com, jgg@nvidia.com, leonro@nvidia.com, linux-rdma@vger.kernel.org, Mateusz Palczewski , Kamil Maziarz , Bharathi Sreenivas Subject: [PATCH net] ice: Fix RDMA VSI removal during queue rebuild Date: Fri, 28 Jul 2023 10:12:43 -0700 Message-Id: <20230728171243.2446101-1-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Rafal Rogalski 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 Signed-off-by: Mateusz Palczewski Signed-off-by: Kamil Maziarz Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Reviewed-by: Leon Romanovsky --- drivers/net/ethernet/intel/ice/ice_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index f02d44455772..cf92c39467c8 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -8813,6 +8813,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) { @@ -8822,10 +8823,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;