diff options
| author | luwenpeng <[email protected]> | 2023-11-22 16:33:52 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2023-11-22 16:33:52 +0800 |
| commit | 81679c4d2260792fa8f41e5f4feecd0388b64951 (patch) | |
| tree | 205c8d14c596399036cd6dceb2ac387542526605 /platform/src | |
| parent | d981c59dba21859f8157520225b8a8f4a5107d07 (diff) | |
perf: 减少marsio_buff_is_ctrlbuf的调用以提升性能
Diffstat (limited to 'platform/src')
| -rw-r--r-- | platform/src/packet_io.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/platform/src/packet_io.cpp b/platform/src/packet_io.cpp index b514c20..5066881 100644 --- a/platform/src/packet_io.cpp +++ b/platform/src/packet_io.cpp @@ -100,9 +100,8 @@ int mbuff_get_metadata(marsio_buff_t *rx_buff, struct metadata *meta) return -1; } - if (marsio_buff_is_ctrlbuf(rx_buff)) + if (meta->is_ctrl_pkt) { - meta->is_ctrl_pkt = 1; if (marsio_buff_get_metadata(rx_buff, MR_BUFF_PAYLOAD_OFFSET, &(meta->l7offset), sizeof(meta->l7offset)) <= 0) { LOG_ERROR("%s: unable to get l7offset from metadata", LOG_TAG_PKTIO); @@ -111,7 +110,6 @@ int mbuff_get_metadata(marsio_buff_t *rx_buff, struct metadata *meta) } else { - meta->is_ctrl_pkt = 0; uint16_t user_data = 0; if (marsio_buff_get_metadata(rx_buff, MR_BUFF_USER_0, &user_data, sizeof(user_data)) <= 0) { @@ -1040,6 +1038,7 @@ static void handle_control_packet(marsio_buff_t *rx_buff, struct thread_ctx *thr struct control_packet ctrl_pkt; memset(&meta, 0, sizeof(struct metadata)); + meta.is_ctrl_pkt = 1; meta.raw_len = raw_len; meta.raw_data = marsio_buff_mtod(rx_buff); if (mbuff_get_metadata(rx_buff, &meta) == -1) @@ -1099,6 +1098,7 @@ static void handle_data_packet(marsio_buff_t *rx_buff, struct thread_ctx *thread struct selected_chaining *chaining = NULL; memset(&meta, 0, sizeof(struct metadata)); + meta.is_ctrl_pkt = 0; meta.raw_len = raw_len; meta.raw_data = marsio_buff_mtod(rx_buff); if (mbuff_get_metadata(rx_buff, &meta) == -1) |
