diff options
author | David S. Miller <davem@davemloft.net> | 2015-03-06 00:26:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-06 00:26:16 -0500 |
commit | fabe7bed114a0ffc02845b731c26aadd800e7b5d (patch) | |
tree | fa5bf3aaa17cb488284366d10a314e8abfb66583 /include/net/switchdev.h | |
parent | 24d2e4a50737867aba1e96a587ef0d90c17e3035 (diff) | |
parent | c1beeef7a32a791a60e2adcc217d4461cd1e25d1 (diff) |
Merge branch 'l3_hw_offload'
Scott Feldman says:
====================
switchdev: add IPv4 routing offload
v4:
- Add NETIF_F_NETNS_LOCAL to rocker port feature list to keep rocker
ports in the default netns. Rocker hardware can't be partitioned
to support multiple namespaces, currently. It would be interesting
to add netns support to rocker device by basically adding another
match field to each table to match on some unique netns ID, with
a port knowing it's netns ID. Future work TDB.
- Up-level the RTNH_F_EXTERNAL marking of routes installed to offload
device from driver to switchdev common code. Now driver can't skip
routes. Either it can install the route or it cannot. Yes or No.
If no on any route, all offloading is aborted by removing routes
from offload device and setting ipv4.fib_offload_disabled so no more
routes can be offloaded. This is harsh, but it's our starting point.
We can refine the policies in follow-up work.
- Add new net.ipv4.fib_offload_disabled bool that is set if anything
goes wrong with route offloading. We can refine this later to make
the setting per-device or per-device-port-netdev, but let's start
here simple and refine in follow-up work.
- Rebase against Alex's latest FIB changes. I think I did everything
correctly, and didn't run into any issues with testing, but I'd like
Alex to look over the changes and maybe follow-up with any cleanups.
v3:
Changes based on v2 review comments:
- Move check for custom rules up earlier in patch set, to keep git bisect
safe.
- Simplify the route add/modify failure handling to simple try until
failure, and then on failure, undo everything. The switchdev driver
will return err when route can normally be installed to device, but
the install fails for one reason or another (no space left on device,
etc). If a failure happens, uninstall all routes from the device,
punting forwarding for all routes back to the kernel.
- Scan route's full nexthop list, ensuring all nexthop devs belong
to the same switchdev device, otherwise don't try to install route
to device.
v2:
Changes based on v1 review comments and discussions at netconf:
- Allow route modification, but use same ndo op used for adding route.
Driver/device is expected to modify route in-place, if it can, to avoid
interruption of service.
- Add new RTNH_F_EXTERNAL flag to mark FIB entries offloaded externally.
- Don't offload routes if using custom IP rules. If routes are already
offloaded, and custom IP rules are turned on, flush routes from offload
device. (Offloaded routes are marked with RTNH_F_EXTERNAL).
- Use kernel's neigh resolution code to resolve route's nexthops' neigh
MAC addrs. (Thanks davem, works great!).
- Use fib->fib_priority in rocker driver to give priorities to routes in
OF-DPA unicast route table.
v1:
This patch set adds L3 routing offload support for IPv4 routes. The idea is to
mirror routes installed in the kernel's FIB down to a hardware switch device to
offload the data forwarding path for L3. Only the data forwarding path is
intercepted. Control and management of the kernel's FIB remains with the
kernel.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/switchdev.h')
-rw-r--r-- | include/net/switchdev.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index cfcdac2e5d25..dc0a5cc7c2c5 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -51,6 +51,12 @@ int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags); int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags); +int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, + u8 tos, u8 type, u32 tb_id); +int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, + u8 tos, u8 type, u32 tb_id); +void netdev_switch_fib_ipv4_abort(struct fib_info *fi); + #else static inline int netdev_switch_parent_id_get(struct net_device *dev, @@ -109,6 +115,24 @@ static inline int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device * return 0; } +static inline int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, + struct fib_info *fi, + u8 tos, u8 type, u32 tb_id) +{ + return 0; +} + +static inline int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, + struct fib_info *fi, + u8 tos, u8 type, u32 tb_id) +{ + return 0; +} + +void netdev_switch_fib_ipv4_abort(struct fib_info *fi) +{ +} + #endif #endif /* _LINUX_SWITCHDEV_H_ */ |