summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiuwen Lu <[email protected]>2016-11-29 16:01:42 +0800
committerQiuwen Lu <[email protected]>2016-11-29 16:01:42 +0800
commit728d2220d8c08ecb2d2fc224a66de555197e5dc2 (patch)
treea1536d07589a5c96ebe8e1e38f32db465c46c313
parentae3de4e24ffd8139df535f67ae8b0ed7a9a7baaa (diff)
合并Bug修复:Append数据包错误
-rw-r--r--core/src/buffer.c19
-rw-r--r--include/marsio_buffer_user_api.h3
2 files changed, 12 insertions, 10 deletions
diff --git a/core/src/buffer.c b/core/src/buffer.c
index 615bd3d..a402c4b 100644
--- a/core/src/buffer.c
+++ b/core/src/buffer.c
@@ -264,13 +264,18 @@ void marsio_buff_free(marsio_buff_t *marsio_buff[], unsigned int nb_buff)
return;
}
-void marsio_buff_append_pkt(marsio_buff_t *previous, marsio_buff_t *next)
-{
- mrbuf_priv(previous)->next = next;
-}
-void marsio_buff_append_seg(marsio_buff_t *previous, marsio_buff_t *next)
-{
- ((struct rte_mbuf *)previous)->next = next;
+void marsio_buff_append_pkt(marsio_buff_t *head, marsio_buff_t *next)
+{
+ marsio_buff_t *p = head;
+ while (mrbuf_priv(p)->next != NULL)
+ {
+ p = mrbuf_priv(p)->next;
+ }
+ mrbuf_priv(p)->next = next;
+}
+void marsio_buff_append_seg(marsio_buff_t *head, marsio_buff_t *next)
+{
+ rte_pktmbuf_chain((struct rte_mbuf *)head, (struct rte_mbuf *)next);
}
marsio_buff_t *marsio_buff_getnext_seg(marsio_buff_t *m)
diff --git a/include/marsio_buffer_user_api.h b/include/marsio_buffer_user_api.h
index 9c4a09e..1aabae1 100644
--- a/include/marsio_buffer_user_api.h
+++ b/include/marsio_buffer_user_api.h
@@ -36,9 +36,6 @@ void marsio_buff_append_seg(marsio_buff_t *head, marsio_buff_t *next);
uint16_t marsio_buff_headroom(const marsio_buff_t *m);
uint16_t marsio_buff_tailroom(const marsio_buff_t *m);
-void marsio_buff_append_pkt(marsio_buff_t *previous, marsio_buff_t *next);
-void marsio_buff_append_seg(marsio_buff_t *previous, marsio_buff_t *next);
-
marsio_buff_t *marsio_buff_getnext_seg(marsio_buff_t *m);
marsio_buff_t *marsio_buff_getnext_pkt(marsio_buff_t *m);