* Whether the creatation of flow rules of i40e NIC support tcp port mask
@ 2023-10-17 8:52 jiangheng (G)
2023-10-17 15:52 ` Stephen Hemminger
2023-10-18 1:54 ` Xing, Beilei
0 siblings, 2 replies; 8+ messages in thread
From: jiangheng (G) @ 2023-10-17 8:52 UTC (permalink / raw)
To: beilei.xing, users; +Cc: Fanbin(Kira,2012 Blue Lab.)
[-- Attachment #1: Type: text/plain, Size: 2856 bytes --]
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: 10860 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-17 8:52 Whether the creatation of flow rules of i40e NIC support tcp port mask jiangheng (G)
@ 2023-10-17 15:52 ` Stephen Hemminger
2023-10-18 1:48 ` 答复: " jiangheng (G)
2023-10-18 1:54 ` Xing, Beilei
1 sibling, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2023-10-17 15:52 UTC (permalink / raw)
To: jiangheng (G); +Cc: beilei.xing, users, Fanbin(Kira,2012 Blue Lab.)
On Tue, 17 Oct 2023 08:52:22 +0000
"jiangheng (G)" <jiangheng14@huawei.com> wrote:
> 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.
Why not create multiple rules each pointing at same action?
Or is mask so wide that you run out of rte_flow slots.
^ permalink raw reply [flat|nested] 8+ messages in thread
* 答复: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-17 15:52 ` Stephen Hemminger
@ 2023-10-18 1:48 ` jiangheng (G)
0 siblings, 0 replies; 8+ messages in thread
From: jiangheng (G) @ 2023-10-18 1:48 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: beilei.xing, users, Fanbin(Kira,2012 Blue Lab.)
Hi Stephen:
I am trying to shorten mask, but flow rules s not working.in i40e NIC.
Please see i40e pmd code:
https://github.com/DPDK/dpdk/blob/v22.11/drivers/net/i40e/i40e_flow.c#L2036
It only determines that the mask is UINT16_MAX, and setting mask to other value seems no difference.
-----邮件原件-----
发件人: Stephen Hemminger <stephen@networkplumber.org>
发送时间: 2023年10月17日 23:52
收件人: jiangheng (G) <jiangheng14@huawei.com>
抄送: beilei.xing@intel.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
On Tue, 17 Oct 2023 08:52:22 +0000
"jiangheng (G)" <jiangheng14@huawei.com> wrote:
> 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.
Why not create multiple rules each pointing at same action?
Or is mask so wide that you run out of rte_flow slots.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-17 8:52 Whether the creatation of flow rules of i40e NIC support tcp port mask jiangheng (G)
2023-10-17 15:52 ` Stephen Hemminger
@ 2023-10-18 1:54 ` Xing, Beilei
2023-10-18 2:19 ` 答复: " jiangheng (G)
1 sibling, 1 reply; 8+ messages in thread
From: Xing, Beilei @ 2023-10-18 1:54 UTC (permalink / raw)
To: jiangheng (G), users; +Cc: Fanbin(Kira,2012 Blue Lab.)
[-- Attachment #1: Type: text/plain, Size: 3270 bytes --]
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: 10329 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* 答复: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-18 1:54 ` Xing, Beilei
@ 2023-10-18 2:19 ` jiangheng (G)
2023-10-18 4:09 ` Xing, Beilei
0 siblings, 1 reply; 8+ messages in thread
From: jiangheng (G) @ 2023-10-18 2:19 UTC (permalink / raw)
To: Xing, Beilei, users, Stephen Hemminger; +Cc: Fanbin(Kira,2012 Blue Lab.)
[-- Attachment #1: Type: text/plain, Size: 3838 bytes --]
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<mailto:jiangheng14@huawei.com>>
Sent: Tuesday, October 17, 2023 4:52 PM
To: Xing, Beilei <beilei.xing@intel.com<mailto:beilei.xing@intel.com>>; users@dpdk.org<mailto:users@dpdk.org>
Cc: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com<mailto: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: 15729 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-18 2:19 ` 答复: " jiangheng (G)
@ 2023-10-18 4:09 ` Xing, Beilei
2023-10-18 7:21 ` Lukáš Šišmiš
0 siblings, 1 reply; 8+ messages in thread
From: Xing, Beilei @ 2023-10-18 4:09 UTC (permalink / raw)
To: jiangheng (G), users, Stephen Hemminger; +Cc: Fanbin(Kira,2012 Blue Lab.)
[-- Attachment #1: Type: text/plain, Size: 4523 bytes --]
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<mailto:beilei.xing@intel.com>>
发送时间: 2023年10月18日 9:55
收件人: jiangheng (G) <jiangheng14@huawei.com<mailto:jiangheng14@huawei.com>>; users@dpdk.org<mailto:users@dpdk.org>
抄送: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com<mailto: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<mailto:jiangheng14@huawei.com>>
Sent: Tuesday, October 17, 2023 4:52 PM
To: Xing, Beilei <beilei.xing@intel.com<mailto:beilei.xing@intel.com>>; users@dpdk.org<mailto:users@dpdk.org>
Cc: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com<mailto: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: 14873 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-18 4:09 ` Xing, Beilei
@ 2023-10-18 7:21 ` Lukáš Šišmiš
2023-10-18 11:16 ` 答复: " jiangheng (G)
0 siblings, 1 reply; 8+ messages in thread
From: Lukáš Šišmiš @ 2023-10-18 7:21 UTC (permalink / raw)
To: Xing, Beilei, jiangheng (G), users, Stephen Hemminger
Cc: Fanbin(Kira,2012 Blue Lab.)
[-- 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 --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* 答复: Whether the creatation of flow rules of i40e NIC support tcp port mask
2023-10-18 7:21 ` Lukáš Šišmiš
@ 2023-10-18 11:16 ` jiangheng (G)
0 siblings, 0 replies; 8+ messages in thread
From: jiangheng (G) @ 2023-10-18 11:16 UTC (permalink / raw)
To: Lukáš Šišmiš,
Xing, Beilei, users, Stephen Hemminger
Cc: Fanbin(Kira,2012 Blue Lab.)
[-- Attachment #1: Type: text/plain, Size: 5388 bytes --]
Thank you sismis.
7680 rules are consistent with my actual test results.
发件人: Lukáš Šišmiš <sismis@cesnet.cz>
发送时间: 2023年10月18日 15:21
收件人: Xing, Beilei <beilei.xing@intel.com>; jiangheng (G) <jiangheng14@huawei.com>; users@dpdk.org; Stephen Hemminger <stephen@networkplumber.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,
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><mailto:jiangheng14@huawei.com>
Sent: Wednesday, October 18, 2023 10:19 AM
To: Xing, Beilei <beilei.xing@intel.com><mailto:beilei.xing@intel.com>; users@dpdk.org<mailto:users@dpdk.org>; Stephen Hemminger <stephen@networkplumber.org><mailto:stephen@networkplumber.org>
Cc: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com><mailto: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<mailto:beilei.xing@intel.com>>
发送时间: 2023年10月18日 9:55
收件人: jiangheng (G) <jiangheng14@huawei.com<mailto:jiangheng14@huawei.com>>; users@dpdk.org<mailto:users@dpdk.org>
抄送: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com<mailto: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<mailto:jiangheng14@huawei.com>>
Sent: Tuesday, October 17, 2023 4:52 PM
To: Xing, Beilei <beilei.xing@intel.com<mailto:beilei.xing@intel.com>>; users@dpdk.org<mailto:users@dpdk.org>
Cc: Fanbin(Kira,2012 Blue Lab.) <fanbin12@huawei.com<mailto: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: 21666 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-18 11:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 8:52 Whether the creatation of flow rules of i40e NIC support tcp port mask 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š
2023-10-18 11:16 ` 答复: " jiangheng (G)
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).