Thread (23 messages) 23 messages, 5 authors, 2021-07-12

Re: [RFC PATCH v2 net-next 04/10] net: bridge: switchdev: allow the data plane forwarding to be offloaded

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-07-09 13:16:44


On 03/07/2021 14:56, Vladimir Oltean wrote:
From: Tobias Waldekranz <tobias@waldekranz.com>

Allow switchdevs to forward frames from the CPU in accordance with the
bridge configuration in the same way as is done between bridge
ports. This means that the bridge will only send a single skb towards
one of the ports under the switchdev's control, and expects the driver
to deliver the packet to all eligible ports in its domain.

Primarily this improves the performance of multicast flows with
multiple subscribers, as it allows the hardware to perform the frame
replication.

The basic flow between the driver and the bridge is as follows:

- The switchdev accepts the offload by returning a non-null pointer
   from .ndo_dfwd_add_station when the port is added to the bridge.

- The bridge sends offloadable skbs to one of the ports under the
   switchdev's control using dev_queue_xmit_accel.

- The switchdev notices the offload by checking for a non-NULL
   "sb_dev" in the core's call to .ndo_select_queue.
Sry, I could be missing smth.

Is there any possibility to just mark skb itself as "fwd_offload" (or smth), so driver can
just check it and decide what to do. Following you series:
- BR itself will send packet only once to one port if fwd offload possible and supported
- switchdev driver can check/negotiate BR_FWD_OFFLOAD flag

In our case, TI CPSW can send directed packet (default now), by specifying port_id if DMA desc
or keep port_id == 0 which will allow HW to process packet internally, including MC duplication.

Sry, again, but necessity to add 3 callbacks and manipulate with "virtual" queue to achieve
MC offload (seems like one of the primary goals) from BR itself looks a bit over-complicated :(
v1->v2:
- convert br_input_skb_cb::fwd_hwdoms to a plain unsigned long
- introduce a static key "br_switchdev_fwd_offload_used" to minimize the
   impact of the newly introduced feature on all the setups which don't
   have hardware that can make use of it
- introduce a check for nbp->flags & BR_FWD_OFFLOAD to optimize cache
   line access
- reorder nbp_switchdev_frame_mark_accel() and br_handle_vlan() in
   __br_forward()
- do not strip VLAN on egress if forwarding offload on VLAN-aware bridge
   is being used
- propagate errors from .ndo_dfwd_add_station() if not EOPNOTSUPP

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
  include/linux/if_bridge.h |  1 +
  net/bridge/br_forward.c   | 18 +++++++-
  net/bridge/br_private.h   | 24 +++++++++++
  net/bridge/br_switchdev.c | 87 +++++++++++++++++++++++++++++++++++++--
[...]

-- 
Best regards,
grygorii
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help