Ido Schimmel
2021-May-02 15:04 UTC
[Bridge] [RFC net-next 4/9] net: bridge: switchdev: Forward offloading
On Mon, Apr 26, 2021 at 07:04:06PM +0200, Tobias Waldekranz wrote:> +static void nbp_switchdev_fwd_offload_add(struct net_bridge_port *p) > +{ > + void *priv; > + > + if (!(p->dev->features & NETIF_F_HW_L2FW_DOFFLOAD)) > + return; > + > + priv = p->dev->netdev_ops->ndo_dfwd_add_station(p->dev, p->br->dev);Some changes to team/bond/8021q will be needed in order to get this optimization to work when they are enslaved to the bridge instead of the front panel port itself?> + if (!IS_ERR_OR_NULL(priv)) > + p->accel_priv = priv; > +} > + > +static void nbp_switchdev_fwd_offload_del(struct net_bridge_port *p) > +{ > + if (!p->accel_priv) > + return; > + > + p->dev->netdev_ops->ndo_dfwd_del_station(p->dev, p->accel_priv); > + p->accel_priv = NULL; > +}
Tobias Waldekranz
2021-May-03 08:53 UTC
[Bridge] [RFC net-next 4/9] net: bridge: switchdev: Forward offloading
On Sun, May 02, 2021 at 18:04, Ido Schimmel <idosch at idosch.org> wrote:> On Mon, Apr 26, 2021 at 07:04:06PM +0200, Tobias Waldekranz wrote: >> +static void nbp_switchdev_fwd_offload_add(struct net_bridge_port *p) >> +{ >> + void *priv; >> + >> + if (!(p->dev->features & NETIF_F_HW_L2FW_DOFFLOAD)) >> + return; >> + >> + priv = p->dev->netdev_ops->ndo_dfwd_add_station(p->dev, p->br->dev); > > Some changes to team/bond/8021q will be needed in order to get this > optimization to work when they are enslaved to the bridge instead of the > front panel port itself?Right you are. We should probably do something similar to the switchdev_handle_port_* family of helpers that could be reused in stacked devices. I will look at it for v1.>> + if (!IS_ERR_OR_NULL(priv)) >> + p->accel_priv = priv; >> +} >> + >> +static void nbp_switchdev_fwd_offload_del(struct net_bridge_port *p) >> +{ >> + if (!p->accel_priv) >> + return; >> + >> + p->dev->netdev_ops->ndo_dfwd_del_station(p->dev, p->accel_priv); >> + p->accel_priv = NULL; >> +}