DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx4: fix restriction on TCP/UDP flow rules
Date: Fri, 20 Oct 2017 14:39:58 +0200	[thread overview]
Message-ID: <1508503129-6298-1-git-send-email-adrien.mazarguil@6wind.com> (raw)

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 <adrien.mazarguil@6wind.com>
---
 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 5af6efb..a0f431b 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.1.4

             reply	other threads:[~2017-10-20 12:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 12:39 Adrien Mazarguil [this message]
2017-10-20 12:45 ` Nélio Laranjeiro
2017-10-23 20:32   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508503129-6298-1-git-send-email-adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).