diff options
| author | root <[email protected]> | 2023-12-21 02:40:50 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2023-12-21 02:40:50 +0000 |
| commit | ff98a9063d2070b11e7c6f6cfbe1abeb59c4e6cd (patch) | |
| tree | d5f457308d28a5dba54aafd4229cb27439e6e582 /shaping/src | |
| parent | 4f76c20b6c303b1e3dd7a9514c94f2db554ad88c (diff) | |
performance optimize
Diffstat (limited to 'shaping/src')
| -rw-r--r-- | shaping/src/shaper.cpp | 9 | ||||
| -rw-r--r-- | shaping/src/shaper_marsio.cpp | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp index de31504..4ebc436 100644 --- a/shaping/src/shaper.cpp +++ b/shaping/src/shaper.cpp @@ -1219,7 +1219,6 @@ void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) struct shaping_flow *sf = NULL; struct metadata meta; int rx_num; - int i; rx_num = marsio_recv_burst(ctx->marsio_info->mr_dev, ctx->thread_index, rx_buff, ctx->marsio_info->rx_brust_max); if (rx_num <= 0) { @@ -1227,7 +1226,8 @@ void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) return; } - for (i = 0; i < rx_num; i++) { + prefetch(rx_buff[0]); + for (int i = 0; i < rx_num; i++) { if (marsio_buff_is_ctrlbuf(rx_buff[i])) { sf = shaper_ctrl_pkt_session_handle(ctx, rx_buff[i], &meta); } else { @@ -1235,13 +1235,16 @@ void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) } shaper_global_stat_throughput_rx_inc(&ctx->thread_global_stat, meta.raw_len); - if (meta.is_ctrl_pkt || !sf || sf->rule_num == 0) {//ctrl pkt need send directly + if (meta.is_ctrl_pkt || !sf) {//ctrl pkt need send directly marsio_send_burst(ctx->marsio_info->mr_path, ctx->thread_index, &rx_buff[i], 1); shaper_global_stat_throughput_tx_inc(&ctx->thread_global_stat, meta.raw_len); } else { shaping_packet_process(ctx, rx_buff[i], &meta, sf); } + polling_entry(ctx->sp, ctx->stat, ctx); + + prefetch(rx_buff[i+1]); } return; diff --git a/shaping/src/shaper_marsio.cpp b/shaping/src/shaper_marsio.cpp index 627691a..357e818 100644 --- a/shaping/src/shaper_marsio.cpp +++ b/shaping/src/shaper_marsio.cpp @@ -34,7 +34,7 @@ static int shaper_marsio_config_load(struct shaper_marsio_config *conf) return ret; } - ret = MESA_load_profile_int_def(SHAPING_GLOBAL_CONF_FILE, "SYSTEM", "RX_BRUST_MAX", &conf->rx_brust_max, 1); + ret = MESA_load_profile_int_def(SHAPING_GLOBAL_CONF_FILE, "MARSIO", "RX_BRUST_MAX", &conf->rx_brust_max, 1); conf->rx_brust_max = conf->rx_brust_max <= SHAPER_MARSIO_RX_BRUST_MAX ? conf->rx_brust_max : SHAPER_MARSIO_RX_BRUST_MAX; return 0; |
