From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20081.outbound.protection.outlook.com [40.107.2.81]) by dpdk.org (Postfix) with ESMTP id 596801B1CD for ; Tue, 9 Jan 2018 15:48:21 +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=Q3ZlSjEe/isNgGzLsEklQfkx2eHSfnWXL6y8echVYFk=; b=FZegOIEcbEPh4HhWmPLN0t1XmZ8Mf8x9wWgiJmTRcktx3+D6VlFTdAbeV8cC7aCm6DWbkV8WcRiJdgfhttE2riVHJwPCpeCXbTp0dqLPhJt5swUqsFitv55JcjC8phbUFqYRnLgXhW2GULZlL9q+BuSly97FqO3TXHAkCU/Dp74= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 14:48:02 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Raslan Darawsheh Date: Tue, 9 Jan 2018 14:47:31 +0000 Message-Id: <1515509253-17834-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515509253-17834-1-git-send-email-matan@mellanox.com> References: <20171222173846.20731-1-adrien.mazarguil@6wind.com> <1515509253-17834-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::16) To AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e78eed9b-f6b3-4c76-6702-08d5576ffc6d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3799; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 3:ryF3q6aDpUALdRJbnmQyPboth68SsDM0zs0kPj1vwUNTraiN6HZ1LUrzqN/tG5FqOx/zugN+xnYB2DfhKvnwWHV3ROovSaGNlyxBwo1KqeRSTXqMKxvHfA7hqUN2BxleveQGnADCoUNHY/wsMAWrhR0XEgK9vBH8BTCVzCNBsxg4awAaG5V1INS/qHTfY/4TEB+3gPvc4uHU2C6xMP1jx+2Lab3/REhSB2cadGz6f/rcfbeMfAbWiUifjXsjuQeM; 25:ktj1lnuP5/5T+eq9CA4QSfPMJrCujYF1Wh7tfxMVwg/qRE+TDxOp53MEIUFKdTIYibp/+YKXK7KVTdb/62IdGo4Nyw9+RYhYh4LCAXlk4C4Zh6KytAgLQB/K89z7HkYio2pib12hUDLG+xFA+S+UEdKrqvoLTMshXzV3e4+anShjeghLNxCW0tSlv/WN8t0dec9/ur6Un0avAx26RqtT5ouBxyirA6OuGaTJEO+M540NC2IbWteriWIE1Jmb2/nFUOMKBOFYzYnQgZBFEwfh0EH42VJ7SFGXR9JqWBa8GJONNZUvndQrZX1Bm6eRjsx0k06V6FrxaV0E0/xaAE6QTQ==; 31:nMJtDJ2qJ2CYQpLIxHiI2Jbzzl1TevxQDRoTyIgpUHxoOfnikaSpEwoPnd9qI3lsQpRwYZ+lVdg4Wu1yMcwdcMTF0dXlut1WZ9gs6YJpp+5ld2uJgd1yohYPKD1r4qz0aoRSgBZB+BROIjoOCZEHUGqqaq4GQeymqMjvmB4c14v8mgS9fWyAyub9gF0zJv90V6Tr28mrCipCstINd01K5j6dfmW71dHdC4S5/xBRBoc= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3799: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 20:zl6HGcrJJE3d+2g1slgy7LtGyiy0pUJAKpZOWg5JWzWEqcYDtivx2TBRt/NjUIakyovb6jzyluOzq5m+BtC/NDFTeAO6y3HDPZ84WgXYMoCJoWz7vx+ytHUECeGeZn/2OQfiBUXhrp9AC7QfvgNvgZ74eCToTLKxWSUvuLYeFUHSBIYWVpkSbW1WhIOga3RRr97mEcTfMjFXq3HBH6sqEbg/aRbxTDmH7KaN+lBw9Lh9MlBvi1DmxTvaAMxg83MeKAtCbgLRAGwHfqkZssHFd7hgkOjb3uPZiyY7hjjyNDQLeLGmkI1hbWs4K63F6WqN5tXlleO+y4vh9dTjn5am91J+uxrbmDCj2LVg7EZtQl0wDqn2Lo466t/VlVxwvIq0IzwOU7WUDOGBpL5jZU5WZ7UcWqP7LfrmeXExLwbBP8bKRG73E47Xquk0/8uXYcDtTvLV48Kz5jorszXx1NB0YaT/fRTjRtLzGbkpnlXEut7mY9eCnBxqRMqZflSHZ3Q4; 4:56Qr0vBbLsp6ZdT+O2lkTTi8xRqFllqL0kEu/CL2S5qSD23jWDQY9OIATAZhiyuD8wFj0qA6mH6uCDWVUT1z8OcOHaAqbykS28kVk7mn4Sk6vmzq7+k0PD7zqCRIkfSrd4iOGra8RwAatcnbSrGz1/C8ejKKrc0bp7dC5rAKMyPHb4LuDcb7LbCFtuNtOr8qZD0qbF8zuflEDipuiCBmMja/aRxYr1T2tEJpdlFuxwnBbMsyJJzPsKLPzRYmty1VmiFaXMaNo0V013gX4ZV0BQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:AM6PR0502MB3799; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3799; X-Forefront-PRVS: 0547116B72 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(396003)(39860400002)(39380400002)(346002)(366004)(376002)(189003)(199004)(21086003)(16586007)(8676002)(575784001)(8936002)(5890100001)(54906003)(316002)(3846002)(51416003)(97736004)(33026002)(386003)(6116002)(55016002)(81156014)(86362001)(16526018)(50466002)(48376002)(69596002)(81166006)(50226002)(76176011)(53936002)(2950100002)(107886003)(6916009)(59450400001)(7696005)(105586002)(36756003)(68736007)(4720700003)(25786009)(5660300001)(106356001)(305945005)(47776003)(52116002)(2906002)(4326008)(7736002)(478600001)(66066001)(6666003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3799; 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; AM6PR0502MB3799; 23:v5+E/QGqr27IPMlXJRroGdFT2dlJ3lBGmAf3yCS?= =?us-ascii?Q?E9+NlnR6Zor7B91WipN1kuTjRKFtwGRatRpvh7ItRqZl9bj6gm//xc1xTX7H?= =?us-ascii?Q?encQ2CFMfi4Lpu81BsJ51DoKEPBjpWMLSXFB7V4NiK0gTk4VMtaosbydnSKn?= =?us-ascii?Q?aJ3ADLvqXT9FBoVQRqerKJkyOgAK33/ZgwpTtBM+e50+ViI7YREog3Vi9Az+?= =?us-ascii?Q?AQCXCVfu7eF1nX2uHyBKxo8QenkWOYB+V9jbdTaX2Q2IgMT3eiFixBybN9Sd?= =?us-ascii?Q?8dJe0k0cWpuxZS0bkR2SQCAzQhhEr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t4KsBNUeHOWICAEYafLkxveQ4Rg8Rt4La2Oye+Gl4Fwp0D8wRTl8rAYk0vS5o6sdvmkJCO5m00I6J26hMu3gIm9dYlcZcZnIYdfwZjmuYQvl7yXGuPlYPX63S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 14:48:02.1276 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e78eed9b-f6b3-4c76-6702-08d5576ffc6d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3799 Subject: [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: Tue, 09 Jan 2018 14:48:21 -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 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 = } /** + * 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 @@ -453,6 +492,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