colo-compare: Insert packet into the suitable position of packet queue directly
commit8850d4caa7ad3f50adb2dd8d89842c67ae81a4b2
authorMao Zhongyi <maozy.fnst@cn.fujitsu.com>
Fri, 13 Oct 2017 06:32:06 +0000 (13 14:32 +0800)
committerJason Wang <jasowang@redhat.com>
Mon, 13 Nov 2017 07:46:37 +0000 (13 15:46 +0800)
treea0f76e50b46bc843bb22f6564d12e7f5010fb9ff
parentff86d5762552787f1fcb7da695ec4f8c1be754b4
colo-compare: Insert packet into the suitable position of packet queue directly

Currently, a packet from pri_dev or sec_dev is fristly pushed at the
tail of the primary or secondary packet queue then sorted by the tcp
sequence number.

Now, this patch use g_queue_insert_sorted to insert the packet directly
into the suitable position to avoid ordering all packets each time when
a new packet is comming, thereby increasing efficiency.

In addition, consolidate the code that add a packet to the list of
Connection (primary or secondary) into a separate routine colo_insert_packet()
since the same chunk of code is called from two place.

Cc: Zhang Chen <zhangckid@gmail.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Signed-off-by: Zhang Chen <zhangckid@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/colo-compare.c