From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0040.outbound.protection.outlook.com [104.47.0.40]) by dpdk.org (Postfix) with ESMTP id 5938E29C8 for ; Thu, 11 Jan 2018 10:00:14 +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=Fn6eqsplsOiCqO9wgYS/VfGXg8Z5Efm/WzujRPkju1Q=; b=Y1REdhR98eMBOrHcO9rzLb8eE96pZzQkaZON5dJmbbqOIIb5OVEAySIshUGyaFVQQxXRFlH4Z84XOfjsaD/UQmXMBRTfST2wVGj2CfNXEZEw5yhoP7rGbUuvbx8xmYj+0NQ40Lnzuh8IgbVXA2K/9AQWcGcmCEw9oUOH18iSjcI= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by AM6PR0502MB3783.eurprd05.prod.outlook.com (52.133.21.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 11 Jan 2018 09:00:11 +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.008; Thu, 11 Jan 2018 09:00:10 +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/trf3caE68y4HPxCQw7KNtNUnAgAAcCwCAAQ79gA== Date: Thu, 11 Jan 2018 09:00:10 +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> <20180110084330.43bdb01a@xeon-e3> In-Reply-To: <20180110084330.43bdb01a@xeon-e3> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB3783; 7:VPt7ZuHnPjmgZm/DmtaVgNZE4+O/lDqXRR0/7zSp54nhiF3vRyQJUii5CEOMAMrgXNzkvLhkFtN2URJIlKG/msm2vErr2el4HLfA+aa45bPAJxDtQBXAmSj2kqMP+FnLuq3/N8Ff/WBpuGbc9V2vaVt0xBpI7uvnIXIF6eMjTQveBCkOtpue3jHzJ/S5DOM1Zf921TT9FNFkIfCKM6BVKsT9zHhPHBJ0AGNNo17u7NEzKSBNv4t3T7xEbUb4PqOa x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9969101c-cc9c-48c8-abb4-08d558d1b87f x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020063)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3783; x-ms-traffictypediagnostic: AM6PR0502MB3783: 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)(5005006)(8121501046)(3002001)(3231023)(944501134)(93006095)(93001095)(10201501046)(6055026)(6041268)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3783; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3783; x-forefront-prvs: 0549E6FD50 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(366004)(346002)(396003)(199004)(189003)(24454002)(105586002)(7696005)(5890100001)(106356001)(5250100002)(99286004)(478600001)(2900100001)(76176011)(97736004)(33656002)(6436002)(53936002)(6246003)(229853002)(25786009)(4326008)(55016002)(8936002)(68736007)(9686003)(2950100002)(6916009)(81156014)(5660300001)(81166006)(8676002)(107886003)(3280700002)(3846002)(2906002)(6116002)(3660700001)(575784001)(74316002)(86362001)(7736002)(54906003)(93886005)(102836004)(66066001)(6346003)(305945005)(316002)(14454004)(59450400001)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3783; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-microsoft-antispam-message-info: DNk/dGxslGGQJ+w6zYgMkXjP7/hc1VGJc91qZuhiC/MBYvM9Fv55k9RxCS7aF+j1WYzmEUkWG+vzytG4f3918w== 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: 9969101c-cc9c-48c8-abb4-08d558d1b87f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2018 09:00:10.8639 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3783 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: Thu, 11 Jan 2018 09:00:14 -0000 Hi Stephan From: Stephen Hemminger, Wednesday, January 10, 2018 6:44 PM > On Wed, 10 Jan 2018 15:07:14 +0000 > Matan Azrad wrote: >=20 > > 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 > > > > > > On Tue, 9 Jan 2018 14:47:31 +0000 > > > Matan Azrad wrote: > > > > > > > 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; > > > > +} > > > > > > In many ways /proc/net/route is legacy intervace. > > > And system may have 1 M routes. > > > > > > Maybe there is faster way to do this with netlink by looking to see > > > if there is an address associated with the interface. > > > > Actually this is control path, we don't care about performance very muc= h. > > But I can get other idea here, Do you have suggestion? > > > > Thanks! > > >=20 > Use netlink (or ioctl) to get interface address. > If interface has an IPv4 or IPv6 (not link local), then skip it. As I a little bit investigated I found that IPv6 getting is problematic by = ioctl. And using nelink for it, really doesn't worth the effort. So, I suggest to keep this code simple as is in spite of the optional high = latency for this function, after all it is a control path.