修改fieldstat字段的命名
This commit is contained in:
@@ -307,8 +307,8 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
if (!marsio_buff_is_ctrlbuf(rx_buffs[j]))
|
||||
{
|
||||
int raw_len = marsio_buff_datalen(rx_buffs[j]);
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_rx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_tx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_rx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_tx, 1, raw_len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
|
||||
if (is_downstream_keepalive_packet(rx_buff))
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->downlink_keepalive_packet_rx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->downlink_keepalive_pkt_rx, 1, raw_len);
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
|
||||
continue;
|
||||
}
|
||||
@@ -331,25 +331,25 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
if (marsio_buff_is_ctrlbuf(rx_buff))
|
||||
{
|
||||
handle_control_packet(handle, rx_buff, thread_seq, ctx);
|
||||
throughput_metrics_inc(&g_metrics->control_packet_rx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->ctrl_pkt_rx, 1, raw_len);
|
||||
// all control packet need bypass
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_rx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_rx, 1, raw_len);
|
||||
int action_bytes = 0;
|
||||
enum raw_pkt_action action = handle_raw_packet(handle, rx_buff, thread_seq, ctx, &action_bytes);
|
||||
assert(action_bytes > 0);
|
||||
switch (action)
|
||||
{
|
||||
case RAW_PKT_ERR_BYPASS:
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_err_bypass, 1, action_bytes);
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_tx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_err_bypass, 1, action_bytes);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_tx, 1, raw_len);
|
||||
break;
|
||||
case RAW_PKT_HIT_BYPASS:
|
||||
throughput_metrics_inc(&g_metrics->hit_bypass_policy, 1, action_bytes);
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_tx, 1, raw_len);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_tx, 1, raw_len);
|
||||
break;
|
||||
case RAW_PKT_HIT_BLOCK:
|
||||
throughput_metrics_inc(&g_metrics->hit_block_policy, 1, action_bytes);
|
||||
@@ -400,7 +400,7 @@ int packet_io_polling_endpoint(struct packet_io *handle, int thread_seq, void *c
|
||||
|
||||
if (is_upstream_keepalive_packet(rx_buff))
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->uplink_keepalive_packet_rx, 1, data_len);
|
||||
throughput_metrics_inc(&g_metrics->uplink_keepalive_pkt_rx, 1, data_len);
|
||||
marsio_buff_free(handle->instance, &rx_buff, 1, 0, thread_seq);
|
||||
continue;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ int packet_io_polling_endpoint(struct packet_io *handle, int thread_seq, void *c
|
||||
break;
|
||||
case INJT_PKT_HIT_FWD2NF: // forward to network function
|
||||
throughput_metrics_inc(&g_metrics->steering_rx, 1, data_len); // use data_len
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_tx, 1, action_bytes);
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_tx, 1, action_bytes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -636,7 +636,7 @@ static int handle_control_packet(struct packet_io *handle, marsio_buff_t *rx_buf
|
||||
{
|
||||
LOG_ERROR("%s: unexpected control packet, unable to get metadata", LOG_TAG_PKTIO);
|
||||
packet_io_dump_metadata(rx_buff, &meta);
|
||||
__atomic_fetch_add(&g_metrics->control_packet_error_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_error_num, 1, __ATOMIC_RELAXED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -645,14 +645,14 @@ static int handle_control_packet(struct packet_io *handle, marsio_buff_t *rx_buf
|
||||
if (ctrl_packet_parser_parse(&ctrl_parser, meta.raw_data + meta.l7_offset, meta.raw_len - meta.l7_offset) == -1)
|
||||
{
|
||||
LOG_ERROR("%s: unexpected control packet, unable to parse data", LOG_TAG_PKTIO);
|
||||
__atomic_fetch_add(&g_metrics->control_packet_error_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_error_num, 1, __ATOMIC_RELAXED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ctrl_parser.session_id != meta.session_id)
|
||||
{
|
||||
LOG_ERROR("%s: unexpected control packet, metadata's session %lu != control packet's session %lu", LOG_TAG_PKTIO, meta.session_id, ctrl_parser.session_id);
|
||||
__atomic_fetch_add(&g_metrics->control_packet_error_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_error_num, 1, __ATOMIC_RELAXED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -661,21 +661,21 @@ static int handle_control_packet(struct packet_io *handle, marsio_buff_t *rx_buf
|
||||
switch (ctrl_parser.state)
|
||||
{
|
||||
case SESSION_STATE_OPENING:
|
||||
__atomic_fetch_add(&g_metrics->control_packet_opening_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_opening_num, 1, __ATOMIC_RELAXED);
|
||||
// when session opening, firewall not send policy id
|
||||
// return handle_session_opening(&meta, &ctrl_parser, thread_seq, ctx);
|
||||
break;
|
||||
case SESSION_STATE_CLOSING:
|
||||
__atomic_fetch_add(&g_metrics->control_packet_closing_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_closing_num, 1, __ATOMIC_RELAXED);
|
||||
return handle_session_closing(&meta, &ctrl_parser, thread_seq, ctx);
|
||||
case SESSION_STATE_ACTIVE:
|
||||
__atomic_fetch_add(&g_metrics->control_packet_active_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_active_num, 1, __ATOMIC_RELAXED);
|
||||
return handle_session_active(&meta, &ctrl_parser, thread_seq, ctx);
|
||||
case SESSION_STATE_RESETALL:
|
||||
__atomic_fetch_add(&g_metrics->control_packet_resetall_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_resetall_num, 1, __ATOMIC_RELAXED);
|
||||
return handle_session_resetall(&meta, &ctrl_parser, thread_seq, ctx);
|
||||
default:
|
||||
__atomic_fetch_add(&g_metrics->control_packet_error_num, 1, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&g_metrics->ctrl_pkt_error_num, 1, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user