From: Adrien Mazarguil Date: Fri, 20 Oct 2017 12:39:58 +0000 (+0200) Subject: net/mlx4: fix restriction on TCP/UDP flow rules X-Git-Tag: spdx-start~1142 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cad92582d23886c4b9f8611da6f14577bad0b15d;p=dpdk.git 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: 680d5280c20b ("net/mlx4: refactor flow item validation code") Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 5af6efb081..a0f431bf5e 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -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";