]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: E-Switch, Rename esw attr mirror count field
authorEli Britstein <elibr@mellanox.com>
Fri, 23 Nov 2018 07:38:27 +0000 (09:38 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 11 Dec 2018 22:52:19 +0000 (14:52 -0800)
The mirror count esw attributes field is used to determine if splitting
the rule to two FTEs is required while programming e-switch mirroring.
Rename it to split count, making it clearer with no functional change.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index abc200947e8439f4f4316e4c5b1d6af07b33f696..342f807543a04af1671d94b75f53eaac9eaa3938 100644 (file)
@@ -838,7 +838,7 @@ mlx5e_tc_offload_fdb_rules(struct mlx5_eswitch *esw,
        if (IS_ERR(rule))
                return rule;
 
-       if (attr->mirror_count) {
+       if (attr->split_count) {
                flow->rule[1] = mlx5_eswitch_add_fwd_rule(esw, spec, attr);
                if (IS_ERR(flow->rule[1])) {
                        mlx5_eswitch_del_offloaded_rule(esw, rule, attr);
@@ -857,7 +857,7 @@ mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,
 {
        flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED;
 
-       if (attr->mirror_count)
+       if (attr->split_count)
                mlx5_eswitch_del_fwd_rule(esw, flow->rule[1], attr);
 
        mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], attr);
@@ -873,7 +873,7 @@ mlx5e_tc_offload_to_slow_path(struct mlx5_eswitch *esw,
 
        memcpy(slow_attr, flow->esw_attr, sizeof(*slow_attr));
        slow_attr->action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
-       slow_attr->mirror_count = 0,
+       slow_attr->split_count = 0,
        slow_attr->dest_chain = FDB_SLOW_PATH_CHAIN,
 
        rule = mlx5e_tc_offload_fdb_rules(esw, flow, spec, slow_attr);
@@ -2427,7 +2427,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                                return err;
 
                        action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
-                       attr->mirror_count = attr->out_count;
+                       attr->split_count = attr->out_count;
                        continue;
                }
 
@@ -2501,7 +2501,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                                encap = true;
                        else
                                return -EOPNOTSUPP;
-                       attr->mirror_count = attr->out_count;
+                       attr->split_count = attr->out_count;
                        continue;
                }
 
@@ -2511,7 +2511,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                        if (err)
                                return err;
 
-                       attr->mirror_count = attr->out_count;
+                       attr->split_count = attr->out_count;
                        continue;
                }
 
@@ -2546,7 +2546,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
        if (!actions_match_supported(priv, exts, parse_attr, flow, extack))
                return -EOPNOTSUPP;
 
-       if (attr->mirror_count > 0 && !mlx5_esw_has_fwd_fdb(priv->mdev)) {
+       if (attr->split_count > 0 && !mlx5_esw_has_fwd_fdb(priv->mdev)) {
                NL_SET_ERR_MSG_MOD(extack,
                                   "current firmware doesn't support split rule for port mirroring");
                netdev_warn_once(priv->netdev, "current firmware doesn't support split rule for port mirroring\n");
index 480ffa294867db7c70b5d2f93d3fe7f1abf03dda..c28ff6487dfd085fc642dd25ec69315147c672dc 100644 (file)
@@ -287,7 +287,7 @@ struct mlx5_esw_flow_attr {
        struct mlx5_core_dev    *out_mdev[MLX5_MAX_FLOW_FWD_VPORTS];
        struct mlx5_core_dev    *in_mdev;
 
-       int mirror_count;
+       int split_count;
        int out_count;
 
        int     action;
index 4d7b65df32efcdb2a4eeff538f7a92405b2565c8..63ac9d3d16901dd383f853a34ba7f1b7994b357b 100644 (file)
@@ -81,7 +81,7 @@ 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 = { .flags = FLOW_ACT_NO_APPEND, };
-       bool mirror = !!(attr->mirror_count);
+       bool split = !!(attr->split_count);
        struct mlx5_flow_handle *rule;
        struct mlx5_flow_table *fdb;
        int j, i = 0;
@@ -120,7 +120,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
                        dest[i].ft = ft;
                        i++;
                } else {
-                       for (j = attr->mirror_count; j < attr->out_count; j++) {
+                       for (j = attr->split_count; j < attr->out_count; j++) {
                                dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
                                dest[i].vport.num = attr->out_rep[j]->vport;
                                dest[i].vport.vhca_id =
@@ -167,7 +167,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
        if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT)
                flow_act.reformat_id = attr->encap_id;
 
-       fdb = esw_get_prio_table(esw, attr->chain, attr->prio, !!mirror);
+       fdb = esw_get_prio_table(esw, attr->chain, attr->prio, !!split);
        if (IS_ERR(fdb)) {
                rule = ERR_CAST(fdb);
                goto err_esw_get;
@@ -182,7 +182,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
        return rule;
 
 err_add_rule:
-       esw_put_prio_table(esw, attr->chain, attr->prio, !!mirror);
+       esw_put_prio_table(esw, attr->chain, attr->prio, !!split);
 err_esw_get:
        if (attr->dest_chain)
                esw_put_prio_table(esw, attr->dest_chain, 1, 0);
@@ -216,7 +216,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
        }
 
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
-       for (i = 0; i < attr->mirror_count; i++) {
+       for (i = 0; i < attr->split_count; i++) {
                dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
                dest[i].vport.num = attr->out_rep[i]->vport;
                dest[i].vport.vhca_id =
@@ -270,7 +270,7 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
                        struct mlx5_esw_flow_attr *attr,
                        bool fwd_rule)
 {
-       bool mirror = (attr->mirror_count > 0);
+       bool split = (attr->split_count > 0);
 
        mlx5_del_flow_rules(rule);
        esw->offloads.num_flows--;
@@ -279,7 +279,7 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
                esw_put_prio_table(esw, attr->chain, attr->prio, 1);
                esw_put_prio_table(esw, attr->chain, attr->prio, 0);
        } else {
-               esw_put_prio_table(esw, attr->chain, attr->prio, !!mirror);
+               esw_put_prio_table(esw, attr->chain, attr->prio, !!split);
                if (attr->dest_chain)
                        esw_put_prio_table(esw, attr->dest_chain, 1, 0);
        }