Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2220916imm; Mon, 28 May 2018 04:12:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqhr4VFRDfvdXH0/stNlPFUKImx90Nd8Ey/LkbabSSirbJvlhLHMjytPDDCQP6JVyIQE4Zr X-Received: by 2002:a65:5105:: with SMTP id f5-v6mr10375490pgq.232.1527505965597; Mon, 28 May 2018 04:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527505965; cv=none; d=google.com; s=arc-20160816; b=A/CRmnEC/Zu8gnryZFf6qpIi8WUFYNyo4lsWeShiM8lFZJjQ7Be5+ohCEDqFoEvCJc vKAmohqT1MVjeaBwpc3Rm7WlQH+Rhv16P2aE2BagtUahu+bIr8Re0I+iRk4LYbhv5mcf AbY4iRYRnHUsK3D/qU/KwqFDmuV07yGY7X6wsTGs7xAxZwBk1qPYTUwYYllL8zlqb28U ZdNMcGMxF8VQ2riLRnCGTYRcoeqvU5IJ3TwvQD5d0jDeeW2FpQne6kUGoudjtpFFaCd2 oZEB14yNhw51IO5friGcGDXEyxrx30OTeGfHu2vJoGO9MUxMfXBf5HHRWuySJvWhSJaZ Ye/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=jwmWJf7v3tLTA5J17EI1E2N3HVLHMp4Kw3zf+O8b60s=; b=pT8R41i5r/emPUIUOAOYKH25qSEAWhCsTQzUr0nMibuNoILZeFM5BkOR5P3inEzenU /iyfx07sgmAEIxh8MRCNYh8/kUjSJVr2l9JSCMwG94MENAyN+auITI8cYmYHR1veXWrL CDO4FtpBWVvc51p8evA+AesPoTcfLcvDJ3s3PioUNG5UOf/ydVfwCrYwWkavSKR9xSi8 XPxlJGqt48SYXZ49lCwk+jTs3LJCE7k9eNeZrY4iILiZPaTvH+JIulN+ivJ2aX4wNjq+ SvqwW+dGwsNrp8AVKgqzFf1VLTvCuOVGVhpkqle9Qf2X32Vx/9xS9I6Ho8l8A1g0BZSC 4cuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TdP43+RS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si29685821pla.194.2018.05.28.04.12.30; Mon, 28 May 2018 04:12:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TdP43+RS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422745AbeE1LKR (ORCPT + 99 others); Mon, 28 May 2018 07:10:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423851AbeE1LKM (ORCPT ); Mon, 28 May 2018 07:10:12 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 9827E2087E; Mon, 28 May 2018 11:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505812; bh=REKp1/MTT+QReElp25QDUodPqplcORcCUr1FvEG8+Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdP43+RSkVmVb1JlBpnsHHOZpnNmpKkXYLATw+T9grTzXJfOZyE9f9oIKWunF8BCY OcTfymgijn8Nzyu/hhKRCRSu8Pd6Yv9nBmvoPU58MA4LKbpKqYH1UJR8VTLKYbkwjB P1IgPegYa9XnFT9ZxmCfwUL2vFcnifgEpw6aHSBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , Ben Hutchings , Jay Vosburgh , "David S. Miller" , Sasha Levin Subject: [PATCH 4.16 137/272] virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS Date: Mon, 28 May 2018 12:02:50 +0200 Message-Id: <20180528100252.571928573@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jay Vosburgh [ Upstream commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718 ] The operstate update logic will leave an interface in the default UNKNOWN operstate if the interface carrier state never changes from the default carrier up state set at creation. This includes the case of an explicit call to netif_carrier_on, as the carrier on to on transition has no effect on operstate. This affects virtio-net for the case that the virtio peer does not support VIRTIO_NET_F_STATUS (the feature that provides carrier state updates). Without this feature, the virtio specification states that "the link should be assumed active," so, logically, the operstate should be UP instead of UNKNOWN. This has impact on user space applications that use the operstate to make availability decisions for the interface. Resolve this by changing the virtio probe logic slightly to call netif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS cases, and then the existing call to netif_carrier_on for the "without" case will cause an operstate transition. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Ben Hutchings Signed-off-by: Jay Vosburgh Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2874,8 +2874,8 @@ static int virtnet_probe(struct virtio_d /* Assume link up if device can't report link status, otherwise get link status from config. */ + netif_carrier_off(dev); if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { - netif_carrier_off(dev); schedule_work(&vi->config_work); } else { vi->status = VIRTIO_NET_S_LINK_UP;