Re: [PATCH net-next v24 08/13] net: add support for skbs with unreadable frags

2024-09-04 Thread Eric Dumazet
On Wed, Sep 4, 2024 at 5:18 PM Mina Almasry  wrote:
>
> On Tue, Sep 3, 2024 at 2:40 PM Jakub Kicinski  wrote:
> >
> > On Sat, 31 Aug 2024 00:43:08 + Mina Almasry wrote:
> > >  static inline bool tcp_skb_can_collapse_to(const struct sk_buff *skb)
> > >  {
> > > - return likely(!TCP_SKB_CB(skb)->eor);
> > > + return likely(!TCP_SKB_CB(skb)->eor && skb_frags_readable(skb));
> >
> > Do you remember why this is here?
>
> Yeah, to be honest, when I first implemented some of these checks I
> erred on the side of caution, and added checks around anything that
> looked concerning, some of these unnecessary checks got removed, but
> looks like this one didn't.
>
> > Both for Rx and Tx what should matter
> > is whether the "readability" matches, right? We can merge two unreadable
> > messages.
>
> Yes, you're right, only 'readability matches' should be the criteria
> here. `tcp_skb_can_collapse` already checks readability is matching
> correctly, so no issue there. The `tcp_skb_can_collapse_to` check
> you're commenting on here looks unnecessary. I will remove it and run
> that through some testing.
>
> As an aside, it looks to me like that tcp_skb_can_collapse_to
> callsites don't seem to be doing any collapsing. Unless I misread the
> code. It looks like tcp_skb_can_collapse_to is used as an eor check. I
> can rename the function to tcp_skb_is_eor() or something if that makes
> sense (in a separate patch). I think the name of the function confused
> me slightly and made me think I need to do a readability check.
>

Please do not use tcp_skb_is_eor()

tcp_skb_can_collapse_to() could be renamed to tcp_skb_can_aggregate_to()
or tcp_skb_can_append_to(), but EOR would not help at all.


Re: [PATCH net-next v24 08/13] net: add support for skbs with unreadable frags

2024-09-04 Thread Mina Almasry
On Tue, Sep 3, 2024 at 2:40 PM Jakub Kicinski  wrote:
>
> On Sat, 31 Aug 2024 00:43:08 + Mina Almasry wrote:
> >  static inline bool tcp_skb_can_collapse_to(const struct sk_buff *skb)
> >  {
> > - return likely(!TCP_SKB_CB(skb)->eor);
> > + return likely(!TCP_SKB_CB(skb)->eor && skb_frags_readable(skb));
>
> Do you remember why this is here?

Yeah, to be honest, when I first implemented some of these checks I
erred on the side of caution, and added checks around anything that
looked concerning, some of these unnecessary checks got removed, but
looks like this one didn't.

> Both for Rx and Tx what should matter
> is whether the "readability" matches, right? We can merge two unreadable
> messages.

Yes, you're right, only 'readability matches' should be the criteria
here. `tcp_skb_can_collapse` already checks readability is matching
correctly, so no issue there. The `tcp_skb_can_collapse_to` check
you're commenting on here looks unnecessary. I will remove it and run
that through some testing.

As an aside, it looks to me like that tcp_skb_can_collapse_to
callsites don't seem to be doing any collapsing. Unless I misread the
code. It looks like tcp_skb_can_collapse_to is used as an eor check. I
can rename the function to tcp_skb_is_eor() or something if that makes
sense (in a separate patch). I think the name of the function confused
me slightly and made me think I need to do a readability check.

--
Thanks,
Mina


Re: [PATCH net-next v24 08/13] net: add support for skbs with unreadable frags

2024-09-03 Thread Jakub Kicinski
On Sat, 31 Aug 2024 00:43:08 + Mina Almasry wrote:
>  static inline bool tcp_skb_can_collapse_to(const struct sk_buff *skb)
>  {
> - return likely(!TCP_SKB_CB(skb)->eor);
> + return likely(!TCP_SKB_CB(skb)->eor && skb_frags_readable(skb));

Do you remember why this is here? Both for Rx and Tx what should matter
is whether the "readability" matches, right? We can merge two unreadable
messages.