[dpdk-dev] [PATCH v1] regex/octeontx2: fix global variable overflow

2021-01-03 Thread guyk
From: Guy Kaneti 

Sentinel was missing from pci_id_ree_table[] array initialization
which caused it to overflow.

Bugzilla ID: 603
Fixes: 4cd1c5fd9 ("regex/octeontx2: introduce REE driver")
Cc: sta...@dpdk.org

Signed-off-by: Guy Kaneti 
---
 drivers/regex/octeontx2/otx2_regexdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/regex/octeontx2/otx2_regexdev.c 
b/drivers/regex/octeontx2/otx2_regexdev.c
index 39eed7a20..b6e55853e 100644
--- a/drivers/regex/octeontx2/otx2_regexdev.c
+++ b/drivers/regex/octeontx2/otx2_regexdev.c
@@ -988,6 +988,9 @@ static struct rte_pci_id pci_id_ree_table[] = {
RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
PCI_DEVID_OCTEONTX2_RVU_REE_PF)
},
+   {
+   .vendor_id = 0,
+   }
 };
 
 static struct rte_pci_driver otx2_regexdev_pmd = {
-- 
2.28.0



[dpdk-dev] [PATCH v3 0/2] Add example l3fwd-regex

2020-10-18 Thread guyk
From: Guy Kaneti 

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

-- 
2.28.0



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

2020-10-18 Thread guyk
From: Guy Kaneti 

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

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index f7ecb5305..9880efa3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/examples/l3fwd-regex/l3fwd.h b/examples/l3fwd-regex/l3fwd.h
new file mode 100644
index 0..3fb3647bb
--- /dev/null
+++ b/examples/l3fwd-regex/l3fwd.h
@@ -0,0 +1,207 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3_FWD_H__
+#define __L3_FWD_H__
+
+#include 
+#include 
+
+#define DO_RFC_1812_CHECKS
+
+#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
+
+/*
+ * Configurable number of RX/TX ring descriptors
+ */
+#define RTE_TEST_RX_DESC_DEFAULT 1024
+#define RTE_TEST_TX_DESC_DEFAULT 1024
+
+#define MAX_PKT_BURST 32
+#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
+
+#define MEMPOOL_CACHE_SIZE 256
+#define MAX_RX_QUEUE_PER_LCORE 16
+
+/*
+ * Try to avoid TX buffering if we have at least MAX_TX_BURST packets to send.
+ */
+#defineMAX_TX_BURST  (MAX_PKT_BURST / 2)
+
+#define NB_SOCKETS8
+
+/* Configure how many packets ahead to prefetch, when reading packets */
+#define PREFETCH_OFFSET  3
+
+/* Used to mark destination port as 'invalid'. */
+#defineBAD_PORT ((uint16_t)-1)
+
+#define FWDSTEP4
+
+/* replace first 12B of the ethernet header. */
+#defineMASK_ETH 0x3f
+
+struct mbuf_table {
+   uint16_t len;
+   struct rte_mbuf *m_table[MAX_PKT_BURST];
+};
+
+struct lcore_rx_queue {
+   uint16_t port_id;
+   uint8_t queue_id;
+} __rte_cache_aligned;
+
+struct lcore_conf {
+   uint16_t n_rx_queue;
+   struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
+   uint8_t regex_dev_id;
+   uint16_t regex_qp_id;
+   uint16_t n_tx_port;
+   uint16_t tx_port_id[RTE_MAX_ETHPORTS];
+   uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+   struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
+   struct rte_mbuf **pkts_burst;
+   void *ipv4_lookup_struct;
+   void *ipv6_lookup_struct;
+} __rte_cache_aligned;
+
+extern volatile bool force_quit;
+
+/* ethernet addresses of ports */
+extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];
+extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
+
+/* mask of enabled ports */
+extern uint32_t enabled_port_mask;
+
+/* Used only in exact match mode. */
+extern int ipv6; /**< ipv6 is false by default. */
+extern uint32_t hash_entry_number;
+
+extern xmm_t val_eth[RTE_MAX_ETHPORTS];
+
+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
+
+/* Send burst of packets on an output interface */
+static inline int
+send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)
+{
+   struct rte_mbuf **m_table;
+   int ret;
+   uint16_t queueid;
+
+   queueid = qconf->tx_queue_id[port];
+   m_table = (struct rte_mbuf **)qconf->tx_mbufs[port].m_table;
+
+   ret = rte_eth_tx_burst(port, queueid, m_table, n);
+   if (unlikely(ret < n)) {
+   do {
+   rte_pktmbuf_free(m_table[ret]);
+   } while (++ret < n);
+   }
+
+   return 0;
+}
+
+/* Enqueue a single packet, and send burst if queue is filled */
+static inline int
+send_single_packet(struct lcore_conf *qconf,
+  struct rte_mbuf *m, uint16_t port)
+{
+   uint16_t len;
+
+   len = qconf->tx_mbufs[port].len;
+   qconf->tx_mbufs[port].m_table[len] = m;
+   len++;
+
+   /* enough pkts to be sent */
+   if (unlikely(len == MAX_PKT_BURST)) {
+   send_burst(qconf, MAX_PKT_BURST, port);
+   len = 0;
+   }
+
+   qconf->tx_mbufs[port].len = len;
+   return 0;
+}
+
+#ifdef DO_RFC_1812_CHECKS
+static inline int
+is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)
+{
+   /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2

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

2020-10-18 Thread guyk
From: Guy Kaneti 

Adding the user guide for l3fwd regex application.

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 9880efa3a..3dcf9aa62 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -433,6 +433,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti 
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/doc/guides/rel_notes/release_20_11.rst 
b/doc/guides/rel_notes/release_20_11.rst
index 48717ee53..857645e88 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index affa9c574..dc67580af 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -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
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index 8ff223b16..94070933b 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -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`: 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`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
diff --git a/doc/guides/sample_app_ug/l3_forward_regex.rst 
b/doc/guides/sample_app_ug/l3_forward_regex.rst
new file mode 100644
index 0..4e4265362
--- /dev/null
+++ b/doc/guides/sample_app_ug/l3_forward_regex.rst
@@ -0,0 +1,235 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(C) 2020 Marvell International Ltd.
+
+L3 Forwarding Regex Sample Application
+==
+
+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.
+
+Overview
+
+
+The application demonstrates the use of the Regex libraries in DPDK to 
implement packet forwarding.
+The initialization is very similar to those of the :doc:`l3_forward`.
+There is also additional initialization of Regex device and configuration per 
lcore.
+The main difference from the L3 Forwarding sample application is that this 
application introduces
+Regex based pre-filtering decision done before LPM lookup.
+Thus, packet can be dropped or flagged before the forwarding decision.
+
+In the sample application, only IPv4 forwarding is supported as of now.
+
+Compiling the Application
+-
+
+To compile the sample application see :doc:`compiling`.
+
+The application is located in the ``l3fwd-regex`` sub-directory.
+
+Running the Application
+---
+
+The application has a number of command line options similar to l3fwd::
+
+./l3fwd-regex [EAL options] -- -p PORTMASK
+   [-P]
+   --config 
(port,queue,lcore,regex-dev,regex-q)[,(port,queue,lcore,regex-dev,regex-q)]
+   [--regex-rule-db-file FILENAME
+   [--regex-drop]
+   [--eth-dest=X,MM:MM:MM:MM:MM:MM]
+   [--enable-jumbo [--max-pkt-len PKTLEN]]
+   [--no-numa]
+   [--parse-ptype]
+   [--per-port-pool]
+   [--regex-drop]
+   [--regex-debug]
+
+Where,
+
+* ``-p PORTMASK:`` Hexadecimal bitmask of ports to configure
+
+* ``-P:`` Optional, sets all ports to promiscuous mode so that packets are 

[dpdk-dev] [PATCH] app/regex: change default qp configuration flags

2020-10-19 Thread guyk
From: Guy Kaneti 

added --cfg_oos argument to config queue
pair out of order scan

Signed-off-by: Guy Kaneti 
---
 app/test-regex/main.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 0d35f4583..9b19031ea 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -33,6 +33,7 @@ enum app_args {
ARG_NUM_OF_JOBS,
ARG_PERF_MODE,
ARG_NUM_OF_ITERATIONS,
+   ARG_CFG_OOS,
 };
 
 static void
@@ -43,13 +44,15 @@ usage(const char *prog_name)
" --data NAME: data file to use\n"
" --nb_jobs: number of jobs to use\n"
" --perf N: only outputs the performance data\n"
-   " --nb_iter N: number of iteration to run\n",
+   " --nb_iter N: number of iteration to run\n"
+   " --cfg_oos: configure regexdev queue flag out of order scan\n",
prog_name);
 }
 
 static void
 args_parse(int argc, char **argv, char *rules_file, char *data_file,
-  uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations)
+  uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations,
+  uint32_t *qp_conf_flags)
 {
char **argvopt;
int opt;
@@ -66,7 +69,9 @@ args_parse(int argc, char **argv, char *rules_file, char 
*data_file,
/* Perf test only */
{ "perf", 0, 0, ARG_PERF_MODE},
/* Number of iterations to run with perf test */
-   { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS}
+   { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS},
+   /* configure out of order scan */
+   { "cfg_oos", 0, 0, ARG_CFG_OOS}
};
 
argvopt = argv;
@@ -98,6 +103,9 @@ args_parse(int argc, char **argv, char *rules_file, char 
*data_file,
case ARG_NUM_OF_ITERATIONS:
*nb_iterations = atoi(optarg);
break;
+   case ARG_CFG_OOS:
+   *qp_conf_flags = RTE_REGEX_QUEUE_PAIR_CFG_OOS_F;
+   break;
case ARG_HELP:
usage("RegEx test app");
break;
@@ -158,7 +166,8 @@ read_file(char *file, char **buf)
 
 static int
 init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
- uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches)
+ uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches,
+ uint32_t qp_conf_flags)
 {
uint16_t id;
uint16_t num_devs;
@@ -171,7 +180,7 @@ init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
};
struct rte_regexdev_qp_conf qp_conf = {
.nb_desc = 1024,
-   .qp_conf_flags = RTE_REGEX_QUEUE_PAIR_CFG_OOS_F,
+   .qp_conf_flags = qp_conf_flags,
};
int res = 0;
 
@@ -407,6 +416,7 @@ main(int argc, char **argv)
bool perf_mode = 0;
uint32_t nb_iterations = 0;
uint8_t nb_max_matches = 0;
+   uint32_t qp_conf_flags = 0;
int ret;
 
