Skip to contentSkip to conversation

Add example l3fwd-regex

PATCH Superseded [email protected] 4 participants 19 messages Sep 8, 2020 – Jun 29, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Add example l3fwd-regex

From: Guy Kaneti <[email protected]>

The L3 Forwarding with Regex application is a simple example of packet processing using DPDK Regex framework.
The application performs L3 LPM based forwarding while using Regex framework for pre-filtering decision.

Guy Kaneti (2):
examples/l3fwd-regex: add regex based l3fwd
doc: add l3fwd-regex application user guide

 MAINTAINERS                                   |    3 +
 doc/guides/sample_app_ug/index.rst            |    1 +
 doc/guides/sample_app_ug/intro.rst            |    4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst |  235 ++++
 examples/l3fwd-regex/l3fwd.h                  |  207 +++
 examples/l3fwd-regex/l3fwd_lpm.c              |  461 +++++++
 examples/l3fwd-regex/l3fwd_lpm.h              |  100 ++
 examples/l3fwd-regex/l3fwd_regex.c            |  487 +++++++
 examples/l3fwd-regex/l3fwd_regex.h            |   38 +
 examples/l3fwd-regex/main.c                   | 1117 +++++++++++++++++
 examples/l3fwd-regex/meson.build              |   10 +
 examples/meson.build                          |    2 +-
 12 files changed, 2664 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.h
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/2 examples/l3fwd-regex: add regex based l3fwd

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

---
 MAINTAINERS                        |    2 +
 examples/l3fwd-regex/l3fwd.h       |  207 ++++++
 examples/l3fwd-regex/l3fwd_lpm.c   |  461 ++++++++++++
 examples/l3fwd-regex/l3fwd_lpm.h   |  100 +++
 examples/l3fwd-regex/l3fwd_regex.c |  487 ++++++++++++
 examples/l3fwd-regex/l3fwd_regex.h |   38 +
 examples/l3fwd-regex/main.c        | 1117 ++++++++++++++++++++++++++++
 examples/l3fwd-regex/meson.build   |   10 +
 examples/meson.build               |    2 +-
 9 files changed, 2423 insertions(+), 1 deletion(-)
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.h
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
MAINTAINERS +2 -0
index ed163f5d5..a73845a2d 100644
@@ -451,6 +451,8 @@ F: lib/librte_regexdev/
 F: app/test-regex/
 F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
+M: Guy Kaneti <[email protected]>
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
examples/l3fwd-regex/l3fwd.h new file +207 -0

207 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_lpm.c new file +461 -0

461 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_lpm.h new file +100 -0

100 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.c new file +487 -0

487 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.h new file +38 -0
new file mode 100644
index 000000000..d01a8e6e1
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3FWD_REGEX_H__
+#define __L3FWD_REGEX_H__
+
+#define REGEX_NB_OPS (8192)
+
+int
+regex_dev_init(uint32_t dev_id, uint16_t nb_queue_pairs);
+
+int
+regex_lcore_init(uint32_t lcore_id, uint32_t dev_id, uint32_t qp_id);
+
+uint32_t
+regex_enqueue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+uint32_t
+regex_dequeue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+int
+regex_read_rule_db_file(char *filename);
+void
+regex_debug_enable(void);
+void
+regex_drop_on_match(void);
+
+void
+regex_stats_print(uint32_t lcore);
+void
+regex_dev_uninit(uint32_t dev_id);
+void
+regex_lcore_uninit(uint32_t lcore_id);
+void
+regex_mem_free(void);
+
+#endif /* __L3FWD_REGEX_H__ */
examples/l3fwd-regex/main.c new file +1117 -0

1,117 lines not on this page · raw message

examples/l3fwd-regex/meson.build new file +10 -0
new file mode 100644
index 000000000..a5f602510
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell International Ltd.
+
+# meson file, for building this example as part of a main DPDK build.
+
+allow_experimental_apis = true
+deps += ['lpm', 'regexdev']
+sources = files(
+	'l3fwd_lpm.c', 'l3fwd_regex.c', 'main.c'
+)
examples/meson.build +1 -1
index eb13e8210..b61acd4bc 100644
@@ -23,7 +23,7 @@ all_examples = [
 	'l2fwd', 'l2fwd-cat', 'l2fwd-event',
 	'l2fwd-crypto', 'l2fwd-jobstats',
 	'l2fwd-keepalive', 'l3fwd',
-	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph',
+	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph', 'l3fwd-regex',
 	'link_status_interrupt',
 	'multi_process/client_server_mp/mp_client',
 	'multi_process/client_server_mp/mp_server',
Signature · 1 line
2.28.0
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] examples/l3fwd-regex: add regex based l3fwd

