Re: [PATCH net-next,v3 10/11] net: flow_offload: add flow_block_cb_is_busy() and use it

Jiri Pirko
2019-07-09T13:36:59Z

Mon, Jul 08, 2019 at 06:06:12PM CEST, pablo@netfilter.org wrote:
>This patch adds a function to check if flow block callback is already in
>use. Call this new function from flow_block_cb_setup_simple() and from
>drivers.
>
>Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
>---
>v3: formerly known as "net: flow_offload: don't allow subsystem to reuse blocks"
> add flow_block_cb_is_busy() helper. Call it per driver to make it easier
> to remove this whenever the first driver client support for multiple
> subsystem offloads.
>
> drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 ++++
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++++
> drivers/net/ethernet/mscc/ocelot_tc.c | 3 +++
> drivers/net/ethernet/netronome/nfp/flower/offload.c | 4 ++++
> include/net/flow_offload.h | 3 +++
> net/core/flow_offload.c | 18 ++++++++++++++++++
> net/dsa/slave.c | 3 +++
> 7 files changed, 39 insertions(+)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>index 19133b9e121a..e303149053e4 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
>@@ -721,6 +721,10 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
> if (indr_priv)
> return -EEXIST;
>
>+ if (flow_block_cb_is_busy(mlx5e_rep_indr_setup_block_cb,
>+ indr_priv, &mlx5e_block_cb_list))

As I already asked for in another patch in this set, it would be really
much much better to have some wrapping struct instead of plain list
head here. …