From: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>
To: Le Scouarnec Nicolas <Nicolas.LeScouarnec@technicolor.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"Adrien Mazarguil (adrien.mazarguil@6wind.com)"
<adrien.mazarguil@6wind.com>
Cc: "Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] Issues with ixgbe and rte_flow
Date: Wed, 8 Mar 2017 03:16:31 +0000 [thread overview]
Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B56D514@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <CY4PR02MB2552446F6413F0AB26B3DF9DF62F0@CY4PR02MB2552.namprd02.prod.outlook.com>
Hi Le Scouarnec,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Le Scouarnec Nicolas
> Sent: Tuesday, March 7, 2017 7:12 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh
> Subject: [dpdk-dev] Issues with ixgbe and rte_flow
>
> Dear all,
>
> I have been using the new API rte_flow to program filtering on an X540 (ixgbe)
> NIC. My goal is to send packets from different VLANs to different queues
> (filtering which should be supported by flow director as far as I understand). I
> enclosed the setup code at the bottom of this email. However, the code in ixgbe
> rejects the request I formulated. I looked at the rte_flow related code in ixgbe
> and I found some weird checkings in function ixgbe_parse_fdir_filter_normal.
> The code verifies that vlan_spec->tpid == ETHER_TYPE_VLAN, which should
> never happen on real packets, as it is eth_spec->type which has this value in
> typical setups. The same comment applies to the mask, only eth_mask->tpid
> should be required to be 0xffff. Overall, unless I misunderstood the rte_flow API,
> the checks should be done on eth_spec/eth_mask rather than
> vlan_spec/vlan_mask.
>
> I also have a side comment which might be more related to the general rte_flow
> API than to the specific implementation in ixgbe. The rte_flow_error returned is
> not very useful for it does return the error of the last tried filter-type (L2 tunnel
> in ixgbe), and not the error of the filter-type that my setup should use (flow
> director). As NICs can have several filter-types, It would be be useful to the user
> if rte_flow_validate/create could return the errors for all filter types tried
> although that would require to change the rte_flow API and returning an array
> of rte_flow_error and not a single struct.
>
> Excerpt of the code that reject my filtering rule:
>
> if (vlan_spec->tpid != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
> memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
> rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ITEM,
> item, "Not supported by fdir filter");
> return -rte_errno;
> }
>
>
> rule->ixgbe_fdir.formatted.vlan_id = vlan_spec->tci;
>
>
> if (vlan_mask->tpid != (uint16_t)~0U) {
> memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
> rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ITEM,
> item, "Not supported by fdir filter");
> return -rte_errno;
> }
>
> For reference, here is the setup code I use
>
> struct rte_flow_attr attr;
> attr.group = 0;
> attr.priority = 0;
> attr.egress = 0;
> attr.ingress = 1;
>
>
> struct rte_flow_item_eth eth_mask;
> struct rte_flow_item_eth eth_spec;
> struct rte_flow_item_vlan vlan_mask;
> struct rte_flow_item_vlan vlan_spec;
> struct rte_flow_action_queue queue;
>
>
> struct rte_flow_item items[3];
> items[0].type = RTE_FLOW_ITEM_TYPE_ETH;
> items[1].type = RTE_FLOW_ITEM_TYPE_VLAN;
> items[0].last = NULL;
> items[0].spec = ð_spec;
> items[0].mask = ð_mask;
> items[1].last = NULL;
> items[1].spec = &vlan_spec;
> items[1].mask = &vlan_mask;
> items[2].type = RTE_FLOW_ITEM_TYPE_END;
>
>
> eth_mask.src = ETH(00,00,00,00,00,00);
> eth_mask.dst = ETH(ff,ff,ff,ff,ff,ff);
> eth_mask.type = 0xffff;
>
>
> eth_spec.src = ETH(00,00,00,00,00,00);
> eth_spec.dst = *dst;
> eth_spec.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN);
>
>
> vlan_spec.tci = vlan_be;
> vlan_spec.tpid = 0;
>
>
> vlan_mask.tci = rte_cpu_to_be_16(0x0fff);
> vlan_mask.tpid = 0;
To my opinion, this setting is not right. As we know, vlan tag is inserted between MAC source address and Ether type.
So if we have a MAC+VLAN+IPv4 packet, the vlan_spec.tpid should be 0x8100, the eth_spec.type should be 0x0800.
+ Adrien, the author. He can correct me if I'm wrong.
next prev parent reply other threads:[~2017-03-08 3:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 11:11 Le Scouarnec Nicolas
2017-03-08 3:16 ` Lu, Wenzhuo [this message]
2017-03-08 9:24 ` Le Scouarnec Nicolas
2017-03-08 15:41 ` Adrien Mazarguil
[not found] ` <CY4PR02MB2552362D11FE183F45F37596F62E0@CY4PR02MB2552.namprd02.prod.outlook.com>
[not found] ` <6A0DE07E22DDAD4C9103DF62FEBC09093B56DC90@shsmsx102.ccr.corp.intel.com>
[not found] ` <6A0DE07E22DDAD4C9103DF62FEBC09093B56E40A@shsmsx102.ccr.corp.intel.com>
2017-03-10 11:46 ` [dpdk-dev] FW: " Adrien Mazarguil
2017-03-13 2:33 ` Lu, Wenzhuo
2017-03-15 10:53 ` Adrien Mazarguil
2017-03-15 14:29 ` Le Scouarnec Nicolas
2017-03-15 16:01 ` Adrien Mazarguil
2017-03-16 17:01 ` Le Scouarnec Nicolas
2017-03-17 9:34 ` Adrien Mazarguil
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=6A0DE07E22DDAD4C9103DF62FEBC09093B56D514@shsmsx102.ccr.corp.intel.com \
--to=wenzhuo.lu@intel.com \
--cc=Nicolas.LeScouarnec@technicolor.com \
--cc=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).