From cad92582d23886c4b9f8611da6f14577bad0b15d Mon Sep 17 00:00:00 2001 From: Adrien Mazarguil Date: Fri, 20 Oct 2017 14:39:58 +0200 Subject: [PATCH] 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 --- drivers/net/mlx4/mlx4_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; -- 2.20.1