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