diff options
| author | lijia <[email protected]> | 2020-07-14 10:52:52 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2020-07-14 10:52:52 +0800 |
| commit | db28a38b27fe0adf71b2ec62f392e937d8c6e47b (patch) | |
| tree | de98827a117554cc2bce9d547d6adb92219dd36f | |
| parent | d22950558954272a566c739a1c98da6772caddd6 (diff) | |
1.marsio模式无包时刷新缓冲区队列; 2.增加获取udp流信息接口;v4.0.17
| -rw-r--r-- | include/public/stream_inc/stream_control.h | 14 | ||||
| -rw-r--r-- | src/inner_plug/sapp_assistant.cpp | 49 | ||||
| -rw-r--r-- | src/packet_io/packet_io_marsio.c | 16 |
3 files changed, 67 insertions, 12 deletions
diff --git a/include/public/stream_inc/stream_control.h b/include/public/stream_inc/stream_control.h index 5f6b4c4..927e957 100644 --- a/include/public/stream_inc/stream_control.h +++ b/include/public/stream_inc/stream_control.h @@ -34,10 +34,10 @@ enum MESA_stream_opt{ MSO_GLOBAL_STREAM_ID, /* opt_val type must be unsigned long long, is value-result argument, IN: device_id, value range[0, 4095]; OUT:global stream id */
MSO_DROP_STREAM, /* opt_val type must be int, value only be [0,1]; similar to DROPPKT, but effective scope is stream. */
MSO_TCP_RST_REMEDY, /* opt_val type must be int, value only be [0,1]; if not set this, default is disable. */
- MSO_TOTAL_INBOUND_PKT, /* opt_val type must be unsigned long long */
- MSO_TOTAL_INBOUND_BYTE, /* opt_val type must be unsigned long long */
- MSO_TOTAL_OUTBOUND_PKT, /* opt_val type must be unsigned long long */
- MSO_TOTAL_OUTBOUND_BYTE,/* opt_val type must be unsigned long long */
+ MSO_TOTAL_INBOUND_PKT, /* inbound packet number of this stream, opt_val type must be unsigned long long */
+ MSO_TOTAL_INBOUND_BYTE, /* inbound packet byte of this stream, opt_val type must be unsigned long long */
+ MSO_TOTAL_OUTBOUND_PKT, /* outbound packet pkt of this stream, opt_val type must be unsigned long long */
+ MSO_TOTAL_OUTBOUND_BYTE,/* outbound packet byte of this stream, opt_val type must be unsigned long long */
__MSO_MAX,
};
@@ -68,8 +68,6 @@ enum sapp_platform_opt{ SPO_FIELD_STAT_HANDLE, /* field stat output handle, opt_val type must be void * */
SPO_INDEPENDENT_THREAD_ID, /* plug independent thread which is created by pthread_create(), opt_val type must be int */
SPO_DEPLOYMENT_MODE_STR, /* opt_val type is char[], optional value is:["mirror", "inline", "transparent"] */
- //SPO_TOTAL_EGRESS_PKT, /* total egress packet number, effective in inline or transparent mode, opt_val type must be unsigned long long */
- //SPO_TOTAL_EGRESS_BYTE, /* total egress packet byte, effective in inline or transparent mode, opt_val type must be unsigned long long */
SPO_TCP_STREAM_NEW, /* total created tcp streams from start, opt_val type must be unsigned long long */
SPO_TCP_STREAM_CLOSE, /* total closed tcp streams from start, opt_val type must be unsigned long long */
SPO_TCP_STREAM_ESTAB, /* realtime established tcp streams, opt_val type must be unsigned long long */
@@ -77,6 +75,10 @@ enum sapp_platform_opt{ SPO_TOTAL_INBOUND_BYTE, /* total inbound packet bytes, opt_val type must be unsigned long long */
SPO_TOTAL_OUTBOUND_PKT, /* total outbound packet number, opt_val type must be unsigned long long */
SPO_TOTAL_OUTBOUND_BYTE, /* total outbound packet bytes, opt_val type must be unsigned long long */
+
+ SPO_UDP_STREAM_NEW, /* total created udp streams from start, opt_val type must be unsigned long long */
+ SPO_UDP_STREAM_CLOSE, /* total closed udp streams from start, opt_val type must be unsigned long long */
+ SPO_UDP_STREAM_CONCURRENT, /* realtime Concurrent udp streams, opt_val type must be unsigned long long */
};
diff --git a/src/inner_plug/sapp_assistant.cpp b/src/inner_plug/sapp_assistant.cpp index bed677b..b88aedd 100644 --- a/src/inner_plug/sapp_assistant.cpp +++ b/src/inner_plug/sapp_assistant.cpp @@ -215,8 +215,8 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va 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_TCP_STREAM_NEW); + unsigned long long *tot_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_NEW); } break; @@ -227,8 +227,8 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va 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_TCP_STREAM_DATA); + unsigned long long *tot_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_DATA); } break; @@ -239,11 +239,48 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va 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_TCP_STREAM_DEL); + unsigned long long *tot_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_DEL); } break; + case SPO_UDP_STREAM_NEW: + { + 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_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_UDP_STREAM_NEW); + } + break; + + case SPO_UDP_STREAM_CONCURRENT: + { + 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_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_UDP_STREAM_TWO); + } + break; + + + case SPO_UDP_STREAM_CLOSE: + { + 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_num = (unsigned long long *)opt_val; + *tot_num = __get_platform_opt_traffic('c', SAPP_STAT_UDP_STREAM_DEL); + } + break; + case SPO_THREAD_COUNT: { if(*opt_val_len != sizeof(int)){ diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c index 05f0d3f..7df69c7 100644 --- a/src/packet_io/packet_io_marsio.c +++ b/src/packet_io/packet_io_marsio.c @@ -50,6 +50,7 @@ static int marsio4_burst_process_pkt_num = 32; /* ������������, ��pag.conf�л�ȡ extern void timestamp_region_update_driver(int tid, long long cpu_cycle); extern int stream_process_polling(int thread_seq); +extern void marsio_send_burst_flush(struct mr_sendpath * sendpath, queue_id_t sid); /************************ funcitons for dynamic link *************************/ @@ -641,6 +642,20 @@ static inline void marsio4_sleep(int tot_call_times, int rcv_pkt_times) */ } +/* ������ģʽ��, marsio�����л���, ���°�����ʱ��Ҫ����ˢ�¶����е����� */ +static inline void flush_buf(int tid) +{ + int i; + + for(i = 0; i < g_mr4_device_num; i++){ + marsio_send_burst_flush(g_mr4_sendpath_up_set[i], tid); + + if(NET_CONN_SERIAL_2CARD == g_marsio4_topology_mode){ + marsio_send_burst_flush(g_mr4_sendpath_down_set[i], tid); + } + } +} + static void *marsio4_worker(void *arg) { int tid = *((int *)arg); @@ -669,6 +684,7 @@ static void *marsio4_worker(void *arg) if(marsio4_process_packet(tid, &raw_pkt) > 0){ rcv_pkt_tims++; }else{ + flush_buf(tid); /* �ް�ʱҪ����polling�ӿ� */ if(stream_process_polling(tid) > 0){ polling_work_times++; |
