From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0084.outbound.protection.outlook.com [104.47.1.84]) by dpdk.org (Postfix) with ESMTP id 8F3D01B024 for ; Thu, 18 Jan 2018 09:44:13 +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=j5SHzkwNOvxjXJx+BLVtgAFWDtM+UK1Q5Uc0sUT5wszB4iA+up76B5T6YJ12gB3IS4BPxU41abQJOyNzO95BlZcBLYXLebIH/11fG/d2Cta1RByefK6cyP1qbdB+qfB7iVx+bAgUSSwsddwQJULCsJ/IVj7HkfzwXpBgp8ZHA8s= 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 08:44:11 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Raslan Darawsheh Date: Thu, 18 Jan 2018 08:43:44 +0000 Message-Id: <1516265026-6469-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516265026-6469-1-git-send-email-matan@mellanox.com> References: <1515509253-17834-1-git-send-email-matan@mellanox.com> <1516265026-6469-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0902CA0040.eurprd09.prod.outlook.com (2603:10a6:802:1::29) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d9394ff-325b-46c8-aadd-08d55e4fa5e7 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:NkRVlvQTPTmeJ/S2EJf+XsO1nkvOUhCJ3vRNRcvUGn4Iiiqb9RqL7mpHdG9dAW6N24QHxibo1hxJ63ah2xi++DQ01Heibl16L7gL6swYArtSXqgk8hc+LbSECLliXQmLiylMSZTbYk/3xyEv+h+URFlpVUv8qq7Ygpy1xRDwuiA6sNMP1uDlA752lCQ4rX1aKHZINkLGsvBUC1jtYUE92ctCz9SG9EH9HQoFo7jWwFIDsz8yZh/rN3llSdcVzisw; 25:znFkAeYwCCrAkc/FMG5jo5AZlGaBYnnEMYNbdVb9a1BqXxIlbxTR5ixXAH9/IcU1wurRjVYoIuZZH/HLOtXJOCLdCfmeo6LoQuszBgWbM2MEeoDSW6EN0KTo142B7UlF8HTZnXm2Y3QFftaWRWBgqDn0WvREy7dIGlhyUY2YGWW3oZkrAO7H2Lz4v0MNP1hIxCI5eGEUKOc0Vf+zcsmOeyEUOzfIHKat1iJTvJLzOpOYb2LUyKdhRV/3fdJFRMVVokjEU+GCn7fmqjPI3wZyinYRK6tnnqCaMFeTN6TcUkMLuRgyp+jZ5mMo82nwFW3I4b1PmNd0UrT8SFN5OiURoQ==; 31:DMdRIkZW1My5gOg43NQBT2gnIHAua1XuT+sq/5IdKfRrsjTV3eMIP4pOp/OaRnNSDIDXGXb1I60+Ji7YHSWWeYNOuKyc1mHOk1IlsEfwhFBF3voz0K/dZvtz73SEatcgMvrytiWoFenyj1iIcxELHbUU9Z5CmpPBh53KZO1QKtcctDy7NRcCKLCix8s7sif4Hk3LhifmyOL3afVtdOuIBc5WFNNHgo4GrG2/+4qbRkU= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:PNCng/2OZBDmzj56QpYiRlICrcrpkMe9VjV5usYsRmyvWt0Xqp9+Zg0mFe4/6oj7AaxXqrY9ezA30HD4U9jRYJGViIqtAruAJ2M4GWQ8MlNxVw6LMOpO6wV/N0hOZLouYG5S0WaOH94DpJKP5Z0hCprKrE8Uv/dZ2UvVVI6OmTsa3lALffMa+Unf3uoYbJ6KZP9VhKFCw6+I/gIRdY2dD5L8tUm/mL8ohIyL+mpqmOrmgBxQYBcNcUQYgF2aiY6c2A0DCLcagB86/KwsYsFvgJhDLoBUuNCcG++TWMUtG+t+7CwcdcyHkYSrz0NyfK7+PNKSTf2i0Ywz2U3nQluBOptrqL9s6rpVeyRsibkju+13Ay0T1BTghRouGoWKL3YUZ40Ues6xATTT07oSTh4sQUlR5wASEj1rnO9YPmyx5AfnN1Y+cX4jKlq9hEmdkclFynZ0yC2o0s/Y08ueuU9pw4XGDyt0NZ7ZO4KiNzYfI+CeVMXQjVYYQ5Rc0dHsBJMp; 4:7PKHSR4CanzoVL5eulfcAuaQgLl6jC86EB3IBI+cspQKxWsVDcgtCQT5Fo/h9Lhg82twEW6SlPqhMH7IX62jLUe0o9Gl7C27mNTd0xon1Cxc5PkuESQleox/MvF5shvfPKdZjzcleOeBGfkIQy14/SgKySXRvfJT179DaQcpbLAcXtdP4WbErOGYnCYQRvhMrHXgynPq6jvQweeoFRkONWkNdx/qaPFAHrYdez0lnORxvuJ+mmGPYJnyZNNCCwlqRYEP/DU0VmWtLgByBxCZ9Q== 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)(2400058)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(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)(346002)(39380400002)(396003)(376002)(366004)(39860400002)(189003)(199004)(97736004)(68736007)(36756003)(50226002)(4326008)(86362001)(575784001)(16526018)(81156014)(81166006)(8936002)(33026002)(55016002)(105586002)(5660300001)(107886003)(106356001)(69596002)(3846002)(53936002)(66066001)(7736002)(305945005)(47776003)(2906002)(6116002)(76176011)(26005)(59450400001)(386003)(4720700003)(50466002)(52116002)(6666003)(51416003)(6916009)(7696005)(25786009)(21086003)(2950100002)(48376002)(16586007)(5890100001)(54906003)(8676002)(316002)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; H:mellanox.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-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR0502MB3797; 23:TA6gSxunzX9SHCD/IegFarPqo/Se3bvP11WJdua?= =?us-ascii?Q?iR8b9Tn6qS2/v+ac+GiDeqtZC5dX2B5xIwo5m61YG/ljw1do/cp2wK7E0ltF?= =?us-ascii?Q?TvWFH1KVpXe5EtUf/aPjOFKqnC4n4Grdn7v9PrUUlAfKyJgnEGPbCNpGUkHI?= =?us-ascii?Q?IGwCl/L9B2nHYGdcbrEfT19XzCJ/KALkcofXu9WOen7+ZsKdET5d9hksahLb?= =?us-ascii?Q?vyDtMQqt4lCWgLcK+acyC+Wd7J/9cvkQDp4jn2Fy2fbr1Ubi4SmVdHS9nnaE?= =?us-ascii?Q?yYUsxYv6F34ziaDxHLrNnX8/Kwc9Lg9kNMPQwDvfjBXZrBsQvhi1N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: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 08:44:11.4143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d9394ff-325b-46c8-aadd-08d55e4fa5e7 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 v4 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 08:44:13 -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