From 81679c4d2260792fa8f41e5f4feecd0388b64951 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Wed, 22 Nov 2023 16:33:52 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=87=8F=E5=B0=91marsio=5Fbuff=5Fis=5F?= =?UTF-8?q?ctrlbuf=E7=9A=84=E8=B0=83=E7=94=A8=E4=BB=A5=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/src/packet_io.cpp | 6 +++--- 1 file 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)