From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43624A0487 for ; Mon, 29 Jul 2019 11:37:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 262441BF01; Mon, 29 Jul 2019 11:37:49 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by dpdk.org (Postfix) with ESMTP id 927AA1BF01 for ; Mon, 29 Jul 2019 11:37:47 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id k189so8916078pgk.13 for ; Mon, 29 Jul 2019 02:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=u/W0fEd1m0uhRO4s/5AT3uBXPzdz82osRqzR8eAKT/8=; b=g0eNV3aTOvW0rXBWOzUXdr0UWCuRHeoku1hLbJtnVDmf79cnOXwQKdFWT3BHlN9AOc NgS/TCR2SrWNs+ktvEJIX0mdvEoHHIPSjrIyjnhhL9kvlvfx9d67kd/mfxO/oIQNkHPC 6A4mCT97hNhY7mniLrfCcSMPMcnjNfkufxcygItYSrljnA6wZLm6ECuk0ANwn4frG70O ewNe7odBJinF4m2Eoe/lhGiibDsnLNbDZMzKTe0PD6lR4+G8ns0rcd/YE8iiiniSOz0/ RMcu2/brVNmfI87sJyz7TyEi2AdfHxR0NLSXiZmTujYeP3vju2sZcbW2MO7v3408fH5F /uaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=u/W0fEd1m0uhRO4s/5AT3uBXPzdz82osRqzR8eAKT/8=; b=SFXH7zyuXKdQEg0qd+bhcu72SGwo4XpfclbwDsksnHjdx2axZJD5kCDF5BNkxrBEKP 2GjvyF9348dpVaX8598WGFcFySAGClyfrDqQbcn75DfQc+ro3fLJwq3Y1xxA0t/4Z0BE C3Nb0rlW8UrZnPL4cUxQ5UhkaCkwuubHMH6Xn7wveFO9WdwB3svI5X+gT5HN6p0gHMYK 8yDrBD4zDmOkB1W0gA+/4Mv3GlFq5Szs9OYfH1M7nUWcROhd4mq6bc6Btr8sH970dCTB NsQ19WSCIoRhoRtIniB5rAcZDMpCIKFzv4Lns/ybn1Y+Mzg7pKpIVr1jMKuwB3kpdvsQ oiAA== X-Gm-Message-State: APjAAAVm46cYbpKQw1+mX60zOtl3H2Mb3qOz/inDlkvyrZykBQNwKdsL 2c76xrghjR/cNNSMt9XpNtw53Y5X X-Google-Smtp-Source: APXvYqzX+KV3xueLEVoeatm4gq7KjcQPlHExwlxTY6RPKyz/fOSl4MHwAFM7+VQmL+OA5z+5ujqSMw== X-Received: by 2002:a62:5487:: with SMTP id i129mr36655326pfb.69.1564393066675; Mon, 29 Jul 2019 02:37:46 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id q4sm56972785pjq.27.2019.07.29.02.37.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jul 2019 02:37:46 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 29 Jul 2019 18:37:41 +0900 Message-Id: <20190729093741.28795-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] bin: add features for testing X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa For testing behaviours of spp_primary, enable to add arbitrary vdevs and add `--dry-run` option. These features are mainly for developers. Dry run is for showing commands without running them actually. $ bin/start.sh --dry-run Any of vdevs and its options can be listed in `PRI_VDEVS` as following in config file. PRI_VDEVS=( eth_vhost11,iface=/tmp/sock11,queues=1 eth_vhost12,iface=/tmp/sock12,queues=1 ) Signed-off-by: Yasufumi Ogawa --- bin/sample/config.sh | 15 +++++++++---- bin/spp_pri.sh | 29 +++++++++++++++++++----- bin/start.sh | 52 ++++++++++++++++++++++++++++++++++---------- 3 files changed, 74 insertions(+), 22 deletions(-) diff --git a/bin/sample/config.sh b/bin/sample/config.sh index c7ad672..69215d1 100644 --- a/bin/sample/config.sh +++ b/bin/sample/config.sh @@ -11,11 +11,18 @@ PRI_MEM=1024 PRI_MEMCHAN=4 # change for your memory channels. NUM_RINGS=8 PRI_PORTMASK=0x03 # total num of ports of spp_primary. -#PRI_VHOST_VDEVS=(11 12) # you use if you have no phy ports. -#PRI_RING_VDEVS=(1 2) # you use if you have no phy ports. -#PRI_TAP_VDEVS=(1 2) # you use if you have no phy ports. + +# Vdevs of spp_primary +#PRI_VHOST_VDEVS=(11 12) # IDs of `eth_vhost` +#PRI_RING_VDEVS=(1 2) # IDs of `net_ring` +#PRI_TAP_VDEVS=(1 2) # IDs of `net_tap` +# You can give whole of vdev options here. +#PRI_VDEVS=( +#eth_vhost11,iface=/tmp/sock13,queues=1 +#eth_vhost12,iface=/tmp/sock14,queues=1 +#) # You do not need to change usually. -# Log files created in 'spp/log/'. +# Log files are created in 'spp/log/'. SPP_CTL_LOG=spp_ctl.log PRI_LOG=spp_primary.log diff --git a/bin/spp_pri.sh b/bin/spp_pri.sh index 62a6075..f08a178 100644 --- a/bin/spp_pri.sh +++ b/bin/spp_pri.sh @@ -7,13 +7,14 @@ SPP_PRI_VHOST="" SPP_PRI_RING="" SPP_PRI_TAP="" +SPP_PRI_VDEVS="" function clean_sock_files() { # clean /tmp/sock* sudo rm -f /tmp/sock* } -# Add vhost vdevs. +# Add vhost vdevs named as such as `eth_vhost0`. function setup_vhost_vdevs() { if [ ${PRI_VHOST_VDEVS} ]; then for id in ${PRI_VHOST_VDEVS[@]}; do @@ -23,7 +24,7 @@ function setup_vhost_vdevs() { fi } -# Add ring vdevs. +# Add ring vdevs named as such as `net_ring0`. function setup_ring_vdevs() { if [ ${PRI_RING_VDEVS} ]; then for id in ${PRI_RING_VDEVS[@]}; do @@ -32,7 +33,7 @@ function setup_ring_vdevs() { fi } -# Add tap vdevs. +# Add tap vdevs named as such as `net_tap0`. function setup_tap_vdevs() { if [ ${PRI_TAP_VDEVS} ]; then for id in ${PRI_TAP_VDEVS[@]}; do @@ -41,10 +42,20 @@ function setup_tap_vdevs() { fi } +# Add any of vdevs. +function setup_vdevs() { + if [ ${PRI_VDEVS} ]; then + for vdev in ${PRI_VDEVS[@]}; do + SPP_PRI_VDEVS="${SPP_PRI_VDEVS} --vdev ${vdev}" + done + fi +} + # Launch spp_primary. function spp_pri() { SPP_PRI_BIN=${SPP_DIR}/src/primary/${RTE_TARGET}/spp_primary - sudo ${SPP_PRI_BIN} \ + + cmd="sudo ${SPP_PRI_BIN} \ -l ${PRI_CORE_LIST} \ -n ${PRI_MEMCHAN} \ --socket-mem ${PRI_MEM} \ @@ -55,9 +66,15 @@ function spp_pri() { ${SPP_PRI_VHOST} \ ${SPP_PRI_RING} \ ${SPP_PRI_TAP} \ + ${SPP_PRI_VDEVS} \ -- \ -p ${PRI_PORTMASK} \ -n ${NUM_RINGS} \ - -s ${SPP_HOST_IP}:5555 \ - > ${SPP_DIR}/log/${PRI_LOG} 2>&1 & + -s ${SPP_HOST_IP}:5555" + + if [ ${DRY_RUN} ]; then + echo ${cmd} + else + ${cmd} > ${SPP_DIR}/log/${PRI_LOG} 2>&1 & + fi } diff --git a/bin/start.sh b/bin/start.sh index bf57d4e..f39d5f6 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -13,6 +13,39 @@ SPP_DIR=${WORK_DIR}/.. DEFAULT_CONFIG=${WORK_DIR}/sample/config.sh CONFIG=${WORK_DIR}/config.sh +DRY_RUN= + +while getopts ":-:" OPT +do + case ${OPT} in + "-") + case ${OPTARG} in + dry-run) + DRY_RUN=true + ;; + esac + ;; + esac +done + +function start_spp_ctl() { + cmd="python3 ${SPP_DIR}/src/spp-ctl/spp-ctl -b ${SPP_HOST_IP}" + if [ ${DRY_RUN} ]; then + echo ${cmd} + else + ${cmd} > ${SPP_DIR}/log/${SPP_CTL_LOG} 2>&1 & + fi +} + +function start_spp_pri() { + . ${SPP_DIR}/bin/spp_pri.sh + clean_sock_files # remove /tmp/sock* as initialization + setup_vhost_vdevs # setup vdevs of eth_vhost + setup_ring_vdevs # setup vdevs of net_ring + setup_tap_vdevs # setup vdevs of net_tap + setup_vdevs # setup any of vdevs + spp_pri # launch spp_primary +} if [ ! -f ${CONFIG} ]; then echo "Creating config file ..." @@ -25,18 +58,13 @@ fi . ${CONFIG} echo "Start spp-ctl" -python3 ${SPP_DIR}/src/spp-ctl/spp-ctl -b ${SPP_HOST_IP} \ - > ${SPP_DIR}/log/${SPP_CTL_LOG} 2>&1 & +start_spp_ctl echo "Start spp_primary" -. ${SPP_DIR}/bin/spp_pri.sh -clean_sock_files # remove /tmp/sock* as initialization -setup_vhost_vdevs # you use vdevs if you have no phy ports -setup_ring_vdevs # you use vdevs if you have no phy ports -setup_tap_vdevs # you use vdevs if you have no phy ports -spp_pri # launch spp_primary +start_spp_pri -echo "Waiting for spp-ctl is ready ..." -sleep 1 - -python3 ${SPP_DIR}/src/spp.py -b ${SPP_HOST_IP} +if [ ! ${DRY_RUN} ]; then + echo "Waiting for spp-ctl is ready ..." + sleep 1 + python3 ${SPP_DIR}/src/spp.py -b ${SPP_HOST_IP} +fi -- 2.17.1