Skip to content

Commit

Permalink
net/mlx5: fix mask used for IPv6 item validation
Browse files Browse the repository at this point in the history
[ upstream commit 6bd5efb ]

The nic_mask struct in function mlx5_flow_validate_item_ipv6()
includes hop_limits field.
This is redundant since matching on this item is not supported using
Verbs flow engine (dv_flow_en=0).

(Separate patch will be sent to handle this issue for DV flow engine.)

Setting a rule including match on this field will fail:
testpmd> flow create 0 ingress pattern eth / ipv6 hop is 1 / end actions
drop / end
port_flow_complain(): Caught PMD error type 1 (cause unspecified):
hardware refuses to create flow: Operation not supported

This patch removes the redundant field from nic_mask, to ensure that
such flow rules will be rejected by PMD validation:
testpmd> flow create 0 ingress pattern eth / ipv6 hop is 1 / end actions
drop / end
port_flow_complain(): Caught PMD error type 13 (specific pattern item):
cause: 0x7fffffffa2c8, mask enables non supported bits: Operation not
supported

The related lines in function flow_verbs_translate_item_ipv6() are
removed as well, since they are redundant.

Fixes: 23c1d42 ("net/mlx5: split flow validation to dedicated function")
Fixes: 84c406e ("net/mlx5: add flow translate function")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
  • Loading branch information
dekelp authored and kevintraynor committed May 27, 2020
1 parent bc2e943 commit a7e766d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
1 change: 0 additions & 1 deletion drivers/net/mlx5/mlx5_flow.c
Expand Up @@ -1266,7 +1266,6 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
"\xff\xff\xff\xff\xff\xff\xff\xff",
.vtc_flow = RTE_BE32(0xffffffff),
.proto = 0xff,
.hop_limits = 0xff,
},
};
const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/mlx5/mlx5_flow_verbs.c
Expand Up @@ -479,14 +479,12 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow,
ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >>
IPV6_HDR_TC_SHIFT;
ipv6.val.next_hdr = spec->hdr.proto;
ipv6.val.hop_limit = spec->hdr.hop_limits;
ipv6.mask.flow_label =
rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >>
IPV6_HDR_FL_SHIFT);
ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >>
IPV6_HDR_TC_SHIFT;
ipv6.mask.next_hdr = mask->hdr.proto;
ipv6.mask.hop_limit = mask->hdr.hop_limits;
/* Remove unwanted bits from values. */
for (i = 0; i < RTE_DIM(ipv6.val.src_ip); ++i) {
ipv6.val.src_ip[i] &= ipv6.mask.src_ip[i];
Expand All @@ -495,7 +493,6 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow,
ipv6.val.flow_label &= ipv6.mask.flow_label;
ipv6.val.traffic_class &= ipv6.mask.traffic_class;
ipv6.val.next_hdr &= ipv6.mask.next_hdr;
ipv6.val.hop_limit &= ipv6.mask.hop_limit;
}
flow_verbs_spec_add(&dev_flow->verbs, &ipv6, size);
}
Expand Down

0 comments on commit a7e766d

Please sign in to comment.