Skip to content

Commit

Permalink
net: flow_offload: rename TC_BLOCK_{UN}BIND to FLOW_BLOCK_{UN}BIND
Browse files Browse the repository at this point in the history
Rename from TC_BLOCK_{UN}BIND to FLOW_BLOCK_{UN}BIND and remove
temporary tc_block_command alias.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pablo Neira Ayuso authored and David S. Miller committed Jul 9, 2019
1 parent 4e95bc2 commit 9c0e189
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
return -EOPNOTSUPP;

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
if (indr_priv)
return -EEXIST;
Expand All @@ -728,7 +728,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
}

return err;
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
if (!indr_priv)
return -ENOENT;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
}

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
err = tcf_block_cb_register(f->block, cb, mlxsw_sp_port,
mlxsw_sp_port, f->extack);
if (err)
Expand All @@ -1692,7 +1692,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
return err;
}
return 0;
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
mlxsw_sp_setup_tc_block_flower_unbind(mlxsw_sp_port,
f->block, ingress);
tcf_block_cb_unregister(f->block, cb, mlxsw_sp_port);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mscc/ocelot_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ static int ocelot_setup_tc_block(struct ocelot_port *port,
}

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
ret = tcf_block_cb_register(f->block, cb, port,
port, f->extack);
if (ret)
return ret;

return ocelot_setup_tc_block_flower_bind(port, f);
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
ocelot_setup_tc_block_flower_unbind(port, f);
tcf_block_cb_unregister(f->block, cb, port);
return 0;
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/netronome/nfp/flower/offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,11 +1315,11 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev,
repr_priv->block_shared = tcf_block_shared(f->block);

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
return tcf_block_cb_register(f->block,
nfp_flower_setup_tc_block_cb,
repr, repr, f->extack);
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
tcf_block_cb_unregister(f->block,
nfp_flower_setup_tc_block_cb,
repr);
Expand Down Expand Up @@ -1395,7 +1395,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
return -EOPNOTSUPP;

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
cb_priv = kmalloc(sizeof(*cb_priv), GFP_KERNEL);
if (!cb_priv)
return -ENOMEM;
Expand All @@ -1413,7 +1413,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
}

return err;
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
cb_priv = nfp_flower_indr_block_cb_priv_lookup(app, netdev);
if (!cb_priv)
return -ENOENT;
Expand Down
4 changes: 2 additions & 2 deletions include/net/flow_offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ static inline void flow_stats_update(struct flow_stats *flow_stats,
}

enum flow_block_command {
TC_BLOCK_BIND,
TC_BLOCK_UNBIND,
FLOW_BLOCK_BIND,
FLOW_BLOCK_UNBIND,
};

enum flow_block_binder_type {
Expand Down
1 change: 0 additions & 1 deletion include/net/pkt_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ int register_tcf_proto_ops(struct tcf_proto_ops *ops);
int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);

#define tc_block_offload flow_block_offload
#define tc_block_command flow_block_command
#define tcf_block_binder_type flow_block_binder_type

