Hi Vladimir,

On Thu Dec 17 2020, Vladimir Oltean wrote:
> Since the introduction of the switchdev API, port attributes were
> transmitted to drivers for offloading using a two-step transactional
> model, with a prepare phase that was supposed to catch all errors, and a
> commit phase that was supposed to never fail.
>
> Some classes of failures can never be avoided, like hardware access, or
> memory allocation. In the latter case, merely attempting to move the
> memory allocation to the preparation phase makes it impossible to avoid
> memory leaks, since commit 91cf8eceffc1 ("switchdev: Remove unused
> transaction item queue") which has removed the unused mechanism of
> passing on the allocated memory between one phase and another.
>
> It is time we admit that separating the preparation from the commit
> phase is something that is best left for the driver to decide, and not
> something that should be baked into the API, especially since there are
> no switchdev callers that depend on this.
>
> This patch removes the struct switchdev_trans member from switchdev port
> attribute notifier structures, and converts drivers to not look at this
> member.
>
> In part, this patch contains a revert of my previous commit 2e554a7a5d8a
> ("net: dsa: propagate switchdev vlan_filtering prepare phase to
> drivers").
>
> For the most part, the conversion was trivial except for:
> - Rocker's world implementation based on Broadcom OF-DPA had an odd
>   implementation of ofdpa_port_attr_bridge_flags_set. The conversion was
>   done mechanically, by pasting the implementation twice, then only
>   keeping the code that would get executed during prepare phase on top,
>   then only keeping the code that gets executed during the commit phase
>   on bottom, then simplifying the resulting code until this was obtained.
> - DSA's offloading of STP state, bridge flags, VLAN filtering and
>   multicast router could be converted right away. But the ageing time
>   could not, so a shim was introduced and this was left for a further
>   commit.
>
> Signed-off-by: Vladimir Oltean <vladimir.olt...@nxp.com>
> ---
>  drivers/net/dsa/b53/b53_common.c              |  6 +-
>  drivers/net/dsa/b53/b53_priv.h                |  3 +-
>  drivers/net/dsa/dsa_loop.c                    |  3 +-
>  drivers/net/dsa/hirschmann/hellcreek.c        |  6 +-
>  drivers/net/dsa/lantiq_gswip.c                | 26 +----
>  drivers/net/dsa/microchip/ksz8795.c           |  6 +-
>  drivers/net/dsa/microchip/ksz9477.c           |  6 +-
>  drivers/net/dsa/mt7530.c                      |  6 +-
>  drivers/net/dsa/mv88e6xxx/chip.c              |  7 +-
>  drivers/net/dsa/ocelot/felix.c                |  5 +-
>  drivers/net/dsa/qca8k.c                       |  6 +-
>  drivers/net/dsa/realtek-smi-core.h            |  3 +-
>  drivers/net/dsa/rtl8366.c                     | 11 +--
>  drivers/net/dsa/sja1105/sja1105.h             |  3 +-
>  drivers/net/dsa/sja1105/sja1105_devlink.c     |  9 +-
>  drivers/net/dsa/sja1105/sja1105_main.c        | 17 ++--
>  .../marvell/prestera/prestera_switchdev.c     | 37 ++-----
>  .../mellanox/mlxsw/spectrum_switchdev.c       | 63 +++---------
>  drivers/net/ethernet/mscc/ocelot.c            | 32 ++----
>  drivers/net/ethernet/mscc/ocelot_net.c        | 13 +--
>  drivers/net/ethernet/rocker/rocker.h          |  6 +-
>  drivers/net/ethernet/rocker/rocker_main.c     | 46 +++------
>  drivers/net/ethernet/rocker/rocker_ofdpa.c    | 23 ++---
>  drivers/net/ethernet/ti/cpsw_switchdev.c      | 20 +---
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.c       | 21 +---
>  include/net/dsa.h                             |  3 +-
>  include/net/switchdev.h                       |  7 +-
>  include/soc/mscc/ocelot.h                     |  3 +-
>  net/dsa/dsa_priv.h                            | 18 ++--
>  net/dsa/port.c                                | 97 ++++++++-----------
>  net/dsa/slave.c                               | 17 ++--
>  net/dsa/switch.c                              | 11 +--
>  net/switchdev/switchdev.c                     | 46 +--------
>  33 files changed, 162 insertions(+), 424 deletions(-)
>

Reviewed-by: Kurt Kanzenbach <k...@linutronix.de>

for the hellcreek part.

Thanks,
Kurt

Attachment: signature.asc
Description: PGP signature

Reply via email to