[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48d764427014f1450e6104746945dd67c5edb64b.camel@mellanox.com>
Date: Wed, 27 May 2020 05:15:51 +0000
From: Saeed Mahameed <saeedm@...lanox.com>
To: "dsahern@...il.com" <dsahern@...il.com>,
"kuba@...nel.org" <kuba@...nel.org>
CC: Eli Cohen <eli@...lanox.com>, Roi Dayan <roid@...lanox.com>,
Eli Britstein <elibr@...lanox.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [net-next 07/10] net/mlx5e: Add support for hw encapsulation of
MPLS over UDP
On Tue, 2020-05-26 at 13:27 -0600, David Ahern wrote:
> On 5/26/20 1:19 PM, Jakub Kicinski wrote:
> > On Fri, 22 May 2020 16:51:45 -0700 Saeed Mahameed wrote:
> > > +static inline __be32 mpls_label_id_field(__be32 label, u8 tos,
> > > u8 ttl)
> > > +{
> > > + u32 res;
> > > +
> > > + /* mpls label is 32 bits long and construction as follows:
> > > + * 20 bits label
> > > + * 3 bits tos
> > > + * 1 bit bottom of stack. Since we support only one label, this
> > > bit is
> > > + * always set.
> > > + * 8 bits TTL
> > > + */
> > > + res = be32_to_cpu(label) << 12 | 1 << 8 | (tos & 7) << 9 |
> > > ttl;
> > > + return cpu_to_be32(res);
> > > +}
> >
> > No static inlines in C source, please. Besides this belongs in the
> > mpls
> > header, it's a generic helper.
> >
>
> net/mpls/internal.h:
>
> 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;
> }
>
> perhaps that can be moved to include/net/mpls.h
Agreed, Eli is preparing a patch as we speak.
Thanks,
Saeed.
Powered by blists - more mailing lists