TSG-14930 TFE支持发送控制报文给SAPP
This commit is contained in:
@@ -26,7 +26,7 @@ struct tap_ctx
|
||||
char *buff;
|
||||
};
|
||||
|
||||
struct acceptor_thread_ctx
|
||||
struct packet_io_thread_ctx
|
||||
{
|
||||
pthread_t tid;
|
||||
int thread_index;
|
||||
@@ -36,7 +36,7 @@ struct acceptor_thread_ctx
|
||||
struct sf_metrics *sf_metrics;
|
||||
|
||||
struct packet_io *ref_io;
|
||||
struct global_metrics *ref_metrics;
|
||||
struct packet_io_fs *ret_fs_state;
|
||||
struct policy_enforcer *ref_enforcer;
|
||||
struct tfe_proxy *ref_proxy;
|
||||
struct acceptor_kni_v4 *ref_acceptor_ctx;
|
||||
@@ -71,7 +71,7 @@ struct session_ctx
|
||||
|
||||
struct tfe_cmsg *cmsg;
|
||||
|
||||
struct acceptor_thread_ctx *ref_thread_ctx;
|
||||
struct packet_io_thread_ctx *ref_thread_ctx;
|
||||
};
|
||||
|
||||
struct acceptor_kni_v4
|
||||
@@ -85,8 +85,8 @@ struct acceptor_kni_v4
|
||||
|
||||
cpu_set_t coremask;
|
||||
struct packet_io *io;
|
||||
struct global_metrics *metrics;
|
||||
struct acceptor_thread_ctx work_threads[TFE_THREAD_MAX];
|
||||
struct packet_io_fs *packet_io_fs;
|
||||
struct packet_io_thread_ctx work_threads[TFE_THREAD_MAX];
|
||||
|
||||
struct tfe_proxy *ref_proxy;
|
||||
};
|
||||
@@ -96,8 +96,8 @@ 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 acceptor_thread_ctx *thread_ctx);
|
||||
void packet_io_thread_wait(struct packet_io *handle, struct acceptor_thread_ctx *thread_ctx, int timeout_ms);
|
||||
int packet_io_thread_init(struct packet_io *handle, struct packet_io_thread_ctx *thread_ctx);
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef _GLOBAL_METRICS_H
|
||||
#define _GLOBAL_METRICS_H
|
||||
#ifndef _TFE_PACKET_IO_FS_H
|
||||
#define _TFE_PACKET_IO_FS_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
@@ -9,19 +9,14 @@ extern "C"
|
||||
#include "tfe_utils.h"
|
||||
#include <MESA/field_stat2.h>
|
||||
|
||||
struct global_metrics_config
|
||||
{
|
||||
char output_file[256];
|
||||
char statsd_server[32];
|
||||
int statsd_port;
|
||||
int statsd_format;
|
||||
int statsd_cycle;
|
||||
|
||||
int prometheus_listen_port;
|
||||
char prometheus_listen_url[256];
|
||||
struct throughput_metrics
|
||||
{
|
||||
uint64_t n_pkts;
|
||||
uint64_t n_bytes;
|
||||
};
|
||||
|
||||
struct global_metrics
|
||||
struct packet_io_fs
|
||||
{
|
||||
struct throughput_metrics raw_pkt_rx; // 累计值
|
||||
struct throughput_metrics raw_pkt_tx; // 累计值
|
||||
@@ -47,20 +42,18 @@ struct global_metrics
|
||||
uint64_t ctrl_pkt_resetall_num; // 累计值
|
||||
uint64_t ctrl_pkt_error_num; // 累计值
|
||||
|
||||
uint64_t sf_active_times; // 累计值
|
||||
uint64_t sf_inactive_times; // 累计值
|
||||
|
||||
uint64_t session_nums; // 瞬时值
|
||||
uint64_t send_log; // 瞬时值
|
||||
|
||||
struct global_metrics_config config;
|
||||
screen_stat_handle_t fs_handle;
|
||||
int fs_id[128];
|
||||
};
|
||||
|
||||
struct global_metrics *global_metrics_create();
|
||||
void global_metrics_destory(struct global_metrics *metrics);
|
||||
void global_metrics_dump(struct global_metrics *metrics);
|
||||
struct packet_io_fs *packet_io_fs_create();
|
||||
void packet_io_fs_destory(struct packet_io_fs *handle);
|
||||
void packet_io_fs_dump(struct packet_io_fs *handle);
|
||||
|
||||
void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
@@ -225,17 +225,5 @@ struct udp_hdr
|
||||
u_int16_t uh_sum; /* udp checksum */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
void build_udp_header(const char *l3_hdr, int l3_hdr_len, struct udp_hdr *udp_hdr, u_int16_t udp_sport, u_int16_t udp_dport, int payload_len);
|
||||
void build_ip_header(struct ip *ip_hdr, u_int8_t next_protocol, const char *src_addr, const char *dst_addr, uint16_t payload_len);
|
||||
void build_ether_header(struct ethhdr *eth_hdr, uint16_t next_protocol, const char *src_mac, const char *dst_mac);
|
||||
|
||||
int str_to_mac(const char *str, char *mac_buff);
|
||||
int get_mac_by_device_name(const char *dev_name, char *mac_buff);
|
||||
|
||||
struct throughput_metrics
|
||||
{
|
||||
uint64_t n_pkts;
|
||||
uint64_t n_bytes;
|
||||
};
|
||||
|
||||
void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes);
|
||||
|
||||
Reference in New Issue
Block a user