ret = rte_eal_init(argc, argv);
@@ -416,10 +426,10 @@ main(int argc, char **argv)
argv += ret;
if (argc > 1)
args_parse(argc, argv, rules_file, data_file, &nb_jobs,
-  &perf_mode, &nb_iterations);
+  &perf_mode, &nb_iterations, &qp_conf_flags);
 
ret = init_port(&mbuf_mp, nb_jobs, &nb_max_payload, rules_file,
-   &nb_max_matches);
+   &nb_max_matches, qp_conf_flags);
if (ret < 0)
rte_exit(EXIT_FAILURE, "init port failed\n");
ret = run_regex(mbuf_mp, nb_jobs, nb_max_payload, perf_mode,
-- 
2.28.0



[dpdk-dev] [PATCH v1] app/regex: change default qp configuration flags

2020-10-19 Thread guyk
From: Guy Kaneti 

By default qp configuration flags was set with
RTE_REGEX_QUEUE_PAIR_CFG_OOS_F.
Changed flags default to 0. In order to set OOS flag use
new argument --cfg_oos to config queue pair out of order scan.

Signed-off-by: Guy Kaneti 
---
 app/test-regex/main.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 0d35f4583..9b19031ea 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -33,6 +33,7 @@ enum app_args {
ARG_NUM_OF_JOBS,
ARG_PERF_MODE,
ARG_NUM_OF_ITERATIONS,
+   ARG_CFG_OOS,
 };
 
 static void
@@ -43,13 +44,15 @@ usage(const char *prog_name)
" --data NAME: data file to use\n"
" --nb_jobs: number of jobs to use\n"
" --perf N: only outputs the performance data\n"
-   " --nb_iter N: number of iteration to run\n",
+   " --nb_iter N: number of iteration to run\n"
+   " --cfg_oos: configure regexdev queue flag out of order scan\n",
prog_name);
 }
 
 static void
 args_parse(int argc, char **argv, char *rules_file, char *data_file,
-  uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations)
+  uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations,
+  uint32_t *qp_conf_flags)
 {
char **argvopt;
int opt;
@@ -66,7 +69,9 @@ args_parse(int argc, char **argv, char *rules_file, char 
*data_file,
/* Perf test only */
{ "perf", 0, 0, ARG_PERF_MODE},
/* Number of iterations to run with perf test */
-   { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS}
+   { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS},
+   /* configure out of order scan */
+   { "cfg_oos", 0, 0, ARG_CFG_OOS}
};
 
argvopt = argv;
@@ -98,6 +103,9 @@ args_parse(int argc, char **argv, char *rules_file, char 
*data_file,
case ARG_NUM_OF_ITERATIONS:
*nb_iterations = atoi(optarg);
break;
+   case ARG_CFG_OOS:
+   *qp_conf_flags = RTE_REGEX_QUEUE_PAIR_CFG_OOS_F;
+   break;
case ARG_HELP:
usage("RegEx test app");
break;
@@ -158,7 +166,8 @@ read_file(char *file, char **buf)
 
 static int
 init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
- uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches)
+ uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches,
+ uint32_t qp_conf_flags)
 {
uint16_t id;
uint16_t num_devs;
@@ -171,7 +180,7 @@ init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
};
struct rte_regexdev_qp_conf qp_conf = {
.nb_desc = 1024,
-   .qp_conf_flags = RTE_REGEX_QUEUE_PAIR_CFG_OOS_F,
+   .qp_conf_flags = qp_conf_flags,
};
int res = 0;
 
@@ -407,6 +416,7 @@ main(int argc, char **argv)
bool perf_mode = 0;
uint32_t nb_iterations = 0;
uint8_t nb_max_matches = 0;
+   uint32_t qp_conf_flags = 0;
int ret;
 
ret = rte_eal_init(argc, argv);
@@ -416,10 +426,10 @@ main(int argc, char **argv)
argv += ret;
if (argc > 1)
args_parse(argc, argv, rules_file, data_file, &nb_jobs,
-  &perf_mode, &nb_iterations);
+  &perf_mode, &nb_iterations, &qp_conf_flags);
 
ret = init_port(&mbuf_mp, nb_jobs, &nb_max_payload, rules_file,
-   &nb_max_matches);
+   &nb_max_matches, qp_conf_flags);
if (ret < 0)
rte_exit(EXIT_FAILURE, "init port failed\n");
ret = run_regex(mbuf_mp, nb_jobs, nb_max_payload, perf_mode,
-- 
2.28.0



[dpdk-dev] [PATCH v1] regexdev: add OOS capability definition

2020-10-20 Thread guyk
From: Guy Kaneti 

Add out of order scan capability to check PMD
support for OOS.

Signed-off-by: Guy Kaneti 
---
 lib/librte_regexdev/rte_regexdev.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_regexdev/rte_regexdev.h 
b/lib/librte_regexdev/rte_regexdev.h
index 4077e62c9..60cccf816 100644
--- a/lib/librte_regexdev/rte_regexdev.h
+++ b/lib/librte_regexdev/rte_regexdev.h
@@ -474,6 +474,14 @@ rte_regexdev_get_dev_id(const char *name);
  * @see RTE_REGEXDEV_CFG_MATCH_ALL_F
  */
 
+#define RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F (1ULL << 22)
+/**< RegEx device support out of order scan, this means the scan can be retired
+ * as soon as device returns completion.
+ *
+ * @see RTE_REGEX_QUEUE_PAIR_CFG_OOS_F
+ * @see struct rte_regexdev_info::regexdev_capa
+ */
+
 /* Enumerates PCRE rule flags */
 #define RTE_REGEX_PCRE_RULE_ALLOW_EMPTY_F (1ULL << 0)
 /**< When this flag is set, the pattern that can match against an empty string,
-- 
2.28.0



[dpdk-dev] [PATCH v1] app/regex: configure qp according to device capabilities

2020-10-20 Thread guyk
From: Guy Kaneti 

configure qp with OOS according to device capabilities
returned from rte_regexdev_info_get.

Signed-off-by: Guy Kaneti 
---
 app/test-regex/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index e6080b44b..3deaf3c80 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -173,7 +173,7 @@ init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
};
struct rte_regexdev_qp_conf qp_conf = {
.nb_desc = 1024,
-   .qp_conf_flags = RTE_REGEX_QUEUE_PAIR_CFG_OOS_F,
+   .qp_conf_flags = 0,
};
int res = 0;
 
@@ -218,6 +218,8 @@ init_port(struct rte_mempool **mbuf_mp, uint32_t nb_jobs,
printf("Error, can't configure device %d.\n", id);
goto error;
}
+   if (info.regexdev_capa & RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F)
+   qp_conf.qp_conf_flags |= RTE_REGEX_QUEUE_PAIR_CFG_OOS_F;
res = rte_regexdev_queue_pair_setup(id, 0, &qp_conf);
if (res < 0) {
printf("Error, can't setup queue pair for device %d.\n",
-- 
2.28.0



[dpdk-dev] [PATCH v2] regexdev: add OOS capability definition

2020-10-21 Thread guyk
From: Guy Kaneti 

Add out of order scan capability to check PMD
support for OOS.

Signed-off-by: Guy Kaneti 
---
v2 - fix definition comment
---
 lib/librte_regexdev/rte_regexdev.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_regexdev/rte_regexdev.h 
b/lib/librte_regexdev/rte_regexdev.h
index 4077e62c9..000165892 100644
--- a/lib/librte_regexdev/rte_regexdev.h
+++ b/lib/librte_regexdev/rte_regexdev.h
@@ -474,6 +474,15 @@ rte_regexdev_get_dev_id(const char *name);
  * @see RTE_REGEXDEV_CFG_MATCH_ALL_F
  */
 
+#define RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F (1ULL << 22)
+/**< RegEx device supports out of order scan.
+ * Out of order scan means the response of a specific job can be returned as
+ * soon as it is ready even if previous jobs on the same queue didn't complete.
+ *
+ * @see RTE_REGEX_QUEUE_PAIR_CFG_OOS_F
+ * @see struct rte_regexdev_info::regexdev_capa
+ */
+
 /* Enumerates PCRE rule flags */
 #define RTE_REGEX_PCRE_RULE_ALLOW_EMPTY_F (1ULL << 0)
 /**< When this flag is set, the pattern that can match against an empty string,
-- 
2.28.0



[dpdk-dev] [PATCH v1] app/regex: add job context

2020-10-22 Thread guyk
From: Guy Kaneti 

Store mbuf pointer associated with that job.

Signed-off-by: Guy Kaneti 
---
 app/test-regex/main.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index e6080b44b..f869d754b 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -35,6 +35,10 @@ enum app_args {
ARG_NUM_OF_ITERATIONS,
 };
 
+struct job_ctx {
+   struct rte_mbuf *mbuf;
+};
+
 static void
 usage(const char *prog_name)
 {
@@ -266,6 +270,7 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs,
time_t start;
time_t end;
double time;
+   struct job_ctx *jobs_ctx;
 
shinfo.free_cb = extbuf_free_cb;
 
@@ -275,6 +280,12 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs,
return -ENOMEM;
}
 
+   jobs_ctx = rte_malloc(NULL, sizeof(struct job_ctx)*nb_jobs, 0);
+   if (!jobs_ctx) {
+   printf("Error, can't allocate memory for jobs_ctx.\n");
+   return -ENOMEM;
+   }
+
/* Allocate the jobs and assign each job with an mbuf. */
for (i = 0; i < nb_jobs; i++) {
ops[i] = rte_malloc(NULL, sizeof(*ops[0]) + nb_max_matches *
@@ -317,6 +328,7 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs,
long act_job_len = RTE_MIN(job_len, buf_len - pos);
rte_pktmbuf_attach_extbuf(ops[i]->mbuf, &buf[pos], 0,
  act_job_len, &shinfo);
+   jobs_ctx[i].mbuf = ops[i]->mbuf;
ops[i]->mbuf->data_len = job_len;
ops[i]->mbuf->pkt_len = act_job_len;
ops[i]->user_id = i;
@@ -386,13 +398,13 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs,
}
 end:
for (i = 0; i < actual_jobs; i++) {
-   if (ops[i]) {
-   if (ops[i]->mbuf)
-   rte_pktmbuf_free(ops[i]->mbuf);
+   if (ops[i])
rte_free(ops[i]);
-   }
+   if (jobs_ctx[i].mbuf)
+   rte_pktmbuf_free(jobs_ctx[i].mbuf);
}
rte_free(ops);
+   rte_free(jobs_ctx);
if (buf)
rte_free(buf);
return res;
-- 
2.28.0



[dpdk-dev] [PATCH v2 0/4] Add Marvell OCTEON TX2 regex driver

2020-10-12 Thread guyk
From: Guy Kaneti 

This patchset adds support for OCTEON TX2 regex driver as DPDK regexdev.
The driver implements the API defined in the regexdev lib.

v2:
* Rebase.
* Remove config/common_base from patch
* change rte_cio_wmb to rte_io_wmb

Guy Kaneti (4):
  common/octeontx2: add REE definitions and logging support
  regex/octeontx2: add build infra and device support
  usertools: add octeontx2 REE device binding
  doc: add Marvell OCTEON TX2 regex guide

 MAINTAINERS   |3 +
 doc/guides/platform/octeontx2.rst |5 +
 doc/guides/regexdevs/features/octeontx2.ini   |   10 +
 doc/guides/regexdevs/index.rst|1 +
 doc/guides/regexdevs/octeontx2.rst|   49 +
 doc/guides/rel_notes/release_20_11.rst|5 +
 drivers/common/octeontx2/hw/otx2_ree.h|   27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|5 +
 drivers/common/octeontx2/otx2_common.c|1 +
 drivers/common/octeontx2/otx2_common.h|5 +
 drivers/common/octeontx2/otx2_mbox.h  |  103 ++
 .../rte_common_octeontx2_version.map  |1 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   53 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1002 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 meson_options.txt |2 +
 usertools/dpdk-devbind.py |8 +
 25 files changed, 2441 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

-- 
2.28.0



[dpdk-dev] [PATCH v2 3/4] usertools: add octeontx2 REE device binding

2020-10-12 Thread guyk
From: Guy Kaneti 

Update the devbind script with new section of regex devices, also
added OCTEONTX2 REE device ID to regex device list

Signed-off-by: Guy Kaneti 
---
 usertools/dpdk-devbind.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 1d1113a08..cb2fc6009 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -41,6 +41,8 @@
   'SVendor': None, 'SDevice': None}
 octeontx2_dma = {'Class': '08', 'Vendor': '177d', 'Device': 'a081',
   'SVendor': None, 'SDevice': None}
+octeontx2_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
+  'SVendor': None, 'SDevice': None}
 
 intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': 
