aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-06-03 23:43:43 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-04 02:47:23 -0400
commit7616dcbb212eeec00c9bcc0fecb953fdee60634c (patch)
treec09e8d383d5c070d137afe898f589575d74566ff
parent4b5364fbdce7e4b947e6e76d7341675ea2e12f4d (diff)
switchdev: documentation: use switchdev_port_obj_xxx for IPv4 FIB add/modify/delete ops
Clarify in documentation and code that IPV4 FIB add operation is used for both adding a new FIB entry to the device and for modifying an existing FIB entry on the device. Also, remove left-over references to ipv4_fib ops and replace with details on SWITCHDEV_PORT_IPV4_FIB object. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/networking/switchdev.txt53
-rw-r--r--net/switchdev/switchdev.c4
2 files changed, 31 insertions, 26 deletions
diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
index 00c703ce6903..da82cd75a4f6 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -300,33 +300,38 @@ IGMP Snooping
300XXX: complete this section 300XXX: complete this section
301 301
302 302
303L3 routing 303L3 Routing Offload
304---------- 304------------------
305 305
306Offloading L3 routing requires that device be programmed with FIB entries from 306Offloading L3 routing requires that device be programmed with FIB entries from
307the kernel, with the device doing the FIB lookup and forwarding. The device 307the kernel, with the device doing the FIB lookup and forwarding. The device
308does a longest prefix match (LPM) on FIB entries matching route prefix and 308does a longest prefix match (LPM) on FIB entries matching route prefix and
309forwards the packet to the matching FIB entry's nexthop(s) egress ports. To 309forwards the packet to the matching FIB entry's nexthop(s) egress ports.
310program the device, the switchdev driver is called with add/delete ops for IPv4 310
311and IPv6 FIB entries. For IPv4, the driver implements switchdev ops: 311To program the device, the driver implements support for
312 312SWITCHDEV_OBJ_IPV[4|6]_FIB object using switchdev_port_obj_xxx ops.
313 int (*switchdev_fib_ipv4_add)(struct net_device *dev, 313switchdev_port_obj_add is used for both adding a new FIB entry to the device,
314 __be32 dst, int dst_len, 314or modifying an existing entry on the device.
315 struct fib_info *fi, 315
316 u8 tos, u8 type, 316XXX: Currently, only SWITCHDEV_OBJ_IPV4_FIB objects are supported.
317 u32 nlflags, u32 tb_id); 317
318 318SWITCHDEV_OBJ_IPV4_FIB object passes:
319 int (*switchdev_fib_ipv4_del)(struct net_device *dev, 319
320 __be32 dst, int dst_len, 320 struct switchdev_obj_ipv4_fib { /* IPV4_FIB */
321 struct fib_info *fi, 321 u32 dst;
322 u8 tos, u8 type, 322 int dst_len;
323 u32 tb_id); 323 struct fib_info *fi;
324 324 u8 tos;
325to add/delete IPv4 dst/dest_len prefix on table tb_id. The *fi structure holds 325 u8 type;
326details on the route and route's nexthops. *dev is one of the port netdevs 326 u32 nlflags;
327mentioned in the routes next hop list. If the output port netdevs referenced 327 u32 tb_id;
328in the route's nexthop list don't all have the same switch ID, the driver is 328 } ipv4_fib;
329not called to add/delete the FIB entry. 329
330to add/modify/delete IPv4 dst/dest_len prefix on table tb_id. The *fi
331structure holds details on the route and route's nexthops. *dev is one of the
332port netdevs mentioned in the routes next hop list. If the output port netdevs
333referenced in the route's nexthop list don't all have the same switch ID, the
334driver is not called to add/modify/delete the FIB entry.
330 335
331Routes offloaded to the device are labeled with "offload" in the ip route 336Routes offloaded to the device are labeled with "offload" in the ip route
332listing: 337listing:
@@ -344,7 +349,7 @@ listing:
344 12.0.0.4 via 11.0.0.9 dev sw1p2 proto zebra metric 20 offload 349 12.0.0.4 via 11.0.0.9 dev sw1p2 proto zebra metric 20 offload
345 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15 350 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15
346 351
347XXX: add/del IPv6 FIB API 352XXX: add/mod/del IPv6 FIB API
348 353
349Nexthop Resolution 354Nexthop Resolution
350^^^^^^^^^^^^^^^^^^ 355^^^^^^^^^^^^^^^^^^
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index ac853acbe211..e008057dab46 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -803,7 +803,7 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
803} 803}
804 804
805/** 805/**
806 * switchdev_fib_ipv4_add - Add IPv4 route entry to switch 806 * switchdev_fib_ipv4_add - Add/modify switch IPv4 route entry
807 * 807 *
808 * @dst: route's IPv4 destination address 808 * @dst: route's IPv4 destination address
809 * @dst_len: destination address length (prefix length) 809 * @dst_len: destination address length (prefix length)
@@ -813,7 +813,7 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
813 * @nlflags: netlink flags passed in (NLM_F_*) 813 * @nlflags: netlink flags passed in (NLM_F_*)
814 * @tb_id: route table ID 814 * @tb_id: route table ID
815 * 815 *
816 * Add IPv4 route entry to switch device. 816 * Add/modify switch IPv4 route entry.
817 */ 817 */
818int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, 818int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
819 u8 tos, u8 type, u32 nlflags, u32 tb_id) 819 u8 tos, u8 type, u32 nlflags, u32 tb_id)