08/09/2020 14:31, [email protected]:

Quoted 4 lines

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

The trend is to reduce the number of example applications. Do you think regex could be an option in the original l3fwd?

author
#3 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH 1/2] examples/l3fwd-regex: add regex based l3fwd

Sorry for the delayed response

Quoted 17 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, October 14, 2020 11:47 AM
To: Guy Kaneti <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Smadar Fuks <[email protected]>; Dovrat Zifroni <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH 1/2] examples/l3fwd-regex: add regex based l3fwd

External Email

----------------------------------------------------------------------
08/09/2020 14:31, [email protected]:

Quoted 8 lines
Quoted 4 lines

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

The trend is to reduce the number of example applications. Do you think regex could be an option in the original l3fwd?

The regex operation is not a direct networking functionality and is not a type of forwarding. The purpose of the application was to show an example of regex operation with networking. I think it should stand by itself.

#4 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH 1/2] examples/l3fwd-regex: add regex based l3fwd

18/10/2020 13:53, Guy Kaneti:

Quoted 6 lines

From: Thomas Monjalon <[email protected]>

Quoted 5 lines
Quoted 4 lines

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

Quoted 6 lines
Quoted 2 lines

The trend is to reduce the number of example applications. Do you think regex could be an option in the original l3fwd?

The regex operation is not a direct networking functionality and is not a type of forwarding. The purpose of the application was to show an example of regex operation with networking. I think it should stand by itself.

If it was only regex, yes it would make sense as standalone. But mixing with networking forwarding could be in the same app.

#5 lore raw

PATCH 2/2 doc: add l3fwd-regex application user guide

In reply to [email protected]

From: Guy Kaneti <[email protected]>

Adding the user guide for l3fwd regex application.

---
 MAINTAINERS                                   |   1 +
 doc/guides/sample_app_ug/index.rst            |   1 +
 doc/guides/sample_app_ug/intro.rst            |   4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst | 235 ++++++++++++++++++
 4 files changed, 241 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
MAINTAINERS +1 -0
index a73845a2d..af8a803ea 100644
@@ -453,6 +453,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti <[email protected]>
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
doc/guides/sample_app_ug/index.rst +1 -0
index affa9c574..dc67580af 100644
@@ -32,6 +32,7 @@ Sample Applications User Guides
     l3_forward_graph
     l3_forward_power_man
     l3_forward_access_ctrl
+    l3_forward_regex
     link_status_intr
     server_node_efd
     service_cores
doc/guides/sample_app_ug/intro.rst +4 -0
index 8ff223b16..94070933b 100644
@@ -58,6 +58,10 @@ examples are highlighted below.
   forwarding Graph, or ``l3fwd_graph`` application does forwarding based on IPv4
   like a simple router with DPDK Graph framework.
 
+* :doc:`Network Layer 3 forwarding Regex<l3_forward_regex>`: The Network Layer3
+  forwarding Regex, or ``l3fwd-regex`` application does forwarding based on IPv4
+  like a simple router with DPDK Regex framework.
+
 * :doc:`Hardware packet copying<ioat>`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
doc/guides/sample_app_ug/l3_forward_regex.rst new file +235 -0

235 lines not on this page · raw message

Signature · 1 line
2.28.0
#6 lore raw

v2 cover Add example l3fwd-regex

From: Guy Kaneti <[email protected]>

The L3 Forwarding with Regex application is a simple example of packet processing using DPDK Regex framework.
The application performs L3 LPM based forwarding while using Regex framework for pre-filtering decision.

v2:
* Rebase.
* Add release notes.
* fix spelling mistake
* fix build error

Guy Kaneti (2):
examples/l3fwd-regex: add regex based l3fwd
doc: add l3fwd-regex application user guide

 MAINTAINERS                                   |    3 +
 doc/guides/rel_notes/release_20_11.rst        |    4 +
 doc/guides/sample_app_ug/index.rst            |    1 +
 doc/guides/sample_app_ug/intro.rst            |    4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst |  235 ++++
 examples/l3fwd-regex/l3fwd.h                  |  207 +++
 examples/l3fwd-regex/l3fwd_lpm.c              |  484 +++++++
 examples/l3fwd-regex/l3fwd_regex.c            |  487 +++++++
 examples/l3fwd-regex/l3fwd_regex.h            |   38 +
 examples/l3fwd-regex/main.c                   | 1117 +++++++++++++++++
 examples/l3fwd-regex/meson.build              |   10 +
 examples/meson.build                          |    2 +-
 12 files changed, 2591 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