struct tcf_block_ext_info {
Expand Down
4 changes: 2 additions & 2 deletions net/core/flow_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f,
f->driver_block_list = driver_block_list;

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
return tcf_block_cb_register(f->block, cb, cb_ident, cb_priv,
f->extack);
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
tcf_block_cb_unregister(f->block, cb, cb_ident);
return 0;
default:
Expand Down
4 changes: 2 additions & 2 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
return -EOPNOTSUPP;

switch (f->command) {
case TC_BLOCK_BIND:
case FLOW_BLOCK_BIND:
return tcf_block_cb_register(f->block, cb, dev, dev, f->extack);
case TC_BLOCK_UNBIND:
case FLOW_BLOCK_UNBIND:
tcf_block_cb_unregister(f->block, cb, dev);
return 0;
default:
Expand Down
22 changes: 11 additions & 11 deletions net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ static void tc_indr_block_cb_del(struct tc_indr_block_cb *indr_block_cb)

static void tc_indr_block_ing_cmd(struct tc_indr_block_dev *indr_dev,
struct tc_indr_block_cb *indr_block_cb,
enum tc_block_command command)
enum flow_block_command command)
{
struct tc_block_offload bo = {
.command = command,
Expand Down Expand Up @@ -706,7 +706,7 @@ int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
if (err)
goto err_dev_put;

tc_indr_block_ing_cmd(indr_dev, indr_block_cb, TC_BLOCK_BIND);
tc_indr_block_ing_cmd(indr_dev, indr_block_cb, FLOW_BLOCK_BIND);
return 0;

err_dev_put:
Expand Down Expand Up @@ -743,7 +743,7 @@ void __tc_indr_block_cb_unregister(struct net_device *dev,
return;

/* Send unbind message if required to free any block cbs. */
tc_indr_block_ing_cmd(indr_dev, indr_block_cb, TC_BLOCK_UNBIND);
tc_indr_block_ing_cmd(indr_dev, indr_block_cb, FLOW_BLOCK_UNBIND);
tc_indr_block_cb_del(indr_block_cb);
tc_indr_block_dev_put(indr_dev);
}
Expand All @@ -760,7 +760,7 @@ EXPORT_SYMBOL_GPL(tc_indr_block_cb_unregister);

static void tc_indr_block_call(struct tcf_block *block, struct net_device *dev,
struct tcf_block_ext_info *ei,
enum tc_block_command command,
enum flow_block_command command,
struct netlink_ext_ack *extack)
{
struct tc_indr_block_cb *indr_block_cb;
Expand All @@ -776,7 +776,7 @@ static void tc_indr_block_call(struct tcf_block *block, struct net_device *dev,
if (!indr_dev)
return;

indr_dev->block = command == TC_BLOCK_BIND ? block : NULL;
indr_dev->block = command == FLOW_BLOCK_BIND ? block : NULL;

list_for_each_entry(indr_block_cb, &indr_dev->cb_list, list)
indr_block_cb->cb(dev, indr_block_cb->cb_priv, TC_SETUP_BLOCK,
Expand All @@ -791,7 +791,7 @@ static bool tcf_block_offload_in_use(struct tcf_block *block)
static int tcf_block_offload_cmd(struct tcf_block *block,
struct net_device *dev,
struct tcf_block_ext_info *ei,
enum tc_block_command command,
enum flow_block_command command,
struct netlink_ext_ack *extack)
{
struct tc_block_offload bo = {};
Expand Down Expand Up @@ -821,20 +821,20 @@ static int tcf_block_offload_bind(struct tcf_block *block, struct Qdisc *q,
return -EOPNOTSUPP;
}

err = tcf_block_offload_cmd(block, dev, ei, TC_BLOCK_BIND, extack);
err = tcf_block_offload_cmd(block, dev, ei, FLOW_BLOCK_BIND, extack);
if (err == -EOPNOTSUPP)
goto no_offload_dev_inc;
if (err)
return err;

tc_indr_block_call(block, dev, ei, TC_BLOCK_BIND, extack);
tc_indr_block_call(block, dev, ei, FLOW_BLOCK_BIND, extack);
return 0;

no_offload_dev_inc:
if (tcf_block_offload_in_use(block))
return -EOPNOTSUPP;
block->nooffloaddevcnt++;
tc_indr_block_call(block, dev, ei, TC_BLOCK_BIND, extack);
tc_indr_block_call(block, dev, ei, FLOW_BLOCK_BIND, extack);
return 0;
}

Expand All @@ -844,11 +844,11 @@ static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q,
struct net_device *dev = q->dev_queue->dev;
int err;

tc_indr_block_call(block, dev, ei, TC_BLOCK_UNBIND, NULL);
tc_indr_block_call(block, dev, ei, FLOW_BLOCK_UNBIND, NULL);

if (!dev->netdev_ops->ndo_setup_tc)
goto no_offload_dev_dec;
err = tcf_block_offload_cmd(block, dev, ei, TC_BLOCK_UNBIND, NULL);
err = tcf_block_offload_cmd(block, dev, ei, FLOW_BLOCK_UNBIND, NULL);
if (err == -EOPNOTSUPP)
goto no_offload_dev_dec;
return;
Expand Down

0 comments on commit 9c0e189

Please sign in to comment.