'6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
   'SVendor': None, 'SDevice': None}
@@ -64,6 +66,7 @@
 misc_devices = [intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_idxd_spr,
 intel_ntb_skx, intel_ntb_icx,
 octeontx2_dma]
+regex_devices = [octeontx2_ree]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -650,6 +653,9 @@ def show_status():
 if status_dev == "misc" or status_dev == "all":
 show_device_status(misc_devices, "Misc (rawdev)")
 
+if status_dev == "regex" or status_dev == "all":
+show_device_status(regex_devices, "Regex")
+
 
 def pci_glob(arg):
 '''Returns a list containing either:
@@ -743,6 +749,7 @@ def do_arg_actions():
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
 get_device_details(misc_devices)
+get_device_details(regex_devices)
 show_status()
 
 
@@ -764,6 +771,7 @@ def main():
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
 get_device_details(misc_devices)
+get_device_details(regex_devices)
 do_arg_actions()
 
 if __name__ == "__main__":
-- 
2.28.0



[dpdk-dev] [PATCH v2 2/4] regex/octeontx2: add build infra and device support

2020-10-12 Thread guyk
From: Guy Kaneti 

Add meson based build infrastructure along with the
OTX2 regexdev (REE) device functions.

For regex rule compiler support build:
meson configure -Dree_compiler_sdk=

Signed-off-by: Guy Kaneti 
---
 MAINTAINERS   |3 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   53 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1002 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 meson_options.txt |2 +
 13 files changed, 2221 insertions(+), 1 deletion(-)
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 2a18262d6..631893bb2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1118,6 +1118,9 @@ F: drivers/regex/mlx5/
 F: doc/guides/regexdevs/mlx5.rst
 F: doc/guides/regexdevs/features/mlx5.ini
 
+Marvell OCTEON TX2 regex
+M: Guy Kaneti 
+F: drivers/regex/octeontx2/
 
 vDPA Drivers
 
diff --git a/drivers/regex/meson.build b/drivers/regex/meson.build
index 8edeba3a0..79bb5d5df 100644
--- a/drivers/regex/meson.build
+++ b/drivers/regex/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2020 Mellanox Technologies, Ltd
 
-drivers = ['mlx5']
+drivers = ['mlx5', 'octeontx2']
 std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
 driver_name_fmt = 'rte_pmd_@0@'
diff --git a/drivers/regex/octeontx2/meson.build 
b/drivers/regex/octeontx2/meson.build
new file mode 100644
index 0..c212e3d43
--- /dev/null
+++ b/drivers/regex/octeontx2/meson.build
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell International Ltd.
+#
+
+if not is_linux
+   build = false
+   reason = 'only supported on Linux'
+endif
+
+path = get_option('ree_compiler_sdk')
+lib_dir = path + '/lib'
+inc_dir = path + '/include'
+
+if dpdk_conf.has('RTE_LIBRTE_PMD_OCTEONTX2_REGEX_COMPILER')
+   lib = cc.find_library('librxp_compiler', dirs : [lib_dir], required: 
false)
+   if not lib.found()
+   build = false
+   reason = 'missing dependency, "librxp_compiler"'
+   else
+   ext_deps += lib
+   ext_deps += cc.find_library('libstdc++', required: true)
+   includes += include_directories(inc_dir)
+   cflags += ['-DREE_COMPILER_SDK']
+   endif
+endif
+
+sources = files('otx2_regexdev.c',
+   'otx2_regexdev_hw_access.c',
+   'otx2_regexdev_mbox.c',
+   'otx2_regexdev_compiler.c'
+   )
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit 
warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+   extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
+if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
+   ext_deps += cc.find_library('atomic')
+endif
+
+foreach flag: extra_flags
+   if cc.has_argument(flag)
+   cflags += flag
+   endif
+endforeach
+
+name = 'octeontx2_regex'
+deps += ['bus_pci', 'common_octeontx2', 'regexdev']
+
+includes += include_directories('../../common/octeontx2')
diff --git a/drivers/regex/octeontx2/otx2_regexdev.c 
b/drivers/regex/octeontx2/otx2_regexdev.c
new file mode 100644
index 0..39eed7a20
--- /dev/null
+++ b/drivers/regex/octeontx2/otx2_regexdev.c
@@ -0,0 +1,1002 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+/* REE common headers */
+#include "otx2_common.h"
+#include "otx2_dev.h"
+#include "otx2_regexdev.h"
+#include "otx2_regexdev_compiler.h"
+#include "otx2_regexdev_hw_access.h"
+#include "otx2_regexdev_mbox.h"
+
+
+/* HW matc

[dpdk-dev] [PATCH v2 1/4] common/octeontx2: add REE definitions and logging support

2020-10-12 Thread guyk
From: Guy Kaneti 

Add REE mbox msg definitions, RVU and REE HW definitions

Signed-off-by: Guy Kaneti 
---
 drivers/common/octeontx2/hw/otx2_ree.h|  27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|   5 +
 drivers/common/octeontx2/otx2_common.c|   1 +
 drivers/common/octeontx2/otx2_common.h|   5 +
 drivers/common/octeontx2/otx2_mbox.h  | 103 ++
 .../rte_common_octeontx2_version.map  |   1 +
 6 files changed, 142 insertions(+)
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h

diff --git a/drivers/common/octeontx2/hw/otx2_ree.h 
b/drivers/common/octeontx2/hw/otx2_ree.h
new file mode 100644
index 0..b7481f125
--- /dev/null
+++ b/drivers/common/octeontx2/hw/otx2_ree.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_REE_HW_H__
+#define __OTX2_REE_HW_H__
+
+/* REE BAR0*/
+#define REE_AF_REEXM_MAX_MATCH (0x80c8)
+
+/* REE BAR02 */
+#define REE_LF_MISC_INT (0x300)
+#define REE_LF_DONE_INT (0x120)
+
+#define REE_AF_QUEX_GMCTL(a)(0x800 | (a) << 3)
+
+#define REE_AF_INT_VEC_RAS  (0x0ull)
+#define REE_AF_INT_VEC_RVU  (0x1ull)
+#define REE_AF_INT_VEC_QUE_DONE (0x2ull)
+#define REE_AF_INT_VEC_AQ   (0x3ull)
+
+/* ENUMS */
+
+#define REE_LF_INT_VEC_QUE_DONE(0x0ull)
+#define REE_LF_INT_VEC_MISC(0x1ull)
+
+#endif /* __OTX2_REE_HW_H__*/
diff --git a/drivers/common/octeontx2/hw/otx2_rvu.h 
b/drivers/common/octeontx2/hw/otx2_rvu.h
index 330bfb37f..072515207 100644
--- a/drivers/common/octeontx2/hw/otx2_rvu.h
+++ b/drivers/common/octeontx2/hw/otx2_rvu.h
@@ -130,6 +130,7 @@
 #define RVU_BLOCK_TYPE_RAD  (0xdull)
 #define RVU_BLOCK_TYPE_DFA  (0xeull)
 #define RVU_BLOCK_TYPE_HNA  (0xfull)
+#define RVU_BLOCK_TYPE_REE  (0xeull)
 
 #define RVU_BLOCK_ADDR_RVUM (0x0ull)
 #define RVU_BLOCK_ADDR_LMT  (0x1ull)
@@ -146,6 +147,8 @@
 #define RVU_BLOCK_ADDR_NDC2 (0xeull)
 #define RVU_BLOCK_ADDR_R_END(0x1full)
 #define RVU_BLOCK_ADDR_R_START  (0x14ull)
+#define RVU_BLOCK_ADDR_REE0 (0x14ull)
+#define RVU_BLOCK_ADDR_REE1 (0x15ull)
 
 #define RVU_VF_INT_VEC_MBOX (0x0ull)
 
@@ -167,6 +170,7 @@
 #define NPA_AF_BAR2_SEL(0x900ull)
 #define CPT_AF_BAR2_SEL(0x900ull)
 #define RVU_AF_BAR2_SEL(0x900ull)
+#define REE_AF_BAR2_SEL(0x900ull)
 
 #define AF_BAR2_ALIASX(a, b) \
(0x910ull | (uint64_t)(a) << 12 | (uint64_t)(b))
@@ -177,6 +181,7 @@
 #define NPA_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(0, b)
 #define CPT_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 #define RVU_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
+#define REE_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 
 /* Structures definitions */
 
diff --git a/drivers/common/octeontx2/otx2_common.c 
b/drivers/common/octeontx2/otx2_common.c
index b292e999a..d23c50242 100644
--- a/drivers/common/octeontx2/otx2_common.c
+++ b/drivers/common/octeontx2/otx2_common.c
@@ -213,3 +213,4 @@ RTE_LOG_REGISTER(otx2_logtype_sso, pmd.event.octeontx2, 
NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_tim, pmd.event.octeontx2.timer, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_dpi, pmd.raw.octeontx2.dpi, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_ep, pmd.raw.octeontx2.ep, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_ree, pmd.regex.octeontx2, NOTICE);
diff --git a/drivers/common/octeontx2/otx2_common.h 
b/drivers/common/octeontx2/otx2_common.h
index 2168cde4d..b6779f710 100644
--- a/drivers/common/octeontx2/otx2_common.h
+++ b/drivers/common/octeontx2/otx2_common.h
@@ -21,6 +21,7 @@
 #include "hw/otx2_sso.h"
 #include "hw/otx2_ssow.h"
 #include "hw/otx2_tim.h"
+#include "hw/otx2_ree.h"
 
 /* Alignment */
 #define OTX2_ALIGN  128
@@ -96,6 +97,7 @@ extern int otx2_logtype_tm;
 extern int otx2_logtype_tim;
 extern int otx2_logtype_dpi;
 extern int otx2_logtype_ep;
+extern int otx2_logtype_ree;
 
 #define otx2_err(fmt, args...) \
RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",  \
@@ -119,6 +121,7 @@ extern int otx2_logtype_ep;
 #define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
 #define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
 #define otx2_sdp_dbg(fmt, ...) otx2_dbg(ep, fmt, ##__VA_ARGS__)
+#define otx2_ree_dbg(fmt, ...) otx2_dbg(ree, fmt, ##__VA_ARGS__)
 
 /* PCI IDs */
 #define PCI_VENDOR_ID_CAVIUM   0x177D
@@ -136,6 +139,8 @@ extern int otx2_logtype_ep;
 #define PCI_DEVID_OCTEONTX2_EP_VF  0xB203 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF 0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF 0xA0f7
+#define PCI_DEVID_OCTEONTX2_RVU

[dpdk-dev] [PATCH v2 4/4] doc: add Marvell OCTEON TX2 regex guide

2020-10-12 Thread guyk
From: Guy Kaneti 

Added Marvell OCTEON TX2 regex guide, features
and updated release notes.

Signed-off-by: Guy Kaneti 
---
 doc/guides/platform/octeontx2.rst   |  5 +++
 doc/guides/regexdevs/features/octeontx2.ini | 10 +
 doc/guides/regexdevs/index.rst  |  1 +
 doc/guides/regexdevs/octeontx2.rst  | 49 +
 doc/guides/rel_notes/release_20_11.rst  |  5 +++
 5 files changed, 70 insertions(+)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst

diff --git a/doc/guides/platform/octeontx2.rst 
b/doc/guides/platform/octeontx2.rst
index 13255eec5..c4d64ab4b 100644
--- a/doc/guides/platform/octeontx2.rst
+++ b/doc/guides/platform/octeontx2.rst
@@ -67,6 +67,8 @@ DPDK subsystem.
+---+-+--+
| 9 | SDP | rte_ethdev   |
+---+-+--+
+   | 10| REE | rte_regexdev |
+   +---+-+--+
 
 PF0 is called the administrative / admin function (AF) and has exclusive
 privileges to provision RVU functional block's LFs to each of the PF/VF.
@@ -156,6 +158,9 @@ This section lists dataplane H/W block(s) available in 
OCTEON TX2 SoC.
 #. **Crypto Device Driver**
See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
 
+#. **Regex Device Driver**
+   See :doc:`../regexdevs/octeontx2` for REE regex device driver information.
+
 Procedure to Setup Platform
 ---
 
diff --git a/doc/guides/regexdevs/features/octeontx2.ini 
b/doc/guides/regexdevs/features/octeontx2.ini
new file mode 100644
index 0..c9b421a16
--- /dev/null
+++ b/doc/guides/regexdevs/features/octeontx2.ini
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx2' regex driver.
+;
+; Refer to default.ini for the full list of available driver features.
+;
+[Features]
+PCRE back reference = Y
+PCRE word boundary  = Y
+Run time compilation= Y
+Armv8   = Y
diff --git a/doc/guides/regexdevs/index.rst b/doc/guides/regexdevs/index.rst
index 49216a932..b1abc826b 100644
--- a/doc/guides/regexdevs/index.rst
+++ b/doc/guides/regexdevs/index.rst
@@ -13,3 +13,4 @@ which can be used from an application through RegEx API.
 
features_overview
mlx5
+   octeontx2
diff --git a/doc/guides/regexdevs/octeontx2.rst 
b/doc/guides/regexdevs/octeontx2.rst
new file mode 100644
index 0..859780da1
--- /dev/null
+++ b/doc/guides/regexdevs/octeontx2.rst
@@ -0,0 +1,49 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2020 Marvell International Ltd.
+
+OCTEON TX2 REE Regexdev Driver
+===
+
+The OCTEON TX2 REE PMD (**librte_pmd_octeontx2_regex**) provides poll mode
+regexdev driver support for the inbuilt regex device found in the **Marvell 
OCTEON TX2**
+SoC family.
+
+More information about OCTEON TX2 SoC can be found at `Marvell Official Website
+`_.
+
+Features
+
+
+Features of the OCTEON TX2 REE PMD are:
+
+- 36 queues
+- Up to 254 matches for each regex operation
+
+Prerequisites and Compilation procedure
+---
+
+   See :doc:`../platform/octeontx2` for setup information.
+
+Device Setup
+
+
+The OCTEON TX2 REE devices will need to be bound to a user-space IO driver
+for use. The script ``dpdk-devbind.py`` script included with DPDK can be
+used to view the state of the devices and to bind them to a suitable
+DPDK-supported kernel driver. When querying the status of the devices,
+they will appear under the category of "REGEX devices", i.e. the command
+``dpdk-devbind.py --status-dev regex`` can be used to see the state of
+those devices alone.
+
+Debugging Options
+-
+
+.. _table_octeontx2_regex_debug_options:
+
+.. table:: OCTEON TX2 regex device debug options
+
+   +---++---+
+   | # | Component  | EAL log command   |
+   +===++===+
+   | 1 | REE| --log-level='pmd\.regex\.octeontx2,8' |
+   +---++---+
diff --git a/doc/guides/rel_notes/release_20_11.rst 
b/doc/guides/rel_notes/release_20_11.rst
index 57e3edcdd..90b32936f 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -148,6 +148,11 @@ New Features
   * Extern objects and functions can be plugged into the pipeline.
   * Transaction-oriented table updates.
 
+* **Added Marvell OCTEON TX2 regex PMD.**
+
+  Added a new PMD driver for hardware regex off

[dpdk-dev] [PATCH v3 0/3] Add Marvell OCTEON TX2 regex driver

2020-10-13 Thread guyk
From: Guy Kaneti 

This patchset adds support for OCTEON TX2 regex driver as DPDK regexdev.
The driver implements the API defined in the regexdev lib.

v3:
* Fix ML comments.
 
v2:
* Rebase.
* Remove config/common_base from patch
* change rte_cio_wmb to rte_io_wmb

Guy Kaneti (3):
  common/octeontx2: add REE definitions and logging support
  regex/octeontx2: add build infra and device support
  usertools: add octeontx2 REE device binding

 MAINTAINERS   |4 +
 doc/guides/platform/octeontx2.rst |5 +
 doc/guides/regexdevs/features/octeontx2.ini   |   10 +
 doc/guides/regexdevs/index.rst|1 +
 doc/guides/regexdevs/octeontx2.rst|   49 +
 doc/guides/rel_notes/release_20_11.rst|5 +
 drivers/common/octeontx2/hw/otx2_ree.h|   27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|5 +
 drivers/common/octeontx2/otx2_common.c|1 +
 drivers/common/octeontx2/otx2_common.h|5 +
 drivers/common/octeontx2/otx2_mbox.h  |  103 ++
 .../rte_common_octeontx2_version.map  |1 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   44 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1002 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 usertools/dpdk-devbind.py |8 +
 24 files changed, 2431 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

-- 
2.28.0



[dpdk-dev] [PATCH v3 2/3] regex/octeontx2: add build infra and device support

2020-10-13 Thread guyk
From: Guy Kaneti 

Add meson based build infrastructure along with the
OTX2 regexdev (REE) device functions.
Add Marvell OCTEON TX2 regex guide.

Signed-off-by: Guy Kaneti 
---
 MAINTAINERS   |4 +
 doc/guides/platform/octeontx2.rst |5 +
 doc/guides/regexdevs/features/octeontx2.ini   |   10 +
 doc/guides/regexdevs/index.rst|1 +
 doc/guides/regexdevs/octeontx2.rst|   38 +
 doc/guides/rel_notes/release_20_11.rst|5 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   44 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1002 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 17 files changed, 2270 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 2a18262d6..44c7cc82a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1112,6 +1112,10 @@ F: doc/guides/compressdevs/features/zlib.ini
 RegEx Drivers
 -
 
+Marvell OCTEON TX2 regex
+M: Guy Kaneti 
+F: drivers/regex/octeontx2/
+
 Mellanox mlx5
 M: Ori Kam 
 F: drivers/regex/mlx5/
diff --git a/doc/guides/platform/octeontx2.rst 
b/doc/guides/platform/octeontx2.rst
index 13255eec5..c4d64ab4b 100644
--- a/doc/guides/platform/octeontx2.rst
+++ b/doc/guides/platform/octeontx2.rst
@@ -67,6 +67,8 @@ DPDK subsystem.
+---+-+--+
| 9 | SDP | rte_ethdev   |
+---+-+--+
+   | 10| REE | rte_regexdev |
+   +---+-+--+
 
 PF0 is called the administrative / admin function (AF) and has exclusive
 privileges to provision RVU functional block's LFs to each of the PF/VF.
@@ -156,6 +158,9 @@ This section lists dataplane H/W block(s) available in 
OCTEON TX2 SoC.
 #. **Crypto Device Driver**
See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
 
+#. **Regex Device Driver**
+   See :doc:`../regexdevs/octeontx2` for REE regex device driver information.
+
 Procedure to Setup Platform
 ---
 
diff --git a/doc/guides/regexdevs/features/octeontx2.ini 
b/doc/guides/regexdevs/features/octeontx2.ini
new file mode 100644
index 0..c9b421a16
--- /dev/null
+++ b/doc/guides/regexdevs/features/octeontx2.ini
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx2' regex driver.
+;
+; Refer to default.ini for the full list of available driver features.
+;
+[Features]
+PCRE back reference = Y
+PCRE word boundary  = Y
+Run time compilation= Y
+Armv8   = Y
diff --git a/doc/guides/regexdevs/index.rst b/doc/guides/regexdevs/index.rst
index 49216a932..b1abc826b 100644
--- a/doc/guides/regexdevs/index.rst
+++ b/doc/guides/regexdevs/index.rst
@@ -13,3 +13,4 @@ which can be used from an application through RegEx API.
 
features_overview
mlx5
+   octeontx2
diff --git a/doc/guides/regexdevs/octeontx2.rst 
b/doc/guides/regexdevs/octeontx2.rst
new file mode 100644
index 0..87659b661
--- /dev/null
+++ b/doc/guides/regexdevs/octeontx2.rst
@@ -0,0 +1,38 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2020 Marvell International Ltd.
+
+OCTEON TX2 REE Regexdev Driver
+===
+
+The OCTEON TX2 REE PMD (**librte_pmd_octeontx2_regex**) provides poll mode
+regexdev driver support for the inbuilt regex device found in the **Marvell 
OCTEON TX2**
+SoC family.
+
+More information about OCTEON TX2 SoC can be found at `Marvell Official Website
+

[dpdk-dev] [PATCH v3 3/3] usertools: add octeontx2 REE device binding

2020-10-13 Thread guyk
From: Guy Kaneti 

Update the devbind script with new section of regex devices, also
added OCTEONTX2 REE device ID to regex device list

Signed-off-by: Guy Kaneti 
---
 doc/guides/regexdevs/octeontx2.rst | 11 +++
 usertools/dpdk-devbind.py  |  8 
 2 files changed, 19 insertions(+)

diff --git a/doc/guides/regexdevs/octeontx2.rst 
b/doc/guides/regexdevs/octeontx2.rst
index 87659b661..859780da1 100644
--- a/doc/guides/regexdevs/octeontx2.rst
+++ b/doc/guides/regexdevs/octeontx2.rst
@@ -24,6 +24,17 @@ Prerequisites and Compilation procedure
 
See :doc:`../platform/octeontx2` for setup information.
 
+Device Setup
+
+
+The OCTEON TX2 REE devices will need to be bound to a user-space IO driver
+for use. The script ``dpdk-devbind.py`` script included with DPDK can be
+used to view the state of the devices and to bind them to a suitable
+DPDK-supported kernel driver. When querying the status of the devices,
+they will appear under the category of "REGEX devices", i.e. the command
+``dpdk-devbind.py --status-dev regex`` can be used to see the state of
+those devices alone.
+
 Debugging Options
 -
 
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 1d1113a08..99112b7ab 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -41,6 +41,8 @@
   'SVendor': None, 'SDevice': None}
 octeontx2_dma = {'Class': '08', 'Vendor': '177d', 'Device': 'a081',
   'SVendor': None, 'SDevice': None}
+octeontx2_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
+  'SVendor': None, 'SDevice': None}
 
 intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': 
'6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
   'SVendor': None, 'SDevice': None}
@@ -61,6 +63,7 @@
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+regex_devices = [octeontx2_ree]
 misc_devices = [intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_idxd_spr,
 intel_ntb_skx, intel_ntb_icx,
 octeontx2_dma]
@@ -650,6 +653,9 @@ def show_status():
 if status_dev == "misc" or status_dev == "all":
 show_device_status(misc_devices, "Misc (rawdev)")
 
+if status_dev == "regex" or status_dev == "all":
+show_device_status(regex_devices, "Regex")
+
 
 def pci_glob(arg):
 '''Returns a list containing either:
