From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH bpf-next RFC 1/2] Organize MPLS headers Date: Wed, 28 Mar 2018 12:20:05 -0600 Message-ID: References: <20180328162715.113-1-shrijeetoss@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com, ast@fb.com To: Shrijeet Mukherjee , daniel@iogearbox.net Return-path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:36894 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbeC1SUI (ORCPT ); Wed, 28 Mar 2018 14:20:08 -0400 Received: by mail-pg0-f65.google.com with SMTP id n11so1297394pgp.4 for ; Wed, 28 Mar 2018 11:20:08 -0700 (PDT) In-Reply-To: <20180328162715.113-1-shrijeetoss@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 3/28/18 10:27 AM, Shrijeet Mukherjee wrote: > From: Shrijeet Mukherjee > > Prepare shared headers for new MPLS label push/pop EBPF helpers > > Signed-off-by: Shrijeet Mukherjee > --- > include/net/mpls.h | 1 + > net/core/filter.c | 2 ++ > net/mpls/af_mpls.c | 8 ++++---- > net/mpls/internal.h | 31 ------------------------------- > net/mpls/mpls_iptunnel.c | 2 +- > net/openvswitch/actions.c | 12 ++++++------ > 6 files changed, 14 insertions(+), 42 deletions(-) > > diff --git a/include/net/mpls.h b/include/net/mpls.h > index 1dbc669b770e..2583dbc689b8 100644 > --- a/include/net/mpls.h > +++ b/include/net/mpls.h > @@ -16,6 +16,7 @@ > > #include > #include > +#include drop the uapi; just include linux/mpls.h > > #define MPLS_HLEN 4 > > diff --git a/net/core/filter.c b/net/core/filter.c > index c86f03fd9ea5..00f62fafc788 100644 > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -56,6 +57,7 @@ > #include > #include > #include > +#include > #include Changes to this file are not needed with this patch. > > /** > diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c > index d4a89a8be013..4e05391b77f0 100644 > --- a/net/mpls/af_mpls.c > +++ b/net/mpls/af_mpls.c > @@ -170,7 +170,7 @@ static u32 mpls_multipath_hash(struct mpls_route *rt, struct sk_buff *skb) > break; > > /* Read and decode the current label */ > - hdr = mpls_hdr(skb) + label_index; > + hdr = skb_mpls_hdr(skb) + label_index; No need to add skb_ prefix; no other protocol has the skb_ prefix (ip_hdr, ipv6_hdr, eth_hdr, ...) > diff --git a/net/mpls/internal.h b/net/mpls/internal.h > index 768a302879b4..cd93cb201fed 100644 > --- a/net/mpls/internal.h > +++ b/net/mpls/internal.h > @@ -8,13 +8,6 @@ > */ > #define MAX_NEW_LABELS 30 > > -struct mpls_entry_decoded { > - u32 label; > - u8 ttl; > - u8 tc; > - u8 bos; > -}; > - > struct mpls_pcpu_stats { > struct mpls_link_stats stats; > struct u64_stats_sync syncp; > @@ -172,30 +165,6 @@ struct mpls_route { /* next hop label forwarding entry */ > > #define endfor_nexthops(rt) } > > -static inline struct mpls_shim_hdr mpls_entry_encode(u32 label, unsigned ttl, unsigned tc, bool bos) > -{ > - struct mpls_shim_hdr result; > - result.label_stack_entry = > - cpu_to_be32((label << MPLS_LS_LABEL_SHIFT) | > - (tc << MPLS_LS_TC_SHIFT) | > - (bos ? (1 << MPLS_LS_S_SHIFT) : 0) | > - (ttl << MPLS_LS_TTL_SHIFT)); > - return result; > -} > - > -static inline struct mpls_entry_decoded mpls_entry_decode(struct mpls_shim_hdr *hdr) > -{ > - struct mpls_entry_decoded result; > - unsigned entry = be32_to_cpu(hdr->label_stack_entry); > - > - result.label = (entry & MPLS_LS_LABEL_MASK) >> MPLS_LS_LABEL_SHIFT; > - result.ttl = (entry & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT; > - result.tc = (entry & MPLS_LS_TC_MASK) >> MPLS_LS_TC_SHIFT; > - result.bos = (entry & MPLS_LS_S_MASK) >> MPLS_LS_S_SHIFT; > - > - return result; > -} > - > static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev) > { > return rcu_dereference_rtnl(dev->mpls_ptr); With just this patch applied, MPLS can't compile since you are removing these 2 functions.