提交 14624d72 编写于 作者: R Roi Dayan 提交者: Saeed Mahameed

net/mlx5e: Don't use termination table when redundant

Current code used termination table for each vport destination
while it's only required for hairpin, i.e. uplink to uplink, or
when vlan push on rx action being used.
Fix to skip using termination table for vport destinations that
do not require it.
Signed-off-by: NRoi Dayan <roid@nvidia.com>
Reviewed-by: NMaor Dickman <maord@nvidia.com>
Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
上级 2d04e1ce
...@@ -210,6 +210,18 @@ static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw, ...@@ -210,6 +210,18 @@ static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw,
return (port_mask & port_value) == MLX5_VPORT_UPLINK; return (port_mask & port_value) == MLX5_VPORT_UPLINK;
} }
static bool
mlx5_eswitch_is_push_vlan_no_cap(struct mlx5_eswitch *esw,
struct mlx5_flow_act *flow_act)
{
if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH &&
!(mlx5_fs_get_capabilities(esw->dev, MLX5_FLOW_NAMESPACE_FDB) &
MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX))
return true;
return false;
}
bool bool
mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
struct mlx5_flow_attr *attr, struct mlx5_flow_attr *attr,
...@@ -225,10 +237,7 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, ...@@ -225,10 +237,7 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
(!mlx5_eswitch_offload_is_uplink_port(esw, spec) && !esw_attr->int_port)) (!mlx5_eswitch_offload_is_uplink_port(esw, spec) && !esw_attr->int_port))
return false; return false;
/* push vlan on RX */ if (mlx5_eswitch_is_push_vlan_no_cap(esw, flow_act))
if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH &&
!(mlx5_fs_get_capabilities(esw->dev, MLX5_FLOW_NAMESPACE_FDB) &
MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX))
return true; return true;
/* hairpin */ /* hairpin */
...@@ -252,19 +261,31 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, ...@@ -252,19 +261,31 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
struct mlx5_flow_act term_tbl_act = {}; struct mlx5_flow_act term_tbl_act = {};
struct mlx5_flow_handle *rule = NULL; struct mlx5_flow_handle *rule = NULL;
bool term_table_created = false; bool term_table_created = false;
bool is_push_vlan_on_rx;
int num_vport_dests = 0; int num_vport_dests = 0;
int i, curr_dest; int i, curr_dest;
is_push_vlan_on_rx = mlx5_eswitch_is_push_vlan_no_cap(esw, flow_act);
mlx5_eswitch_termtbl_actions_move(flow_act, &term_tbl_act); mlx5_eswitch_termtbl_actions_move(flow_act, &term_tbl_act);
term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
for (i = 0; i < num_dest; i++) { for (i = 0; i < num_dest; i++) {
struct mlx5_termtbl_handle *tt; struct mlx5_termtbl_handle *tt;
bool hairpin = false;
/* only vport destinations can be terminated */ /* only vport destinations can be terminated */
if (dest[i].type != MLX5_FLOW_DESTINATION_TYPE_VPORT) if (dest[i].type != MLX5_FLOW_DESTINATION_TYPE_VPORT)
continue; continue;
if (attr->dests[num_vport_dests].rep &&
attr->dests[num_vport_dests].rep->vport == MLX5_VPORT_UPLINK)
hairpin = true;
if (!is_push_vlan_on_rx && !hairpin) {
num_vport_dests++;
continue;
}
if (attr->dests[num_vport_dests].flags & MLX5_ESW_DEST_ENCAP) { if (attr->dests[num_vport_dests].flags & MLX5_ESW_DEST_ENCAP) {
term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat; term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat;
...@@ -312,6 +333,9 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, ...@@ -312,6 +333,9 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
for (curr_dest = 0; curr_dest < num_vport_dests; curr_dest++) { for (curr_dest = 0; curr_dest < num_vport_dests; curr_dest++) {
struct mlx5_termtbl_handle *tt = attr->dests[curr_dest].termtbl; struct mlx5_termtbl_handle *tt = attr->dests[curr_dest].termtbl;
if (!tt)
continue;
attr->dests[curr_dest].termtbl = NULL; attr->dests[curr_dest].termtbl = NULL;
/* search for the destination associated with the /* search for the destination associated with the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册