@@ -742,6 +748,7 @@ def do_arg_actions():
 get_device_details(eventdev_devices)
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
+get_device_details(regex_devices)
 get_device_details(misc_devices)
 show_status()
 
@@ -763,6 +770,7 @@ def main():
 get_device_details(eventdev_devices)
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
+get_device_details(regex_devices)
 get_device_details(misc_devices)
 do_arg_actions()
 
-- 
2.28.0



[dpdk-dev] [PATCH v3 1/3] common/octeontx2: add REE definitions and logging support

2020-10-13 Thread guyk
From: Guy Kaneti 

Add REE mbox msg definitions, RVU and REE HW definitions

Signed-off-by: Guy Kaneti 
---
 drivers/common/octeontx2/hw/otx2_ree.h|  27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|   5 +
 drivers/common/octeontx2/otx2_common.c|   1 +
 drivers/common/octeontx2/otx2_common.h|   5 +
 drivers/common/octeontx2/otx2_mbox.h  | 103 ++
 .../rte_common_octeontx2_version.map  |   1 +
 6 files changed, 142 insertions(+)
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h

diff --git a/drivers/common/octeontx2/hw/otx2_ree.h 
b/drivers/common/octeontx2/hw/otx2_ree.h
new file mode 100644
index 0..b7481f125
--- /dev/null
+++ b/drivers/common/octeontx2/hw/otx2_ree.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_REE_HW_H__
+#define __OTX2_REE_HW_H__
+
+/* REE BAR0*/
+#define REE_AF_REEXM_MAX_MATCH (0x80c8)
+
+/* REE BAR02 */
+#define REE_LF_MISC_INT (0x300)
+#define REE_LF_DONE_INT (0x120)
+
+#define REE_AF_QUEX_GMCTL(a)(0x800 | (a) << 3)
+
+#define REE_AF_INT_VEC_RAS  (0x0ull)
+#define REE_AF_INT_VEC_RVU  (0x1ull)
+#define REE_AF_INT_VEC_QUE_DONE (0x2ull)
+#define REE_AF_INT_VEC_AQ   (0x3ull)
+
+/* ENUMS */
+
+#define REE_LF_INT_VEC_QUE_DONE(0x0ull)
+#define REE_LF_INT_VEC_MISC(0x1ull)
+
+#endif /* __OTX2_REE_HW_H__*/
diff --git a/drivers/common/octeontx2/hw/otx2_rvu.h 
b/drivers/common/octeontx2/hw/otx2_rvu.h
index 330bfb37f..072515207 100644
--- a/drivers/common/octeontx2/hw/otx2_rvu.h
+++ b/drivers/common/octeontx2/hw/otx2_rvu.h
@@ -130,6 +130,7 @@
 #define RVU_BLOCK_TYPE_RAD  (0xdull)
 #define RVU_BLOCK_TYPE_DFA  (0xeull)
 #define RVU_BLOCK_TYPE_HNA  (0xfull)
