From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796287188; b=Me559bOCafmjtPh5usdKM02niWd0CULRByg1XN36sLgBEN5FxXklC/L6siGmqProSQ8n AWryZ9nA7YzX5mPaEKYeZCJl7neC/Muuw1nKv7W6WRXyWby7WVIro5I2Jb0WcDIAcV2zb l5EVprv6oLObVIKbvdChG9sL3O6Jw064UvcUQBb0YFTBzwwH8pdtfpOk8iXoclNP6HYk9 YkQzZNkeva3uDR5GQADbgieS6oEluaOJqBMmeLNz1GD386OcNfOsgh9cPrQnmKnC4hbN7 o1dckxX0Q8AswpDaRiFbE1JhELabMARWv+sMksO723O1czm0apTW5utjzTMi3Wd5k0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287188; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding; bh=gUtpJXxnsi2T93pB3C5PsrSfecM4L/tQE+OkLr9loVk=; b=DftPrOclzlkmv7W/0LuCW/xan72InQ4K0WsMqhmpLmZv7mdJFq4tKSWZIiXmiA/0LAfC T1HeaCo2FE2ZOflEdGNXDXRiT7Kllyq/uDnaAlLr4qy2E2fxQYSwmSo0bAMnRqoSRFHKY 1vY3JQiyu+LqXBrAnAeiydTI9GK35Nd+qhLPjjEF3ncFDJbEaqN4/lrS/gkIu1ph/rVF2 hL9E15AI5TSjYVNNyJkqipgJWbA7xSztOJQuvsWQeVctV21PNVKOzZaLNiCFA5mP5e+MO kuQFNIkwYNY46Yg0Y4DpUHyvHUdZ2xPnFX0+AE/Jd/lmFEzhuEIxT+KtrzpNsA/QpAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PQi912fz; arc=none smtp.remote-ip=209.85.218.43 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4A95606A336 for ; Thu, 3 Dec 2026 08:39:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E4A95606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PQi912fz Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-c5118deebcfso2117880466b.1 for ; Thu, 03 Dec 2026 00:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796287186; x=1796891986; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=gUtpJXxnsi2T93pB3C5PsrSfecM4L/tQE+OkLr9loVk=; b=PQi912fz9BpSrDlNg0sLRpUlsZXCj5wRJEzWyFnRfoxqF9PRwKqyac2VScxpmoBfQo 4/G4Brkl7WMK49RyF7gKYa/Qse+PYlvzBM2ZdvB4Up8m2IF68oWciPN9ZhVrA0eSlmPo upF+tfyBK6z3OTivmvKfhmNJX57fcWDYGwGFVBDQBGqU4FxOPTNP4roMWnh76pj2diZR C51jSbzipiAnBXeOWINBHQDc4LBqfDl4tF3L1BOqsJjfQi9xtJEFeBjEgLOUJYrLm9+W fS4uSl9i8w9fXLtBtp/aNP9Nbh3OX5t+TdPhn3iRI/P1DYk59fUsLyhaN27Qq6Eswtzu 9Mpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796287186; x=1796891986; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gUtpJXxnsi2T93pB3C5PsrSfecM4L/tQE+OkLr9loVk=; b=Xy+SPNaJIuJ7Ll5FMbNL8ftSneVkCHGrMyVLxXNuJufgTshntP5HbT5GCh2o31lpUQ LmlOPflfhmR36vSNxdHb/N9cz5iRZnPZ0f+4WwZOLTH6hdvqpvt4/vk4q/VA0NaBSglX mYq+FEpy3XxnrPd+Jrc58KYLUp7W4egy3Y9Svx4+S0jXx7U2kwhkIs1ZbUKP3o0IW/Od mVNZ0zWylJ8iYshWNRPQkQIJ0Lchzgwne+8+Fv0QuK0Sdr1kGU3GFzRq7vtjqAP9tTUY frAF/uZ0tLNn5EBIc6ML1GQNyDIuiHtdAS3rrUOk6jJaITw9ohjuBBxyne2C8SmrtaCL RXiw== X-Forwarded-Encrypted: i=1; AL+hErFOkpMSAMpSmHHQD3yEp/eo2WGp4A+Vc/TtgayijFHueuJavXCF72E/aXyePJtMCZjqXFB+8u4=@vger.kernel.org X-Gm-Message-State: APuU4Z9sQWaHASE7pPLmD0Fz/loXSjZ7cWOu2sWfN7worlACq7t6f+8/ 17Y44W9nUqBYzES5SNLhgPthvPRBzoYAnOiJ7WMwV5UF+9uIDwFIQU7n X-Gm-Gg: AZFdTZd912S7p+oecOSCQSOkddm9MudEKxAolAAYRnhjWyVqJ1amRlnmLpv3teY6OIJ 9cfCD+nqxTv2HAjcBVKPc+7kyBgyieS4IABu6VnqVA1Yp2NZn574X5rl4DOJx9jgthe9s99h8eU B1eRZ5bmSlxDAhnPZ1Xz3W5txmBKm4rLqwrImHpwPiuy4u5FT5agL4lGZmawtnp9oo0cX6zgTZa D6GFIUdWEFLbNZnEwULKacehdJl563jeLDUCtHot9VwnF8+xHAoBno4Qu/0LUY9CJT+td5tVMot RRZsYfNn9e0L0KpON88fq34OzhW0bREnC3zj7Cb9UGxvh5ZQ5xX/m73BFLVtvMxhT0RLI2dGw7K kFD/qnsACohMrXE7bQe7eKsxUJKsbHiXvR4Zqqu1WinqppwN3PgcEPb6U4RhUguuV8TR761Hq8l V3tO8ofJ+L5zrSsMpD2RkEPLnTPKMdPmdCSbEdw4+H9+yBVs47H97u0u9DJaswxYqezRkNPUJcp juZFPilNo9HkGJJ+LUp34TUq+UUhLqlVqxVCkCL2+bdyIrsoo7tZM3MvYjBfjCD3eRS19j6 X-Received: by 2002:a17:906:19c1:b0:c49:bf6a:28fa with SMTP id a640c23a62f3a-c513aad65eemr2503131866b.28.1796287186124; Thu, 03 Dec 2026 00:39:46 -0800 (PST) Received: from gmail.com ([2a0e:dc0:2:7836::1]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513aebe94fsm1408565766b.49.2026.12.03.00.39.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Dec 2026 00:39:45 -0800 (PST) From: Alexander Lopintsev To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com Subject: [PATCH net] iavf: restore queues after failed VF reset Date: Thu, 3 Dec 2026 11:39:36 +0300 Message-ID: <20261203083936.79920-1-cldlss@gmail.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 7bit If Admin Queue initialization fails during a VF reset, iavf_disable_vf() frees the queues and lets the watchdog retry initialization. The registered netdev can retain IFF_UP while the adapter reaches __IAVF_DOWN. The finish-config worker updates the queue counts but does not allocate and enable the data queues, leaving the interface without traffic until a manual down/up. This was observed as a connectivity loss on a running SR-IOV guest. Reproduce the recovery failure by returning IAVF_ERR_ADMIN_QUEUE_ERROR once from the post-reset iavf_init_adminq() call through a lab-only hook. Request the VF reset by changing the RX descriptor count. Share the queue-start sequence with ndo_open and run it from iavf_finish_config() for an already registered, administratively up VF. Keep RTNL before the netdev lock, skip removal and pending resets, and leave carrier updates to the existing virtchnl completion path. Clear address synchronization state when the VF filters are discarded so that reinitialization can replay them. Reschedule finish-config when a follow-on reset finishes before queue restart. Remove the unreachable RUNNING check while extracting the open sequence. The preceding DOWN check already returns -EBUSY for RUNNING adapters. The 2023 revert removed dev_close() from reset failures while retaining the removal of direct IFF_UP updates. Reopening the preserved interface after successful reinitialization restores the missing recovery step. Two hardware A/B runs on an Intel X722 VF with an i40e PF and Ubuntu 7.0.0-38-generic reproduced carrier 0 for 30 seconds with the baseline. With this change, the same injected failure recovered carrier and three consecutive IPv6 replies while preserving IFF_UP. Control resets also recovered. Testing required the one-shot source hook described above. The full x86 allmodconfig and allyesconfig all targets build before and after this fix with W=1 and GCC 13.4.0. CONFIG_WERROR and CONFIG_DRM_WERROR are disabled for existing baseline warnings, while iavf_main.c is built with -Werror. allyesconfig uses KASAN_OUTLINE to fit the build host; KASAN remains enabled. The fixed builds reuse completed baseline objects and add no warnings. Kernel networking selftests and runtime testing on the current net base have not been run. Developed with AI assistance (Codex); reviewed with Kimi and Mistral. Fixes: d916d273041b ("Revert "iavf: Do not restart Tx queues after reset task failure"") Signed-off-by: Alexander Lopintsev --- Notes for reviewers: Przemek's XLVF v7 01/15 [1] addresses RSS and resource handling during reinitialization after iavf_disable_vf(). This patch restores the data queues when that reinitialization leaves a registered, administratively up netdev in __IAVF_DOWN. The relevant posted XLVF diffs do not add this queue restart. Yuho's queue-disable failure patch [2] keeps rings allocated when the PF fails VIRTCHNL_OP_DISABLE_QUEUES. Here, the injected failure is in post-reset Admin Queue initialization. The comparison is based on the posted diffs; combined runtime testing with either proposal has not been performed. The trigger of the original PF reset has not been established. The one-shot hook reproduces the recovery failure after that reset. Hardware A/B used the Ubuntu kernel described above; runtime testing on the net base remains pending. The Fixes attribution follows source history, without a hardware bisect of historical kernels. A local C control-flow regression and an alternative hardware regression harness are public at [3]. The public hardware harness uses fail_function with a debug kernel. The A/B results above used the one-shot module parameter hook; the public fail_function harness has not been hardware-validated. [1] https://lists.openwall.net/netdev/2026/11/21/273 [2] https://lists.openwall.net/netdev/2026/11/02/63 [3] https://github.com/alopintsev/iavf-recovery/tree/bddcb3ba700b42f25487e9027f8018047bbf06ff drivers/net/ethernet/intel/iavf/iavf_main.c | 107 ++++++++++++-------- 1 file changed, 66 insertions(+), 41 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 4de3ea852..c235c408f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -14,6 +14,7 @@ #define CREATE_TRACE_POINTS #include "iavf_trace.h" +static int iavf_start_queues(struct iavf_adapter *adapter); static int iavf_setup_all_tx_resources(struct iavf_adapter *adapter); static int iavf_setup_all_rx_resources(struct iavf_adapter *adapter); static int iavf_close(struct net_device *netdev); @@ -2003,21 +2004,23 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter, bool runni static void iavf_finish_config(struct work_struct *work) { struct iavf_adapter *adapter; + struct net_device *netdev; bool netdev_released = false; int pairs, err; adapter = container_of(work, struct iavf_adapter, finish_config); + netdev = adapter->netdev; /* Always take RTNL first to prevent circular lock dependency; * the dev->lock (== netdev lock) is needed to update the queue number. */ rtnl_lock(); - netdev_lock(adapter->netdev); + netdev_lock(netdev); if ((adapter->flags & IAVF_FLAG_SETUP_NETDEV_FEATURES) && - adapter->netdev->reg_state == NETREG_REGISTERED && + netdev->reg_state == NETREG_REGISTERED && !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) { - netdev_update_features(adapter->netdev); + netdev_update_features(netdev); adapter->flags &= ~IAVF_FLAG_SETUP_NETDEV_FEATURES; } @@ -2027,33 +2030,44 @@ static void iavf_finish_config(struct work_struct *work) * state == __IAVF_DOWN */ pairs = adapter->num_active_queues; - netif_set_real_num_rx_queues(adapter->netdev, pairs); - netif_set_real_num_tx_queues(adapter->netdev, pairs); + netif_set_real_num_rx_queues(netdev, pairs); + netif_set_real_num_tx_queues(netdev, pairs); - if (adapter->netdev->reg_state != NETREG_REGISTERED) { - netdev_unlock(adapter->netdev); + if (netdev->reg_state != NETREG_REGISTERED) { + netdev_unlock(netdev); netdev_released = true; - err = register_netdevice(adapter->netdev); + err = register_netdevice(netdev); if (err) { dev_err(&adapter->pdev->dev, "Unable to register netdev (%d)\n", err); /* go back and try again.*/ - netdev_lock(adapter->netdev); + netdev_lock(netdev); iavf_free_rss(adapter); iavf_free_misc_irq(adapter); iavf_reset_interrupt_capability(adapter); iavf_change_state(adapter, __IAVF_INIT_CONFIG_ADAPTER); - netdev_unlock(adapter->netdev); + netdev_unlock(netdev); goto out; } + } else if ((netdev->flags & IFF_UP) && netif_device_present(netdev) && + !(adapter->flags & (IAVF_FLAG_PF_COMMS_FAILED | + IAVF_FLAG_RESET_PENDING | + IAVF_FLAG_RESET_NEEDED)) && + !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) { + /* The netdev kept IFF_UP while the VF was down. */ + adapter->flags |= IAVF_FLAG_QUEUES_DISABLED; + err = iavf_start_queues(adapter); + if (err) + netdev_err(netdev, "Failed to restart queues after VF reinitialization: %d\n", + err); } break; case __IAVF_RUNNING: pairs = adapter->num_active_queues; - netif_set_real_num_rx_queues(adapter->netdev, pairs); - netif_set_real_num_tx_queues(adapter->netdev, pairs); + netif_set_real_num_rx_queues(netdev, pairs); + netif_set_real_num_tx_queues(netdev, pairs); break; default: @@ -2062,7 +2076,7 @@ static void iavf_finish_config(struct work_struct *work) out: if (!netdev_released) - netdev_unlock(adapter->netdev); + netdev_unlock(netdev); rtnl_unlock(); } @@ -3068,7 +3082,11 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) iavf_free_all_rx_resources(adapter); } + /* Startup must be able to replay addresses whose VF filters are lost. */ + netif_addr_lock_bh(adapter->netdev); spin_lock_bh(&adapter->mac_vlan_list_lock); + __dev_uc_unsync(adapter->netdev, NULL); + __dev_mc_unsync(adapter->netdev, NULL); /* Delete all of the filters */ list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { @@ -3083,6 +3101,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) adapter->num_vlan_filters = 0; spin_unlock_bh(&adapter->mac_vlan_list_lock); + netif_addr_unlock_bh(adapter->netdev); spin_lock_bh(&adapter->cloud_filter_list_lock); list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { @@ -3341,6 +3360,9 @@ void iavf_reset_step(struct iavf_adapter *adapter) } else { iavf_change_state(adapter, __IAVF_DOWN); wake_up(&adapter->down_waitqueue); + /* A follow-on reset can finish before the queues were restarted. */ + if (netif_running(netdev)) + iavf_schedule_finish_config(adapter); } adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; @@ -4472,39 +4494,13 @@ static void iavf_restore_fdir_filters(struct iavf_adapter *adapter) spin_unlock_bh(&adapter->fdir_fltr_lock); } -/** - * iavf_open - Called when a network interface is made active - * @netdev: network interface device structure - * - * Returns 0 on success, negative value on failure - * - * The open entry point is called when a network interface is made - * active by the system (IFF_UP). At this point all resources needed - * for transmit and receive operations are allocated, the interrupt - * handler is registered with the OS, the watchdog is started, - * and the stack is notified that the interface is ready. - **/ -static int iavf_open(struct net_device *netdev) +static int iavf_start_queues(struct iavf_adapter *adapter) { - struct iavf_adapter *adapter = netdev_priv(netdev); + struct net_device *netdev = adapter->netdev; int err; netdev_assert_locked(netdev); - if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) { - dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n"); - return -EIO; - } - - if (adapter->state != __IAVF_DOWN) - return -EBUSY; - - if (adapter->state == __IAVF_RUNNING && - !test_bit(__IAVF_VSI_DOWN, adapter->vsi.state)) { - dev_dbg(&adapter->pdev->dev, "VF is already open.\n"); - return 0; - } - /* allocate transmit descriptors */ err = iavf_setup_all_tx_resources(adapter); if (err) @@ -4545,6 +4541,35 @@ static int iavf_open(struct net_device *netdev) return err; } +/** + * iavf_open - Called when a network interface is made active + * @netdev: network interface device structure + * + * Returns 0 on success, negative value on failure + * + * The open entry point is called when a network interface is made + * active by the system (IFF_UP). At this point all resources needed + * for transmit and receive operations are allocated, the interrupt + * handler is registered with the OS, the watchdog is started, + * and the stack is notified that the interface is ready. + **/ +static int iavf_open(struct net_device *netdev) +{ + struct iavf_adapter *adapter = netdev_priv(netdev); + + netdev_assert_locked(netdev); + + if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) { + dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n"); + return -EIO; + } + + if (adapter->state != __IAVF_DOWN) + return -EBUSY; + + return iavf_start_queues(adapter); +} + /** * iavf_close - Disables a network interface * @netdev: network interface device structure base-commit: 0d39bf81267861742b80d5f1c52e8a63e9ca0ca1 -- 2.50.1 (Apple Git-155)