调整kni.conf

This commit is contained in:
崔一鸣
2019-06-21 18:55:08 +08:00
parent 88678844a5
commit 4ca638521a
6 changed files with 62 additions and 66 deletions

View File

@@ -18,7 +18,7 @@ struct tfe_mgr{
int tfe_enabled_node_count;
int tfe_alive_nodes[TFE_COUNT_MAX];
int tfe_alive_node_count;
int keepalive_switch;
int watch_dog_switch;
void *logger;
};
@@ -289,10 +289,10 @@ struct tfe_mgr* tfe_mgr_init(int tfe_node_count, const char* profile, void *logg
mgr->logger = logger;
int ret;
//load keepalive conf
char section[KNI_SYMBOL_MAX] = "tfe_mgr";
MESA_load_profile_int_def(profile, section, "keepalive_switch", &(mgr->keepalive_switch), 0);
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n keepalive_switch: %d", section, mgr->keepalive_switch);
if(mgr->keepalive_switch == 0){
char section[KNI_SYMBOL_MAX] = "watch_dog";
MESA_load_profile_int_def(profile, section, "switch", &(mgr->watch_dog_switch), 0);
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n switch: %d", section, mgr->watch_dog_switch);
if(mgr->watch_dog_switch == 0){
return mgr;
}
int keepalive_idle, keepalive_cnt, keepalive_intvl;
@@ -309,17 +309,17 @@ struct tfe_mgr* tfe_mgr_init(int tfe_node_count, const char* profile, void *logg
MESA_load_profile_int_def(profile, section, "keepalive_idle", &keepalive_idle, 2);
MESA_load_profile_int_def(profile, section, "keepalive_intvl", &keepalive_intvl, 1);
MESA_load_profile_int_def(profile, section, "keepalive_cnt", &keepalive_cnt, 3);
ret = MESA_load_profile_string_nodef(profile, section, "keepalive_listen_eth", keepalive_listen_eth, sizeof(keepalive_listen_eth));
ret = MESA_load_profile_string_nodef(profile, section, "listen_eth", keepalive_listen_eth, sizeof(keepalive_listen_eth));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: keepalive_listen_eth not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_int_nodef(profile, section, "keepalive_listen_port", &keepalive_listen_port);
ret = MESA_load_profile_int_nodef(profile, section, "listen_port", &keepalive_listen_port);
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: keepalive_listen_port not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n keepalive_idle: %d\n keepalive_intvl: %d\n keepalive_cnt: %d\n keepalive_listen_eth: %s\n keepalive_listen_port: %d",
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n keepalive_idle: %d\n keepalive_intvl: %d\n keepalive_cnt: %d\n listen_eth: %s\n listen_port: %d",
section, keepalive_idle, keepalive_intvl, keepalive_cnt, keepalive_listen_eth, keepalive_listen_port);
ret = kni_ipv4_addr_get_by_eth(keepalive_listen_eth, &keepalive_listen_ip);
if(ret < 0){
@@ -386,7 +386,7 @@ error_out:
int tfe_mgr_alive_node_get(struct tfe_mgr *mgr, int thread_seq){
int tfe_id = -1;
if(mgr->keepalive_switch == 0){
if(mgr->watch_dog_switch == 0){
if(mgr->tfe_enabled_node_count > 0){
int i = thread_seq % mgr->tfe_enabled_node_count;
tfe_id = mgr->tfe_enabled_nodes[i].tfe_id;