From: David Ahern <dsahern@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, Saeed Mahameed <saeedm@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Eli Cohen <eli@mellanox.com>,
Roi Dayan <roid@mellanox.com>, Eli Britstein <elibr@mellanox.com>
Subject: Re: [net-next 07/10] net/mlx5e: Add support for hw encapsulation of MPLS over UDP
Date: Tue, 26 May 2020 13:27:05 -0600 [thread overview]
Message-ID: <97ec57bc-c46d-f9ca-037a-a9e07ad0fc08@gmail.com> (raw)
In-Reply-To: <20200526121920.7f5836e6@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
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
next prev parent reply other threads:[~2020-05-26 19:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 23:51 [pull request][net-next 00/10] mlx5 updates 2020-05-22 Saeed Mahameed
2020-05-22 23:51 ` [net-next 01/10] net/mlx5e: Use IS_ERR() to check and simplify code Saeed Mahameed
2020-05-22 23:51 ` [net-next 02/10] net/mlx5e: Extract TC-specific code from en_rep.c to rep/tc.c Saeed Mahameed
2020-05-22 23:51 ` [net-next 03/10] net/mlx5e: Extract neigh-specific code from en_rep.c to rep/neigh.c Saeed Mahameed
2020-05-22 23:51 ` [net-next 04/10] net/mlx5e: Move TC-specific code from en_main.c to en_tc.c Saeed Mahameed
2020-05-22 23:51 ` [net-next 05/10] net/mlx5e: Introduce kconfig var for TC support Saeed Mahameed
2020-05-25 14:46 ` Marcelo Ricardo Leitner
2020-05-27 5:08 ` Saeed Mahameed
2020-05-22 23:51 ` [net-next 06/10] net: Add netif_is_bareudp() API to identify bareudp devices Saeed Mahameed
2020-05-22 23:51 ` [net-next 07/10] net/mlx5e: Add support for hw encapsulation of MPLS over UDP Saeed Mahameed
2020-05-26 19:19 ` Jakub Kicinski
2020-05-26 19:27 ` David Ahern [this message]
2020-05-27 5:15 ` Saeed Mahameed
2020-05-22 23:51 ` [net-next 08/10] net/mlx5e: Allow to match on mpls parameters Saeed Mahameed
2020-05-22 23:51 ` [net-next 09/10] net/mlx5e: Add support for hw decapsulation of MPLS over UDP Saeed Mahameed
2020-05-22 23:51 ` [net-next 10/10] net/mlx5e: Support pedit on mpls over UDP decap Saeed Mahameed
2020-05-22 23:58 ` [pull request][net-next 00/10] mlx5 updates 2020-05-22 Saeed Mahameed
2020-05-23 23:39 ` David Miller
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=97ec57bc-c46d-f9ca-037a-a9e07ad0fc08@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=eli@mellanox.com \
--cc=elibr@mellanox.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roid@mellanox.com \
--cc=saeedm@mellanox.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 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).