summaryrefslogtreecommitdiffstats
path: root/src/framework
diff options
context:
space:
mode:
authorSwarup Nayak <swarupnpvt@gmail.com>2018-08-13 19:23:34 +0530
committerSwarup Nayak <swarupnpvt@gmail.com>2018-08-13 19:25:27 +0530
commit7dc65518819f2b453fd2837e92c115592d8832ec (patch)
treef9119bb3624ff11af480981c9904b84c172a607c /src/framework
parentbd6e75c243db1b384ba0882ecaf9063ec4cd70bd (diff)
Feat : LWIP integration part1
Change-Id: Ia26c092d16579c6f845a021ba66bde106363883a Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com>
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/CMakeLists.txt2
-rw-r--r--src/framework/common/base/include/common/common_func.h17
-rw-r--r--src/framework/common/base/include/common/common_mem_api.h5
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c47
-rw-r--r--src/framework/include/nsfw_mem_api.h2
-rw-r--r--src/framework/include/nsfw_mgr_com_api.h2
-rw-r--r--src/framework/include/nstack_log.h2
-rw-r--r--src/framework/ipc/mgr_com/mgr_com.c2
-rw-r--r--src/framework/ipc/mgr_com/mgr_com.h2
-rw-r--r--src/framework/ipc/ps/nsfw_soft_param.c6
-rw-r--r--src/framework/lib_common_mem/common_api.c2
-rw-r--r--src/framework/lib_common_mem/common_buf.c1
-rw-r--r--src/framework/lib_common_mem/common_func.c2
13 files changed, 30 insertions, 62 deletions
diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt
index 83e9d81..b76e1ce 100644
--- a/src/framework/CMakeLists.txt
+++ b/src/framework/CMakeLists.txt
@@ -32,7 +32,7 @@ FILE(GLOB DMM_ADPT ../adapt/*.c)
-ADD_LIBRARY(dmm_api STATIC ${COMMON} ${INIT} ${IPC} ${LOG} ${SNAPSHOT} ${STARTUP} ${MAINTAIN} ${TRACEING} ${HAL} ${DMM_ADPT} ${LIBCOMM})
+ADD_LIBRARY(dmm_api SHARED ${COMMON} ${INIT} ${IPC} ${LOG} ${SNAPSHOT} ${STARTUP} ${MAINTAIN} ${TRACEING} ${HAL} ${DMM_ADPT} ${LIBCOMM})
if(WITH_SECUREC_LIB)
ADD_DEPENDENCIES(dmm_api SECUREC JSON GLOG)
else()
diff --git a/src/framework/common/base/include/common/common_func.h b/src/framework/common/base/include/common/common_func.h
index fdf2802..2b84b7a 100644
--- a/src/framework/common/base/include/common/common_func.h
+++ b/src/framework/common/base/include/common/common_func.h
@@ -93,6 +93,23 @@
#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/src/framework/common/base/include/common/common_mem_api.h b/src/framework/common/base/include/common/common_mem_api.h
index 9eb4344..d143732 100644
--- a/src/framework/common/base/include/common/common_mem_api.h
+++ b/src/framework/common/base/include/common/common_mem_api.h
@@ -75,6 +75,7 @@ typedef s8_t err_t;
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);
@@ -90,7 +91,7 @@ get_sys_pid ()
}
pid_t updata_sys_pid ();
-long sys_now (void);
+u32_t sys_now (void);
#define sys_sem_t sys_sem_t_v2
#define sys_sem_st sys_sem_st_v2
@@ -126,9 +127,7 @@ sys_arch_lock_with_pid_v2 (sys_sem_t_v2 sem)
#define NSTACK_SEM_MALLOC(sys_sem,count) \
{ \
rte_spinlock_init(&(sys_sem)); \
- /*lint -e506*/\
if (!(count)) \
- /*lint +e506*/\
{ \
rte_spinlock_lock(&(sys_sem)); \
} \
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
index 270e0f8..2622809 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
@@ -699,53 +699,6 @@ nsfw_shmem_static (void *handle, nsfw_mem_struct_type type)
i32
nsfw_shmem_mbuf_recycle (mpool_handle handle)
{
-#if 0
- const struct common_mem_mempool *mp = (struct common_mem_mempool *) handle;
- struct common_mem_ring *rteRing = NULL;
- struct common_mem_mbuf *m_buf = NULL;
- uint32_t item;
- u32_t *recycle_flg;
- uint32_t size = mp->size;
- uint32_t threadsize = (size >> 2) * 3;
- rteRing = (struct common_mem_ring *) ADDR_SHTOL (mp->ring);
-
- if (rteRing->prod.tail - rteRing->cons.head < threadsize)
- {
- for (item = 0; item < size - 1; item++)
- {
- m_buf = (struct common_mem_mbuf *) ADDR_SHTOL (mp->elt_va_start + item * (mp->header_size + mp->elt_size + mp->trailer_size) + mp->header_size); /*lint !e647 */
- recycle_flg =
- (uint32_t *) ((char *) (ADDR_SHTOL (m_buf->buf_addr_align)) +
- RTE_PKTMBUF_HEADROOM - sizeof (uint32_t));
-
- if (m_buf->refcnt > 0 && *recycle_flg == MBUF_HLD_BY_APP)
- {
- NSCOMM_LOGINF ("free mbuf hold by app]ring=%p, mbuf=%p", handle,
- m_buf);
- *recycle_flg = MBUF_UNUSED;
- common_mem_pktmbuf_free (m_buf);
- }
- }
- }
-
- NSCOMM_LOGINF ("To recycle app_tx_pool now]ring=%p,prod.head=%u,"
- "prod.tail=%u,cons.head=%u,cons.tail=%u.", handle,
- rteRing->prod.head, rteRing->prod.tail,
- rteRing->cons.head, rteRing->cons.tail);
-
- /*we Must check and recorrect the Queue if Queue is not correct
- 1.if proc.head != proc.tail set proc.head to proc.tail [may lost some buf,but the queue still can use]
- App May not putIn Data , just done head++, we can't set proc.tail to proc.head.
- 2.if cons.head != cons.tail set cons.tail to cons.head [may lost some buf,but the queue still can use]
- App May already finish deque,just not tail++, we can't set cons.head to cons.tail.
- */
- if ((rteRing->prod.head != rteRing->prod.tail)
- || (rteRing->cons.head != rteRing->cons.tail))
- {
- rteRing->prod.head = rteRing->prod.tail;
- rteRing->cons.tail = rteRing->cons.head;
- }
-#endif
return NSFW_MEM_OK;
}
diff --git a/src/framework/include/nsfw_mem_api.h b/src/framework/include/nsfw_mem_api.h
index 68adbe1..db7f5e7 100644
--- a/src/framework/include/nsfw_mem_api.h
+++ b/src/framework/include/nsfw_mem_api.h
@@ -83,7 +83,7 @@ typedef struct
* must add '_0' at the end of name, if the memory was created by app and the role of process is NSFW_PROC_MASTER, must add
* _(pid) at the end of name, nstack_123.
*/
- i8 aname[NSFW_MEM_NAME_LENGTH]; /*the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */
+ i8 aname[NSFW_MEM_NAME_LENGTH]; /*the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */
} nsfw_mem_name;
typedef struct
diff --git a/src/framework/include/nsfw_mgr_com_api.h b/src/framework/include/nsfw_mgr_com_api.h
index 45102bb..094043e 100644
--- a/src/framework/include/nsfw_mgr_com_api.h
+++ b/src/framework/include/nsfw_mgr_com_api.h
@@ -107,7 +107,7 @@ typedef enum _fw_poc_type
NSFW_PROC_MAX = 16
} fw_poc_type;
-#define NSFW_DOMAIN_DIR "/var/log/nStack/"
+#define NSFW_DOMAIN_DIR "/var/run"
#define NSTACK_MAX_PROC_NAME_LEN 20
typedef enum _nsfw_mgr_msg_rsp_code
diff --git a/src/framework/include/nstack_log.h b/src/framework/include/nstack_log.h
index ec5dac6..4e1ba81 100644
--- a/src/framework/include/nstack_log.h
+++ b/src/framework/include/nstack_log.h
@@ -41,7 +41,7 @@
#define NSTACK_GETVER_MODULE "nStack"
#ifndef NSTACK_GETVER_VERSION
- #error "need define version first"
+#error "need define version first"
#endif
#define NSTACK_GETVER_BUILDTIME "[" __DATE__ "]" "[" __TIME__ "]"
diff --git a/src/framework/ipc/mgr_com/mgr_com.c b/src/framework/ipc/mgr_com/mgr_com.c
index 25d8bff..2b35e2c 100644
--- a/src/framework/ipc/mgr_com/mgr_com.c
+++ b/src/framework/ipc/mgr_com/mgr_com.c
@@ -1859,8 +1859,6 @@ nsfw_mgr_com_module_init (void *param)
return -1;
}
- //TODO: check the path exist or not
-
NSFW_LOGINF ("module mgr init]NSFW_PROC_MAIN domain_path=%s",
mgr_cfg->domain_path);
diff --git a/src/framework/ipc/mgr_com/mgr_com.h b/src/framework/ipc/mgr_com/mgr_com.h
index a5cdfcf..02e46c1 100644
--- a/src/framework/ipc/mgr_com/mgr_com.h
+++ b/src/framework/ipc/mgr_com/mgr_com.h
@@ -29,7 +29,7 @@
#include "pthread.h"
#include "nsfw_mem_api.h"
#include "common_mem_api.h"
-
+#include "common_mem_memzone.h"
#include "common_func.h"
#ifdef __cplusplus
diff --git a/src/framework/ipc/ps/nsfw_soft_param.c b/src/framework/ipc/ps/nsfw_soft_param.c
index d458040..91d7598 100644
--- a/src/framework/ipc/ps/nsfw_soft_param.c
+++ b/src/framework/ipc/ps/nsfw_soft_param.c
@@ -97,13 +97,15 @@ nsfw_soft_set_int (u32 param, char *buf, u32 buf_len)
nsfw_set_soft_item *int_item = &g_soft_int_cfg[param];
if (NULL == int_item->data)
{
- NSFW_LOGERR ("data err]buf=%s,param=%u,min=%llu,max=%llu", buf, param, int_item->min, int_item->max); //[DTS2017112402499][2017-11-24][z00316269] Issue #40, fix type dismatch
+ NSFW_LOGERR ("data err]buf=%s,param=%u,min=%llu,max=%llu", buf, param,
+ int_item->min, int_item->max);
return FALSE;
}
if (buf_value < int_item->min || buf_value > int_item->max)
{
- NSFW_LOGERR ("argv err]buf=%s,param=%u,min=%llu,max=%llu", buf, param, int_item->min, int_item->max); //[DTS2017112402499][2017-11-24][z00316269] Issue #40, fix type dismatch
+ NSFW_LOGERR ("argv err]buf=%s,param=%u,min=%llu,max=%llu", buf, param,
+ int_item->min, int_item->max);
return FALSE;
}
diff --git a/src/framework/lib_common_mem/common_api.c b/src/framework/lib_common_mem/common_api.c
index b535ee6..566b8be 100644
--- a/src/framework/lib_common_mem/common_api.c
+++ b/src/framework/lib_common_mem/common_api.c
@@ -29,7 +29,7 @@ sys_sem_init_v2 (sys_sem_t_v2 sem)
/** Returns the current time in milliseconds,
* may be the same as sys_jiffies or at least based on it. */
-long
+u32_t
sys_now (void)
{
struct timespec now;
diff --git a/src/framework/lib_common_mem/common_buf.c b/src/framework/lib_common_mem/common_buf.c
index 654bd46..877becf 100644
--- a/src/framework/lib_common_mem/common_buf.c
+++ b/src/framework/lib_common_mem/common_buf.c
@@ -123,7 +123,6 @@ nscomm_pal_module_init (common_mem_pal_module_info * pinfo)
{
PARA1_SET (argv, tempargv, agindex, "nStackMain");
- /*[DTS2017032711606 ][2017-04-08][z00353090] There are some unsafe function ,need to be replace with safe function */
retVal = SPRINTF_S (tempbuf, PATA_STRLENT, "0x");
if (-1 == retVal)
{
diff --git a/src/framework/lib_common_mem/common_func.c b/src/framework/lib_common_mem/common_func.c
index 0cf5b90..5220374 100644
--- a/src/framework/lib_common_mem/common_func.c
+++ b/src/framework/lib_common_mem/common_func.c
@@ -137,7 +137,7 @@ dmm_pktmbuf_pool_iterator (struct common_mem_mempool * mp, uint32_t start,
}
int32_t elm_size = mp->elt_size + mp->header_size + mp->trailer_size;
- struct common_mem_mbuf *elm_mbuf = (struct common_mem_mbuf *) (STAILQ_FIRST(&mp->mem_list)->addr + start * elm_size + mp->header_size); /*lint !e647 */
+ struct common_mem_mbuf *elm_mbuf = (struct common_mem_mbuf *) (STAILQ_FIRST (&mp->mem_list)->addr + start * elm_size + mp->header_size); /*lint !e647 */
uint32_t i;
uint32_t mbuf_end = COMMON_MEM_MIN (end, mp->size) - start;