From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 799E31B00C for ; Mon, 18 Dec 2017 17:46:38 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id s66so14780907wrc.9 for ; Mon, 18 Dec 2017 08:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MRuHYbMt6QvKiyZ7iYUJKmPn4Bm0xBWB36f5UgyuQoE=; b=LnMiMwEf/XFCRJ6TnJ5yfAkTLHItJWmN884dR5vMKftF4SrbW6DQa7Ijm1Drr23JCb YotgCo9SqvsRybKgQa9/c3cSdFb72nt1crFE8CKDht+faCEiqbyYjMYQAv+sk51BapUJ yDSE0gcYSXoCxd7w1VGKa0epOpjoBoNfCp1Y2t3g753HyWBALjfcT88lnp1bI5nRTp8g oa5aPcsE59b1/tkbTQmgHubwxS36i6kD5coPiurrQl46D9jgiFzCKIb//FFxLzFwi2L2 +E6wSr91X4U1jjUIcHITRTpZS4I9PsSWMB9ZPh72G/TSjqFWe4YXsXRlNNHzUyhx7PGF yv4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MRuHYbMt6QvKiyZ7iYUJKmPn4Bm0xBWB36f5UgyuQoE=; b=VkXC+qr2FKAq9BQcPXH/ZIIMzEH4eMC064I7lCEzr26hzrsb13QMt9hpPzR4WUlC7z Umn+0Wct0K4cF5+ACmX5HkxEBf3t+X156OwrQvpSM/DCYV2e+d0dp4eDdL6gZlE3rZQk FGEBKVko55g8iFifrnxh+m2w8a9bU/PUOCyQoC4jT5LZhPhu1it1gYyWk1ec8FI8KIS8 xMHgoQzLDmLYobVI8fnj5pi22FtYr2hATime2KX8GAcSFEX7UFi4vqmV8b7nDuTBY6kY FmnflmpCENE+4uM0H4uY4lvvZWSjGV/m9RJIZKT+gDRMMFNiQllcYCOExAxgZpmZcPjK ULlg== X-Gm-Message-State: AKGB3mL05CUbLUQ99yCAEwwe35XECa7j7hdMnFL2pc28UMeuTCLyB+TM YC9bBqXZ1ObliU6WOz+2pIW1aQ== X-Google-Smtp-Source: ACJfBot6hqcpVIxJNUZai4gzgLbX4YUKaI1Q22hhkjOe9/tjf34T8/5gKEPEr/8AIQO0Rk3GlZm12Q== X-Received: by 10.223.134.216 with SMTP id 24mr514080wry.156.1513615598136; Mon, 18 Dec 2017 08:46:38 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id d17sm5454973wrc.14.2017.12.18.08.46.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 08:46:37 -0800 (PST) Date: Mon, 18 Dec 2017 17:46:25 +0100 From: Adrien Mazarguil To: Ferruh Yigit Cc: dev@dpdk.org, Stephen Hemminger Message-ID: <20171218162443.12971-4-adrien.mazarguil@6wind.com> References: <20171124172132.GW4062@6wind.com> <20171218162443.12971-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171218162443.12971-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v1 3/3] net/hyperv: add "force" parameter 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: Mon, 18 Dec 2017 16:46:38 -0000 This parameter allows specifying any non-NetVSC interface to use with tap sub-devices for development purposes. Signed-off-by: Adrien Mazarguil --- doc/guides/nics/hyperv.rst | 5 +++++ drivers/net/hyperv/hyperv.c | 26 +++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/hyperv.rst b/doc/guides/nics/hyperv.rst index 8f7a8b153..9b5220919 100644 --- a/doc/guides/nics/hyperv.rst +++ b/doc/guides/nics/hyperv.rst @@ -110,5 +110,10 @@ The following device parameters are supported: Same as ``iface`` except a suitable NetVSC interface is located using its MAC address. +- ``force`` [int] + + If nonzero, forces the use of specified interfaces even if not detected as + NetVSC. + Not specifying either ``iface`` or ``mac`` makes this PMD attach itself to all NetVSC interfaces found on the system. diff --git a/drivers/net/hyperv/hyperv.c b/drivers/net/hyperv/hyperv.c index bad224be9..d9d9bbcd5 100644 --- a/drivers/net/hyperv/hyperv.c +++ b/drivers/net/hyperv/hyperv.c @@ -62,6 +62,7 @@ #define HYPERV_DRIVER net_hyperv #define HYPERV_ARG_IFACE "iface" #define HYPERV_ARG_MAC "mac" +#define HYPERV_ARG_FORCE "force" #define HYPERV_PROBE_MS 1000 #define NETVSC_CLASS_ID "{f8615163-df3e-46c5-913f-f2d2f965ed0e}" @@ -504,6 +505,9 @@ hyperv_alarm(void *arg) * - struct rte_kvargs *kvargs: * Device arguments provided to current driver instance. * + * - int force: + * Accept specified interface even if not detected as NetVSC. + * * - unsigned int specified: * Number of specific netdevices provided as device arguments. * @@ -521,6 +525,7 @@ hyperv_netvsc_probe(const struct if_nameindex *iface, { const char *name = va_arg(ap, const char *); struct rte_kvargs *kvargs = va_arg(ap, struct rte_kvargs *); + int force = va_arg(ap, int); unsigned int specified = va_arg(ap, unsigned int); unsigned int *matched = va_arg(ap, unsigned int *); unsigned int i; @@ -567,9 +572,11 @@ hyperv_netvsc_probe(const struct if_nameindex *iface, if (!hyperv_iface_is_netvsc(iface)) { if (!specified) return 0; - WARN("interface \"%s\" (index %u) is not NetVSC, skipping", - iface->if_name, iface->if_index); - return 0; + WARN("interface \"%s\" (index %u) is not NetVSC, %s", + iface->if_name, iface->if_index, + force ? "using anyway (forced)" : "skipping"); + if (!force) + return 0; } /* Create interface context. */ ctx = calloc(1, sizeof(*ctx)); @@ -700,6 +707,7 @@ hyperv_vdev_probe(struct rte_vdev_device *dev) static const char *const hyperv_arg[] = { HYPERV_ARG_IFACE, HYPERV_ARG_MAC, + HYPERV_ARG_FORCE, NULL, }; const char *name = rte_vdev_device_name(dev); @@ -708,6 +716,7 @@ hyperv_vdev_probe(struct rte_vdev_device *dev) hyperv_arg); unsigned int specified = 0; unsigned int matched = 0; + int force = 0; unsigned int i; int ret; @@ -719,13 +728,15 @@ hyperv_vdev_probe(struct rte_vdev_device *dev) for (i = 0; i != kvargs->count; ++i) { const struct rte_kvargs_pair *pair = &kvargs->pairs[i]; - if (!strcmp(pair->key, HYPERV_ARG_IFACE) || - !strcmp(pair->key, HYPERV_ARG_MAC)) + if (!strcmp(pair->key, HYPERV_ARG_FORCE)) + force = !!atoi(pair->value); + else if (!strcmp(pair->key, HYPERV_ARG_IFACE) || + !strcmp(pair->key, HYPERV_ARG_MAC)) ++specified; } rte_eal_alarm_cancel(hyperv_alarm, NULL); /* Gather interfaces. */ - ret = hyperv_foreach_iface(hyperv_netvsc_probe, name, kvargs, + ret = hyperv_foreach_iface(hyperv_netvsc_probe, name, kvargs, force, specified, &matched); if (ret < 0) goto error; @@ -784,4 +795,5 @@ RTE_PMD_REGISTER_VDEV(HYPERV_DRIVER, hyperv_vdev); RTE_PMD_REGISTER_ALIAS(HYPERV_DRIVER, eth_hyperv); RTE_PMD_REGISTER_PARAM_STRING(net_hyperv, HYPERV_ARG_IFACE "= " - HYPERV_ARG_MAC "="); + HYPERV_ARG_MAC "= " + HYPERV_ARG_FORCE "="); -- 2.11.0