Packet IO支持单向流发送日志

This commit is contained in:
wangmenglan
2023-06-06 19:28:56 +08:00
parent a97a90ac7d
commit 396f8426f9

View File

@@ -1514,6 +1514,7 @@ static int handle_raw_packet_from_nf(struct packet_io *handle, marsio_buff_t *rx
struct packet_io *packet_io = thread->ref_io; struct packet_io *packet_io = thread->ref_io;
struct packet_io_fs *packet_io_fs = thread->ret_fs_state; struct packet_io_fs *packet_io_fs = thread->ret_fs_state;
int is_ipv4 = 0; int is_ipv4 = 0;
uint8_t flag = 0;
char *header = NULL; char *header = NULL;
int header_len = 0; int header_len = 0;
void * logger = thread->logger; void * logger = thread->logger;
@@ -1548,6 +1549,12 @@ static int handle_raw_packet_from_nf(struct packet_io *handle, marsio_buff_t *rx
throughput_metrics_inc(&s_ctx->c2s_info.rx, 1, raw_len); throughput_metrics_inc(&s_ctx->c2s_info.rx, 1, raw_len);
else else
throughput_metrics_inc(&s_ctx->s2c_info.rx, 1, raw_len); throughput_metrics_inc(&s_ctx->s2c_info.rx, 1, raw_len);
flag = tfe_cmsg_get_flag(s_ctx->cmsg);
if (flag & TFE_CMSG_FLAG_USER0) {
send_event_log(s_ctx, thread_seq, ctx);
tfe_cmsg_set_flag(s_ctx->cmsg, TFE_CMSG_FLAG_INIT);
}
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1); marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
return 0; return 0;
} }
@@ -1640,7 +1647,7 @@ static int handle_raw_packet_from_nf(struct packet_io *handle, marsio_buff_t *rx
throughput_metrics_inc(&packet_io_fs->tap_pkt_tx, 1, raw_len); throughput_metrics_inc(&packet_io_fs->tap_pkt_tx, 1, raw_len);
} }
uint8_t flag = tfe_cmsg_get_flag(s_ctx->cmsg); flag = tfe_cmsg_get_flag(s_ctx->cmsg);
if (flag & TFE_CMSG_FLAG_USER0) { if (flag & TFE_CMSG_FLAG_USER0) {
send_event_log(s_ctx, thread_seq, ctx); send_event_log(s_ctx, thread_seq, ctx);
tfe_cmsg_set_flag(s_ctx->cmsg, TFE_CMSG_FLAG_INIT); tfe_cmsg_set_flag(s_ctx->cmsg, TFE_CMSG_FLAG_INIT);