Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp728182rdh; Thu, 26 Oct 2023 14:07:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLkt6U+klo+5s29LaQh/dyQU+kpTuUgffEvRg+sZUp2GmJ61bS21RFowKwc1WfnUxn8Etm X-Received: by 2002:a81:ad49:0:b0:59b:ec85:54ee with SMTP id l9-20020a81ad49000000b0059bec8554eemr707605ywk.39.1698354466464; Thu, 26 Oct 2023 14:07:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698354466; cv=pass; d=google.com; s=arc-20160816; b=nMYDNHZ3XlRzsCA2R5DnhOokgbhl/+MnTt+4ZpEkMMQd7RsxlCo4SHIKkXQQ/jZCo0 Ob84X80nYIB5ozAv/aGHSN38k9o4msveDARe0eOuELv8fjijiAZMOoOdXJ7dHdV1kwdY HScgZ9YUPaBe3vp1UoPxM1l7KF0gyIIcniOesAnQTa+j9zlEnwOTiNGuizYtw0pU7zDV AvpQ4sQO9Bjqv7diYR2+XzdnUAXO8L/YnhnPfwJXaX0f5tm6O7hKD26bqHRFz2+tb1nX fG/DL20ekTVpEpGA+kbXy1MwnyTfqaUb4l4xn/XOJzuqduKaL5+ulmtLgB8p1WHY1RZ/ SVJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=JPs8eP6IieOQhnqR6klzGP5pDCVR/FSn6BN6LKQyDDE=; fh=/NjTZvTxQEL6A/3ttNhrN/L1mx6QEN0kwfa5R34XTFo=; b=UxCEuPrZ0XYLcHKlvoq51262uyeZS5KjfVmh2IitPWQy6SGNdKa/W0co2fsU2mvJlO 1gGv/w7QYqeV7TtOc8xBq4TCZHZ2vPsvCXKESyrwXnQwkfdHF4v/gs3g6Q9/ktUmSbD6 t/BgbZ50lV6y9d9aXwoF41grDgl2EA+hedAJqcgbR+olch1V/Q2mIFK1L2SzGUz54i5r +sW8ig/9VJw9+bFLO4MRMzpn4t5TLjUVdm3510UTVKNIoWqm4vnoJ/5f//prGtIUA1QQ LHiECG2R31ncaAgGXNT+r4RaZvBCORq3urpHH9ieOhoIzzRaI9io7MY5kQsJ0Y0wFaqK 9ovw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=X100ac6q; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id s65-20020a815e44000000b005920925b1e0si282643ywb.184.2023.10.26.14.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 14:07:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=X100ac6q; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 64C1A81BB1BC; Thu, 26 Oct 2023 14:07:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbjJZVH3 (ORCPT + 99 others); Thu, 26 Oct 2023 17:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjJZVH2 (ORCPT ); Thu, 26 Oct 2023 17:07:28 -0400 Received: from BN3PR00CU001.outbound.protection.outlook.com (mail-eastus2azon11020002.outbound.protection.outlook.com [52.101.56.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A06D93; Thu, 26 Oct 2023 14:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ddNk+nr3U4yH87aAL/eoEVzuukcOX5whkyGJWFm7NaQrHTKYvmKyybyKWV8Eob7Zg5dFlT/wxvrx4QdeyXoGo9TZlXmlUeaLcB09UQdecFmaSNkzFiS7LH1YpzIhr3m743/E97AwQUujHW7l03b/ScolGKiSm0pB18UtP/2oUflcKKuX1SZuENW0rB5B8HXo5Ro/Spd4tS1nqiCBxatcX+89cru1K1wI6TvhvwH7vrJ6KMWqb83MeOg4o6wKT1AXCqE9XINX0JBbdsSprlyP0TsUXdwOucdb/veOP2gXZq9b+7/kNqR44AQofzovljyZNje2nA1iWaKp6Yt+vJ9riQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JPs8eP6IieOQhnqR6klzGP5pDCVR/FSn6BN6LKQyDDE=; b=nij0ovTqzjO+UVXpU/2dNggo4ooo8FHRqXw1Q1gScnShUEU7wi+W8CsKejsySY9rZwehHKUkmR+rU4xE6E0XK222RHIxDQvBflHCsIHUtUolDdg1wjKv2WKaZmEd0OD2b+PrsKvxzf8qouZdQroNCdBmXhkZGV++CBG3R5FyCqalvz+PUm3n2EIPZmPUaNlZRw59DlAArtZ9cS8BpauDtx6ZyWH5kME6OulYzpiQTsoXB7R6W+ssOSBDvKSiduPnPGFeKKQjrPrFECkA/WarB3Z/miGdW/xeLG444vXX2Fz0RseV5gXLKJndC4TewY5wGEc4bT9U6zkg396xi+eoDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JPs8eP6IieOQhnqR6klzGP5pDCVR/FSn6BN6LKQyDDE=; b=X100ac6qJaUkvRT2hgsAPCo+MtmNdhsRjELLiJCYMzcZjXBN/DVd65+fRfR1fjxFWBIBaZ7PwY8Y3KxW/k56Ys5O6sfjVHAr6toXOV6UcdC9S9Y3t1X/mJ2tm6srNpVVXc7cfc8E/jfDahq0FeSAyyurf6Ey2+QI+uPbdf6QsX0= Received: from MN0PR21MB3264.namprd21.prod.outlook.com (2603:10b6:208:37c::19) by BL1PR21MB3306.namprd21.prod.outlook.com (2603:10b6:208:39b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.6; Thu, 26 Oct 2023 21:07:22 +0000 Received: from MN0PR21MB3264.namprd21.prod.outlook.com ([fe80::9f51:f462:e8d2:d242]) by MN0PR21MB3264.namprd21.prod.outlook.com ([fe80::9f51:f462:e8d2:d242%5]) with mapi id 15.20.6954.005; Thu, 26 Oct 2023 21:07:22 +0000 From: Long Li To: Stephen Hemminger , "longli@linuxonhyperv.com" CC: KY Srinivasan , Haiyang Zhang , Wei Liu , Dexuan Cui , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" Subject: RE: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode Thread-Topic: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode Thread-Index: AQHaB5W4U0Kx/aurvkOjV7lIJbHFdbBcSWCAgABHzdA= Date: Thu, 26 Oct 2023 21:07:22 +0000 Message-ID: References: <1698274250-653-1-git-send-email-longli@linuxonhyperv.com> <20231026094841.39f01d26@hermes.local> In-Reply-To: <20231026094841.39f01d26@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=a803e39c-7cff-470d-8f4d-d1e0f795ac24;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-10-26T21:05:39Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR21MB3264:EE_|BL1PR21MB3306:EE_ x-ms-office365-filtering-correlation-id: 599e9ca4-451e-4766-eae7-08dbd6678c27 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HACY+LjmapsxBbR9uGNyCCXmmfnM70wzKhxWCH8hIuI/eW3qTvZbLEDyW8WvdSl7nWgHLoVcKY6UiASF8xpTU73zWl6Fasw0v5hjBFilwf19jKsONzXROI3qrGTG+sKnG+qud9yNXKwIrV6cL28r0uNQ2+pfRu2RtVitMmkFt7hlg9HUZud8zi8dOozNpgowC8t+sALZmAD3SfkW/zT8yFaTFMEDzN/f2uHPHscw/Ce00ERclEQWrJi8t1Vbt40Ibh8cOW518CYbDULPo5mCdPU0HSD8AaS2VRxMGaPPIahFZ9YZZqqSLyI9j75Mid/gmz1mNW7oYuFnNWIISFZ6805uc+p2xOlmIzOHWEVMH5qRnz7gsGL+HLd7e379Diec7Hey+t71Dbe051ZSO9bd5mN9IQCUbCqEPrnSwLpMSICvNPPC7RR+kU0H+Tn+IcajJc37osjj3UW977eQGKUOKwfvS8dBnqlS/viLsQil58HLh6pOKaiWGj+S39SWz0Kakishrke7EIg6aIR3cNn9uTFZWGV+He5fJ6zN0P2QPQQdaeka6743pr5bzmf9wJdRzyAqs6shI79mWXMc5ioD88wvsv9kofMxpsodyX74iow0+ckEgRtl1SqGZtjmxEuc2+WMOiiRIGJH4jCmmwi6lbp1os2Hj3If2LlNa7QPmKY= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR21MB3264.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(346002)(136003)(366004)(396003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(66556008)(8990500004)(66946007)(83380400001)(316002)(10290500003)(54906003)(38100700002)(76116006)(64756008)(66446008)(110136005)(7696005)(9686003)(82950400001)(26005)(6506007)(66476007)(71200400001)(7416002)(41300700001)(2906002)(8936002)(86362001)(122000001)(4326008)(82960400001)(8676002)(5660300002)(33656002)(478600001)(52536014)(38070700009)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0nnY3Cyh1YOJIV2FpYGEVBjzr55fxlNhOTJAL+aZ+t+P5mAHlSfsncNJ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+Cl7C3h6fITDKcoKMOPnk1uSL04JMc?= =?us-ascii?Q?pNraQzuHEGmqyqu7aUmzQ1gkQkn+7yYWLwgQmrnp6LGXJVw/EmCopulwiZol?= =?us-ascii?Q?phEaQEV7rzSTCPBbefuVxENu6zgtTmU7ZvA7a5NFiiiZ/9gaviz5Ziwnwdxn?= =?us-ascii?Q?Fv2RBmbGDP3qlM8YcYFEpO41ISZdj2t246l2to1xzMFu5gGiB63tdFOCJnDk?= =?us-ascii?Q?J8vaQlzhlpcFuYacw91JqJRrF5qbxEj9Nagn/i2EjHSiBQ8wqGQlTqZMaiXa?= =?us-ascii?Q?eOoQuq3193d+nzUTrGH3IBBYl3fdBXWuibQHK258NuM1h3aRUPaZFRPYmErw?= =?us-ascii?Q?c5IiW5prWZ7pjPVOoaYS9dkPBeWvvmAiVqejgqi7ZlQ4lJjm0GWSnEhzctcQ?= =?us-ascii?Q?d7BVnn/AREzlmGYhUbs3KI6dyzAQ97XOETdpDvW6iF5HllEU3bUxlVOI8ELg?= =?us-ascii?Q?8T/ifJrQtzUg1iAPJKfFcRLi7lhVKVHs0HQH98s544/FFbGF9m+mTA9fDrmC?= =?us-ascii?Q?IyNlP35it5xzAwgR8TiKQDSu59zupDuDma0WxVnkwu0761XrvjJj3op6kp94?= =?us-ascii?Q?YmsCWVJnN2XdyCBeVfQ9UunH0dCnzat+R6VpsIPoWMf9QF6yq3daEGg0hxTV?= =?us-ascii?Q?0uTfGYqLhrNcc24Ep6fzvZbcXOcSZ4wGRzjGm3B3?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR21MB3264.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 599e9ca4-451e-4766-eae7-08dbd6678c27 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2023 21:07:22.1711 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OrQT2virXgk9Py4XH8gVVUSgbYk+wbUQiAs9p7KoapFlBnjzumFUD79hwz5nXTggkU3lV9acRzRrhZfbr7IV6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR21MB3306 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 26 Oct 2023 14:07:43 -0700 (PDT) > Subject: Re: [PATCH] hv_netvsc: Mark VF as slave before exposing it to us= er-mode >=20 > On Wed, 25 Oct 2023 15:50:50 -0700 > longli@linuxonhyperv.com wrote: >=20 > > @@ -2347,6 +2342,12 @@ static int netvsc_register_vf(struct net_device > *vf_netdev) > > if (!ndev) > > return NOTIFY_DONE; > > > > + if (event =3D=3D NETDEV_POST_INIT) { > > + /* set slave flag before open to prevent IPv6 addrconf */ > > + vf_netdev->flags |=3D IFF_SLAVE; > > + return NOTIFY_DONE; > > + } > > + > > net_device_ctx =3D netdev_priv(ndev); > > netvsc_dev =3D rtnl_dereference(net_device_ctx->nvdev); > > if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) > > @@ -2753,8 +2754,9 @@ static int netvsc_netdev_event(struct notifier_bl= ock > *this, > > return NOTIFY_DONE; > > > > switch (event) { > > + case NETDEV_POST_INIT: > > case NETDEV_REGISTER: > > - return netvsc_register_vf(event_dev); > > + return netvsc_register_vf(event_dev, event); >=20 > Although correct, this is an awkward way to write this. > There are two events which call register_vf() but the post init one short= circuits > and doesn't really register the VF. >=20 > The code is clearer if flag is set in switch statement. >=20 I will add a dedicated function to handle NETDEV_POST_INIT. Thanks, Long