Skip to content

Commit ed9085f

Browse files
Maor Gottliebdledford
authored andcommitted
IB/mlx5: Fix steering rule of drop and count
There are two flow rule destinations: QP and packet. While users are setting DROP packet rule, the QP should not be set as a destination. Fixes: 3b3233f ("IB/mlx5: Add flow counters binding support") Signed-off-by: Maor Gottlieb <[email protected]> Reviewed-by: Raed Salem <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Doug Ledford <[email protected]>
1 parent 89f988d commit ed9085f

File tree

1 file changed

+6
-7
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+6
-7
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,10 +3544,6 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
35443544
}
35453545

35463546
INIT_LIST_HEAD(&handler->list);
3547-
if (dst) {
3548-
memcpy(&dest_arr[0], dst, sizeof(*dst));
3549-
dest_num++;
3550-
}
35513547

35523548
for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) {
35533549
err = parse_flow_attr(dev->mdev, spec,
@@ -3560,6 +3556,11 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
35603556
ib_flow += ((union ib_flow_spec *)ib_flow)->size;
35613557
}
35623558

3559+
if (dst && !(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP)) {
3560+
memcpy(&dest_arr[0], dst, sizeof(*dst));
3561+
dest_num++;
3562+
}
3563+
35633564
if (!flow_is_multicast_only(flow_attr))
35643565
set_underlay_qp(dev, spec, underlay_qpn);
35653566

@@ -3600,10 +3601,8 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
36003601
}
36013602

36023603
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP) {
3603-
if (!(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT)) {
3604+
if (!dest_num)
36043605
rule_dst = NULL;
3605-
dest_num = 0;
3606-
}
36073606
} else {
36083607
if (is_egress)
36093608
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_ALLOW;

0 commit comments

Comments
 (0)