+#define RVU_BLOCK_TYPE_REE  (0xeull)
 
 #define RVU_BLOCK_ADDR_RVUM (0x0ull)
 #define RVU_BLOCK_ADDR_LMT  (0x1ull)
@@ -146,6 +147,8 @@
 #define RVU_BLOCK_ADDR_NDC2 (0xeull)
 #define RVU_BLOCK_ADDR_R_END(0x1full)
 #define RVU_BLOCK_ADDR_R_START  (0x14ull)
+#define RVU_BLOCK_ADDR_REE0 (0x14ull)
+#define RVU_BLOCK_ADDR_REE1 (0x15ull)
 
 #define RVU_VF_INT_VEC_MBOX (0x0ull)
 
@@ -167,6 +170,7 @@
 #define NPA_AF_BAR2_SEL(0x900ull)
 #define CPT_AF_BAR2_SEL(0x900ull)
 #define RVU_AF_BAR2_SEL(0x900ull)
+#define REE_AF_BAR2_SEL(0x900ull)
 
 #define AF_BAR2_ALIASX(a, b) \
(0x910ull | (uint64_t)(a) << 12 | (uint64_t)(b))
@@ -177,6 +181,7 @@
 #define NPA_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(0, b)
 #define CPT_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 #define RVU_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
+#define REE_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 
 /* Structures definitions */
 
diff --git a/drivers/common/octeontx2/otx2_common.c 
b/drivers/common/octeontx2/otx2_common.c
index b292e999a..d23c50242 100644
--- a/drivers/common/octeontx2/otx2_common.c
+++ b/drivers/common/octeontx2/otx2_common.c
@@ -213,3 +213,4 @@ RTE_LOG_REGISTER(otx2_logtype_sso, pmd.event.octeontx2, 
NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_tim, pmd.event.octeontx2.timer, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_dpi, pmd.raw.octeontx2.dpi, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_ep, pmd.raw.octeontx2.ep, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_ree, pmd.regex.octeontx2, NOTICE);
diff --git a/drivers/common/octeontx2/otx2_common.h 
b/drivers/common/octeontx2/otx2_common.h
index 2168cde4d..b6779f710 100644
--- a/drivers/common/octeontx2/otx2_common.h
+++ b/drivers/common/octeontx2/otx2_common.h
@@ -21,6 +21,7 @@
 #include "hw/otx2_sso.h"
 #include "hw/otx2_ssow.h"
 #include "hw/otx2_tim.h"
+#include "hw/otx2_ree.h"
 
 /* Alignment */
 #define OTX2_ALIGN  128
@@ -96,6 +97,7 @@ extern int otx2_logtype_tm;
 extern int otx2_logtype_tim;
 extern int otx2_logtype_dpi;
 extern int otx2_logtype_ep;
+extern int otx2_logtype_ree;
 
 #define otx2_err(fmt, args...) \
RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",  \
@@ -119,6 +121,7 @@ extern int otx2_logtype_ep;
 #define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
 #define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
 #define otx2_sdp_dbg(fmt, ...) otx2_dbg(ep, fmt, ##__VA_ARGS__)
+#define otx2_ree_dbg(fmt, ...) otx2_dbg(ree, fmt, ##__VA_ARGS__)
 
 /* PCI IDs */
 #define PCI_VENDOR_ID_CAVIUM   0x177D
@@ -136,6 +139,8 @@ extern int otx2_logtype_ep;
 #define PCI_DEVID_OCTEONTX2_EP_VF  0xB203 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF 0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF 0xA0f7
+#define PCI_DEVID_OCTEONTX2_RVU

[dpdk-dev] [PATCH 0/4] Add Marvell OCTEON TX2 regex driver

2020-09-01 Thread guyk
From: Guy Kaneti 

This patchset adds support for OCTEON TX2 regex driver as DPDK regexdev.
The driver implements the API defined in the regexdev lib.

Guy Kaneti (4):
  common/octeontx2: add REE definitions and logging support
  regex/octeontx2: add build infra and device support
  usertools: add octeontx2 REE device binding
  doc: add Marvell OCTEON TX2 regex guide

 MAINTAINERS   |3 +
 config/common_base|6 +
 doc/guides/platform/octeontx2.rst |5 +
 doc/guides/regexdevs/features/octeontx2.ini   |   10 +
 doc/guides/regexdevs/index.rst|1 +
 doc/guides/regexdevs/octeontx2.rst|   49 +
 doc/guides/rel_notes/release_20_11.rst|5 +
 drivers/common/octeontx2/hw/otx2_ree.h|   27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|5 +
 drivers/common/octeontx2/otx2_common.c|1 +
 drivers/common/octeontx2/otx2_common.h|5 +
 drivers/common/octeontx2/otx2_mbox.h  |  103 ++
 .../rte_common_octeontx2_version.map  |1 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   53 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1001 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 meson_options.txt |2 +
 usertools/dpdk-devbind.py |8 +
 26 files changed, 2446 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

