From: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
To: sfeldma@gmail.com, netdev@vger.kernel.org, davem@davemloft.net,
jiri@resnulli.us, roopa@cumulusnetworks.com
Subject: Re: [PATCH net-next v2 2/4] net: add IPv4 routing FIB support for switchdev
Date: Mon, 02 Mar 2015 14:27:04 -0800 [thread overview]
Message-ID: <54F4E3B8.5020705@intel.com> (raw)
In-Reply-To: <1425290777-22702-3-git-send-email-sfeldma@gmail.com>
On 3/2/2015 2:06 AM, sfeldma@gmail.com wrote:
> From: Scott Feldman <sfeldma@gmail.com>
>
> Add two new ndo ops (ndo_switch_fib_ipv4_add/del) for switchdev devices
> capable of offloading IPv4 L3 routing function from the kernel. The ops are
> called by the core IPv4 FIB code when installing/removing/modifying FIB entries
> in the kernel FIB. On install/modify, the driver should return 0 if FIB entry
> (route) can be installed/modified to device; -EOPNOTSUPP if route cannot be
> installed/modified due to device limitations; and any other negative error code
> on failure to install route to device. On failure error code, the route is not
> installed to device, and not installed in kernel FIB, and the return code is
> propagated back to the user-space caller (via netlink). An -EOPNOTSUPP error
> code is skipped for the device but installed in the kernel FIB.
>
> The FIB entry (route) nexthop list is used to find the switchdev netdev to
> anchor the ndo op call. The route's fib_dev (the first nexthop's dev) is used
> find the switchdev netdev by recursively traversing the fib_dev's lower_dev
> list until a switchdev netdev is found. The ndo op is called on this switchdev
> netdev. This downward traversal is necessary for switchdev ports stacked under
> bonds and/or bridges, where the bond or bridge has the L3 interface.
>
> Thw switchdev driver can monitor netevent notifier NETEVENT_NEIGH_UPDATE to
> know neighbor IP addresses which are resolved to a MAC address. In the case
> where the route's nexthops list contains unresolved neighbor IP addresses, the
> driver can ask the kernel to resolve the neighbor. As route nexthops are
> resolved, the driver has enough information to program the device for
> L3 forwarding offload.
>
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
> include/linux/netdevice.h | 22 +++++++++++
> include/net/switchdev.h | 19 +++++++++
> net/ipv4/fib_trie.c | 33 ++++++++++++++--
> net/switchdev/switchdev.c | 95 +++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 166 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 5897b4e..73b2766 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -769,6 +769,8 @@ struct netdev_phys_item_id {
> typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
> struct sk_buff *skb);
>
> +struct fib_info;
> +
> /*
> * This structure defines the management hooks for network devices.
> * The following hooks can be defined; unless noted otherwise, they are
> @@ -1032,6 +1034,14 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
> * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
> * Called to notify switch device port of bridge port STP
> * state change.
> + * int (*ndo_sw_parent_fib_ipv4_add)(struct net_device *dev, __be32 dst,
> + * int dst_len, struct fib_info *fi,
> + * u8 tos, u8 type, u32 tb_id);
> + * Called to add/modify IPv4 route to switch device.
> + * int (*ndo_sw_parent_fib_ipv4_del)(struct net_device *dev, __be32 dst,
> + * int dst_len, struct fib_info *fi,
> + * u8 tos, u8 type, u32 tb_id);
> + * Called to delete IPv4 route from switch device.
> */
> struct net_device_ops {
> int (*ndo_init)(struct net_device *dev);
> @@ -1193,6 +1203,18 @@ struct net_device_ops {
> struct netdev_phys_item_id *psid);
> int (*ndo_switch_port_stp_update)(struct net_device *dev,
> u8 state);
> + int (*ndo_switch_fib_ipv4_add)(struct net_device *dev,
> + __be32 dst,
> + int dst_len,
> + struct fib_info *fi,
> + u8 tos, u8 type,
> + u32 tb_id);
> + int (*ndo_switch_fib_ipv4_del)(struct net_device *dev,
> + __be32 dst,
> + int dst_len,
> + struct fib_info *fi,
> + u8 tos, u8 type,
> + u32 tb_id);
> #endif
> };
>
Don't we need ndo's to offload adding/deleting neighbor table entries
and router interface or gateway addresses?
Is it expected that the switch driver can program the hardware in
response to the neighbor update events?
Thanks
Sridhar
next prev parent reply other threads:[~2015-03-02 22:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 10:06 [PATCH net-next v2 0/4] switchdev: add IPv4 routing offload sfeldma
2015-03-02 10:06 ` [PATCH net-next v2 1/4] rtnetlink: add RTNH_F_EXTERNAL flag for fib offload sfeldma
2015-03-02 10:06 ` [PATCH net-next v2 2/4] net: add IPv4 routing FIB support for switchdev sfeldma
2015-03-02 14:30 ` roopa
2015-03-02 17:10 ` Scott Feldman
2015-03-02 19:24 ` roopa
2015-03-02 22:27 ` Samudrala, Sridhar [this message]
2015-03-02 22:31 ` David Miller
2015-03-02 10:06 ` [PATCH net-next v2 3/4] rocker: implement IPv4 fib offloading sfeldma
2015-03-02 10:06 ` [PATCH net-next v2 4/4] switchdev: don't support custom ip rules, for now sfeldma
2015-03-02 14:36 ` roopa
2015-03-02 17:00 ` Scott Feldman
2015-03-02 19:09 ` roopa
2015-03-02 20:40 ` David Miller
2015-03-02 20:30 ` David Miller
2015-03-02 20:10 ` 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=54F4E3B8.5020705@intel.com \
--to=sridhar.samudrala@intel.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=sfeldma@gmail.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).