From 08db0069d623d35de69999ba1dfbc9ed1a5b78d6 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Thu, 14 Mar 2024 16:49:56 +0800
Subject: [PATCH] transfer pbuf timestamp in ip frag

---
 src/core/ipv4/ip4_frag.c | 5 +++++
 src/include/lwipsock.h   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index d9bf5cc..aa50856 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -39,6 +39,7 @@
  */
 
 #include "lwip/opt.h"
+#include "lwipsock.h"
 
 #if LWIP_IPV4
 
@@ -800,6 +801,10 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
     if (rambuf == NULL) {
       goto memerr;
     }
+#if GAZELLE_ENABLE
+    /* transfer time stamp to new pbuf */
+    time_stamp_transfer_pbuf(p, rambuf);
+#endif
     LWIP_ASSERT("this needs a pbuf in one piece!",
                 (rambuf->len == rambuf->tot_len) && (rambuf->next == NULL));
     poff += pbuf_copy_partial(p, rambuf->payload, fragsize, poff);
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index f4cb1de..dc2e9d3 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -182,6 +182,7 @@ extern err_t same_node_ring_create(struct rte_ring **ring, int size, int port, c
 extern err_t create_same_node_ring(struct tcp_pcb *pcb);
 extern err_t find_same_node_ring(struct tcp_pcb *pcb);
 extern void lstack_calculate_aggregate(int type, uint32_t len);
+extern void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new);
 #endif /* GAZELLE_ENABLE */
 
 struct lwip_sock *get_socket(int s);
-- 
2.33.0

