gro: fix the chain index in insert_new_item for more than 2 packets
Checks
Commit Message
From: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
When more than two packets are merged in a flow, and if we receive
a 3rd packet which is matching the sequence of the 2nd packet the
prev_idx will be 1 and not 2, hence resulting in packet re-ordering
Signed-off-by: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
---
V1:
Initial changes to fix packet reordering issue when
more than 2 items are chained in a flow.
Ex:
3 mergeable TCP packets received in order.
packet_0 - no flow found so insert the packet and new start
index -> 0
packet_1-> flow found. prev_idx, curr_index = 0. So merge works
find packet_0->packet_1
packet_2 flow found. prev_indx =0, curr_index = 1. Matching
dequence numbers found but chained as
packet_0->packet_2->packet_1
lib/gro/gro_tcp4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
> -----Original Message-----
> From: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
> Sent: Wednesday, September 7, 2022 5:32 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>
> Cc: dev@dpdk.org; Kumara Parameshwaran
> <kumaraparamesh92@gmail.com>
> Subject: [PATCH] gro: fix the chain index in insert_new_item for more than 2
> packets
>
> From: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
>
> When more than two packets are merged in a flow, and if we receive a 3rd
> packet which is matching the sequence of the 2nd packet the prev_idx will
> be 1 and not 2, hence resulting in packet re-ordering
>
> Signed-off-by: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
> ---
> V1:
> Initial changes to fix packet reordering issue when
> more than 2 items are chained in a flow.
> Ex:
> 3 mergeable TCP packets received in order.
> packet_0 - no flow found so insert the packet and new start
> index -> 0
> packet_1-> flow found. prev_idx, curr_index = 0. So merge
> works
> find packet_0->packet_1
> packet_2 flow found. prev_indx =0, curr_index = 1. Matching
> dequence numbers found but chained as
> packet_0->packet_2->packet_1
>
> lib/gro/gro_tcp4.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index
> 7498c66141..9758e28fd5 100644
> --- a/lib/gro/gro_tcp4.c
> +++ b/lib/gro/gro_tcp4.c
> @@ -305,7 +305,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
> * length is greater than the max value. Store
> * the packet into the flow.
> */
> - if (insert_new_item(tbl, pkt, start_time, prev_idx,
> + if (insert_new_item(tbl, pkt, start_time, cur_idx,
> sent_seq, ip_id, is_atomic)
Good catch.
Acked-by: Jiayu Hu <Jiayu.hu@intel.com>
Thanks,
Jiayu
> ==
> INVALID_ARRAY_INDEX)
> return -1;
> --
> 2.25.1
> > When more than two packets are merged in a flow, and if we receive a 3rd
> > packet which is matching the sequence of the 2nd packet the prev_idx will
> > be 1 and not 2, hence resulting in packet re-ordering
> >
> > Signed-off-by: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
> > ---
> > V1:
> > Initial changes to fix packet reordering issue when
> > more than 2 items are chained in a flow.
> > Ex:
> > 3 mergeable TCP packets received in order.
> > packet_0 - no flow found so insert the packet and new start
> > index -> 0
> > packet_1-> flow found. prev_idx, curr_index = 0. So merge
> > works
> > find packet_0->packet_1
> > packet_2 flow found. prev_indx =0, curr_index = 1. Matching
> > dequence numbers found but chained as
> > packet_0->packet_2->packet_1
> >
> > lib/gro/gro_tcp4.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index
> > 7498c66141..9758e28fd5 100644
> > --- a/lib/gro/gro_tcp4.c
> > +++ b/lib/gro/gro_tcp4.c
> > @@ -305,7 +305,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
> > * length is greater than the max value. Store
> > * the packet into the flow.
> > */
> > - if (insert_new_item(tbl, pkt, start_time, prev_idx,
> > + if (insert_new_item(tbl, pkt, start_time, cur_idx,
> > sent_seq, ip_id, is_atomic)
>
> Good catch.
>
> Acked-by: Jiayu Hu <Jiayu.hu@intel.com>
Applied, thanks.
@@ -305,7 +305,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
* length is greater than the max value. Store
* the packet into the flow.
*/
- if (insert_new_item(tbl, pkt, start_time, prev_idx,
+ if (insert_new_item(tbl, pkt, start_time, cur_idx,
sent_seq, ip_id, is_atomic) ==
INVALID_ARRAY_INDEX)
return -1;