netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: mpm@selenic.com
Cc: jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [BUG] netpoll is unable to handle skb's using packet split
Date: Mon, 14 Nov 2005 22:45:45 -0800 (PST)	[thread overview]
Message-ID: <20051114.224545.101398810.davem@davemloft.net> (raw)
In-Reply-To: <20051115062947.GI31287@waste.org>

From: Matt Mackall <mpm@selenic.com>
Date: Mon, 14 Nov 2005 22:29:47 -0800

> Can we make any assumptions about the size and position of fragments.
> For instance, will the first N data bytes of a UDP packet all be in
> the same fragment?

Nope, they can be fragmented any way possible.

For packet parsing, you don't need any of this anyways.
Just use the things that the normal network input stack
uses, for example you could use something like
skb_header_pointer(), or pskb_may_pull().

For example, a clean way to parse a UDP header at the
front of an SKB is:

	struct udphdr *uh, _tmp;

	uh = skb_header_pointer(skb, 0, sizeof(_tmp), &_tmp);
	if (uh->sport = foo && uh->dport == bar)
		...

The UDP input path uses:

	struct udphdr *uh;

	if (!pskb_may_pull(skb, sizeof(struct udphdr)))
		goto header_error;

	uh = skb->h.uh;

Unfortunately, pskb_may_pull() may need to call __pskb_pull_tail()
which in turn might do a pskb_expand_head() and thus a GFP_ATOMIC
memory allocation.

      reply	other threads:[~2005-11-15  6:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-14 21:15 [BUG] netpoll is unable to handle skb's using packet split Jeff Kirsher
2005-11-15  5:23 ` Matt Mackall
2005-11-15  5:39   ` David S. Miller
2005-11-15  5:41     ` David S. Miller
2005-11-15  6:29       ` Matt Mackall
2005-11-15  6:45         ` David S. Miller [this message]

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=20051114.224545.101398810.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).