From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.57]) by dpdk.org (Postfix) with ESMTP id 4D8491B2C9 for ; Thu, 18 Jan 2018 14:52:05 +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=qaz2CGLFhJ19gIlWa9kufHEZ8sY0AwF1m1vL16HBKi8hL1o/QrDCnqLafIpnoxP4uYEFULw4s+G2OXhmUGmL8wfcQ1pBRJSepgJdwhMLDu/fK1VkYLlhA0SzwvVbUqxSucSKpJafXkRqrEU2/StD4Z71E+bRCnTZniQarXbYi7c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3798.eurprd05.prod.outlook.com (2603:10a6:209:a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 13:52:03 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org, Raslan Darawsheh Date: Thu, 18 Jan 2018 13:51:44 +0000 Message-Id: <1516283506-21198-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516283506-21198-1-git-send-email-matan@mellanox.com> References: <1516269709-15252-1-git-send-email-matan@mellanox.com> <1516283506-21198-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0115.eurprd08.prod.outlook.com (2603:10a6:800:d4::17) To AM6PR0502MB3798.eurprd05.prod.outlook.com (2603:10a6:209:a::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cc794bfb-718e-4a24-350c-08d55e7aa7ee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3798; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 3:gkHjRh0lJPFGhzi6Aap0LTsHTJuf1zFonZzmstUtnBxPBH4f01smgKQR4pojHygHl8CULDv4AEYvNo/+TBsBcRdSM3wTio41nao610VvMMpT/6F9mmqXTkvLztBNT5tzks/Zm2EhjUZm+B2hWjhZnr6XJb6MHCVIxO1CMeBb6/LzZ0h11zZb4RJr2+p1pWYGZYWZSrKo2EcucAu8yoi37AmOrZ0sT2TLSwgs/Lu0C6yq4j25a1CZ5CvLU7mwlBu0; 25:ni1zy57+0+VTYXdnfWmGOJ4JN4cLXoP+HzOLejj3Hg/1wQTGiL58YNJz7l/kcaDbnfS6ZkdXOsFqRifoHiiwPLbUpvp4yc+Awt7o0/vh+AUZat6w4KOpOMqgcbfshHvY6rz3vWakVpj7Qwdn7hk07JoYcmpY9ZRvyQZoQGHAranigo4c61MX4BMAfo7lZCQ72kV6KDLolEhzcVPLtEW4RkrpnrTGGyD1YNMc1kEhweM9c3L9FjOZrQuA1p74R9oglSAQfGcIo0jdu2G+H0N15dwijuEBba4aUQVD+7FwKoEjNlcyGxSTAUk+YsshOj8LOg7M5+60YD81VGRaU7kwWQ==; 31:H8HSrICwbS+rwBVRUh4dtXYT+ediI0ssK2u5Rsw3PzklCMjOHPBm3LPKpHaAs79TK9s2g74ZFqLz8VmWvQRWBCt6YSfQ0cLNfMEx4HHGzwOVw4/J78aknnxWjiD/fleQ6dKfnhwc2oGePvCkfm48TsFxXH2wv/tW4hAyowjAFbgC/9zvo3KyypEwXCBETS5nBkmd4bDGz0H1V7S+sgOrl64w4ua2Sh1v2p6ApxNaHwg= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3798: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 20:CSirkCK/TH3NfCQcTR+oGNLm1G34RhOdR+FpfM3pADjNUWzhHtqmpwbPu//vNSPujFz8Vl5FUIXRIo1iL5QuPTMuZ4lgouKJXRCWIpubnEBxxSrRktQ1icvDEcMHaNu55g0etqXKlIJYTlU/UxGA0orn6IUstr179UQNU6MglTpGHJnkhHYCYfW8GSFDubiGXVomLjE54u2v4bWEduQGXMFrOzOAiudDllCIyVNZDTtYdaBKpjdhoujkJQQACnd9MpNmoBH4b/FflUGJdh5xweVY2RqPOoqn4rEAo0pGLpb373fm02OljTPcgcmAW4HooxWq4vtjXNh2WlOFDyQlYGvZcb2dzOvrbMQranYiTcQeiiD4YxVvOxfs8U1ZsCoKMgrQ3v0MaSmqwHdQAE83VN5C3iPNDVjhvtLCY5D5l9tRnrZKta8HeWXUyYXFbGk5v6NCCP7vJQsPGMEWAniFKuCIZLceFskKGIoWjd/rceTe60GOlle1ECJ+f5FF4TGR; 4:qR1+LVk10pDAqk1FI/3UA7QSsrGl11mA/XhuLQKDLRBE6YbQ6Kl4LOhGJDJWR/Bxk82Qo+0iwgeiuVrLvuBCpJqribVixA0UTBTnpLw0lg0Dz4bjmZAlXudfzlK66Bx1W00icesGVH/YG98UjMkh0Ey6jIrM5WBhgxq3hc87GE0zPGEqmQv/FZa+YxsDoXj2zvDpn/IhrBglPpN+HvrSdI8uB8kldElrEYOe4PFv0QFLqdXEF+f3WiskdrV9iju/alJYEfmaGX0dkdsel8gS1w== 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)(3002001)(10201501046)(3231023)(944501161)(93006095)(93001095)(6055026)(6041268)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR0502MB3798; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3798; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39380400002)(39860400002)(376002)(199004)(189003)(386003)(2906002)(51416003)(81156014)(81166006)(5660300001)(305945005)(4326008)(21086003)(7696005)(106356001)(8676002)(68736007)(26005)(69596002)(76176011)(59450400001)(105586002)(86362001)(97736004)(3846002)(6116002)(575784001)(52116002)(53936002)(6666003)(50226002)(55016002)(4720700003)(33026002)(7736002)(2950100002)(36756003)(47776003)(107886003)(478600001)(16526018)(8936002)(66066001)(316002)(110136005)(48376002)(50466002)(54906003)(16586007)(5890100001)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3798; 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; AM6PR0502MB3798; 23:yH7JlbUAjl1bgrOvnyqzcAjWc+mIAN3LYmkZrzK?= =?us-ascii?Q?3kWOaAvddMqT5rqPKcjaSBQqgcNXFBPBPFcjqsxDkFSZLAKKoAN6TK4dNvK/?= =?us-ascii?Q?vxdfxncHJ5mXYLh4rE7uH94UcNlVQ4YD66UAyIKJxNartJ3ofaEc7O3DoOpP?= =?us-ascii?Q?FZmUVq6H6R+90kYVrkR9H8BDS4Z4YJfRqXscBo64zlP6Mp1XaqnI2ySi4oUA?= =?us-ascii?Q?C94Rk9x2pFAv+QbQnLTAREMK/9WvfTOU0il62H0G5b+8eEgE6rvpWb9Yb44K?= =?us-ascii?Q?iu94Gy4f3WEzyIKQdrOflhKX6TW8/uPs9HetJqFd/zLeIm7QHV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GAZm7MKbqq5eI4Dsf3CEC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:52:03.0939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc794bfb-718e-4a24-350c-08d55e7aa7ee X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3798 Subject: [dpdk-dev] [PATCH v6 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 13:52:05 -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