History

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.

Scott Feldman committed 11 years ago

Commit 7616dcb1 parent 4b5364f2 files · +31 −26Browse files

Unified · Split

2 files
  1. Documentation/networking/switchdev.txt +29 −24
  2. net/switchdev/switchdev.c +2 −2
Documentation/networking/switchdev.txt+29−24
@@ -300,33 +300,38 @@ IGMP Snooping · 299 unmodified lines
300300 XXX: complete this section
301301
302302
303−L3 routing
304−----------
303+L3 Routing Offload
304+------------------
305305
306306 Offloading L3 routing requires that device be programmed with FIB entries from
307307 the kernel, with the device doing the FIB lookup and forwarding. The device
308308 does a longest prefix match (LPM) on FIB entries matching route prefix and
309−forwards the packet to the matching FIB entry's nexthop(s) egress ports. To
310−program the device, the switchdev driver is called with add/delete ops for IPv4
311−and IPv6 FIB entries. For IPv4, the driver implements switchdev ops:
312−
313− int (*switchdev_fib_ipv4_add)(struct net_device *dev,
314− __be32 dst, int dst_len,
315− struct fib_info *fi,
316− u8 tos, u8 type,
317− u32 nlflags, u32 tb_id);
318−
319− int (*switchdev_fib_ipv4_del)(struct net_device *dev,
320− __be32 dst, int dst_len,
321− struct fib_info *fi,
322− u8 tos, u8 type,
323− u32 tb_id);
324−
325−to add/delete IPv4 dst/dest_len prefix on table tb_id. The *fi structure holds
326−details on the route and route's nexthops. *dev is one of the port netdevs
327−mentioned in the routes next hop list. If the output port netdevs referenced
328−in the route's nexthop list don't all have the same switch ID, the driver is
329−not called to add/delete the FIB entry.
309+forwards the packet to the matching FIB entry's nexthop(s) egress ports.
310+
311+To program the device, the driver implements support for
312+SWITCHDEV_OBJ_IPV[4|6]_FIB object using switchdev_port_obj_xxx ops.
313+switchdev_port_obj_add is used for both adding a new FIB entry to the device,
314+or modifying an existing entry on the device.
315+
316+XXX: Currently, only SWITCHDEV_OBJ_IPV4_FIB objects are supported.
317+
318+SWITCHDEV_OBJ_IPV4_FIB object passes:
319+
320+ struct switchdev_obj_ipv4_fib { /* IPV4_FIB */
321+ u32 dst;
322+ int dst_len;
323+ struct fib_info *fi;
324+ u8 tos;
325+ u8 type;
326+ u32 nlflags;
327+ u32 tb_id;
328+ } ipv4_fib;
329+
330+to add/modify/delete IPv4 dst/dest_len prefix on table tb_id. The *fi
331+structure holds details on the route and route's nexthops. *dev is one of the
332+port netdevs mentioned in the routes next hop list. If the output port netdevs
333+referenced in the route's nexthop list don't all have the same switch ID, the
334+driver is not called to add/modify/delete the FIB entry.
330335
331336 Routes offloaded to the device are labeled with "offload" in the ip route
332337 listing:
@@ -344,7 +349,7 @@ listing: · 11 unmodified lines
344349 12.0.0.4 via 11.0.0.9 dev sw1p2 proto zebra metric 20 offload
345350 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15
346351
347−XXX: add/del IPv6 FIB API
352+XXX: add/mod/del IPv6 FIB API
348353
349354 Nexthop Resolution
350355 ^^^^^^^^^^^^^^^^^^
net/switchdev/switchdev.c+2−2
@@ -803,7 +803,7 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi) · 802 unmodified lines
803803 }
804804
805805 /**
806− * switchdev_fib_ipv4_add - Add IPv4 route entry to switch
806+ * switchdev_fib_ipv4_add - Add/modify switch IPv4 route entry
807807 *
808808 * @dst: route's IPv4 destination address
809809 * @dst_len: destination address length (prefix length)
@@ -813,7 +813,7 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi) · 3 unmodified lines
813813 * @nlflags: netlink flags passed in (NLM_F_*)
814814 * @tb_id: route table ID
815815 *
816− * Add IPv4 route entry to switch device.
816+ * Add/modify switch IPv4 route entry.
817817 */
818818 int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
819819 u8 tos, u8 type, u32 nlflags, u32 tb_id)