RE: [PATCH net-next] consolidate duplicate code is skb_checksum_setup() helpers
From: Paul Durrant <hidden>
Date: 2014-02-27 12:39:04
-----Original Message----- From: Jan Beulich [mailto:JBeulich@suse.com] Sent: 27 February 2014 12:20 To: Paul Durrant Cc: davem@davemloft.net; Eric Dumazet; netdev@vger.kernel.org Subject: RE: [PATCH net-next] consolidate duplicate code is skb_checksum_setup() helpersquoted
quoted
quoted
On 27.02.14 at 13:00, Paul Durrant [off-list ref] wrote:-----Original Message----- From: Jan Beulich [mailto:JBeulich@suse.com] Sent: 27 February 2014 11:50 To: Paul Durrant Cc: davem@davemloft.net; Eric Dumazet; netdev@vger.kernel.org Subject: RE: [PATCH net-next] consolidate duplicate code is skb_checksum_setup() helpersquoted
quoted
quoted
On 27.02.14 at 11:57, Paul Durrant [off-list ref] wrote:-----Original Message----- From: Jan Beulich [mailto:JBeulich@suse.com] Sent: 27 February 2014 09:05 To: netdev@vger.kernel.org Cc: Paul Durrant; davem@davemloft.net; Eric Dumazet Subject: [PATCH net-next] consolidate duplicate code is skb_checksum_setup() helpers Realizing that the skb_maybe_pull_tail() calls in the IP-protocol specific portions of both helpers are terminal ones (i.e. no further pulls are expected), their maximum size to be pulled can be madematchquoted
quoted
quoted
quoted
their minimal size needed, thus making the code identical and hence possible to be moved into another helper.There is a difference in the case of an IPv4 TCP packet with options.Withquoted
quoted
quoted
your patch it will only get pulled up as far as the base header so theremayquoted
quoted
quoted
need to be another pull for options parsing.Don't the options start right after the IP header, before the TCP or UDP one? In which case the pull covers them.*IP* options do, TCP options are immediately after the TCP header (hencethequoted
TCP header length field). UDP doesn't have options.Oh, right, of course. But then again - is the maximum length of TCP options different between v4 and v6? If not, that limit should be used here rather than the more generic (and version dependent) IP limit.
I don't know off the top of my head - I'd have to go look. My hunch is that TCP options are essentially independent of IP version. Anyway, the header is limited to 60 bytes max due to the 4 bit width of the header length field so you may as well just use that.
And iiuc the UDP case could remain as is.
Yep. Paul