From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BE551A0542; Fri, 7 Feb 2020 17:12:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C32DA1C0DB; Fri, 7 Feb 2020 17:12:15 +0100 (CET) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id E2FE61BFE6 for ; Fri, 7 Feb 2020 17:12:13 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id w21so1369807pgl.9 for ; Fri, 07 Feb 2020 08:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tvgln/FSer2XEKxd2rN3AhgGGjb5Esy3A2d+gF+MTmc=; b=BtSK0bSPfTgLwkfGpXyQ3/IXnJwxnIlv1+/PWJxd5dZhJaGOh6jvBPh/S9Y27l3hOM kR6mtyvDsHbMqmwVWbRjrOdvw3CaY5b/Knde8gPz47d8m5M6/OlJvLVI8nA8Iz2XwxYV vbKtmlKopPzVO1XsPunuydJENUs7sqcQQxJnb3RaqPt812CcDpj5KZ35vUzDd/sE6KoK Xio49SD+ramF3uWhn61qO16SNy8OOvKuIpZO3gHfA33A00Jan0yO98i8oRfPaeb8isUH qZssgAZEMIh8U4KbiVwkHv6Y8HRc2/hdPudTOyeTn/0kD90pcUOyNlYm3wAsDJ/D10Z5 G0Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tvgln/FSer2XEKxd2rN3AhgGGjb5Esy3A2d+gF+MTmc=; b=dFGmEY7dl3a/FaGzPi2VYK+yWb8ciLYtwbtkcb1rp072DO9JCYFtCh2BoxXYP3WINo FphmrVOoo5jRmcxfk6HTQ88jAigqQikWaYXgDjiCcb+sK5ZEY+gSFU/zvGPbPca4FbtZ 4XQViQ/PpzPwoXp3Od71EpzCw5rJBStR0yDs5C3QmhJHzPP6wYklnhMloZ8GRP2a7IrV vR4MBQKMcfnmNloaJh6uhpFVzxvh5pBz/bSMEot1QUJBYOd2d9RB8z4NByaTkfMM/UUu kLeoc5kyjNz7jCHXTFiAcYaFlDF/T/YzCTUwiwU8IgHYvHkgN3Kd0BXuyzZE+qd68kgK 3vmg== X-Gm-Message-State: APjAAAVTBp3ppyzJNnM88kS6HKhJfktmuQfKVHQHQSBVPuE8DxSv35WP vzOkSpPF5HwSETxJU/y4csSUP63IbraiEQ== X-Google-Smtp-Source: APXvYqxHmdW9nPoWL/+wyt0gTTKlzszRG6QlvhPuut4x/3V5lmE/toAESHDugx+Dthlh13fGd+bMSw== X-Received: by 2002:a17:90a:e389:: with SMTP id b9mr4653396pjz.7.1581091932735; Fri, 07 Feb 2020 08:12:12 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id u12sm937403pgr.3.2020.02.07.08.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 08:12:12 -0800 (PST) Date: Fri, 7 Feb 2020 08:12:04 -0800 From: Stephen Hemminger To: Mohammed Gamal Cc: dev@dpdk.org, Stephen Hemminger Message-ID: <20200207081204.56e36149@hermes.lan> In-Reply-To: <3e5e62ec4a9436920ba9ab59185b49d2957a02a2.camel@redhat.com> References: <20200206105541.1186-1-mgamal@redhat.com> <20200207001038.7254-1-sthemmin@microsoft.com> <3e5e62ec4a9436920ba9ab59185b49d2957a02a2.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFT] net/netvsc: initialize link state X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 07 Feb 2020 15:22:23 +0200 Mohammed Gamal wrote: > On Thu, 2020-02-06 at 16:10 -0800, Stephen Hemminger wrote: > > If application is using link state interrupt, the correct link state > > needs to be filled in when device is started. This is similar to > > how virtio updates link information. > > > > Reported-by: Mohammed Gamal > > Signed-off-by: Stephen Hemminger > > --- > > This version marked RFT because am in airport without access to a > > machine to test it. > > > > drivers/net/netvsc/hn_ethdev.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/net/netvsc/hn_ethdev.c > > b/drivers/net/netvsc/hn_ethdev.c > > index c79f924379fe..564620748daf 100644 > > --- a/drivers/net/netvsc/hn_ethdev.c > > +++ b/drivers/net/netvsc/hn_ethdev.c > > @@ -823,6 +823,10 @@ hn_dev_start(struct rte_eth_dev *dev) > > if (error) > > hn_rndis_set_rxfilter(hv, 0); > > > > + /* Initialize Link state */ > > + if (error == 0) > > + hn_dev_link_update(dev, 0); > > + > > return error; > > } > > > > I tested this and I always get the link status as UP, regardless of > whether I start the interface on the guest in UP or DOWN state. Looking > at hn_dev_link_update() code, I see that the link status depends on the > NDIS status that the driver gets from the host if my understanding is > correct. > The question is whether if I use 'ip li set dev $IF_NAME down' on the > guest affects the status the host sees, or would the host set the state > to NDIS_MEDIA_STATE_CONNECTED of the device is physcially connected > regardless of what the guest tries to do? > Are you confused about admin state vs link state? Admin state is the up/down state in software, and link state is the (virtual) hardware link status. In traditional Linux, admin state is controlled by ip link set up/down; in DPDK the admin state is implied by whether the DPDK device is started or stopped. The link state for hardware devices is determined by whether the hardware link has synchronized with the switch. In virtual environments this is synchronized. In Linux link state is reported as NOCARRIER (IFF_RUNNING). In DPDK it is reported in via the link info get. The device visible to the kernel is the accelerated networking (Mellanox) device and is not related directly to the netvsc device. To test link up/down is not easy on Azure. You would have to use Azure CLI to disconnect the NIC from VM. On native Hyper-V you can test by setting up a virtual switch with an external network device; then unplug the network device.