netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH,RFC] skb->network_header and __vlan_put_tag()
Date: Mon, 07 Jul 2008 14:17:56 +0200	[thread overview]
Message-ID: <48720974.5090907@trash.net> (raw)
In-Reply-To: <20080707120541.GB2026@xi.wantstofly.org>

Lennert Buytenhek wrote:
> On Sat, Jul 05, 2008 at 08:33:01PM +0200, Patrick McHardy wrote:
> 
>> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
>> index 037929f..d0157d4 100644
>> --- a/include/linux/if_vlan.h
>> +++ b/include/linux/if_vlan.h
>> @@ -188,8 +188,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
>>  	veth->h_vlan_TCI = htons(tag);
>>  
>>  	skb->protocol = htons(ETH_P_8021Q);
>> -	skb->mac_header -= VLAN_HLEN;
>> -	skb->network_header -= VLAN_HLEN;
> 
> This works -- I can now just calculate
> '(void *)skb->data - (void *)ip_hdr(skb)' to find out how many bytes
> there are in the virtual ethernet header (i.e. ethernet header plus
> VLAN tag(s)) and program the TX descriptor accordingly.  (But in the
> VLAN case, I only ever get packets that have already been checksummed
> -- but that's another issue.)
> 
> 
>> +	skb_reset_mac_header(skb);
> 
> I'm not sure whether there is much point to doing this.  With this
> change, VLAN-tagged packets are given to ->hard_start_xmit() with
> ethhdr pointing to skb->data instead of NULL, but non-VLAN-tagged
> packets are still passed in with ethhdr being NULL.

You're right, its not strictly necessary. I'll remove that part
again.

      reply	other threads:[~2008-07-07 12:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-16 22:15 [PATCH,RFC] skb->network_header and __vlan_put_tag() Lennert Buytenhek
2008-06-17 10:10 ` Benny Amorsen
2008-06-17 12:19   ` Patrick McHardy
2008-06-17 12:18 ` Patrick McHardy
2008-07-05 18:33   ` Patrick McHardy
2008-07-07 12:05     ` Lennert Buytenhek
2008-07-07 12:17       ` Patrick McHardy [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=48720974.5090907@trash.net \
    --to=kaber@trash.net \
    --cc=buytenh@wantstofly.org \
    --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).