From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00046.outbound.protection.outlook.com [40.107.0.46]) by dpdk.org (Postfix) with ESMTP id E46EF1B1DA for ; Thu, 18 Jan 2018 11:02:09 +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=B843wMF/4DHaXWymfZ8rlMT37Oh9Ee90saAMNB762uA=; b=gbLJaeNNx352PEPvhfMWDELAmcNn6ZmYPsIY5mg+GMv2e999kKWa01OWau05DkZbAB4ZZ5JzcJrsykSUgoL2r9zRhneUQdaLtnMkUa558qKRlNFsx/sNpaJQeM/wvbJ2r8hDdxJJyQYZ9Zj1NjdfM7bUlfUdHI2vF6zAniuh/qs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 18 Jan 2018 10:02:07 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Raslan Darawsheh Date: Thu, 18 Jan 2018 10:01:47 +0000 Message-Id: <1516269709-15252-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516269709-15252-1-git-send-email-matan@mellanox.com> References: <1516265026-6469-1-git-send-email-matan@mellanox.com> <1516269709-15252-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0202CA0033.eurprd02.prod.outlook.com (2603:10a6:803:14::46) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50047e20-b9f2-41c3-9f4e-08d55e5a8946 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3797; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 3:P4o5icspv80PxV5wXpcYNX4b+ruZ4CwE+almcfWW0EUYz6+76AojfWR8VFmwAsqaemgVdYV3AQF/3bamKTZXnUPB0ERXQLP+5vevl61DOyEfln5NMNR8wk11pT4mEW3JI0Hukj4AjwMSkmKm4fdAVqoqFo7N1uYQ4VwXfSGmDeZaMtE1DHOvXorujlVFdLSOuN/YWPGjWx92QmnT8xm+e8YmWQ9o3VSQPVMbbwr/wm+XENLvuo2XRyaUUUuZANhL; 25:p4Y+hnYh+O5q/Gv4fCXDJfIoPdY+4Yu2M/hvhjU8Qlu9Cr3Eq4dOeiFMwYnxTrN5Fdy/egxRjdnmiBnPryBP7Fxv9K+fvXwG37HhwXvoytH0BhFlvLvf1McWMDuv6uCs5VtD8HTr8oQOkjPEwW297VtxfQppRAZXUSPk5NUMiMDuVFkagNhfDaONtUAbwDRBLl7+Kgd5RvYVmxiPSewxyQZMg/5bii0p4sg6fbmv5Bn/qMToj/wCXtOY1RwgYlVXE4gCmZYZViCuGnR/X3yr8EFmF2Hu2GEnERBWizUVYnAAyzlrEy/Sa6to94ari5VAsyIMItG8qWHtCMvYqRlJVw==; 31:ncqjFsA9yNA6/YzftsDSQ3wXrAykGGXWqwlgM1QeYPKiXgPfShrZqDHs1kjPtBNq0mvGpuCm3Ppg98jCXfV4MqGDexMR62alr74Rq1/KIoajt62UqqEAG3oY2MstwGXaSpq6ZUHA9QTiFUy5jzkzsZ6YLizbHj8AklYLP5Z3lYZ8CTcMZPq59m+CYbZ8Ove/QDu8TBUFZNLkbJfz/s2O3iIXC04R5+AE0zWXzd8hexs= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:45QNc7VquPrhRNFcwtdnI88YfNALHHVkt6QGK9OThN+y4TiHxmeKgV7p7FxdVpMaJJE6EMOzZQhtAt7L0xELbpj9QJ+mFUPSDXHn2EJrLPgs2SMEAc0iIaLqyVs93UW8R6MrAHzuBumStTVvxAPEOM34D4axE2th0tdMU7FlbwUCAAntGrrwLQX1oKcMp9YR4eSVQv3FTu4IG4jbTFGJ2okokdCylNNEnWmrxIZ5LKaM3/8F7goKDUqJhiSOpvwvjeLD5lzbKfKpA30pVbdStKg2LIx+BBOiHFCvADYC67tW0qzyR+V8ou9cTQ7Af7FJIdO83U03R+75eTHbFMxAr9JSc9ZEdmo/ec4Npj226Pk3+9CWGK76nG8ZWAjvH9xrqoY7ncr0/AHVl+WSsINL+WJGn0Bau8Sic61zWOGro0IsyMMjA5P5Yr5xcHRqgBhh/04KsMtGWF58I9NWY9vjaX/XLuvP50PISoL6fuW4C5rCLSHKGYUiioRSnBK2jY19; 4:CwWW4KM1YSP1XZOzfMFN9Ot7IVLI2iBuUvOxDhHkGNje0Ur1K1rLepWl2D6nY95ZRZ3dNoD6VHDTwW6fhF2a4c9lLqTOUuTTnprbVHmP0omchVJOSpPmcwkZo8bkvqRSYjKBZe5tv0lwZ9ip9SB/+Bjq6m/2nPsQ/tnfl/yLyWANW74JIOfJJ7sChnhU1O68p5OgAmynkrj/2RldG6vfrqIQSdJXO9mlO3l+uHlpugZxapxLNC4etSNd40jT4Mp6bblw5wnuRngXwlBK/IFt2w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3231023)(2400060)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3797; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3797; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(39380400002)(346002)(396003)(376002)(199004)(189003)(6116002)(53936002)(76176011)(386003)(4720700003)(59450400001)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(54906003)(5890100001)(8676002)(478600001)(316002)(21086003)(2950100002)(25786009)(48376002)(52116002)(6666003)(51416003)(7696005)(6916009)(81166006)(81156014)(8936002)(4326008)(86362001)(575784001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(3846002)(69596002)(107886003)(106356001)(33026002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; H:mellanox.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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR0502MB3797; 23:Gpz8fHhCfd2BWtKBER1WFcYAOQK5A4oijAis1HY?= =?us-ascii?Q?pIXOPetkb1L9Cuo0EYX/QMWwnKu1uIxlfkypvJlqtEWcUkhSEbIg8ekZv38S?= =?us-ascii?Q?hF4LOAoie/E+z6zSa+BPPgBn/Klcse28ZvOz5Yxj2lgNrYJrYdWbLzvy6/MF?= =?us-ascii?Q?94pXF8oijzm/lcF9yZe5VT1EMtCs3QyVGfTDJZf/4pXQVAKcWDPNlEKU2S1u?= =?us-ascii?Q?RPSy98EC3dYmhiZV0OCaL+iTXs16WTht3LfogNerD+Bs6uai1Mfc4VLYlAX5?= =?us-ascii?Q?5Y5s486dlroANBN4hRA1ypCElFuKX7rF7jtRLCpDey6+vonNwKashNCLZouZ?= =?us-ascii?Q?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com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 10:02:07.8623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50047e20-b9f2-41c3-9f4e-08d55e5a8946 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3797 Subject: [dpdk-dev] [PATCH v5 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, 18 Jan 2018 10:02:11 -0000 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 21c3265..0055d0b 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -39,6 +39,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, \ @@ -198,6 +199,44 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = } /** + * 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 = 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; +} + +/** * Retrieve network interface data from sysfs symbolic link. * * @param[out] buf @@ -459,6 +498,13 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = iface->if_name, iface->if_index); return 0; } + /* Routed NetVSC should not be probed. */ + if (vdev_netvsc_has_route(iface->if_name)) { + DRV_LOG(WARNING, "NetVSC interface \"%s\" (index %u) is routed", + iface->if_name, iface->if_index); + if (!specified) + return 0; + } /* Create interface context. */ ctx = calloc(1, sizeof(*ctx)); if (!ctx) { -- 1.8.3.1