summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2019-12-31 11:38:03 +0800
committerlijia <[email protected]>2019-12-31 11:38:03 +0800
commit06731c3bb2818b398884990af62ab05a401d1f78 (patch)
treef145e37668797b6e4aec306487e04b8ee9c1aae7
parent98228e4e577f0df244beb0e2702776fa39877670 (diff)
实现ethernet层inbound, outbound两个方向流量统计; 实现每个stream两个方向统计.
-rw-r--r--bin/etc/sapp.toml8
-rw-r--r--include/private/sapp_global_val.h3
-rw-r--r--include/private/sapp_pkt_stat.h1
-rw-r--r--include/private/stream_internal.h4
-rw-r--r--src/config/config_parse.cpp2
-rw-r--r--src/dealpkt/deal_ethernet.c9
-rw-r--r--src/dealpkt/deal_tcp.c7
-rw-r--r--src/dealpkt/deal_udp.c5
-rw-r--r--src/dealpkt/plug_support.c123
-rw-r--r--src/inner_plug/sapp_assistant.cpp48
-rw-r--r--src/packet_io/packet_io.c10
-rw-r--r--src/packet_io/packet_io_marsio.c1
-rw-r--r--src/packet_io/packet_io_pcap.c1
-rw-r--r--src/packet_io/packet_io_status.cpp9
-rw-r--r--version.txt12
15 files changed, 214 insertions, 29 deletions
diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml
index 6254611..447920e 100644
--- a/bin/etc/sapp.toml
+++ b/bin/etc/sapp.toml
@@ -9,9 +9,9 @@
instance_name = "sapp_v4.0"
[CPU]
-worker_threads=1
+worker_threads=2
### note, bind_mask, if you do not want to bind thread to special CPU core, keep it empty as []
-bind_mask=[1]
+bind_mask=[]
[PACKET_IO]
### note, used to represent inbound or outbound direction value,
@@ -21,11 +21,11 @@ bind_mask=[1]
inbound_route_dir=1
### note, BSD_packet_filter, if you do not want to set any filter rule, keep it empty as ""
-BSD_packet_filter=""
+BSD_packet_filter="tcp port 88"
### note, depolyment.mode options: [mirror, inline, transparent]
[packet_io.depolyment]
- mode=mirror
+ mode=transparent
### note, interface.type options: [pag,pcap,marsio]
[packet_io.internal.interface]
diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h
index 46c8899..ee64e2d 100644
--- a/include/private/sapp_global_val.h
+++ b/include/private/sapp_global_val.h
@@ -159,6 +159,7 @@ typedef struct{
char pcap_dumpfile_name[NAME_MAX];
int polling_enabled;
int polling_priority; /* call sapp_recv_pkt every call polling_entry times, ���ö��ٴ�polling�����һ��recv pkt, 1��ʾ�������ȼ���ͬ */
+ int inbound_route_dir; /* ��ʾ�뾳, I2C�����ֵ��0����1 */
}sapp_config_packet_io_t;
typedef struct{
@@ -219,7 +220,7 @@ typedef struct{
typedef struct{
sapp_gval_mthread_sys_stat_t sys_stat;
unsigned short stream_seq_per_thread;
- char __padding[28];
+ char __padding[12];
}sapp_gval_mthread_t; /* for multi-thread, must 64byte alignment */
diff --git a/include/private/sapp_pkt_stat.h b/include/private/sapp_pkt_stat.h
index 3932335..a7feda7 100644
--- a/include/private/sapp_pkt_stat.h
+++ b/include/private/sapp_pkt_stat.h
@@ -21,7 +21,6 @@ typedef enum __sapp_sys_stat_type{
/************* send packet *******************/
- SAPP_STAT_ETH_EGRESS, /* ����ģʽ�µĻ�������, �����Ϻ�SAPP_STAT_RCV_ETHERNET���, �����в������DROPPKT */
SAPP_STAT_ETH_INBOUND, /* ����ģʽ��, �ǵ�ǰ������I/O����, ��������ڵ�ǰ�豸��������λ��, ���뾳�������� */
SAPP_STAT_ETH_OUTBOUND, /* ����ģʽ��, �ǵ�ǰ������I/O����, ��������ڵ�ǰ�豸��������λ��, ���뾳�������� */
diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h
index 09acc80..fceb2d5 100644
--- a/include/private/stream_internal.h
+++ b/include/private/stream_internal.h
@@ -69,6 +69,7 @@ typedef struct {
const void *raw_pkt_data; /* ���ϲ�Ӧ�ÿ���ԭʼ��ͷָ��, �п���������Ethernet��, ����low_layer_type�ж�Э������ */
struct timeval raw_pkt_ts; /* ԭʼ������ʱ���, ���ȫΪ0��֧�ִ˹���(��pagģʽ) */
const void *io_lib_pkt_reference; /* ���õײ�I/O���ԭʼ�������ṹ, ����:����marsio��˵, ���ײ��mbuf�ṹ */
+ int route_dir;
}raw_pkt_t;
@@ -132,7 +133,8 @@ struct streaminfo_private
/* ---8 bytes-- */
UCHAR layer_dir:2; /* ������Ч, ��ǰ��ĵ�ַ�Ƿ��Ĭ�Ϲ���"��˿��ǿͻ���"��ͬ */
- UCHAR stream_dir:2; /* ��������������Ч, ���Ĵ洢�ĵ�ַ�Ƿ��Ĭ�Ϲ���"��˿��ǿͻ���"��ͬ */
+ UCHAR stream_dir:1; /* ��������������Ч, ���Ĵ洢�ĵ�ַ�Ƿ��Ĭ�Ϲ���"��˿��ǿͻ���"��ͬ */
+ UCHAR stream_c2s_route_dir:1; /* c2s����İ�, ��Ӧ����·route dir����, ���ڻ�ȡinbound, outbound���� */
UCHAR addr_use_as_hash:1; /* �����addr�Ƿ���ΪHASH����ͱȽϵIJ���, ��:MAC��ַ��������� */
UCHAR addr_skip_for_layer_cmp:1;/*�����addr�Ƿ���Ϊ��ַ�ȽϵIJ㼶���磺MPLS��ַ����Ϊ�������㣬ֱ����������ֵĬ��Ϊ0������Ҫ�Ƚ�*/
UCHAR need_update_opposite_addr:1;/*�����addr�Ƿ��ڶԲ�����ʱ���£��磺MPLS��ǩ�ǶԳ�ʱ��Ҫ��S2C���һ������¼�����ǩ,��ֵĬ��Ϊ0��������Ҫ����*/
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp
index fdcff12..a396ca6 100644
--- a/src/config/config_parse.cpp
+++ b/src/config/config_parse.cpp
@@ -578,6 +578,8 @@ int sapp_parse_config(void)
if(str_tmp[0] != '\0'){
pconfig->packet_io.input_bpf_filter = strdup(str_tmp);
}
+ tomlc99_wrap_load_int_def(default_config_file, (char *)"PACKET_IO", (char *)"inbound_route_dir", &pconfig->packet_io.inbound_route_dir, 0);
+
tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.depolyment", (char *)"mode", pconfig->packet_io.depolyment_mode_str, NAME_MAX, "mirror");
tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.internal.interface", (char *)"type", pconfig->packet_io.internal.interface.type_str, NAME_MAX, "pcap");
tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.internal.interface", (char *)"name", pconfig->packet_io.internal.interface.name, NAME_MAX, "lo");
diff --git a/src/dealpkt/deal_ethernet.c b/src/dealpkt/deal_ethernet.c
index 73c1906..f967526 100644
--- a/src/dealpkt/deal_ethernet.c
+++ b/src/dealpkt/deal_ethernet.c
@@ -82,7 +82,14 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
//g_SysInputInfo[thread_num][PKT_ETHERNET]++;
//g_SysInputInfo[thread_num][PKT_ETHERNET_LEN] += (unsigned long long)raw_pkt->raw_pkt_len;
local_sys_stat->count[SAPP_STAT_RCV_ETHERNET]++;
- local_sys_stat->length[SAPP_STAT_RCV_ETHERNET] += (unsigned long long)raw_pkt->raw_pkt_len;;
+ local_sys_stat->length[SAPP_STAT_RCV_ETHERNET] += (unsigned long long)raw_pkt->raw_pkt_len;
+ if(dir == sapp_global_val->config.packet_io.inbound_route_dir){
+ local_sys_stat->count[SAPP_STAT_ETH_INBOUND]++;
+ local_sys_stat->length[SAPP_STAT_ETH_INBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
+ }else{
+ local_sys_stat->count[SAPP_STAT_ETH_OUTBOUND]++;
+ local_sys_stat->length[SAPP_STAT_ETH_OUTBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
+ }
}else{
pstream_pr = NULL; /* ʹ�ϲ����Э���pfatherΪNULL */
next_layer_offset = 0;
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c
index 163ed0f..a8398f0 100644
--- a/src/dealpkt/deal_tcp.c
+++ b/src/dealpkt/deal_tcp.c
@@ -718,6 +718,7 @@ static struct streamindex *tcp_add_new_stream_bysyn(struct streamindex *pindex,
pdetail_pr->iserverseq=ntohl (this_tcphdr->th_ack);
//pdetail->clientpkt++; //adjust by lqy 20140515 ֻ���½�ʱ����
pdetail_pr->S2C_first_ack_seq = pdetail_pr->iserverseq;
+ pstream_pr->stream_c2s_route_dir = raw_pkt->route_dir ^ 1;
}
else if(createdir==DIR_C2S)
{
@@ -725,6 +726,7 @@ static struct streamindex *tcp_add_new_stream_bysyn(struct streamindex *pindex,
pdetail_pr->iserverseq=ntohl (this_tcphdr->th_seq)+1;
//pdetail->serverpkt++; //adjust by lqy 20140515 ֻ���½�ʱ����
pdetail_pr->C2S_first_ack_seq = ntohl (this_tcphdr->th_ack);
+ pstream_pr->stream_c2s_route_dir = raw_pkt->route_dir;
}
pdetail->lastmtime=g_CurrentTime;
pdetail_pr->link_state=STREAM_LINK_JUST_EST;
@@ -1006,6 +1008,11 @@ static struct streamindex *tcp_add_new_stream_bydata(struct streamindex *pindex,
pdetail_pr->auto_remedy_flag = sapp_global_val->config.stream.tcp.inject.auto_remedy;
+ if(createdir==DIR_C2S){
+ pstream_pr->stream_c2s_route_dir = raw_pkt->route_dir;
+ }else{
+ pstream_pr->stream_c2s_route_dir = raw_pkt->route_dir ^ 1;
+ }
return pindex_tcp;
}
diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c
index 8f2e6bb..d8398ef 100644
--- a/src/dealpkt/deal_udp.c
+++ b/src/dealpkt/deal_udp.c
@@ -208,6 +208,11 @@ static struct streamindex *udp_add_new_stream(struct streamindex *pindex,
}
save_polling_inject_context(pstream_udp_pr, raw_pkt);
+ if(createdir==DIR_C2S){
+ pstream_udp_pr->stream_c2s_route_dir = raw_pkt->route_dir;
+ }else{
+ pstream_udp_pr->stream_c2s_route_dir = raw_pkt->route_dir ^ 1;
+ }
return pindex_udp;
}
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index d23da9b..fee82dc 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -397,6 +397,80 @@ int get_thread_count(void)
}
+/*
+ ctype:
+ 'c':count;
+ 'l':length;
+*/
+static inline unsigned long long __get_stream_opt_traffic(int cltype, int iotype, struct streaminfo_private *pstream_pr)
+{
+ unsigned long long tval;
+ struct streaminfo *pstream = &pstream_pr->stream_public;
+
+ if('c' == cltype){ /* count */
+ if('i' == iotype){ /* inbound */
+ if(sapp_global_val->config.packet_io.inbound_route_dir == pstream_pr->stream_c2s_route_dir){
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->serverpktnum;
+ }else{
+ tval = pstream->pudpdetail->serverpktnum;
+ }
+ }else{
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->clientpktnum;
+ }else{
+ tval = pstream->pudpdetail->clientpktnum;
+ }
+ }
+ }else{ /* outbound */
+ if(sapp_global_val->config.packet_io.inbound_route_dir == pstream_pr->stream_c2s_route_dir){
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->clientpktnum;
+ }else{
+ tval = pstream->pudpdetail->clientpktnum;
+ }
+ }else{
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->serverpktnum;
+ }else{
+ tval = pstream->pudpdetail->serverpktnum;
+ }
+ }
+ }
+ }else{/* length */
+ if('i' == iotype){ /* inbound */
+ if(sapp_global_val->config.packet_io.inbound_route_dir == pstream_pr->stream_c2s_route_dir){
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->serverbytes;
+ }else{
+ tval = pstream->pudpdetail->serverbytes;
+ }
+ }else{
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->clientbytes;
+ }else{
+ tval = pstream->pudpdetail->clientbytes;
+ }
+ }
+ }else{ /* outbound */
+ if(sapp_global_val->config.packet_io.inbound_route_dir == pstream_pr->stream_c2s_route_dir){
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->clientbytes;
+ }else{
+ tval = pstream->pudpdetail->clientbytes;
+ }
+ }else{
+ if(STREAM_TYPE_TCP != pstream_pr->stream_public.type){
+ tval = pstream->ptcpdetail->serverbytes;
+ }else{
+ tval = pstream->pudpdetail->serverbytes;
+ }
+ }
+ }
+ }
+
+ return tval;
+}
int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt opt, void *opt_val, int opt_val_len)
{
int ret = -1;
@@ -517,6 +591,55 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o
pdetail_pr->auto_remedy_flag = (remedy_flag != 0 ? 1:0);
ret = 0;
}
+ break;
+
+ case MSO_TOTAL_INBOUND_PKT:
+ {
+ if((STREAM_TYPE_TCP != pstream->type) && (STREAM_TYPE_UDP != pstream->type)){
+ sapp_runtime_log(RLOG_LV_INFO, "MESA_set_stream_opt() MSO_TOTAL_INBOUND_PKT error: stream type is not tcp or udp!\n");
+ ret = -1;
+ break;
+ }
+ unsigned long long *inbound_pkt = (unsigned long long *)opt_val;
+ *inbound_pkt = __get_stream_opt_traffic('c', 'i', (struct streaminfo_private *)pstream);
+ }
+ break;
+
+ case MSO_TOTAL_OUTBOUND_PKT:
+ {
+ if((STREAM_TYPE_TCP != pstream->type) && (STREAM_TYPE_UDP != pstream->type)){
+ sapp_runtime_log(RLOG_LV_INFO, "MESA_set_stream_opt() MSO_TOTAL_OUTBOUND_PKT error: stream type is not tcp or udp!\n");
+ ret = -1;
+ break;
+ }
+ unsigned long long *outbound_pkt = (unsigned long long *)opt_val;
+ *outbound_pkt = __get_stream_opt_traffic('c', 'o', (struct streaminfo_private *)pstream);
+ }
+ break;
+
+ case MSO_TOTAL_INBOUND_BYTE:
+ {
+ if((STREAM_TYPE_TCP != pstream->type) && (STREAM_TYPE_UDP != pstream->type)){
+ sapp_runtime_log(RLOG_LV_INFO, "MESA_set_stream_opt() MSO_TOTAL_INBOUND_BYTE error: stream type is not tcp or udp!\n");
+ ret = -1;
+ break;
+ }
+ unsigned long long *inbound_byte = (unsigned long long *)opt_val;
+ *inbound_byte = __get_stream_opt_traffic('l', 'i', (struct streaminfo_private *)pstream);
+ }
+ break;
+
+ case MSO_TOTAL_OUTBOUND_BYTE:
+ {
+ if((STREAM_TYPE_TCP != pstream->type) && (STREAM_TYPE_UDP != pstream->type)){
+ sapp_runtime_log(RLOG_LV_INFO, "MESA_set_stream_opt() MSO_TOTAL_OUTBOUND_BYTE error: stream type is not tcp or udp!\n");
+ ret = -1;
+ break;
+ }
+ unsigned long long *outbound_byte = (unsigned long long *)opt_val;
+ *outbound_byte = __get_stream_opt_traffic('l', 'o', (struct streaminfo_private *)pstream);
+ }
+ break;
default:
sapp_runtime_log(RLOG_LV_INFO, "MESA_set_stream_opt() error: unsupport MESA_stream_opt type!\n");
diff --git a/src/inner_plug/sapp_assistant.cpp b/src/inner_plug/sapp_assistant.cpp
index e91b8fa..02c5bab 100644
--- a/src/inner_plug/sapp_assistant.cpp
+++ b/src/inner_plug/sapp_assistant.cpp
@@ -107,7 +107,7 @@ int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt
'c':count;
'l':length;
*/
-static unsigned long long __get_platform_opt_traffic(int ctype, sapp_sys_stat_type_t index)
+static inline unsigned long long __get_platform_opt_traffic(int ctype, sapp_sys_stat_type_t index)
{
int i;
unsigned long long tmp_long = 0;
@@ -158,27 +158,53 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va
}
break;
- case SPO_TOTAL_EGRESS_PKT:
+ case SPO_TOTAL_INBOUND_PKT:
{
if(*opt_val_len != sizeof(long long)){
ret = -1;
sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len);
break;
}
- unsigned long long *tot_byte = (unsigned long long *)opt_val;
- *tot_byte = *tot_byte = __get_platform_opt_traffic('c', SAPP_STAT_ETH_EGRESS);;
+ unsigned long long *inbound_pkt = (unsigned long long *)opt_val;
+ *inbound_pkt = __get_platform_opt_traffic('c', SAPP_STAT_ETH_INBOUND);
}
break;
- case SPO_TOTAL_EGRESS_BYTE:
+ case SPO_TOTAL_INBOUND_BYTE:
{
if(*opt_val_len != sizeof(long long)){
ret = -1;
sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len);
break;
}
- unsigned long long *tot_byte = (unsigned long long *)opt_val;
- *tot_byte = *tot_byte = __get_platform_opt_traffic('l', SAPP_STAT_ETH_EGRESS);;
+ unsigned long long *inbound_byte = (unsigned long long *)opt_val;
+ *inbound_byte = __get_platform_opt_traffic('c', SAPP_STAT_ETH_INBOUND);
+
+ }
+ break;
+
+ case SPO_TOTAL_OUTBOUND_PKT:
+ {
+ if(*opt_val_len != sizeof(long long)){
+ ret = -1;
+ sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len);
+ break;
+ }
+ unsigned long long *outbound_pkt = (unsigned long long *)opt_val;
+ *outbound_pkt = __get_platform_opt_traffic('c', SAPP_STAT_ETH_OUTBOUND);
+ }
+ break;
+
+ case SPO_TOTAL_OUTBOUND_BYTE:
+ {
+ if(*opt_val_len != sizeof(long long)){
+ ret = -1;
+ sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len);
+ break;
+ }
+ unsigned long long *outbound_byte = (unsigned long long *)opt_val;
+ *outbound_byte = __get_platform_opt_traffic('c', SAPP_STAT_ETH_OUTBOUND);
+
}
break;
@@ -636,6 +662,14 @@ static int sapp_fs2_init(void)
pfs_para->fs_id_count_array[SAPP_STAT_RCV_ETHERNET] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Eth_Pkt");
pfs_para->fs_id_length_array[SAPP_STAT_RCV_ETHERNET] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Eth_Bit");
+ if((DEPOLYMENT_MODE_INLINE == sapp_global_val->config.packet_io.depolyment_mode_bin)
+ || (DEPOLYMENT_MODE_TRANSPARENT == sapp_global_val->config.packet_io.depolyment_mode_bin)){
+ pfs_para->fs_id_count_array[SAPP_STAT_ETH_INBOUND] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Pkt_Inbound");
+ pfs_para->fs_id_length_array[SAPP_STAT_ETH_INBOUND] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Bit_Inbound");
+ pfs_para->fs_id_count_array[SAPP_STAT_ETH_OUTBOUND] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Pkt_Outbound");
+ pfs_para->fs_id_length_array[SAPP_STAT_ETH_OUTBOUND] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Bit_Outbound");
+ }
+
pfs_para->fs_id_count_array[SAPP_STAT_RCV_IPV4] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Ipv4_Pkt");
pfs_para->fs_id_length_array[SAPP_STAT_RCV_IPV4] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Ipv4_Bit");
diff --git a/src/packet_io/packet_io.c b/src/packet_io/packet_io.c
index 53268db..34151cb 100644
--- a/src/packet_io/packet_io.c
+++ b/src/packet_io/packet_io.c
@@ -643,10 +643,7 @@ static int mesa_default_pkt_cb(const raw_pkt_t *p_raw_pkt, unsigned char dir, in
ret = g_platform_action_cb_fun(sapp_global_val->config.packet_io.depolyment_mode_bin, ret);
}
- if((PASS == ret) && (g_topology_mode & __NET_CONN_SERIAL)){
- sapp_global_val->mthread_volatile[thread_num]->sys_stat.count[SAPP_STAT_ETH_EGRESS]++;
- sapp_global_val->mthread_volatile[thread_num]->sys_stat.length[SAPP_STAT_ETH_EGRESS]+= p_raw_pkt->raw_pkt_len;
- }
+
return ret;
}
@@ -1086,10 +1083,7 @@ int packet_io_send_fake_pkt(MESA_send_handle *send_handle,int datalen,int send_t
thread_num);
}
- if(ret >= 0){
- sapp_global_val->mthread_volatile[thread_num]->sys_stat.count[SAPP_STAT_ETH_EGRESS]++;
- sapp_global_val->mthread_volatile[thread_num]->sys_stat.length[SAPP_STAT_ETH_EGRESS] += datalen;
- }
+
return ret;
}
diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c
index 27f3309..a09aca1 100644
--- a/src/packet_io/packet_io_marsio.c
+++ b/src/packet_io/packet_io_marsio.c
@@ -475,6 +475,7 @@ static inline int marsio4_pkt_hand(int tid, marsio_buff_t *rx_buff, raw_pkt_t *r
raw_pkt->__lib_raw_pkt_len = marsio_buff_datalen(rx_buff);
raw_pkt->raw_pkt_len = raw_pkt->__lib_raw_pkt_len;
raw_pkt->io_lib_pkt_reference = rx_buff;
+ raw_pkt->route_dir = mr_ctrlzone->route_dir;
ret = (*g_marsio4_work_fun)((const raw_pkt_t *)raw_pkt, mr_ctrlzone->route_dir, tid);
diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c
index 2c92083..24ab773 100644
--- a/src/packet_io/packet_io_pcap.c
+++ b/src/packet_io/packet_io_pcap.c
@@ -1070,6 +1070,7 @@ retry:
pkt_queue_node.route_dir = *((unsigned char *)user);
pkt_queue_node.raw_pkt.hd_hash = 0; /* 2016-05-05 lijia add, pcapģʽ��֧��Ӳ��HASH */
pkt_queue_node.raw_pkt.io_lib_pkt_reference = pkt_queue_node.raw_pkt.__lib_raw_pkt_data; /* ����dpdkģʽ, ���˱�����ֵ */
+ pkt_queue_node.raw_pkt.route_dir = *((unsigned char *)user);
pkt_queue_node.op_flag = PCAP_OP_FLAG_PKT;
#if DEBUG
diff --git a/src/packet_io/packet_io_status.cpp b/src/packet_io/packet_io_status.cpp
index 3afab4c..d3932e5 100644
--- a/src/packet_io/packet_io_status.cpp
+++ b/src/packet_io/packet_io_status.cpp
@@ -120,6 +120,15 @@ static void field_stat2_update_metrics(void)
sapp_fs2_update_count(SAPP_STAT_RCV_ETHERNET, cur_count[SAPP_STAT_RCV_ETHERNET]);
sapp_fs2_update_length(SAPP_STAT_RCV_ETHERNET, 8 *( cur_length[SAPP_STAT_RCV_ETHERNET])); /* to bps, bit per second */
+
+ if((DEPOLYMENT_MODE_INLINE == sapp_global_val->config.packet_io.depolyment_mode_bin)
+ || (DEPOLYMENT_MODE_TRANSPARENT == sapp_global_val->config.packet_io.depolyment_mode_bin)){
+ sapp_fs2_update_count(SAPP_STAT_ETH_INBOUND, cur_count[SAPP_STAT_ETH_INBOUND]);
+ sapp_fs2_update_length(SAPP_STAT_ETH_INBOUND, 8 *( cur_length[SAPP_STAT_ETH_INBOUND])); /* to bps, bit per second */
+
+ sapp_fs2_update_count(SAPP_STAT_ETH_OUTBOUND, cur_count[SAPP_STAT_ETH_OUTBOUND]);
+ sapp_fs2_update_length(SAPP_STAT_ETH_OUTBOUND, 8 *( cur_length[SAPP_STAT_ETH_OUTBOUND])); /* to bps, bit per second */
+ }
sapp_fs2_update_count(SAPP_STAT_RCV_IPV4, cur_count[SAPP_STAT_RCV_IPV4]);
sapp_fs2_update_length(SAPP_STAT_RCV_IPV4, 8 *(cur_length[SAPP_STAT_RCV_IPV4]));
diff --git a/version.txt b/version.txt
index a4581d8..c0d058a 100644
--- a/version.txt
+++ b/version.txt
@@ -3,16 +3,16 @@
VCS_TYPE="git"
VCS_BASENAME="v4.0"
VCS_UUID="efa070923d8398b49f41acda82b839d11eb75230"
-VCS_NUM="145"
-VCS_DATE="2019-12-19T19:41:05+0800"
-VCS_BRANCH="sapp_v4"
+VCS_NUM="146"
+VCS_DATE="2019-12-26T14:19:33+0800"
+VCS_BRANCH="feature_inbound_outbound"
VCS_TAG="v4.0.7"
-VCS_TICK="1"
+VCS_TICK="2"
VCS_EXTRA=""
VCS_ACTION_STAMP=""
-VCS_FULL_HASH="86c5a186658644901d8ba049716f80ef890466a4"
-VCS_SHORT_HASH="86c5a18"
+VCS_FULL_HASH="98228e4e577f0df244beb0e2702776fa39877670"
+VCS_SHORT_HASH="98228e4"
VCS_WC_MODIFIED="1"