DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: jerinj@marvell.com, Ori Kam <orika@nvidia.com>,
	Liron Himi <lironh@marvell.com>
Subject: [PATCH] regex/cn9k: remove rule compiler
Date: Wed, 21 Jun 2023 16:06:37 +0200	[thread overview]
Message-ID: <20230621140637.657038-1-thomas@monjalon.net> (raw)

Nobody knows how to build the feature.
When the dependency "rxp_compiler" is found,
the header file is not available:

drivers/regex/cn9k/cn9k_regexdev_compiler.c:12:10: fatal error:
	rxp-compiler.h: No such file or directory

It seems that it depends on a proprietay library.
According to what was discussed in the Technical Board:
http://mails.dpdk.org/archives/dev/2019-June/135847.html
the dependency must be "freely available".

Bugzilla ID: 1232

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/prog_guide/regexdev.rst          |   3 +-
 drivers/regex/cn9k/cn9k_regexdev.c          |  10 +-
 drivers/regex/cn9k/cn9k_regexdev_compiler.c | 228 --------------------
 drivers/regex/cn9k/cn9k_regexdev_compiler.h |  11 -
 drivers/regex/cn9k/meson.build              |   8 -
 5 files changed, 2 insertions(+), 258 deletions(-)
 delete mode 100644 drivers/regex/cn9k/cn9k_regexdev_compiler.c
 delete mode 100644 drivers/regex/cn9k/cn9k_regexdev_compiler.h

diff --git a/doc/guides/prog_guide/regexdev.rst b/doc/guides/prog_guide/regexdev.rst
index 5ca7e0c769..93229fa743 100644
--- a/doc/guides/prog_guide/regexdev.rst
+++ b/doc/guides/prog_guide/regexdev.rst
@@ -124,8 +124,7 @@ The configuration mode is depended on the PMD capabilities.
 
 Online rule configuration is done using the following API functions:
 ``rte_regexdev_rule_db_update`` which add / remove rules from the rules
-precompiled list, and ``rte_regexdev_rule_db_compile_activate``
-which compile the rules and loads them to the RegEx HW.
+precompiled list.
 
 Offline rule configuration can be done by adding a pointer to the compiled
 rule database in the configuration step, or by using
diff --git a/drivers/regex/cn9k/cn9k_regexdev.c b/drivers/regex/cn9k/cn9k_regexdev.c
index 56c862c5a7..e96cbf4141 100644
--- a/drivers/regex/cn9k/cn9k_regexdev.c
+++ b/drivers/regex/cn9k/cn9k_regexdev.c
@@ -14,7 +14,6 @@
 
 /* REE common headers */
 #include "cn9k_regexdev.h"
