summaryrefslogtreecommitdiffstats
path: root/src/framework
diff options
context:
space:
mode:
authorwangyalei <wylandrea@gmail.com>2018-07-24 02:37:52 +0800
committerYalei Wang <william.wangyalei@huawei.com>2018-08-14 16:48:34 +0800
commit1c5d7496f4c7f5d0358d8b57781fd471882b1ece (patch)
tree695a843e8d885746be1416955a4f4e82b90cc91a /src/framework
parentc080b73a936e0fcdb2d90b32a38135edde2d8fa7 (diff)
Feat: Add a new type 4 for simple stack integration
When simple stack integration(type=4), only alloc necessary memory(32M), and add prefix to differentiate the apps in primary mode. Change-Id: Ide8b3a276e999827b7ad3321cbd62cff127c2d44 Signed-off-by: Yalei Wang <william.wangyalei@huawei.com>
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/common/base/include/common/common_mem_buf.h3
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c5
-rw-r--r--src/framework/lib_common_mem/common_buf.c21
3 files changed, 24 insertions, 5 deletions
diff --git a/src/framework/common/base/include/common/common_mem_buf.h b/src/framework/common/base/include/common/common_mem_buf.h
index 441da6a..f9f1593 100644
--- a/src/framework/common/base/include/common/common_mem_buf.h
+++ b/src/framework/common/base/include/common/common_mem_buf.h
@@ -21,6 +21,7 @@
#else
#include "common_mem_base_type.h"
+#include "types.h"
typedef enum __DMM_PROC_TYPE
{
@@ -63,7 +64,7 @@ typedef struct __common_pal_module_info
* @param name
* The name of the buf pool.
*/
-int nscomm_pal_module_init (common_mem_pal_module_info * pinfo);
+int nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode);
void *nscomm_memzone_data_reserve_name (const char *name, size_t len,
int socket_id);
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 2622809..abd6ce0 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
@@ -37,6 +37,7 @@
#define NSFW_SHMEM_PID (get_sys_pid())
#define NSFW_SHMEM_FLAG (g_shmem_localdata->enflag)
+extern u8 app_mode;
nsfw_mem_localdata *g_shmem_localdata = NULL;
/*check g_mem_localdata*/
@@ -75,13 +76,13 @@ nsfw_shmem_init (nsfw_mem_para * para)
}
else if (NSFW_PROC_MAIN == para->enflag)
{
- iret = common_pal_module_init (NULL);
+ iret = common_pal_module_init (NULL, app_mode);
}
else
{
LCORE_MASK_SET (rteinfo.ilcoremask, 1);
rteinfo.ucproctype = DMM_PROC_T_SECONDARY;
- iret = common_pal_module_init (&rteinfo);
+ iret = common_pal_module_init (&rteinfo, app_mode);
}
if (NSFW_MEM_OK != iret)
diff --git a/src/framework/lib_common_mem/common_buf.c b/src/framework/lib_common_mem/common_buf.c
index 877becf..897445a 100644
--- a/src/framework/lib_common_mem/common_buf.c
+++ b/src/framework/lib_common_mem/common_buf.c
@@ -88,7 +88,7 @@
int log_level = LOG_INFO;
int
-nscomm_pal_module_init (common_mem_pal_module_info * pinfo)
+nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode)
{
char tempargv[PATA_NUM_MAX][PATA_STRLENT];
char *argv[PATA_NUM_MAX];
@@ -98,6 +98,8 @@ nscomm_pal_module_init (common_mem_pal_module_info * pinfo)
int agindex = 0;
int intmask = 0;
int retVal;
+ char name[10] = { '\0' };
+
retVal = MEMSET_S (tempargv, sizeof (tempargv), '\0', sizeof (tempargv));
if (EOK != retVal)
{
@@ -115,9 +117,24 @@ nscomm_pal_module_init (common_mem_pal_module_info * pinfo)
PARA1_SET (argv, tempargv, agindex, "nStackMain");
PARA2_SET (argv, tempargv, agindex, "-c", "0x1");
PARA2_SET (argv, tempargv, agindex, "-n", "4");
- PARA2_SET (argv, tempargv, agindex, "-m", "2048");
PARA1_SET (argv, tempargv, agindex, "--huge-dir=/mnt/nstackhuge");
PARA1_SET (argv, tempargv, agindex, "--proc-type=primary");
+
+ if (app_mode == 1)
+ {
+ sprintf (name, "dmm_app_%ld", (long) getpid ());
+ PARA2_SET (argv, tempargv, agindex, "--file-prefix", name);
+ // TODO: the size of the memory should not be fixed
+ PARA2_SET (argv, tempargv, agindex, "-m", "32");
+ }
+ else
+ {
+ // TODO: replay the name 'nStackMain'
+ /* snprintf(name, 10, "dmm_main_%ld", (long) getpid()); */
+ PARA2_SET (argv, tempargv, agindex, "--file-prefix", "nStackMain");
+ PARA2_SET (argv, tempargv, agindex, "-m", "2048");
+ }
+
}
else
{