From patchwork Fri Jul 1 09:31:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markos Chandras X-Patchwork-Id: 642902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rgrlY1dtTz9t1J for ; Fri, 1 Jul 2016 19:31:53 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id ACFE010B47; Fri, 1 Jul 2016 02:31:50 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 7F9C210B42 for ; Fri, 1 Jul 2016 02:31:49 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 0B6624204C4 for ; Fri, 1 Jul 2016 03:31:49 -0600 (MDT) X-ASG-Debug-ID: 1467365508-09eadd708dd8cb0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id oIxXTyEVlST47rr3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 01 Jul 2016 03:31:48 -0600 (MDT) X-Barracuda-Envelope-From: mchandras@suse.de X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mx2.suse.de) (195.135.220.15) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 1 Jul 2016 09:31:48 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at suse.de designates 195.135.220.15 as permitted sender) X-Barracuda-Apparent-Source-IP: 195.135.220.15 X-Barracuda-RBL-IP: 195.135.220.15 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C1A06ACDC for ; Fri, 1 Jul 2016 09:31:46 +0000 (UTC) X-CudaMail-Envelope-Sender: mchandras@suse.de From: Markos Chandras To: dev@openvswitch.org X-CudaMail-MID: CM-E1-630003558 X-CudaMail-DTE: 070116 X-CudaMail-Originating-IP: 195.135.220.15 Date: Fri, 1 Jul 2016 10:31:26 +0100 X-ASG-Orig-Subj: [##CM-E1-630003558##][PATCH 2/2] utilities: ovs-ctl.in: Allow passing DPDK options to ovs-vswitchd Message-Id: <20160701093126.10453-3-mchandras@suse.de> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20160701093126.10453-1-mchandras@suse.de> References: <20160701093126.10453-1-mchandras@suse.de> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1467365508 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.30919 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH 2/2] utilities: ovs-ctl.in: Allow passing DPDK options to ovs-vswitchd X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" The ovs-ctl script is used to launch ovs-vswitchd among other things. However it does not make it possible to pass DPDK options to the daemon. We fix this by explicitly looking and extracting the DPDK options from the command line which is then reconstructed so it can be parsed by ovs-ctl as usual. The DPDK options are later passed to ovs-vswitchd. Signed-off-by: Markos Chandras --- utilities/ovs-ctl.in | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 8ec825b..b4e7bf1 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -230,7 +230,12 @@ do_start_forwarding () { fi # Start ovs-vswitchd. - set ovs-vswitchd unix:"$DB_SOCK" + set ovs-vswitchd + # DPDK options are expected to be at the beginning of + # the command line arguments. Add '--' to mark the end + # of the DPDK options. + [ -n "$DPDK_OPTS" ] && set -- "$@" $DPDK_OPTS "--" + set "$@" unix:"$DB_SOCK" set "$@" -vconsole:emer -vsyslog:err -vfile:info if test X"$MLOCKALL" != Xno; then set "$@" --mlockall @@ -485,6 +490,25 @@ enable_protocol () { fi } +## ------------------ ## +## parse-dpdk-cmdline ## +## ------------------ ## +parse_dpdk_cmdline () { + echo "${@}" | grep -q -- "--dpdk" || return + + # The DPDK options can be passed anywhere on the command line when + # calling the ovs-ctl script so find out where they are. + if echo "${@}" | grep -q " -- "; then + # end of command line options found + DPDK_OPTS="$(echo ${@} | sed 's/^.*\(--dpdk.*\)\s* -- .*$/\1/')" + cmdline_args="$(echo ${@} | sed 's/\(^.*\)\(--dpdk.*\)\s* -- \(.*$\)/\1\3/')" + else + # no end of command line options found. DPDK options will be at the end + DPDK_OPTS="$(echo ${@} | sed 's/^.*\(--dpdk.*$\)/\1/')" + cmdline_args="$(echo ${@} | sed 's/\(^.*\)\(--dpdk.*$\)/\1/')" + fi +} + ## ---- ## ## main ## ## ---- ## @@ -530,13 +554,15 @@ set_defaults () { SYSTEM_TYPE=unknown SYSTEM_VERSION=unknown fi + + DPDK_OPTS= } usage () { set_defaults cat <