net/mlx5: Add destination e-switch owner
authorShahar Klein <shahark@mellanox.com>
Thu, 22 Mar 2018 10:32:12 +0000 (12:32 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 17 May 2018 21:17:34 +0000 (14:17 -0700)
The destination e-switch owner allows a rule in namespace of one e-switch
owner to point to a vport that is natively associated with another
e-switch owner.

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/diag/fs_tracepoint.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
include/linux/mlx5/fs.h
include/linux/mlx5/mlx5_ifc.h

index d93ff567b40d95ef5faebafae64730ce690fde8e..b3820a34e773a37370c322c530667c71c9992b25 100644 (file)
@@ -235,7 +235,7 @@ const char *parse_fs_dst(struct trace_seq *p,
 
        switch (dst->type) {
        case MLX5_FLOW_DESTINATION_TYPE_VPORT:
-               trace_seq_printf(p, "vport=%u\n", dst->vport_num);
+               trace_seq_printf(p, "vport=%u\n", dst->vport.num);
                break;
        case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
                trace_seq_printf(p, "ft=%p\n", dst->ft);
index 332bc56306bf5cb22b2a7283f80a3b2c1f4e9a10..9a24314b817a5275b6bbf424e98c7fa2ab5e161d 100644 (file)
@@ -192,7 +192,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
        }
 
        dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-       dest.vport_num = vport;
+       dest.vport.num = vport;
 
        esw_debug(esw->dev,
                  "\tFDB add rule dmac_v(%pM) dmac_c(%pM) -> vport(%d)\n",
index b123f8a52ad8c1b30f11095a6029395ae8d7df1d..90c8cb31e633b07afe66d8692adbb1025e0dbc9b 100644 (file)
@@ -71,7 +71,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
 
        if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
                dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-               dest[i].vport_num = attr->out_rep->vport;
+               dest[i].vport.num = attr->out_rep->vport;
                i++;
        }
        if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
@@ -343,7 +343,7 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn
 
        spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
        dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-       dest.vport_num = vport;
+       dest.vport.num = vport;
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 
        flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec,
@@ -387,7 +387,7 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
        dmac_c[0] = 0x01;
 
        dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-       dest.vport_num = 0;
+       dest.vport.num = 0;
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 
        flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec,
index 0bfce6a82c917801a91d976fcb4c63d503b67e98..5a00deff54576429460ee10fd25ea3bc62f28485 100644 (file)
@@ -374,7 +374,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
                                id = dst->dest_attr.ft->id;
                        } else if (dst->dest_attr.type ==
                                   MLX5_FLOW_DESTINATION_TYPE_VPORT) {
-                               id = dst->dest_attr.vport_num;
+                               id = dst->dest_attr.vport.num;
+                               MLX5_SET(dest_format_struct, in_dests,
+                                        destination_eswitch_owner_vhca_id_valid,
+                                        dst->dest_attr.vport.vhca_id_valid);
+                               MLX5_SET(dest_format_struct, in_dests,
+                                        destination_eswitch_owner_vhca_id,
+                                        dst->dest_attr.vport.vhca_id);
                        } else {
                                id = dst->dest_attr.tir_num;
                        }
index de51e7c39bc8b8ae02ea236afc9286b6e768cce5..5a80279b052a70a2ffb4cb438873e477fd75e87a 100644 (file)
@@ -1404,7 +1404,7 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
 {
        if (d1->type == d2->type) {
                if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
-                    d1->vport_num == d2->vport_num) ||
+                    d1->vport.num == d2->vport.num) ||
                    (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
                     d1->ft == d2->ft) ||
                    (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR &&
index 47aecc4fa8c2b9e4f00e6fccd2c08c759f486695..9f4d32e41c06916c50d01c71cd16ec4e0b0cfcc2 100644 (file)
@@ -90,8 +90,12 @@ struct mlx5_flow_destination {
        union {
                u32                     tir_num;
                struct mlx5_flow_table  *ft;
-               u32                     vport_num;
                struct mlx5_fc          *counter;
+               struct {
+                       u16             num;
+                       u16             vhca_id;
+                       bool            vhca_id_valid;
+               } vport;
        };
 };
 
index ef15f751a9849f9a0d27e9c121435159eb6e4074..3d17709bc30c70270c6463245cfcf39a32e80aee 100644 (file)
@@ -1148,8 +1148,9 @@ enum mlx5_flow_destination_type {
 struct mlx5_ifc_dest_format_struct_bits {
        u8         destination_type[0x8];
        u8         destination_id[0x18];
-
-       u8         reserved_at_20[0x20];
+       u8         destination_eswitch_owner_vhca_id_valid[0x1];
+       u8         reserved_at_21[0xf];
+       u8         destination_eswitch_owner_vhca_id[0x10];
 };
 
 struct mlx5_ifc_flow_counter_list_bits {