summaryrefslogtreecommitdiffstats
path: root/stacks/lwip_stack/lwip_src
diff options
context:
space:
mode:
Diffstat (limited to 'stacks/lwip_stack/lwip_src')
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_api_msg.c11
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_tcpip.c6
-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/container_ip.c2
-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.c12
-rw-r--r--stacks/lwip_stack/lwip_src/socket/stackx_udp.c22
11 files changed, 84 insertions, 38 deletions
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..f437bce 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"
@@ -1572,6 +1573,7 @@ spl_do_connected (void *arg, struct tcp_pcb *pcb, err_t err)
conn->state = SPL_NETCONN_NONE;
SPL_NETCONN_SET_SAFE_ERR (conn, ERR_OK);
+ update_tcp_state (pcb->callback_arg, ESTABLISHED);
SPL_API_EVENT (conn, SPL_NETCONN_EVT_SENDPLUS, 1);
if (was_blocking && m != NULL)
@@ -2523,7 +2525,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 +3323,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 b627bcf..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)
@@ -951,7 +951,7 @@ spl_tcpip_thread (void *arg)
u16 task_loop;
u16 num_recv_task = 0, num_send_timer_task = 0;
u16 index_task = 0;
- int tcpip_thread_sleep_interval = g_tcpip_thread_sleep_time * 1000;
+ //int tcpip_thread_sleep_interval = g_tcpip_thread_sleep_time * 1000;
void *task_queue[TASK_BURST];
data_com_msg *msg;
@@ -981,7 +981,7 @@ spl_tcpip_thread (void *arg)
if (run_count++ > 20)
{
- sys_sleep_ns (0, tcpip_thread_sleep_interval);
+ //sys_sleep_ns (0, tcpip_thread_sleep_interval);
}
continue;
}
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/container_ip.c b/stacks/lwip_stack/lwip_src/ip_module/container_ip.c
index decc52c..52f7c64 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/container_ip.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/container_ip.c
@@ -533,7 +533,7 @@ parse_container_ip_json (char *param)
else
{
/* this mandatory parameter */
- goto RETURN_ERROR;
+ NSOPR_LOGWAR ("json_object_object_get_ex containerID failed");
}
json_object_object_get_ex (obj, "ports_list", &ports_list_obj);
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..8d57ba0 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_tcp.c
@@ -403,16 +403,7 @@ sbr_tcp_connect (sbr_socket_t * sk, const struct sockaddr *name,
inet_addr_to_ipaddr (&remote_addr, &addr_in->sin_addr);
u16 remote_port = addr_in->sin_port;
- spl_ip_addr_t local_addr;
- if (IPADDR_ANY == ss_get_local_ip (sbr_get_conn (sk))->addr)
- {
- if (sbr_get_src_ip (remote_addr.addr, &local_addr.addr) != 0)
- {
- sbr_set_sk_errno (sk, EHOSTUNREACH);
- NSSBR_LOGERR ("get src ip failed]fd=%d", sk->fd);
- return -1;
- }
- }
+ spl_ip_addr_t local_addr = { IPADDR_ANY };
if (sbr_handle_connect (sk, &remote_addr, ntohs (remote_port), &local_addr)
!= 0)
@@ -498,6 +489,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/lwip_src/socket/stackx_udp.c b/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
index 69b822b..1f382cf 100644
--- a/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
+++ b/stacks/lwip_stack/lwip_src/socket/stackx_udp.c
@@ -182,16 +182,7 @@ sbr_udp_connect (sbr_socket_t * sk, const struct sockaddr *name,
inet_addr_to_ipaddr (&remote_addr, &addr_in->sin_addr);
u16 remote_port = addr_in->sin_port;
- spl_ip_addr_t local_addr;
- if (IPADDR_ANY == ss_get_local_ip (sbr_get_conn (sk))->addr)
- {
- if (sbr_get_src_ip (remote_addr.addr, &local_addr.addr) != 0)
- {
- sbr_set_sk_errno (sk, EHOSTUNREACH);
- NSSBR_LOGERR ("get src ip failed]fd=%d", sk->fd);
- return -1;
- }
- }
+ spl_ip_addr_t local_addr = { IPADDR_ANY };
return sbr_handle_connect (sk, &remote_addr, ntohs (remote_port),
&local_addr);
@@ -815,16 +806,7 @@ sbr_udp_senddata (sbr_socket_t * sk, const struct iovec *iov, int iovcnt,
netbuf_fromport (&buf) = 0;
}
- spl_ip_addr_t local_ip;
- if (IPADDR_ANY == ss_get_local_ip (sbr_get_conn (sk))->addr)
- {
- if (sbr_get_src_ip (buf.addr.addr, &local_ip.addr) != 0)
- {
- sbr_set_sk_io_errno (sk, EHOSTUNREACH);
- NSSBR_LOGERR ("get src ip failed]fd=%d", sk->fd);
- return -1;
- }
- }
+ spl_ip_addr_t local_ip = { IPADDR_ANY };
int err = ss_get_last_errno (sbr_get_conn (sk));
if (SPL_ERR_IS_FATAL (err))