Skip to contentSkip to conversation

net/cpfl: support action prog

PATCH Superseded [email protected] 2 participants 6 messages Oct 27, 2023 – Nov 6, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

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
index ddede2f553..6b0830afd0 100644
@@ -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
#1 lore raw

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
index ddede2f553..6b0830afd0 100644
@@ -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
#2 lore raw

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
index ddede2f553..6b0830afd0 100644
@@ -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
#3 lore raw
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.

#4 lore raw

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
index 9563267513..babec2ccab 100644
@@ -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
index ddede2f553..6b0830afd0 100644
@@ -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
Acked-by on v4 1/1 Applied
#5 lore raw
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 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:

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 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

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