Commit 0c7294dd authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by David S. Miller

net: flow_offload: remove netns parameter from flow_block_cb_alloc()

No need to annotate the netns on the flow block callback object,
flow_block_cb_is_busy() already checks for used blocks.

Fixes: d63db30c ("net: flow_offload: add flow_block_cb_alloc() and flow_block_cb_free()")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aef833c5
...@@ -735,8 +735,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, ...@@ -735,8 +735,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
list_add(&indr_priv->list, list_add(&indr_priv->list,
&rpriv->uplink_priv.tc_indr_block_priv_list); &rpriv->uplink_priv.tc_indr_block_priv_list);
block_cb = flow_block_cb_alloc(f->net, block_cb = flow_block_cb_alloc(mlx5e_rep_indr_setup_block_cb,
mlx5e_rep_indr_setup_block_cb,
indr_priv, indr_priv, indr_priv, indr_priv,
mlx5e_rep_indr_tc_block_unbind); mlx5e_rep_indr_tc_block_unbind);
if (IS_ERR(block_cb)) { if (IS_ERR(block_cb)) {
......
...@@ -1610,8 +1610,7 @@ mlxsw_sp_setup_tc_block_flower_bind(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1610,8 +1610,7 @@ mlxsw_sp_setup_tc_block_flower_bind(struct mlxsw_sp_port *mlxsw_sp_port,
acl_block = mlxsw_sp_acl_block_create(mlxsw_sp, f->net); acl_block = mlxsw_sp_acl_block_create(mlxsw_sp, f->net);
if (!acl_block) if (!acl_block)
return -ENOMEM; return -ENOMEM;
block_cb = flow_block_cb_alloc(f->net, block_cb = flow_block_cb_alloc(mlxsw_sp_setup_tc_block_cb_flower,
mlxsw_sp_setup_tc_block_cb_flower,
mlxsw_sp, acl_block, mlxsw_sp, acl_block,
mlxsw_sp_tc_block_flower_release); mlxsw_sp_tc_block_flower_release);
if (IS_ERR(block_cb)) { if (IS_ERR(block_cb)) {
...@@ -1702,7 +1701,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1702,7 +1701,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
&mlxsw_sp_block_cb_list)) &mlxsw_sp_block_cb_list))
return -EBUSY; return -EBUSY;
block_cb = flow_block_cb_alloc(f->net, cb, mlxsw_sp_port, block_cb = flow_block_cb_alloc(cb, mlxsw_sp_port,
mlxsw_sp_port, NULL); mlxsw_sp_port, NULL);
if (IS_ERR(block_cb)) if (IS_ERR(block_cb))
return PTR_ERR(block_cb); return PTR_ERR(block_cb);
......
...@@ -323,8 +323,7 @@ int ocelot_setup_tc_block_flower_bind(struct ocelot_port *port, ...@@ -323,8 +323,7 @@ int ocelot_setup_tc_block_flower_bind(struct ocelot_port *port,
if (!port_block) if (!port_block)
return -ENOMEM; return -ENOMEM;
block_cb = flow_block_cb_alloc(f->net, block_cb = flow_block_cb_alloc(ocelot_setup_tc_block_cb_flower,
ocelot_setup_tc_block_cb_flower,
port, port_block, port, port_block,
ocelot_tc_block_unbind); ocelot_tc_block_unbind);
if (IS_ERR(block_cb)) { if (IS_ERR(block_cb)) {
......
...@@ -156,7 +156,7 @@ static int ocelot_setup_tc_block(struct ocelot_port *port, ...@@ -156,7 +156,7 @@ static int ocelot_setup_tc_block(struct ocelot_port *port,
if (flow_block_cb_is_busy(cb, port, &ocelot_block_cb_list)) if (flow_block_cb_is_busy(cb, port, &ocelot_block_cb_list))
return -EBUSY; return -EBUSY;
block_cb = flow_block_cb_alloc(f->net, cb, port, port, NULL); block_cb = flow_block_cb_alloc(cb, port, port, NULL);
if (IS_ERR(block_cb)) if (IS_ERR(block_cb))
return PTR_ERR(block_cb); return PTR_ERR(block_cb);
......
...@@ -1318,8 +1318,7 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev, ...@@ -1318,8 +1318,7 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev,
&nfp_block_cb_list)) &nfp_block_cb_list))
return -EBUSY; return -EBUSY;
block_cb = flow_block_cb_alloc(f->net, block_cb = flow_block_cb_alloc(nfp_flower_setup_tc_block_cb,
nfp_flower_setup_tc_block_cb,
repr, repr, NULL); repr, repr, NULL);
if (IS_ERR(block_cb)) if (IS_ERR(block_cb))
return PTR_ERR(block_cb); return PTR_ERR(block_cb);
...@@ -1424,8 +1423,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app, ...@@ -1424,8 +1423,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
cb_priv->app = app; cb_priv->app = app;
list_add(&cb_priv->list, &priv->indr_block_cb_priv); list_add(&cb_priv->list, &priv->indr_block_cb_priv);
block_cb = flow_block_cb_alloc(f->net, block_cb = flow_block_cb_alloc(nfp_flower_setup_indr_block_cb,
nfp_flower_setup_indr_block_cb,
cb_priv, cb_priv, cb_priv, cb_priv,
nfp_flower_setup_indr_tc_release); nfp_flower_setup_indr_tc_release);
if (IS_ERR(block_cb)) { if (IS_ERR(block_cb)) {
......
...@@ -264,7 +264,6 @@ struct flow_block_offload { ...@@ -264,7 +264,6 @@ struct flow_block_offload {
struct flow_block_cb { struct flow_block_cb {
struct list_head driver_list; struct list_head driver_list;
struct list_head list; struct list_head list;
struct net *net;
tc_setup_cb_t *cb; tc_setup_cb_t *cb;
void *cb_ident; void *cb_ident;
void *cb_priv; void *cb_priv;
...@@ -272,7 +271,7 @@ struct flow_block_cb { ...@@ -272,7 +271,7 @@ struct flow_block_cb {
unsigned int refcnt; unsigned int refcnt;
}; };
struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb, struct flow_block_cb *flow_block_cb_alloc(tc_setup_cb_t *cb,
void *cb_ident, void *cb_priv, void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv)); void (*release)(void *cb_priv));
void flow_block_cb_free(struct flow_block_cb *block_cb); void flow_block_cb_free(struct flow_block_cb *block_cb);
......
...@@ -165,7 +165,7 @@ void flow_rule_match_enc_opts(const struct flow_rule *rule, ...@@ -165,7 +165,7 @@ void flow_rule_match_enc_opts(const struct flow_rule *rule,
} }
EXPORT_SYMBOL(flow_rule_match_enc_opts); EXPORT_SYMBOL(flow_rule_match_enc_opts);
struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb, struct flow_block_cb *flow_block_cb_alloc(tc_setup_cb_t *cb,
void *cb_ident, void *cb_priv, void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv)) void (*release)(void *cb_priv))
{ {
...@@ -175,7 +175,6 @@ struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb, ...@@ -175,7 +175,6 @@ struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb,
if (!block_cb) if (!block_cb)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
block_cb->net = net;
block_cb->cb = cb; block_cb->cb = cb;
block_cb->cb_ident = cb_ident; block_cb->cb_ident = cb_ident;
block_cb->cb_priv = cb_priv; block_cb->cb_priv = cb_priv;
...@@ -200,8 +199,7 @@ struct flow_block_cb *flow_block_cb_lookup(struct flow_block_offload *f, ...@@ -200,8 +199,7 @@ struct flow_block_cb *flow_block_cb_lookup(struct flow_block_offload *f,
struct flow_block_cb *block_cb; struct flow_block_cb *block_cb;
list_for_each_entry(block_cb, f->driver_block_list, driver_list) { list_for_each_entry(block_cb, f->driver_block_list, driver_list) {
if (block_cb->net == f->net && if (block_cb->cb == cb &&
block_cb->cb == cb &&
block_cb->cb_ident == cb_ident) block_cb->cb_ident == cb_ident)
return block_cb; return block_cb;
} }
...@@ -261,8 +259,7 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f, ...@@ -261,8 +259,7 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f,
if (flow_block_cb_is_busy(cb, cb_ident, driver_block_list)) if (flow_block_cb_is_busy(cb, cb_ident, driver_block_list))
return -EBUSY; return -EBUSY;
block_cb = flow_block_cb_alloc(f->net, cb, cb_ident, block_cb = flow_block_cb_alloc(cb, cb_ident, cb_priv, NULL);
cb_priv, NULL);
if (IS_ERR(block_cb)) if (IS_ERR(block_cb))
return PTR_ERR(block_cb); return PTR_ERR(block_cb);
......
...@@ -967,7 +967,7 @@ static int dsa_slave_setup_tc_block(struct net_device *dev, ...@@ -967,7 +967,7 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
if (flow_block_cb_is_busy(cb, dev, &dsa_slave_block_cb_list)) if (flow_block_cb_is_busy(cb, dev, &dsa_slave_block_cb_list))
return -EBUSY; return -EBUSY;
block_cb = flow_block_cb_alloc(f->net, cb, dev, dev, NULL); block_cb = flow_block_cb_alloc(cb, dev, dev, NULL);
if (IS_ERR(block_cb)) if (IS_ERR(block_cb))
return PTR_ERR(block_cb); return PTR_ERR(block_cb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment