net/mlx4: fix restriction on TCP/UDP flow rules

The code as currently written requires TCP/UDP source and destination
ports to be always specified.

No such restriction is enforced by hardware; all TCP and UDP traffic
can be matched by providing an empty mask for these fields.

Fixes: 680d5280c2 ("net/mlx4: refactor flow item validation code")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
This commit is contained in:
Adrien Mazarguil 2017-10-20 14:39:58 +02:00 committed by Ferruh Yigit
parent 373840beaf
commit cad92582d2

View File

@ -404,7 +404,7 @@ mlx4_flow_merge_udp(struct rte_flow *flow,
struct ibv_flow_spec_tcp_udp *udp;
const char *msg;
if (!mask ||
if (mask &&
((uint16_t)(mask->hdr.src_port + 1) > UINT16_C(1) ||
(uint16_t)(mask->hdr.dst_port + 1) > UINT16_C(1))) {
msg = "mlx4 does not support matching partial UDP fields";
@ -464,7 +464,7 @@ mlx4_flow_merge_tcp(struct rte_flow *flow,
struct ibv_flow_spec_tcp_udp *tcp;
const char *msg;
if (!mask ||
if (mask &&
((uint16_t)(mask->hdr.src_port + 1) > UINT16_C(1) ||
(uint16_t)(mask->hdr.dst_port + 1) > UINT16_C(1))) {
msg = "mlx4 does not support matching partial TCP fields";