Commit 53636068 authored by Roi Dayan's avatar Roi Dayan Committed by David S. Miller

net/mlx5e: Remove redundant hashtable lookup in configure flower

We will never find a flow with the same cookie as cls_flower always
allocates a new flow and the cookie is the allocated memory address.

Fixes: e3a2b7ed ("net/mlx5e: Support offload cls_flower with drop action")
Signed-off-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarHadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec8b9981
...@@ -915,25 +915,17 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, ...@@ -915,25 +915,17 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
u32 flow_tag, action; u32 flow_tag, action;
struct mlx5e_tc_flow *flow; struct mlx5e_tc_flow *flow;
struct mlx5_flow_spec *spec; struct mlx5_flow_spec *spec;
struct mlx5_flow_handle *old = NULL;
struct mlx5_esw_flow_attr *old_attr = NULL;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
if (esw && esw->mode == SRIOV_OFFLOADS) if (esw && esw->mode == SRIOV_OFFLOADS)
fdb_flow = true; fdb_flow = true;
flow = rhashtable_lookup_fast(&tc->ht, &f->cookie,
tc->ht_params);
if (flow) {
old = flow->rule;
old_attr = flow->attr;
} else {
if (fdb_flow) if (fdb_flow)
flow = kzalloc(sizeof(*flow) + sizeof(struct mlx5_esw_flow_attr), flow = kzalloc(sizeof(*flow) +
sizeof(struct mlx5_esw_flow_attr),
GFP_KERNEL); GFP_KERNEL);
else else
flow = kzalloc(sizeof(*flow), GFP_KERNEL); flow = kzalloc(sizeof(*flow), GFP_KERNEL);
}
spec = mlx5_vzalloc(sizeof(*spec)); spec = mlx5_vzalloc(sizeof(*spec));
if (!spec || !flow) { if (!spec || !flow) {
...@@ -970,16 +962,12 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, ...@@ -970,16 +962,12 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
if (err) if (err)
goto err_del_rule; goto err_del_rule;
if (old)
mlx5e_tc_del_flow(priv, old, old_attr);
goto out; goto out;
err_del_rule: err_del_rule:
mlx5_del_flow_rules(flow->rule); mlx5_del_flow_rules(flow->rule);
err_free: err_free:
if (!old)
kfree(flow); kfree(flow);
out: out:
kvfree(spec); kvfree(spec);
......
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