Soft Patch Panel
 help / color / mirror / Atom feed
From: Yasufumi Ogawa <yasufum.o@gmail.com>
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] bin: add memif to vdevs of primary
Date: Sun, 22 Dec 2019 05:02:36 +0900	[thread overview]
Message-ID: <20191221200236.10288-1-yasufum.o@gmail.com> (raw)

This update is to add memif vdev to spp_primary. The set of IDs of memif
is defined in `bin/config.sh` as following.

  PRI_MEMIF_VDEVS=(0 1)  # IDs of `net_memif`

This memif is attached as master role, and socket file is shared among
all vdevs. As same as vhost socks, it must be deleted before
re-launching, or failed to launch because of socket is already exists.

  $ sudo spp_primary ... \
  --vdev net_memif0,id=0,role=master,socket=/tmp/spp-memif.sock \
  --vdev net_memif1,id=1,role=master,socket=/tmp/spp-memif.sock \
  ...

For client app, it should refer the memif vdev as slave role. It means
simply no need to add `role=master`.

  $ sudo some-dpdk-client-app ... \
  --vdev net_memif0,id=0,socket=/tmp/spp-memif.sock \
  --vdev net_memif1,id=1,socket=/tmp/spp-memif.sock \
  ...

As a note, sock file of memif is created as `/run/memif.sock` as default
if it is not given explicitly. To avoid the implicity, create SPP's sock
file and delete it before re-launch in startup scripts.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 bin/sample/config.sh |  5 +++--
 bin/spp_pri.sh       | 20 +++++++++++++++++---
 bin/start.sh         |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/bin/sample/config.sh b/bin/sample/config.sh
index e797956..ec4d4b8 100644
--- a/bin/sample/config.sh
+++ b/bin/sample/config.sh
@@ -15,13 +15,14 @@ NUM_RINGS=8
 PRI_PORTMASK=0x03  # total num of ports of spp_primary.
 
 # Vdevs of spp_primary
+#PRI_MEMIF_VDEVS=(0 1)  # IDs of `net_memif`
 #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
+#net_memif0,socket=/tmp/memif.sock,id=0,role=master
+#net_memif1,socket=/tmp/memif.sock,id=1,role=master
 #)
 
 # You do not need to change usually.
diff --git a/bin/spp_pri.sh b/bin/spp_pri.sh
index 5e21572..c0b0e1e 100644
--- a/bin/spp_pri.sh
+++ b/bin/spp_pri.sh
@@ -7,19 +7,23 @@
 SPP_PRI_VHOST=""
 SPP_PRI_RING=""
 SPP_PRI_TAP=""
+SPP_PRI_MEMIF=""
 SPP_PRI_VDEVS=""
 
+SOCK_VHOST="/tmp/sock"
+SOCK_MEMIF="/tmp/spp-memif.sock"
+
 function clean_sock_files() {
     # clean /tmp/sock*
-    sudo rm -f /tmp/sock*
+    sudo rm -f ${SOCK_VHOST}*
+    sudo rm -f ${SOCK_MEMIF}
 }
 
 # 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
-            SPP_SOCK="/tmp/sock${id}"
-            SPP_PRI_VHOST="${SPP_PRI_VHOST} --vdev eth_vhost${id},iface=${SPP_SOCK}"
+            SPP_PRI_VHOST="${SPP_PRI_VHOST} --vdev eth_vhost${id},iface=${SOCK_VHOST}${id}"
         done
     fi
 }
@@ -42,6 +46,15 @@ function setup_tap_vdevs() {
     fi
 }
 
+# Add memif vdevs named as such as `net_memif`.
+function setup_memif_vdevs() {
+    if [ ${PRI_MEMIF_VDEVS} ]; then
+        for id in ${PRI_MEMIF_VDEVS[@]}; do
+            SPP_PRI_MEMIF="${SPP_PRI_MEMIF} --vdev net_memif${id},id=${id},role=master,socket=${SOCK_MEMIF}"
+        done
+    fi
+}
+
 # Add any of vdevs.
 function setup_vdevs() {
     if [ ${PRI_VDEVS} ]; then
@@ -71,6 +84,7 @@ function spp_pri() {
         ${SPP_PRI_VHOST} \
         ${SPP_PRI_RING} \
         ${SPP_PRI_TAP} \
+        ${SPP_PRI_MEMIF} \
         ${SPP_PRI_VDEVS} \
         -- \
         -p ${PRI_PORTMASK} \
diff --git a/bin/start.sh b/bin/start.sh
index ce3ce26..eecb2ed 100755
--- a/bin/start.sh
+++ b/bin/start.sh
@@ -43,6 +43,7 @@ function start_spp_pri() {
     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_memif_vdevs  # setup vdevs of net_memif
     setup_vdevs  # setup any of vdevs
     spp_pri  # launch spp_primary
 }
-- 
2.17.1


                 reply	other threads:[~2019-12-21 20:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191221200236.10288-1-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).