Received: by 10.192.165.148 with SMTP id m20csp4619647imm; Tue, 8 May 2018 11:20:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoJ5Onry/2WLyUWpiYTGGjWOCHvm1SLiSZ1VNFF9rH9CpAiukeyMqCycW6QebV0b8XOOMgg X-Received: by 2002:a17:902:9042:: with SMTP id w2-v6mr42110599plz.34.1525803603496; Tue, 08 May 2018 11:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525803603; cv=none; d=google.com; s=arc-20160816; b=sQFYkEe/DQtNeLlPM6PFsfSiIk6MLqmjHHBZOWMnAVkqfOuCqNWr4YaxIDxcrneXD0 yUfKbbATX2M0ygb/WvSDqGxGNvK9GPoODHL+sLcJC7SixWd2mVsBsJ/Q/cyuZt2ODaap AYnKco2WvMOKGGuUeWCiqVXY4HKFe7yX+Gx+p37FlyPyx5ygvAC7ReJQZG4JFnb16Sfl xx97lV44YG0b+8igB2mSVV7vylzfH8v3u4+CmHLAzrqRZpsEMGc5ZtzGyGxMlCMAheG3 mD/b2JKSVQ36IJrp1pRBj/ZjPDICvBhwoGaoTEElcBKUfQSynFFWi7mnWuLN/CewbOrA fu3Q== 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 :organization:references:in-reply-to:date:cc:to:reply-to:from :subject:message-id:arc-authentication-results; bh=RQjz7Pbb1AJHQkjxY38xaV3Qz8oN4SusCJrM26k87B4=; b=pyPyRjZSAEg+0MdIDay+wW0/6JIhNky0tJeE4hal7oAa3rLtMUIGzfkwJuZc1L/FDZ bRmOh7mN4htAqLcJA7pr2l2+CuqleFOIl/PVGWVcqmmgD43TECNzWHtPqItfVQE/qvVm ysWSZswsREkSZZhaUNDt0vjsPsU4+g2A1c//12IGGDuiA0MAAPD5xxwYrG7iDyZR8tv6 IrBlDScDSnN74AeiQjK+0ouI1Q4WfdvFoVp/qCDB2CnBLMrAtyMmpl50foeeEpFLmL6T 6X2nRUVwZtBVgEp8SbbATxK5UqxmHHbPQafEdmfnrIHCq7jBesZZC8W5aMFwcxmMQUio J0fw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si22775470pln.443.2018.05.08.11.19.48; Tue, 08 May 2018 11:20:03 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933588AbeEHSR5 (ORCPT + 99 others); Tue, 8 May 2018 14:17:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46630 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933120AbeEHSRz (ORCPT ); Tue, 8 May 2018 14:17:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 865B0EB71C; Tue, 8 May 2018 18:17:54 +0000 (UTC) Received: from ovpn-112-46.ams2.redhat.com (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3B4DAFD75; Tue, 8 May 2018 18:17:52 +0000 (UTC) Message-ID: <1525803471.4366.15.camel@redhat.com> Subject: Re: [PATCH] hv_netvsc: Fix net device attach on older Windows hosts From: Mohammed Gamal Reply-To: mgamal@redhat.com To: Stephen Hemminger Cc: netdev@vger.kernel.org, sthemmin@microsoft.com, haiyangz@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, vkuznets@redhat.com Date: Tue, 08 May 2018 20:17:51 +0200 In-Reply-To: <20180508111323.1767fc0c@xeon-e3> References: <1525801247-27765-1-git-send-email-mgamal@redhat.com> <20180508111323.1767fc0c@xeon-e3> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 08 May 2018 18:17:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 08 May 2018 18:17:54 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mgamal@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-05-08 at 11:13 -0700, Stephen Hemminger wrote: > On Tue,  8 May 2018 19:40:47 +0200 > Mohammed Gamal wrote: > > > On older windows hosts the net_device instance is returned to > > the caller of rndis_filter_device_add() without having the presence > > bit set first. This would cause any subsequent calls to network > > device > > operations (e.g. MTU change, channel change) to fail after the > > device > > is detached once, returning -ENODEV. > > > > Make sure we explicitly call netif_device_attach() before returning > > the net_device instance to make sure the presence bit is set > > > > Fixes: 7b2ee50c0cd5 ("hv_netvsc: common detach logic") > > > > Signed-off-by: Mohammed Gamal > > --- > >  drivers/net/hyperv/rndis_filter.c | 4 +++- > >  1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/hyperv/rndis_filter.c > > b/drivers/net/hyperv/rndis_filter.c > > index 6b127be..09a3c1d 100644 > > --- a/drivers/net/hyperv/rndis_filter.c > > +++ b/drivers/net/hyperv/rndis_filter.c > > @@ -1287,8 +1287,10 @@ struct netvsc_device > > *rndis_filter_device_add(struct hv_device *dev, > >      rndis_device->hw_mac_adr, > >      rndis_device->link_state ? "down" : "up"); > >   > > - if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) > > + if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) { > > + netif_device_attach(net); > >   return net_device; > > + } > > Yes, this looks right, but it might be easier to use goto existing > exit > path. > I was just not sure if we should set max_chn and num_chn here. I will modify the patch and resend. > diff --git a/drivers/net/hyperv/rndis_filter.c > b/drivers/net/hyperv/rndis_filter.c > index 3b6dbacaf77d..ed941c5a0be9 100644 > --- a/drivers/net/hyperv/rndis_filter.c > +++ b/drivers/net/hyperv/rndis_filter.c > @@ -1316,7 +1316,7 @@ struct netvsc_device > *rndis_filter_device_add(struct hv_device *dev, >                    rndis_device->link_state ? "down" : "up"); >   >         if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) > -               return net_device; > +               goto out; >   >         rndis_filter_query_link_speed(rndis_device, net_device); >