[dpdk-dev,v2,1/4] librte_table: modify LPM table parameter structure
Commit Message
This patch relates to ABI change proposed for librte_table
(lpm table). A new parameter to hold the table name has
been added to the LPM table parameter structures
rte_table_lpm_params and rte_table_lpm_ipv6_params.
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
lib/librte_table/rte_table_lpm.c | 8 ++++++--
lib/librte_table/rte_table_lpm.h | 3 +++
lib/librte_table/rte_table_lpm_ipv6.c | 8 ++++++--
lib/librte_table/rte_table_lpm_ipv6.h | 3 +++
4 files changed, 18 insertions(+), 4 deletions(-)
@@ -103,7 +103,11 @@ rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size)
__func__);
return NULL;
}
-
+ if (p->name == NULL) {
+ RTE_LOG(ERR, TABLE, "%s: Table name is NULL\n",
+ __func__);
+ return NULL;
+ }
entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t));
/* Memory allocation */
@@ -119,7 +123,7 @@ rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size)
}
/* LPM low-level table creation */
- lpm->lpm = rte_lpm_create("LPM", socket_id, p->n_rules, 0);
+ lpm->lpm = rte_lpm_create(p->name, socket_id, p->n_rules, 0);
if (lpm->lpm == NULL) {
rte_free(lpm);
RTE_LOG(ERR, TABLE, "Unable to create low-level LPM table\n");
@@ -77,6 +77,9 @@ extern "C" {
/** LPM table parameters */
struct rte_table_lpm_params {
+ /** Table name */
+ const char *name;
+
/** Maximum number of LPM rules (i.e. IP routes) */
uint32_t n_rules;
@@ -109,7 +109,11 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size)
__func__);
return NULL;
}
-
+ if (p->name == NULL) {
+ RTE_LOG(ERR, TABLE, "%s: Table name is NULL\n",
+ __func__);
+ return NULL;
+ }
entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t));
/* Memory allocation */
@@ -128,7 +132,7 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size)
lpm6_config.max_rules = p->n_rules;
lpm6_config.number_tbl8s = p->number_tbl8s;
lpm6_config.flags = 0;
- lpm->lpm = rte_lpm6_create("LPM IPv6", socket_id, &lpm6_config);
+ lpm->lpm = rte_lpm6_create(p->name, socket_id, &lpm6_config);
if (lpm->lpm == NULL) {
rte_free(lpm);
RTE_LOG(ERR, TABLE,
@@ -79,6 +79,9 @@ extern "C" {
/** LPM table parameters */
struct rte_table_lpm_ipv6_params {
+ /** Table name */
+ const char *name;
+
/** Maximum number of LPM rules (i.e. IP routes) */
uint32_t n_rules;