Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1894081lql; Wed, 13 Mar 2024 11:04:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVI00ve6IQZvDG4Jwy5ejKz//VA4ywccMq2TVkyfKAoh5w9fDdW8ZisAb5xV7I5Ib3JAg8s1JwZNsnUD5H9CHuNezfSjJmzezMGNEe2iw== X-Google-Smtp-Source: AGHT+IF4Y6Bz968luZsBGaiRIlrlHZmxRvVwHwxHW0X5DTztyxJKTwnSNdlxuICkvX+MmqIwbWGX X-Received: by 2002:a17:90a:dc13:b0:29c:5fcb:4fd5 with SMTP id i19-20020a17090adc1300b0029c5fcb4fd5mr2127302pjv.19.1710353041374; Wed, 13 Mar 2024 11:04:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710353041; cv=pass; d=google.com; s=arc-20160816; b=DY91v12WTSjbgRnOefm5aixeqsKCCd+oxkqM0sVehalf/AchIc8L14ZlBdosMrO7ay SoHliiRYh4BYgIoGJaZSl8NndNJTtOEvMxYgzCQ2N5yVqmrr5k4wgg1tIQfz6zht6vIS JhWNZzmYIoh8Yt001nsBEeuVT+2Av3gFcrRxocxodBdIQTECsJ/icPvJENI+53xJmqBA M9N/e7ys2wlzsRGUD8O6CU+u2DqrdH5s811uSx/ieTn1/N2RD63CuywpXUf8rL5yHVDF R95hvImN/rdEwpVJDjHGRGMg17a4W7p1+btrAE9+nbt4eJUeGx7kRb+h2rB+Y5VuQ2dN KZNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qTxvCVzVJ7GM3QWWvZCz/r3pO+MWS81JRaWP90DBaFM=; fh=hcSQUZmmjNT0h+Rtzfwrqu7KlZYjznuTG/QRtB5NZLs=; b=awMuySnsQ1LPnSi67hckLgI1+WY/qiXUqPowo9l90nRP1rrhO14HSErq3YY8Pku9im /lNfz//xyjO+cLj8aFPewC2YteApGNWXwnUmcFymC+mgZ6WQ2NU1UyKPdaDceldbt9wX ZtbPYoS18hc4DGwvzj9w0G3bS2a0D4CPbz1PzEILpF1csxq1woocCnaJ+3h60n1GGnE1 xKzqK90shY+Kit3frwIzwi9sB/uGhRxkmdmE9MSvccOupqJy6AE/1SxVSb20YA4OZUwF 4aQwt89mVjRKgxiI3azUjIPayeKr65Od5YnRSZx/k/Ps7797q6s6Yrd/XGeFqwhly7xo SNIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ijPTWkF7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y23-20020a17090aa41700b0029c74a38c69si223799pjp.168.2024.03.13.11.04.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:04:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ijPTWkF7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5B085B241D0 for ; Wed, 13 Mar 2024 17:53:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B8E315E5D4; Wed, 13 Mar 2024 16:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ijPTWkF7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E6A415E5B9; Wed, 13 Mar 2024 16:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348462; cv=none; b=KkhqOTHvgche6QxW7/dDoNSD3gqC6g1/OOWwRpPdkoPPTf1NuiYcrSRpWTmG2S6vMYshR2AWwdsEbEO8gMSTVTxGQ29RUaSe2o1ONzSpAm4ZoNq6E6Ks2vSw7r1FRcU5z+HVLWGvTAVd0QN+lzD9BAqOOL+bRk6AqgAiL2jbrmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348462; c=relaxed/simple; bh=nhbKbEX9nHakPLpkOIH63yejM4HifZj5GXSMu2I7y9o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AtYCoatYWaJZ7NkCkLADFEQGghImn+SIzIVsyde34tSeXqbJodnQ+uSXwvlmvYCOKr65eATTwem8M2HOYs04yAGxvEGm/uptuf0/L73sQs7l1pL1X2UqsAetLnpCLXXjzduLzNwwLeom6WqrqZHuFAp9ESDYVdwqhxxXwWOqh90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ijPTWkF7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79DB9C433F1; Wed, 13 Mar 2024 16:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348462; bh=nhbKbEX9nHakPLpkOIH63yejM4HifZj5GXSMu2I7y9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijPTWkF7TGi52oKap6TAmKdGpaZOMbi+n7cm54b3La3+jEhBRi+TLNUTf75opL3xT tFtsDw3+aTEj8FVvuR5FxOmlGKB1mg1ReHF/EmKPyytqAA2cS1BshUE8YALP6nTcOB 6B6FLWI40E7aPZ1/QizAnkaISy0KCZ+5fgvQ0RR20AI67Gil48eyEuaAYun4wfWu52 bXscbzWS5uDXSvJqSZTh11TtuJhBEXyvFaGCI2L32jT0ZmFfDsAV0zAa1lekL+SN+U jQSofgz7qb3/QLvpG+cJ/5wigtc8SAONfevNklVni4pWONEc+rCguORhJH04btmlxg wsJW1Y5W+2a4Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Long Li , Haiyang Zhang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 54/73] hv_netvsc: Process NETDEV_GOING_DOWN on VF hot remove Date: Wed, 13 Mar 2024 12:46:21 -0400 Message-ID: <20240313164640.616049-55-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164640.616049-1-sashal@kernel.org> References: <20240313164640.616049-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.213-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.213-rc1 X-KernelTest-Deadline: 2024-03-15T16:46+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Long Li [ Upstream commit 34b06a2eee44d469f2e2c013a83e6dac3aff6411 ] On VF hot remove, NETDEV_GOING_DOWN is sent to notify the VF is about to go down. At this time, the VF is still sending/receiving traffic and we request the VSP to switch datapath. On completion, the datapath is switched to synthetic and we can proceed with VF hot remove. Signed-off-by: Long Li Reviewed-by: Haiyang Zhang Signed-off-by: Jakub Kicinski Stable-dep-of: 9cae43da9867 ("hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed") Signed-off-by: Sasha Levin --- drivers/net/hyperv/netvsc_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 57a5ec098e7e0..057b1a9dde153 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2411,12 +2411,15 @@ static int netvsc_register_vf(struct net_device *vf_netdev) * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network * interface, there is only the CHANGE event and no UP or DOWN event. */ -static int netvsc_vf_changed(struct net_device *vf_netdev) +static int netvsc_vf_changed(struct net_device *vf_netdev, unsigned long event) { struct net_device_context *net_device_ctx; struct netvsc_device *netvsc_dev; struct net_device *ndev; - bool vf_is_up = netif_running(vf_netdev); + bool vf_is_up = false; + + if (event != NETDEV_GOING_DOWN) + vf_is_up = netif_running(vf_netdev); ndev = get_netvsc_byref(vf_netdev); if (!ndev) @@ -2762,7 +2765,8 @@ static int netvsc_netdev_event(struct notifier_block *this, case NETDEV_UP: case NETDEV_DOWN: case NETDEV_CHANGE: - return netvsc_vf_changed(event_dev); + case NETDEV_GOING_DOWN: + return netvsc_vf_changed(event_dev, event); default: return NOTIFY_DONE; } -- 2.43.0