summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/build_rsocket.sh37
-rw-r--r--src/framework/common/base/liblinuxapi/nsfw_lock_file.c2
-rw-r--r--src/framework/hal/hal.c4
-rw-r--r--src/framework/hal/hal.h3
-rw-r--r--src/framework/include/hal_api.h3
-rw-r--r--src/framework/include/nsfw_mgr_com_api.h1
-rw-r--r--src/framework/ipc/mgr_com/mgr_com.c1
-rw-r--r--stacks/lwip_stack/CMakeLists.txt2
-rw-r--r--stacks/lwip_stack/doc/README.md5
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_api_msg.c10
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_tcpip.c2
-rw-r--r--stacks/lwip_stack/lwip_src/common/stackx_common_opt.h1
-rw-r--r--stacks/lwip_stack/lwip_src/common/stackx_spl_msg.h2
-rw-r--r--stacks/lwip_stack/lwip_src/include/ip_module/ip_module_api.h1
-rw-r--r--stacks/lwip_stack/lwip_src/include/netif/sharedmemory.h1
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/network.c43
-rw-r--r--stacks/lwip_stack/lwip_src/netif/spl_hal.c21
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_tcp.c1
-rwxr-xr-xstacks/lwip_stack/release/script/nstack_fun.sh4
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/script/nstack_var.sh0
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/script/run_nstack_main.sh3
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/script/run_nstack_master.sh0
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/send_alarm.sh0
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/start_nstack.sh46
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/stop_nstack.sh0
-rwxr-xr-x[-rw-r--r--]stacks/lwip_stack/release/uninstall.sh0
-rw-r--r--stacks/lwip_stack/src/io_adpt/dpdk.c69
-rw-r--r--stacks/lwip_stack/src/nStackMain/main.c2
-rw-r--r--thirdparty/apps/CMakeLists.txt25
29 files changed, 237 insertions, 52 deletions
diff --git a/scripts/build_rsocket.sh b/scripts/build_rsocket.sh
index ef31c88..9075e3c 100755
--- a/scripts/build_rsocket.sh
+++ b/scripts/build_rsocket.sh
@@ -7,21 +7,34 @@ OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
DMM_DIR=`dirname $(readlink -f $0)`/../
BUILD_DIR=${DMM_DIR}/build
-############### build rsocket
-echo "rsocket build start"
-cd $DMM_DIR/stacks/rsocket
if [ "$OS_ID" == "ubuntu" ]; then
- wget http://www.mellanox.com/downloads/ofed/MLNX_OFED-4.4-1.0.0.0/MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64.tgz
- tar -zxvf MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64.tgz
- cd MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64
+ INSTALLED=`apt list --installed | grep mlnx-ofed`
elif [ "$OS_ID" == "centos" ]; then
- CENT_VERSION=`grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release`
- wget http://www.mellanox.com/downloads/ofed/MLNX_OFED-4.4-1.0.0.0/MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64.tgz
- tar -zxvf MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64.tgz
- cd MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64
+ INSTALLED=`rpm -qa | grep mlnx-ofed`
fi
-sudo ./mlnxofedinstall --force || exit 1
+############### build rsocket
+echo "rsocket build start"
+cd $DMM_DIR/stacks/rsocket
+
+if [ -z $INSTALLED ]; then
+ if [ "$OS_ID" == "ubuntu" ]; then
+ wget http://www.mellanox.com/downloads/ofed/MLNX_OFED-4.4-1.0.0.0/MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64.tgz
+ tar -zxvf MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64.tgz
+ cd MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64
+ elif [ "$OS_ID" == "centos" ]; then
+ CENT_VERSION=`grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release`
+ wget http://www.mellanox.com/downloads/ofed/MLNX_OFED-4.4-1.0.0.0/MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64.tgz
+ tar -zxvf MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64.tgz
+ cd MLNX_OFED_LINUX-4.4-1.0.0.0-rhel${CENT_VERSION}-x86_64
+ else
+ echo "NOT SUPPORT $OS_ID"
+ exit 1
+ fi
+
+ sudo ./mlnxofedinstall --force || exit 1
+
+fi
cd $BUILD_DIR
make dmm_rsocket
@@ -31,4 +44,4 @@ else
echo "rsocket build has FAILED"
exit 1
fi
-echo "rsocket build finished" \ No newline at end of file
+echo "rsocket build finished"
diff --git a/src/framework/common/base/liblinuxapi/nsfw_lock_file.c b/src/framework/common/base/liblinuxapi/nsfw_lock_file.c
index abfbfd1..cef8d95 100644
--- a/src/framework/common/base/liblinuxapi/nsfw_lock_file.c
+++ b/src/framework/common/base/liblinuxapi/nsfw_lock_file.c
@@ -94,6 +94,8 @@ nsfw_proc_start_with_lock (u8 proc_type)
return -1;
}
+ nsfw_mgr_com_mkdir_domainpath (lock_fpath);
+
ret = STRCAT_S (lock_fpath, NSFW_FILE_PATH_LEN, module_name);
if (EOK != ret)
{
diff --git a/src/framework/hal/hal.c b/src/framework/hal/hal.c
index 545c759..49b1fb7 100644
--- a/src/framework/hal/hal.c
+++ b/src/framework/hal/hal.c
@@ -312,7 +312,7 @@ hal_get_invalid_hdl ()
Called By :
*****************************************************************************/
hal_hdl_t
-hal_create (const char *name, hal_netif_config_t * conf)
+hal_create (const char *name, const char *nic_type, hal_netif_config_t * conf)
{
int ret = -1;
uint32_t netif_type;
@@ -336,7 +336,7 @@ hal_create (const char *name, hal_netif_config_t * conf)
/*open */
for (netif_type = 0; NULL != netif_ops_table[netif_type]; ++netif_type)
{
- ret = netif_ops_table[netif_type]->open (inst, name);
+ ret = netif_ops_table[netif_type]->open (inst, name, nic_type);
if (0 == ret)
{
diff --git a/src/framework/hal/hal.h b/src/framework/hal/hal.h
index 36ad79d..5a8f51e 100644
--- a/src/framework/hal/hal.h
+++ b/src/framework/hal/hal.h
@@ -66,6 +66,7 @@ typedef struct dpdk_if
char pci_addr[HAL_MAX_PCI_ADDR_LEN];
char nic_name[HAL_MAX_NIC_NAME_LEN];
+ char nic_type[HAL_MAX_NIC_NAME_LEN];
char driver_name[HAL_MAX_DRIVER_NAME_LEN];
} dpdk_if_t;
@@ -93,7 +94,7 @@ typedef struct netif_ops
const char *name;
int (*init_global) (int argc, char **argv);
int (*init_local) (void);
- int (*open) (netif_inst_t * inst, const char *name);
+ int (*open) (netif_inst_t * inst, const char *name, const char *type);
int (*close) (netif_inst_t * inst);
int (*start) (netif_inst_t * inst);
int (*stop) (netif_inst_t * inst);
diff --git a/src/framework/include/hal_api.h b/src/framework/include/hal_api.h
index 90c3100..a5d7725 100644
--- a/src/framework/include/hal_api.h
+++ b/src/framework/include/hal_api.h
@@ -110,7 +110,8 @@ typedef struct hal_netif_config
int hal_init_global (int argc, char **argv);
int hal_init_local ();
-hal_hdl_t hal_create (const char *name, hal_netif_config_t * conf);
+hal_hdl_t hal_create (const char *name, const char *nic_type,
+ hal_netif_config_t * conf);
hal_hdl_t hal_bond (const char *bond_name, uint8_t slave_num,
hal_hdl_t slave_hdl[]);
diff --git a/src/framework/include/nsfw_mgr_com_api.h b/src/framework/include/nsfw_mgr_com_api.h
index 56ec08f..9bbcaca 100644
--- a/src/framework/include/nsfw_mgr_com_api.h
+++ b/src/framework/include/nsfw_mgr_com_api.h
@@ -186,6 +186,7 @@ extern int nsfw_mgr_run_script (const char *cmd, char *result,
extern int nsfw_mgr_com_chk_hbt (int v_add);
extern i32 nsfw_set_close_on_exec (i32 sock);
extern int nsfw_mgr_comm_fd_init (u32 proc_type);
+extern void nsfw_mgr_com_mkdir_domainpath (char *pathname);
#ifdef __cplusplus
/* *INDENT-OFF* */
diff --git a/src/framework/ipc/mgr_com/mgr_com.c b/src/framework/ipc/mgr_com/mgr_com.c
index 2fb9789..a2998fa 100644
--- a/src/framework/ipc/mgr_com/mgr_com.c
+++ b/src/framework/ipc/mgr_com/mgr_com.c
@@ -1828,7 +1828,6 @@ nsfw_mgr_comm_fd_init (u32 proc_type)
* Calls :
* Called By :
*****************************************************************************/
-void nsfw_mgr_com_mkdir_domainpath (char *pathname);
void
nsfw_mgr_com_mkdir_domainpath (char *pathname)
{
diff --git a/stacks/lwip_stack/CMakeLists.txt b/stacks/lwip_stack/CMakeLists.txt
index 297d2d9..3992f20 100644
--- a/stacks/lwip_stack/CMakeLists.txt
+++ b/stacks/lwip_stack/CMakeLists.txt
@@ -48,8 +48,6 @@ FILE(WRITE ${post_compile} "#!/bin/bash\n")
FILE(APPEND ${post_compile}
"
-find ${CMAKE_CURRENT_LIST_DIR}/release/ -name \"*.sh\" -exec chmod +x {} \\;
-find ${CMAKE_CURRENT_LIST_DIR}/release/ -name \"*.py\" -exec chmod +x {} \\;
ln -sfn ./run_nstack_main.sh ${CMAKE_CURRENT_LIST_DIR}/release/script/run_nstack.sh
echo post compile process success.
"
diff --git a/stacks/lwip_stack/doc/README.md b/stacks/lwip_stack/doc/README.md
index e9bb31e..6b533e0 100644
--- a/stacks/lwip_stack/doc/README.md
+++ b/stacks/lwip_stack/doc/README.md
@@ -67,6 +67,11 @@ Run the process:
#./start_nstack.sh
```
+If you want to run it with vhost-user, you can run the start_nstack.sh with parameters as follow.
+```
+ #./start_nstack.sh --vdev virtio_user,mac=fa:16:3e:5f:b3:08,path=/tmp/unix/sock1.sock,queues=8,queue_size=1024 --no-pci
+```
+
- Steps 4: Communication test between machine A(as server) with machine B
(as client)
diff --git a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
index 1c9bf92..c4052b3 100644
--- a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
+++ b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c
@@ -22,6 +22,7 @@
//#include "sockets.h"
#include <netinet/in.h>
#include <errno.h>
+#include <netinet/tcp.h>
#include "stackx_prot_com.h"
#include "spl_api.h"
@@ -2523,7 +2524,12 @@ do_get_tcpproto_getsockopt_internal (struct common_pcb *cpcb,
NSPOL_LOGDBG (SOCKETS_DEBUG, "]fd=%d,SPL_TCP_KEEPCNT=%d",
cpcb->socket, *(int *) optval);
break;
-
+ case SPL_TCP_INFO:
+ ((struct tcp_info *) optval)->tcpi_total_retrans = (int) tpcb->nrtx;
+ ((struct tcp_info *) optval)->tcpi_snd_mss = (int) tpcb->mss;
+ ((struct tcp_info *) optval)->tcpi_rtt = (int) tpcb->sa;
+ ((struct tcp_info *) optval)->tcpi_snd_cwnd = (int) tpcb->cwnd;
+ break;
default:
NSPOL_LOGDBG (SOCKETS_DEBUG, "unsupported]optname=%d", optname);
SET_MSG_ERR (m, EOPNOTSUPP);
@@ -3316,5 +3322,7 @@ alloc_common_pcb (enum spl_netconn_type type)
common_pcb_init (cpcb);
cpcb->type = type;
+
+ res_alloc (&cpcb->res_chk);
return cpcb;
}
diff --git a/stacks/lwip_stack/lwip_src/api/spl_tcpip.c b/stacks/lwip_stack/lwip_src/api/spl_tcpip.c
index c1bd141..b0b588a 100644
--- a/stacks/lwip_stack/lwip_src/api/spl_tcpip.c
+++ b/stacks/lwip_stack/lwip_src/api/spl_tcpip.c
@@ -61,7 +61,7 @@
#include "sys.h"
-#define NSTACK_MAIN_MAX_PARA 19
+#define NSTACK_MAIN_MAX_PARA 32
#define NSTACK_MAIN_MIN_PARA 1
#define DPDK_DEFAULT_EAL_MEM_SIZE (1024)
diff --git a/stacks/lwip_stack/lwip_src/common/stackx_common_opt.h b/stacks/lwip_stack/lwip_src/common/stackx_common_opt.h
index d2d01e5..feccc3f 100644
--- a/stacks/lwip_stack/lwip_src/common/stackx_common_opt.h
+++ b/stacks/lwip_stack/lwip_src/common/stackx_common_opt.h
@@ -102,6 +102,7 @@ extern "C" {
#define SPL_TCP_KEEPCNT 0x06
#define SPL_TCP_LINGER2 0x08
#define SPL_TCP_DEFER_ACCEPT 0x09
+#define SPL_TCP_INFO 0x0B
typedef enum spl_netconn_type
{
diff --git a/stacks/lwip_stack/lwip_src/common/stackx_spl_msg.h b/stacks/lwip_stack/lwip_src/common/stackx_spl_msg.h
index 119c26a..3088150 100644
--- a/stacks/lwip_stack/lwip_src/common/stackx_spl_msg.h
+++ b/stacks/lwip_stack/lwip_src/common/stackx_spl_msg.h
@@ -21,6 +21,7 @@
#include "stackx_spl_share.h"
#include "stackx_common_opt.h"
#include <sys/socket.h>
+#include <netinet/tcp.h>
#ifdef __cplusplus
/* *INDENT-OFF* */
@@ -207,6 +208,7 @@ typedef struct
//struct in_addr inaddr_optval;
//struct linger _linger;
struct timeval timeval_optval;
+ struct tcp_info tpinfo;
//ipmreq ipmreq_optval; //Multicast support later
} optval;
diff --git a/stacks/lwip_stack/lwip_src/include/ip_module/ip_module_api.h b/stacks/lwip_stack/lwip_src/include/ip_module/ip_module_api.h
index 488e13e..acf5057 100644
--- a/stacks/lwip_stack/lwip_src/include/ip_module/ip_module_api.h
+++ b/stacks/lwip_stack/lwip_src/include/ip_module/ip_module_api.h
@@ -149,6 +149,7 @@ struct network_configuration
struct ip_subnet *ip_subnet;
char network_name[IP_MODULE_MAX_NAME_LEN];
char type_name[IP_MODULE_MAX_NAME_LEN];
+ char nic_type_name[IP_MODULE_MAX_NAME_LEN];
network_buffer *buffer;
};
diff --git a/stacks/lwip_stack/lwip_src/include/netif/sharedmemory.h b/stacks/lwip_stack/lwip_src/include/netif/sharedmemory.h
index 0a92ea0..6230ed8 100644
--- a/stacks/lwip_stack/lwip_src/include/netif/sharedmemory.h
+++ b/stacks/lwip_stack/lwip_src/include/netif/sharedmemory.h
@@ -101,6 +101,7 @@ enum proc_run_type
struct linux_port_info
{
char if_name[HAL_MAX_NIC_NAME_LEN];
+ char if_type[HAL_MAX_NIC_NAME_LEN];
char ip_addr_linux[18]; //uint32_t ip_addr_linux;
char mask_linux[18]; //uint32_t mask_linux;
char bcast_linux[18]; //uint32_t bcast_linux;
diff --git a/stacks/lwip_stack/lwip_src/ip_module/network.c b/stacks/lwip_stack/lwip_src/ip_module/network.c
index ef0d9a7..d7c9630 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/network.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/network.c
@@ -510,7 +510,8 @@ add_network_configuration (struct network_configuration
while (pheader)
{
if (!spl_hal_is_nic_exist (pheader->nic_name)
- && !nic_already_init (pheader->nic_name))
+ && !nic_already_init (pheader->nic_name)
+ && strncmp (tmp->nic_type_name, "vhost", strlen ("vhost")))
{
NSOPR_LOGERR ("Invalid configuration %s not exist Error! ",
pheader->nic_name);
@@ -584,7 +585,7 @@ parse_network_obj (struct json_object *network_obj)
NULL, *type_name_obj = NULL;
struct json_object *ref_nic_list_obj = NULL, *bond_mode_obj =
NULL, *bond_name_obj = NULL, *ipam_obj = NULL;
- struct json_object *subnet_obj = NULL;
+ struct json_object *subnet_obj = NULL, *nic_type_obj = NULL;
if (!network_obj)
{
@@ -687,6 +688,44 @@ parse_network_obj (struct json_object *network_obj)
goto RETURN_ERROR;
}
+ json_object_object_get_ex (phy_obj, "nic_type", &nic_type_obj); /*lint !e534 no need to check return value */
+ if (nic_type_obj)
+ {
+ const char *nic_type_name =
+ json_object_get_string (nic_type_obj);
+ if (strcmp (nic_type_name, "pci") != 0
+ && strcmp (nic_type_name, "vhost") != 0)
+ {
+ NSOPR_LOGERR ("unsupported nic_type]nic_type=%s",
+ nic_type_name);
+ goto RETURN_ERROR;
+ }
+
+ retVal =
+ STRCPY_S (pst_network_configuration->nic_type_name,
+ sizeof (pst_network_configuration->nic_type_name),
+ nic_type_name);
+ if (EOK != retVal)
+ {
+ NSOPR_LOGERR ("strcpy_s failed]ret=%d", retVal);
+ goto RETURN_ERROR;
+ }
+ }
+ else
+ {
+ NSOPR_LOGINF
+ ("nic_type not specified, use default type]defaul nic_type=pci");
+ retVal =
+ STRCPY_S (pst_network_configuration->nic_type_name,
+ sizeof (pst_network_configuration->nic_type_name),
+ "pci");
+ if (EOK != retVal)
+ {
+ NSOPR_LOGERR ("strcpy_s failed]ret=%d", retVal);
+ goto RETURN_ERROR;
+ }
+ }
+
json_object_object_get_ex (phy_obj, "ref_nic", &ref_nic_list_obj);
if (ref_nic_list_obj)
{
diff --git a/stacks/lwip_stack/lwip_src/netif/spl_hal.c b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
index 596962e..db843d4 100644
--- a/stacks/lwip_stack/lwip_src/netif/spl_hal.c
+++ b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
@@ -962,6 +962,23 @@ spl_hal_port_config (unsigned int *port_num)
NSPOL_LOGINF (SC_DPDK_INFO, "if_name %s",
p_stackx_port_zone->
stackx_one_port[port_index].linux_ip.if_name);
+
+ retVal =
+ STRCPY_S (p_stackx_port_zone->
+ stackx_one_port[port_index].linux_ip.if_type,
+ sizeof (p_stackx_port_zone->
+ stackx_one_port[port_index].linux_ip.if_type),
+ network->nic_type_name);
+ if (EOK != retVal)
+ {
+ NSPOL_LOGERR ("strcpy_s failed]ret=%d.", retVal);
+ return -1;
+ }
+
+ NSPOL_LOGINF (SC_DPDK_INFO, "if_type %s",
+ p_stackx_port_zone->
+ stackx_one_port[port_index].linux_ip.if_type);
+
retVal =
STRCPY_S (p_stackx_port_zone->
stackx_one_port[port_index].linux_ip.ip_addr_linux,
@@ -1286,7 +1303,9 @@ spl_hal_port_start (uint16_t nic_id, struct stackx_port_info *p_port_info,
conf.tx.ring_size[q] = HAL_TX_RING_SIZE;
}
- hdl = hal_create (p_port_info->linux_ip.if_name, &conf);
+ hdl =
+ hal_create (p_port_info->linux_ip.if_name, p_port_info->linux_ip.if_type,
+ &conf);
if (!hal_is_valid (hdl))
{
diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c b/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
index 3225c2f..0042e54 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
@@ -498,6 +498,7 @@ sbr_getsockopt_ipproto_tcp (int optname, void *optval, socklen_t optlen)
case SPL_TCP_KEEPIDLE:
case SPL_TCP_KEEPINTVL:
case SPL_TCP_KEEPCNT:
+ case SPL_TCP_INFO:
break;
default:
err = ENOPROTOOPT;
diff --git a/stacks/lwip_stack/release/script/nstack_fun.sh b/stacks/lwip_stack/release/script/nstack_fun.sh
index 5e16283..fed3588 100755
--- a/stacks/lwip_stack/release/script/nstack_fun.sh
+++ b/stacks/lwip_stack/release/script/nstack_fun.sh
@@ -332,10 +332,10 @@ run_nStackMain()
log $LINENO "$env DPDK_TOOL_DIR=$DPDK_TOOL_DIR"
log $LINENO "$env LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
log $LINENO "$env DPDK_LIB_PATH=$DPDK_LIB_PATH"
- log $LINENO "./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 stack -c $4 -sleep $5 -bind_cpu $6"
+ log $LINENO "./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 $7 $8 stack -c $4 -sleep $5 -bind_cpu $6"
check_file_size $DPDK_FILE
cd ..; cd bin/
- ./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 stack -c $4 -sleep $5 -bind_cpu $6 >> $DPDK_FILE &
+ ./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 $7 $8 stack -c $4 -sleep $5 -bind_cpu $6 >> $DPDK_FILE &
}
diff --git a/stacks/lwip_stack/release/script/nstack_var.sh b/stacks/lwip_stack/release/script/nstack_var.sh
index a654d34..a654d34 100644..100755
--- a/stacks/lwip_stack/release/script/nstack_var.sh
+++ b/stacks/lwip_stack/release/script/nstack_var.sh
diff --git a/stacks/lwip_stack/release/script/run_nstack_main.sh b/stacks/lwip_stack/release/script/run_nstack_main.sh
index 2bd9e0d..9d6049a 100644..100755
--- a/stacks/lwip_stack/release/script/run_nstack_main.sh
+++ b/stacks/lwip_stack/release/script/run_nstack_main.sh
@@ -20,7 +20,8 @@ init_network
CORE_MASK=1
log $LINENO "start run nstackmain"
log $LINENO "COREMASK=$CORE_MASK, HUGE_DIR=$1, MEM_SIZE=$2, RTP_CORE_MASK=$RTP_CORE_MASK, SLEEP_INTERVAL=$SLEEP_INTERVAL, BIND_CPU=$BIND_CPU"
+log $LINENO "VDEV=$VDEV, NO_PCI=$NO_PCI"
-run_nStackMain $CORE_MASK $1 $2 $RTP_CORE_MASK $SLEEP_INTERVAL $BIND_CPU
+run_nStackMain $CORE_MASK $1 $2 $RTP_CORE_MASK $SLEEP_INTERVAL $BIND_CPU $3 $4
exit 0
diff --git a/stacks/lwip_stack/release/script/run_nstack_master.sh b/stacks/lwip_stack/release/script/run_nstack_master.sh
index 8da0d49..8da0d49 100644..100755
--- a/stacks/lwip_stack/release/script/run_nstack_master.sh
+++ b/stacks/lwip_stack/release/script/run_nstack_master.sh
diff --git a/stacks/lwip_stack/release/send_alarm.sh b/stacks/lwip_stack/release/send_alarm.sh
index 46ea413..46ea413 100644..100755
--- a/stacks/lwip_stack/release/send_alarm.sh
+++ b/stacks/lwip_stack/release/send_alarm.sh
diff --git a/stacks/lwip_stack/release/start_nstack.sh b/stacks/lwip_stack/release/start_nstack.sh
index db0c084..35fe9df 100644..100755
--- a/stacks/lwip_stack/release/start_nstack.sh
+++ b/stacks/lwip_stack/release/start_nstack.sh
@@ -16,16 +16,40 @@ fi
##get the log info from the parameter of ./start -l XXX -a XXX ###
nstack_log_path=""
hostinfo_path=""
-while getopts "l:i:a:" arg
+ARGS=`getopt -o "l:i:a:" -l "vdev:,file-prefix:,no-pci" -n "start_nstack.sh" -- "$@"`
+eval set -- "${ARGS}"
+while true
do
- case $arg in
- l)
- nstack_log_path="$OPTARG"
- ;;
- i)
- hostinfo_path="$OPTARG"
- ;;
- esac
+ case "$1" in
+ -l)
+ nstack_log_path="$2"
+ shift 2
+ ;;
+ -i)
+ hostinfo_path="$2"
+ shift 2
+ ;;
+ --vdev)
+ VDEV="--vdev=$2"
+ shift 2
+ ;;
+ --file-prefix)
+ FILE_PREFIX="--file-prefix=$2"
+ shift 2
+ ;;
+ --no-pci)
+ NO_PCI="--no-pci"
+ shift 1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "Option illegal, please check input!"
+ exit 1
+ ;;
+ esac
done
hostinfo_stat=0
@@ -116,8 +140,8 @@ install_config
########################################################
core_mask=1
START_TYPE="primary"
-log $LINENO "./script/run_nstack_main.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE"
-${script_path}/script/run_nstack_main.sh $HUGE_DIR $MEM_SIZE
+log $LINENO "./script/run_nstack_main.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE $VDEV $NO_PCI"
+${script_path}/script/run_nstack_main.sh $HUGE_DIR $MEM_SIZE $VDEV $NO_PCI
print_pid=$(ps -ux | grep nStackMain | awk '{print $2}' | awk 'NR == 2')
echo "nStackMain PID:$print_pid"
diff --git a/stacks/lwip_stack/release/stop_nstack.sh b/stacks/lwip_stack/release/stop_nstack.sh
index 48d1af7..48d1af7 100644..100755
--- a/stacks/lwip_stack/release/stop_nstack.sh
+++ b/stacks/lwip_stack/release/stop_nstack.sh
diff --git a/stacks/lwip_stack/release/uninstall.sh b/stacks/lwip_stack/release/uninstall.sh
index 92ae5fe..92ae5fe 100644..100755
--- a/stacks/lwip_stack/release/uninstall.sh
+++ b/stacks/lwip_stack/release/uninstall.sh
diff --git a/stacks/lwip_stack/src/io_adpt/dpdk.c b/stacks/lwip_stack/src/io_adpt/dpdk.c
index d199513..8518112 100644
--- a/stacks/lwip_stack/src/io_adpt/dpdk.c
+++ b/stacks/lwip_stack/src/io_adpt/dpdk.c
@@ -190,6 +190,13 @@ NSTACK_STATIC struct rte_eth_conf port_conf_default_bond = {
},
};
+NSTACK_STATIC struct rte_eth_conf port_conf_default_vhost = {
+ .rxmode = {
+ .hw_ip_checksum = 0, /* vhost nic doesn't support hw_ip_checksum and hw_vlan_filter */
+ .hw_vlan_filter = 0,
+ }
+};
+
/*****************************************************************************
* Prototype : dpdk_mbuf_to_file
* Description : write the packet data into a file
@@ -700,6 +707,39 @@ dpdk_set_port (netif_inst_t * inst, uint8_t port)
}
/*****************************************************************************
+ Prototype : dpdk_set_nic_type
+ Description : check and save nic type
+ Input : netif_inst_t* inst
+ const char* type
+ Output : None
+ Return Value : NSTACK_STATIC
+ Calls :
+ Called By :
+
+*****************************************************************************/
+NSTACK_STATIC int
+dpdk_set_nic_type (netif_inst_t * inst, const char *type)
+{
+ int ret;
+
+ ret =
+ STRCPY_S (inst->data.dpdk_if.nic_type,
+ sizeof (inst->data.dpdk_if.nic_type), type);
+ if (EOK != ret)
+ {
+ NSHAL_LOGERR ("strcpy_s set nic_type failed]ret=%d", ret);
+ return -1;
+ }
+
+ /*
+ * *nic_type is first checked at read_ipmoduleoperateadd_configuration,
+ * *thus here we dont boring validating it once more and just return.
+ * */
+
+ return 0;
+}
+
+/*****************************************************************************
Prototype : dpdk_set_nic_name
Description : check and save nic name
Input : netif_inst_t* inst
@@ -1433,10 +1473,25 @@ dpdk_probe_pci (netif_inst_t * inst)
*****************************************************************************/
NSTACK_STATIC int
-dpdk_open (netif_inst_t * inst, const char *name)
+dpdk_open (netif_inst_t * inst, const char *name, const char *type)
{
int ret;
+ if ((inst == NULL) || (name == NULL) || (type == NULL))
+ {
+ NSHAL_LOGERR
+ ("invaliad arguments]inst==NULL, nic_type==NULL or type==NULL");
+ return -1;
+ }
+
+ ret = dpdk_set_nic_type (inst, type);
+
+ if (0 != ret)
+ {
+ NSHAL_LOGERR ("dpdk_set_nic_type fail]nic_type=%s, ret=%d", type, ret);
+ return -1;
+ }
+
ret = dpdk_set_nic_name (inst, name);
if (0 != ret)
@@ -1445,6 +1500,13 @@ dpdk_open (netif_inst_t * inst, const char *name)
return -1;
}
+ if (!strncmp (type, "vhost", strlen ("vhost")))
+ {
+ /*for vhost-user device, the remaining steps is unnecessary, y0413485 */
+ NSHAL_LOGERR ("initting vhost device]nic_name=%s type=%s", name, type);
+ return 0;
+ }
+
ret = dpdk_get_driver_name (inst);
if (0 != ret)
@@ -1588,6 +1650,11 @@ dpdk_get_port_conf (netif_inst_t * inst, struct rte_eth_conf **port_conf)
{
*port_conf = &port_conf_default_bond;
}
+ else if (strncmp ("vhost", inst->data.dpdk_if.nic_type, (size_t) 5) == 0)
+ {
+ *port_conf = &port_conf_default_vhost;
+ return;
+ }
else
{
*port_conf = &port_conf_default_normal;
diff --git a/stacks/lwip_stack/src/nStackMain/main.c b/stacks/lwip_stack/src/nStackMain/main.c
index ce05068..ec36b75 100644
--- a/stacks/lwip_stack/src/nStackMain/main.c
+++ b/stacks/lwip_stack/src/nStackMain/main.c
@@ -42,7 +42,7 @@
#define GlOBAL_HELP "--help"
#define GLOBAL_Dpdk_ARG "dpdk"
#define GLOBAL_STACK_PORT "-port"
-#define NSTACK_MAIN_MAX_PARA 19
+#define NSTACK_MAIN_MAX_PARA 32
#define NSTACK_MAIN_MIN_PARA 1
#define MAX_MASTER_OPEN_FD 1024
diff --git a/thirdparty/apps/CMakeLists.txt b/thirdparty/apps/CMakeLists.txt
index 2cf5240..8df3cb8 100644
--- a/thirdparty/apps/CMakeLists.txt
+++ b/thirdparty/apps/CMakeLists.txt
@@ -28,18 +28,19 @@ endif()
INCLUDE(ExternalProject)
ExternalProject_Add(
- NGINX
- URL ${NGINX_URL}
- DOWNLOAD_DIR ${NGINX_DOWNLOAD_DIR}
- DOWNLOAD_COMMAND ${NGINX_DOWNLOAD_CMD}
- BUILD_IN_SOURCE 1
- SOURCE_DIR ${NGINX_SRC}
- PATCH_COMMAND echo "./configure --with-ld-opt=\"-L${LIB_PATH_SHARED}/ -lnStackAPI -Wl,-rpath=${LIB_PATH_SHARED}\" --sbin-path=${NGINX_RELEASE}/nginx --conf-path=${NGINX_RELEASE}/nginx.conf --pid-path=${NGINX_RELEASE}/nginx.pid " > configure.sh
- COMMAND sed -i -e "48,49 s/^/#/" ${CMAKE_CURRENT_LIST_DIR}/nginx/nginx-1.12.2/auto/os/linux
- CONFIGURE_COMMAND sh configure.sh
- BUILD_COMMAND make
- INSTALL_COMMAND make install
- DEPENDS nStackAPI
+ NGINX
+ URL ${NGINX_URL}
+ DOWNLOAD_DIR ${NGINX_DOWNLOAD_DIR}
+ DOWNLOAD_COMMAND ${NGINX_DOWNLOAD_CMD}
+ BUILD_IN_SOURCE 1
+ SOURCE_DIR ${NGINX_SRC}
+ PATCH_COMMAND echo "./configure --with-ld-opt=\"-L${LIB_PATH_SHARED}/ -lnStackAPI -Wl,-rpath=${LIB_PATH_SHARED}\" --sbin-path=${NGINX_RELEASE}/nginx --conf-path=${NGINX_RELEASE}/nginx.conf --pid-path=${NGINX_RELEASE}/nginx.pid " > configure.sh
+ COMMAND sed -i -e "47 s/$/\"/" ${CMAKE_CURRENT_LIST_DIR}/nginx/nginx-1.14.0/auto/os/linux
+ COMMAND sed -i -e "48,49 s/^/#/" ${CMAKE_CURRENT_LIST_DIR}/nginx/nginx-1.12.2/auto/os/linux
+ CONFIGURE_COMMAND sh configure.sh
+ BUILD_COMMAND make
+ INSTALL_COMMAND make install
+ DEPENDS nStackAPI
)
set_target_properties(NGINX PROPERTIES EXCLUDE_FROM_ALL TRUE)