aboutsummaryrefslogtreecommitdiffstats
path: root/stacks/lwip_stack/src/include/common
diff options
context:
space:
mode:
Diffstat (limited to 'stacks/lwip_stack/src/include/common')
-rw-r--r--stacks/lwip_stack/src/include/common/common_func.h115
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_api.h122
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_base_type.h85
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_buf.h76
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_common.h25
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_malloc.h25
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_mbuf.h40
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_mempool.h25
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_memzone.h25
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_pal.h30
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_pal_memconfig.h26
-rw-r--r--stacks/lwip_stack/src/include/common/common_mem_spinlock.h40
-rw-r--r--stacks/lwip_stack/src/include/common/common_sys_config.h46
-rw-r--r--stacks/lwip_stack/src/include/common/generic/common_mem_rwlock.h25
14 files changed, 705 insertions, 0 deletions
diff --git a/stacks/lwip_stack/src/include/common/common_func.h b/stacks/lwip_stack/src/include/common/common_func.h
new file mode 100644
index 0000000..2b84b7a
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_func.h
@@ -0,0 +1,115 @@
+/*
+*
+* 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 _RTE_COMM_FUNC_H_
+#define _RTE_COMM_FUNC_H_
+
+#ifdef HAL_LIB
+
+#else
+
+#define common_mem_rwlock_t rte_rwlock_t
+#define common_mem_spinlock_t rte_spinlock_t
+ //typedef rte_rwlock_t common_mem_rwlock_t;
+
+#define nsfw_write_lock(plock) rte_rwlock_write_lock(plock)
+#define nsfw_write_unlock(plock) rte_rwlock_write_unlock(plock)
+#define nsfw_read_lock(plock) rte_rwlock_read_lock(plock)
+#define nsfw_read_unlock(plock) rte_rwlock_read_unlock(plock)
+
+#define common_mem_align32pow2 rte_align32pow2
+
+#define common_mem_atomic32_cmpset rte_atomic32_cmpset
+#define common_mem_pause rte_pause
+
+#define COMMON_MEM_MAX_MEMZONE RTE_MAX_MEMZONE
+
+#define common_mem_atomic32_t rte_atomic32_t
+
+#define common_mem_memseg rte_memseg
+#define common_mem_mem_config rte_mem_config
+
+#define common_mem_pal_get_configuration rte_eal_get_configuration
+
+ //#define commem_mem_pal_module_info rte_eal_module_info
+ //
+#define common_mem_pal_init rte_eal_init
+
+#define COMMON_MEM_MEMPOOL_NAMESIZE RTE_MEMPOOL_NAMESIZE
+
+#define common_mem_memzone_lookup rte_memzone_lookup
+#define common_mem_memzone rte_memzone
+#define common_mem_atomic32_add_return rte_atomic32_add_return
+
+#define common_mem_spinlock_init rte_spinlock_init
+#define common_mem_spinlock_lock rte_spinlock_lock
+#define common_mem_spinlock_unlock rte_spinlock_unlock
+
+#define common_mem_memzone_free rte_memzone_free
+#define common_mem_pktmbuf_pool_create rte_pktmbuf_pool_create
+
+#define common_mem_pktmbuf_alloc rte_pktmbuf_alloc
+
+#define common_mem_mempool rte_mempool
+
+#define common_mem_pktmbuf_free rte_pktmbuf_free
+#define common_mem_mbuf rte_mbuf
+
+#define common_mem_mempool_lookup rte_mempool_lookup
+
+#define common_mem_ring_get_memsize rte_ring_get_memsize
+#define common_mem_ring rte_ring
+
+#define COMMON_MEM_MAX_MEMSEG RTE_MAX_MEMSEG
+
+#define common_mem_memzone_reserve rte_memzone_reserve
+#define common_mem_rwlock_read_lock rte_rwlock_read_lock
+#define common_mem_rwlock_read_unlock rte_rwlock_read_unlock
+
+#define common_mem_rwlock_write_lock rte_rwlock_write_lock
+#define common_mem_rwlock_write_unlock rte_rwlock_write_unlock
+#define common_mem_spinlock_trylock rte_spinlock_trylock
+
+#define common_mem_socket_id rte_socket_id
+#define common_mem_malloc_socket_stats rte_malloc_socket_stats
+
+#define COMMON_MEM_MIN RTE_MIN
+
+#define common_pal_module_init nscomm_pal_module_init
+#define common_memzone_data_reserve_name nscomm_memzone_data_reserve_name
+#define common_memzone_data_lookup_name nscomm_memzone_data_lookup_name
+
+#define common_dump_stack rte_dump_stack
+#define COMMON_PKTMBUF_HEADROOM RTE_PKTMBUF_HEADROOM
+
+#define common_pktmbuf_mtod rte_pktmbuf_mtod
+#define common_memcpy rte_memcpy
+#define common_spinlock_try_lock_with_pid dmm_spinlock_try_lock_with_pid
+#define common_spinlock_unlock rte_spinlock_unlock
+#define common_atomic64_t rte_atomic64_t
+#define common_atomic64_inc rte_atomic64_inc
+#define common_atomic64_read rte_atomic64_read
+#define common_atomic64_dec rte_atomic64_dec
+#define common_mbuf_refcnt_set rte_mbuf_refcnt_set
+#define common_mbuf_refcnt_read rte_mbuf_refcnt_read
+#define common_exit rte_exit
+#define COMMON_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE
+#define common_eal_process_type rte_eal_process_type
+#define COMMON_PROC_PRIMARY RTE_PROC_PRIMARY
+
+#endif
+
+#endif // _RTE_COMM_FUNC_H_
diff --git a/stacks/lwip_stack/src/include/common/common_mem_api.h b/stacks/lwip_stack/src/include/common/common_mem_api.h
new file mode 100644
index 0000000..a51e900
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_api.h
@@ -0,0 +1,122 @@
+/*
+*
+* 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 __COMMON_MEM_API_H__
+#define __COMMON_MEM_API_H__
+
+#ifdef HAL_LIB
+#else
+
+#include "rte_atomic.h"
+#include "common_mem_spinlock.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <semaphore.h>
+
+#include "dmm_sys.h"
+
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+#ifndef NSTACK_LINT_CODE_DISABLE
+#define NSTACK_LINT_CODE_DISABLE(code) /*lint -e#code */
+#endif
+
+#ifndef NSTACK_LINT_CODE_ENABLE
+#define NSTACK_LINT_CODE_ENABLE(code) /*lint +e#code */
+#endif
+
+#define SYS_MBOX_NULL (sys_mbox_t)0
+
+typedef sem_t *sys_sem_t_v1;
+typedef sem_t sys_sem_st_v1;
+typedef struct queue *sys_mbox_t;
+
+typedef rte_spinlock_t *sys_sem_t_v2;
+typedef rte_spinlock_t sys_sem_st_v2;
+
+#ifndef u32_t
+typedef uint32_t u32_t;
+#endif
+
+#ifndef u8_t
+typedef uint8_t u8_t;
+#endif
+
+#ifndef s8_t
+typedef int8_t s8_t;
+#endif
+
+#ifndef err_t
+typedef s8_t err_t;
+#endif
+
+/** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
+#define SYS_ARCH_TIMEOUT 0xffffffffUL
+
+/** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate.
+ * For now we use the same magic value, but we allow this to change in future.
+ */
+#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
+
+void sys_sem_signal_s_v2 (sys_sem_t_v2 sem);
+void sys_sem_init_v2 (sys_sem_t_v2 sem);
+u32_t sys_arch_sem_trywait_v2 (sys_sem_t_v2 * sem);
+
+u32_t sys_arch_sem_wait_s_v2 (sys_sem_t_v2 sem);
+
+u32_t sys_now (void);
+
+#define sys_sem_t sys_sem_t_v2
+#define sys_sem_st sys_sem_st_v2
+#define sys_sem_new(sem, count) sys_sem_new_v2(sem, count)
+#define sys_sem_free(sem) sys_sem_free_v2(sem)
+#define sys_sem_signal(sem) sys_sem_signal_v2(sem)
+#define sys_arch_sem_wait(sem, timeout) sys_arch_sem_wait_v2(sem)
+#define sys_arch_sem_trywait(sem) sys_arch_sem_trywait_v2(sem)
+
+#define sys_sem_init(sem) sys_sem_init_v2(sem)
+#define sys_sem_s_signal(sem) sys_sem_signal_s_v2(sem)
+#define sys_arch_sem_s_wait(sem, timeout) sys_arch_sem_wait_s_v2(sem)
+#define sys_arch_lock_with_pid(sem) (void)sys_arch_lock_with_pid_v2(sem)
+
+static inline u32_t
+sys_arch_lock_with_pid_v2 (sys_sem_t_v2 sem)
+{
+ dmm_spinlock_lock_with_pid (sem, get_sys_pid ());
+ return 0;
+}
+
+#define NSTACK_SEM_MALLOC(sys_sem,count) \
+{ \
+ rte_spinlock_init(&(sys_sem)); \
+ if (!(count)) \
+ { \
+ rte_spinlock_lock(&(sys_sem)); \
+ } \
+}
+
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#endif
+
+#endif /* __COMMON_MEM_API_H__ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_base_type.h b/stacks/lwip_stack/src/include/common/common_mem_base_type.h
new file mode 100644
index 0000000..01707d9
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_base_type.h
@@ -0,0 +1,85 @@
+/*
+*
+* 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 _COMMON_MEM_BASE_TYPE_H_
+#define _COMMON_MEM_BASE_TYPE_H_
+
+#ifdef HAL_LIB
+
+#else
+
+#define ALIGN_TYPE uint64_t
+#define PTR_ALIGN_TYPE uint64_t
+
+/*alignment define*/
+#define ALIGNMENT_DEF(name, type, aligntype) \
+ union { \
+ type name; \
+ aligntype name##_align; \
+ }
+
+#define PTR_ALIGNMENT_DEF(name, type) ALIGNMENT_DEF(name, type, PTR_ALIGN_TYPE)
+
+#define OTHER_ALIGNMENT_DEF(name, type) ALIGNMENT_DEF(name, type, ALIGN_TYPE)
+
+/*
+ * * List definitions.
+ * */
+#define DMM_LIST_HEAD(name, type) \
+struct name { \
+ PTR_ALIGNMENT_DEF(lh_first, struct type *); /* first element */ \
+}
+
+#define DMM_LIST_ENTRY(type) \
+struct { \
+ PTR_ALIGNMENT_DEF(le_next, struct type *); /* next element */\
+ PTR_ALIGNMENT_DEF(le_prev, struct type **); /* address of previous next element */ \
+}
+
+/*
+ * * Tail queue definitions.
+ * */
+#define _DMM_TAILQ_HEAD(name, type, qual) \
+struct name { \
+ PTR_ALIGNMENT_DEF(tqh_first, qual type *); /* first element */ \
+ PTR_ALIGNMENT_DEF(tqh_last, qual type * qual *); /* addr of last next element */ \
+}
+
+#define DMM_TAILQ_HEAD(name, type) _DMM_TAILQ_HEAD(name, struct type,)
+
+#define _DMM_TAILQ_ENTRY(type, qual) \
+struct { \
+ PTR_ALIGNMENT_DEF(tqe_next, qual type *); /* next element */\
+ PTR_ALIGNMENT_DEF(tqe_prev, qual type * qual*); /* address of previous next element */\
+}
+#define DMM_TAILQ_ENTRY(type) _DMM_TAILQ_ENTRY(struct type,)
+
+/*
+ * * Singly-linked Tail queue declarations.
+ * */
+#define DMM_STAILQ_HEAD(name, type) \
+ struct name { \
+ PTR_ALIGNMENT_DEF(stqh_first, struct type *); /* first element */ \
+ PTR_ALIGNMENT_DEF(stqh_last, struct type **); /* addr of last next element */ \
+ }
+
+#define DMM_STAILQ_ENTRY(type) \
+ struct { \
+ PTR_ALIGNMENT_DEF(stqe_next, struct type *); /* next element */ \
+ }
+#endif
+
+#endif
diff --git a/stacks/lwip_stack/src/include/common/common_mem_buf.h b/stacks/lwip_stack/src/include/common/common_mem_buf.h
new file mode 100644
index 0000000..834f386
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_buf.h
@@ -0,0 +1,76 @@
+/*
+*
+* 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 _COMMON_MEM_BUF_H_
+#define _COMMON_MEM_BUF_H_
+
+#ifdef HAL_LIB
+#else
+
+#include "common_mem_base_type.h"
+#include "types.h"
+
+typedef enum __DMM_PROC_TYPE
+{
+ DMM_PROC_T_AUTO = 0, /*auto detect */
+ DMM_PROC_T_PRIMARY = 1, /* set to primary */
+ DMM_PROC_T_SECONDARY = 2, /* set to secondary */
+ DMM_PROC_T_INVALID
+} DMM_PROC_TYPE;
+
+#define DMM_MBUF_RET_OK 0
+#define DMM_MBUF_RET_ERR 1
+
+#define LCORE_MAX 128
+#define LCORE_MASK_PER (sizeof(int) * 8)
+#define LCORE_MASK_MAX (LCORE_MAX/LCORE_MASK_PER)
+
+#define LCORE_MASK_SET(ilcoremask, value) \
+ if (value < LCORE_MAX) \
+ { \
+ ilcoremask[(value/LCORE_MASK_PER)] = (int) ( (ilcoremask[(value/LCORE_MASK_PER)]) | (1< (value%LCORE_MASK_PER))); \
+ } \
+
+#define DMM_HUGTBL_ENABLE 0
+#define DMM_HUGTBL_DISABLE 1
+
+typedef struct __common_pal_module_info
+{
+ int ishare_mem_size; /*shared memory size */
+ int ilcoremask[LCORE_MASK_MAX];
+ /**/ unsigned char uchugeflag;
+ unsigned char ucproctype;
+ unsigned char ucinstance;
+ unsigned char ucresrv2;
+} common_mem_pal_module_info;
+
+/**
+ * rte pal module init.
+ *
+ *
+ * @param name
+ * The name of the buf pool.
+ */
+int nscomm_pal_module_init (common_mem_pal_module_info * pinfo);
+
+void *nscomm_memzone_data_reserve_name (const char *name, size_t len,
+ int socket_id);
+
+void *nscomm_memzone_data_lookup_name (const char *name);
+
+#endif
+
+#endif /* _COMMON_MEM_BUF_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_common.h b/stacks/lwip_stack/src/include/common/common_mem_common.h
new file mode 100644
index 0000000..1e4cf56
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_common.h
@@ -0,0 +1,25 @@
+/*
+*
+* 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 _COMMON_MEM_COMMON_H_
+#define _COMMON_MEM_COMMON_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_common.h"
+#endif
+
+#endif
diff --git a/stacks/lwip_stack/src/include/common/common_mem_malloc.h b/stacks/lwip_stack/src/include/common/common_mem_malloc.h
new file mode 100644
index 0000000..68721cd
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_malloc.h
@@ -0,0 +1,25 @@
+/*
+*
+* 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 _COMMON_MEM_MALLOC_H_
+#define _COMMON_MEM_MALLOC_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_malloc.h"
+#endif
+
+#endif /* _COMMON_MEM_MALLOC_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_mbuf.h b/stacks/lwip_stack/src/include/common/common_mem_mbuf.h
new file mode 100644
index 0000000..0bb7696
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_mbuf.h
@@ -0,0 +1,40 @@
+/*
+*
+* 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.
+*/
+
+/*******************************************************************
+ Copyright 2017 - 2047, Huawei Tech. Co., Ltd.
+ ALL RIGHTS RESERVED
+
+Filename : common_mem_mbuf.h
+Description :
+Version : 1.1
+********************************************************************/
+
+#ifndef _COMMON_MEM_MBUF_H_
+#define _COMMON_MEM_MBUF_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_mbuf.h"
+#include "common_func.h"
+
+typedef uint32_t (*dmm_mbuf_item_fun) (void *data, void *argv);
+int32_t dmm_pktmbuf_pool_iterator (struct common_mem_mempool *mp,
+ uint32_t start, uint32_t end,
+ dmm_mbuf_item_fun fun, void *argv);
+#endif
+
+#endif /* _COMMON_MEM_MBUF_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_mempool.h b/stacks/lwip_stack/src/include/common/common_mem_mempool.h
new file mode 100644
index 0000000..58a8e82
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_mempool.h
@@ -0,0 +1,25 @@
+/*
+*
+* 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 _COMMON_MEM_MEMPOOL_H_
+#define _COMMON_MEM_MEMPOOL_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_mempool.h"
+#endif
+
+#endif /* _COMMON_MEM_MEMPOOL_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_memzone.h b/stacks/lwip_stack/src/include/common/common_mem_memzone.h
new file mode 100644
index 0000000..20e18c2
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_memzone.h
@@ -0,0 +1,25 @@
+/*
+*
+* 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 _COMMON_MEM_MEMZONE_H_
+#define _COMMON_MEM_MEMZONE_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_memzone.h"
+#endif
+
+#endif /* _COMMON_MEM_MEMZONE_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_pal.h b/stacks/lwip_stack/src/include/common/common_mem_pal.h
new file mode 100644
index 0000000..209b8bd
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_pal.h
@@ -0,0 +1,30 @@
+/*
+*
+* 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 _COMMON_MEM_PAL_H_
+#define _COMMON_MEM_PAL_H_
+
+#ifdef HAL_LIB
+#else
+
+#include "nsfw_base_linux_api.h"
+
+/*print the map address*/
+void dmm_addr_print (void);
+
+#endif
+
+#endif /* _COMMON_MEM_PAL_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_mem_pal_memconfig.h b/stacks/lwip_stack/src/include/common/common_mem_pal_memconfig.h
new file mode 100644
index 0000000..65b6e04
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_pal_memconfig.h
@@ -0,0 +1,26 @@
+/*
+*
+* 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 _COMMON_MEM_PAL_MEMCONFIG_H_
+#define _COMMON_MEM_PAL_MEMCONFIG_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_eal_memconfig.h"
+
+#endif
+
+#endif
diff --git a/stacks/lwip_stack/src/include/common/common_mem_spinlock.h b/stacks/lwip_stack/src/include/common/common_mem_spinlock.h
new file mode 100644
index 0000000..23f6b1e
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_mem_spinlock.h
@@ -0,0 +1,40 @@
+/*
+*
+* 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 _COMMON_MEM_SPINLOCK_X86_64_H_
+#define _COMMON_MEM_SPINLOCK_X86_64_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_spinlock.h"
+
+static inline void
+dmm_spinlock_lock_with_pid (rte_spinlock_t * sl, int pid)
+{
+ while (!__sync_bool_compare_and_swap (&sl->locked, 0, pid))
+ while (sl->locked)
+ rte_pause ();
+}
+
+static inline int
+dmm_spinlock_try_lock_with_pid (rte_spinlock_t * sl, int pid)
+{
+ return __sync_bool_compare_and_swap (&sl->locked, 0, pid);
+}
+
+#endif
+
+#endif /* _COMMON_MEM_SPINLOCK_X86_64_H_ */
diff --git a/stacks/lwip_stack/src/include/common/common_sys_config.h b/stacks/lwip_stack/src/include/common/common_sys_config.h
new file mode 100644
index 0000000..736c47b
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/common_sys_config.h
@@ -0,0 +1,46 @@
+/*
+*
+* 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 __COMMON_SYS_CONFIG_H_
+#define __COMMON_SYS_CONFIG_H_
+
+/* Below compile macro is used only in UT makefile */
+#if (HAL_LIB)
+#else
+#undef RTE_CACHE_LINE_SIZE
+#define RTE_CACHE_LINE_SIZE 64 /* RTE_CACHE_LINE_SIZE */
+#undef RTE_MAX_LCORE
+#define RTE_MAX_LCORE 128 /* RTE_MAX_LCORE */
+#undef RTE_MAX_NUMA_NODES
+#define RTE_MAX_NUMA_NODES 8 /* RTE_MAX_NUMA_NODES */
+#undef RTE_MAX_MEMSEG
+#define RTE_MAX_MEMSEG 256 /* RTE_MAX_MEMSEG */
+#undef RTE_MAX_MEMZONE
+#define RTE_MAX_MEMZONE 2560 /* RTE_MAX_MEMZONE */
+#undef RTE_MAX_TAILQ
+#define RTE_MAX_TAILQ 32 /* RTE_MAX_TAILQ */
+#undef RTE_ARCH_X86
+#define RTE_ARCH_X86 1 /* RTE_ARCH_64 */
+#undef RTE_ARCH_64
+#define RTE_ARCH_64 1 /* RTE_ARCH_64 */
+#undef RTE_PKTMBUF_HEADROOM
+#define RTE_PKTMBUF_HEADROOM 128 /* RTE_PKTMBUF_HEADROOM */
+#undef RTE_MEMPOOL_CACHE_MAX_SIZE
+#define RTE_MEMPOOL_CACHE_MAX_SIZE 512 /* RTE_MEMPOOL_CACHE_MAX_SIZE */
+
+#endif
+
+#endif // __COMMON_SYS_CONFIG_H_
diff --git a/stacks/lwip_stack/src/include/common/generic/common_mem_rwlock.h b/stacks/lwip_stack/src/include/common/generic/common_mem_rwlock.h
new file mode 100644
index 0000000..2eed259
--- /dev/null
+++ b/stacks/lwip_stack/src/include/common/generic/common_mem_rwlock.h
@@ -0,0 +1,25 @@
+/*
+*
+* 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 _COMMON_MEM_RWLOCK_H_
+#define _COMMON_MEM_RWLOCK_H_
+
+#ifdef HAL_LIB
+#else
+#include "rte_rwlock.h"
+#endif
+
+#endif /* _COMMON_MEM_RWLOCK_H_ */