Signature · 1 line
2.28.0
#7 lore raw

PATCH v2 1/2 examples/l3fwd-regex: add regex based l3fwd

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

---
 MAINTAINERS                        |    2 +
 examples/l3fwd-regex/l3fwd.h       |  207 ++++++
 examples/l3fwd-regex/l3fwd_lpm.c   |  484 ++++++++++++
 examples/l3fwd-regex/l3fwd_regex.c |  487 ++++++++++++
 examples/l3fwd-regex/l3fwd_regex.h |   38 +
 examples/l3fwd-regex/main.c        | 1117 ++++++++++++++++++++++++++++
 examples/l3fwd-regex/meson.build   |   10 +
 examples/meson.build               |    2 +-
 8 files changed, 2346 insertions(+), 1 deletion(-)
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
MAINTAINERS +2 -0
index 3b16d7a4b..e30b1ad56 100644
@@ -433,6 +433,8 @@ F: lib/librte_regexdev/
 F: app/test-regex/
 F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
+M: Guy Kaneti <[email protected]>
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
examples/l3fwd-regex/l3fwd.h new file +207 -0

207 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_lpm.c new file +484 -0

484 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.c new file +487 -0

487 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.h new file +38 -0
new file mode 100644
index 000000000..d01a8e6e1
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3FWD_REGEX_H__
+#define __L3FWD_REGEX_H__
+
+#define REGEX_NB_OPS (8192)
+
+int
+regex_dev_init(uint32_t dev_id, uint16_t nb_queue_pairs);
+
+int
+regex_lcore_init(uint32_t lcore_id, uint32_t dev_id, uint32_t qp_id);
+
+uint32_t
+regex_enqueue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+uint32_t
+regex_dequeue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+int
+regex_read_rule_db_file(char *filename);
+void
+regex_debug_enable(void);
+void
+regex_drop_on_match(void);
+
+void
+regex_stats_print(uint32_t lcore);
+void
+regex_dev_uninit(uint32_t dev_id);
+void
+regex_lcore_uninit(uint32_t lcore_id);
+void
+regex_mem_free(void);
+
+#endif /* __L3FWD_REGEX_H__ */
examples/l3fwd-regex/main.c new file +1117 -0

1,117 lines not on this page · raw message

