aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryalei wang <wylandrea@gmail.com>2018-09-20 02:08:56 +0000
committerGerrit Code Review <gerrit@fd.io>2018-09-20 02:08:56 +0000
commit9f145958f0a168661b0dd4d376366d8428946ed3 (patch)
tree86bde0735773386781f12f6f75cbf637f3872acf
parentea51d29ba72637b088d0e8cc781364968726e0ae (diff)
parentc40c114f2cc079fa363f53ce5927491503f03f6c (diff)
Merge "Feat: Resource recycle + nStackMaster Code removal"
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c24
-rw-r--r--src/framework/ipc/mgr_com/mgr_com.c23
-rw-r--r--src/framework/ipc/ps/nsfw_fd_timer.c1
-rw-r--r--src/framework/ipc/ps/nsfw_ps_module.c40
-rw-r--r--src/framework/ipc/ps/nsfw_recycle_module.c3
-rw-r--r--src/framework/ipc/ps/nsfw_soft_param.c1
-rw-r--r--src/framework/log/nsfw_set_log.c1
-rw-r--r--src/nSocket/nstack/nstack.c2
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c6
-rw-r--r--stacks/lwip_stack/src/alarm/alarm.c4
-rw-r--r--stacks/lwip_stack/src/maintain/fw_mt_config.c38
11 files changed, 10 insertions, 133 deletions
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 08ad4cd..ba38c32 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
@@ -73,11 +73,7 @@ nsfw_shmem_init (nsfw_mem_para * para)
NSCOMM_LOGINF ("nsfw shmem init begin");
- if (NSFW_PROC_MASTER == para->enflag)
- {
- iret = common_mem_pal_init (para->iargsnum, para->pargs);
- }
- else if (NSFW_PROC_MAIN == para->enflag)
+ if (NSFW_PROC_MAIN == para->enflag)
{
iret = common_pal_module_init (NULL, app_mode);
}
@@ -189,11 +185,7 @@ nsfw_shmem_createv (nsfw_mem_zone * pmeminfo, i32 inum,
{
NSFW_INIT_CHK_RET ();
- if (NSFW_PROC_MASTER == NSFW_SHMEM_FLAG)
- {
- return NSFW_MEM_ERR;
- }
- else if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
+ if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
{
return nsfw_memzone_remote_reserv_v (pmeminfo, paddr_array, iarray_num,
0);
@@ -321,11 +313,7 @@ nsfw_shmem_mbfmpcreatev (nsfw_mem_mbfpool * pmbfname, i32 inum,
{
NSFW_INIT_CHK_RET ();
- if (NSFW_PROC_MASTER == NSFW_SHMEM_FLAG)
- {
- return NSFW_MEM_ERR;
- }
- else if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
+ if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
{
return nsfw_remote_shmem_mbf_createv (pmbfname, phandle_array,
iarray_num, 0);
@@ -431,11 +419,7 @@ nsfw_shmem_spcreatev (nsfw_mem_sppool * pmpinfo, i32 inum,
{
NSFW_INIT_CHK_RET ();
- if (NSFW_PROC_MASTER == NSFW_SHMEM_FLAG)
- {
- return NSFW_MEM_ERR;
- }
- else if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
+ if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
{
return nsfw_remote_shmem_mpcreatev (pmpinfo, pringhandle_array, inum,
0);
diff --git a/src/framework/ipc/mgr_com/mgr_com.c b/src/framework/ipc/mgr_com/mgr_com.c
index bc2aca2..2fb9789 100644
--- a/src/framework/ipc/mgr_com/mgr_com.c
+++ b/src/framework/ipc/mgr_com/mgr_com.c
@@ -423,9 +423,6 @@ nsfw_mgr_get_connect_socket (u8 proc_type, u32 host_pid)
case NSFW_PROC_MAIN:
name = NSFW_MAIN_FILE;
break;
- case NSFW_PROC_MASTER:
- name = NSFW_MASTER_FILE;
- break;
case NSFW_PROC_ALARM:
directory = "/tmp";
name = NSFW_ALARM_FILE;
@@ -1930,27 +1927,7 @@ nsfw_mgr_com_module_init (void *param)
}
break;
- case NSFW_PROC_MASTER:
- /* modify destMax, remove "-1" */
- if (EOK !=
- STRCPY_S (mgr_cfg->domain_path, NSFW_MGRCOM_PATH_LEN, directory))
- {
- NSFW_LOGERR ("module mgr init STRCPY_S failed!");
- lint_unlock_1 ();
- return -1;
- }
- NSFW_LOGINF ("module mgr init]NSFW_PROC_MASTER domain_path=%s",
- mgr_cfg->domain_path);
-
- if (TRUE != nsfw_mgr_com_start ())
- {
- NSFW_LOGERR ("module mgr nsfw_mgr_com_start failed!");
- lint_unlock_1 ();
- return -1;
- }
-
- break;
case NSFW_PROC_TOOLS:
break;
case NSFW_PROC_CTRL:
diff --git a/src/framework/ipc/ps/nsfw_fd_timer.c b/src/framework/ipc/ps/nsfw_fd_timer.c
index 55d35cb..cea2486 100644
--- a/src/framework/ipc/ps/nsfw_fd_timer.c
+++ b/src/framework/ipc/ps/nsfw_fd_timer.c
@@ -322,7 +322,6 @@ nsfw_timer_module_init (void *param)
NSFW_LOGINF ("ps module init]type=%u", proc_type);
switch (proc_type)
{
- case NSFW_PROC_MASTER:
case NSFW_PROC_MAIN:
(void) NSFW_REG_SOFT_INT (NSFW_DBG_MODE_PARAM, g_hbt_switch, 0, 1);
break;
diff --git a/src/framework/ipc/ps/nsfw_ps_module.c b/src/framework/ipc/ps/nsfw_ps_module.c
index e600bf7..6e03e11 100644
--- a/src/framework/ipc/ps/nsfw_ps_module.c
+++ b/src/framework/ipc/ps/nsfw_ps_module.c
@@ -468,7 +468,7 @@ u8
nsfw_ps_exit_end_notify (u32 pid)
{
nsfw_mgr_msg *rsp_msg =
- nsfw_mgr_msg_alloc (MGR_MSG_APP_EXIT_RSP, NSFW_PROC_MASTER);
+ nsfw_mgr_msg_alloc (MGR_MSG_APP_EXIT_RSP, NSFW_PROC_MAIN);
if (NULL == rsp_msg)
{
NSFW_LOGERR ("alloc rsp msg failed]pid=%u", pid);
@@ -1590,42 +1590,6 @@ nsfw_ps_module_init (void *param)
switch (proc_type)
{
- case NSFW_PROC_MASTER:
- {
- (void) nsfw_mgr_reg_msg_fun (MGR_MSG_CHK_HBT_RSP,
- nsfw_ps_recv_hbt_rsp);
- (void) NSFW_REG_SOFT_INT (NSFW_HBT_TIMER, NSFW_CHK_HBT_TVLAUE, 1,
- 0xFFFF);
- (void) NSFW_REG_SOFT_INT (NSFW_HBT_COUNT_PARAM,
- NSFW_SOFT_HBT_CHK_COUNT, 1, 0xFFFF);
- (void) NSFW_REG_SOFT_INT (NSFW_APP_EXIT_TIMER, NSFW_PS_WEXIT_TVLAUE,
- 1, 0xFFFF);
-
- pid_info = nsfw_mem_zone_lookup (&pzoneinfo.stname);
- if (NULL == pid_info)
- {
- pid_info = nsfw_mem_zone_create (&pzoneinfo);
- if (NULL == pid_info)
- {
- NSFW_LOGERR ("alloc rec nul!");
- return -1;
- }
-
- retval =
- MEMSET_S (pid_info, (sizeof (nsfw_pid_item) * NSFW_MAX_PID),
- 0, (sizeof (nsfw_pid_item) * NSFW_MAX_PID));
- if (EOK != retval)
- {
- NSFW_LOGERR ("MEMSET_S failed]retval=%d.\n", retval);
- return -1;
- }
- }
-
- MEM_STAT (NSFW_PS_MODULE, pzoneinfo.stname.aname, NSFW_SHMEM,
- pzoneinfo.length);
- g_ps_info = pid_info;
- break;
- }
case NSFW_PROC_MAIN:
{
pid_info = malloc (sizeof (nsfw_pid_item) * NSFW_MAX_PID);
@@ -1693,7 +1657,7 @@ nsfw_ps_module_init (void *param)
MEM_STAT (NSFW_PS_MODULE, pmpinfo.stname.aname, NSFW_NSHMEM,
nsfw_mem_get_len (ps_cfg->ps_info_pool, NSFW_MEM_SPOOL));
- if (NSFW_PROC_MASTER != proc_type)
+ if (NSFW_PROC_MAIN != proc_type)
{
return 0;
}
diff --git a/src/framework/ipc/ps/nsfw_recycle_module.c b/src/framework/ipc/ps/nsfw_recycle_module.c
index 541581f..01e16fb 100644
--- a/src/framework/ipc/ps/nsfw_recycle_module.c
+++ b/src/framework/ipc/ps/nsfw_recycle_module.c
@@ -607,8 +607,6 @@ nsfw_recycle_module_init (void *param)
g_rec_cfg.rec_waite_end_tvalue = NSFW_REC_WEND_TVLAUE_DEF;
switch (proc_type)
{
- case NSFW_PROC_MASTER:
- return 0;
case NSFW_PROC_MAIN:
(void) nsfw_mgr_reg_msg_fun (MGR_MSG_APP_EXIT_REQ, mem_app_exit_proc);
(void) nsfw_mgr_reg_msg_fun (MGR_MSG_RCC_END_REQ,
@@ -644,7 +642,6 @@ nsfw_recycle_fork_init ()
{
/* reconnect to master after fork in child proc */
nsfw_mgr_close_dst_proc (NSFW_PROC_MAIN, 0);
- nsfw_mgr_close_dst_proc (NSFW_PROC_MASTER, 0);
if (0 == nsfw_recycle_module_init ((void *) ((long long) NSFW_PROC_APP)))
{
return TRUE;
diff --git a/src/framework/ipc/ps/nsfw_soft_param.c b/src/framework/ipc/ps/nsfw_soft_param.c
index 91d7598..743276f 100644
--- a/src/framework/ipc/ps/nsfw_soft_param.c
+++ b/src/framework/ipc/ps/nsfw_soft_param.c
@@ -270,7 +270,6 @@ nsfw_softparam_module_init (void *param)
switch (proc_type)
{
case NSFW_PROC_MAIN:
- case NSFW_PROC_MASTER:
(void) nsfw_mgr_reg_msg_fun (MGR_MSG_SOF_PAR_REQ,
nsfw_softparam_msg_proc);
return 0;
diff --git a/src/framework/log/nsfw_set_log.c b/src/framework/log/nsfw_set_log.c
index 7ef6f37..31241b5 100644
--- a/src/framework/log/nsfw_set_log.c
+++ b/src/framework/log/nsfw_set_log.c
@@ -199,7 +199,6 @@ nsfw_cfg_module_init (void *param)
switch (proc_type)
{
case NSFW_PROC_MAIN:
- case NSFW_PROC_MASTER:
(void) nsfw_mgr_reg_msg_fun (MGR_MSG_SET_LOG_REQ,
nsfw_set_log_msg_proc);
g_log_cfg.proc_type = proc_type;
diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c
index 861bc37..4198266 100644
--- a/src/nSocket/nstack/nstack.c
+++ b/src/nSocket/nstack/nstack.c
@@ -29,6 +29,7 @@
#include "nstack_share_res.h"
#include "nsfw_mgr_com_api.h"
#include "nsfw_ps_mem_api.h"
+#include "nsfw_fd_timer_api.h"
#include "nsfw_ps_api.h"
#include "nsfw_recycle_api.h"
#include "nstack_fd_mng.h"
@@ -788,6 +789,7 @@ nstack_fw_init ()
stinfo.enflag = (fw_poc_type)proc_type;
nstack_framework_setModuleParam(NSFW_MEM_MGR_MODULE, (void*)&stinfo);
nstack_framework_setModuleParam(NSFW_MGR_COM_MODULE, (void*) ((long long)proc_type));
+ nstack_framework_setModuleParam(NSFW_TIMER_MODULE, (void*) ((long long)proc_type));
nstack_framework_setModuleParam(NSFW_PS_MODULE, (void*) ((long long)proc_type));
nstack_framework_setModuleParam(NSFW_PS_MEM_MODULE, (void*) ((long long)proc_type));
nstack_framework_setModuleParam(NSFW_RECYCLE_MODULE, (void*) ((long long)proc_type));
diff --git a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
index d5b228b..03b5998 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
@@ -823,13 +823,7 @@ read_fn (i32 fd)
return;
}
- const char *old_hbt_cnt = "6";
- const char *new_hbt_cnt = "60";
- nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM,
- (void *) new_hbt_cnt, sizeof (u16));
(void) read_configuration (); // if it returns -1, the err desc info will be wrote to g_config_data, so no need to check return value.
- nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM,
- (void *) old_hbt_cnt, sizeof (u16));
offset = 0;
left = MAX_IP_MODULE_BUFF_SIZE;
diff --git a/stacks/lwip_stack/src/alarm/alarm.c b/stacks/lwip_stack/src/alarm/alarm.c
index 5f89cdd..c158144 100644
--- a/stacks/lwip_stack/src/alarm/alarm.c
+++ b/stacks/lwip_stack/src/alarm/alarm.c
@@ -158,11 +158,9 @@ ns_alarm_module_init (void *param)
switch (proc_type)
{
case NSFW_PROC_MAIN:
-
- case NSFW_PROC_MASTER:
case NSFW_PROC_CTRL:
- /* [S138713][p00329905][20171219]modify ip address to vm id */
+ /* modify ip address to vm id */
pst_vm_id = getenv ("VM_ID");
if (INVALID_STR_LEN (pst_vm_id, MIN_VM_ID_LEN, MAX_VM_ID_LEN))
diff --git a/stacks/lwip_stack/src/maintain/fw_mt_config.c b/stacks/lwip_stack/src/maintain/fw_mt_config.c
index 400eaa0..403a46e 100644
--- a/stacks/lwip_stack/src/maintain/fw_mt_config.c
+++ b/stacks/lwip_stack/src/maintain/fw_mt_config.c
@@ -558,8 +558,7 @@ init_base_config (cfg_module_param * param)
{
/* initial default config */
/* omc_ctrl single log file should be 10M */
- if (param->proc_type == NSFW_PROC_MASTER
- || param->proc_type == NSFW_PROC_CTRL)
+ if (param->proc_type == NSFW_PROC_CTRL)
{
init_master_def_config_items ();
}
@@ -684,26 +683,6 @@ init_main_log_cfg_para ()
set_log_init_para (&log_para);
}
-NSTACK_STATIC void
-init_master_log_cfg_para ()
-{
- struct log_init_para log_para;
- log_para.mon_log_size = g_cfg_item_info[CFG_SEG_LOG][0].value;
- log_para.mon_log_count = g_cfg_item_info[CFG_SEG_LOG][1].value;
-
- /* log path valid check */
- if (0 == access (g_cfg_item_info[CFG_SEG_PATH][0].pvalue, W_OK))
- {
- log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].pvalue;
- }
- else
- {
- log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].default_str;
- }
-
- set_log_init_para (&log_para);
-}
-
/* nStackCtrl is the diff process with main, cannot use main process info,
need get the configure info respectively */
/* omc_ctrl single log file should be 10M */
@@ -739,17 +718,6 @@ init_module_cfg_nstackmain ()
init_main_log_cfg_para ();
}
-/*===========config init for nstack master=============*/
-
-NSTACK_STATIC void
-init_module_cfg_nstackmaster ()
-{
- /* init config data */
- init_module_cfg_default ();
-
- init_master_log_cfg_para ();
-}
-
/*===========config init for nstack ctrl=============*/
/* nStackCtrl is the diff process with main,
@@ -776,10 +744,6 @@ config_module_init (cfg_module_param * param)
init_module_cfg_nstackmain ();
break;
- case NSFW_PROC_MASTER:
- init_module_cfg_nstackmaster ();
- break;
-
case NSFW_PROC_CTRL:
init_module_cfg_nstackctrl ();
break;