perf: action_sf_chaining调用的小函数定义为inline
This commit is contained in:
@@ -92,7 +92,11 @@ struct throughput_metrics
|
|||||||
uint64_t n_bytes;
|
uint64_t n_bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes);
|
static inline void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes)
|
||||||
|
{
|
||||||
|
iterm->n_bytes += n_bytes;
|
||||||
|
iterm->n_pkts += n_pkts;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* device
|
* device
|
||||||
|
|||||||
@@ -143,16 +143,6 @@ void route_ctx_copy(struct route_ctx *dst, struct route_ctx *src)
|
|||||||
dst->len = src->len;
|
dst->len = src->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* throughput_metrics
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes)
|
|
||||||
{
|
|
||||||
iterm->n_bytes += n_bytes;
|
|
||||||
iterm->n_pkts += n_pkts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* device
|
* device
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ void vlan_encapsulate(marsio_buff_t *mbuff, int vlan_id, int replace_orig_vlan_h
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_packet_to_sf(struct session_ctx *session_ctx, marsio_buff_t *mbuff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline int send_packet_to_sf(struct session_ctx *session_ctx, marsio_buff_t *mbuff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
thread_ctx->tx_packets_ipid++;
|
thread_ctx->tx_packets_ipid++;
|
||||||
int nsend = 0;
|
int nsend = 0;
|
||||||
@@ -533,9 +533,9 @@ static int send_packet_to_sf(struct session_ctx *session_ctx, marsio_buff_t *mbu
|
|||||||
return nsend;
|
return nsend;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_nf_inject(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx);
|
static inline int action_nf_inject(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx);
|
||||||
|
|
||||||
static void action_err_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_err_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ static void action_err_bypass(marsio_buff_t *rx_buff, struct metadata *meta, str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_err_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_err_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
struct packet_io *packet_io = thread_ctx->ref_io;
|
struct packet_io *packet_io = thread_ctx->ref_io;
|
||||||
@@ -558,7 +558,7 @@ static void action_err_block(marsio_buff_t *rx_buff, struct metadata *meta, stru
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return nsend
|
// return nsend
|
||||||
static int action_nf_inject(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline int action_nf_inject(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
struct packet_io *packet_io = thread_ctx->ref_io;
|
struct packet_io *packet_io = thread_ctx->ref_io;
|
||||||
@@ -577,7 +577,7 @@ static int action_nf_inject(marsio_buff_t *rx_buff, struct metadata *meta, struc
|
|||||||
return raw_len;
|
return raw_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_mirr_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_mirr_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
|
|
||||||
@@ -585,7 +585,7 @@ static void action_mirr_bypass(marsio_buff_t *rx_buff, struct metadata *meta, st
|
|||||||
throughput_metrics_inc(&(thread_metrics->data_pkt.mirr_bypass), 1, raw_len);
|
throughput_metrics_inc(&(thread_metrics->data_pkt.mirr_bypass), 1, raw_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_mirr_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_mirr_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ static void action_mirr_block(marsio_buff_t *rx_buff, struct metadata *meta, str
|
|||||||
throughput_metrics_inc(&(thread_metrics->data_pkt.mirr_block), 1, raw_len);
|
throughput_metrics_inc(&(thread_metrics->data_pkt.mirr_block), 1, raw_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_mirr_forward(struct session_ctx *session_ctx, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_mirr_forward(struct session_ctx *session_ctx, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
struct packet_io *packet_io = thread_ctx->ref_io;
|
struct packet_io *packet_io = thread_ctx->ref_io;
|
||||||
@@ -618,7 +618,7 @@ static void action_mirr_forward(struct session_ctx *session_ctx, marsio_buff_t *
|
|||||||
sf_metrics_inc(thread_ctx->sf_metrics, sf->rule_vsys_id, sf->rule_id, sf->sff_profile_id, sf->sf_profile_id, 0, 0, 1, nsend);
|
sf_metrics_inc(thread_ctx->sf_metrics, sf->rule_vsys_id, sf->rule_id, sf->sff_profile_id, sf->sf_profile_id, 0, 0, 1, nsend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_stee_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_stee_bypass(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
|
|
||||||
@@ -626,7 +626,7 @@ static void action_stee_bypass(marsio_buff_t *rx_buff, struct metadata *meta, st
|
|||||||
throughput_metrics_inc(&(thread_metrics->data_pkt.stee_bypass), 1, raw_len);
|
throughput_metrics_inc(&(thread_metrics->data_pkt.stee_bypass), 1, raw_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_stee_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_stee_block(marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
struct packet_io *packet_io = thread_ctx->ref_io;
|
struct packet_io *packet_io = thread_ctx->ref_io;
|
||||||
@@ -637,7 +637,7 @@ static void action_stee_block(marsio_buff_t *rx_buff, struct metadata *meta, str
|
|||||||
marsio_buff_free(packet_io->instance, &rx_buff, 1, 0, thread_index);
|
marsio_buff_free(packet_io->instance, &rx_buff, 1, 0, thread_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action_stee_forward(struct session_ctx *session_ctx, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
static inline void action_stee_forward(struct session_ctx *session_ctx, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, struct thread_ctx *thread_ctx)
|
||||||
{
|
{
|
||||||
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
struct thread_metrics *thread_metrics = &thread_ctx->thread_metrics;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user