DPDK usage discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@nvidia.com>
To: David Bouyeure <david.bouyeure@fraudbuster.mobi>,
	"users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] mlx5 dv_flow_en doesn't behave as expected
Date: Sun, 9 May 2021 07:20:31 +0000	[thread overview]
Message-ID: <DM6PR12MB2748A24DB28C384165CFA2B2CF559@DM6PR12MB2748.namprd12.prod.outlook.com> (raw)
In-Reply-To: <f7f337a5-bf77-7957-d6ac-803958ee1116@fraudbuster.mobi>

Hi David, 


> -----Original Message-----
> From: users <users-bounces@dpdk.org> On Behalf Of David Bouyeure
> Sent: Thursday, May 6, 2021 6:29 PM
> To: users@dpdk.org
> Subject: [dpdk-users] mlx5 dv_flow_en doesn't behave as expected
> 
> Hello all,
> 
> 
> I'm using rte_flow (dpdk 20.11.1) on Mellanox Connect-X6 to filter some
> flows.
> 
> I recently was surprised by reading some of the mlx5
> limitations(http://doc.dpdk.org/guides/nics/mlx5.html#limitations),
> regarding the Verbs flow engine against the DV flow engine.
> 
> I wasn't aware of those 2 flow engines, neither of the following behavior:
> 
> >  *
> >
> >     When using Verbs flow engine (|dv_flow_en| = 0), flow pattern
> >     without any specific VLAN will match for VLAN packets as well:
> >
> >     When VLAN spec is not specified in the pattern, the matching rule
> >     will be created with VLAN as a wild card. Meaning, the flow rule:
> >
> >     flow create 0 ingress pattern eth / vlan vid is 3 / ipv4 / end ...
> >
> >     Will only match vlan packets with vid=3. and the flow rule:
> >
> >     flow create 0 ingress pattern eth / ipv4 / end ...
> >
> >     Will match any ipv4 packet (VLAN included).
> >
> >  *
> >
> >     When using Verbs flow engine (|dv_flow_en| = 0),
> >     multi-tagged(QinQ) match is not supported.
> >
> >  *
> >
> >     When using DV flow engine (|dv_flow_en| = 1), flow pattern with
> >     any VLAN specification will match only single-tagged packets
> >     unless the ETH item |type| field is 0x88A8 or the VLAN item
> >     |has_more_vlan| field is 1. The flow rule:
> >
> >     flow create 0 ingress pattern eth / ipv4 / end ...
> >
> >     Will match any ipv4 packet. The flow rules:
> >
> >     flow create 0 ingress pattern eth / vlan / end ...
> >     flow create 0 ingress pattern eth has_vlan is 1 / end ...
> >     flow create 0 ingress pattern eth type is 0x8100 / end ...
> >
> >     Will match single-tagged packets only, with any VLAN ID value. The
> >     flow rules:
> >
> >     flow create 0 ingress pattern eth type is 0x88A8 / end ...
> >     flow create 0 ingress pattern eth / vlan has_more_vlan is 1 / end ...
> >
> >     Will match multi-tagged packets only, with any VLAN ID value.
> >
That's true for MLX5 pmd yes,

> So, I retested some of my scenarios involving some eth / ipv4 rule pattern.
> 
> And, indeed, it's not doing what I was expected. The following is supposed to
> discard any flow which isn't GTP or which is VLAN tagged:
> 
> sudo dpdk-20.11.1/build/app/dpdk-testpmd -a 04:00.0 -c 0x0f  -- --rxq 16 --
> txq 16 -i
> 
> # jump eth from 0 to 1
> flow create 0 ingress group 0 priority 2 pattern eth / end actions count / jump
> group 1 / end
> 
> # Allows gtp without vlan
> flow create 0 ingress group 1 priority 2 pattern eth / ipv4 / udp / gtp / end
> actions count / rss queues 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 end / end
> 
> Playing a capture with X VLAN/GTP packets led to the rule
> #2(eth/ipv4/udp/gtp) being hit X times, which shouldn't.
> 
> I'm sure that DV flow is used because I added some log messages in mlx5
> PMD, and anyway running 'dpdk-testpmd -a 04:00.0,dv_flow_en=0'
> complains that groups aren't supported.
> 
> In the above RSS rule, if I replace 'eth' by 'eth type is 0x0800', it does what I
> expect.
> 
> I could had this IP4 ethernet type to some eth item, that would not be a
> problem, but I'm wondering if I missed something, at compile time for
> example?
Regardless of the dv_flow engine in MLX5 PMD, 
If you'll check the following:
https://doc.dpdk.org/guides/prog_guide/rte_flow.html
section: 12.2.6.3 you'll see the following:
The field has_vlan can be used to match any type of tagged packets, instead of using the type field. If the type and has_vlan fields are not specified, then both tagged and untagged packets will match the pattern.
Which means from your rules it's fully expected to match both tagged and untagged packets, 
If you want to match tagged packets then has_vlan should be of spec 1 and mask 1, as for untagged packets, 
It should be has_vlan with spec of 0 and mask of 1, 

> 
> 
> Thanks a lot.
> 
Kindest regards
Raslan Darawsheh

      reply	other threads:[~2021-05-09  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 15:28 David Bouyeure
2021-05-09  7:20 ` Raslan Darawsheh [this message]

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=DM6PR12MB2748A24DB28C384165CFA2B2CF559@DM6PR12MB2748.namprd12.prod.outlook.com \
    --to=rasland@nvidia.com \
    --cc=david.bouyeure@fraudbuster.mobi \
    --cc=users@dpdk.org \
    /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).