Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2233056/?format=api
{ "id": 2233056, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233056/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260505152923.1040589-4-aleksander.lobakin@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/1.2/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260505152923.1040589-4-aleksander.lobakin@intel.com>", "list_archive_url": null, "date": "2026-05-05T15:29:21", "name": "[iwl-next,v5,3/5] ice: migrate to netdev ops lock", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "24ad601fb94f0c99d11f4e4794cc0c1da240194a", "submitter": { "id": 85827, "url": "http://patchwork.ozlabs.org/api/1.2/people/85827/?format=api", "name": "Alexander Lobakin", "email": "aleksander.lobakin@intel.com" }, "delegate": { "id": 109701, "url": "http://patchwork.ozlabs.org/api/1.2/users/109701/?format=api", "username": "anguy11", "first_name": "Anthony", "last_name": "Nguyen", "email": "anthony.l.nguyen@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260505152923.1040589-4-aleksander.lobakin@intel.com/mbox/", "series": [ { "id": 502856, "url": "http://patchwork.ozlabs.org/api/1.2/series/502856/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=502856", "date": "2026-05-05T15:29:18", "name": "ice: add support for devmem/io_uring Rx and Tx", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/502856/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2233056/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233056/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=ZOKwUzYP;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.137; helo=smtp4.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g92Xc1CT6z1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 01:30:56 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 5700940AAA;\n\tTue, 5 May 2026 15:30:54 +0000 (UTC)", "from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id OQCl0eZ-dIFJ; Tue, 5 May 2026 15:30:51 +0000 (UTC)", "from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 706CD40AA9;\n\tTue, 5 May 2026 15:30:51 +0000 (UTC)", "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists1.osuosl.org (Postfix) with ESMTP id 210D7280\n for <intel-wired-lan@lists.osuosl.org>; Tue, 5 May 2026 15:30:50 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 072CC608AF\n for <intel-wired-lan@lists.osuosl.org>; Tue, 5 May 2026 15:30:50 +0000 (UTC)", "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id p8MjA-4S5MhZ for <intel-wired-lan@lists.osuosl.org>;\n Tue, 5 May 2026 15:30:48 +0000 (UTC)", "from mgamail.intel.com (mgamail.intel.com [192.198.163.7])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 6514F608B2\n for <intel-wired-lan@lists.osuosl.org>; Tue, 5 May 2026 15:30:48 +0000 (UTC)", "from orviesa010.jf.intel.com ([10.64.159.150])\n by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 May 2026 08:30:48 -0700", "from newjersey.igk.intel.com ([10.102.20.203])\n by orviesa010.jf.intel.com with ESMTP; 05 May 2026 08:30:44 -0700" ], "X-Virus-Scanned": [ "amavis at osuosl.org", "amavis at osuosl.org" ], "X-Comment": "SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ", "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 smtp4.osuosl.org 706CD40AA9", "OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6514F608B2" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777995051;\n\tbh=Qr4fEgi8scw0dZMi+vnT6gPGKKIdTlkNT9Vyt1JUMU4=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=ZOKwUzYPftvKs7wezGkJ6dJgOsTSEyPm03UPOagqAwcdYTpGVO2Qkdy4ZNmcNvDV9\n\t RC3WmHOSPK+ILioHq+aMvVt38NWI5LP5+Xx2wW7S9nPODUBrkA+kNkGmHovfcg6PlU\n\t HY+6XcixJ1UwJKIy7QSMP4CL6n8VEwlTQ2DyrV47hWQBf3rX8wOKEEdWMSrSjJAVxm\n\t Tu5Hr4lS0K/hAdkzbFCWqKRyUByL8hL/D5iHm5jBcQK7S26h5eczfEMmavfSYtQzT3\n\t lszXxUBto2UfhBM1xu3HZO4DedGIEXAM9pz0NMinaHR0/9VVNhnLmdnq8aQTIlwhz0\n\t bOPQ1nH0h/XFg==", "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.7;\n helo=mgamail.intel.com; envelope-from=aleksander.lobakin@intel.com;\n receiver=<UNKNOWN>", "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp3.osuosl.org 6514F608B2", "X-CSE-ConnectionGUID": [ "DnDdB6SsSw64rvppv0buLw==", "VzruFCdqQQCQFPhrqGvw/g==" ], "X-CSE-MsgGUID": [ "4TBpEB7URoee7XeX0Lq4dQ==", "MBjy74zXS5ql0zwKKhQsvw==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11777\"; a=\"104317024\"", "E=Sophos;i=\"6.23,217,1770624000\"; d=\"scan'208\";a=\"104317024\"", "E=Sophos;i=\"6.23,217,1770624000\"; d=\"scan'208\";a=\"234971597\"" ], "X-ExtLoop1": "1", "From": "Alexander Lobakin <aleksander.lobakin@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Cc": "Alexander Lobakin <aleksander.lobakin@intel.com>,\n Tony Nguyen <anthony.l.nguyen@intel.com>,\n Przemek Kitszel <przemyslaw.kitszel@intel.com>,\n Andrew Lunn <andrew+netdev@lunn.ch>,\n \"David S. Miller\" <davem@davemloft.net>,\n Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>,\n Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,\n Kohei Enju <kohei@enjuk.jp>, Jacob Keller <jacob.e.keller@intel.com>,\n Aleksandr Loktionov <aleksandr.loktionov@intel.com>,\n nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org,\n linux-kernel@vger.kernel.org", "Date": "Tue, 5 May 2026 17:29:21 +0200", "Message-ID": "<20260505152923.1040589-4-aleksander.lobakin@intel.com>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260505152923.1040589-1-aleksander.lobakin@intel.com>", "References": "<20260505152923.1040589-1-aleksander.lobakin@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Mailman-Original-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777995049; x=1809531049;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=WIRR0x15eBpzjBFl8qxQLkRXUiNIwBeFswDQFt896Jg=;\n b=gOcmo0yEXoz3a0UpZMC8o7R/wfKWKKbPpRurMABfznA5TBDVMVVWa/M9\n Ie2w72Wr9k5FV6sc3H6LPp2yrlnDLix0PdilqjftlH1xcmx9zaXgd18ZB\n tUNVdHzrtJa0Cx0HhBd7WDUveI68HsJ43T79SwtEodYqFMi0LHiEUZ5uA\n A17RLuptUKJxU3TfAsBhvZ4+BkBrIdi5x/PkQNekNfHt46TWUUm9/rxko\n IcEHkDHFejwKM3eV4OSTTG8Ul1aONpfprSB0q270ZOguGbK1jaFPhfVxn\n Ex7Z2e17tjqBn9VT7aINXPwNvJRnARJpbdVdTEY6oaoNK270n5zUDExVs\n w==;", "X-Mailman-Original-Authentication-Results": [ "smtp3.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com", "smtp3.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=gOcmo0yE" ], "Subject": "[Intel-wired-lan] [PATCH iwl-next v5 3/5] ice: migrate to netdev\n ops lock", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "Queue management ops unconditionally enable netdev locking. The same\nlock is taken by default by several NAPI configuration functions,\nsuch as napi_enable() and netif_napi_set_irq().\nRequest ops locking in advance and make sure we use the _locked\ncounterparts of those functions to avoid deadlocks, taking the lock\nmanually where needed (suspend/resume, queue rebuild and resets).\n\nCo-developed-by: Kohei Enju <kohei@enjuk.jp> # ice_xdp_setup_prog(), safe mode\nSigned-off-by: Kohei Enju <kohei@enjuk.jp>\nReviewed-by: Jacob Keller <jacob.e.keller@intel.com>\nReviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\nSigned-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_base.h | 2 +\n drivers/net/ethernet/intel/ice/ice_lib.h | 13 +-\n drivers/net/ethernet/intel/ice/ice_base.c | 63 ++++-\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 15 +-\n drivers/net/ethernet/intel/ice/ice_eswitch.c | 26 ++-\n drivers/net/ethernet/intel/ice/ice_lib.c | 227 +++++++++++++++----\n drivers/net/ethernet/intel/ice/ice_main.c | 78 ++++---\n drivers/net/ethernet/intel/ice/ice_sf_eth.c | 3 +\n drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +-\n 9 files changed, 324 insertions(+), 107 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_base.h b/drivers/net/ethernet/intel/ice/ice_base.h\nindex d28294247599..99b2c7232829 100644\n--- a/drivers/net/ethernet/intel/ice/ice_base.h\n+++ b/drivers/net/ethernet/intel/ice/ice_base.h\n@@ -12,8 +12,10 @@ int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg);\n int\n ice_vsi_ctrl_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx, bool wait);\n int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx);\n+int ice_vsi_alloc_q_vectors_locked(struct ice_vsi *vsi);\n int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi);\n void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi);\n+void ice_vsi_free_q_vectors_locked(struct ice_vsi *vsi);\n void ice_vsi_free_q_vectors(struct ice_vsi *vsi);\n int ice_vsi_cfg_single_txq(struct ice_vsi *vsi, struct ice_tx_ring **tx_rings,\n \t\t\t u16 q_idx);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 49454d98dcfe..476fa54ec4e8 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -53,19 +53,24 @@ struct ice_vsi *\n ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params);\n \n void ice_vsi_set_napi_queues(struct ice_vsi *vsi);\n-void ice_napi_add(struct ice_vsi *vsi);\n-\n+void ice_vsi_set_napi_queues_locked(struct ice_vsi *vsi);\n void ice_vsi_clear_napi_queues(struct ice_vsi *vsi);\n+void ice_vsi_clear_napi_queues_locked(struct ice_vsi *vsi);\n+\n+void ice_napi_add(struct ice_vsi *vsi);\n \n int ice_vsi_release(struct ice_vsi *vsi);\n \n void ice_vsi_close(struct ice_vsi *vsi);\n \n-int ice_ena_vsi(struct ice_vsi *vsi, bool locked);\n+int ice_ena_vsi_locked(struct ice_vsi *vsi);\n+int ice_ena_vsi(struct ice_vsi *vsi);\n \n void ice_vsi_decfg(struct ice_vsi *vsi);\n-void ice_dis_vsi(struct ice_vsi *vsi, bool locked);\n+void ice_dis_vsi_locked(struct ice_vsi *vsi);\n+void ice_dis_vsi(struct ice_vsi *vsi);\n \n+int ice_vsi_rebuild_locked(struct ice_vsi *vsi, u32 vsi_flags);\n int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags);\n int ice_vsi_cfg(struct ice_vsi *vsi);\n struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c\nindex f162cdfc62a7..1add82d894bb 100644\n--- a/drivers/net/ethernet/intel/ice/ice_base.c\n+++ b/drivers/net/ethernet/intel/ice/ice_base.c\n@@ -155,8 +155,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)\n \t * handler here (i.e. resume, reset/rebuild, etc.)\n \t */\n \tif (vsi->netdev)\n-\t\tnetif_napi_add_config(vsi->netdev, &q_vector->napi,\n-\t\t\t\t ice_napi_poll, v_idx);\n+\t\tnetif_napi_add_config_locked(vsi->netdev, &q_vector->napi,\n+\t\t\t\t\t ice_napi_poll, v_idx);\n \n out:\n \t/* tie q_vector and VSI together */\n@@ -198,7 +198,7 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)\n \n \t/* only VSI with an associated netdev is set up with NAPI */\n \tif (vsi->netdev)\n-\t\tnetif_napi_del(&q_vector->napi);\n+\t\tnetif_napi_del_locked(&q_vector->napi);\n \n \t/* release MSIX interrupt if q_vector had interrupt allocated */\n \tif (q_vector->irq.index < 0)\n@@ -886,13 +886,15 @@ int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx)\n }\n \n /**\n- * ice_vsi_alloc_q_vectors - Allocate memory for interrupt vectors\n+ * ice_vsi_alloc_q_vectors_locked - Allocate memory for interrupt vectors\n * @vsi: the VSI being configured\n *\n- * We allocate one q_vector per queue interrupt. If allocation fails we\n- * return -ENOMEM.\n+ * Should be called only under the netdev lock.\n+ * We allocate one q_vector per queue interrupt.\n+ *\n+ * Return: 0 on success, -ENOMEM if allocation fails.\n */\n-int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)\n+int ice_vsi_alloc_q_vectors_locked(struct ice_vsi *vsi)\n {\n \tstruct device *dev = ice_pf_to_dev(vsi->back);\n \tu16 v_idx;\n@@ -919,6 +921,30 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)\n \treturn v_idx ? 0 : err;\n }\n \n+/**\n+ * ice_vsi_alloc_q_vectors - Allocate memory for interrupt vectors\n+ * @vsi: the VSI being configured\n+ *\n+ * We allocate one q_vector per queue interrupt.\n+ *\n+ * Return: 0 on success, -ENOMEM if allocation fails.\n+ */\n+int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\tint ret;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tret = ice_vsi_alloc_q_vectors_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+\n+\treturn ret;\n+}\n+\n /**\n * ice_vsi_map_rings_to_vectors - Map VSI rings to interrupt vectors\n * @vsi: the VSI being configured\n@@ -982,10 +1008,12 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi)\n }\n \n /**\n- * ice_vsi_free_q_vectors - Free memory allocated for interrupt vectors\n+ * ice_vsi_free_q_vectors_locked - Free memory allocated for interrupt vectors\n * @vsi: the VSI having memory freed\n+ *\n+ * Should be called only under the netdev lock.\n */\n-void ice_vsi_free_q_vectors(struct ice_vsi *vsi)\n+void ice_vsi_free_q_vectors_locked(struct ice_vsi *vsi)\n {\n \tint v_idx;\n \n@@ -995,6 +1023,23 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi)\n \tvsi->num_q_vectors = 0;\n }\n \n+/**\n+ * ice_vsi_free_q_vectors - Free memory allocated for interrupt vectors\n+ * @vsi: the VSI having memory freed\n+ */\n+void ice_vsi_free_q_vectors(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tice_vsi_free_q_vectors_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+}\n+\n /**\n * ice_cfg_tstamp - Configure Tx time stamp queue\n * @tx_ring: Tx ring to be configured with timestamping\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex 16aa25535152..7d89c0acc5d8 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -273,14 +273,13 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)\n * ice_dcb_ena_dis_vsi - disable certain VSIs for DCB config/reconfig\n * @pf: pointer to the PF instance\n * @ena: true to enable VSIs, false to disable\n- * @locked: true if caller holds RTNL lock, false otherwise\n *\n * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHDEV\n * and CHNL need to be brought down. Following completion of DCB configuration\n * the VSIs that were downed need to be brought up again. This helper function\n * does both.\n */\n-static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked)\n+static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena)\n {\n \tint i;\n \n@@ -294,9 +293,9 @@ static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked)\n \t\tcase ICE_VSI_CHNL:\n \t\tcase ICE_VSI_PF:\n \t\t\tif (ena)\n-\t\t\t\tice_ena_vsi(vsi, locked);\n+\t\t\t\tice_ena_vsi(vsi);\n \t\t\telse\n-\t\t\t\tice_dis_vsi(vsi, locked);\n+\t\t\t\tice_dis_vsi(vsi);\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tcontinue;\n@@ -416,7 +415,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \t\trtnl_lock();\n \n \t/* disable VSIs affected by DCB changes */\n-\tice_dcb_ena_dis_vsi(pf, false, true);\n+\tice_dcb_ena_dis_vsi(pf, false);\n \n \tmemcpy(curr_cfg, new_cfg, sizeof(*curr_cfg));\n \tmemcpy(&curr_cfg->etsrec, &curr_cfg->etscfg, sizeof(curr_cfg->etsrec));\n@@ -445,7 +444,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \n out:\n \t/* enable previously downed VSIs */\n-\tice_dcb_ena_dis_vsi(pf, true, true);\n+\tice_dcb_ena_dis_vsi(pf, true);\n \tif (!locked)\n \t\trtnl_unlock();\n free_cfg:\n@@ -1107,7 +1106,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,\n \n \trtnl_lock();\n \t/* disable VSIs affected by DCB changes */\n-\tice_dcb_ena_dis_vsi(pf, false, true);\n+\tice_dcb_ena_dis_vsi(pf, false);\n \n \tret = ice_query_port_ets(pi, &buf, sizeof(buf), NULL);\n \tif (ret) {\n@@ -1119,7 +1118,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,\n \tice_pf_dcb_recfg(pf, false);\n \n \t/* enable previously downed VSIs */\n-\tice_dcb_ena_dis_vsi(pf, true, true);\n+\tice_dcb_ena_dis_vsi(pf, true);\n unlock_rtnl:\n \trtnl_unlock();\n out:\ndiff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c\nindex 2e4f0969035f..af0cc77fbf71 100644\n--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c\n@@ -23,10 +23,16 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)\n \tstruct net_device *netdev = uplink_vsi->netdev;\n \tbool if_running = netif_running(netdev);\n \tstruct ice_vsi_vlan_ops *vlan_ops;\n+\tint ret;\n+\n+\tif (if_running && !test_and_set_bit(ICE_VSI_DOWN, uplink_vsi->state)) {\n+\t\tnetdev_lock(netdev);\n+\t\tret = ice_down(uplink_vsi);\n+\t\tnetdev_unlock(netdev);\n \n-\tif (if_running && !test_and_set_bit(ICE_VSI_DOWN, uplink_vsi->state))\n-\t\tif (ice_down(uplink_vsi))\n+\t\tif (ret)\n \t\t\treturn -ENODEV;\n+\t}\n \n \tice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);\n \tice_vsi_cfg_sw_lldp(uplink_vsi, true, false);\n@@ -53,8 +59,14 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)\n \tif (ice_vsi_update_local_lb(uplink_vsi, true))\n \t\tgoto err_override_local_lb;\n \n-\tif (if_running && ice_up(uplink_vsi))\n-\t\tgoto err_up;\n+\tif (if_running) {\n+\t\tnetdev_lock(netdev);\n+\t\tret = ice_up(uplink_vsi);\n+\t\tnetdev_unlock(netdev);\n+\n+\t\tif (ret)\n+\t\t\tgoto err_up;\n+\t}\n \n \treturn 0;\n \n@@ -74,8 +86,12 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)\n \tice_fltr_add_mac_and_broadcast(uplink_vsi,\n \t\t\t\t uplink_vsi->port_info->mac.perm_addr,\n \t\t\t\t ICE_FWD_TO_VSI);\n-\tif (if_running)\n+\n+\tif (if_running) {\n+\t\tnetdev_lock(netdev);\n \t\tice_up(uplink_vsi);\n+\t\tnetdev_unlock(netdev);\n+\t}\n \n \treturn -ENODEV;\n }\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 837b71b7b2b7..6760aac609f2 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -2304,10 +2304,14 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)\n }\n \n /**\n- * ice_vsi_cfg_def - configure default VSI based on the type\n+ * ice_vsi_cfg_def_locked - configure default VSI based on the type\n * @vsi: pointer to VSI\n+ *\n+ * Should be called only with the netdev lock taken.\n+ *\n+ * Return: 0 on success, -errno on failure.\n */\n-static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n+static int ice_vsi_cfg_def_locked(struct ice_vsi *vsi)\n {\n \tstruct device *dev = ice_pf_to_dev(vsi->back);\n \tstruct ice_pf *pf = vsi->back;\n@@ -2350,7 +2354,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \tcase ICE_VSI_CTRL:\n \tcase ICE_VSI_SF:\n \tcase ICE_VSI_PF:\n-\t\tret = ice_vsi_alloc_q_vectors(vsi);\n+\t\tret = ice_vsi_alloc_q_vectors_locked(vsi);\n \t\tif (ret)\n \t\t\tgoto unroll_vsi_init;\n \n@@ -2400,7 +2404,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \t\t * creates a VSI and corresponding structures for bookkeeping\n \t\t * purpose\n \t\t */\n-\t\tret = ice_vsi_alloc_q_vectors(vsi);\n+\t\tret = ice_vsi_alloc_q_vectors_locked(vsi);\n \t\tif (ret)\n \t\t\tgoto unroll_vsi_init;\n \n@@ -2424,7 +2428,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \t\t}\n \t\tbreak;\n \tcase ICE_VSI_LB:\n-\t\tret = ice_vsi_alloc_q_vectors(vsi);\n+\t\tret = ice_vsi_alloc_q_vectors_locked(vsi);\n \t\tif (ret)\n \t\t\tgoto unroll_vsi_init;\n \n@@ -2451,7 +2455,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n unroll_vector_base:\n \t/* reclaim SW interrupts back to the common pool */\n unroll_alloc_q_vector:\n-\tice_vsi_free_q_vectors(vsi);\n+\tice_vsi_free_q_vectors_locked(vsi);\n unroll_vsi_init:\n \tice_vsi_delete_from_hw(vsi);\n unroll_get_qs:\n@@ -2463,6 +2467,28 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n \treturn ret;\n }\n \n+/**\n+ * ice_vsi_cfg_def - configure default VSI based on the type\n+ * @vsi: pointer to VSI\n+ *\n+ * Return: 0 on success, -errno on failure.\n+ */\n+static int ice_vsi_cfg_def(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\tint ret;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tret = ice_vsi_cfg_def_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+\n+\treturn ret;\n+}\n+\n /**\n * ice_vsi_cfg - configure a previously allocated VSI\n * @vsi: pointer to VSI\n@@ -2497,10 +2523,12 @@ int ice_vsi_cfg(struct ice_vsi *vsi)\n }\n \n /**\n- * ice_vsi_decfg - remove all VSI configuration\n+ * ice_vsi_decfg_locked - remove all VSI configuration\n * @vsi: pointer to VSI\n+ *\n+ * Should be called only under the netdev lock.\n */\n-void ice_vsi_decfg(struct ice_vsi *vsi)\n+static void ice_vsi_decfg_locked(struct ice_vsi *vsi)\n {\n \tstruct ice_pf *pf = vsi->back;\n \tint err;\n@@ -2518,7 +2546,7 @@ void ice_vsi_decfg(struct ice_vsi *vsi)\n \t\tice_destroy_xdp_rings(vsi, ICE_XDP_CFG_PART);\n \n \tice_vsi_clear_rings(vsi);\n-\tice_vsi_free_q_vectors(vsi);\n+\tice_vsi_free_q_vectors_locked(vsi);\n \tice_vsi_put_qs(vsi);\n \tice_vsi_free_arrays(vsi);\n \n@@ -2533,6 +2561,23 @@ void ice_vsi_decfg(struct ice_vsi *vsi)\n \t\tvsi->agg_node->num_vsis--;\n }\n \n+/**\n+ * ice_vsi_decfg - remove all VSI configuration\n+ * @vsi: pointer to VSI\n+ */\n+void ice_vsi_decfg(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tice_vsi_decfg_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+}\n+\n /**\n * ice_vsi_setup - Set up a VSI by a given type\n * @pf: board private structure\n@@ -2706,18 +2751,19 @@ void ice_vsi_close(struct ice_vsi *vsi)\n \tif (!test_and_set_bit(ICE_VSI_DOWN, vsi->state))\n \t\tice_down(vsi);\n \n-\tice_vsi_clear_napi_queues(vsi);\n+\tice_vsi_clear_napi_queues_locked(vsi);\n \tice_vsi_free_irq(vsi);\n \tice_vsi_free_tx_rings(vsi);\n \tice_vsi_free_rx_rings(vsi);\n }\n \n /**\n- * ice_ena_vsi - resume a VSI\n- * @vsi: the VSI being resume\n- * @locked: is the rtnl_lock already held\n+ * ice_ena_vsi_locked - resume a VSI (without taking the netdev lock)\n+ * @vsi: VSI to resume\n+ *\n+ * Return: 0 on success, -errno on failure.\n */\n-int ice_ena_vsi(struct ice_vsi *vsi, bool locked)\n+int ice_ena_vsi_locked(struct ice_vsi *vsi)\n {\n \tint err = 0;\n \n@@ -2728,15 +2774,8 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked)\n \n \tif (vsi->netdev && (vsi->type == ICE_VSI_PF ||\n \t\t\t vsi->type == ICE_VSI_SF)) {\n-\t\tif (netif_running(vsi->netdev)) {\n-\t\t\tif (!locked)\n-\t\t\t\trtnl_lock();\n-\n+\t\tif (netif_running(vsi->netdev))\n \t\t\terr = ice_open_internal(vsi->netdev);\n-\n-\t\t\tif (!locked)\n-\t\t\t\trtnl_unlock();\n-\t\t}\n \t} else if (vsi->type == ICE_VSI_CTRL) {\n \t\terr = ice_vsi_open_ctrl(vsi);\n \t}\n@@ -2745,11 +2784,34 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked)\n }\n \n /**\n- * ice_dis_vsi - pause a VSI\n+ * ice_ena_vsi - resume a VSI\n+ * @vsi: VSI to resume\n+ *\n+ * Return: 0 on success, -errno on failure.\n+ */\n+int ice_ena_vsi(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\tint ret;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tret = ice_ena_vsi_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+\n+\treturn ret;\n+}\n+\n+/**\n+ * ice_dis_vsi_locked - pause a VSI\n * @vsi: the VSI being paused\n- * @locked: is the rtnl_lock already held\n+ *\n+ * The caller must always hold the netdev lock.\n */\n-void ice_dis_vsi(struct ice_vsi *vsi, bool locked)\n+void ice_dis_vsi_locked(struct ice_vsi *vsi)\n {\n \tbool already_down = test_bit(ICE_VSI_DOWN, vsi->state);\n \n@@ -2758,14 +2820,9 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked)\n \tif (vsi->netdev && (vsi->type == ICE_VSI_PF ||\n \t\t\t vsi->type == ICE_VSI_SF)) {\n \t\tif (netif_running(vsi->netdev)) {\n-\t\t\tif (!locked)\n-\t\t\t\trtnl_lock();\n \t\t\talready_down = test_bit(ICE_VSI_DOWN, vsi->state);\n \t\t\tif (!already_down)\n \t\t\t\tice_vsi_close(vsi);\n-\n-\t\t\tif (!locked)\n-\t\t\t\trtnl_unlock();\n \t\t} else if (!already_down) {\n \t\t\tice_vsi_close(vsi);\n \t\t}\n@@ -2775,12 +2832,30 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked)\n }\n \n /**\n- * ice_vsi_set_napi_queues - associate netdev queues with napi\n+ * ice_dis_vsi - pause a VSI\n+ * @vsi: the VSI being paused\n+ */\n+void ice_dis_vsi(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tice_dis_vsi_locked(vsi);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+}\n+\n+/**\n+ * ice_vsi_set_napi_queues_locked - associate netdev queues with napi\n * @vsi: VSI pointer\n *\n * Associate queue[s] with napi for all vectors.\n+ * Must be called only with the netdev_lock taken.\n */\n-void ice_vsi_set_napi_queues(struct ice_vsi *vsi)\n+void ice_vsi_set_napi_queues_locked(struct ice_vsi *vsi)\n {\n \tstruct net_device *netdev = vsi->netdev;\n \tint q_idx, v_idx;\n@@ -2788,7 +2863,6 @@ void ice_vsi_set_napi_queues(struct ice_vsi *vsi)\n \tif (!netdev)\n \t\treturn;\n \n-\tASSERT_RTNL();\n \tice_for_each_rxq(vsi, q_idx)\n \t\tif (vsi->rx_rings[q_idx] && vsi->rx_rings[q_idx]->q_vector)\n \t\t\tnetif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_RX,\n@@ -2802,17 +2876,37 @@ void ice_vsi_set_napi_queues(struct ice_vsi *vsi)\n \tice_for_each_q_vector(vsi, v_idx) {\n \t\tstruct ice_q_vector *q_vector = vsi->q_vectors[v_idx];\n \n-\t\tnetif_napi_set_irq(&q_vector->napi, q_vector->irq.virq);\n+\t\tnetif_napi_set_irq_locked(&q_vector->napi, q_vector->irq.virq);\n \t}\n }\n \n /**\n- * ice_vsi_clear_napi_queues - dissociate netdev queues from napi\n+ * ice_vsi_set_napi_queues - associate VSI queues with NAPIs\n * @vsi: VSI pointer\n *\n+ * Version of ice_vsi_set_napi_queues_locked() that takes the netdev_lock,\n+ * to use it outside of the net_device_ops context.\n+ */\n+void ice_vsi_set_napi_queues(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *netdev = vsi->netdev;\n+\n+\tif (!netdev)\n+\t\treturn;\n+\n+\tnetdev_lock(netdev);\n+\tice_vsi_set_napi_queues_locked(vsi);\n+\tnetdev_unlock(netdev);\n+}\n+\n+/**\n+ * ice_vsi_clear_napi_queues_locked - dissociate netdev queues from napi\n+ * @vsi: VSI to process\n+ *\n * Clear the association between all VSI queues queue[s] and napi.\n+ * Must be called only with the netdev_lock taken.\n */\n-void ice_vsi_clear_napi_queues(struct ice_vsi *vsi)\n+void ice_vsi_clear_napi_queues_locked(struct ice_vsi *vsi)\n {\n \tstruct net_device *netdev = vsi->netdev;\n \tint q_idx, v_idx;\n@@ -2820,12 +2914,11 @@ void ice_vsi_clear_napi_queues(struct ice_vsi *vsi)\n \tif (!netdev)\n \t\treturn;\n \n-\tASSERT_RTNL();\n \t/* Clear the NAPI's interrupt number */\n \tice_for_each_q_vector(vsi, v_idx) {\n \t\tstruct ice_q_vector *q_vector = vsi->q_vectors[v_idx];\n \n-\t\tnetif_napi_set_irq(&q_vector->napi, -1);\n+\t\tnetif_napi_set_irq_locked(&q_vector->napi, -1);\n \t}\n \n \tice_for_each_txq(vsi, q_idx)\n@@ -2835,6 +2928,25 @@ void ice_vsi_clear_napi_queues(struct ice_vsi *vsi)\n \t\tnetif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_RX, NULL);\n }\n \n+/**\n+ * ice_vsi_clear_napi_queues - dissociate VSI queues from NAPIs\n+ * @vsi: VSI to process\n+ *\n+ * Version of ice_vsi_clear_napi_queues_locked() that takes the netdev lock,\n+ * to use it outside of the net_device_ops context.\n+ */\n+void ice_vsi_clear_napi_queues(struct ice_vsi *vsi)\n+{\n+\tstruct net_device *netdev = vsi->netdev;\n+\n+\tif (!netdev)\n+\t\treturn;\n+\n+\tnetdev_lock(netdev);\n+\tice_vsi_clear_napi_queues_locked(vsi);\n+\tnetdev_unlock(netdev);\n+}\n+\n /**\n * ice_napi_add - register NAPI handler for the VSI\n * @vsi: VSI for which NAPI handler is to be registered\n@@ -3072,16 +3184,17 @@ ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi)\n }\n \n /**\n- * ice_vsi_rebuild - Rebuild VSI after reset\n+ * ice_vsi_rebuild_locked - Rebuild VSI after reset\n * @vsi: VSI to be rebuild\n * @vsi_flags: flags used for VSI rebuild flow\n *\n * Set vsi_flags to ICE_VSI_FLAG_INIT to initialize a new VSI, or\n * ICE_VSI_FLAG_NO_INIT to rebuild an existing VSI in hardware.\n+ * Should be called only under the netdev lock.\n *\n- * Returns 0 on success and negative value on failure\n+ * Return: 0 on success, -errno on failure.\n */\n-int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)\n+int ice_vsi_rebuild_locked(struct ice_vsi *vsi, u32 vsi_flags)\n {\n \tstruct ice_coalesce_stored *coalesce;\n \tint prev_num_q_vectors;\n@@ -3102,8 +3215,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)\n \tif (ret)\n \t\tgoto unlock;\n \n-\tice_vsi_decfg(vsi);\n-\tret = ice_vsi_cfg_def(vsi);\n+\tice_vsi_decfg_locked(vsi);\n+\tret = ice_vsi_cfg_def_locked(vsi);\n \tif (ret)\n \t\tgoto unlock;\n \n@@ -3133,12 +3246,38 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)\n \tkfree(coalesce);\n decfg:\n \tif (ret)\n-\t\tice_vsi_decfg(vsi);\n+\t\tice_vsi_decfg_locked(vsi);\n unlock:\n \tmutex_unlock(&vsi->xdp_state_lock);\n \treturn ret;\n }\n \n+/**\n+ * ice_vsi_rebuild - Rebuild VSI after reset\n+ * @vsi: VSI to be rebuild\n+ * @vsi_flags: flags used for VSI rebuild flow\n+ *\n+ * Set vsi_flags to ICE_VSI_FLAG_INIT to initialize a new VSI, or\n+ * ICE_VSI_FLAG_NO_INIT to rebuild an existing VSI in hardware.\n+ *\n+ * Return: 0 on success, -errno on failure.\n+ */\n+int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)\n+{\n+\tstruct net_device *dev = vsi->netdev;\n+\tint ret;\n+\n+\tif (dev)\n+\t\tnetdev_lock(dev);\n+\n+\tret = ice_vsi_rebuild_locked(vsi, vsi_flags);\n+\n+\tif (dev)\n+\t\tnetdev_unlock(dev);\n+\n+\treturn ret;\n+}\n+\n /**\n * ice_is_reset_in_progress - check for a reset in progress\n * @state: PF state field\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 1d1947a7fe11..50975fe7cab7 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -507,16 +507,15 @@ static void ice_sync_fltr_subtask(struct ice_pf *pf)\n /**\n * ice_pf_dis_all_vsi - Pause all VSIs on a PF\n * @pf: the PF\n- * @locked: is the rtnl_lock already held\n */\n-static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked)\n+static void ice_pf_dis_all_vsi(struct ice_pf *pf)\n {\n \tint node;\n \tint v;\n \n \tice_for_each_vsi(pf, v)\n \t\tif (pf->vsi[v])\n-\t\t\tice_dis_vsi(pf->vsi[v], locked);\n+\t\t\tice_dis_vsi(pf->vsi[v]);\n \n \tfor (node = 0; node < ICE_MAX_PF_AGG_NODES; node++)\n \t\tpf->pf_agg_node[node].num_vsis = 0;\n@@ -605,7 +604,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)\n \tice_clear_hw_tbls(hw);\n \t/* disable the VSIs and their queues that are not already DOWN */\n \tset_bit(ICE_VSI_REBUILD_PENDING, ice_get_main_vsi(pf)->state);\n-\tice_pf_dis_all_vsi(pf, false);\n+\tice_pf_dis_all_vsi(pf);\n \n \tif (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))\n \t\tice_ptp_prepare_for_reset(pf, reset_type);\n@@ -2943,9 +2942,9 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,\n \t\t\t\tgoto resume_if;\n \t\t\t}\n \t\t}\n-\t\txdp_features_set_redirect_target(vsi->netdev, true);\n+\t\txdp_features_set_redirect_target_locked(vsi->netdev, true);\n \t} else if (ice_is_xdp_ena_vsi(vsi) && !prog) {\n-\t\txdp_features_clear_redirect_target(vsi->netdev);\n+\t\txdp_features_clear_redirect_target_locked(vsi->netdev);\n \t\txdp_ring_err = ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_FULL);\n \t\tif (xdp_ring_err)\n \t\t\tNL_SET_ERR_MSG_MOD(extack, \"Freeing XDP Tx resources failed\");\n@@ -3447,11 +3446,13 @@ static void ice_set_ops(struct ice_vsi *vsi)\n \n \tif (ice_is_safe_mode(pf)) {\n \t\tnetdev->netdev_ops = &ice_netdev_safe_mode_ops;\n+\t\tnetdev->request_ops_lock = true;\n \t\tice_set_ethtool_safe_mode_ops(netdev);\n \t\treturn;\n \t}\n \n \tnetdev->netdev_ops = &ice_netdev_ops;\n+\tnetdev->request_ops_lock = true;\n \tnetdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic;\n \tnetdev->xdp_metadata_ops = &ice_xdp_md_ops;\n \tice_set_ethtool_ops(netdev);\n@@ -4058,6 +4059,7 @@ bool ice_is_wol_supported(struct ice_hw *hw)\n * @locked: is adev device_lock held\n *\n * Only change the number of queues if new_tx, or new_rx is non-0.\n+ * Note that it should be called only with the netdev lock taken.\n *\n * Returns 0 on success.\n */\n@@ -4083,7 +4085,7 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)\n \n \t/* set for the next time the netdev is started */\n \tif (!netif_running(vsi->netdev)) {\n-\t\terr = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);\n+\t\terr = ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT);\n \t\tif (err)\n \t\t\tgoto rebuild_err;\n \t\tdev_dbg(ice_pf_to_dev(pf), \"Link is down, queue count change happens when link is brought up\\n\");\n@@ -4091,7 +4093,7 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)\n \t}\n \n \tice_vsi_close(vsi);\n-\terr = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);\n+\terr = ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT);\n \tif (err)\n \t\tgoto rebuild_err;\n \n@@ -5437,7 +5439,7 @@ static void ice_prepare_for_shutdown(struct ice_pf *pf)\n \tdev_dbg(ice_pf_to_dev(pf), \"Tearing down internal switch for shutdown\\n\");\n \n \t/* disable the VSIs and their queues that are not already DOWN */\n-\tice_pf_dis_all_vsi(pf, false);\n+\tice_pf_dis_all_vsi(pf);\n \n \tice_for_each_vsi(pf, v)\n \t\tif (pf->vsi[v])\n@@ -5473,16 +5475,17 @@ static int ice_reinit_interrupt_scheme(struct ice_pf *pf)\n \n \t/* Remap vectors and rings, after successful re-init interrupts */\n \tice_for_each_vsi(pf, v) {\n-\t\tif (!pf->vsi[v])\n+\t\tstruct ice_vsi *vsi = pf->vsi[v];\n+\n+\t\tif (!vsi)\n \t\t\tcontinue;\n \n-\t\tret = ice_vsi_alloc_q_vectors(pf->vsi[v]);\n+\t\tret = ice_vsi_alloc_q_vectors(vsi);\n \t\tif (ret)\n \t\t\tgoto err_reinit;\n-\t\tice_vsi_map_rings_to_vectors(pf->vsi[v]);\n-\t\trtnl_lock();\n-\t\tice_vsi_set_napi_queues(pf->vsi[v]);\n-\t\trtnl_unlock();\n+\n+\t\tice_vsi_map_rings_to_vectors(vsi);\n+\t\tice_vsi_set_napi_queues(vsi);\n \t}\n \n \tret = ice_req_irq_msix_misc(pf);\n@@ -5495,13 +5498,15 @@ static int ice_reinit_interrupt_scheme(struct ice_pf *pf)\n \treturn 0;\n \n err_reinit:\n-\twhile (v--)\n-\t\tif (pf->vsi[v]) {\n-\t\t\trtnl_lock();\n-\t\t\tice_vsi_clear_napi_queues(pf->vsi[v]);\n-\t\t\trtnl_unlock();\n-\t\t\tice_vsi_free_q_vectors(pf->vsi[v]);\n-\t\t}\n+\twhile (v--) {\n+\t\tstruct ice_vsi *vsi = pf->vsi[v];\n+\n+\t\tif (!vsi)\n+\t\t\tcontinue;\n+\n+\t\tice_vsi_clear_napi_queues(vsi);\n+\t\tice_vsi_free_q_vectors(vsi);\n+\t}\n \n \treturn ret;\n }\n@@ -5564,14 +5569,17 @@ static int ice_suspend(struct device *dev)\n \t * to CPU0.\n \t */\n \tice_free_irq_msix_misc(pf);\n+\n \tice_for_each_vsi(pf, v) {\n-\t\tif (!pf->vsi[v])\n+\t\tstruct ice_vsi *vsi = pf->vsi[v];\n+\n+\t\tif (!vsi)\n \t\t\tcontinue;\n-\t\trtnl_lock();\n-\t\tice_vsi_clear_napi_queues(pf->vsi[v]);\n-\t\trtnl_unlock();\n-\t\tice_vsi_free_q_vectors(pf->vsi[v]);\n+\n+\t\tice_vsi_clear_napi_queues(vsi);\n+\t\tice_vsi_free_q_vectors(vsi);\n \t}\n+\n \tice_clear_interrupt_scheme(pf);\n \n \tpci_save_state(pdev);\n@@ -6699,7 +6707,7 @@ static void ice_napi_enable_all(struct ice_vsi *vsi)\n \t\tice_init_moderation(q_vector);\n \n \t\tif (q_vector->rx.rx_ring || q_vector->tx.tx_ring)\n-\t\t\tnapi_enable(&q_vector->napi);\n+\t\t\tnapi_enable_locked(&q_vector->napi);\n \t}\n }\n \n@@ -7198,7 +7206,7 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)\n \t\tstruct ice_q_vector *q_vector = vsi->q_vectors[q_idx];\n \n \t\tif (q_vector->rx.rx_ring || q_vector->tx.tx_ring)\n-\t\t\tnapi_disable(&q_vector->napi);\n+\t\t\tnapi_disable_locked(&q_vector->napi);\n \n \t\tcancel_work_sync(&q_vector->tx.dim.work);\n \t\tcancel_work_sync(&q_vector->rx.dim.work);\n@@ -7498,7 +7506,7 @@ int ice_vsi_open(struct ice_vsi *vsi)\n \t\tif (err)\n \t\t\tgoto err_set_qs;\n \n-\t\tice_vsi_set_napi_queues(vsi);\n+\t\tice_vsi_set_napi_queues_locked(vsi);\n \t}\n \n \terr = ice_up_complete(vsi);\n@@ -7584,7 +7592,7 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)\n \t\tvsi->vsi_num = ice_get_hw_vsi_num(&pf->hw, vsi->idx);\n \n \t\t/* enable the VSI */\n-\t\terr = ice_ena_vsi(vsi, false);\n+\t\terr = ice_ena_vsi(vsi);\n \t\tif (err) {\n \t\t\tdev_err(dev, \"enable VSI failed, err %d, VSI index %d, type %s\\n\",\n \t\t\t\terr, vsi->idx, ice_vsi_type_str(type));\n@@ -9190,7 +9198,7 @@ static int ice_setup_tc_mqprio_qdisc(struct net_device *netdev, void *type_data)\n \t\treturn 0;\n \n \t/* Pause VSI queues */\n-\tice_dis_vsi(vsi, true);\n+\tice_dis_vsi_locked(vsi);\n \n \tif (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))\n \t\tice_remove_q_channels(vsi, true);\n@@ -9229,14 +9237,14 @@ static int ice_setup_tc_mqprio_qdisc(struct net_device *netdev, void *type_data)\n \tcur_rxq = vsi->num_rxq;\n \n \t/* proceed with rebuild main VSI using correct number of queues */\n-\tret = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);\n+\tret = ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT);\n \tif (ret) {\n \t\t/* fallback to current number of queues */\n \t\tdev_info(dev, \"Rebuild failed with new queues, try with current number of queues\\n\");\n \t\tvsi->req_txq = cur_txq;\n \t\tvsi->req_rxq = cur_rxq;\n \t\tclear_bit(ICE_RESET_FAILED, pf->state);\n-\t\tif (ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT)) {\n+\t\tif (ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT)) {\n \t\t\tdev_err(dev, \"Rebuild of main VSI failed again\\n\");\n \t\t\treturn ret;\n \t\t}\n@@ -9292,7 +9300,7 @@ static int ice_setup_tc_mqprio_qdisc(struct net_device *netdev, void *type_data)\n \t\tvsi->all_enatc = 0;\n \t}\n \t/* resume VSI */\n-\tice_ena_vsi(vsi, true);\n+\tice_ena_vsi_locked(vsi);\n \n \treturn ret;\n }\ndiff --git a/drivers/net/ethernet/intel/ice/ice_sf_eth.c b/drivers/net/ethernet/intel/ice/ice_sf_eth.c\nindex a730aa368c92..cd6ba53a873b 100644\n--- a/drivers/net/ethernet/intel/ice/ice_sf_eth.c\n+++ b/drivers/net/ethernet/intel/ice/ice_sf_eth.c\n@@ -58,6 +58,7 @@ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port,\n \teth_hw_addr_set(netdev, dyn_port->hw_addr);\n \tether_addr_copy(netdev->perm_addr, dyn_port->hw_addr);\n \tnetdev->netdev_ops = &ice_sf_netdev_ops;\n+\tnetdev->request_ops_lock = true;\n \tSET_NETDEV_DEVLINK_PORT(netdev, devlink_port);\n \n \terr = register_netdev(netdev);\n@@ -183,7 +184,9 @@ static void ice_sf_dev_remove(struct auxiliary_device *adev)\n \tdevlink = priv_to_devlink(sf_dev->priv);\n \tdevl_lock(devlink);\n \n+\tnetdev_lock(vsi->netdev);\n \tice_vsi_close(vsi);\n+\tnetdev_unlock(vsi->netdev);\n \n \tice_sf_decfg_netdev(vsi);\n \tice_devlink_destroy_sf_dev_port(sf_dev);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c\nindex 0643017541c3..be0cb548487a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_xsk.c\n+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c\n@@ -33,9 +33,9 @@ ice_qvec_toggle_napi(struct ice_vsi *vsi, struct ice_q_vector *q_vector,\n \t\treturn;\n \n \tif (enable)\n-\t\tnapi_enable(&q_vector->napi);\n+\t\tnapi_enable_locked(&q_vector->napi);\n \telse\n-\t\tnapi_disable(&q_vector->napi);\n+\t\tnapi_disable_locked(&q_vector->napi);\n }\n \n /**\n", "prefixes": [ "iwl-next", "v5", "3/5" ] }