-- 
2.28.0



[dpdk-dev] [PATCH 1/4] common/octeontx2: add REE definitions and logging support

2020-09-01 Thread guyk
From: Guy Kaneti 

Add REE mbox msg definitions, RVU and REE HW definitions

Signed-off-by: Guy Kaneti 
---
 drivers/common/octeontx2/hw/otx2_ree.h|  27 +
 drivers/common/octeontx2/hw/otx2_rvu.h|   5 +
 drivers/common/octeontx2/otx2_common.c|   1 +
 drivers/common/octeontx2/otx2_common.h|   5 +
 drivers/common/octeontx2/otx2_mbox.h  | 103 ++
 .../rte_common_octeontx2_version.map  |   1 +
 6 files changed, 142 insertions(+)
 create mode 100644 drivers/common/octeontx2/hw/otx2_ree.h

diff --git a/drivers/common/octeontx2/hw/otx2_ree.h 
b/drivers/common/octeontx2/hw/otx2_ree.h
new file mode 100644
index 0..b7481f125
--- /dev/null
+++ b/drivers/common/octeontx2/hw/otx2_ree.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_REE_HW_H__
+#define __OTX2_REE_HW_H__
+
+/* REE BAR0*/
+#define REE_AF_REEXM_MAX_MATCH (0x80c8)
+
+/* REE BAR02 */
+#define REE_LF_MISC_INT (0x300)
+#define REE_LF_DONE_INT (0x120)
+
+#define REE_AF_QUEX_GMCTL(a)(0x800 | (a) << 3)
+
+#define REE_AF_INT_VEC_RAS  (0x0ull)
+#define REE_AF_INT_VEC_RVU  (0x1ull)
+#define REE_AF_INT_VEC_QUE_DONE (0x2ull)
+#define REE_AF_INT_VEC_AQ   (0x3ull)
+
+/* ENUMS */
+
+#define REE_LF_INT_VEC_QUE_DONE(0x0ull)
+#define REE_LF_INT_VEC_MISC(0x1ull)
+
+#endif /* __OTX2_REE_HW_H__*/
diff --git a/drivers/common/octeontx2/hw/otx2_rvu.h 
b/drivers/common/octeontx2/hw/otx2_rvu.h
index 330bfb37f..072515207 100644
--- a/drivers/common/octeontx2/hw/otx2_rvu.h
+++ b/drivers/common/octeontx2/hw/otx2_rvu.h
@@ -130,6 +130,7 @@
 #define RVU_BLOCK_TYPE_RAD  (0xdull)
 #define RVU_BLOCK_TYPE_DFA  (0xeull)
 #define RVU_BLOCK_TYPE_HNA  (0xfull)
+#define RVU_BLOCK_TYPE_REE  (0xeull)
 
 #define RVU_BLOCK_ADDR_RVUM (0x0ull)
 #define RVU_BLOCK_ADDR_LMT  (0x1ull)
@@ -146,6 +147,8 @@
 #define RVU_BLOCK_ADDR_NDC2 (0xeull)
 #define RVU_BLOCK_ADDR_R_END(0x1full)
 #define RVU_BLOCK_ADDR_R_START  (0x14ull)
+#define RVU_BLOCK_ADDR_REE0 (0x14ull)
+#define RVU_BLOCK_ADDR_REE1 (0x15ull)
 
 #define RVU_VF_INT_VEC_MBOX (0x0ull)
 
@@ -167,6 +170,7 @@
 #define NPA_AF_BAR2_SEL(0x900ull)
 #define CPT_AF_BAR2_SEL(0x900ull)
 #define RVU_AF_BAR2_SEL(0x900ull)
+#define REE_AF_BAR2_SEL(0x900ull)
 
 #define AF_BAR2_ALIASX(a, b) \
(0x910ull | (uint64_t)(a) << 12 | (uint64_t)(b))
@@ -177,6 +181,7 @@
 #define NPA_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(0, b)
 #define CPT_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 #define RVU_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
+#define REE_AF_BAR2_ALIASX(a, b)   AF_BAR2_ALIASX(a, b)
 
 /* Structures definitions */
 
diff --git a/drivers/common/octeontx2/otx2_common.c 
b/drivers/common/octeontx2/otx2_common.c
index b292e999a..d23c50242 100644
--- a/drivers/common/octeontx2/otx2_common.c
+++ b/drivers/common/octeontx2/otx2_common.c
@@ -213,3 +213,4 @@ RTE_LOG_REGISTER(otx2_logtype_sso, pmd.event.octeontx2, 
NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_tim, pmd.event.octeontx2.timer, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_dpi, pmd.raw.octeontx2.dpi, NOTICE);
 RTE_LOG_REGISTER(otx2_logtype_ep, pmd.raw.octeontx2.ep, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_ree, pmd.regex.octeontx2, NOTICE);
diff --git a/drivers/common/octeontx2/otx2_common.h 
b/drivers/common/octeontx2/otx2_common.h
index 2168cde4d..b6779f710 100644
--- a/drivers/common/octeontx2/otx2_common.h
+++ b/drivers/common/octeontx2/otx2_common.h
@@ -21,6 +21,7 @@
 #include "hw/otx2_sso.h"
 #include "hw/otx2_ssow.h"
 #include "hw/otx2_tim.h"
+#include "hw/otx2_ree.h"
 
 /* Alignment */
 #define OTX2_ALIGN  128
@@ -96,6 +97,7 @@ extern int otx2_logtype_tm;
 extern int otx2_logtype_tim;
 extern int otx2_logtype_dpi;
 extern int otx2_logtype_ep;
+extern int otx2_logtype_ree;
 
 #define otx2_err(fmt, args...) \
RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",  \
@@ -119,6 +121,7 @@ extern int otx2_logtype_ep;
 #define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
 #define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
 #define otx2_sdp_dbg(fmt, ...) otx2_dbg(ep, fmt, ##__VA_ARGS__)
+#define otx2_ree_dbg(fmt, ...) otx2_dbg(ree, fmt, ##__VA_ARGS__)
 
 /* PCI IDs */
 #define PCI_VENDOR_ID_CAVIUM   0x177D
@@ -136,6 +139,8 @@ extern int otx2_logtype_ep;
 #define PCI_DEVID_OCTEONTX2_EP_VF  0xB203 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF 0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF 0xA0f7
+#define PCI_DEVID_OCTEONTX2_RVU

[dpdk-dev] [PATCH 2/4] regex/octeontx2: add build infra and device support

2020-09-01 Thread guyk
From: Guy Kaneti 

Add meson based build infrastructure along with the
OTX2 regexdev (REE) device functions.

For regex rule compiler support build:
meson configure -Dree_compiler_sdk=

Signed-off-by: Guy Kaneti 
---
 MAINTAINERS   |3 +
 config/common_base|6 +
 drivers/regex/meson.build |2 +-
 drivers/regex/octeontx2/meson.build   |   53 +
 drivers/regex/octeontx2/otx2_regexdev.c   | 1001 +
 drivers/regex/octeontx2/otx2_regexdev.h   |  109 ++
 .../regex/octeontx2/otx2_regexdev_compiler.c  |  229 
 .../regex/octeontx2/otx2_regexdev_compiler.h  |   11 +
 .../regex/octeontx2/otx2_regexdev_hw_access.c |  167 +++
 .../regex/octeontx2/otx2_regexdev_hw_access.h |  202 
 drivers/regex/octeontx2/otx2_regexdev_mbox.c  |  401 +++
 drivers/regex/octeontx2/otx2_regexdev_mbox.h  |   38 +
 .../rte_pmd_octeontx2_regex_version.map   |3 +
 meson_options.txt |2 +
 14 files changed, 2226 insertions(+), 1 deletion(-)
 create mode 100644 drivers/regex/octeontx2/meson.build
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_compiler.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_hw_access.h
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.c
 create mode 100644 drivers/regex/octeontx2/otx2_regexdev_mbox.h
 create mode 100644 drivers/regex/octeontx2/rte_pmd_octeontx2_regex_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index ed163f5d5..ab8a9313c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1137,6 +1137,9 @@ F: drivers/regex/mlx5/
 F: doc/guides/regexdevs/mlx5.rst
 F: doc/guides/regexdevs/features/mlx5.ini
 
+Marvell OCTEON TX2 regex
+M: Guy Kaneti 
+F: drivers/regex/octeontx2/
 
 vDPA Drivers
 
diff --git a/config/common_base b/config/common_base
index fbf0ee70c..2cd687bf6 100644
--- a/config/common_base
+++ b/config/common_base
@@ -842,6 +842,12 @@ CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=y
 #
 CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=y
 
+#
+# Compile PMD for Octeontx2 REE regex device
+#
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_REGEX=y
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_REGEX_COMPILER=n
+
 #
 # Compile librte_ring
 #
diff --git a/drivers/regex/meson.build b/drivers/regex/meson.build
index 8edeba3a0..79bb5d5df 100644
--- a/drivers/regex/meson.build
+++ b/drivers/regex/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2020 Mellanox Technologies, Ltd
 
-drivers = ['mlx5']
+drivers = ['mlx5', 'octeontx2']
 std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
 driver_name_fmt = 'rte_pmd_@0@'
diff --git a/drivers/regex/octeontx2/meson.build 
b/drivers/regex/octeontx2/meson.build
new file mode 100644
index 0..c212e3d43
--- /dev/null
+++ b/drivers/regex/octeontx2/meson.build
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell International Ltd.
+#
+
+if not is_linux
+   build = false
+   reason = 'only supported on Linux'
+endif
+
+path = get_option('ree_compiler_sdk')
+lib_dir = path + '/lib'
+inc_dir = path + '/include'
+
+if dpdk_conf.has('RTE_LIBRTE_PMD_OCTEONTX2_REGEX_COMPILER')
+   lib = cc.find_library('librxp_compiler', dirs : [lib_dir], required: 
false)
+   if not lib.found()
+   build = false
+   reason = 'missing dependency, "librxp_compiler"'
+   else
+   ext_deps += lib
+   ext_deps += cc.find_library('libstdc++', required: true)
+   includes += include_directories(inc_dir)
+   cflags += ['-DREE_COMPILER_SDK']
+   endif
+endif
+
+sources = files('otx2_regexdev.c',
+   'otx2_regexdev_hw_access.c',
+   'otx2_regexdev_mbox.c',
+   'otx2_regexdev_compiler.c'
+   )
+
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit 
warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+   extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
+if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
+   ext_deps += cc.find_library('atomic')
+endif
+
+foreach flag: extra_flags
+   if cc.has_argument(flag)
+   cflags += flag
+   endif
+endforeach
+
+name = 'octeontx2_regex'
+deps += ['bus_pci', 'common_octeontx2', 'regexdev']
+
+includes += include_directories('../../common/octeontx2')
diff --git a/drivers/regex/octeontx2/otx2_regexdev.c 
b/drivers/regex/octeontx2/otx2_regexdev.c
new file mode 100644
index 0..2aebd0138
--- /dev/null

