net/cpfl: support action prog
PATCH 1/1 net/cpfl: support action prog
From: Wenjing Qiao <[email protected]>
Parse JSON file and generate rules that instruct PMD to map an RTE_FLOW_ACTION_TYPE_PROG to a low-level FXP representation, the matching follows below guidelines.
Use rte_flow_action_prog->name to match the name of a P4 action type when provided in the JSON file. In cases where the JSON file lacks the P4 action type's name but includes the P4 action type ID, PMD should attempt to convert rte_flow_action_prog->name into a uint32 value and then match it to the P4 action type ID.
The same method applies when matching a rte_flow_action_prog_argument to a field of an action type.
Here's an example to create a rule that matches an IPV4/TCP header and applies a VXLAN encapsulation which is represented by rte_flow_action_prog:
flow create 0 ingress pattern eth src is 00:11:22:33:44:55 dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / tcp src is 0x1451 dst is 0x157c / end actions prog name vxlan_encap arguments src_addr 0xC0A80002 dst_addr 0xC0A80003 src_mac 0x000100000314 dst_mac 0x000600000314 src_port 0x1234 dst_port 0x4789 vni 0x000050 end / port_representor port_id 0 / end
---
Depends-on: series-30022 ("ethdev: fix flow API support for P4-programmable devices")
--- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 + drivers/net/cpfl/cpfl_flow_parser.c | 268 ++++++++++++++++++++++-- drivers/net/cpfl/cpfl_flow_parser.h | 62 +++++- 3 files changed, 308 insertions(+), 24 deletions(-)
drivers/net/cpfl/cpfl_flow_engine_fxp.c +2 -0
@@ -373,6 +373,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,break ;case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :break ;case RTE_FLOW_ACTION_TYPE_VOID :break ;
@@ -425,6 +426,7 @@ cpfl_is_mod_action(const struct rte_flow_action actions[])switch (action_type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :return true;default :continue ;
drivers/net/cpfl/cpfl_flow_parser.c +250 -18
386 lines not on this page · raw message
drivers/net/cpfl/cpfl_flow_parser.h +56 -6
98 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 1/1 net/cpfl: support action prog
From: Wenjing Qiao <[email protected]>
Parse JSON file and generate rules that instruct PMD to map an RTE_FLOW_ACTION_TYPE_PROG to a low-level FXP representation, the matching follows below guidelines.
Use rte_flow_action_prog->name to match the name of a P4 action type when provided in the JSON file. In cases where the JSON file lacks the P4 action type's name but includes the P4 action type ID, PMD should attempt to convert rte_flow_action_prog->name into a uint32 value and then match it to the P4 action type ID.
The same method applies when matching a rte_flow_action_prog_argument to a field of an action type.
Here's an example to create a rule that matches an IPV4/TCP header and applies a VXLAN encapsulation which is represented by rte_flow_action_prog:
flow create 0 ingress pattern eth src is 00:11:22:33:44:55 dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / tcp src is 0x1451 dst is 0x157c / end actions prog name vxlan_encap arguments src_addr 0xC0A80002 dst_addr 0xC0A80003 src_mac 0x000100000314 dst_mac 0x000600000314 src_port 0x1234 dst_port 0x4789 vni 0x000050 end / port_representor port_id 0 / end
--- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 + drivers/net/cpfl/cpfl_flow_parser.c | 268 ++++++++++++++++++++++-- drivers/net/cpfl/cpfl_flow_parser.h | 62 +++++- 3 files changed, 308 insertions(+), 24 deletions(-)
drivers/net/cpfl/cpfl_flow_engine_fxp.c +2 -0
@@ -373,6 +373,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,break ;case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :break ;case RTE_FLOW_ACTION_TYPE_VOID :break ;
@@ -425,6 +426,7 @@ cpfl_is_mod_action(const struct rte_flow_action actions[])switch (action_type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :return true;default :continue ;
drivers/net/cpfl/cpfl_flow_parser.c +250 -18
386 lines not on this page · raw message
drivers/net/cpfl/cpfl_flow_parser.h +56 -6
98 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 1/1 net/cpfl: support action prog
From: Wenjing Qiao <[email protected]>
Parse JSON file and generate rules that instruct PMD to map an RTE_FLOW_ACTION_TYPE_PROG to a low-level FXP representation, the matching follows below guidelines.
Use rte_flow_action_prog->name to match the name of a P4 action type when provided in the JSON file. In cases where the JSON file lacks the P4 action type's name but includes the P4 action type ID, PMD should attempt to convert rte_flow_action_prog->name into a uint32 value and then match it to the P4 action type ID.
The same method applies when matching a rte_flow_action_prog_argument to a field of an action type.
Here's an example to create a rule that matches an IPV4/TCP header and applies a VXLAN encapsulation which is represented by rte_flow_action_prog:
flow create 0 ingress pattern eth src is 00:11:22:33:44:55 dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / tcp src is 0x1451 dst is 0x157c / end actions prog name vxlan_encap arguments src_addr 0xC0A80002 dst_addr 0xC0A80003 src_mac 0x000100000314 dst_mac 0x000600000314 src_port 0x1234 dst_port 0x4789 vni 0x000050 end / port_representor port_id 0 / end
--- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 + drivers/net/cpfl/cpfl_flow_parser.c | 266 ++++++++++++++++++++++-- drivers/net/cpfl/cpfl_flow_parser.h | 62 +++++- 3 files changed, 306 insertions(+), 24 deletions(-)
drivers/net/cpfl/cpfl_flow_engine_fxp.c +2 -0
@@ -373,6 +373,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,break ;case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :break ;case RTE_FLOW_ACTION_TYPE_VOID :break ;
@@ -425,6 +426,7 @@ cpfl_is_mod_action(const struct rte_flow_action actions[])switch (action_type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :return true;default :continue ;
drivers/net/cpfl/cpfl_flow_parser.c +248 -18
378 lines not on this page · raw message
drivers/net/cpfl/cpfl_flow_parser.h +56 -6
98 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 10 lines
-----Original Message-----
From: Qiao, Wenjing <[email protected]>
Sent: Tuesday, October 31, 2023 3:48 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Qiao, Wenjing <[email protected]>
Subject: [PATCH v3] net/cpfl: support action prog
Support new rte_flow action need to update [rte_flow actions] in icpf.ini.
Btw, please always add change log in each version.
PATCH v4 1/1 net/cpfl: support action prog
In reply to [email protected]From: Wenjing Qiao <[email protected]>
Parse JSON file and generate rules that instruct PMD to map an RTE_FLOW_ACTION_TYPE_PROG to a low-level FXP representation, the matching follows below guidelines.
Use rte_flow_action_prog->name to match the name of a P4 action type when provided in the JSON file. In cases where the JSON file lacks the P4 action type's name but includes the P4 action type ID, PMD should attempt to convert rte_flow_action_prog->name into a uint32 value and then match it to the P4 action type ID.
The same method applies when matching a rte_flow_action_prog_argument to a field of an action type.
Here's an example to create a rule that matches an IPV4/TCP header and applies a VXLAN encapsulation which is represented by rte_flow_action_prog:
flow create 0 ingress pattern eth src is 00:11:22:33:44:55 dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / tcp src is 0x1451 dst is 0x157c / end actions prog name vxlan_encap arguments src_addr 0xC0A80002 dst_addr 0xC0A80003 src_mac 0x000100000314 dst_mac 0x000600000314 src_port 0x1234 dst_port 0x4789 vni 0x000050 end / port_representor port_id 0 / end
---
v4:
- fix compile issues.
- update [rte_flow actions] in icpf.ini.
v3:
- use strncpy instead of memcpy for string copy.
- refactor the coding style.
v2:
- fix compile issues.
doc/guides/nics/features/cpfl.ini | 1 + drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 + drivers/net/cpfl/cpfl_flow_parser.c | 268 ++++++++++++++++++++++-- drivers/net/cpfl/cpfl_flow_parser.h | 62 +++++- 4 files changed, 309 insertions(+), 24 deletions(-)
doc/guides/nics/features/cpfl.ini +1 -0
@@ -43,3 +43,4 @@ represented_port = Y rss = Y vxlan_decap = Y vxlan_encap = Y +prog = Y
drivers/net/cpfl/cpfl_flow_engine_fxp.c +2 -0
@@ -373,6 +373,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,break ;case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :break ;case RTE_FLOW_ACTION_TYPE_VOID :break ;
@@ -425,6 +426,7 @@ cpfl_is_mod_action(const struct rte_flow_action actions[])switch (action_type) {case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP : +case RTE_FLOW_ACTION_TYPE_PROG :return true;default :continue ;
drivers/net/cpfl/cpfl_flow_parser.c +250 -18
380 lines not on this page · raw message
drivers/net/cpfl/cpfl_flow_parser.h +56 -6
98 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 28 lines
-----Original Message-----
From: Qiao, Wenjing <[email protected]>
Sent: Thursday, November 2, 2023 4:51 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Qiao, Wenjing <[email protected]>
Subject: [PATCH v4] net/cpfl: support action progFrom: Wenjing Qiao <[email protected]>
Parse JSON file and generate rules that instruct PMD to map an
RTE_FLOW_ACTION_TYPE_PROGto a low-level FXP representation, the matching follows below guidelines.Use
rte_flow_action_prog->nameto match the name of a P4 action type when provided in the JSON file. In cases where the JSON file lacks the P4 action type's name but includes the P4 action type ID, PMD should attempt to convertrte_flow_action_prog->nameinto a
uint32 value and then match it to the P4 action type ID.The same method applies when matching a
rte_flow_action_prog_argumentto a field of an action type.Here's an example to create a rule that matches an IPV4/TCP header and applies a VXLAN encapsulation which is represented by
rte_flow_action_prog:
Quoted 8 lines
flow create 0 ingress pattern eth src is 00:11:22:33:44:55 dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / tcp src is
0x1451dst is0x157c/ end actions prog namevxlan_encapargumentssrc_addr0xC0A80002dst_addr0xC0A80003src_mac0x000100000314dst_mac0x000600000314src_port0x1234dst_port0x4789vni0x000050end /port_representorport_id0 / endSigned-off-by Wenjing Qiao <[email protected]>
The CI build error in patchwork is covered by below fix
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Applied to dpdk-next-net-intel.
Thanks
Qi