From patchwork Wed Nov 1 17:46:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chandran, Sugesh" X-Patchwork-Id: 833063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yRwfY1Bbsz9sRW for ; Thu, 2 Nov 2017 04:47:49 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 91914CC7; Wed, 1 Nov 2017 17:46:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 99D98CB9 for ; Wed, 1 Nov 2017 17:46:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 46BEE79 for ; Wed, 1 Nov 2017 17:46:46 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2017 10:46:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,329,1505804400"; d="scan'208";a="167946585" Received: from silpixa00389820.ir.intel.com ([10.237.222.155]) by orsmga005.jf.intel.com with ESMTP; 01 Nov 2017 10:46:45 -0700 From: Sugesh Chandran To: dev@openvswitch.org Date: Wed, 1 Nov 2017 17:46:44 +0000 Message-Id: <1509558404-130908-3-git-send-email-sugesh.chandran@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509558404-130908-1-git-send-email-sugesh.chandran@intel.com> References: <1509558404-130908-1-git-send-email-sugesh.chandran@intel.com> X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [RFC PATCH 2/2] Adding configuration option to whitelist DPDK physical ports. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Adding a OVS configuration option to whitelist DPDK physical ports. By default running multiple instances of DPDK on a single platform cannot use physical ports at the same time even though they are distinct. The eal init scans all the ports that are bound to DPDK and initialize the drivers accordingly. This happens for every DPDK process init. On a multi instance deployment usecase, it causes issues for using physical NIC ports. Consider a two DPDK process that are running on a single platform, the second DPDK primary process will try to initialize the drivers for all the physical ports even though it may be used in first DPDK process. To avoid this situation user can whitelist the ports for each DPDK application. Whitelisting of ports/PCI-ID in a DPDK process will limit the eal-init only on those ports. To whitelist two physical ports "0000:06:00.0" and "0000:06:00.1", the configuration option in OVS would be ovs-vsctl set Open_vSwitch . other_config:dpdk-whitelist-pci-ids="0000:06:00.0,0000:06:00.1" To update the whitelist ports, OVS daemon has to be restarted. Signed-off-by: Sugesh Chandran --- lib/dpdk.c | 29 +++++++++++++++++++++++++++++ vswitchd/vswitch.xml | 21 +++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/lib/dpdk.c b/lib/dpdk.c index cbbf28d..ea7400f 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -336,6 +336,34 @@ dpdk_isolate_rte_mem_config(const struct smap *ovs_other_config, } static void +dpdk_whitelist_pci_ids(const struct smap *ovs_other_config, char ***argv, + int *argc) +{ + const char *pci_ids; + char *pci_dev; + int len; + int i; + pci_ids = smap_get(ovs_other_config, "dpdk-whitelist-pci-ids"); + if (!pci_ids) { + return; + } + len = strlen(pci_ids); + do { + i = strcspn(pci_ids, ","); + pci_dev = xmemdup0(pci_ids, i); + if (!strlen(pci_dev)) { + break; + } + *argv = grow_argv(argv, *argc, 2); + (*argv)[(*argc)++] = xstrdup("-w"); + (*argv)[(*argc)++] = pci_dev; + i++; + pci_ids += i; + len -= i; + } while (pci_ids && len > 0); +} + +static void dpdk_init__(const struct smap *ovs_other_config) { char **argv = NULL, **argv_to_release = NULL; @@ -422,6 +450,7 @@ dpdk_init__(const struct smap *ovs_other_config) } dpdk_isolate_rte_mem_config(ovs_other_config, &argv, &argc); + dpdk_whitelist_pci_ids(ovs_other_config, &argv, &argc); argv = grow_argv(&argv, argc, 1); argv[argc] = NULL; diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 3a507ea..04baf97 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -442,6 +442,27 @@

+ +

+ Specifies list of pci-ids separated by , for whitelisting available + physical NIC ports in OVS. The option valid only when DPDK is enabled + in OVS and the ports are already bound to DPDK userspace driver. +

+

+ By default, all the DPDK bound ports are initialized at the time of + vswitchd start. Whitelisting a list of pci-ids is used to limit the + initialization only to specific ports. Changing this value requires + restarting the daemon. +

+

+ This option allow user to run multiple instance of DPDK including + vswitchd simultaneously by exclusively allocating the physical NIC + ports between them. Its impossible to use the NIC ports in + multiple primary DPDK processes without whitelisting them + even the application is using distinct ports. +

+
+