[dpdk-dev] [PATCH 3/4] usertools: add octeontx2 REE device binding

2020-09-01 Thread guyk
From: Guy Kaneti 

Update the devbind script with new section of regex devices, also
added OCTEONTX2 REE device ID to regex device list

Signed-off-by: Guy Kaneti 
---
 usertools/dpdk-devbind.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 86b6b53c4..51ee990db 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -44,6 +44,8 @@
   'SVendor': None, 'SDevice': None}
 octeontx2_dma = {'Class': '08', 'Vendor': '177d', 'Device': 'a081',
   'SVendor': None, 'SDevice': None}
+octeontx2_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
+  'SVendor': None, 'SDevice': None}
 
 intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': 
'6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
   'SVendor': None, 'SDevice': None}
@@ -61,6 +63,7 @@
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
 misc_devices = [intel_ioat_bdw, intel_ioat_skx, intel_ioat_icx, intel_ntb_skx, 
octeontx2_dma]
+regex_devices = [octeontx2_ree]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -648,6 +651,9 @@ def show_status():
 if status_dev == "misc" or status_dev == "all":
 show_device_status(misc_devices, "Misc (rawdev)")
 
+if status_dev == "regex" or status_dev == "all":
+show_device_status(regex_devices, "Regex")
+
 def parse_args():
 '''Parses the command-line arguments given by the user and takes the
 appropriate action for each'''
@@ -723,6 +729,7 @@ def do_arg_actions():
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
 get_device_details(misc_devices)
+get_device_details(regex_devices)
 show_status()
 
 
@@ -744,6 +751,7 @@ def main():
 get_device_details(mempool_devices)
 get_device_details(compress_devices)
 get_device_details(misc_devices)
+get_device_details(regex_devices)
 do_arg_actions()
 
 if __name__ == "__main__":
-- 
2.28.0



[dpdk-dev] [PATCH 4/4] doc: add Marvell OCTEON TX2 regex guide

2020-09-01 Thread guyk
From: Guy Kaneti 

Signed-off-by: Guy Kaneti 
---
 doc/guides/platform/octeontx2.rst   |  5 +++
 doc/guides/regexdevs/features/octeontx2.ini | 10 +
 doc/guides/regexdevs/index.rst  |  1 +
 doc/guides/regexdevs/octeontx2.rst  | 49 +
 doc/guides/rel_notes/release_20_11.rst  |  5 +++
 5 files changed, 70 insertions(+)
 create mode 100644 doc/guides/regexdevs/features/octeontx2.ini
 create mode 100644 doc/guides/regexdevs/octeontx2.rst

diff --git a/doc/guides/platform/octeontx2.rst 
b/doc/guides/platform/octeontx2.rst
index 13255eec5..c4d64ab4b 100644
--- a/doc/guides/platform/octeontx2.rst
+++ b/doc/guides/platform/octeontx2.rst
@@ -67,6 +67,8 @@ DPDK subsystem.
+---+-+--+
| 9 | SDP | rte_ethdev   |
+---+-+--+
+   | 10| REE | rte_regexdev |
+   +---+-+--+
 
 PF0 is called the administrative / admin function (AF) and has exclusive
 privileges to provision RVU functional block's LFs to each of the PF/VF.
@@ -156,6 +158,9 @@ This section lists dataplane H/W block(s) available in 
OCTEON TX2 SoC.
 #. **Crypto Device Driver**
See :doc:`../cryptodevs/octeontx2` for CPT crypto device driver information.
 
+#. **Regex Device Driver**
+   See :doc:`../regexdevs/octeontx2` for REE regex device driver information.
+
 Procedure to Setup Platform
 ---
 
diff --git a/doc/guides/regexdevs/features/octeontx2.ini 
b/doc/guides/regexdevs/features/octeontx2.ini
new file mode 100644
index 0..c9b421a16
--- /dev/null
+++ b/doc/guides/regexdevs/features/octeontx2.ini
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx2' regex driver.
+;
+; Refer to default.ini for the full list of available driver features.
+;
+[Features]
+PCRE back reference = Y
+PCRE word boundary  = Y
+Run time compilation= Y
+Armv8   = Y
diff --git a/doc/guides/regexdevs/index.rst b/doc/guides/regexdevs/index.rst
index 49216a932..b1abc826b 100644
--- a/doc/guides/regexdevs/index.rst
+++ b/doc/guides/regexdevs/index.rst
@@ -13,3 +13,4 @@ which can be used from an application through RegEx API.
 
features_overview
mlx5
+   octeontx2
diff --git a/doc/guides/regexdevs/octeontx2.rst 
b/doc/guides/regexdevs/octeontx2.rst
new file mode 100644
index 0..859780da1
--- /dev/null
+++ b/doc/guides/regexdevs/octeontx2.rst
@@ -0,0 +1,49 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2020 Marvell International Ltd.
+
+OCTEON TX2 REE Regexdev Driver
+===
+
+The OCTEON TX2 REE PMD (**librte_pmd_octeontx2_regex**) provides poll mode
+regexdev driver support for the inbuilt regex device found in the **Marvell 
OCTEON TX2**
+SoC family.
+
+More information about OCTEON TX2 SoC can be found at `Marvell Official Website
+`_.
+
+Features
+
+
+Features of the OCTEON TX2 REE PMD are:
+
+- 36 queues
+- Up to 254 matches for each regex operation
+
+Prerequisites and Compilation procedure
+---
+
+   See :doc:`../platform/octeontx2` for setup information.
+
+Device Setup
+
+
+The OCTEON TX2 REE devices will need to be bound to a user-space IO driver
+for use. The script ``dpdk-devbind.py`` script included with DPDK can be
+used to view the state of the devices and to bind them to a suitable
+DPDK-supported kernel driver. When querying the status of the devices,
+they will appear under the category of "REGEX devices", i.e. the command
+``dpdk-devbind.py --status-dev regex`` can be used to see the state of
+those devices alone.
+
+Debugging Options
+-
+
+.. _table_octeontx2_regex_debug_options:
+
+.. table:: OCTEON TX2 regex device debug options
+
+   +---++---+
+   | # | Component  | EAL log command   |
+   +===++===+
+   | 1 | REE| --log-level='pmd\.regex\.octeontx2,8' |
+   +---++---+
diff --git a/doc/guides/rel_notes/release_20_11.rst 
b/doc/guides/rel_notes/release_20_11.rst
index df227a177..05c0a8ba7 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -55,6 +55,11 @@ New Features
  Also, make sure to start the actual text at the margin.
  ===
 
