aboutsummaryrefslogtreecommitdiffstats
path: root/tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh
diff options
context:
space:
mode:
authorSridhar K. N. Rao <sridhar.rao@spirent.com>2021-11-12 16:00:03 +0530
committerSridhar K. N. Rao <sridhar.rao@spirent.com>2021-11-12 16:01:30 +0530
commit24e68cf441d94ba09a13f21fdfc994d4a14dfde0 (patch)
tree127b699abb0bd1b17bce9f138f3b2648ee7d0ecf /tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh
parent4fa105c5b4113a9ff4311569709ca99a8fbf5028 (diff)
Docker: Forwarding Pods.
This patch adds source file required to build 2 forwarding pods. 1. L2 and L3 Fowarding 2. VPP Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com> Change-Id: Ibffea4ebe34a575d040778e45b6ba9e92af5e8b6
Diffstat (limited to 'tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh')
-rwxr-xr-xtools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh b/tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh
new file mode 100755
index 00000000..83c5dbdb
--- /dev/null
+++ b/tools/docker/test-containers/dpdk-forwarding-pods/l2l3fwd/l2fwd_substitute.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# SPDX-License-Identifier: Apache-2.0
+# Copyright(c) 2021 Red Hat, Inc.
+
+
+# Add new app-netutil headerfile to the main code so app-netutil
+# can be called to gather parameters.
+#
+# Search for line with: "#include <rte_mbuf.h>".
+# Append line: "#include "dpdk-args.h"".
+sed -i -e '/#include <rte_mbuf.h>/a #include "dpdk-args.h"' main.c
+
+
+# Replace the call to rte_eal_init() to call app-netutil code first
+# if no input parametes were passed in. app-netutil code generates
+# its own set of DPDK parameters that are used instead. If input
+# parameters were passed in, call rte_eal_init() with input parameters
+# and run as if app-netutil wasn't there.
+#
+# Search for the line with "ret = rte_eal_init(argc, argv);"
+# Create a label 'a' and continue searching and copying until
+# line with "argv += ret;" is found.
+# Replace that block of code with the contents of file 'l2fwd_eal_init.txt'.
+sed -i '/ret = rte_eal_init(argc, argv);/{
+:a;N;/argv += ret;/!ba;N;s/.*\n//g
+r l2fwd_eal_init.txt
+}' main.c
+
+
+# If no input parametes were passed in, use the parameter list generated
+# by app-netutil in the previous patch to call the local parameter
+# parsing code, l2fwd_parse_args(). If input parameters were passed in,
+# call l2fwd_parse_args() with input parameters and run as if app-netutil
+# wasn't there.
+#
+# Search for the line with "ret = l2fwd_parse_args(argc, argv);"
+# Replace that line of code with the contents of file
+# 'l2fwd_parse_args.txt'.
+sed -i '/ret = l2fwd_parse_args(argc, argv);/{
+s/ret = l2fwd_parse_args(argc, argv);//g
+r l2fwd_parse_args.txt
+}' main.c
+
+
+# Add new app-netutil source file to the Makefile.
+#
+# Search for line with: "SRCS-y :=".
+# Append line: "SRCS-y += c_util.c dpdk-args.c".
+sed -i -e '/SRCS-y :=/a SRCS-y += c_util.c dpdk-args.c' Makefile
+
+
+# Add new app-netutil shared library to the Makefile.
+# Contains the C API and GO package which collects the
+# interface data.
+#
+# Search for line with: "SRCS-y += c_util.c dpdk-args.c".
+# Append line: "LDLIBS += -lnetutil_api".
+sed -i -e '/SRCS-y += c_util.c dpdk-args.c/a LDLIBS += -lnetutil_api' Makefile