Whether the creatation of flow rules of i40e NIC support tcp port mask
Lukáš Šišmiš
sismis at cesnet.cz
Wed Oct 18 09:21:16 CEST 2023
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 at huawei.com>
> *Sent:* Wednesday, October 18, 2023 10:19 AM
> *To:* Xing, Beilei <beilei.xing at intel.com>; users at dpdk.org; Stephen
> Hemminger <stephen at networkplumber.org>
> *Cc:* Fanbin(Kira,2012 Blue Lab.) <fanbin12 at 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 at intel.com>
> *发送时间:* 2023年10月18日 9:55
> *收件人:* jiangheng (G) <jiangheng14 at huawei.com>; users at dpdk.org
> *抄送:* Fanbin(Kira,2012 Blue Lab.) <fanbin12 at 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 at huawei.com>
> *Sent:* Tuesday, October 17, 2023 4:52 PM
> *To:* Xing, Beilei <beilei.xing at intel.com>; users at dpdk.org
> *Cc:* Fanbin(Kira,2012 Blue Lab.) <fanbin12 at 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/users/attachments/20231018/d489aa32/attachment.htm>
More information about the users
mailing list