+* **Added Marvell OCTEON TX2 regex PMD.**
+
+  Added a new PMD driver for hardware regex offload block for OCTEON TX2 SoC.
+
+  See the :doc:`../regexdevs

[dpdk-dev] [PATCH 0/2] Add example l3fwd-regex

2020-09-08 Thread guyk
From: Guy Kaneti 

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

-- 
2.28.0



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

2020-09-08 Thread guyk
From: Guy Kaneti 

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

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index ed163f5d5..a73845a2d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/examples/l3fwd-regex/l3fwd.h b/examples/l3fwd-regex/l3fwd.h
new file mode 100644
index 0..3fb3647bb
--- /dev/null
+++ b/examples/l3fwd-regex/l3fwd.h
@@ -0,0 +1,207 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3_FWD_H__
+#define __L3_FWD_H__
+
+#include 
+#include 
+
+#define DO_RFC_1812_CHECKS
+
+#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
+
+/*
+ * Configurable number of RX/TX ring descriptors
+ */
+#define RTE_TEST_RX_DESC_DEFAULT 1024
+#define RTE_TEST_TX_DESC_DEFAULT 1024
+
+#define MAX_PKT_BURST 32
+#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
+
+#define MEMPOOL_CACHE_SIZE 256
+#define MAX_RX_QUEUE_PER_LCORE 16
+
+/*
+ * Try to avoid TX buffering if we have at least MAX_TX_BURST packets to send.
+ */
+#defineMAX_TX_BURST  (MAX_PKT_BURST / 2)
+
+#define NB_SOCKETS8
+
+/* Configure how many packets ahead to prefetch, when reading packets */
+#define PREFETCH_OFFSET  3
+
+/* Used to mark destination port as 'invalid'. */
+#defineBAD_PORT ((uint16_t)-1)
+
+#define FWDSTEP4
+
+/* replace first 12B of the ethernet header. */
+#defineMASK_ETH 0x3f
+
+struct mbuf_table {
+   uint16_t len;
+   struct rte_mbuf *m_table[MAX_PKT_BURST];
+};
+
+struct lcore_rx_queue {
+   uint16_t port_id;
+   uint8_t queue_id;
+} __rte_cache_aligned;
+
+struct lcore_conf {
+   uint16_t n_rx_queue;
+   struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
+   uint8_t regex_dev_id;
+   uint16_t regex_qp_id;
+   uint16_t n_tx_port;
+   uint16_t tx_port_id[RTE_MAX_ETHPORTS];
+   uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+   struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
+   struct rte_mbuf **pkts_burst;
+   void *ipv4_lookup_struct;
+   void *ipv6_lookup_struct;
+} __rte_cache_aligned;
+
+extern volatile bool force_quit;
+
+/* ethernet addresses of ports */
+extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];
+extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
+
+/* mask of enabled ports */
+extern uint32_t enabled_port_mask;
+
+/* Used only in exact match mode. */
+extern int ipv6; /**< ipv6 is false by default. */
+extern uint32_t hash_entry_number;
+
+extern xmm_t val_eth[RTE_MAX_ETHPORTS];
+
+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
+
+/* Send burst of packets on an output interface */
+static inline int
+send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)
+{
+   struct rte_mbuf **m_table;
+   int ret;
+   uint16_t queueid;
+
+   queueid = qconf->tx_queue_id[port];
+   m_table = (struct rte_mbuf **)qconf->tx_mbufs[port].m_table;
+
+   ret = rte_eth_tx_burst(port, queueid, m_table, n);
+   if (unlikely(ret < n)) {
+   do {
+   rte_pktmbuf_free(m_table[ret]);
+   } while (++ret < n);
+   }
+
+   return 0;
+}
+
+/* Enqueue a single packet, and send burst if queue is filled */
+static inline int
+send_single_packet(struct lcore_conf *qconf,
+  struct rte_mbuf *m, uint16_t port)
+{
+   uint16_t len;
+
+   len = qconf->tx_mbufs[port].len;
+   qconf->tx_mbufs[port].m_table[len] = m;
+   len++;
+
+   /* enough pkts to be sent */
+   if (unlikely(len == MAX_PKT_BURST)) {
+   send_burst(qconf, MAX_PKT_BURST, port);
+   len = 0;
+   }
+
+   qconf->tx_mbufs[port].len = len;
+   return 0;
+}
+
+#ifdef DO_RFC_1812_CHECKS
+static inline int
+is_valid_ipv4_pkt(struct rte_ipv4_h

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

2020-09-08 Thread guyk
From: Guy Kaneti 

Adding the user guide for l3fwd regex application.

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index a73845a2d..af8a803ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -453,6 +453,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti 
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index affa9c574..dc67580af 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -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
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index 8ff223b16..94070933b 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -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`: 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`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
diff --git a/doc/guides/sample_app_ug/l3_forward_regex.rst 
b/doc/guides/sample_app_ug/l3_forward_regex.rst
new file mode 100644
index 0..bb11884a3
--- /dev/null
+++ b/doc/guides/sample_app_ug/l3_forward_regex.rst
@@ -0,0 +1,235 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(C) 2020 Marvell International Ltd.
+
+L3 Forwarding Regex Sample Application
+==
+
+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.
+
+Overview
+
+
+The application demonstrates the use of the Regex libraries in DPDK to 
implement packet forwarding.
+The initialization is very similar to those of the :doc:`l3_forward`.
+There is also additional initialization of Regex device and configuration per 
lcore.
+The main difference from the L3 Forwarding sample application is that this 
application introduces
+Regex based pre-filtering decision done before LPM lookup.
+Thus, packet can be dropped or flagged before the forwarding decision.
+
+In the sample application, only IPv4 forwarding is supported as of now.
+
+Compiling the Application
+-
+
+To compile the sample application see :doc:`compiling`.
+
+The application is located in the ``l3fwd-regex`` sub-directory.
+
+Running the Application
+---
+
+The application has a number of command line options similar to l3fwd::
+
+./l3fwd-graph [EAL options] -- -p PORTMASK
+   [-P]
+   --config 
(port,queue,lcore,regex-dev,regex-q)[,(port,queue,lcore,regex-dev,regex-q)]
+   [--regex-rule-db-file FILENAME
+   [--regex-drop]
+   [--eth-dest=X,MM:MM:MM:MM:MM:MM]
+   [--enable-jumbo [--max-pkt-len PKTLEN]]
+   [--no-numa]
+   [--parse-ptype]
+   [--per-port-pool]
+   [--regex-drop]
+   [--regex-debug]
+
+Where,
+
+* ``-p PORTMASK:`` Hexadecimal bitmask of ports to configure
+
+* ``-P:`` Optional, sets all ports to promiscuous mode so that packets are 
accepted regardless of the packet's Ethernet MAC destination address.
+  Without this option, only packets with the Ethernet MAC destination address 
set to the Ethernet address of the port are accepted.
+
+* ``--config 
(port,queue,lcore,regex-dev,regex-q)[,(port,queue,lcore,regex-dev,regex-q)]:`` 
Determines which queues from which ports are mapped
+  to which cores, and which Regex device and queues to use.
+
+* ``--regex-rule-db-file FILENAME:`` prebuilt rule database to configure Regex 
device with.
+
+* ``--eth-dest=X,MM:MM:MM:MM:MM:MM:`` Optional, ethernet destination for port 
X.
+
+* ``--enable-jumb

[dpdk-dev] [PATCH v2 0/2] Add example l3fwd-regex

2020-09-09 Thread guyk
From: Guy Kaneti 

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

-- 
2.28.0



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

2020-09-09 Thread guyk
From: Guy Kaneti 

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

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 3b16d7a4b..e30b1ad56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 
+F: examples/l3fwd-regex/
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/examples/l3fwd-regex/l3fwd.h b/examples/l3fwd-regex/l3fwd.h
new file mode 100644
index 0..3fb3647bb
--- /dev/null
+++ b/examples/l3fwd-regex/l3fwd.h
@@ -0,0 +1,207 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __L3_FWD_H__
+#define __L3_FWD_H__
+
+#include 
+#include 
+
+#define DO_RFC_1812_CHECKS
+
+#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
+
+/*
+ * Configurable number of RX/TX ring descriptors
+ */
+#define RTE_TEST_RX_DESC_DEFAULT 1024
+#define RTE_TEST_TX_DESC_DEFAULT 1024
+
+#define MAX_PKT_BURST 32
+#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
+
+#define MEMPOOL_CACHE_SIZE 256
+#define MAX_RX_QUEUE_PER_LCORE 16
+
+/*
+ * Try to avoid TX buffering if we have at least MAX_TX_BURST packets to send.
+ */
+#defineMAX_TX_BURST  (MAX_PKT_BURST / 2)
+
+#define NB_SOCKETS8
+
+/* Configure how many packets ahead to prefetch, when reading packets */
+#define PREFETCH_OFFSET  3
+
+/* Used to mark destination port as 'invalid'. */
+#defineBAD_PORT ((uint16_t)-1)
+
+#define FWDSTEP4
+
+/* replace first 12B of the ethernet header. */
+#defineMASK_ETH 0x3f
+
+struct mbuf_table {
+   uint16_t len;
+   struct rte_mbuf *m_table[MAX_PKT_BURST];
+};
+
+struct lcore_rx_queue {
+   uint16_t port_id;
+   uint8_t queue_id;
+} __rte_cache_aligned;
+
+struct lcore_conf {
+   uint16_t n_rx_queue;
+   struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
+   uint8_t regex_dev_id;
+   uint16_t regex_qp_id;
+   uint16_t n_tx_port;
+   uint16_t tx_port_id[RTE_MAX_ETHPORTS];
+   uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+   struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
+   struct rte_mbuf **pkts_burst;
+   void *ipv4_lookup_struct;
+   void *ipv6_lookup_struct;
+} __rte_cache_aligned;
+
+extern volatile bool force_quit;
+
+/* ethernet addresses of ports */
+extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];
+extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
+
+/* mask of enabled ports */
+extern uint32_t enabled_port_mask;
+
+/* Used only in exact match mode. */
+extern int ipv6; /**< ipv6 is false by default. */
+extern uint32_t hash_entry_number;
+
+extern xmm_t val_eth[RTE_MAX_ETHPORTS];
+
+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
+
+/* Send burst of packets on an output interface */
+static inline int
+send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)
+{
+   struct rte_mbuf **m_table;
+   int ret;
+   uint16_t queueid;
+
+   queueid = qconf->tx_queue_id[port];
+   m_table = (struct rte_mbuf **)qconf->tx_mbufs[port].m_table;
+
+   ret = rte_eth_tx_burst(port, queueid, m_table, n);
+   if (unlikely(ret < n)) {
+   do {
+   rte_pktmbuf_free(m_table[ret]);
+   } while (++ret < n);
+   }
+
+   return 0;
+}
+
+/* Enqueue a single packet, and send burst if queue is filled */
+static inline int
+send_single_packet(struct lcore_conf *qconf,
+  struct rte_mbuf *m, uint16_t port)
+{
+   uint16_t len;
+
+   len = qconf->tx_mbufs[port].len;
+   qconf->tx_mbufs[port].m_table[len] = m;
+   len++;
+
+   /* enough pkts to be sent */
+   if (unlikely(len == MAX_PKT_BURST)) {
+   send_burst(qconf, MAX_PKT_BURST, port);
+   len = 0;
+   }
+
+   qconf->tx_mbufs[port].len = len;
+   return 0;
+}
+
+#ifdef DO_RFC_1812_CHECKS
+static inline int
+is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)
+{
+   /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2

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

2020-09-09 Thread guyk
From: Guy Kaneti 

Adding the user guide for l3fwd regex application.

Signed-off-by: Guy Kaneti 
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index e30b1ad56..f35f8bc01 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -435,6 +435,7 @@ F: doc/guides/prog_guide/regexdev.rst
 F: doc/guides/regexdevs/features/default.ini
 M: Guy Kaneti 
 F: examples/l3fwd-regex/
+F: doc/guides/sample_app_ug/l3_forward_regex.rst
 
 Eventdev API
 M: Jerin Jacob 
diff --git a/doc/guides/rel_notes/release_20_11.rst 
b/doc/guides/rel_notes/release_20_11.rst
index df227a177..8c27ba6fd 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index affa9c574..dc67580af 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -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
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index 8ff223b16..94070933b 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -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`: 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`: The Hardware packet copying,
   or ``ioatfwd`` application demonstrates how to use IOAT rawdev driver for
   copying packets between two threads.
diff --git a/doc/guides/sample_app_ug/l3_forward_regex.rst 
b/doc/guides/sample_app_ug/l3_forward_regex.rst
new file mode 100644
index 0..276cabdf4
--- /dev/null
+++ b/doc/guides/sample_app_ug/l3_forward_regex.rst
@@ -0,0 +1,235 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(C) 2020 Marvell International Ltd.
+
+L3 Forwarding Regex Sample Application
+==
+
+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.
+
+Overview
+
+
+The application demonstrates the use of the Regex libraries in DPDK to 
implement packet forwarding.
+The initialization is very similar to those of the :doc:`l3_forward`.
+There is also additional initialization of Regex device and configuration per 
lcore.
+The main difference from the L3 Forwarding sample application is that this 
application introduces
+Regex based pre-filtering decision done before LPM lookup.
+Thus, packet can be dropped or flagged before the forwarding decision.
+
+In the sample application, only IPv4 forwarding is supported as of now.
+
+Compiling the Application
+-
+
+To compile the sample application see :doc:`compiling`.
+
+The application is located in the ``l3fwd-regex`` sub-directory.
+
+Running the Application
+---
+
+The application has a number of command line options similar to l3fwd::
+
+./l3fwd-graph [EAL options] -- -p PORTMASK
+   [-P]
+   --config 
(port,queue,lcore,regex-dev,regex-q)[,(port,queue,lcore,regex-dev,regex-q)]
+   [--regex-rule-db-file FILENAME
+   [--regex-drop]
+   [--eth-dest=X,MM:MM:MM:MM:MM:MM]
+   [--enable-jumbo [--max-pkt-len PKTLEN]]
+   [--no-numa]
+   [--parse-ptype]
+   [--per-port-pool]
+   [--regex-drop]
+   [--regex-debug]
+
+Where,
+
+* ``-p PORTMASK:`` Hexadecimal bitmask of ports to configure
+
+* ``-P:`` Optional, sets all ports to promiscuou