netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Ido Schimmel <idosch@idosch.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	jiri@mellanox.com, dsahern@gmail.com, roopa@cumulusnetworks.com,
	mlxsw@mellanox.com, Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next v2 03/10] ipv4: Add "offload" and "trap" indications to routes
Date: Tue, 14 Jan 2020 17:39:36 +0100	[thread overview]
Message-ID: <20200114163936.GN2131@nanopsycho> (raw)
In-Reply-To: <20200114112318.876378-4-idosch@idosch.org>

Tue, Jan 14, 2020 at 12:23:11PM CET, idosch@idosch.org wrote:
>From: Ido Schimmel <idosch@mellanox.com>
>
>When performing L3 offload, routes and nexthops are usually programmed
>into two different tables in the underlying device. Therefore, the fact
>that a nexthop resides in hardware does not necessarily mean that all
>the associated routes also reside in hardware and vice-versa.
>
>While the kernel can signal to user space the presence of a nexthop in
>hardware (via 'RTNH_F_OFFLOAD'), it does not have a corresponding flag
>for routes. In addition, the fact that a route resides in hardware does
>not necessarily mean that the traffic is offloaded. For example,
>unreachable routes (i.e., 'RTN_UNREACHABLE') are programmed to trap
>packets to the CPU so that the kernel will be able to generate the
>appropriate ICMP error packet.
>
>This patch adds an "offload" and "trap" indications to IPv4 routes, so
>that users will have better visibility into the offload process.
>
>'struct fib_alias' is extended with two new fields that indicate if the
>route resides in hardware or not and if it is offloading traffic from
>the kernel or trapping packets to it. Note that the new fields are added
>in the 6 bytes hole and therefore the struct still fits in a single
>cache line [1].
>
>Capable drivers are expected to invoke fib_alias_hw_flags_set() with the
>route's key in order to set the flags.
>
>The indications are dumped to user space via a new flags (i.e.,
>'RTM_F_OFFLOAD' and 'RTM_F_TRAP') in the 'rtm_flags' field in the
>ancillary header.
>
>v2:
>* Make use of 'struct fib_rt_info' in fib_alias_hw_flags_set()
>
>[1]
>struct fib_alias {
>        struct hlist_node  fa_list;                      /*     0    16 */
>        struct fib_info *          fa_info;              /*    16     8 */
>        u8                         fa_tos;               /*    24     1 */
>        u8                         fa_type;              /*    25     1 */
>        u8                         fa_state;             /*    26     1 */
>        u8                         fa_slen;              /*    27     1 */
>        u32                        tb_id;                /*    28     4 */
>        s16                        fa_default;           /*    32     2 */
>        u8                         offload:1;            /*    34: 0  1 */
>        u8                         trap:1;               /*    34: 1  1 */
>        u8                         unused:6;             /*    34: 2  1 */
>
>        /* XXX 5 bytes hole, try to pack */
>
>        struct callback_head rcu __attribute__((__aligned__(8))); /*    40    16 */
>
>        /* size: 56, cachelines: 1, members: 12 */
>        /* sum members: 50, holes: 1, sum holes: 5 */
>        /* sum bitfield members: 8 bits (1 bytes) */
>        /* forced alignments: 1, forced holes: 1, sum forced holes: 5 */
>        /* last cacheline: 56 bytes */
>} __attribute__((__aligned__(8)));
>
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

  parent reply	other threads:[~2020-01-14 16:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 11:23 [PATCH net-next v2 00/10] net: Add route offload indication Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 01/10] ipv4: Replace route in list before notifying Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 02/10] ipv4: Encapsulate function arguments in a struct Ido Schimmel
2020-01-14 15:39   ` David Ahern
2020-01-14 16:35   ` Jiri Pirko
2020-01-14 11:23 ` [PATCH net-next v2 03/10] ipv4: Add "offload" and "trap" indications to routes Ido Schimmel
2020-01-14 15:43   ` David Ahern
2020-01-14 16:39   ` Jiri Pirko [this message]
2020-01-14 11:23 ` [PATCH net-next v2 04/10] ipv6: " Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 05/10] mlxsw: spectrum_router: Separate nexthop offload indication from route Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 06/10] mlxsw: spectrum_router: Set hardware flags for routes Ido Schimmel
2020-01-14 16:41   ` Jiri Pirko
2020-01-14 11:23 ` [PATCH net-next v2 07/10] netdevsim: fib: Add dummy implementation for FIB offload Ido Schimmel
2020-01-14 16:54   ` Jiri Pirko
2020-01-14 11:23 ` [PATCH net-next v2 08/10] selftests: forwarding: Add helpers and tests " Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 09/10] selftests: netdevsim: Add test for FIB offload API Ido Schimmel
2020-01-14 11:23 ` [PATCH net-next v2 10/10] selftests: mlxsw: " Ido Schimmel
2020-01-15  2:54 ` [PATCH net-next v2 00/10] net: Add route offload indication 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=20200114163936.GN2131@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.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).