All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: jmorris@redhat.com, netdev@oss.sgi.com
Subject: Re: pskb change in dst->output
Date: Fri, 9 Jul 2004 14:21:44 -0700	[thread overview]
Message-ID: <20040709142144.483369ec.davem@redhat.com> (raw)
In-Reply-To: <20040709204228.GA3015@gondor.apana.org.au>

On Sat, 10 Jul 2004 06:42:28 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> On Fri, Jul 09, 2004 at 12:36:08PM -0700, David S. Miller wrote:
> >
> > > > If there are no objections, I'd like to create a version of
> > > > skb_checksum_help() that doesn't copy the packet, and call
> > > > that version from ah_output()/esp_output()/ipcomp_output().
> > > 
> > > This will break when cloned packets are passed to these functions.
> > 
> > James is right Herbert.  TCP will send clones down into these routines
> > all the time.
> 
> The first TCP transmission will always be a clone of a packet off
> its output queue.  However, the TCP code is written such that you
> can modify any part of the skb except the TCP payload.  This
> includes the TCP header which is where the TCP checksum is.
>
> If this weren't the case then you'd have to copy the packet much earlier.
> This assumption is already made by tcp_transmit_skb(), ip_queue_xmit()
> and all the functions called by dst_output().
> 
> When TCP retransmits the packet, it will do a pskb_copy() on it so
> it's no longer a clone.

Not necessarily true.  If the device has finished transmission,
which is true %99.9999 of the time when a retransmission happens,
another clone will be made against the original SKB sitting in
the write queue.

> So unless I've missed another case where someone will pass a clone
> down, it is safe to change the checksum on the TCP clones.

The hw checksumming state is what we care about.  And skb_cow()'s implementation
is:

1) Always copy all data if cloned

2) Allocate a unique data area, and even the shared private skb
   area becomes local to the skb.

In short only the data is uncloned.

However, skb_checksum_help() is doing something entirely different.
It makes a fully new skb, both data and sk_buff struct are uncloned.

This is particularly important for the very case which ah_output()
cares about, for example.  If the skb is CHECKSUM_HW we have to unclone
the full SKB.  ah_output() does not use things like skb_cow() like
ESP and others do.

I really think the dst->output() SKB pointer passing is truly needed.

You still won't be convinced, I know :-)  So propose a patch and we'll
shoot holes in it so we can discuss something concrete, ok? :)))

  parent reply	other threads:[~2004-07-09 21:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-07 13:06 pskb change in dst->output Herbert Xu
2004-07-07 14:58 ` James Morris
2004-07-07 21:28   ` Herbert Xu
2004-07-07 22:01     ` David S. Miller
2004-07-07 23:12       ` Herbert Xu
2004-07-07 23:33         ` James Morris
2004-07-08  0:04           ` Herbert Xu
2004-07-08  0:17             ` David S. Miller
2004-07-08  0:35               ` Herbert Xu
2004-07-08  1:05               ` James Morris
2004-07-08  1:11                 ` Herbert Xu
2004-07-08  1:19                   ` James Morris
2004-07-08  3:34                   ` James Morris
2004-07-08  4:02                     ` Herbert Xu
2004-07-09  8:14                       ` Herbert Xu
2004-07-09 14:02                         ` James Morris
2004-07-09 19:36                           ` David S. Miller
2004-07-09 20:42                             ` Herbert Xu
2004-07-09 21:07                               ` Herbert Xu
2004-07-09 21:21                               ` David S. Miller [this message]
2004-07-09 21:43                                 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040709142144.483369ec.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jmorris@redhat.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.