From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 827B91B020 for ; Wed, 17 Jan 2018 18:00:32 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1BC502091B; Wed, 17 Jan 2018 12:00:32 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 17 Jan 2018 12:00:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=Tq2+3W78imuRiO4hSQT2rlYa3f WgmhfjKrl0C7DQRUU=; b=X1K7tEWzgJGVPXBcEVhlBHjMc3kSB0y71QfWEMDBgr grf+7ac6ldH1LXnryCjFBC2Byk5MGI9Dhw7UfaP7gfR9MGU5jmsCeb4A5NRebrf/ G/UAGSKgobgoykN/Hwmw7h/NKIxo/54r2sHofES0ISPZVE0HymcBD7p9P1oft8Cu A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Tq2+3W 78imuRiO4hSQT2rlYa3fWgmhfjKrl0C7DQRUU=; b=bXrmzdNqpEGzNs7dXYQF0x btWLcAgEjRRXlwlodScT6VOa4YB/UlRMJDd5ATyfbyE2GqpV001AmbDn2+cseTJs fWSUwYDm7IO3/hKB6tXwBWJOjUB0UmA/lyc8Cj/BN4NyvSDqxbwqGhiUJ1jTne4a 3QnlZIgFkadae0akF94nT0nmP/neoFpADse66OiFSr1nsL71iSLSqSTJMnquZuMn m2KZnj2AK/CBIHkAO+VMrsedVPRIuMtMXpO2ORJreZggQjKm67TkLGGz9m5q7ioy dchLy3lIHWPZY2Tx6ZHHw9ap4OLE38WwQk2FYW5vm8E1xfxg6ySqBqpatco4yUcA == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id BCB46247FE; Wed, 17 Jan 2018 12:00:31 -0500 (EST) From: Thomas Monjalon To: Matan Azrad , Stephen Hemminger , Ferruh Yigit Cc: dev@dpdk.org, Raslan Darawsheh Date: Wed, 17 Jan 2018 17:59:59 +0100 Message-ID: <3422394.yW0MKVo7Tu@xps> In-Reply-To: References: <20171222173846.20731-1-adrien.mazarguil@6wind.com> <20180110084330.43bdb01a@xeon-e3> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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, 17 Jan 2018 17:00:32 -0000 11/01/2018 10:00, Matan Azrad: > From: Stephen Hemminger, Wednesday, January 10, 2018 6:44 PM > > > From: Stephen Hemminger, Tuesday, January 9, 2018 8:51 PM > > > > On Tue, 9 Jan 2018 14:47:31 +0000 > > > > Matan Azrad wrote: > > > > > +static int > > > > > +vdev_netvsc_has_route(const char *name) { > > > > > + FILE *fp; > > > > > + int ret = 0; > > > > > + char route[NETVSC_MAX_ROUTE_LINE_SIZE]; > > > > > + char *netdev; > > > > > + > > > > > + fp = fopen("/proc/net/route", "r"); > > > > > + if (!fp) { > > > > > + rte_errno = errno; > > > > > + return 0; > > > > > + } > > > > > + while (fgets(route, NETVSC_MAX_ROUTE_LINE_SIZE, fp) != NULL) { > > > > > + netdev = strtok(route, "\t"); > > > > > + if (strcmp(netdev, name) == 0) { > > > > > + ret = 1; > > > > > + break; > > > > > + } > > > > > + /* Move file pointer to the next line. */ > > > > > + while (strchr(route, '\n') == NULL && > > > > > + fgets(route, NETVSC_MAX_ROUTE_LINE_SIZE, fp) != > > > > 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 much. > > > But I can get other idea here, Do you have suggestion? > > > > > > Thanks! > > > > > > > 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. No more comment? So we are OK with this solution for now? If we see real performance issue, I guess it can be fixed later.