netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@redhat.com>
To: pravin shelar <pshelar@ovn.org>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	David Ahern <dsa@cumulusnetworks.com>
Subject: Re: [PATCH net-next 2/2] openvswitch: remove skb_mpls_header
Date: Fri, 30 Sep 2016 10:06:08 +0200	[thread overview]
Message-ID: <20160930100608.1b4308b2@griffin> (raw)
In-Reply-To: <CAOrHB_DJunwVXJse8XyVMqAxt2sf4BZ67vospaKD0Lj-6HS_yQ@mail.gmail.com>

On Thu, 29 Sep 2016 16:03:19 -0700, pravin shelar wrote:
> > --- a/include/net/mpls.h
> > +++ b/include/net/mpls.h
> > @@ -25,15 +25,4 @@ static inline bool eth_p_mpls(__be16 eth_type)
> >                 eth_type == htons(ETH_P_MPLS_MC);
> >  }
> >
> > -/*
> > - * For non-MPLS skbs this will correspond to the network header.
> > - * For MPLS skbs it will be before the network_header as the MPLS
> > - * label stack lies between the end of the mac header and the network
> > - * header. That is, for MPLS skbs the end of the mac header
> > - * is the top of the MPLS label stack.
> > - */
> > -static inline unsigned char *skb_mpls_header(struct sk_buff *skb)
> > -{
> > -       return skb_mac_header(skb) + skb->mac_len;
> > -}
> 
> I think we should keep this API, so that it is clear that MPLS header
> mapped skb network header.

I was pondering this but I don't think it really gains us anything.
Wrappers like ip_hdr() are useful as they do type conversion; it's much
nicer to write
	ip_hdr(skb)->daddr
than 
	(struct iphdr *)skb_network_header(skb)->daddr.

But we don't really have a good type to return from skb_mpls_header, it
boils down to be 100% equivalent to skb_network_header. In fact, you
could just do:
#define skb_mpls_header skb_network_header

In the code, I don't think there's much benefit from calling the
wrapper, meaning of skb_network_header itself is clear enough. It *is*
the network header, after all. In the whole openvswitch code, MPLS is
treated as L3 header - no dissection is performed after the MPLS
headers, the network header and mac_len is set as expected now, etc.

 Jiri

  reply	other threads:[~2016-09-30  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 19:19 [PATCH net-next 0/2] openvswitch: mpls fix and clean up Jiri Benc
2016-09-29 19:19 ` [PATCH net-next 1/2] openvswitch: mpls: set network header correctly on key extract Jiri Benc
2016-09-29 23:02   ` pravin shelar
2016-09-29 19:19 ` [PATCH net-next 2/2] openvswitch: remove skb_mpls_header Jiri Benc
2016-09-29 23:03   ` pravin shelar
2016-09-30  8:06     ` Jiri Benc [this message]
2016-09-30 16:05       ` 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=20160930100608.1b4308b2@griffin \
    --to=jbenc@redhat.com \
    --cc=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.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).