net/mlx5e: Explicitly set source e-switch in offloaded TC rules
authorShahar Klein <shahark@mellanox.com>
Sun, 18 Mar 2018 07:03:49 +0000 (09:03 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 17 May 2018 21:17:35 +0000 (14:17 -0700)
Set a specific source e-switch when setting a rule that matches on the
ingress port.

Signed-off-by: Shahar Klein <shahark@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Roi Dayan <roid@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 880adc810cccdf627af85fdb9b4d98eb0a92578c..1d2ba687b902ffd8a913be274b2cd6329de1c541 100644 (file)
@@ -2462,6 +2462,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
 
        memset(attr, 0, sizeof(*attr));
        attr->in_rep = rpriv->rep;
+       attr->in_mdev = priv->mdev;
 
        tcf_exts_to_list(exts, &actions);
        list_for_each_entry(a, &actions, list) {
index ac5db54823a1fd2a51e9277b24a5bff166fbac7d..98a306e026406be4c55821fc0fcfbfb322608749 100644 (file)
@@ -231,6 +231,7 @@ struct mlx5_esw_flow_attr {
        struct mlx5_eswitch_rep *in_rep;
        struct mlx5_eswitch_rep *out_rep;
        struct mlx5_core_dev    *out_mdev;
+       struct mlx5_core_dev    *in_mdev;
 
        int     action;
        __be16  vlan_proto;
index ea93867d1ab41ecc56393b2b59f8013a844f1598..6c83eef5141a94b8d10cb9e21e435f209ff7f9c0 100644 (file)
@@ -93,8 +93,16 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
        misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
        MLX5_SET(fte_match_set_misc, misc, source_port, attr->in_rep->vport);
 
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               MLX5_SET(fte_match_set_misc, misc,
+                        source_eswitch_owner_vhca_id,
+                        MLX5_CAP_GEN(attr->in_mdev, vhca_id));
+
        misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
        MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_port);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               MLX5_SET_TO_ONES(fte_match_set_misc, misc,
+                                source_eswitch_owner_vhca_id);
 
        spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS |
                                      MLX5_MATCH_MISC_PARAMETERS;