From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0054.outbound.protection.outlook.com [104.47.2.54]) by dpdk.org (Postfix) with ESMTP id 6B9DF1B260 for ; Wed, 10 Jan 2018 16:07:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=AtLIE1PAo3qobywUMHzbjWQub6KVmvVtAAcfUWWnrAE=; b=Dpn+8ELW1mPVDgbHQP/p5uvIX/ItDyooF4QCsH2Fjf1KxFVM/sWdyO8wpT3AOQtl7JQSL+ivc9YHkyzmWonxEP85qhknq7XM3YFGPpukuO7zq3nXDI2OENuokc2VEIBCIc/OotEpu/F6ZlUma/Dey+fhN2O3r8noBB+AS+DJR38= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by DB5PR05MB1686.eurprd05.prod.outlook.com (10.165.6.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 15:07:14 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::b4b4:7de8:cf70:aa3a]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::b4b4:7de8:cf70:aa3a%13]) with mapi id 15.20.0386.006; Wed, 10 Jan 2018 15:07:14 +0000 From: Matan Azrad To: Stephen Hemminger CC: Ferruh Yigit , Thomas Monjalon , "dev@dpdk.org" , Raslan Darawsheh Thread-Topic: [PATCH v3 6/8] net/vdev_netvsc: skip routed netvsc probing Thread-Index: AQHTiXrf4Z/trf3caE68y4HPxCQw7KNtNUnA Date: Wed, 10 Jan 2018 15:07:14 +0000 Message-ID: References: <20171222173846.20731-1-adrien.mazarguil@6wind.com> <1515509253-17834-1-git-send-email-matan@mellanox.com> <1515509253-17834-7-git-send-email-matan@mellanox.com> <20180109105128.7c268db6@xeon-e3> In-Reply-To: <20180109105128.7c268db6@xeon-e3> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR05MB1686; 7:ogyr1SzaxAKwH/DudQRuuLy1XVtSjPNXYAHNF1CNYL/4ECBB7f32VLLBnXFF5+YX4fR+/mc2lHmh8B72YhohTxlh7d3dgNJ29ZxVAOOUCILT2pC2CaAyP0tzG65nJxG7AR7gWP5npdFHrvSmf+ywwBORgiif8AlFhS8+JomcNJF9goH+1mab3RXUQZBkdZqYAKjuL3Cjm+kYlnyBGk/omYHz4gUhO6r3jH5N98u3RgNDOz1zljYJZ2Pt5U5IKrkp x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 97f3bf5e-a3d5-4617-1413-08d5583bd527 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:DB5PR05MB1686; x-ms-traffictypediagnostic: DB5PR05MB1686: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231023)(944501075)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB5PR05MB1686; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB5PR05MB1686; x-forefront-prvs: 0548586081 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(396003)(376002)(39380400002)(39860400002)(24454002)(189003)(199004)(99286004)(33656002)(105586002)(3280700002)(6916009)(3660700001)(229853002)(81166006)(68736007)(107886003)(2950100002)(76176011)(81156014)(8936002)(8676002)(14454004)(5660300001)(6116002)(25786009)(2906002)(93886005)(575784001)(316002)(7696005)(54906003)(4326008)(6246003)(3846002)(5890100001)(86362001)(5250100002)(66066001)(2900100001)(7736002)(74316002)(305945005)(478600001)(102836004)(6436002)(9686003)(59450400001)(53936002)(55016002)(6506007)(106356001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1686; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: pn9aRNLfWNzj8n9CqGnuwhm5CBl5jEaDLRxmQGBszku690kkE5C4wvc2FsIDXwBoxgxj2QwrtdZfo/SBQyWEEw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97f3bf5e-a3d5-4617-1413-08d5583bd527 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2018 15:07:14.4278 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1686 Subject: Re: [dpdk-dev] [PATCH v3 6/8] net/vdev_netvsc: skip routed netvsc probing 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: , X-List-Received-Date: Wed, 10 Jan 2018 15:07:16 -0000 Hi Stephan From: Stephen Hemminger, Tuesday, January 9, 2018 8:51 PM > To: Matan Azrad > Cc: Ferruh Yigit ; Thomas Monjalon > ; dev@dpdk.org; Raslan Darawsheh > > Subject: Re: [PATCH v3 6/8] net/vdev_netvsc: skip routed netvsc probing >=20 > On Tue, 9 Jan 2018 14:47:31 +0000 > Matan Azrad wrote: >=20 > > NetVSC netdevices which are already routed should not be probed > > because they are used for management purposes by the HyperV. > > > > prevent routed netvsc devices probing. > > > > Signed-off-by: Raslan Darawsheh > > Signed-off-by: Matan Azrad > > --- > > doc/guides/nics/vdev_netvsc.rst | 2 +- > > drivers/net/vdev_netvsc/vdev_netvsc.c | 46 > > +++++++++++++++++++++++++++++++++++ > > 2 files changed, 47 insertions(+), 1 deletion(-) > > > > diff --git a/doc/guides/nics/vdev_netvsc.rst > > b/doc/guides/nics/vdev_netvsc.rst index fde1fb8..f779862 100644 > > --- a/doc/guides/nics/vdev_netvsc.rst > > +++ b/doc/guides/nics/vdev_netvsc.rst > > @@ -87,4 +87,4 @@ The following device parameters are supported: > > MAC address. > > > > Not specifying either ``iface`` or ``mac`` makes this driver attach > > itself to -all NetVSC interfaces found on the system. > > +all unrouted NetVSC interfaces found on the system. > > diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c > > b/drivers/net/vdev_netvsc/vdev_netvsc.c > > index 3d8895b..4295b92 100644 > > --- a/drivers/net/vdev_netvsc/vdev_netvsc.c > > +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c > > @@ -38,6 +38,7 @@ > > #define VDEV_NETVSC_PROBE_MS 1000 > > > > #define NETVSC_CLASS_ID "{f8615163-df3e-46c5-913f-f2d2f965ed0e}" > > +#define NETVSC_MAX_ROUTE_LINE_SIZE 300 > > > > #define DRV_LOG(level, ...) \ > > rte_log(RTE_LOG_ ## level, \ > > @@ -192,6 +193,44 @@ static LIST_HEAD(, vdev_netvsc_ctx) > > vdev_netvsc_ctx_list =3D } > > > > /** > > + * Determine if a network interface has a route. > > + * > > + * @param[in] name > > + * Network device name. > > + * > > + * @return > > + * A nonzero value when interface has an route. In case of error, > > + * rte_errno is updated and 0 returned. > > + */ > > +static int > > +vdev_netvsc_has_route(const char *name) { > > + FILE *fp; > > + int ret =3D 0; > > + char route[NETVSC_MAX_ROUTE_LINE_SIZE]; > > + char *netdev; > > + > > + fp =3D fopen("/proc/net/route", "r"); > > + if (!fp) { > > + rte_errno =3D errno; > > + return 0; > > + } > > + while (fgets(route, NETVSC_MAX_ROUTE_LINE_SIZE, fp) !=3D NULL) { > > + netdev =3D strtok(route, "\t"); > > + if (strcmp(netdev, name) =3D=3D 0) { > > + ret =3D 1; > > + break; > > + } > > + /* Move file pointer to the next line. */ > > + while (strchr(route, '\n') =3D=3D NULL && > > + fgets(route, NETVSC_MAX_ROUTE_LINE_SIZE, fp) !=3D > NULL) > > + ; > > + } > > + fclose(fp); > > + return ret; > > +} >=20 > In many ways /proc/net/route is legacy intervace. > And system may have 1 M routes. >=20 > Maybe there is faster way to do this with netlink by looking to see if th= ere is > an address associated with the interface. Actually this is control path, we don't care about performance very much. But I can get other idea here, Do you have suggestion? Thanks!