From: Jiri Pirko <jiri@resnulli.us>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com,
pshelar@nicira.com, therbert@google.com, edumazet@google.com,
willemb@google.com, dborkman@redhat.com, mst@redhat.com,
fw@strlen.de, Paul.Durrant@citrix.com, tgraf@suug.ch
Subject: Re: [patch net-next 1/2] net: move vlan pop/push functions into common code
Date: Tue, 11 Nov 2014 16:00:16 +0100 [thread overview]
Message-ID: <20141111150016.GD1825@nanopsycho.lan> (raw)
In-Reply-To: <1415711181.9613.32.camel@edumazet-glaptop2.roam.corp.google.com>
Tue, Nov 11, 2014 at 02:06:21PM CET, eric.dumazet@gmail.com wrote:
>On Tue, 2014-11-11 at 11:13 +0100, Jiri Pirko wrote:
>> So it can be used from out of openvswitch code.
>> Did couple of cosmetic changes on the way, namely variable naming and
>> adding support for 8021AD proto.
>>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> ---
>> include/linux/skbuff.h | 2 ++
>> net/core/skbuff.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++
>> net/openvswitch/actions.c | 76 ++---------------------------------------
>> 3 files changed, 90 insertions(+), 74 deletions(-)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 103fbe8..3b0445c 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -2673,6 +2673,8 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet);
>> unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
>> struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
>> struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
>> +int skb_vlan_pop(struct sk_buff *skb);
>> +int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
>>
>> struct skb_checksum_ops {
>> __wsum (*update)(const void *mem, int len, __wsum wsum);
>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
>> index 7001896..75e53d4 100644
>> --- a/net/core/skbuff.c
>> +++ b/net/core/skbuff.c
>> @@ -4151,6 +4151,92 @@ err_free:
>> }
>> EXPORT_SYMBOL(skb_vlan_untag);
>>
>> +/* remove VLAN header from packet and update csum accordingly. */
>> +static int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci)
>> +{
>> + struct vlan_hdr *vhdr;
>> + int err;
>> +
>
>
>
>> + if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
>> + return -ENOMEM;
>> +
>> + if (!skb_cloned(skb) || skb_clone_writable(skb, VLAN_ETH_HLEN))
>> + return 0;
>> +
>> + err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
>> + if (unlikely(err))
>> + return err;
>
>All this should be a function of its own (OVS calls this
>make_writable()).
>
>Its too bad netfilter has a different skb_make_writable()
How different is that? Looking at it it seems it is doing the same
thing. Not sure though...
>
>
>> +
>> + if (skb->ip_summed == CHECKSUM_COMPLETE)
>> + skb->csum = csum_sub(skb->csum, csum_partial(skb->data
>> + + (2 * ETH_ALEN), VLAN_HLEN, 0));
>
>This looks like skb_postpull_rcsum()
>
>BTW, calling csum_partial() for 4 bytes is quite expensive.
>
>
>
next prev parent reply other threads:[~2014-11-11 15:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-11 10:13 [patch net-next 1/2] net: move vlan pop/push functions into common code Jiri Pirko
2014-11-11 10:13 ` [patch net-next 2/2] sched: introduce vlan action Jiri Pirko
2014-11-11 12:34 ` Jamal Hadi Salim
2014-11-11 22:33 ` Cong Wang
2014-11-12 12:34 ` Jiri Pirko
2014-11-12 13:03 ` Jamal Hadi Salim
2014-11-12 13:06 ` Jamal Hadi Salim
2014-11-11 23:18 ` Cong Wang
2014-11-12 7:47 ` Jiri Pirko
2014-11-12 12:27 ` Jamal Hadi Salim
2014-11-13 17:06 ` Cong Wang
2014-11-11 13:06 ` [patch net-next 1/2] net: move vlan pop/push functions into common code Eric Dumazet
2014-11-11 15:00 ` Jiri Pirko [this message]
2014-11-11 17:24 ` Pravin Shelar
2014-11-12 11:59 ` Jiri Pirko
2014-11-12 19:11 ` David Miller
2014-11-12 19:20 ` Pravin Shelar
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=20141111150016.GD1825@nanopsycho.lan \
--to=jiri@resnulli.us \
--cc=Paul.Durrant@citrix.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=jhs@mojatatu.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
--cc=tgraf@suug.ch \
--cc=therbert@google.com \
--cc=willemb@google.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.