Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4414943pxa; Mon, 10 Aug 2020 08:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymKGHQjscxkpRo4FU/70kuHHSCCB8WP7XD/tma6Zpd+8xc6QL2aFPukIjl9BLuqOxIviD8 X-Received: by 2002:a17:906:f1da:: with SMTP id gx26mr22453327ejb.129.1597073594379; Mon, 10 Aug 2020 08:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073594; cv=none; d=google.com; s=arc-20160816; b=uiAf39rMVkMXsfzBF630ETmsER34Ack/58UCqPaPfQ8IgPrLBbgEKUe/2ISbcfH2BC iC4pwRodswwev0xrj0z2fnx38jYfncXCljhkxX32FMksXgU7mbzahLmifNGsvpOBkfC1 uQmWDU7DT71wx4uj+ZQRIpg/Yidz+apd2hzeOdnu4Rc0tjZENkeZNndryx819VpJZvWY CPIhDw1Le3c5JtSnaAsy/2QuU0woGA7oSxiKfPrHi6BKaQgqO7N6RSL0P+VyMbIllATx V2yxhgn6TVBzMJgpK1kWF25liSfN9lQVKSqq6P2mX9wJlWbOJgG7YwQuKgJtM/tDRHAa ozWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vbs02kZNKK1G9Pcu1SGswH4I+/y8kuQvTHi2Q+FeJS8=; b=Pz4pqNGHthmy7a/NzoQfu6C20y2nk338DKUjwVGMcXw6foJFKa9hfWw675+QoUQooY r1txnYLDOpPPiWYvHKOjKfQfJsdtmpE2UGOLplwe+snVedECFDukzqY8tBh8pcncxr/F bYafGbDHc3tJAQkr+1lsrjKQS9l3yfOMe/x2cl8k4tZWX+w632fWf59zb+Si3RhsQ+90 jeJl5X/Jy9pJtNkLjVya59IVI6e1HQFsn/VDOngXb2vvcnvJeJv4wULyN8e48EG+ysv/ pgwZULC18zhuePdYdmHtnk0YHT6qRHyC1jQe7NbkEb+FxT8MF21M6C8tYv88QEzqSq6m ntpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gc5fJNi8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si10688831ejb.359.2020.08.10.08.32.51; Mon, 10 Aug 2020 08:33:14 -0700 (PDT) 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=@kernel.org header.s=default header.b=gc5fJNi8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbgHJPad (ORCPT + 99 others); Mon, 10 Aug 2020 11:30:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:37468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbgHJPab (ORCPT ); Mon, 10 Aug 2020 11:30:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 546DD22B4E; Mon, 10 Aug 2020 15:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073430; bh=2QRROI2k7MJ+DKbhUfFPfn4ahpH62ukiBkER15FU9wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gc5fJNi8zFXKAame3rXCG3r4YAIYvd9jPiYK3Svj/MffsTMCrajO9/Uk8mFZaGRxn mnwv8BIlAmaaHC5RkVDSsY6/LENUPnxBb91vxRt9ERskaFSsDl2L4H7OBXIs/uw4oN py4bAKp4skGGhdWqX7f9HIluXXLHD/nGZphr0nFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Shah, Ashish N" , Stephen Hemminger , Haiyang Zhang , "David S. Miller" Subject: [PATCH 4.19 37/48] hv_netvsc: do not use VF device if link is down Date: Mon, 10 Aug 2020 17:21:59 +0200 Message-Id: <20200810151806.042873899@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Hemminger [ Upstream commit 7c9864bbccc23e1812ac82966555d68c13ea4006 ] If the accelerated networking SRIOV VF device has lost carrier use the synthetic network device which is available as backup path. This is a rare case since if VF link goes down, normally the VMBus device will also loose external connectivity as well. But if the communication is between two VM's on the same host the VMBus device will still work. Reported-by: "Shah, Ashish N" Fixes: 0c195567a8f6 ("netvsc: transparent VF management") Signed-off-by: Stephen Hemminger Reviewed-by: Haiyang Zhang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -543,12 +543,13 @@ static int netvsc_start_xmit(struct sk_b u32 hash; struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT]; - /* if VF is present and up then redirect packets - * already called with rcu_read_lock_bh + /* If VF is present and up then redirect packets to it. + * Skip the VF if it is marked down or has no carrier. + * If netpoll is in uses, then VF can not be used either. */ vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev); if (vf_netdev && netif_running(vf_netdev) && - !netpoll_tx_running(net)) + netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net)) return netvsc_vf_xmit(net, vf_netdev, skb); /* We will atmost need two pages to describe the rndis