From: "Lukáš Šišmiš" <sismis@cesnet.cz>
To: "Xing, Beilei" <beilei.xing@intel.com>,
"jiangheng (G)" <jiangheng14@huawei.com>,
"users@dpdk.org" <users@dpdk.org>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: "Fanbin(Kira,2012 Blue Lab.)" <fanbin12@huawei.com>
Subject: Re: Whether the creatation of flow rules of i40e NIC support tcp port mask
Date: Wed, 18 Oct 2023 09:21:16 +0200 [thread overview]
Message-ID: <2d9a33c2-c4d3-4f05-8af4-d342d924fbe4@cesnet.cz> (raw)
In-Reply-To: <LV2PR11MB59970CBF9B54F420DC296804F7D5A@LV2PR11MB5997.namprd11.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 4843 bytes --]
Hi Jiangheng,
maybe going through this thesis will help you -
https://theses.cz/id/c96b6o/24818.pdf
Page 46 mentions 7680 rules as the overall maximum capacity for i40e.
Regards,
Lukas
On 18. 10. 23 6:09, Xing, Beilei wrote:
>
> Hi jiangheng,
>
> For TCP rules, it should be flow director. I remember i40e supports 8K
> flow director rules.
>
> When the rule number is greater than 8K, only 8k rules can be created
> successfully.
>
> BR,
>
> Beilei
>
> *From:*jiangheng (G) <jiangheng14@huawei.com>
> *Sent:* Wednesday, October 18, 2023 10:19 AM
> *To:* Xing, Beilei <beilei.xing@intel.com>; users@dpdk.org; Stephen
> Hemminger <stephen@networkplumber.org>
> *Cc:* Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com>
> *Subject:* 答复: Whether the creatation of flow rules of i40e NIC
> support tcp port mask
>
> Hi Beilei:
>
> What is the maximum number of flow rules supported by the i40e?
>
> What about that situation: numbers of tcp connection is greater than
> the maximum number of flow rules.
>
> *发件人**:*Xing, Beilei <beilei.xing@intel.com>
> *发送时间:* 2023年10月18日 9:55
> *收件人:* jiangheng (G) <jiangheng14@huawei.com>; users@dpdk.org
> *抄送:* Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com>
> *主题:* RE: Whether the creatation of flow rules of i40e NIC support tcp
> port mask
>
> Hi Jiangheng,
>
> That’s because i40e only supports perfect match.
>
> BR,
>
> Beilei
>
> *From:*jiangheng (G) <jiangheng14@huawei.com>
> *Sent:* Tuesday, October 17, 2023 4:52 PM
> *To:* Xing, Beilei <beilei.xing@intel.com>; users@dpdk.org
> *Cc:* Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com>
> *Subject:* Whether the creatation of flow rules of i40e NIC support
> tcp port mask
>
> Hi beilei,
>
> I would like to create flows using tcp port mask, but it seems *only
> mask 0xffff or 0x0 work*, Does flow rlue can be created using other mask?
>
> I40e dirver was using now.
>
> Here is my code:
>
> struct rte_flow_attr attr;
>
> struct rte_flow_item pattern[MAX_PATTERN_NUM];
>
> struct rte_flow_action action[MAX_ACTION_NUM];
>
> struct rte_flow *flow = NULL;
>
> struct rte_flow_action_queue queue = { .index = queue_id };
>
> struct rte_flow_item_ipv4 ip_spec;
>
> struct rte_flow_item_ipv4 ip_mask;
>
> struct rte_flow_item_tcp tcp_spec;
>
> struct rte_flow_item_tcp tcp_mask;
>
> int res;
>
> memset_s(pattern, sizeof(pattern), 0, sizeof(pattern));
>
> memset_s(action, sizeof(action), 0, sizeof(action));
>
> /*
>
> * set the rule attribute.
>
> * in this case only ingress packets will be checked.
>
> */
>
> memset_s(&attr, sizeof(struct rte_flow_attr), 0, sizeof(struct
> rte_flow_attr));
>
> attr.ingress = 1;
>
> /*
>
> * create the action sequence.
>
> * one action only, move packet to queue
>
> */
>
> action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
>
> action[0].conf = &queue;
>
> action[1].type = RTE_FLOW_ACTION_TYPE_END;
>
> // not limit eth header
>
> pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
>
> // ip header
>
> memset_s(&ip_spec, sizeof(struct rte_flow_item_ipv4), 0,
> sizeof(struct rte_flow_item_ipv4));
>
> memset_s(&ip_mask, sizeof(struct rte_flow_item_ipv4), 0,
> sizeof(struct rte_flow_item_ipv4));
>
> ip_spec.hdr.dst_addr = dst_ip;
>
> ip_mask.hdr.dst_addr = EMPTY_MASK;
>
> ip_spec.hdr.src_addr = src_ip;
>
> ip_mask.hdr.src_addr = EMPTY_MASK;
>
> pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
>
> pattern[1].spec = &ip_spec;
>
> pattern[1].mask = &ip_mask;
>
> // tcp header, full mask 0xffff
>
> memset_s(&tcp_spec, sizeof(struct rte_flow_item_tcp), 0,
> sizeof(struct rte_flow_item_tcp));
>
> memset_s(&tcp_mask, sizeof(struct rte_flow_item_tcp), 0,
> sizeof(struct rte_flow_item_tcp));
>
> pattern[2].type = RTE_FLOW_ITEM_TYPE_TCP; // 2: pattern 2 is tcp
> header
>
> tcp_spec.hdr.src_port = src_port;
>
> tcp_spec.hdr.dst_port = dst_port;
>
> *tcp_mask.hdr.src_port = 0xffff; // only 0xffff and 0x0 work*
>
> *tcp_mask.hdr.dst_port = 0xffff; // only 0xffff and 0x0 work*
>
> pattern[2].spec = &tcp_spec;
>
> pattern[2].mask = &tcp_mask;
>
> /* the final level must be always type end */
>
> pattern[3].type = RTE_FLOW_ITEM_TYPE_END;
>
> res = rte_flow_validate(port_id, &attr, pattern, action, error);
>
> if (!res) {
>
> flow = rte_flow_create(port_id, &attr, pattern, action, error);
>
> } else {
>
> LSTACK_LOG(ERR, PORT, "rte_flow_create.rte_flow_validate
> error, res %d \n", res);
>
> }
>
> Looking forward to your favourable reply.
>
[-- Attachment #2: Type: text/html, Size: 18146 bytes --]
next prev parent reply other threads:[~2023-10-18 7:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 8:52 jiangheng (G)
2023-10-17 15:52 ` Stephen Hemminger
2023-10-18 1:48 ` 答复: " jiangheng (G)
2023-10-18 1:54 ` Xing, Beilei
2023-10-18 2:19 ` 答复: " jiangheng (G)
2023-10-18 4:09 ` Xing, Beilei
2023-10-18 7:21 ` Lukáš Šišmiš [this message]
2023-10-18 11:16 ` 答复: " jiangheng (G)
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=2d9a33c2-c4d3-4f05-8af4-d342d924fbe4@cesnet.cz \
--to=sismis@cesnet.cz \
--cc=beilei.xing@intel.com \
--cc=fanbin12@huawei.com \
--cc=jiangheng14@huawei.com \
--cc=stephen@networkplumber.org \
--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).