DPDK usage discussions
 help / color / mirror / Atom feed
From: Andrew Bainbridge <andbain@microsoft.com>
To: users <users@dpdk.org>
Subject: [dpdk-users] How to use .last and .spec fields in the Generic Flow API?
Date: Wed, 6 Mar 2019 15:30:02 +0000	[thread overview]
Message-ID: <DB7PR83MB0235A5B5899ED4551426B721AE730@DB7PR83MB0235.EURPRD83.prod.outlook.com> (raw)

Hi

How should I specify a range of UDP ports in the generic flow API? Here's what I've tried...

I'm trying to create a flow to move packets with UDP dest ports from 1234 to 1244 into a specified queue. It works fine if I specify a single port of 1234, instead of the range. Here's how I set the flow item for that:

    struct rte_flow_item_udp udp_spec = { 0 };
    struct rte_flow_item_udp udp_mask = { 0 };
    udp_spec.hdr.dst_port = htons(udp_dst_port);
    udp_mask.hdr.dst_port = 0xffff;
    pattern[2].type = RTE_FLOW_ITEM_TYPE_UDP;
    pattern[2].spec = &udp_spec;
    pattern[2].mask = &udp_mask;

But if I attempt to specify the range, I believe I have to use the .last field. When I do that, I get this error, 'range between "spec" and "last" is larger than "mask"'. Here's how I set that flow item:

    struct rte_flow_item_udp udp_spec = { 0 };
    struct rte_flow_item_udp udp_last = { 0 };
    struct rte_flow_item_udp udp_mask = { 0 };
    udp_spec.hdr.dst_port = htons(1234);
    udp_last.hdr.dst_port = htons(1244);
    udp_mask.hdr.dst_port = 0xffff;
    pattern[2].type = RTE_FLOW_ITEM_TYPE_UDP;
    pattern[2].spec = &udp_spec;
    pattern[2].last = &udp_last;
    pattern[2].mask = &udp_mask;

I don't understand the error message. The range between spec and last is 10. The mask is 0xffff. The error message seems wrong. But probably I just misunderstood something.

More details:

I'm using the mlx4 PMD. The source of the error message is in mlx4_flow_item_check(), where the code appears goes through each byte of the spec and last and checks that:

    (((const uint8_t *)item->spec)[i] & mask[i]) != (((const uint8_t *)item->last)[i] & mask[i]))

Which makes no sense to me. That appears to require that spec and last are equal wherever mask is not zero.

Any ideas?

Thanks,
Andy

             reply	other threads:[~2019-03-06 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 15:30 Andrew Bainbridge [this message]
2019-03-07  8:51 ` Raslan Darawsheh
2019-03-07 11:10   ` Andrew Bainbridge
2019-03-07 11:31     ` Raslan Darawsheh

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=DB7PR83MB0235A5B5899ED4551426B721AE730@DB7PR83MB0235.EURPRD83.prod.outlook.com \
    --to=andbain@microsoft.com \
    --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).