summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
diff options
context:
space:
mode:
authorMark Bloch2018-10-03 00:57:24 +0200
committerSaeed Mahameed2018-10-17 23:15:48 +0200
commitb8aee82250b7d90a32b11ba208656f52dbaca342 (patch)
tree90b757122f3e156fd4d98ecf7856a476722ff30c /drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
parentMerge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mel... (diff)
downloadkernel-qcow2-linux-b8aee82250b7d90a32b11ba208656f52dbaca342.tar.gz
kernel-qcow2-linux-b8aee82250b7d90a32b11ba208656f52dbaca342.tar.xz
kernel-qcow2-linux-b8aee82250b7d90a32b11ba208656f52dbaca342.zip
net/mlx5: E-Switch, Get counters for offloaded flows from callers
There's no real reason for the e-switch logic to manage the creation of counters for offloaded flows. The API already has the directive for the caller to denote they want to attach a counter to the created flow. As such, we go and move the management of flow counters to the mlx5e tc offload logic. This also lets us remove an inelegant interface where the FS layer had to provide a way to retrieve a counter from a flow rule. Signed-off-by: Mark Bloch <markb@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 0741683f7d70..a2f2d726c99b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -51,7 +51,6 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
struct mlx5_flow_destination dest[MLX5_MAX_FLOW_FWD_VPORTS + 1] = {};
struct mlx5_flow_act flow_act = {0};
struct mlx5_flow_table *ft = NULL;
- struct mlx5_fc *counter = NULL;
struct mlx5_flow_handle *rule;
int j, i = 0;
void *misc;
@@ -91,13 +90,8 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
}
}
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
- counter = mlx5_fc_create(esw->dev, true);
- if (IS_ERR(counter)) {
- rule = ERR_CAST(counter);
- goto err_counter_alloc;
- }
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
- dest[i].counter = counter;
+ dest[i].counter = attr->counter;
i++;
}
@@ -132,15 +126,11 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
rule = mlx5_add_flow_rules(ft, spec, &flow_act, dest, i);
if (IS_ERR(rule))
- goto err_add_rule;
+ goto out;
else
esw->offloads.num_flows++;
- return rule;
-
-err_add_rule:
- mlx5_fc_destroy(esw->dev, counter);
-err_counter_alloc:
+out:
return rule;
}
@@ -200,11 +190,7 @@ mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
struct mlx5_flow_handle *rule,
struct mlx5_esw_flow_attr *attr)
{
- struct mlx5_fc *counter = NULL;
-
- counter = mlx5_flow_rule_counter(rule);
mlx5_del_flow_rules(rule);
- mlx5_fc_destroy(esw->dev, counter);
esw->offloads.num_flows--;
}