diff options
author | Shahar Klein <shahark@mellanox.com> | 2018-03-22 06:32:12 -0400 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2018-05-17 17:17:34 -0400 |
commit | b17f7fc10facca9e1b2b9cef39af0a8179796c14 (patch) | |
tree | b3a5fc642835364f515c91be5e91293e27506591 | |
parent | 65360e5451121e493944776a7e33d1345c8483e6 (diff) |
net/mlx5: Add destination e-switch owner
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>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 | ||||
-rw-r--r-- | include/linux/mlx5/fs.h | 6 | ||||
-rw-r--r-- | include/linux/mlx5/mlx5_ifc.h | 5 |
7 files changed, 21 insertions, 10 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c index d93ff567b40d..b3820a34e773 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c | |||
@@ -235,7 +235,7 @@ const char *parse_fs_dst(struct trace_seq *p, | |||
235 | 235 | ||
236 | switch (dst->type) { | 236 | switch (dst->type) { |
237 | case MLX5_FLOW_DESTINATION_TYPE_VPORT: | 237 | case MLX5_FLOW_DESTINATION_TYPE_VPORT: |
238 | trace_seq_printf(p, "vport=%u\n", dst->vport_num); | 238 | trace_seq_printf(p, "vport=%u\n", dst->vport.num); |
239 | break; | 239 | break; |
240 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: | 240 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: |
241 | trace_seq_printf(p, "ft=%p\n", dst->ft); | 241 | trace_seq_printf(p, "ft=%p\n", dst->ft); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 332bc56306bf..9a24314b817a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
@@ -192,7 +192,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule, | |||
192 | } | 192 | } |
193 | 193 | ||
194 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 194 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
195 | dest.vport_num = vport; | 195 | dest.vport.num = vport; |
196 | 196 | ||
197 | esw_debug(esw->dev, | 197 | esw_debug(esw->dev, |
198 | "\tFDB add rule dmac_v(%pM) dmac_c(%pM) -> vport(%d)\n", | 198 | "\tFDB add rule dmac_v(%pM) dmac_c(%pM) -> vport(%d)\n", |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index b123f8a52ad8..90c8cb31e633 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
@@ -71,7 +71,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, | |||
71 | 71 | ||
72 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { | 72 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { |
73 | dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 73 | dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
74 | dest[i].vport_num = attr->out_rep->vport; | 74 | dest[i].vport.num = attr->out_rep->vport; |
75 | i++; | 75 | i++; |
76 | } | 76 | } |
77 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { | 77 | 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 | |||
343 | 343 | ||
344 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; | 344 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; |
345 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 345 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
346 | dest.vport_num = vport; | 346 | dest.vport.num = vport; |
347 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; | 347 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; |
348 | 348 | ||
349 | flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec, | 349 | 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) | |||
387 | dmac_c[0] = 0x01; | 387 | dmac_c[0] = 0x01; |
388 | 388 | ||
389 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 389 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
390 | dest.vport_num = 0; | 390 | dest.vport.num = 0; |
391 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; | 391 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; |
392 | 392 | ||
393 | flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec, | 393 | flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c index 0bfce6a82c91..5a00deff5457 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | |||
@@ -374,7 +374,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, | |||
374 | id = dst->dest_attr.ft->id; | 374 | id = dst->dest_attr.ft->id; |
375 | } else if (dst->dest_attr.type == | 375 | } else if (dst->dest_attr.type == |
376 | MLX5_FLOW_DESTINATION_TYPE_VPORT) { | 376 | MLX5_FLOW_DESTINATION_TYPE_VPORT) { |
377 | id = dst->dest_attr.vport_num; | 377 | id = dst->dest_attr.vport.num; |
378 | MLX5_SET(dest_format_struct, in_dests, | ||
379 | destination_eswitch_owner_vhca_id_valid, | ||
380 | dst->dest_attr.vport.vhca_id_valid); | ||
381 | MLX5_SET(dest_format_struct, in_dests, | ||
382 | destination_eswitch_owner_vhca_id, | ||
383 | dst->dest_attr.vport.vhca_id); | ||
378 | } else { | 384 | } else { |
379 | id = dst->dest_attr.tir_num; | 385 | id = dst->dest_attr.tir_num; |
380 | } | 386 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index de51e7c39bc8..5a80279b052a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -1404,7 +1404,7 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1, | |||
1404 | { | 1404 | { |
1405 | if (d1->type == d2->type) { | 1405 | if (d1->type == d2->type) { |
1406 | if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT && | 1406 | if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT && |
1407 | d1->vport_num == d2->vport_num) || | 1407 | d1->vport.num == d2->vport.num) || |
1408 | (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE && | 1408 | (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE && |
1409 | d1->ft == d2->ft) || | 1409 | d1->ft == d2->ft) || |
1410 | (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR && | 1410 | (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR && |
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h index 47aecc4fa8c2..9f4d32e41c06 100644 --- a/include/linux/mlx5/fs.h +++ b/include/linux/mlx5/fs.h | |||
@@ -90,8 +90,12 @@ struct mlx5_flow_destination { | |||
90 | union { | 90 | union { |
91 | u32 tir_num; | 91 | u32 tir_num; |
92 | struct mlx5_flow_table *ft; | 92 | struct mlx5_flow_table *ft; |
93 | u32 vport_num; | ||
94 | struct mlx5_fc *counter; | 93 | struct mlx5_fc *counter; |
94 | struct { | ||
95 | u16 num; | ||
96 | u16 vhca_id; | ||
97 | bool vhca_id_valid; | ||
98 | } vport; | ||
95 | }; | 99 | }; |
96 | }; | 100 | }; |
97 | 101 | ||
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index ef15f751a984..3d17709bc30c 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -1148,8 +1148,9 @@ enum mlx5_flow_destination_type { | |||
1148 | struct mlx5_ifc_dest_format_struct_bits { | 1148 | struct mlx5_ifc_dest_format_struct_bits { |
1149 | u8 destination_type[0x8]; | 1149 | u8 destination_type[0x8]; |
1150 | u8 destination_id[0x18]; | 1150 | u8 destination_id[0x18]; |
1151 | 1151 | u8 destination_eswitch_owner_vhca_id_valid[0x1]; | |
1152 | u8 reserved_at_20[0x20]; | 1152 | u8 reserved_at_21[0xf]; |
1153 | u8 destination_eswitch_owner_vhca_id[0x10]; | ||
1153 | }; | 1154 | }; |
1154 | 1155 | ||
1155 | struct mlx5_ifc_flow_counter_list_bits { | 1156 | struct mlx5_ifc_flow_counter_list_bits { |