Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp717867pxb; Fri, 8 Jan 2021 16:57:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuLvkIEB2NahR51er2XRLQKk+rb8fPycDWfzS8UFQbLbwSreifUYSP4u1AvWwONwYxl9wS X-Received: by 2002:a17:907:da7:: with SMTP id go39mr4463440ejc.58.1610153835420; Fri, 08 Jan 2021 16:57:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610153835; cv=none; d=google.com; s=arc-20160816; b=YQ+OFUgCqmyIKCiUFiT0SFk6nvJJht8mkyBzNelOIRwZZOuKL5860ki4QlPqVQhXpn SCm7Mz5+Eiv094xyYTfgvEis4GyTcmUWl0g6CCamcxVZHtJ1+YLkiirfaU8rxHjQhgNA ARb5JDsS7m50XC2zMndTU2JLwwoHwsMWlA7CeZnN2KMPwgFYHI8621dLd9PIXf9ASGZ2 iF2thBE86l74m8IMP1PXaAECs5nJMDbPNXhF/tU/O8N2ZJb6AINXp8Orx6M7ketnRAtO 27n5v58EZaCDdDskI9fE94rVIK4glQ7xCPbYxI9FZSpd47LgIXiSMRDicystCQaGHrV/ vp5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=a9mYqRWHBtW/4GhoIGv+qIDowOAzSYAjrMOFelGtva8=; b=HgE5/Ksv6CrAcvZqpwlSZ9bJznDTBwZLnqax8SvaFzI8YVI064l0svBDD18TuCByfO NcCrruMR++D0/w6nvoOASpv1w8RL7hG7s4YcAkkG3RXiI3KuCvzYKNyLNyUMrJefAdjH n1AHWDUzKHfwzBqJkoGfFgnR4cC31RXz6LTYG0AptlQ8UpxvzjWkBVWXsWOvCr6Ph4fD APkeaU2SlNUZ84unJSg129K9U64uUVxTBZCxfAwSHLkZCKr5evXidTcAB8Jli8YeNtME OJEz9lVtvig9RzhiZ3i+uO+0DEV/BhpVLovwzdj/M9AkoIVlicRol45ZB62KI4UNB8Yn 1LUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=Cwsd1IsS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si4065115ejd.199.2021.01.08.16.56.51; Fri, 08 Jan 2021 16:57:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=Cwsd1IsS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbhAIAyq (ORCPT + 99 others); Fri, 8 Jan 2021 19:54:46 -0500 Received: from linux.microsoft.com ([13.77.154.182]:41740 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbhAIAyq (ORCPT ); Fri, 8 Jan 2021 19:54:46 -0500 Received: by linux.microsoft.com (Postfix, from userid 1004) id D4F8D20B6C42; Fri, 8 Jan 2021 16:54:05 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D4F8D20B6C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1610153645; bh=a9mYqRWHBtW/4GhoIGv+qIDowOAzSYAjrMOFelGtva8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cwsd1IsSZqOe3XwG/mwVPmC5GeHuXrqadX+yHNOpLA3qSE5bdKKTOrIuQM8QJi5yT YAzSRkXQ7jg65PIZgogPcSCNNNsL77XAHhz6xj8alQgSV8eUvc0g3plKotOuFkpekK 4NxIBAdFDgiXp596sUOsiYx2imNS1fAS4ARjsHpQ= From: Long Li To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , "David S. Miller" , Jakub Kicinski , linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [PATCH v2 3/3] hv_netvsc: Process NETDEV_GOING_DOWN on VF hot remove Date: Fri, 8 Jan 2021 16:53:43 -0800 Message-Id: <1610153623-17500-4-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1610153623-17500-1-git-send-email-longli@linuxonhyperv.com> References: <1610153623-17500-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Long Li 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 --- 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 64ae5f4e974e..75b4d6703cf1 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2382,12 +2382,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) @@ -2716,7 +2719,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.27.0