修正fieldstat的hit_bypass_pkt字段
This commit is contained in:
@@ -69,7 +69,8 @@ enum raw_pkt_action
|
||||
RAW_PKT_ERR_BYPASS,
|
||||
RAW_PKT_HIT_BYPASS,
|
||||
RAW_PKT_HIT_BLOCK,
|
||||
RAW_PKT_HIT_FORWARD,
|
||||
RAW_PKT_HIT_STEERING,
|
||||
RAW_PKT_HIT_MIRRORING,
|
||||
};
|
||||
|
||||
enum inject_pkt_action
|
||||
@@ -126,7 +127,8 @@ static int handle_control_packet(struct packet_io *handle, marsio_buff_t *rx_buf
|
||||
// return : RAW_PKT_ERR_BYPASS
|
||||
// return : RAW_PKT_HIT_BYPASS
|
||||
// return : RAW_PKT_HIT_BLOCK
|
||||
// reutrn : RAW_PKT_HIT_FORWARD
|
||||
// reutrn : RAW_PKT_HIT_STEERING
|
||||
// return : RAW_PKT_HIT_MIRRORING
|
||||
static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx, int *action_bytes);
|
||||
// return : INJT_PKT_ERR_DROP
|
||||
// return : INJT_PKT_MIRR_RX_DROP
|
||||
@@ -355,10 +357,13 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
case RAW_PKT_HIT_BLOCK:
|
||||
throughput_metrics_inc(&g_metrics->hit_block_policy, 1, action_bytes);
|
||||
break;
|
||||
case RAW_PKT_HIT_FORWARD:
|
||||
case RAW_PKT_HIT_STEERING:
|
||||
throughput_metrics_inc(&g_metrics->steering_tx, 1, action_bytes);
|
||||
throughput_metrics_inc(&g_metrics->dev_endpoint_tx, 1, action_bytes);
|
||||
break;
|
||||
case RAW_PKT_HIT_MIRRORING:
|
||||
throughput_metrics_inc(&g_metrics->raw_pkt_tx, 1, action_bytes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -689,7 +694,8 @@ static int handle_control_packet(struct packet_io *handle, marsio_buff_t *rx_buf
|
||||
// return : RAW_PKT_ERR_BYPASS
|
||||
// return : RAW_PKT_HIT_BYPASS
|
||||
// return : RAW_PKT_HIT_BLOCK
|
||||
// reutrn : RAW_PKT_HIT_FORWARD
|
||||
// reutrn : RAW_PKT_HIT_STEERING
|
||||
// return : RAW_PKT_HIT_MIRRORING
|
||||
static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx, int *action_bytes)
|
||||
{
|
||||
int nsend = 0;
|
||||
@@ -770,6 +776,7 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
||||
return RAW_PKT_ERR_BYPASS;
|
||||
}
|
||||
|
||||
int last_sf_is_action_bypass = 1;
|
||||
for (int i = 0; i < chaining->chaining_used; i++)
|
||||
{
|
||||
struct selected_sf *node = &(chaining->chaining[i]);
|
||||
@@ -785,6 +792,7 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
||||
{
|
||||
case SESSION_ACTION_BYPASS:
|
||||
// BYPASS CURRENT SF
|
||||
last_sf_is_action_bypass = 1;
|
||||
continue;
|
||||
case SESSION_ACTION_BLOCK:
|
||||
// BLOCK ALL SF
|
||||
@@ -811,7 +819,7 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
||||
sf_metrics_inc(thread->sf_metrics, node->policy_id, node->sff_profile_id, node->sf_profile_id, 0, 0, 1, nsend);
|
||||
throughput_metrics_inc(&node->tx, 1, nsend);
|
||||
*action_bytes = nsend;
|
||||
return RAW_PKT_HIT_FORWARD;
|
||||
return RAW_PKT_HIT_STEERING;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -833,6 +841,7 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
||||
throughput_metrics_inc(&node->tx, 1, nsend);
|
||||
throughput_metrics_inc(&g_metrics->mirroring_tx, 1, nsend);
|
||||
throughput_metrics_inc(&g_metrics->dev_endpoint_tx, 1, nsend);
|
||||
last_sf_is_action_bypass = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -845,15 +854,24 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
||||
}
|
||||
|
||||
default:
|
||||
last_sf_is_action_bypass = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// BYPASS ALL SF or LAST SF IS MIRRORING
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
|
||||
*action_bytes = raw_len;
|
||||
|
||||
if (last_sf_is_action_bypass)
|
||||
{
|
||||
// BYPASS ALL SF or LAST SF IS MIRRORING
|
||||
return RAW_PKT_HIT_BYPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RAW_PKT_HIT_MIRRORING;
|
||||
}
|
||||
}
|
||||
|
||||
// return : INJT_PKT_ERR_DROP
|
||||
// return : INJT_PKT_MIRR_RX_DROP
|
||||
|
||||
Reference in New Issue
Block a user