Optimize seq_sorter function for colo-compare
authorRao, Lei <lei.rao@intel.com>
Fri, 16 Oct 2020 05:52:00 +0000 (13:52 +0800)
committerJason Wang <jasowang@redhat.com>
Wed, 11 Nov 2020 08:52:23 +0000 (16:52 +0800)
The seq of tcp has been filled in fill_pkt_tcp_info, it
can be used directly here.

Signed-off-by: Lei Rao <lei.rao@intel.com>
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Reviewed-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/colo-compare.c

index 3a45d64175f00543f307a5234ea2b50487f50c97..a35c10fb59c0a1b66cb3e777b108eeede7966336 100644 (file)
@@ -194,13 +194,10 @@ static void colo_compare_inconsistency_notify(CompareState *s)
     }
 }
 
+/* Use restricted to colo_insert_packet() */
 static gint seq_sorter(Packet *a, Packet *b, gpointer data)
 {
-    struct tcp_hdr *atcp, *btcp;
-
-    atcp = (struct tcp_hdr *)(a->transport_header);
-    btcp = (struct tcp_hdr *)(b->transport_header);
-    return ntohl(atcp->th_seq) - ntohl(btcp->th_seq);
+    return a->tcp_seq - b->tcp_seq;
 }
 
 static void fill_pkt_tcp_info(void *data, uint32_t *max_ack)