diff options
Diffstat (limited to 'stacks/lwip_stack/src/include')
-rw-r--r-- | stacks/lwip_stack/src/include/nsfw_msg.h | 203 | ||||
-rw-r--r-- | stacks/lwip_stack/src/include/nsfw_msg_api.h | 309 | ||||
-rw-r--r-- | stacks/lwip_stack/src/include/nsfw_mt_config.h | 292 | ||||
-rw-r--r-- | stacks/lwip_stack/src/include/nsfw_rti.h | 66 |
4 files changed, 0 insertions, 870 deletions
diff --git a/stacks/lwip_stack/src/include/nsfw_msg.h b/stacks/lwip_stack/src/include/nsfw_msg.h deleted file mode 100644 index e5254d3..0000000 --- a/stacks/lwip_stack/src/include/nsfw_msg.h +++ /dev/null @@ -1,203 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef MSG_H -#define MSG_H -#include "types.h" -#include "common_mem_api.h" -#include "nsfw_rti.h" -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -#define MAX_MSG_SIZE 512 -COMPAT_PROTECT (MAX_MSG_SIZE, 512); -#define MAX_MSG_PARAM_SIZE 128 -COMPAT_PROTECT (MAX_MSG_PARAM_SIZE, 128); - -#define MSG_ASYN_POST 0 -#define MSG_SYN_POST 1 - -typedef struct -{ - u16 module_type; - u16 major_type; - u16 minor_type; - u16 op_type; /* MSG_SYN_POST or MSG_ASYN_POST */ - sys_sem_st op_completed; - i32 err; - PRIMARY_ADDR void *msg_from; /* use it to free msg */ - i64 receiver; - i64 comm_receiver; - nsfw_res res_chk; - u32 src_pid; - u32 recycle_pid; /* use it in recycle */ - u64 span_pid; - i64 extend_member_bit; -} msg_param; - -typedef struct msg_t -{ - msg_param param; - i8 msg_param_pad[MAX_MSG_PARAM_SIZE - sizeof (msg_param)]; /* sizeof(msg_param) + sizeof(msg_param_pad) = MAX_MSG_PARAM_SIZE */ - i64 buffer[(MAX_MSG_SIZE - MAX_MSG_PARAM_SIZE) / 8]; -} -data_com_msg; - -#define MAX_MODULE_TYPE 64 -#define MAX_MAJOR_TYPE 256 -#define MAX_MINOR_TYPE 256 - -struct rti_queue -{ - /* corresponding to enum spl_tcpip_msg_type */ - volatile u64 tcpip_msg_enq[MAX_MAJOR_TYPE]; - volatile u64 tcpip_msg_enq_fail[MAX_MAJOR_TYPE]; - u64 tcpip_msg_deq[MAX_MAJOR_TYPE]; - - /* corresponding to enum api_msg_type, this is sub-type of SPL_TCPIP_NEW_MSG_API */ - volatile u64 api_msg_enq[MAX_MINOR_TYPE]; - volatile u64 api_msg_enq_fail[MAX_MINOR_TYPE]; - u64 api_msg_deq[MAX_MINOR_TYPE]; - - u64 extend_member_bit; -}; - -enum MSG_MODULE_TYPE -{ - MSG_MODULE_IP, - MSG_MODULE_SBR, - MSG_MODULE_HAL, - MSG_MODULE_SPL, - MSG_MODULE_TIMER, - MSG_MODULE_MT, - MSG_MODULE_DFX, - MSG_MODULE_MAX = MAX_MODULE_TYPE -}; - -typedef int (*msg_fun) (data_com_msg * m); - -/* *INDENT-OFF* */ -extern msg_fun g_msg_module_fun_array[MAX_MODULE_TYPE]; -extern msg_fun g_msg_module_major_fun_array[MAX_MODULE_TYPE][MAX_MAJOR_TYPE]; -extern msg_fun g_msg_module_major_minor_fun_array[MAX_MODULE_TYPE][MAX_MAJOR_TYPE][MAX_MINOR_TYPE]; -extern msg_fun g_msg_unsupport_fun; -/* *INDENT-ON* */ - -#define REGIST_MSG_MODULE_FUN(module, fun) \ - static void regist_ ## module ## _function (void) \ - __attribute__((__constructor__)); \ - static void regist_ ## module ## _function (void) \ - { \ - g_msg_module_fun_array[module] = fun; \ - } \ - -#define REGIST_MSG_MODULE_MAJOR_FUN(module, major, fun) \ - static void regist_ ## module ## major ## _function (void) \ - __attribute__((__constructor__)); \ - static void regist_ ## module ## major ## _function (void) \ - { \ - g_msg_module_major_fun_array[module][major] = fun; \ - } \ - -#define REGIST_MSG_MODULE_MAJOR_MINOR_FUN(module, major, minor, fun) \ - static void regist_ ## module ## major ## minor ## _function (void) \ - __attribute__((__constructor__)); \ - static void regist_ ## module ## major ## minor ## _function (void) \ - { \ - g_msg_module_major_minor_fun_array[module][major][minor] = fun; \ - } \ - -#define REGIST_MSG_UNSUPPORT_FUN(fun) \ - static void regist_msg_unsupport_function (void) \ - __attribute__((__constructor__)); \ - static void regist_msg_unsupport_function (void) \ - { \ - g_msg_unsupport_fun = fun; \ - } - -static inline int -unsupport_msg (data_com_msg * m) -{ - if (g_msg_unsupport_fun) - { - return g_msg_unsupport_fun (m); - } - - return -1; -} - -/***************************************************************************** -* Prototype : call_msg_fun -* Description : call msg fun -* Input : data_com_msg* m -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -* -*****************************************************************************/ -static inline int -call_msg_fun (data_com_msg * m) -{ - u16 module = m->param.module_type; - u16 major = m->param.major_type; - u16 minor = m->param.minor_type; - - if ((module >= MAX_MODULE_TYPE) || (major >= MAX_MAJOR_TYPE) - || (minor >= MAX_MINOR_TYPE)) - { - return unsupport_msg (m); - } - - nsfw_rti_stat_macro (NSFW_STAT_PRIMARY_DEQ, m); - - if (g_msg_module_fun_array[module] - && (g_msg_module_fun_array[module] (m) != 0)) - { - return -1; - } - - if (g_msg_module_major_fun_array[module][major] - && (g_msg_module_major_fun_array[module][major] (m) != 0)) - { - return -1; - } - - if (g_msg_module_major_minor_fun_array[module][major][minor]) - { - return g_msg_module_major_minor_fun_array[module][major][minor] (m); - } - - if (!g_msg_module_fun_array[module] - && !g_msg_module_major_fun_array[module][major] - && !g_msg_module_major_minor_fun_array[module][major][minor]) - { - return unsupport_msg (m); - } - - return 0; -} - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif diff --git a/stacks/lwip_stack/src/include/nsfw_msg_api.h b/stacks/lwip_stack/src/include/nsfw_msg_api.h deleted file mode 100644 index 85dca49..0000000 --- a/stacks/lwip_stack/src/include/nsfw_msg_api.h +++ /dev/null @@ -1,309 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef MSG_API_H -#define MSG_API_H -#include "nsfw_msg.h" -#include "nsfw_mem_api.h" -#include "nstack_log.h" -#include "nsfw_rti.h" -#include "common_mem_api.h" -#include "nsfw_recycle_api.h" -#include "common_pal_bitwide_adjust.h" - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -#define SET_MSG_ERR(m, error) ((m)->param.err = (error)) -#define GET_MSG_ERR(m) ((m)->param.err) - -/* for sync message from sbr we should signal sem */ -#define SYNC_MSG_ACK(m) sys_sem_s_signal(&((m)->param.op_completed)) - -/* for async message from sbr we should free the message */ -#define ASYNC_MSG_FREE(m) msg_free(m) - -#define MSG_ENTRY(_ptr, _type, _member) container_of((void *)_ptr, _type, _member) - -#ifndef NSTACK_STATIC_CHECK -/***************************************************************************** -* Prototype : msg_malloc -* Description : malloc msg -* Input : mring_handle mhandle -* Output : None -* Return Value : static inline data_com_msg* -* Calls : -* Called By : -*****************************************************************************/ -static inline data_com_msg * -msg_malloc (mring_handle mhandle) -{ - if (!mhandle) - { - NSFW_LOGERR ("mhandle is null"); - return NULL; - } - - data_com_msg *m = NULL; - if (nsfw_mem_ring_dequeue (mhandle, (void **) &m) != 1) - { - return NULL; - } - - m->param.recycle_pid = get_sys_pid (); - res_alloc (&m->param.res_chk); - return m; -} - -/***************************************************************************** -* Prototype : msg_free -* Description : free msg -* Input : data_com_msg* m -* mring_handle mhandle -* Output : None -* Return Value : static inline void -* Calls : -* Called By : -*****************************************************************************/ -static inline void -msg_free (data_com_msg * m) -{ - if (!m) - { - NSFW_LOGERR ("m is NULL"); - return; - } - - mring_handle mhandle = ADDR_SHTOL (m->param.msg_from); - if (!mhandle) - { - return; - } - - if (res_free (&m->param.res_chk)) - { - NSFW_LOGERR ("m refree!]m=%p", m); - return; - } - - m->param.recycle_pid = 0; - - if (nsfw_mem_ring_enqueue (mhandle, (void *) m) != 1) - { - NSFW_LOGERR ("nsfw_mem_ring_enqueue failed,this can not happen"); - } -} - -/***************************************************************************** -* Prototype : msg_post -* Description : post msg -* Input : data_com_msg* m -* mring_handle mhandle -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -*****************************************************************************/ -static inline int -msg_post (data_com_msg * m, mring_handle mhandle) -{ - int ret; - if (!m || !mhandle) - { - NSFW_LOGERR ("param is not ok]m=%p,mhandle=%p", m, mhandle); - return -1; - } - - while (1) - { - ret = nsfw_mem_ring_enqueue (mhandle, (void *) m); - switch (ret) - { - case 1: - if (MSG_SYN_POST == m->param.op_type) - { - sys_arch_sem_s_wait (&m->param.op_completed, 0); - } - - return 0; - case 0: - continue; - default: - nsfw_rti_stat_macro (NSFW_STAT_PRIMARY_ENQ_FAIL, m); - return -1; - } - } -} - -#define MSG_POST_FAILED 50 -/***************************************************************************** -* Prototype : msg_post_with_lock_rel -* Description : post msg to tcpip thread in mgrcom thread -* Input : data_com_msg* m -* mring_handle mhandle -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -*****************************************************************************/ -static inline int -msg_post_with_lock_rel (data_com_msg * m, mring_handle mhandle) -{ - int ret; - int try_count = 0; - if (!m || !mhandle) - { - NSFW_LOGERR ("param is not ok]m=%p,mhandle=%p", m, mhandle); - return -1; - } - - while (1) - { - ret = nsfw_mem_ring_enqueue (mhandle, (void *) m); - switch (ret) - { - case 1: - if (MSG_SYN_POST == m->param.op_type) - { - sys_arch_sem_s_wait (&m->param.op_completed, 0); - } - - return 0; - case 0: - try_count++; - if (try_count > MSG_POST_FAILED) - { - try_count = 0; - nsfw_recycle_rechk_lock (); - } - sys_sleep_ns (0, 1000000); - continue; - default: - nsfw_rti_stat_macro (NSFW_STAT_PRIMARY_ENQ_FAIL, m); - return -1; - } - } -} - -/***************************************************************************** -* Prototype : msg_try_post -* Description : try post msg -* Input : data_com_msg* m -* mring_handle mhandle -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -*****************************************************************************/ -static inline int -msg_try_post (data_com_msg * m, mring_handle mhandle) -{ - if (!m || !mhandle) - { - NSFW_LOGERR ("param is not ok]m=%p,mhandle=%p", m, mhandle); - return -1; - } - - int ret = nsfw_mem_ring_enqueue (mhandle, (void *) m); - if (1 == ret) - { - if (MSG_SYN_POST == m->param.op_type) - { - sys_arch_sem_s_wait (&m->param.op_completed, 0); - } - - return 0; - } - - return -1; -} - -/***************************************************************************** -* Prototype : msg_fetch -* Description : fetch msg -* Input : mring_handle mhandle -* data_com_msg** m -* u32 num -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -*****************************************************************************/ -static inline int -msg_fetch (mring_handle mhandle, data_com_msg ** m, u32 num) -{ - if (!m || !mhandle) - { - NSFW_LOGERR ("param is not ok]m=%p,mhandle=%p", m, mhandle); - return -1; - } - - int ret; - while (1) - { - ret = nsfw_mem_ring_dequeuev (mhandle, (void *) m, num); - if (ret > 0) - { - break; - } - } - - return ret; -} - -/***************************************************************************** -* Prototype : msg_try_fetch -* Description : try fetch msg -* Input : mring_handle mhandle -* data_com_msg** m -* u32 num -* Output : None -* Return Value : static inline int -* Calls : -* Called By : -*****************************************************************************/ -static inline int -msg_try_fetch (mring_handle mhandle, data_com_msg ** m, u32 num) -{ - if (!m || !mhandle) - { - NSFW_LOGERR ("param is not ok]m=%p,mhandle=%p", m, mhandle); - return -1; - } - - return nsfw_mem_ring_dequeuev (mhandle, (void *) m, num); -} - -#else -data_com_msg *msg_malloc (mring_handle mhandle); -void msg_free (data_com_msg * m); -int msg_post (data_com_msg * m, mring_handle mhandle); -int msg_try_post (data_com_msg * m, mring_handle mhandle); -int msg_fetch (mring_handle mhandle, data_com_msg ** m, u32 num); -int msg_try_fetch (mring_handle mhandle, data_com_msg ** m, u32 num); -int msg_post_with_lock_rel (data_com_msg * m, mring_handle mhandle); -#endif - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif diff --git a/stacks/lwip_stack/src/include/nsfw_mt_config.h b/stacks/lwip_stack/src/include/nsfw_mt_config.h deleted file mode 100644 index e1a7899..0000000 --- a/stacks/lwip_stack/src/include/nsfw_mt_config.h +++ /dev/null @@ -1,292 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef _FW_MT_CONFIG_H -#define _FW_MT_CONFIG_H - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -#define NSFW_CONFIG_MODULE "nsfw_config" -#define NSTACK_SHARE_CONFIG "nstack_share_config" - -#define CFG_PATH "NSTACK_CONFIG_PATH" -#define CFG_FILE_NAME "nStackConfig.json" -#define MAX_FILE_NAME_LEN 512 -#define CFG_BUFFER_LEN 2048 -#define MAX_CFG_ITEM 128 -#define CFG_ITEM_LENGTH 64 - -enum NSTACK_BASE_CFG -{ - CFG_BASE_SOCKET_NUM = 0, - CFG_BASE_RING_SIZE, - CFG_BASE_HAL_PORT_NUM, - CFG_BASE_ARP_STALE_TIME, - CFG_BASE_ARP_BC_RETRANS_NUM, - MAX_BASE_CFG -}; -COMPAT_PROTECT (MAX_BASE_CFG, 5); - -enum NSTACK_CUSTOM_CFG -{ - /* mBuf config */ - CFG_MBUF_DATA_SIZE, - CFG_TX_MBUF_NUM, - CFG_RX_MBUF_NUM, - - /* memory pool config */ - CFG_MP_TCPSEG_NUM, - CFG_MP_MSG_NUM, - - /* RING config */ - CFG_HAL_TX_RING_SIZE, - CFG_HAL_RX_RING_SIZE, - CFG_MBOX_RING_SIZE, - CFG_SPL_MAX_RING_SIZE, - - /* PCB config */ - CFG_TCP_PCB_NUM, - CFG_UDP_PCB_NUM, - CFG_RAW_PCB_NUM, - - CFG_ARP_QUEUE_NUM, - - MAX_CUSTOM_CFG -}; -COMPAT_PROTECT (CFG_SPL_MAX_RING_SIZE, 8); - -enum EN_CFG_SEG -{ - CFG_SEG_BASE = 0, - CFG_SEG_LOG, - CFG_SEG_PATH, - CFG_SEG_PRI, - CFG_SEG_MAX -}; - -enum EN_CFG_ITEM_TYPE -{ - CFG_ITEM_TYPE_INT = 0, - CFG_ITEM_TYPE_STRING -}; - -enum EN_SEG_BASE_ITEM -{ - CFG_SEG_BASE_SOCKET_NUM = 0, - CFG_SEG_BASE_ARP_STALE_TIME, - CFG_SEG_BASE_ARP_BC_RETRANS_NUM, - CFG_SEG_BASE_MAX -}; - -enum EN_SEG_THREAD_PRI_ITEM -{ - CFG_SEG_THREAD_PRI_POLICY = 0, - CFG_SEG_THREAD_PRI_PRI, - CFG_SEG_THREAD_PRI_MAX -}; - -typedef void (*custom_check_fn) (void *pitem); - -// pack size? -struct cfg_item_info -{ - char *name; - int type; - int min_value; - int max_value; - int default_value; - char *default_str; - custom_check_fn custom_check; - union - { - int value; - char *pvalue; - }; -}; - -typedef struct _cfg_module_param -{ - u32 proc_type; - i32 argc; - u8 **argv; -} cfg_module_param; - -extern u32 g_custom_cfg_items[MAX_CUSTOM_CFG]; -extern u32 g_base_cfg_items[MAX_BASE_CFG]; - -#define get_base_cfg(tag) g_base_cfg_items[(tag)] -#define get_custom_cfg(tag) g_custom_cfg_items[(tag)] -#define set_custom_cfg_item(tag, value) g_custom_cfg_items[(tag)] = (value) - -/* stackx config data definition */ - -/* app socket num */ -#define DEF_APP_SOCKET_NUM 1024 - -/* socket num config */ -#define SOCKET_NUM_PER_THREAD 1024 /* socket number per thread */ -COMPAT_PROTECT (SOCKET_NUM_PER_THREAD, 1024); - -/* - MAX_SOCKET_NUM: max socket fd number one app can use, it should equal the max socket - number nstack support(CUR_CFG_SOCKET_NUM) -*/ - -#define DEF_SOCKET_NUM 1024 /* default socket number */ -COMPAT_PROTECT (DEF_SOCKET_NUM, 1024); -#define MIN_SOCKET_NUM 1024 /* min socket number */ - -#define MAX_SOCKET_NUM 8192 /* default: 8K sockets */ - -#define CUR_CFG_SOCKET_NUM get_base_cfg(CFG_BASE_SOCKET_NUM) /* max socket numbere nstack support */ - -#define DEF_ARP_STACLE_TIME 300 /* default arp stale time: second */ -#define MIN_ARP_STACLE_TIME 30 /* min arp stale time: second */ -#define MAX_ARP_STACLE_TIME 1200 /* max arp stale time: second */ -#define ARP_STALE_TIME get_base_cfg(CFG_BASE_ARP_STALE_TIME) - -#define DEF_ARP_BC_RETRANS_NUM 5 /* default arp broadcast retransmission times */ -#define MIN_ARP_BC_RETRANS_NUM 1 /* min arp broadcast retransmission times */ -#define MAX_ARP_BC_RETRANS_NUM 20 /* max arp broadcast retransmission times */ -#define ARP_BC_RETRANS_NUM get_base_cfg(CFG_BASE_ARP_BC_RETRANS_NUM) - -/* application mumber config */ -#define APP_POOL_NUM 32 /* max application number */ -COMPAT_PROTECT (APP_POOL_NUM, 32); - -/* thread number config */ -#define DEF_THREAD_NUM 1 /* default stackx thread number */ -#define MIN_THREAD_NUM 1 /* min thread number */ -#define MAX_THREAD_NUM 1 /* max thread number */ -COMPAT_PROTECT (MAX_THREAD_NUM, 1); - -/* hash size */ -#define MAX_TCP_HASH_SIZE 4096 - -/* hal port number config */ -#define DEF_HAL_PORT_NUM 20 /* port number */ -COMPAT_PROTECT (DEF_HAL_PORT_NUM, 20); -#define MIN_HAL_PORT_NUM 1 -#define MAX_HAL_PORT_NUM 255 -#define CUR_CFG_HAL_PORT_NUM get_base_cfg(CFG_BASE_HAL_PORT_NUM) - -/* vm number config */ -#define MAX_VF_NUM 4 /* max vf number */ -COMPAT_PROTECT (MAX_VF_NUM, 4); - -/* base ring size config */ -#define DEF_RING_BASE_SIZE 2048 /* base ring size */ -COMPAT_PROTECT (DEF_RING_BASE_SIZE, 2048); -#define MIN_RING_BASE_SIZE 1024 -#define MAX_RING_BASE_SIZE 4096 -#define POOL_RING_BASE_SIZE get_base_cfg(CFG_BASE_RING_SIZE) - -/* mbuf data size config */ -#define DEF_MBUF_DATA_SIZE 2048 /* mbuf data size */ -COMPAT_PROTECT (DEF_MBUF_DATA_SIZE, 2048); -#define TX_MBUF_MAX_LEN get_custom_cfg(CFG_MBUF_DATA_SIZE) - -/* tx mbuf pool size config */ -#define DEF_TX_MBUF_POOL_SIZE (4*POOL_RING_BASE_SIZE) /* tx mbuf pool size */ - -#define TX_MBUF_POOL_SIZE get_custom_cfg(CFG_TX_MBUF_NUM) - -/* rx mbuf pool size config */ -#define DEF_RX_MBUF_POOL_SIZE (8*POOL_RING_BASE_SIZE) /* rx mbuf pool size */ - -#define RX_MBUF_POOL_SIZE get_custom_cfg(CFG_RX_MBUF_NUM) - -/* hal netif rx/tx ring size config */ -#define DEF_HAL_RX_RING_SIZE 2048 /* hal rx ring size */ - -#define DEF_HAL_TX_RING_SIZE 2048 /* hal tx ring size */ -#define HAL_RX_RING_SIZE get_custom_cfg(CFG_HAL_RX_RING_SIZE) -#define HAL_TX_RING_SIZE get_custom_cfg(CFG_HAL_TX_RING_SIZE) - -/* stackx recv ring size config */ -#define DEF_SPL_MAX_RING_SIZE 1024 -COMPAT_PROTECT (DEF_SPL_MAX_RING_SIZE, 1024); - -#define SPL_MAX_RING_SIZE get_custom_cfg(CFG_SPL_MAX_RING_SIZE) /* ring size config, used in recv ring(per socket) */ - -/* pcb number config */ -#define DEF_TCP_PCB_NUM 4096 /* tcp pcb number, per thread */ -COMPAT_PROTECT (DEF_TCP_PCB_NUM, 4096); -#define DEF_UDP_PCB_NUM 512 /* udp pcb number, per thread */ -COMPAT_PROTECT (DEF_UDP_PCB_NUM, 512); -#define DEF_RAW_PCB_NUM 600 /* raw pcb number, per thread */ -COMPAT_PROTECT (DEF_RAW_PCB_NUM, 600); - -#define DEF_ARP_QUEUE_NUM 300 -#define LARGE_ARP_QUEUE_NUM (512*1024) - -#define SPL_MEMP_NUM_TCP_PCB get_custom_cfg(CFG_TCP_PCB_NUM) - -#define SPL_MEMP_NUM_UDP_PCB get_custom_cfg(CFG_UDP_PCB_NUM) -#define SPL_MEMP_NUM_RAW_PCB get_custom_cfg(CFG_RAW_PCB_NUM) - -#define SPL_MEMP_NUM_ARP_QUEUE get_custom_cfg(CFG_ARP_QUEUE_NUM) - -/* tcp seg number config */ -#define DEF_MEMP_NUM_TCP_SEG (2*APP_POOL_NUM*DEF_TX_MBUF_POOL_SIZE) -#define SPL_MEMP_NUM_TCP_SEG get_custom_cfg(CFG_MP_TCPSEG_NUM) /* tcp segment number, per thread */ - -/* stackx internal msg number config */ -#define DEF_TX_MSG_POOL_SIZE (DEF_TX_MBUF_POOL_SIZE*APP_POOL_NUM + MAX_VF_NUM*DEF_RX_MBUF_POOL_SIZE + DEF_RING_BASE_SIZE) - -#define TX_MSG_POOL_SIZE get_custom_cfg(CFG_MP_MSG_NUM) /* msg number, used by stackx internal, per thread */ - -/* mbox ring size config */ -#define DEF_MBOX_RING_SIZE (DEF_RING_BASE_SIZE/4) -COMPAT_PROTECT (DEF_MBOX_RING_SIZE, 512); - -#define MBOX_RING_SIZE get_custom_cfg(CFG_MBOX_RING_SIZE) /* mbox ring size config, per thread */ - -/*some probem if CUSOTM_RECV_RING_SIZE more than 4096*/ -#define CUSOTM_RECV_RING_SIZE 4096 -COMPAT_PROTECT (CUSOTM_RECV_RING_SIZE, 4096); - -/*==============================================* - * constants or macros define * - *----------------------------------------------*/ -#define set_cfg_info(tag, item, min, max, def) { \ - g_cfg_item_info[tag][item].min_value = (min); \ - g_cfg_item_info[tag][item].max_value = (max); \ - g_cfg_item_info[tag][item].default_value = (def);\ - g_cfg_item_info[tag][item].value = (def);\ -} - -#define get_cfg_info(tag, item) g_cfg_item_info[tag][item].value - -u32 get_cfg_share_mem_size (); - -int get_share_cfg_from_mem (void *mem); - -int set_share_cfg_to_mem (void *mem); - -void config_module_init (cfg_module_param * param); - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif diff --git a/stacks/lwip_stack/src/include/nsfw_rti.h b/stacks/lwip_stack/src/include/nsfw_rti.h deleted file mode 100644 index 6b81942..0000000 --- a/stacks/lwip_stack/src/include/nsfw_rti.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef RTI_H -#define RTI_H - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -#define nsfw_rti_stat_macro(type, m) if (1 == g_dfx_switch) { nsfw_rti_stat(type, m); } - -typedef enum nsfw_rti_stat_type -{ - NSFW_STAT_PRIMARY_ENQ, - NSFW_STAT_PRIMARY_ENQ_FAIL, - NSFW_STAT_PRIMARY_DEQ, -} nsfw_rti_stat_type_t; - -typedef struct nsfw_app_info -{ - int nsocket_fd; - int sbr_fd; - - int hostpid; - int pid; - int ppid; - - u64 reserve1; - u64 reserve2; - u64 reserve3; - u64 reserve4; - - u64 extend_member_bit; -} nsfw_app_info_t; - -struct rti_queue; -struct msg_t; - -extern char g_dfx_switch; -extern struct rti_queue *g_nsfw_rti_primary_stat; - -void nsfw_rti_stat (nsfw_rti_stat_type_t statType, const struct msg_t *m); - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif |