diff options
| -rw-r--r-- | .gitlab-ci.yml | 10 | ||||
| -rw-r--r-- | bin/etc/sapp.toml | 6 | ||||
| -rw-r--r-- | ci/travis.sh | 3 | ||||
| -rw-r--r-- | include/public/stream_inc/stream_control.h | 30 | ||||
| -rw-r--r-- | src/config/config_parse.cpp | 2 | ||||
| -rw-r--r-- | src/packet_io/packet_io_marsio.c | 6 | ||||
| -rw-r--r-- | src/packet_io/sendpacket.c | 34 |
7 files changed, 83 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61db797..437d956 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,8 @@ branch_build_debug: extends: .build_by_travis variables: BUILD_TYPE: Debug + CAPTURE_MODE: MARSIO + PLATFORM_MODE: INLINE except: - /^develop.*$/i - /^master.*$/i @@ -34,6 +36,8 @@ branch_build_release: stage: build variables: BUILD_TYPE: RelWithDebInfo + CAPTURE_MODE: MARSIO + PLATFORM_MODE: INLINE extends: .build_by_travis except: - /^develop.*$/i @@ -45,6 +49,8 @@ develop_build_debug: extends: .build_by_travis variables: BUILD_TYPE: Debug + CAPTURE_MODE: MARSIO + PLATFORM_MODE: INLINE PACKAGE: 1 artifacts: name: "sapp-$CI_COMMIT_REF_NAME-debug" @@ -59,6 +65,8 @@ develop_build_release: extends: .build_by_travis variables: BUILD_TYPE: RelWithDebInfo + CAPTURE_MODE: MARSIO + PLATFORM_MODE: INLINE PACKAGE: 1 artifacts: name: "sapp-$CI_COMMIT_REF_NAME-release" @@ -73,6 +81,8 @@ release_build_release: stage: build variables: BUILD_TYPE: RelWithDebInfo + CAPTURE_MODE: MARSIO + PLATFORM_MODE: INLINE PACKAGE: 1 UPLOAD: 1 PULP3_REPO_NAME: platform-stable-x86_64.el7 diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml index 6f9eb9c..bd5abb8 100644 --- a/bin/etc/sapp.toml +++ b/bin/etc/sapp.toml @@ -9,8 +9,8 @@ instance_name = "sapp_v4.0" [CPU] -worker_threads=1 -send_only_threads_max=16 +worker_threads=4 +send_only_threads_max=4 ### note, bind_mask, if you do not want to bind thread to special CPU core, keep it empty as [] bind_mask=[] @@ -29,7 +29,7 @@ dictator_enable=1 BSD_packet_filter="" ### note, same as tcpdump -Q/-P arg, possible values are `in', `out' and `inout', default is "in" - pcap_capture_direction="inout" + pcap_capture_direction="in" ### note, depolyment.mode options: [mirror, inline, transparent] [packet_io.depolyment] diff --git a/ci/travis.sh b/ci/travis.sh index c9d2f27..2fca6d5 100644 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -33,6 +33,7 @@ env | sort : "${COMPILER_IS_GNUCXX:=OFF}" # Install dependency from YUM +yum install -y mrzcpd numactl-devel zlib-devel librdkafka-devel systemd-devel yum install libMESA_htable-devel libMESA_prof_load-devel libcjson-devel libMESA_field_stat2-devel framework_env libwiredcfg-devel libWiredLB-devel libMESA_handle_logger-devel -y source /etc/profile.d/framework.sh @@ -40,6 +41,8 @@ mkdir build || true cd build cmake3 -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ + -DCAPTURE_MODE=$CAPTURE_MODE \ + -DPLATFORM_MODE=$PLATFORM_MODE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ -DENABLE_DEVEL=$ENABLE_DEVEL_SWITCH \ diff --git a/include/public/stream_inc/stream_control.h b/include/public/stream_inc/stream_control.h index 927e957..5b5fcd7 100644 --- a/include/public/stream_inc/stream_control.h +++ b/include/public/stream_inc/stream_control.h @@ -235,6 +235,36 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va */
int sapp_get_device_opt(const char *device, enum sapp_device_opt opt_type, void *opt_val, int *opt_val_len);
+/***************************************************************************************
+ NOTE:
+ �ڱ���ģʽ��, ����������route_dir�ľ���ֵ, ֻ��Ҫ����ͬ��ͷ���,
+ ��������������Ҫ��ȷ����route_dir��0����1, �������������ģʽ��ͬ, ������ʱ��仯,
+ �������ô˽ӿ�, ���ֻ�贫����������ķ���human_dir, ���ص�ǰ��·��link route dir,
+ ע���״β���ʱ, etc/sapp.toml->inbound_route_dirһ��Ҫ������ȷ.
+
+ args: ��ʾ����Ŀ������ڵ�ǰ�豸���ڵĵ���λ��,
+ 'E' or 'e': ��ʾ���ݰ����䷽���Ǵ�Internal to External.
+ 'I' or 'i': ��ʾ���ݰ����䷽���Ǵ�External to Internal.
+
+ return value:
+ 0 or 1: success.
+ -1 : error.
+****************************************************************************************/
+int MESA_dir_human_to_link(int human_dir);
+
+/*
+ args:
+ ��·���䷽��: 0��1, ͨ������stream->routedir;
+
+ ����ֵ:
+ 'E' or 'e': ��ʾ���ݰ����䷽���Ǵ�Internal to External.
+ 'I' or 'i': ��ʾ���ݰ����䷽���Ǵ�External to Internal.
+ 'x': ��������;
+*/
+int MESA_dir_link_to_human(int link_route_dir);
+
+
+
/****************************************************************************************
CHN : ��Ϊ��ʷ��������,���ຯ��������Ϊ������,��ʹ���½ӿ�:MESA_set_stream_opt().
ENG : for compat old version, keep these functions, but we suggest you use new API MESA_set_stream_opt().
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp index 5ef8b0a..35a2d8c 100644 --- a/src/config/config_parse.cpp +++ b/src/config/config_parse.cpp @@ -598,7 +598,7 @@ int sapp_parse_config(void) tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.external.interface", (char *)"type", pconfig->packet_io.external.interface.type_str, NAME_MAX, "pcap"); tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.external.interface", (char *)"name", pconfig->packet_io.external.interface.name, NAME_MAX, "lo"); tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"enabled", &pconfig->packet_io.polling_enabled, 1); - tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"polling_priority", &pconfig->packet_io.polling_priority, 10); + tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"polling_priority", &pconfig->packet_io.polling_priority, 100); /******************************* STREAM ******************************/ tomlc99_wrap_load_string_def(default_config_file, (char *)"STREAM", (char *)"stream_id_base_time", pconfig->stream.stream_id_base_time_str, 32, ""); diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c index 7df69c7..73750a3 100644 --- a/src/packet_io/packet_io_marsio.c +++ b/src/packet_io/packet_io_marsio.c @@ -686,7 +686,7 @@ static void *marsio4_worker(void *arg) }else{ flush_buf(tid); /* �ް�ʱҪ����polling�ӿ� */ - if(stream_process_polling(tid) > 0){ + if((stream_process_polling(tid) & POLLING_STATE_WORK) != 0){ polling_work_times++; } } @@ -695,7 +695,7 @@ static void *marsio4_worker(void *arg) if((rcv_pkt_tims % sapp_global_val->config.packet_io.polling_priority) == 0){ /* ���������, һֱ�а�ʱ, ÿ��polling_priority����ҲҪ����polling�ӿ� */ - if(stream_process_polling(tid) > 0){ + if((stream_process_polling(tid) & POLLING_STATE_WORK) != 0){ polling_work_times++; } total_call_times++; @@ -707,8 +707,6 @@ static void *marsio4_worker(void *arg) rcv_pkt_tims = 0; polling_work_times = 0; } - - } return NULL; diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c index 9df73e5..aedfb6c 100644 --- a/src/packet_io/sendpacket.c +++ b/src/packet_io/sendpacket.c @@ -3278,6 +3278,40 @@ int MESA_dir_human_to_link(int human_dir) return link_route_dir; } +/* + args: + ��·���䷽��: 0��1, ͨ������stream->routedir; + + ����ֵ: + 'E' or 'e': ��ʾ���������Ǵ�Internal to External. + 'I' or 'i': ��ʾ���������Ǵ�External to Internal. + 'x': ��������; +*/ +int MESA_dir_link_to_human(int link_route_dir) +{ + int human_dir; + + if((link_route_dir != 0) && (link_route_dir != 1)){ + return 'x'; + } + + if(0 == sapp_global_val->config.packet_io.inbound_route_dir){ + if(0 == link_route_dir){ + human_dir = 'I'; + }else{ + human_dir = 'E'; + } + }else{ + if(0 == link_route_dir){ + human_dir = 'E'; + }else{ + human_dir = 'I'; + } + } + + return human_dir; +} + static inline int dir_check(unsigned char raw_dir) |