-#include "cn9k_regexdev_compiler.h"
 
 
 /* HW matches are at offset 0x80 from RES_PTR_ADDR
@@ -697,12 +696,6 @@ cn9k_ree_queue_pair_setup(struct rte_regexdev *dev, uint16_t qp_id,
 	return 0;
 }
 
-static int
-cn9k_ree_rule_db_compile_activate(struct rte_regexdev *dev)
-{
-	return cn9k_ree_rule_db_compile_prog(dev);
-}
-
 static int
 cn9k_ree_rule_db_update(struct rte_regexdev *dev,
 		const struct rte_regexdev_rule *rules, uint16_t nb_rules)
@@ -834,8 +827,7 @@ static struct rte_regexdev_ops cn9k_ree_ops = {
 	.dev_attr_get = NULL,
 	.dev_attr_set = NULL,
 	.dev_rule_db_update = cn9k_ree_rule_db_update,
-	.dev_rule_db_compile_activate =
-			cn9k_ree_rule_db_compile_activate,
+	.dev_rule_db_compile_activate = NULL,
 	.dev_db_import = cn9k_ree_rule_db_import,
 	.dev_db_export = cn9k_ree_rule_db_export,
 	.dev_xstats_names_get = NULL,
diff --git a/drivers/regex/cn9k/cn9k_regexdev_compiler.c b/drivers/regex/cn9k/cn9k_regexdev_compiler.c
deleted file mode 100644
index 60f1c1b4c4..0000000000
--- a/drivers/regex/cn9k/cn9k_regexdev_compiler.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (C) 2020 Marvell International Ltd.
- */
-
-#include <rte_malloc.h>
-#include <rte_regexdev.h>
-
-#include "cn9k_regexdev.h"
-#include "cn9k_regexdev_compiler.h"
-
-#ifdef REE_COMPILER_SDK
-#include <rxp-compiler.h>
-
-static int
-ree_rule_db_compile(const struct rte_regexdev_rule *rules,
-		uint16_t nb_rules, struct rxp_rof **rof, struct rxp_rof **rofi,
-		struct rxp_rof *rof_for_incremental_compile,
-		struct rxp_rof *rofi_for_incremental_compile)
-{
-	/*INPUT*/
-	struct rxp_prefix_selection_control_list *prefix_selection_control_list
-		= NULL;
-	struct rxp_blacklist_data_sample *blacklist_sample_data = NULL;
-	struct rxp_rule_ids_to_remove *rule_ids_to_remove = NULL;
-	struct rxp_roff *roff_for_incremental_compile = NULL;
-
-	/*OPTIONS - setting default values*/
-	enum rxp_virtual_prefix_mode virtual_prefix_mode =
-			RXP_VIRTUAL_PREFIX_MODE_0;
-	enum rxp_prefix_capacity prefix_capacity = RXP_PREFIX_CAPACITY_32K;
-	/**< rxp_global_regex_options_flags*/
-	enum rxp_compiler_objective objective = RXP_COMPILER_OBJECTIVE_5;
-	enum rxp_tpe_data_width tpe_data_width = RXP_TPE_DATA_WIDTH_4;
-	uint32_t compiler_options = RXP_COMPILER_OPTIONS_FORCE;
-	/**< rxp_compiler_options_flags*/
-	enum rxp_verbose_level verbose = RXP_VERBOSE_LEVEL_3;
-	enum rxp_version set_rxp_version = RXP_VERSION_V5_8;
-	uint32_t compiler_output_flags = 0;
-	/**< rxp_compiler_output_flags*/
-	uint32_t global_regex_options = 0;
-	/**< rxp_global_regex_options_flags*/
-	float set_auto_blacklist = 0;
-	uint32_t max_rep_max = 65535;
-	uint32_t divide_ruleset = 1;
-	struct rxp_ruleset ruleset;
-	float ptpb_threshold = 0;
-	uint32_t set_max = 0;
-	uint32_t threads = 1;
-
-	/*OUTPUT*/
-	struct rxp_rule_direction_analysis *rule_direction_analysis = NULL;
-	struct rxp_compilation_statistics *compilation_statistics = NULL;
-	struct rxp_prefix_selection_control_list *generated_pscl = NULL;
-	struct rxp_uncompiled_rules_log *uncompiled_rules_log = NULL;
-	struct rxp_critical_rules_rank *critical_rules_rank = NULL;
-	struct rxp_compiled_rules_log *compiled_rules_log = NULL;
-	struct rxp_roff *roff = NULL;
-
-	uint16_t i;
-	int ret;
-
-	ruleset.number_of_entries = nb_rules;
-	ruleset.rules = rte_malloc("rxp_rule_entry",
-			nb_rules*sizeof(struct rxp_rule_entry), 0);
-
-	if (ruleset.rules == NULL) {
-		cn9k_err("Could not allocate memory for rule compilation\n");
-		return -EFAULT;
-	}
-	if (rof_for_incremental_compile)
-		compiler_options |= RXP_COMPILER_OPTIONS_INCREMENTAL;
-	if (rofi_for_incremental_compile)
-		compiler_options |= RXP_COMPILER_OPTIONS_CHECKSUM;
-
-	for (i = 0; i < nb_rules; i++) {
-		ruleset.rules[i].number_of_prefix_entries = 0;
-		ruleset.rules[i].prefix = NULL;
-		ruleset.rules[i].rule = rules[i].pcre_rule;
-		ruleset.rules[i].rule_id = rules[i].rule_id;
-		ruleset.rules[i].subset_id = rules[i].group_id;
-		ruleset.rules[i].rule_direction_type =
-				RXP_RULE_DIRECTION_TYPE_NONE;
-	}
-
-	ret = rxp_compile_advanced(
-			/*INPUT*/
-			&ruleset,
-			prefix_selection_control_list,
-			rof_for_incremental_compile,
-			roff_for_incremental_compile,
-			rofi_for_incremental_compile,
-			rule_ids_to_remove,
-			blacklist_sample_data,
-
-			/*OPTIONS*/
-			compiler_options,
-			prefix_capacity,
-			global_regex_options,
-			set_auto_blacklist,
-			set_max,
-			objective,
-			ptpb_threshold,
-			max_rep_max,
-			threads,
-			set_rxp_version,
-			verbose,
-			tpe_data_width,
-			virtual_prefix_mode,
-			compiler_output_flags,
-			divide_ruleset,
-
-			/*OUTPUT*/
-			&compilation_statistics,
-			&compiled_rules_log,
-			&critical_rules_rank,
-			&rule_direction_analysis,
-			&uncompiled_rules_log,
-			rof,
-			&roff,
-			rofi,
-			&generated_pscl);
-	rte_free(ruleset.rules);
-
-	return ret;
-}
-
-int
-cn9k_ree_rule_db_compile_prog(struct rte_regexdev *dev)
-{
-	struct cn9k_ree_data *data = dev->data->dev_private;
-	struct roc_ree_vf *vf = &data->vf;
-	char compiler_version[] = "20.5.2.eda0fa2";
-	char timestamp[] = "19700101_000001";
-	uint32_t rule_db_len, rule_dbi_len;
-	struct rxp_rof *rofi_inc_p = NULL;
-	struct rxp_rof_entry rule_dbi[6];
-	char *rofi_rof_entries = NULL;
-	struct rxp_rof *rofi = NULL;
-	struct rxp_rof *rof = NULL;
-	struct rxp_rof rofi_inc;
-	struct rxp_rof rof_inc;
-	char *rule_db = NULL;
-	int ret;
-
-	ree_func_trace();
-
-	ret = roc_ree_rule_db_len_get(vf, &rule_db_len, &rule_dbi_len);
-	if (ret != 0) {
-		cn9k_err("Could not get rule db length");
-		return ret;
-	}
-
-	if (rule_db_len > 0) {
-		cn9k_ree_dbg("Incremental compile, rule db len %d rule dbi len %d",
-				rule_db_len, rule_dbi_len);
-		rule_db = rte_malloc("ree_rule_db", rule_db_len, 0);
-		if (!rule_db) {
-			cn9k_err("Could not allocate memory for rule db");
-			return -EFAULT;
-		}
-
-		ret = roc_ree_rule_db_get(vf, rule_db, rule_db_len,
-				(char *)rule_dbi, rule_dbi_len);
-		if (ret) {
-			cn9k_err("Could not read rule db");
-			rte_free(rule_db);
-			return -EFAULT;
-		}
-		rof_inc.rof_revision = 0;
-		rof_inc.rof_version = 2;
-		rof_inc.rof_entries = (struct rxp_rof_entry *)rule_db;
-		rof_inc.rxp_compiler_version = compiler_version;
-		rof_inc.timestamp = timestamp;
-		rof_inc.number_of_entries =
-				(rule_db_len/sizeof(struct rxp_rof_entry));
-
-		if (rule_dbi_len > 0) {
-			/* incremental compilation not the first time */
-			rofi_inc.rof_revision = 0;
-			rofi_inc.rof_version = 2;
-			rofi_inc.rof_entries = rule_dbi;
-			rofi_inc.rxp_compiler_version = compiler_version;
-			rofi_inc.timestamp = timestamp;
-			rofi_inc.number_of_entries =
-				(rule_dbi_len/sizeof(struct rxp_rof_entry));
-			rofi_inc_p = &rofi_inc;
-		}
-		ret = ree_rule_db_compile(data->rules, data->nb_rules, &rof,
-				&rofi, &rof_inc, rofi_inc_p);
-		if (rofi->number_of_entries == 0) {
-			cn9k_ree_dbg("No change to rule db");
-			ret = 0;
-			goto free_structs;
-		}
-		rule_dbi_len = rofi->number_of_entries *
-				sizeof(struct rxp_rof_entry);
-		rofi_rof_entries = (char *)rofi->rof_entries;
-	} else {
-		/* full compilation */
-		ret = ree_rule_db_compile(data->rules, data->nb_rules, &rof,
-				&rofi, NULL, NULL);
-	}
-	if (ret != 0) {
-		cn9k_err("Could not compile rule db");
-		goto free_structs;
-	}
-	rule_db_len = rof->number_of_entries * sizeof(struct rxp_rof_entry);
-	ret = roc_ree_rule_db_prog(vf, (char *)rof->rof_entries, rule_db_len,
-			rofi_rof_entries, rule_dbi_len);
-	if (ret)
-		cn9k_err("Could not program rule db");
-
-free_structs:
-	rxp_free_structs(NULL, NULL, NULL, NULL, NULL, &rof, NULL, &rofi, NULL,
-			1);
-
-	rte_free(rule_db);
-
-	return ret;
-}
-#else
-int
-cn9k_ree_rule_db_compile_prog(struct rte_regexdev *dev)
-{
-	RTE_SET_USED(dev);
-	return -ENOTSUP;
-}
-#endif
diff --git a/drivers/regex/cn9k/cn9k_regexdev_compiler.h b/drivers/regex/cn9k/cn9k_regexdev_compiler.h
deleted file mode 100644
index 4c29a69ada..0000000000
--- a/drivers/regex/cn9k/cn9k_regexdev_compiler.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (C) 2020 Marvell International Ltd.
- */
-
-#ifndef _CN9K_REGEXDEV_COMPILER_H_
-#define _CN9K_REGEXDEV_COMPILER_H_
-
-int
-cn9k_ree_rule_db_compile_prog(struct rte_regexdev *dev);
-
-#endif /* _CN9K_REGEXDEV_COMPILER_H_ */
diff --git a/drivers/regex/cn9k/meson.build b/drivers/regex/cn9k/meson.build
index 19b2e70111..44b12b9845 100644
--- a/drivers/regex/cn9k/meson.build
+++ b/drivers/regex/cn9k/meson.build
@@ -8,16 +8,8 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
     subdir_done()
 endif
 
-lib = cc.find_library('rxp_compiler', required: false)
-if lib.found()
-    ext_deps += lib
-    ext_deps += cc.find_library('stdc++', required: true)
-    cflags += ['-DREE_COMPILER_SDK']
-endif
-
 sources = files(
         'cn9k_regexdev.c',
-        'cn9k_regexdev_compiler.c',
 )
 
 deps += ['bus_pci', 'regexdev']
-- 
2.41.0


             reply	other threads:[~2023-06-21 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 14:06 Thomas Monjalon [this message]
2023-06-21 15:33 ` Jerin Jacob
2023-06-25 20:57   ` Stephen Hemminger
2023-06-26  7:16     ` Thomas Monjalon
2023-06-26 16:22       ` Stephen Hemminger
2023-06-26 16:43         ` Thomas Monjalon
2023-06-26 17:11           ` Stephen Hemminger
2023-07-03 14:59   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230621140637.657038-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=lironh@marvell.com \
    --cc=orika@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).