examples/l3fwd-regex/meson.build new file +10 -0
new file mode 100644
index 000000000..a5f602510
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell International Ltd.
+
+# meson file, for building this example as part of a main DPDK build.
+
+allow_experimental_apis = true
+deps += ['lpm', 'regexdev']
+sources = files(
+	'l3fwd_lpm.c', 'l3fwd_regex.c', 'main.c'
+)
examples/meson.build +1 -1
index eb13e8210..b61acd4bc 100644
@@ -23,7 +23,7 @@ all_examples = [
 	'l2fwd', 'l2fwd-cat', 'l2fwd-event',
 	'l2fwd-crypto', 'l2fwd-jobstats',
 	'l2fwd-keepalive', 'l3fwd',
-	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph',
+	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph', 'l3fwd-regex',
 	'link_status_interrupt',
 	'multi_process/client_server_mp/mp_client',
 	'multi_process/client_server_mp/mp_server',
Signature · 1 line
2.28.0
Acked-by on v2 1/2
#8 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] examples/l3fwd-regex: add regex based l3fwd

Hi Guy,

Sorry for late reply.

Quoted 5 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, September 9, 2020 3:09 PM
Subject: [PATCH v2 1/2] examples/l3fwd-regex: add regex based l3fwd

Quoted 7 lines

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

---

Thanks,
Ori

#9 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] examples/l3fwd-regex: add regex based l3fwd

In reply to [email protected]

(repeating question asked on v1 by mistake)

09/09/2020 14:08, [email protected]:

Quoted 2 lines

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

The trend is to reduce the number of example applications. Do you think regex could be an option in the original l3fwd?

#10 lore raw

PATCH v2 2/2 doc: add l3fwd-regex application user guide

In reply to [email protected]

From: Guy Kaneti <[email protected]>

Adding the user guide for l3fwd regex application.

---
 MAINTAINERS                                   |   1 +
 doc/guides/rel_notes/release_20_11.rst        |   4 +
 doc/guides/sample_app_ug/index.rst            |   1 +
 doc/guides/sample_app_ug/intro.rst            |   4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst | 235 ++++++++++++++++++
 5 files changed, 245 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
MAINTAINERS +1 -0
index e30b1ad56..f35f8bc01 100644
@@ -435,6 +435,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti <[email protected]>
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
doc/guides/rel_notes/release_20_11.rst +4 -0
index df227a177..8c27ba6fd 100644
@@ -55,6 +55,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added new l3fwd-regex sample application.**
+
+  Added an example application ``l3fwd-regex``. This demonstrates the usage of
+  packet processing using DPDK Regex libraries.
 
 Removed Items
 -------------
doc/guides/sample_app_ug/index.rst +1 -0
index affa9c574..dc67580af 100644
@@ -32,6 +32,7 @@ Sample Applications User Guides
     l3_forward_graph
     l3_forward_power_man
     l3_forward_access_ctrl
+    l3_forward_regex
     link_status_intr
     server_node_efd
     service_cores
doc/guides/sample_app_ug/intro.rst +4 -0
index 8ff223b16..94070933b 100644
@@ -58,6 +58,10 @@ examples are highlighted below.
   forwarding Graph, or ``l3fwd_graph`` application does forwarding based on IPv4
   like a simple router with DPDK Graph framework.
 
+* :doc:`Network Layer 3 forwarding Regex<l3_forward_regex>`: The Network Layer3
+  forwarding Regex, or ``l3fwd-regex`` application does forwarding based on IPv4
+  like a simple router with DPDK Regex framework.
+
 * :doc:`Hardware packet copying<ioat>`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
doc/guides/sample_app_ug/l3_forward_regex.rst new file +235 -0

235 lines not on this page · raw message

Signature · 1 line
2.28.0
Acked-by on v2 2/2
#11 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] doc: add l3fwd-regex application user guide

Hi Guy,

Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, September 9, 2020 3:09 PM
Subject: [PATCH v2 2/2] doc: add l3fwd-regex application user guide

From: Guy Kaneti <[email protected]>

Adding the user guide for l3fwd regex application.

---

Thanks,
Ori

#12 lore raw

v3 cover Add example l3fwd-regex

In reply to [email protected]

From: Guy Kaneti <[email protected]>

The L3 Forwarding with Regex application is a simple example of packet processing using DPDK Regex framework.
The application performs L3 LPM based forwarding while using Regex framework for pre-filtering decision.

v3:
* Rebase.
* fix typo

v2:
* Rebase.
* Add release notes.
* fix spelling mistake
* fix build error

Guy Kaneti (2):
examples/l3fwd-regex: add regex based l3fwd
doc: add l3fwd-regex application user guide

 MAINTAINERS                                   |    3 +
 doc/guides/rel_notes/release_20_11.rst        |    5 +
 doc/guides/sample_app_ug/index.rst            |    1 +
 doc/guides/sample_app_ug/intro.rst            |    4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst |  235 ++++
 examples/l3fwd-regex/l3fwd.h                  |  207 +++
 examples/l3fwd-regex/l3fwd_lpm.c              |  484 +++++++
 examples/l3fwd-regex/l3fwd_regex.c            |  487 +++++++
 examples/l3fwd-regex/l3fwd_regex.h            |   38 +
 examples/l3fwd-regex/main.c                   | 1117 +++++++++++++++++
 examples/l3fwd-regex/meson.build              |   10 +
 examples/meson.build                          |    2 +-
 12 files changed, 2592 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
Signature · 1 line
2.28.0
#13 lore raw

PATCH v3 1/2 examples/l3fwd-regex: add regex based l3fwd

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

---
 MAINTAINERS                        |    2 +
 examples/l3fwd-regex/l3fwd.h       |  207 ++++++
 examples/l3fwd-regex/l3fwd_lpm.c   |  484 ++++++++++++
 examples/l3fwd-regex/l3fwd_regex.c |  487 ++++++++++++
 examples/l3fwd-regex/l3fwd_regex.h |   38 +
 examples/l3fwd-regex/main.c        | 1117 ++++++++++++++++++++++++++++
 examples/l3fwd-regex/meson.build   |   10 +
 examples/meson.build               |    2 +-
 8 files changed, 2346 insertions(+), 1 deletion(-)
 create mode 100644 examples/l3fwd-regex/l3fwd.h
 create mode 100644 examples/l3fwd-regex/l3fwd_lpm.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.c
 create mode 100644 examples/l3fwd-regex/l3fwd_regex.h
 create mode 100644 examples/l3fwd-regex/main.c
 create mode 100644 examples/l3fwd-regex/meson.build
MAINTAINERS +2 -0
index f7ecb5305..9880efa3a 100644
@@ -431,6 +431,8 @@ F: lib/librte_regexdev/
 F: app/test-regex/
 F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
+M: Guy Kaneti <[email protected]>
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
examples/l3fwd-regex/l3fwd.h new file +207 -0

207 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_lpm.c new file +484 -0

484 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.c new file +487 -0

487 lines not on this page · raw message

examples/l3fwd-regex/l3fwd_regex.h new file +38 -0
new file mode 100644
index 000000000..d01a8e6e1
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3FWD_REGEX_H__
+#define __L3FWD_REGEX_H__
+
+#define REGEX_NB_OPS (8192)
+
+int
+regex_dev_init(uint32_t dev_id, uint16_t nb_queue_pairs);
+
+int
+regex_lcore_init(uint32_t lcore_id, uint32_t dev_id, uint32_t qp_id);
+
+uint32_t
+regex_enqueue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+uint32_t
+regex_dequeue_burst_ops(int dev_id, uint32_t lcore_id, uint16_t qp_id,
+		struct rte_mbuf **pkts_burst, uint16_t nb_pkts);
+int
+regex_read_rule_db_file(char *filename);
+void
+regex_debug_enable(void);
+void
+regex_drop_on_match(void);
+
+void
+regex_stats_print(uint32_t lcore);
+void
+regex_dev_uninit(uint32_t dev_id);
+void
+regex_lcore_uninit(uint32_t lcore_id);
+void
+regex_mem_free(void);
+
+#endif /* __L3FWD_REGEX_H__ */
examples/l3fwd-regex/main.c new file +1117 -0

1,117 lines not on this page · raw message

examples/l3fwd-regex/meson.build new file +10 -0
new file mode 100644
index 000000000..a5f602510
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell International Ltd.
+
+# meson file, for building this example as part of a main DPDK build.
+
+allow_experimental_apis = true
+deps += ['lpm', 'regexdev']
+sources = files(
+	'l3fwd_lpm.c', 'l3fwd_regex.c', 'main.c'
+)
examples/meson.build +1 -1
index 414ec55cc..1378d3f0b 100644
@@ -23,7 +23,7 @@ all_examples = [
 	'l2fwd', 'l2fwd-cat', 'l2fwd-event',
 	'l2fwd-crypto', 'l2fwd-jobstats',
 	'l2fwd-keepalive', 'l3fwd',
-	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph',
+	'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph', 'l3fwd-regex',
 	'link_status_interrupt',
 	'multi_process/client_server_mp/mp_client',
 	'multi_process/client_server_mp/mp_server',
Signature · 1 line
2.28.0
Acked-by on v3 1/2
#14 lore raw

Re: [dpdk-dev] [PATCH v3 1/2] examples/l3fwd-regex: add regex based l3fwd

Hi Guy,

Quoted 9 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Sunday, October 18, 2020 3:04 PM
To: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v3 1/2] examples/l3fwd-regex: add regex based l3fwd

Quoted 7 lines

From: Guy Kaneti <[email protected]>

Add regex based l3fwd application
inline with normal l3fwd. only LPM is supported.

---

Best,
Ori

#15 lore raw

PATCH v3 2/2 doc: add l3fwd-regex application user guide

In reply to [email protected]

From: Guy Kaneti <[email protected]>

Adding the user guide for l3fwd regex application.

---
 MAINTAINERS                                   |   1 +
 doc/guides/rel_notes/release_20_11.rst        |   5 +
 doc/guides/sample_app_ug/index.rst            |   1 +
 doc/guides/sample_app_ug/intro.rst            |   4 +
 doc/guides/sample_app_ug/l3_forward_regex.rst | 235 ++++++++++++++++++
 5 files changed, 246 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/l3_forward_regex.rst
MAINTAINERS +1 -0
index 9880efa3a..3dcf9aa62 100644
@@ -433,6 +433,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti <[email protected]>
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob <[email protected]>
doc/guides/rel_notes/release_20_11.rst +5 -0
index 48717ee53..857645e88 100644
@@ -285,6 +285,11 @@ New Features
   * Added scatter gather support.
   * Added NIST GCMVS complaint GMAC test method support.
 
+* **Added new l3fwd-regex sample application.**
+
+  Added an example application ``l3fwd-regex``. This demonstrates the usage of
+  packet processing using DPDK Regex libraries.
+
 
 Removed Items
 -------------
doc/guides/sample_app_ug/index.rst +1 -0
index affa9c574..dc67580af 100644
@@ -32,6 +32,7 @@ Sample Applications User Guides
     l3_forward_graph
     l3_forward_power_man
     l3_forward_access_ctrl
+    l3_forward_regex
     link_status_intr
     server_node_efd
     service_cores
doc/guides/sample_app_ug/intro.rst +4 -0
index 8ff223b16..94070933b 100644
@@ -58,6 +58,10 @@ examples are highlighted below.
   forwarding Graph, or ``l3fwd_graph`` application does forwarding based on IPv4
   like a simple router with DPDK Graph framework.
 
+* :doc:`Network Layer 3 forwarding Regex<l3_forward_regex>`: The Network Layer3
+  forwarding Regex, or ``l3fwd-regex`` application does forwarding based on IPv4
+  like a simple router with DPDK Regex framework.
+
 * :doc:`Hardware packet copying<ioat>`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
doc/guides/sample_app_ug/l3_forward_regex.rst new file +235 -0

235 lines not on this page · raw message

Signature · 1 line
2.28.0
Acked-by on v3 2/2
#16 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: add l3fwd-regex application user guide

Hi Guy,

Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Sunday, October 18, 2020 3:04 PM
Subject: [PATCH v3 2/2] doc: add l3fwd-regex application user guide

From: Guy Kaneti <[email protected]>

Adding the user guide for l3fwd regex application.

---

Best,
Ori

#17 lore raw
In reply to [email protected]

18/10/2020 14:03, [email protected]:

Quoted 6 lines

From: Guy Kaneti <[email protected]>

The L3 Forwarding with Regex application is a simple example of packet processing using DPDK Regex framework.
The application performs L3 LPM based forwarding while using Regex framework for pre-filtering decision.

The techboard decision is a bit different of this l3fwd-regex:
"
- TB agreed to have an example application that exercises the regex device and network device as a separate application.
- The example shall be used for both Benchmark and functional verification of regex in the forwarding path.
- Based on the discussions, it is agreed that l3fwd might not be the real use case to consider as regex + network application
- Instead, TB recommends having the Deep packet inspection style application to showcase the regex + networking use case.
- Following is the simple DPI style application definition, which can be considered as a candidate, as an example of regex + network application
1) Create or import a rule database.
- Rule database will have an index as rule_id and pattern to search
2) Create or import rule_id to the action table
- Action could be -1 for the drop, 0 .. N for a specific port to forward upon the match
3) Enqueue all the packet from ethdev to regexdev
4) If there is a match, then do the action based on the table created in step 2 using struct rte_regexdev_match::rule_id
5) If there is no match, forward back to the source port
"

