misc: add and consolidate host stack scripts 49/42449/7
authorFlorin Coras <fcoras@cisco.com>
Mon, 3 Mar 2025 21:19:01 +0000 (16:19 -0500)
committerDave Barach <vpp@barachs.net>
Tue, 4 Mar 2025 21:39:00 +0000 (21:39 +0000)
Move all existing host stack scripts under extras/scripts/host-stack

Also add scripts for iperf/vcl performance testing

Type: improvement

Change-Id: Ia79b6bd061db49f61a0e4c6577cf45afe0323eb1
Signed-off-by: Florin Coras <fcoras@cisco.com>
22 files changed:
docs/developer/extras/vcl_ldpreload.rst
extras/scripts/host-stack/cc_plots.py [moved from src/scripts/host-stack/cc_plots.py with 100% similarity]
extras/scripts/host-stack/convert_evt [moved from src/scripts/host-stack/convert_evt with 100% similarity]
extras/scripts/host-stack/perf-tests/conf/dpdk_mt.cli [new file with mode: 0644]
extras/scripts/host-stack/perf-tests/conf/dpdk_st.cli [new file with mode: 0644]
extras/scripts/host-stack/perf-tests/dpdk_mt [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/dpdk_st [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/gdb_ldp_init [new file with mode: 0644]
extras/scripts/host-stack/perf-tests/start_vpp.sh [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/vcl_client [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/vcl_iperf_client [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/vcl_iperf_server [new file with mode: 0755]
extras/scripts/host-stack/perf-tests/vcl_perf.conf [new file with mode: 0644]
extras/scripts/host-stack/perf-tests/vcl_server [new file with mode: 0755]
extras/scripts/host-stack/vcl-ldpreload/README.rst [moved from extras/vcl-ldpreload/README.rst with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/common/nginx_test.sh [moved from extras/vcl-ldpreload/test/common/nginx_test.sh with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/common/nginx_welcome.html [moved from extras/vcl-ldpreload/test/common/nginx_welcome.html with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/common/vpp_docker.conf [moved from extras/vcl-ldpreload/test/common/vpp_docker.conf with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/curl_test.sh [moved from extras/vcl-ldpreload/test/curl_test.sh with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/emacs_gdb_curl.sh [moved from extras/vcl-ldpreload/test/emacs_gdb_curl.sh with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/emacs_gdb_vpp.sh [moved from extras/vcl-ldpreload/test/emacs_gdb_vpp.sh with 100% similarity]
extras/scripts/host-stack/vcl-ldpreload/test/wget_test.sh [moved from extras/vcl-ldpreload/test/wget_test.sh with 100% similarity]

index 3740db2..6064a0c 120000 (symlink)
@@ -1 +1 @@
-../../../extras/vcl-ldpreload/README.rst
\ No newline at end of file
+../../../extras/scripts/host-stack/vcl-ldpreload/README.rst
\ No newline at end of file
diff --git a/extras/scripts/host-stack/perf-tests/conf/dpdk_mt.cli b/extras/scripts/host-stack/perf-tests/conf/dpdk_mt.cli
new file mode 100644 (file)
index 0000000..8df8ee1
--- /dev/null
@@ -0,0 +1,6 @@
+comment {SPDX-License-Identifier: Apache-2.0}
+comment {Copyright (c) 2025 Cisco Systems, Inc.}
+set int ip address HundredGigabitEthernet16/0/0 6.0.1.1/24
+set int state HundredGigabitEthernet16/0/0 up
+
+session enable
diff --git a/extras/scripts/host-stack/perf-tests/conf/dpdk_st.cli b/extras/scripts/host-stack/perf-tests/conf/dpdk_st.cli
new file mode 100644 (file)
index 0000000..97aeb39
--- /dev/null
@@ -0,0 +1,5 @@
+comment {SPDX-License-Identifier: Apache-2.0}
+comment {Copyright (c) 2025 Cisco Systems, Inc.}
+set int ip address HundredGigabitEthernet16/0/0 6.0.1.1/24
+set int state HundredGigabitEthernet16/0/0 up
+session enable
diff --git a/extras/scripts/host-stack/perf-tests/dpdk_mt b/extras/scripts/host-stack/perf-tests/dpdk_mt
new file mode 100755 (executable)
index 0000000..6e095da
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS="${VPP_WS}"/extras/scripts/host-stack/perf-tests
+CFG_DIR="${CFG_WS}"/conf
+CFG_FILE=dpdk_mt.cli
+BASE_DIR="${VPP_WS}"/build-root
+BIN_FLAVOR=release
+
+DPDK_DEV=0000:16:00.0
+NUM_MBUFS=16536
+IF_RX_DESC=256
+IF_TX_DESC=256
+DPDK_CSUM=enable-tcp-udp-checksum
+
+SKIP_CORE=0
+MAIN_CORE=1
+WORKERS=4
+CFG_CORELIST_WKS="corelist-workers 2-5"
+
+HEAP_SIZE=4g
+API_SIZE=1G
+API_GLOBAL_SIZE=2000M
+EVT_LOG_SIZE=400000
+
+SOCK=/run/vpp-api.sock
+SESSION_CFG="session { event-queue-length 100000 use-app-socket-api }"
+
+#QUIC_ENABLE=1
+#LOCAL_OSSL=/scratch/fcoras/openssl
+
+function usage() {
+  echo "Usage: cmd [-f release|debug] [-d dpdk_device_pci_address] [-w vpp_workspace]"
+}
+
+while getopts "f:d:w:h" opt; do
+  case ${opt} in
+    h)  usage
+        exit 0
+        ;;
+    w)  VPP_WS=$OPTARG
+        ;;
+    f)  BIN_FLAVOR=$OPTARG
+        ;;
+    d)  DPDK_DEV=$OPTARG
+        ;;
+    \?) echo "Usage: cmd [-f release|debug] [-d dpdk_device_pci_address]"
+        exit 1
+        ;;
+  esac
+done
+shift $((OPTIND -1))
+
+source "${CFG_WS}"/start_vpp.sh
+
+start_vpp
diff --git a/extras/scripts/host-stack/perf-tests/dpdk_st b/extras/scripts/host-stack/perf-tests/dpdk_st
new file mode 100755 (executable)
index 0000000..a35889f
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS="${VPP_WS}"/extras/scripts/host-stack/perf-tests
+CFG_DIR="${CFG_WS}"/conf
+CFG_FILE=dpdk_st.cli
+BASE_DIR="${VPP_WS}"/build-root
+BIN_FLAVOR=release
+
+#DPDK_DISABLE=1
+DPDK_DEV=0000:16:00.0
+IF_RX_DESC=512
+IF_TX_DESC=256
+DPDK_CSUM=enable-tcp-udp-checksum
+
+NUM_MBUFS=16536
+
+HEAP_SIZE=4g
+API_SIZE=1G
+API_GLOBAL_SIZE=2000M
+EVT_LOG_SIZE=400000
+
+MAIN_CORE=1
+WORKERS=1
+CFG_CORELIST_WKS="corelist-workers 2"
+
+SOCK=/run/vpp-api.sock
+CLI_SOCK=/run/vpp/cli.sock
+SESSION_CFG="session { event-queue-length 100000 use-app-socket-api }"
+
+TCP_CFG="tcp { max-rx-fifo 128m }"
+TLS_CFG="tls { fifo-size 1m }"
+#QUIC_ENABLE=1
+#LOCAL_OSSL=/scratch/fcoras/openssl
+
+function usage() {
+  echo "Usage: cmd [-f release|debug] [-d dpdk_device_pci_address] [-w vpp_workspace]"
+}
+
+while getopts "f:d:w:h" opt; do
+  case ${opt} in
+    h)  usage
+        exit 0
+        ;;
+    w)  VPP_WS=$OPTARG
+        ;;
+    f)  BIN_FLAVOR=$OPTARG
+        ;;
+    d)  DPDK_DEV=$OPTARG
+        ;;
+    \?) usage
+        exit 1
+        ;;
+  esac
+done
+shift $((OPTIND -1))
+
+source "${CFG_WS}"/start_vpp.sh
+
+start_vpp
diff --git a/extras/scripts/host-stack/perf-tests/gdb_ldp_init b/extras/scripts/host-stack/perf-tests/gdb_ldp_init
new file mode 100644 (file)
index 0000000..7c2f28e
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+handle SIGUSR1 nostop noprint pass
+set print pretty on
+set exec-wrapper env 'LD_PRELOAD=/scratch/fcoras/vpp/build-root/build-vpp-native/vpp/lib/libvcl_ldpreload.so'
+set environment LDP_DEBUG=1
+set environment VCL_CONFIG=/scratch/fcoras/vpp/extras/scripts/host-stack/perf-tests/vcl_perf.conf
diff --git a/extras/scripts/host-stack/perf-tests/start_vpp.sh b/extras/scripts/host-stack/perf-tests/start_vpp.sh
new file mode 100755 (executable)
index 0000000..2761471
--- /dev/null
@@ -0,0 +1,153 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+if [ $BIN_FLAVOR = "debug" ]
+then
+  BIN_DIR=install-vpp_debug-native
+  BIN_EXEC_PREFIX="gdb --args"
+else
+  BIN_DIR=install-vpp-native
+  BIN_EXEC_PREFIX="gdb --args"
+fi
+
+BIN_PATH=$BASE_DIR/$BIN_DIR
+
+if [ "$#" -eq 1 ]
+then
+  echo $1
+  CFG_FILE=$1
+fi
+
+CFG_MBUFS=""
+if [ -n "$NUM_MBUFS" ]; then
+  CFG_MBUFS="buffers-per-numa $NUM_MBUFS"
+fi
+
+if [ -z $HEAP_SIZE ]; then
+  HEAP_SIZE=4g
+fi
+
+if [ -z $SKIP_CORE ]; then
+  SKIP_CORE=0
+fi
+
+if [ -z $SKIP_CORE ]; then
+  MAIN_CORE=1
+fi
+
+if [ -z $EVT_LOG_SIZE ]; then
+  EVT_LOG_SIZE=0
+fi
+
+if [ -z $API_GLOBAL_SIZE ]; then
+  API_GLOBAL_SIZE=64M
+fi
+
+if [ -z $API_SIZE ]; then
+  API_SIZE=16M
+fi
+
+if [ -z ${WORKERS+x} ]; then
+  WORKERS=0
+  CFG_RX_QS=1
+else
+  CFG_WORKERS="workers $WORKERS"
+  CFG_RX_QS=$(( $WORKERS ))
+fi
+
+SOCK_CFG=""
+if [ -n "$SOCK" ]; then
+  SOCK_CFG="socksvr { socket-name ${SOCK} }"
+fi
+
+if [ -z $IF_RX_DESC ]; then
+  IF_RX_DESC=4096
+fi
+
+if [ -z $IF_TX_DESC ]; then
+  IF_TX_DESC=4096
+fi
+
+API_PREFIX_CFG=""
+if [ -n "$API_PREFIX" ]; then
+  API_PREFIX_CFG="prefix $API_PREFIX"
+fi
+
+CLI_LISTEN_CFG="cli-listen localhost:5002"
+if [ -n "$CLI_SOCK" ]; then
+  CLI_LISTEN_CFG="cli-listen $CLI_SOCK"
+fi
+
+if [[ -z "$DPDK_DISABLE" ]]; then
+  DPDK_CFG="dpdk {                                             \
+               dev $DPDK_DEV {                                 \
+                       num-tx-desc $IF_TX_DESC                 \
+                        num-rx-desc $IF_RX_DESC                 \
+                       num-rx-queues $CFG_RX_QS                \
+               }                                               \
+               $SOCK_MEM_CFG                                   \
+               $DPDK_CSUM                                      \
+        }"
+else
+  DPDK_PLUGIN_DISABLE="plugin dpdk_plugin.so {disable}"
+fi
+
+if [[ -n "$QUIC_ENABLE" ]]; then
+  QUIC_PLUGIN="plugin quic_plugin.so {enable}"
+fi
+
+if [[ -n "$SRTP_ENABLE" ]]; then
+  SRTP_PLUGIN="plugin srtp_plugin.so {enable}"
+fi
+
+# custom openssl locally built
+LD_LIBP=""
+if [[ -n "${LOCAL_OSSL}" ]]; then
+  LD_LIBP="LD_LIBRARY_PATH=${LOCAL_OSSL}"
+fi
+
+function start_vpp
+{
+  sudo $LD_LIBP $BIN_EXEC_PREFIX $BIN_PATH/vpp/bin/vpp         \
+       unix {                                                  \
+               interactive log /tmp/vpp.log                    \
+               full-coredump                                   \
+               exec $CFG_DIR/$CFG_FILE                         \
+               $CLI_LISTEN_CFG                                 \
+               poll-sleep-usec 0                               \
+       }                                                       \
+       heapsize $HEAP_SIZE                                     \
+       api-trace { on }                                        \
+       api-segment {                                           \
+         global-size $API_GLOBAL_SIZE                          \
+         api-size $API_SIZE                                    \
+         gid vpp                                               \
+         $API_PREFIX_CFG                                       \
+       }                                                       \
+       vlib {                                                  \
+         elog-events $EVT_LOG_SIZE                             \
+         elog-post-mortem-dump                                 \
+       }                                                       \
+       cpu {                                                   \
+               skip-cores $SKIP_CORE                           \
+               main-core $MAIN_CORE                            \
+                $CFG_CORELIST_WKS                               \
+       }                                                       \
+       buffers { $CFG_MBUFS }                                  \
+       $DPDK_CFG                                               \
+       $SESSION_CFG                                            \
+       $TCP_CFG                                                \
+       $UDP_CFG                                                \
+       $SOCK_CFG                                               \
+       $TLS_CFG                                                \
+       plugins {                                               \
+         plugin unittest_plugin.so {enable}                    \
+         plugin http_unittest_plugin.so {enable}               \
+         $QUIC_PLUGIN                                          \
+         $SRTP_PLUGIN                                          \
+         $DPDK_PLUGIN_DISABLE                                  \
+       }
+}
+
diff --git a/extras/scripts/host-stack/perf-tests/vcl_client b/extras/scripts/host-stack/perf-tests/vcl_client
new file mode 100755 (executable)
index 0000000..653aeef
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS=$VPP_WS/extras/scripts/host-stack/perf-tests
+BIN=$VPP_WS/build-root/build-vpp-native/vpp/bin/vcl_test_client
+GDB_ENV=$CFG_WS/gdb_vcl_env
+VCL_CFG=$CFG_WS/vcl_perf.conf
+PARAMS=$@
+
+sudo taskset --cpu-list 10 sh -c "VCL_CONFIG=$VCL_CFG $BIN -c $PARAMS"
diff --git a/extras/scripts/host-stack/perf-tests/vcl_iperf_client b/extras/scripts/host-stack/perf-tests/vcl_iperf_client
new file mode 100755 (executable)
index 0000000..94a8b6c
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS=$VPP_WS/extras/scripts/host-stack/perf-tests
+BIN_PATH=iperf3
+LDP_VAR=$VPP_WS/build-root/install-vpp-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so
+VCL_CFG=$CFG_WS/vcl_perf.conf
+PARAMS=$@
+
+sudo taskset --cpu-list 6-11 sh -c "LD_PRELOAD=$LDP_VAR VCL_CONFIG=$VCL_CFG $BIN_PATH -4 -c $PARAMS"
+
+# for tls
+# CERT=$CFG_WS/selfsigned.crt
+# KEY=$CFG_WS/selfsigned.key
+# sudo taskset --cpu-list 6-10 sh -c "LDP_TRANSPARENT_TLS=2 LDP_TLS_CERT_FILE=$CERT LDP_TLS_KEY_FILE=$KEY VCL_CONFIG=$VCL_CFG LD_PRELOAD=$LDP_VAR $BIN_PATH -4 -c $PARAMS"
+
+# for debugging
+# LDP_SCRIPT=$CFG_WS/gdb_ldp_init
+# sudo gdb --command=$LDP_SCRIPT --args $BIN_PATH -4 -s $PARAMS
diff --git a/extras/scripts/host-stack/perf-tests/vcl_iperf_server b/extras/scripts/host-stack/perf-tests/vcl_iperf_server
new file mode 100755 (executable)
index 0000000..92dd1fc
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS=$VPP_WS/extras/scripts/host-stack/perf-tests
+BIN_PATH=iperf3
+LDP_VAR=$VPP_WS/build-root/install-vpp-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so
+VCL_CFG=$CFG_WS/vcl_perf.conf
+PARAMS=$@
+
+sudo taskset --cpu-list 6-11 sh -c "LD_PRELOAD=$LDP_VAR VCL_CONFIG=$VCL_CFG $BIN_PATH -4 -s $PARAMS"
+
+# for tls testing
+# CERT=$CFG_WS/selfsigned.crt
+# KEY=$CFG_WS/selfsigned.key
+# sudo taskset --cpu-list 6-11 sh -c "LDP_TRANSPARENT_TLS=1 LDP_TLS_CERT_FILE=$CERT LDP_TLS_KEY_FILE=$KEY LD_PRELOAD=$LDP_VAR VCL_CONFIG=$VCL_CFG $BIN_PATH -4 -s $PARAMS"
+
+# debugging
+# LDP_SCRIPT=/home/fcoras/vpp/gdb_ldp_init
+# sudo gdb --command=$LDP_SCRIPT --args $BIN_PATH -4 -s $PARAMS
diff --git a/extras/scripts/host-stack/perf-tests/vcl_perf.conf b/extras/scripts/host-stack/perf-tests/vcl_perf.conf
new file mode 100644 (file)
index 0000000..791d5fd
--- /dev/null
@@ -0,0 +1,16 @@
+vcl {
+  # SPDX-License-Identifier: Apache-2.0
+  # Copyright (c) 2025 Cisco Systems, Inc.
+  rx-fifo-size 4000000
+  tx-fifo-size 4000000
+
+  app-scope-local
+  app-scope-global
+
+  segment-size 10000000000
+  add-segment-size 10000000000
+
+  app-socket-api /var/run/vpp/app_ns_sockets/default
+  use-mq-eventfd
+  event-queue-size 500000
+}
diff --git a/extras/scripts/host-stack/perf-tests/vcl_server b/extras/scripts/host-stack/perf-tests/vcl_server
new file mode 100755 (executable)
index 0000000..4ecc2f1
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2025 Cisco Systems, Inc.
+
+VPP_WS=${VPP_WS:-/scratch/fcoras/vpp}
+CFG_WS=$VPP_WS/extras/scripts/host-stack/perf-tests
+BIN=$VPP_WS/build-root/build-vpp-native/vpp/bin/vcl_test_server
+GDB_ENV=$CFG_WS/gdb_init_tls
+VCL_CFG=$CFG_WS/vcl_perf.conf
+PARAMS=$@
+
+sudo taskset --cpu-list 6-11 sh -c "VCL_CONFIG=$VCL_CFG $BIN $PARAMS"
\ No newline at end of file