From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B33E5606A32C for ; Thu, 3 Dec 2026 15:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=CBSfb5qQ; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TqPZgW9y Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8B43061B32; Thu, 3 Dec 2026 15:51:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8rNyeZbT9ISz; Thu, 3 Dec 2026 15:51:13 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 46B2F61B3E Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796313073; b=nsizJDkQxNmW7Tt8F4nslEkrBXEl/FXLyajRBSu1URHltTiKBliFTutPR3W7NVTC9ogm uYMmQnI0top0YmO/hR4N2M4Oe2slGd1n5BYT2aSSK51JwQbA7BbyekuqOxqlUgg6VOYap DYFYXIoEvcdtzX9PEKr329vfiXSh7sQbNPS86GmRvLL/ljepEoJffJlSaoIudCoxHyIVW N3TOP/R/WOIphzvrD7F/FCvVzvjL04EWUTh1KxaAu3rBMXv3taTGQmLD1yxkO/jFGg6Ix IjGEBkJpCE+i2tYqYAFiyL9S2DMY+DmvXx3QqMmiMd8wWrZILmDzZk0W6lRyF7dVf5w== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796313073; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:Received:From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:X-Mailman-Approved-At:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Errors-To; bh=gUtpJXxnsi2T93pB3C5PsrSfecM4L/tQE+OkLr9loVk=; b=p1Y/XV+kVhfJrbuPXqTqzNqKbXjfar2smoohqDzLn/si3+aFA1J309MsiwdN2ImUYYBb MUFtgssBz8ahRDl7yCTeAUGprX3si8a+ZRSvjbbYjS5m78hpd6J5T97yBagPvt7loZyqb UPpnHAyinw2gYUA7tZNN0a5+tT7tQu9ceYP/YFRmuc8JOCx3YkRl3Ehm5SmU09o1Mx43T mk9VmWbiKRhpBm/7BsfKerjZ2VHzPsuzmSyV+SRExFgXqnCx+fjgtJtNd3uDiH7CTdQwT Emnnddel7c554YrxDtzktAvpKHTuP5f6vcc75nngCBlq0C/ZwtISXKK61lIrcTscWJQ== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=pass header.from=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TqPZgW9y; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796313073; bh=gUtpJXxnsi2T93pB3C5PsrSfecM4L/tQE+OkLr9loVk=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=CBSfb5qQSkpBClP4SLHKHk2iekg6VOqXvdpgq94paqwFn2TiMNu5G+o9MnuTAhEyo Fw4E0quHtv+b7lGI2AsuD9tSssZ025l+LtD+WYdSeMx87NH4/upDEYDsdqDJ5Z6+d5 u/Cqs+4bwUoAC3j3ItnAbcSiXQa9swW0ATCBp0WNi52f11GJfM4+5eCpvzpKZxQfEA lcD6gbJJPQZ1bqnxdWz1REFp+vmdu3DvHYP/UVVGg54a/9C7BuTSAeN0lXiFNhxsAh yX8pB1bL2JI5phOL2cz4P/yZHeudQu7WdgE62OlIer/StOcYHXqUZfxUn2lPUY2hK7 1TB9J2pmhSIeA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 46B2F61B3E; Thu, 3 Dec 2026 15:51:13 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 439033DB for ; Thu, 3 Dec 2026 08:39:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 29AAF61031 for ; Thu, 3 Dec 2026 08:39:50 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2SqTPqYzEKpy for ; Thu, 3 Dec 2026 08:39:49 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 8E27960FCA Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:20::629" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::629; helo=mail-ej1-x629.google.com; envelope-from=cldlss@gmail.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TqPZgW9y Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8E27960FCA for ; Thu, 3 Dec 2026 08:39:47 +0000 (UTC) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-c4cac7a7d3cso2110677966b.3 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=lists.osuosl.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=TqPZgW9yzJPMbT7Hm5UqGiNvrSViSfe8Qghmpizl8WGqbWUChbhHcT3bY+EFzWYST6 bmizG7kxnOZM9O9zYjHJO6259PcTXtIyd13RdqF41+Jw8cy+ioE4MTJo6zkdOTr4wox1 v8FDXqVX6Iq5NOquRZhQZAh407alVcC1Y3B2BqGJ/ozt9I5YtaEoLwBmlooP/T8WMA59 BUdGkDhh8KsYUb54RtOZdIUseyXnS5ycDdU62y1lsBOFZF+qiqCcvaIF1r211ObKtnCl 4LZlXb7dlRcgIrQArL3vxpIAtheQAHIhdoPeft4MFhL/Tw9Pmpc6XZ06+VTGSO5J+HK6 7+cg== 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=Q5P3XqzkPcZqI4vOecNnylNnwVErZhRaSQ1IouQPZrbM0SOWbEqy6fATlD6ZcrFnMR buodu1UnszolVyUNGZRbOoWn8nomJwo8ir3csTphE8kroshCGJzMmCJn11mShSnAXz07 DeCfzvlD24QyfjpI0AYh04t5p6NSsO4hj7JZ3rkm6khf6IeFGWLJbQlq6BCeaNY04RSB xNtQS2yt1vWPjz/o+gpL4Rfrbxu6MZjvvDl1FzpACteSGw5Y0Xz1rlrHEjrdJZFYCyIt JOE1DFeuww2RrZOGVwFJDgGtCax9fuVadgj2BdVs0SrOo9LMcFpucvqjO3tzH+NBt/uj fhMQ== X-Gm-Message-State: APuU4Z9ePcFWsXw3HBcBQg/jsAxG3EBaZmVQ0oBGN+B8SUu1EkMyL5Ki XLUQzvcluJ3KmyHpDwNbCMWnerQnXfT/LOBoBISwsBDTWtPtCMScjRJz X-Gm-Gg: AZFdTZcw9LhpYQzA3F7IRueX8J5LWois9WTfbjhmQk2CfgrarSrNu4k2BxwuIw7WTUJ xLOZCpq7vvGhi9mn5R4Hs+BBw6BoSwNmyUoOHBShgDLf7SxkNIYTAOxDkd3xAyhKFzARMFB18eA SKrEJSCnNkse9A6ONDKfreoM4KwQz5Fxt53FpTXidiG9IDFxbDugcLa23xBiF3zRXs3MIylhBG0 b3WPlxoEOyoq53mLLSp9EJG+0o3bgU/OO6NgCBFiWZev2p6oWQW/uOzN3tWeKJQETOzB7eYG7wy CZPmFvgjJEDAYZ80HAyXMd8FYr+3T2hC3NH+oJz+JGb6+95fLfvIAOq53IyTaHcjxXyan6qdQnT wfh5+laJvegVnuHXpGzahT4wmTGm2SQam81MhK30o/OwZe5/b6fGyyiQ6B9lSEvwPcc/TEUbxu4 m2RZ4snCwH3/cW2V4vbFADsacTESxZEvDmSIAzZtaEeJI3XY+LT2jbkv2bFOWGyuBVB4nfKpvTW EZ/f7CWiOm6AG5HqLPFJQ+1qf02JXAOQerDPbLTCN+yIYXjagrc3Ye0w8SZJPC1O3pRF3zX 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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 03 Dec 2026 15:51:12 +0000 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-17.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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)