http://mails.dpdk.org/archives/dev/2020-November/191301.html

#18 lore raw
Quoted 24 lines · On Sun, 15 Nov 2020 15:07:37 +0100 Thomas Monjalon <[email protected]> wrote:

18/10/2020 14:03, [email protected]:

Quoted 6 lines

From: Guy Kaneti <[email protected]>

The L3 Forwarding with Regex application is a simple example of packet processing using DPDK Regex framework.
The application performs L3 LPM based forwarding while using Regex framework for pre-filtering decision.

The techboard decision is a bit different of this l3fwd-regex:
"
- TB agreed to have an example application that exercises the regex device and network device as a separate application.
- The example shall be used for both Benchmark and functional verification of regex in the forwarding path.
- Based on the discussions, it is agreed that l3fwd might not be the real use case to consider as regex + network application
- Instead, TB recommends having the Deep packet inspection style application to showcase the regex + networking use case.
- Following is the simple DPI style application definition, which can be considered as a candidate, as an example of regex + network application
1) Create or import a rule database.
- Rule database will have an index as rule_id and pattern to search
2) Create or import rule_id to the action table
- Action could be -1 for the drop, 0 .. N for a specific port to forward upon the match
3) Enqueue all the packet from ethdev to regexdev
4) If there is a match, then do the action based on the table created in step 2 using struct rte_regexdev_match::rule_id
5) If there is no match, forward back to the source port
"

Quoted 1 line

http://mails.dpdk.org/archives/dev/2020-November/191301.html

Marking original example as "Changes requested" Please resubmit example based on the above feedback.