2 # SPDX-License-Identifier: BSD-3-Clause
4 # check required parameters
5 SGW_REQ_VARS="SGW_PATH SGW_PORT_CFG SGW_WAIT_DEV"
6 for reqvar in ${SGW_REQ_VARS}
8 if [[ -z "${!reqvar}" ]]; then
9 echo "Required parameter ${reqvar} is empty"
14 # check if SGW_PATH point to an executable
15 if [[ ! -x ${SGW_PATH} ]]; then
16 echo "${SGW_PATH} is not executable"
21 SGW_LCORE=${SGW_LCORE:-0}
23 # setup config and output filenames
24 SGW_OUT_FILE=./ipsec-secgw.out1
25 SGW_CFG_FILE=$(mktemp)
27 # setup secgw parameters
28 SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4"
29 SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})"
30 SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\""
35 SGW_EXEC_FILE=$(mktemp)
36 cat <<EOF > ${SGW_EXEC_FILE}
37 stdbuf -o0 ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \
38 ${SGW_PORT_CFG} ${SGW_EAL_XPRM} \
39 -- ${SGW_CMD_PRM} ${SGW_CMD_XPRM} -f ${SGW_CFG_FILE} > \
40 ${SGW_OUT_FILE} 2>&1 &
47 SGW_PID=`/bin/bash -x ${SGW_EXEC_FILE}`
49 # wait till ipsec-secgw start properly
52 while [[ $i -ne 10 && $st -ne 0 ]]; do
54 ifconfig ${SGW_WAIT_DEV}
60 # stop ipsec-secgw and cleanup
64 rm -f ${SGW_EXEC_FILE}