[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180811.115453.2016294695634012705.davem@davemloft.net>
Date: Sat, 11 Aug 2018 11:54:53 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: doronrk@...com
Cc: davejwatson@...com, vakul.garg@....com, borisp@...lanox.com,
aviadye@...lanox.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next,v4] net/tls: Calculate nsg for zerocopy path
without skb_cow_data.
From: Doron Roberts-Kedes <doronrk@...com>
Date: Thu, 9 Aug 2018 15:43:44 -0700
> Taking a step back, is there an existing solution for what this function
> is trying to do? I was surprised to find that there did not seem to
> exist a function for determining the number of scatterlist elements
> required to map an skb without COW.
The reason is that we usually never need to "map" an SKB on receive,
and on transmit the SKB geometry is normalized by the destination
device features which means no frag_list.
And the other existing receive path doing SW crypto, IPSEC, always
COWs the data so get the number of SG array entries needed from
skb_cow_data().
Frag lists on RX should be pretty rare. They occur when GRO
segmentation encouters poorly arranged incoming SKBs. For example
this happens if the incoming frames use lots of tiny SKB page frags,
and therefore prevent accumulation into the page frag array of the
head GRO skb.
So yes it can happen, and we have to account for it.
So I guess you really do need to accomodate this situation. Why
don't you try to rearrange your new function with some likely()
and unlikely() tests so that the straight code path optimizes for
the non-frag-list case?
Thanks!
Powered by blists - more mailing lists