Hi Stephen,
> -----Original Message-----
> From: Stephen Hemminger [mailto:[email protected]]
> Sent: Thursday, December 14, 2017 11:03 AM
> To: Hu, Jiayu <[email protected]>
> Cc: [email protected]; Ananyev, Konstantin <[email protected]>;
> Tan, Jianfeng <[email protected]>; Chen, Junjie J
> <[email protected]>; Mcnamara, John <[email protected]>;
> [email protected]
> Subject: Re: [PATCH v2 2/2] gro: support VxLAN GRO
>
> On Thu, 14 Dec 2017 10:49:39 +0800
> Jiayu Hu <[email protected]> wrote:
>
> > + /* Don't merge packets whose outer DF bits are different. */
> > + if (item->outer_is_atomic ^ outer_is_atomic)
>
> unlikely() here?
Agree. Add it in the next version.
>
> > + return 0;
> > +
> > + l2_offset = pkt->outer_l2_len + pkt->outer_l3_len;
> > + cmp = check_seq_option(&item->inner_item, tcp_hdr, sent_seq,
> ip_id,
> > + tcp_hl, tcp_dl, l2_offset, is_atomic);
> > + if ((cmp == 1) && (outer_is_atomic || (outer_ip_id ==
> > + item->outer_ip_id +
> > + item->inner_item.nb_merged)))
>
> More readable if you break the line at the ||
Exactly, I will change it in the next version.
>
> > + /* Append the packet. */
> > + return 1;
> > + else if ((cmp == -1) && (outer_is_atomic || (outer_ip_id + 1 ==
> > + item->outer_ip_id)))
>
> else unecessary after return. Similar line break for readabilty.
Correctly, I will change it.
>
> > + /* Prepend the packet. */
> > + return -1;
> > + else
> > + return 0;
> > +}
> > +
>
> maybe?
> if (cmp == 1) {
> if (outer_is_atomic ||
> outer_ip_id == item->outer_ip_id + item-
> >inner_item.nb_merged)
> return 1;
> } else if (cmp == -1) {
> if (uter_is_atomic || outer_ip_id + 1 == item->outer_ip_id)
> return -1;
> }
> return 0;
>
The reason to replace "if ((cmp == 1) && (outer_is_atomic ...))" with two if
statements is
for readability?
But will two if statements make codes less efficient?
Thanks,
Jiayu