netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org
Cc: tomasw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC v2] mac80211: assign needed_headroom/tailroom for netdevs
Date: Mon, 05 May 2008 13:44:20 -0700 (PDT)	[thread overview]
Message-ID: <20080505.134420.194001886.davem@davemloft.net> (raw)
In-Reply-To: <1210018214.4181.27.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>

From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Date: Mon, 05 May 2008 22:10:14 +0200

> So you're saying the check there to see if we can add 802.11 headers
> should depend on skb_header_cloned() and not skb_cloned()?

If you're pushing things in front (adding headers), you should basically
always be OK.

The problem is the skb->data pointer, that has to remain stable
once dev_queue_xmit() gets the frame because taps like AF_PACKET
can have access to the packet (via net/core/dev.c:dev_queue_xmit_nit()).

(If you read the AF_PACKET code, and notice how it munges the
 headers, note that it only does so temporarily and restores the
 skb->data and skb->len state before returning back up to
 it's caller, dev_hard_start_xmit())

I think the AF_PACKET stuff is actually superfluous on the transmit
side, we always give it clones so it can modify skb->data however it
pleases without having to restore anything.  Someone with some time
should look more closely into this :-)  The problem here seems to
be that pt->func is used for both receive and transmit paths, so it
must be mindful to handle both cases properly.

BTW, this gets back to the topic of the pain caused by pretending this
stuff is ethernet when it isn't.  If we really made these wireless
devices look the way they should, tcpdump could see the headers
correctly.  I'm sure you have all sorts of hacks in the 80211 code to
make 802.11 header capture possible via side-band stuff, but it would
have been so much nicer (and transparently solved these header space
issues) if we didn't try to put lipstick on a pig :-)

Anyways, back to the original topic.  I think you can avoid COW'ing
clones if you don't modify skb->data and give the drivers some other
way to know where the wireless headers really start.

Alternatively, you can just clone the packet.  At that point the
skb->data etc. members are your's to modify to your heart's content.
And because nobody can look below the original skb->data value, you
can stick your headers there.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-05-05 20:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04 21:24 [RFC] mac80211: assign needed_headroom/tailroom for netdevs Johannes Berg
     [not found] ` <1209936253.7304.10.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-04 21:31   ` Johannes Berg
2008-05-04 21:32   ` [RFC v2] " Johannes Berg
     [not found]     ` <1209936745.7304.16.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05  0:30       ` David Miller
     [not found]         ` <20080504.173051.133197507.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-05  7:22           ` Johannes Berg
     [not found]             ` <1209972139.3655.9.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 14:27               ` Tomas Winkler
     [not found]                 ` <1ba2fa240805050727r2060b0b4x3a9b3240647b66b1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-05-05 15:22                   ` Johannes Berg
     [not found]                     ` <1210000923.8245.26.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 17:15                       ` Tomas Winkler
2008-05-05 17:57                         ` Johannes Berg
2008-05-05 18:58                           ` David Miller
     [not found]                             ` <20080505.115855.137964071.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-05 19:05                               ` Johannes Berg
2008-05-05 19:50                                 ` David Miller
2008-05-05 19:57                                   ` Johannes Berg
2008-05-05 20:02                                     ` David Miller
2008-05-05 20:10                                       ` Johannes Berg
     [not found]                                         ` <1210018214.4181.27.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 20:44                                           ` David Miller [this message]
2008-05-05 20:57                                             ` Johannes Berg
     [not found]                                               ` <1210021066.4181.41.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 21:01                                                 ` David Miller
2008-05-05 22:37                                                 ` David Miller
2008-05-05 22:44                                                   ` Johannes Berg
     [not found]                                                     ` <1210027447.8012.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 23:14                                                       ` David Miller
     [not found]                                                         ` <20080505.161458.46071527.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-05 23:23                                                           ` Johannes Berg
     [not found]                                                             ` <1210029835.8012.30.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 23:39                                                               ` David Miller
     [not found]                                                                 ` <20080505.163916.239187195.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-06  0:01                                                                   ` Johannes Berg
     [not found]                                                                     ` <1210032076.8012.49.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-06  0:08                                                                       ` David Miller
     [not found]                                                                         ` <20080505.170805.127854312.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-06 11:13                                                                           ` Johannes Berg
2008-05-06  1:32                                                                   ` Herbert Xu
2008-05-13  5:01                                                   ` David Miller
2008-05-05 23:03                       ` David Miller
     [not found]                         ` <20080505.160328.203996832.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-05 23:17                           ` Johannes Berg
     [not found]                             ` <1210029435.8012.25.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 23:24                               ` David Miller
     [not found]                                 ` <20080505.162424.176435653.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-05 23:30                                   ` Johannes Berg
2008-05-05 23:36                           ` Johannes Berg
     [not found]                             ` <1210030591.8012.41.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-05 23:40                               ` David Miller
2008-05-13  3:52     ` David Miller
     [not found]       ` <20080512.205224.12536510.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-13  9:01         ` Johannes Berg
     [not found]           ` <1210669273.3646.51.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-13  9:45             ` David Miller
2008-05-13 10:07               ` Johannes Berg

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=20080505.134420.194001886.davem@davemloft.net \
    --to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
    --cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tomasw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).