Commit a1db2178 authored by wenxu's avatar wenxu Committed by David S. Miller
Browse files

net: flow_offload: fix flow_indr_dev_unregister path



If the representor is removed, then identify the indirect flow_blocks
that need to be removed by the release callback and the port representor
structure. To identify the port representor structure, a new
indr.cb_priv field needs to be introduced. The flow_block also needs to
be removed from the driver list from the cleanup path.

Fixes: 1fac52da ("net: flow_offload: consolidate indirect flow_block infrastructure")

Signed-off-by: default avatarwenxu <wenxu@ucloud.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66f1939a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1911,7 +1911,7 @@ static int bnxt_tc_setup_indr_block(struct net_device *netdev, struct bnxt *bp,
		block_cb = flow_indr_block_cb_alloc(bnxt_tc_setup_indr_block_cb,
						    cb_priv, cb_priv,
						    bnxt_tc_setup_indr_rel, f,
						    netdev, data, cleanup);
						    netdev, data, bp, cleanup);
		if (IS_ERR(block_cb)) {
			list_del(&cb_priv->list);
			kfree(cb_priv);
@@ -2079,7 +2079,7 @@ void bnxt_shutdown_tc(struct bnxt *bp)
		return;

	flow_indr_dev_unregister(bnxt_tc_setup_indr_cb, bp,
				 bnxt_tc_setup_indr_block_cb);
				 bnxt_tc_setup_indr_rel);
	rhashtable_destroy(&tc_info->flow_table);
	rhashtable_destroy(&tc_info->l2_table);
	rhashtable_destroy(&tc_info->decap_l2_table);
+3 −2
Original line number Diff line number Diff line
@@ -442,7 +442,8 @@ mlx5e_rep_indr_setup_block(struct net_device *netdev,

		block_cb = flow_indr_block_cb_alloc(setup_cb, indr_priv, indr_priv,
						    mlx5e_rep_indr_block_unbind,
						    f, netdev, data, cleanup);
						    f, netdev, data, rpriv,
						    cleanup);
		if (IS_ERR(block_cb)) {
			list_del(&indr_priv->list);
			kfree(indr_priv);
@@ -503,7 +504,7 @@ int mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv)
void mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv)
{
	flow_indr_dev_unregister(mlx5e_rep_indr_setup_cb, rpriv,
				 mlx5e_rep_indr_setup_tc_cb);
				 mlx5e_rep_indr_block_unbind);
}

#if IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
+1 −1
Original line number Diff line number Diff line
@@ -861,7 +861,7 @@ static void nfp_flower_clean(struct nfp_app *app)
	flush_work(&app_priv->cmsg_work);

	flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app,
				 nfp_flower_setup_indr_block_cb);
				 nfp_flower_setup_indr_tc_release);

	if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)
		nfp_flower_qos_cleanup(app);
+1 −2
Original line number Diff line number Diff line
@@ -462,8 +462,7 @@ int nfp_flower_indr_setup_tc_cb(struct net_device *netdev, void *cb_priv,
				enum tc_setup_type type, void *type_data,
				void *data,
				void (*cleanup)(struct flow_block_cb *block_cb));
int nfp_flower_setup_indr_block_cb(enum tc_setup_type type, void *type_data,
				   void *cb_priv);
void nfp_flower_setup_indr_tc_release(void *cb_priv);

void
__nfp_flower_non_repr_priv_get(struct nfp_flower_non_repr_priv *non_repr_priv);
+4 −4
Original line number Diff line number Diff line
@@ -1619,7 +1619,7 @@ nfp_flower_indr_block_cb_priv_lookup(struct nfp_app *app,
	return NULL;
}

int nfp_flower_setup_indr_block_cb(enum tc_setup_type type,
static int nfp_flower_setup_indr_block_cb(enum tc_setup_type type,
					  void *type_data, void *cb_priv)
{
	struct nfp_flower_indr_block_cb_priv *priv = cb_priv;
@@ -1637,7 +1637,7 @@ int nfp_flower_setup_indr_block_cb(enum tc_setup_type type,
	}
}

static void nfp_flower_setup_indr_tc_release(void *cb_priv)
void nfp_flower_setup_indr_tc_release(void *cb_priv)
{
	struct nfp_flower_indr_block_cb_priv *priv = cb_priv;

@@ -1680,7 +1680,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
		block_cb = flow_indr_block_cb_alloc(nfp_flower_setup_indr_block_cb,
						    cb_priv, cb_priv,
						    nfp_flower_setup_indr_tc_release,
						    f, netdev, data, cleanup);
						    f, netdev, data, app, cleanup);
		if (IS_ERR(block_cb)) {
			list_del(&cb_priv->list);
			kfree(cb_priv);
Loading