packet io增加fieldstat状态统计

This commit is contained in:
wangmenglan
2023-05-15 16:41:59 +08:00
parent 935aa7235e
commit b931a3dc58
17 changed files with 780 additions and 757 deletions

View File

@@ -39,8 +39,8 @@ void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler);
// return 0 : success
// return -1 : error
int ctrl_packet_parser_parse(struct ctrl_pkt_parser *handler, const char *data, size_t length);
void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler);
int ctrl_packet_parser_parse(void *ctx, const char* data, size_t length, void *logger);
void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler, void *logger);
#ifdef __cpluscplus
}

View File

@@ -1,17 +0,0 @@
#ifndef _TFE_MPACK_H
#define _TFE_MPACK_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "tfe_cmsg.h"
int parse_messagepack(const char* data, size_t length, void *ctx);
#ifdef __cpluscplus
}
#endif
#endif

View File

@@ -33,14 +33,13 @@ struct packet_io_thread_ctx
struct tap_ctx *tap_ctx;
struct session_table *session_table;
struct sf_metrics *sf_metrics;
struct packet_io *ref_io;
struct packet_io_fs *ret_fs_state;
struct policy_enforcer *ref_enforcer;
struct tfe_proxy *ref_proxy;
struct packet_io_fs *ret_fs_state;
struct acceptor_kni_v4 *ref_acceptor_ctx;
void *logger;
int session_table_need_reset;
};
@@ -80,10 +79,9 @@ struct acceptor_kni_v4
int proxy_sids;
int sce_sids;
int nr_worker_threads;
int cpu_affinity_mask[TFE_THREAD_MAX];
cpu_set_t coremask;
struct packet_io *io;
struct packet_io_fs *packet_io_fs;
struct packet_io_thread_ctx work_threads[TFE_THREAD_MAX];
@@ -96,10 +94,10 @@ int is_enable_iouring(struct packet_io *handle);
void tfe_tap_ctx_destory(struct tap_ctx *handler);
struct tap_ctx *tfe_tap_ctx_create(void *ctx);
int packet_io_thread_init(struct packet_io *handle, struct packet_io_thread_ctx *thread_ctx);
int packet_io_thread_init(struct packet_io *handle, struct packet_io_thread_ctx *thread_ctx, void *logger);
void packet_io_thread_wait(struct packet_io *handle, struct packet_io_thread_ctx *thread_ctx, int timeout_ms);
void packet_io_destory(struct packet_io *handle);
struct packet_io *packet_io_create(const char *profile, int thread_num, cpu_set_t *coremask);
struct packet_io *packet_io_create(const char *profile, int thread_num, cpu_set_t *coremask, void *logger);
int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, void *ctx);
void handle_decryption_packet_from_tap(const char *data, int len, void *args);

View File

@@ -18,23 +18,28 @@ struct throughput_metrics
struct packet_io_fs
{
struct throughput_metrics raw_pkt_rx; // 累计值
struct throughput_metrics raw_pkt_tx; // 累计值
struct throughput_metrics raw_pkt_rx; // 累计值
struct throughput_metrics raw_pkt_tx; // 累计值
struct throughput_metrics hit_policy; // 累计值
struct throughput_metrics decrypt_tx; // 累计值
struct throughput_metrics decrypt_rx; // 累计值
struct throughput_metrics decrypt_tx; // 累计值
struct throughput_metrics decrypt_rx; // 累计值
struct throughput_metrics raw_bypass; // 累计值
struct throughput_metrics decrypt_rxdrop; // 累计值
struct throughput_metrics ctrl_pkt_rx; // 累计值
struct throughput_metrics ctrl_pkt_tx; // 累计值
struct throughput_metrics ctrl_pkt_rx; // 累计值
struct throughput_metrics ctrl_pkt_tx; // 累计值
struct throughput_metrics tap_pkt_rx; // 累计值
struct throughput_metrics tap_pkt_tx; // 累计值
struct throughput_metrics tap_c_pkt_rx; // 累计值
struct throughput_metrics tap_c_pkt_tx; // 累计值
struct throughput_metrics tap_s_pkt_rx; // 累计值
struct throughput_metrics tap_s_pkt_tx; // 累计值
struct throughput_metrics keepalived_pkt_rx; // 累计值
struct throughput_metrics keepalived_pkt_tx; // 累计值
struct throughput_metrics tap_pkt_rx; // 累计值
struct throughput_metrics tap_pkt_tx; // 累计值
struct throughput_metrics tap_pkt_rxdrop; // 累计值
struct throughput_metrics tap_c_pkt_rx; // 累计值
struct throughput_metrics tap_c_pkt_tx; // 累计值
struct throughput_metrics tap_s_pkt_rx; // 累计值
struct throughput_metrics tap_s_pkt_tx; // 累计值
uint64_t ctrl_pkt_opening_num; // 累计值
uint64_t ctrl_pkt_active_num; // 累计值
@@ -42,14 +47,14 @@ struct packet_io_fs
uint64_t ctrl_pkt_resetall_num; // 累计值
uint64_t ctrl_pkt_error_num; // 累计值
uint64_t session_nums; // 瞬时值
uint64_t send_log; // 瞬时值
uint64_t session_num; // 瞬时值
uint64_t session_log; // 瞬时值
screen_stat_handle_t fs_handle;
int fs_id[128];
};
struct packet_io_fs *packet_io_fs_create();
struct packet_io_fs *packet_io_fs_create(const char *profile);
void packet_io_fs_destory(struct packet_io_fs *handle);
void packet_io_fs_dump(struct packet_io_fs *handle);

View File

@@ -78,19 +78,19 @@ struct raw_pkt_parser
void raw_packet_parser_init(struct raw_pkt_parser *handler, uint64_t pkt_trace_id, enum layer_type expect_type, uint16_t expect_results_num);
// return most inner payload
const void *raw_packet_parser_parse(struct raw_pkt_parser *handler, const void *data, size_t length);
const void *raw_packet_parser_parse(struct raw_pkt_parser *handler, const void *data, size_t length, void *logger);
// return 0 : success
// return -1 : error
int raw_packet_parser_get_most_inner_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
int raw_packet_parser_get_most_outer_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
int raw_packet_parser_get_most_inner_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr, void *logger);
int raw_packet_parser_get_most_outer_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr, void *logger);
// return 0 : success
// return -1 : error
int raw_packet_parser_get_most_inner_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
int raw_packet_parser_get_most_outer_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
int raw_packet_parser_get_most_inner_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr, void *logger);
int raw_packet_parser_get_most_outer_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr, void *logger);
uint64_t raw_packet_parser_get_hash_value(struct raw_pkt_parser *handler, enum ldbc_method method, int dir_is_internal);
uint64_t raw_packet_parser_get_hash_value(struct raw_pkt_parser *handler, enum ldbc_method method, int dir_is_internal, void *logger);
#ifdef __cpluscplus
}