DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <orika@nvidia.com>, <thomas@monjalon.net>,
	<ivan.malov@oktetlabs.ru>, <andrew.rybchenko@oktetlabs.ru>,
	<ferruh.yigit@intel.com>, <mohammad.abdul.awal@intel.com>,
	<qi.z.zhang@intel.com>, <jerinj@marvell.com>,
	<ajit.khaparde@broadcom.com>
Subject: [PATCH v3 06/10] app/testpmd: implement rte flow table management
Date: Sun, 6 Feb 2022 05:25:22 +0200	[thread overview]
Message-ID: <20220206032526.816079-7-akozyrev@nvidia.com> (raw)
In-Reply-To: <20220206032526.816079-1-akozyrev@nvidia.com>

Add testpmd support for the rte_flow_table API.
Provide the command line interface for the flow
table creation/destruction. Usage example:
  testpmd> flow table 0 create table_id 6
    group 9 priority 4 ingress mode 1
    rules_number 64 pattern_template 2 actions_template 4
  testpmd> flow table 0 destroy table 6

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-pmd/cmdline_flow.c                 | 315 ++++++++++++++++++++
 app/test-pmd/config.c                       | 170 +++++++++++
 app/test-pmd/testpmd.h                      |  17 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  53 ++++
 4 files changed, 555 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 3f0e73743a..75bd128e68 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -58,6 +58,7 @@ enum index {
 	COMMON_FLEX_TOKEN,
 	COMMON_PATTERN_TEMPLATE_ID,
 	COMMON_ACTIONS_TEMPLATE_ID,
+	COMMON_TABLE_ID,
 
 	/* TOP-level command. */
 	ADD,
@@ -78,6 +79,7 @@ enum index {
 	CONFIGURE,
 	PATTERN_TEMPLATE,
 	ACTIONS_TEMPLATE,
+	TABLE,
 	INDIRECT_ACTION,
 	VALIDATE,
 	CREATE,
@@ -112,6 +114,20 @@ enum index {
 	ACTIONS_TEMPLATE_SPEC,
 	ACTIONS_TEMPLATE_MASK,
 
+	/* Table arguments. */
+	TABLE_CREATE,
+	TABLE_DESTROY,
+	TABLE_CREATE_ID,
+	TABLE_DESTROY_ID,
+	TABLE_GROUP,
+	TABLE_PRIORITY,
+	TABLE_INGRESS,
+	TABLE_EGRESS,
+	TABLE_TRANSFER,
+	TABLE_RULES_NUMBER,
+	TABLE_PATTERN_TEMPLATE,
+	TABLE_ACTIONS_TEMPLATE,
+
 	/* Tunnel arguments. */
 	TUNNEL_CREATE,
 	TUNNEL_CREATE_TYPE,
@@ -884,6 +900,18 @@ struct buffer {
 			uint32_t *template_id;
 			uint32_t template_id_n;
 		} templ_destroy; /**< Template destroy arguments. */
+		struct {
+			uint32_t id;
+			struct rte_flow_table_attr attr;
+			uint32_t *pat_templ_id;
+			uint32_t pat_templ_id_n;
+			uint32_t *act_templ_id;
+			uint32_t act_templ_id_n;
+		} table; /**< Table arguments. */
+		struct {
+			uint32_t *table_id;
+			uint32_t table_id_n;
+		} table_destroy; /**< Template destroy arguments. */
 		struct {
 			uint32_t *action_id;
 			uint32_t action_id_n;
@@ -1015,6 +1043,32 @@ static const enum index next_at_destroy_attr[] = {
 	ZERO,
 };
 
+static const enum index next_table_subcmd[] = {
+	TABLE_CREATE,
+	TABLE_DESTROY,
+	ZERO,
+};
+
+static const enum index next_table_attr[] = {
+	TABLE_CREATE_ID,
+	TABLE_GROUP,
+	TABLE_PRIORITY,
+	TABLE_INGRESS,
+	TABLE_EGRESS,
+	TABLE_TRANSFER,
+	TABLE_RULES_NUMBER,
+	TABLE_PATTERN_TEMPLATE,
+	TABLE_ACTIONS_TEMPLATE,
+	END,
+	ZERO,
+};
+
+static const enum index next_table_destroy_attr[] = {
+	TABLE_DESTROY_ID,
+	END,
+	ZERO,
+};
+
 static const enum index next_ia_create_attr[] = {
 	INDIRECT_ACTION_CREATE_ID,
 	INDIRECT_ACTION_INGRESS,
@@ -2059,6 +2113,11 @@ static int parse_template(struct context *, const struct token *,
 static int parse_template_destroy(struct context *, const struct token *,
 				  const char *, unsigned int,
 				  void *, unsigned int);
+static int parse_table(struct context *, const struct token *,
+		       const char *, unsigned int, void *, unsigned int);
+static int parse_table_destroy(struct context *, const struct token *,
+			       const char *, unsigned int,
+			       void *, unsigned int);
 static int parse_tunnel(struct context *, const struct token *,
 			const char *, unsigned int,
 			void *, unsigned int);
@@ -2132,6 +2191,8 @@ static int comp_pattern_template_id(struct context *, const struct token *,
 				    unsigned int, char *, unsigned int);
 static int comp_actions_template_id(struct context *, const struct token *,
 				    unsigned int, char *, unsigned int);
+static int comp_table_id(struct context *, const struct token *,
+			 unsigned int, char *, unsigned int);
 
 /** Token definitions. */
 static const struct token token_list[] = {
@@ -2296,6 +2357,13 @@ static const struct token token_list[] = {
 		.call = parse_int,
 		.comp = comp_actions_template_id,
 	},
+	[COMMON_TABLE_ID] = {
+		.name = "{table_id}",
+		.type = "TABLE_ID",
+		.help = "table id",
+		.call = parse_int,
+		.comp = comp_table_id,
+	},
 	/* Top-level command. */
 	[FLOW] = {
 		.name = "flow",
@@ -2306,6 +2374,7 @@ static const struct token token_list[] = {
 			      CONFIGURE,
 			      PATTERN_TEMPLATE,
 			      ACTIONS_TEMPLATE,
+			      TABLE,
 			      INDIRECT_ACTION,
 			      VALIDATE,
 			      CREATE,
@@ -2486,6 +2555,104 @@ static const struct token token_list[] = {
 		.call = parse_template,
 	},
 	/* Top-level command. */
+	[TABLE] = {
+		.name = "table",
+		.type = "{command} {port_id} [{arg} [...]]",
+		.help = "manage tables",
+		.next = NEXT(next_table_subcmd, NEXT_ENTRY(COMMON_PORT_ID)),
+		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
+		.call = parse_table,
+	},
+	/* Sub-level commands. */
+	[TABLE_CREATE] = {
+		.name = "create",
+		.help = "create table",
+		.next = NEXT(next_table_attr),
+		.call = parse_table,
+	},
+	[TABLE_DESTROY] = {
+		.name = "destroy",
+		.help = "destroy table",
+		.next = NEXT(NEXT_ENTRY(TABLE_DESTROY_ID)),
+		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
+		.call = parse_table_destroy,
+	},
+	/* Table  arguments. */
+	[TABLE_CREATE_ID] = {
+		.name = "table_id",
+		.help = "specify table id to create",
+		.next = NEXT(next_table_attr,
+			     NEXT_ENTRY(COMMON_TABLE_ID)),
+		.args = ARGS(ARGS_ENTRY(struct buffer, args.table.id)),
+	},
+	[TABLE_DESTROY_ID] = {
+		.name = "table",
+		.help = "specify table id to destroy",
+		.next = NEXT(next_table_destroy_attr,
+			     NEXT_ENTRY(COMMON_TABLE_ID)),
+		.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
+					    args.table_destroy.table_id)),
+		.call = parse_table_destroy,
+	},
+	[TABLE_GROUP] = {
+		.name = "group",
+		.help = "specify a group",
+		.next = NEXT(next_table_attr, NEXT_ENTRY(COMMON_GROUP_ID)),
+		.args = ARGS(ARGS_ENTRY(struct buffer,
+					args.table.attr.flow_attr.group)),
+	},
+	[TABLE_PRIORITY] = {
+		.name = "priority",
+		.help = "specify a priority level",
+		.next = NEXT(next_table_attr, NEXT_ENTRY(COMMON_PRIORITY_LEVEL)),
+		.args = ARGS(ARGS_ENTRY(struct buffer,
+					args.table.attr.flow_attr.priority)),
+	},
+	[TABLE_EGRESS] = {
+		.name = "egress",
+		.help = "affect rule to egress",
+		.next = NEXT(next_table_attr),
+		.call = parse_table,
+	},
+	[TABLE_INGRESS] = {
+		.name = "ingress",
+		.help = "affect rule to ingress",
+		.next = NEXT(next_table_attr),
+		.call = parse_table,
+	},
+	[TABLE_TRANSFER] = {
+		.name = "transfer",
+		.help = "affect rule to transfer",
+		.next = NEXT(next_table_attr),
+		.call = parse_table,
+	},
+	[TABLE_RULES_NUMBER] = {
+		.name = "rules_number",
+		.help = "number of rules in table",
+		.next = NEXT(next_table_attr,
+			     NEXT_ENTRY(COMMON_UNSIGNED)),
+		.args = ARGS(ARGS_ENTRY(struct buffer,
+					args.table.attr.nb_flows)),
+	},
+	[TABLE_PATTERN_TEMPLATE] = {
+		.name = "pattern_template",
+		.help = "specify pattern template id",
+		.next = NEXT(next_table_attr,
+			     NEXT_ENTRY(COMMON_PATTERN_TEMPLATE_ID)),
+		.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
+					    args.table.pat_templ_id)),
+		.call = parse_table,
+	},
+	[TABLE_ACTIONS_TEMPLATE] = {
+		.name = "actions_template",
+		.help = "specify actions template id",
+		.next = NEXT(next_table_attr,
+			     NEXT_ENTRY(COMMON_ACTIONS_TEMPLATE_ID)),
+		.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
+					    args.table.act_templ_id)),
+		.call = parse_table,
+	},
+	/* Top-level command. */
 	[INDIRECT_ACTION] = {
 		.name = "indirect_action",
 		.type = "{command} {port_id} [{arg} [...]]",
@@ -7886,6 +8053,119 @@ parse_template_destroy(struct context *ctx, const struct token *token,
 	return len;
 }
 
+/** Parse tokens for table create command. */
+static int
+parse_table(struct context *ctx, const struct token *token,
+	    const char *str, unsigned int len,
+	    void *buf, unsigned int size)
+{
+	struct buffer *out = buf;
+	uint32_t *template_id;
+
+	/* Token name must match. */
+	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
+		return -1;
+	/* Nothing else to do if there is no buffer. */
+	if (!out)
+		return len;
+	if (!out->command) {
+		if (ctx->curr != TABLE)
+			return -1;
+		if (sizeof(*out) > size)
+			return -1;
+		out->command = ctx->curr;
+		ctx->objdata = 0;
+		ctx->object = out;
+		ctx->objmask = NULL;
+		return len;
+	}
+	switch (ctx->curr) {
+	case TABLE_CREATE:
+		out->command = ctx->curr;
+		ctx->objdata = 0;
+		ctx->object = out;
+		ctx->objmask = NULL;
+		out->args.table.id = UINT32_MAX;
+		return len;
+	case TABLE_PATTERN_TEMPLATE:
+		out->args.table.pat_templ_id =
+			(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
+					       sizeof(double));
+		template_id = out->args.table.pat_templ_id
+				+ out->args.table.pat_templ_id_n++;
+		if ((uint8_t *)template_id > (uint8_t *)out + size)
+			return -1;
+		ctx->objdata = 0;
+		ctx->object = template_id;
+		ctx->objmask = NULL;
+		return len;
+	case TABLE_ACTIONS_TEMPLATE:
+		out->args.table.act_templ_id =
+			(void *)RTE_ALIGN_CEIL((uintptr_t)
+					       (out->args.table.pat_templ_id +
+						out->args.table.pat_templ_id_n),
+					       sizeof(double));
+		template_id = out->args.table.act_templ_id
+				+ out->args.table.act_templ_id_n++;
+		if ((uint8_t *)template_id > (uint8_t *)out + size)
+			return -1;
+		ctx->objdata = 0;
+		ctx->object = template_id;
+		ctx->objmask = NULL;
+		return len;
+	case TABLE_INGRESS:
+		out->args.table.attr.flow_attr.ingress = 1;
+		return len;
+	case TABLE_EGRESS:
+		out->args.table.attr.flow_attr.egress = 1;
+		return len;
+	case TABLE_TRANSFER:
+		out->args.table.attr.flow_attr.transfer = 1;
+		return len;
+	default:
+		return -1;
+	}
+}
+
+/** Parse tokens for table destroy command. */
+static int
+parse_table_destroy(struct context *ctx, const struct token *token,
+		    const char *str, unsigned int len,
+		    void *buf, unsigned int size)
+{
+	struct buffer *out = buf;
+	uint32_t *table_id;
+
+	/* Token name must match. */
+	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
+		return -1;
+	/* Nothing else to do if there is no buffer. */
+	if (!out)
+		return len;
+	if (!out->command || out->command == TABLE) {
+		if (ctx->curr != TABLE_DESTROY)
+			return -1;
+		if (sizeof(*out) > size)
+			return -1;
+		out->command = ctx->curr;
+		ctx->objdata = 0;
+		ctx->object = out;
+		ctx->objmask = NULL;
+		out->args.table_destroy.table_id =
+			(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
+					       sizeof(double));
+		return len;
+	}
+	table_id = out->args.table_destroy.table_id
+		    + out->args.table_destroy.table_id_n++;
+	if ((uint8_t *)table_id > (uint8_t *)out + size)
+		return -1;
+	ctx->objdata = 0;
+	ctx->object = table_id;
+	ctx->objmask = NULL;
+	return len;
+}
+
 static int
 parse_flex(struct context *ctx, const struct token *token,
 	     const char *str, unsigned int len,
@@ -8903,6 +9183,30 @@ comp_actions_template_id(struct context *ctx, const struct token *token,
 	return i;
 }
 
+/** Complete available table IDs. */
+static int
+comp_table_id(struct context *ctx, const struct token *token,
+	      unsigned int ent, char *buf, unsigned int size)
+{
+	unsigned int i = 0;
+	struct rte_port *port;
+	struct port_table *pt;
+
+	(void)token;
+	if (port_id_is_invalid(ctx->port, DISABLED_WARN) ||
+	    ctx->port == (portid_t)RTE_PORT_ALL)
+		return -1;
+	port = &ports[ctx->port];
+	for (pt = port->table_list; pt != NULL; pt = pt->next) {
+		if (buf && i == ent)
+			return snprintf(buf, size, "%u", pt->id);
+		++i;
+	}
+	if (buf)
+		return -1;
+	return i;
+}
+
 /** Internal context. */
 static struct context cmd_flow_context;
 
@@ -9189,6 +9493,17 @@ cmd_flow_parsed(const struct buffer *in)
 				in->args.templ_destroy.template_id_n,
 				in->args.templ_destroy.template_id);
 		break;
+	case TABLE_CREATE:
+		port_flow_table_create(in->port, in->args.table.id,
+			&in->args.table.attr, in->args.table.pat_templ_id_n,
+			in->args.table.pat_templ_id, in->args.table.act_templ_id_n,
+			in->args.table.act_templ_id);
+		break;
+	case TABLE_DESTROY:
+		port_flow_table_destroy(in->port,
+					in->args.table_destroy.table_id_n,
+					in->args.table_destroy.table_id);
+		break;
 	case INDIRECT_ACTION_CREATE:
 		port_action_handle_create(
 				in->port, in->args.vc.attr.group,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index adc77169af..126bead03e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1638,6 +1638,49 @@ template_alloc(uint32_t id, struct port_template **template,
 	return 0;
 }
 
+static int
+table_alloc(uint32_t id, struct port_table **table,
+	    struct port_table **list)
+{
+	struct port_table *lst = *list;
+	struct port_table **ppt;
+	struct port_table *pt = NULL;
+
+	*table = NULL;
+	if (id == UINT32_MAX) {
+		/* taking first available ID */
+		if (lst) {
+			if (lst->id == UINT32_MAX - 1) {
+				printf("Highest table ID is already"
+				" assigned, delete it first\n");
+				return -ENOMEM;
+			}
+			id = lst->id + 1;
+		} else {
+			id = 0;
+		}
+	}
+	pt = calloc(1, sizeof(*pt));
+	if (!pt) {
+		printf("Allocation of table failed\n");
+		return -ENOMEM;
+	}
+	ppt = list;
+	while (*ppt && (*ppt)->id > id)
+		ppt = &(*ppt)->next;
+	if (*ppt && (*ppt)->id == id) {
+		printf("Table #%u is already assigned,"
+			" delete it first\n", id);
+		free(pt);
+		return -EINVAL;
+	}
+	pt->next = *ppt;
+	pt->id = id;
+	*ppt = pt;
+	*table = pt;
+	return 0;
+}
+
 /** Get info about flow management resources. */
 int
 port_flow_get_info(portid_t port_id)
@@ -2267,6 +2310,133 @@ port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
 	return ret;
 }
 
+/** Create table */
+int
+port_flow_table_create(portid_t port_id, uint32_t id,
+		       const struct rte_flow_table_attr *table_attr,
+		       uint32_t nb_pattern_templates, uint32_t *pattern_templates,
+		       uint32_t nb_actions_templates, uint32_t *actions_templates)
+{
+	struct rte_port *port;
+	struct port_table *pt;
+	struct port_template *temp = NULL;
+	int ret;
+	uint32_t i;
+	struct rte_flow_error error;
+	struct rte_flow_pattern_template
+			*flow_pattern_templates[nb_pattern_templates];
+	struct rte_flow_actions_template
+			*flow_actions_templates[nb_actions_templates];
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+	    port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+	port = &ports[port_id];
+	for (i = 0; i < nb_pattern_templates; ++i) {
+		bool found = false;
+		temp = port->pattern_templ_list;
+		while (temp) {
+			if (pattern_templates[i] == temp->id) {
+				flow_pattern_templates[i] = temp->template.pattern_template;
+				found = true;
+				break;
+			}
+			temp = temp->next;
+		}
+		if (!found) {
+			printf("Pattern template #%u is invalid\n",
+			       pattern_templates[i]);
+			return -EINVAL;
+		}
+	}
+	for (i = 0; i < nb_actions_templates; ++i) {
+		bool found = false;
+		temp = port->actions_templ_list;
+		while (temp) {
+			if (actions_templates[i] == temp->id) {
+				flow_actions_templates[i] =
+					temp->template.actions_template;
+				found = true;
+				break;
+			}
+			temp = temp->next;
+		}
+		if (!found) {
+			printf("Actions template #%u is invalid\n",
+			       actions_templates[i]);
+			return -EINVAL;
+		}
+	}
+	ret = table_alloc(id, &pt, &port->table_list);
+	if (ret)
+		return ret;
+	/* Poisoning to make sure PMDs update it in case of error. */
+	memset(&error, 0x22, sizeof(error));
+	pt->table = rte_flow_table_create(port_id, table_attr,
+		      flow_pattern_templates, nb_pattern_templates,
+		      flow_actions_templates, nb_actions_templates,
+		      &error);
+
+	if (!pt->table) {
+		uint32_t destroy_id = pt->id;
+		port_flow_table_destroy(port_id, 1, &destroy_id);
+		return port_flow_complain(&error);
+	}
+	pt->nb_pattern_templates = nb_pattern_templates;
+	pt->nb_actions_templates = nb_actions_templates;
+	printf("Table #%u created\n", pt->id);
+	return 0;
+}
+
+/** Destroy table */
+int
+port_flow_table_destroy(portid_t port_id,
+			uint32_t n, const uint32_t *table)
+{
+	struct rte_port *port;
+	struct port_table **tmp;
+	uint32_t c = 0;
+	int ret = 0;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+	    port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+	port = &ports[port_id];
+	tmp = &port->table_list;
+	while (*tmp) {
+		uint32_t i;
+
+		for (i = 0; i != n; ++i) {
+			struct rte_flow_error error;
+			struct port_table *pt = *tmp;
+
+			if (table[i] != pt->id)
+				continue;
+			/*
+			 * Poisoning to make sure PMDs update it in case
+			 * of error.
+			 */
+			memset(&error, 0x33, sizeof(error));
+
+			if (pt->table &&
+			    rte_flow_table_destroy(port_id,
+						   pt->table,
+						   &error)) {
+				ret = port_flow_complain(&error);
+				continue;
+			}
+			*tmp = pt->next;
+			printf("Table #%u destroyed\n", pt->id);
+			free(pt);
+			break;
+		}
+		if (i == n)
+			tmp = &(*tmp)->next;
+		++c;
+	}
+	return ret;
+}
+
 /** Create flow rule. */
 int
 port_flow_create(portid_t port_id,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c70b1fa4e8..4d85dfdaf6 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -177,6 +177,16 @@ struct port_template {
 	} template; /**< PMD opaque template object */
 };
 
+/** Descriptor for a flow table. */
+struct port_table {
+	struct port_table *next; /**< Next table in list. */
+	struct port_table *tmp; /**< Temporary linking. */
+	uint32_t id; /**< Table ID. */
+	uint32_t nb_pattern_templates; /**< Number of pattern templates. */
+	uint32_t nb_actions_templates; /**< Number of actions templates. */
+	struct rte_flow_table *table; /**< PMD opaque template object */
+};
+
 /** Descriptor for a single flow. */
 struct port_flow {
 	struct port_flow *next; /**< Next flow in list. */
@@ -259,6 +269,7 @@ struct rte_port {
 	uint8_t                 slave_flag; /**< bonding slave port */
 	struct port_template    *pattern_templ_list; /**< Pattern templates. */
 	struct port_template    *actions_templ_list; /**< Actions templates. */
+	struct port_table       *table_list; /**< Flow tables. */
 	struct port_flow        *flow_list; /**< Associated flows. */
 	struct port_indirect_action *actions_list;
 	/**< Associated indirect actions. */
@@ -915,6 +926,12 @@ int port_flow_actions_template_create(portid_t port_id, uint32_t id,
 				      const struct rte_flow_action *masks);
 int port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
 				       const uint32_t *template);
+int port_flow_table_create(portid_t port_id, uint32_t id,
+		   const struct rte_flow_table_attr *table_attr,
+		   uint32_t nb_pattern_templates, uint32_t *pattern_templates,
+		   uint32_t nb_actions_templates, uint32_t *actions_templates);
+int port_flow_table_destroy(portid_t port_id,
+			    uint32_t n, const uint32_t *table);
 int port_flow_validate(portid_t port_id,
 		       const struct rte_flow_attr *attr,
 		       const struct rte_flow_item *pattern,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 56e821ec5c..cfa9aecdba 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3339,6 +3339,19 @@ following sections.
 
    flow actions_template {port_id} destroy actions_template {id} [...]
 
+- Create a table::
+
+   flow table {port_id} create
+       [table_id {id}]
+       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
+       rules_number {number}
+       pattern_template {pattern_template_id}
+       actions_template {actions_template_id}
+
+- Destroy a table::
+
+   flow table {port_id} destroy table {id} [...]
+
 - Check whether a flow rule can be created::
 
    flow validate {port_id}
@@ -3520,6 +3533,46 @@ The usual error message is shown when an actions template cannot be destroyed::
 
    Caught error type [...] ([...]): [...]
 
+Creating flow table
+~~~~~~~~~~~~~~~~~~~
+
+``flow table create`` creates the specified flow table.
+It is bound to ``rte_flow_table_create()``::
+
+   flow table {port_id} create
+       [table_id {id}] [group {group_id}]
+       [priority {level}] [ingress] [egress] [transfer]
+       rules_number {number}
+       pattern_template {pattern_template_id}
+       actions_template {actions_template_id}
+
+If successful, it will show::
+
+   Table #[...] created
+
+Otherwise it will show an error message of the form::
+
+   Caught error type [...] ([...]): [...]
+
+Destroying flow table
+~~~~~~~~~~~~~~~~~~~~~
+
+``flow table destroy`` destroys one or more flow tables
+from their table ID (as returned by ``flow table create``),
+this command calls ``rte_flow_table_destroy()`` as many
+times as necessary::
+
+   flow table {port_id} destroy table {id} [...]
+
+If successful, it will show::
+
+   Table #[...] destroyed
+
+It does not report anything for table IDs that do not exist.
+The usual error message is shown when a table cannot be destroyed::
+
+   Caught error type [...] ([...]): [...]
+
 Creating a tunnel stub for offload
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.18.2


  parent reply	other threads:[~2022-02-06  3:26 UTC|newest]

Thread overview: 218+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06  4:48 [dpdk-dev] [RFC 0/3] ethdev: datapath-focused flow rules management Alexander Kozyrev
2021-10-06  4:48 ` [dpdk-dev] [PATCH 1/3] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2021-10-13  4:11   ` Ajit Khaparde
2021-10-13 13:15     ` Ori Kam
2021-10-31 17:27       ` Ajit Khaparde
2021-11-01 10:40         ` Ori Kam
2021-10-06  4:48 ` [dpdk-dev] [PATCH 2/3] ethdev: add flow item/action templates Alexander Kozyrev
2021-10-06 17:24   ` Ivan Malov
2021-10-13  1:25     ` Alexander Kozyrev
2021-10-13  2:26       ` Ajit Khaparde
2021-10-13  2:38         ` Alexander Kozyrev
2021-10-13 11:25       ` Ivan Malov
2021-10-06  4:48 ` [dpdk-dev] [PATCH 3/3] ethdev: add async queue-based flow rules operations Alexander Kozyrev
2021-10-06 16:24   ` Ivan Malov
2021-10-13  1:10     ` Alexander Kozyrev
2021-10-13  4:57   ` Ajit Khaparde
2021-10-13 13:17     ` Ori Kam
2022-01-18 15:30 ` [PATCH v2 00/10] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-01-18 15:30   ` [PATCH v2 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-01-24 14:36     ` Jerin Jacob
2022-01-24 17:35       ` Thomas Monjalon
2022-01-24 17:46         ` Jerin Jacob
2022-01-24 18:08           ` Bruce Richardson
2022-01-25  1:14             ` Alexander Kozyrev
2022-01-25 15:58             ` Ori Kam
2022-01-25 18:09               ` Bruce Richardson
2022-01-25 18:14                 ` Bruce Richardson
2022-01-26  9:45                   ` Ori Kam
2022-01-26 10:52                     ` Bruce Richardson
2022-01-26 11:21                       ` Thomas Monjalon
2022-01-26 12:19                         ` Ori Kam
2022-01-26 13:41                           ` Bruce Richardson
2022-01-26 15:12                             ` Ori Kam
2022-01-24 17:40       ` Ajit Khaparde
2022-01-25  1:28         ` Alexander Kozyrev
2022-01-25 18:44           ` Jerin Jacob
2022-01-26 22:02             ` Alexander Kozyrev
2022-01-27  9:34               ` Jerin Jacob
2022-01-18 15:30   ` [PATCH v2 02/10] ethdev: add flow item/action templates Alexander Kozyrev
2022-01-18 15:30   ` [PATCH v2 03/10] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-01-18 15:30   ` [PATCH v2 04/10] app/testpmd: implement rte flow configure Alexander Kozyrev
2022-01-18 15:33   ` [v2,05/10] app/testpmd: implement rte flow item/action template Alexander Kozyrev
2022-01-18 15:34   ` [v2,06/10] app/testpmd: implement rte flow table Alexander Kozyrev
2022-01-18 15:35   ` [v2,07/10] app/testpmd: implement rte flow queue create flow Alexander Kozyrev
2022-01-18 15:35   ` [v2,08/10] app/testpmd: implement rte flow queue drain Alexander Kozyrev
2022-01-18 15:36   ` [v2,09/10] app/testpmd: implement rte flow queue dequeue Alexander Kozyrev
2022-01-18 15:37   ` [v2,10/10] app/testpmd: implement rte flow queue indirect action Alexander Kozyrev
2022-01-19  7:16   ` [PATCH v2 00/10] ethdev: datapath-focused flow rules management Suanming Mou
2022-01-24 15:10     ` Ori Kam
2022-02-06  3:25   ` [PATCH v3 " Alexander Kozyrev
2022-02-06  3:25     ` [PATCH v3 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-02-07 13:15       ` Ori Kam
2022-02-07 14:52       ` Jerin Jacob
2022-02-07 17:59         ` Alexander Kozyrev
2022-02-07 18:24           ` Jerin Jacob
2022-02-06  3:25     ` [PATCH v3 02/10] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-07 13:16       ` Ori Kam
2022-02-06  3:25     ` [PATCH v3 03/10] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-07 13:18       ` Ori Kam
2022-02-08 10:56       ` Jerin Jacob
2022-02-08 14:11         ` Alexander Kozyrev
2022-02-08 15:23           ` Ivan Malov
2022-02-09  5:40             ` Alexander Kozyrev
2022-02-08 17:36           ` Jerin Jacob
2022-02-09  5:50           ` Jerin Jacob
2022-02-06  3:25     ` [PATCH v3 04/10] app/testpmd: implement rte flow configuration Alexander Kozyrev
2022-02-07 13:19       ` Ori Kam
2022-02-06  3:25     ` [PATCH v3 05/10] app/testpmd: implement rte flow template management Alexander Kozyrev
2022-02-07 13:20       ` Ori Kam
2022-02-06  3:25     ` Alexander Kozyrev [this message]
2022-02-07 13:22       ` [PATCH v3 06/10] app/testpmd: implement rte flow table management Ori Kam
2022-02-06  3:25     ` [PATCH v3 07/10] app/testpmd: implement rte flow queue flow operations Alexander Kozyrev
2022-02-07 13:21       ` Ori Kam
2022-02-06  3:25     ` [PATCH v3 08/10] app/testpmd: implement rte flow push operations Alexander Kozyrev
2022-02-07 13:22       ` Ori Kam
2022-02-06  3:25     ` [PATCH v3 09/10] app/testpmd: implement rte flow pull operations Alexander Kozyrev
2022-02-07 13:23       ` Ori Kam
2022-02-06  3:25     ` [PATCH v3 10/10] app/testpmd: implement rte flow queue indirect actions Alexander Kozyrev
2022-02-07 13:23       ` Ori Kam
     [not found] <20220206032526.816079-1-akozyrev@nvidia.com >
2022-02-09 21:37 ` [PATCH v4 00/10] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 02/10] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 03/10] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 04/10] app/testpmd: implement rte flow configuration Alexander Kozyrev
2022-02-10  9:32     ` Thomas Monjalon
2022-02-09 21:38   ` [PATCH v4 05/10] app/testpmd: implement rte flow template management Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 06/10] app/testpmd: implement rte flow table management Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 07/10] app/testpmd: implement rte flow queue flow operations Alexander Kozyrev
2022-02-09 21:53     ` Ori Kam
2022-02-09 21:38   ` [PATCH v4 08/10] app/testpmd: implement rte flow push operations Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 09/10] app/testpmd: implement rte flow pull operations Alexander Kozyrev
2022-02-09 21:38   ` [PATCH v4 10/10] app/testpmd: implement rte flow queue indirect actions Alexander Kozyrev
2022-02-10 16:00   ` [PATCH v4 00/10] ethdev: datapath-focused flow rules management Ferruh Yigit
2022-02-10 16:12     ` Asaf Penso
2022-02-10 16:33       ` Suanming Mou
2022-02-10 18:04     ` Ajit Khaparde
2022-02-11 10:22     ` Ivan Malov
2022-02-11 10:48     ` Jerin Jacob
2022-02-11  2:26   ` [PATCH v5 " Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-02-11 10:16       ` Andrew Rybchenko
2022-02-11 18:47         ` Alexander Kozyrev
2022-02-16 13:03           ` Andrew Rybchenko
2022-02-16 22:17             ` Alexander Kozyrev
2022-02-17 10:35               ` Andrew Rybchenko
2022-02-17 10:57                 ` Ori Kam
2022-02-17 11:04                   ` Andrew Rybchenko
2022-02-11  2:26     ` [PATCH v5 02/10] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-11 11:27       ` Andrew Rybchenko
2022-02-11 22:25         ` Alexander Kozyrev
2022-02-16 13:14           ` Andrew Rybchenko
2022-02-16 14:18             ` Ori Kam
2022-02-17 10:44               ` Andrew Rybchenko
2022-02-17 11:11                 ` Ori Kam
2022-02-11  2:26     ` [PATCH v5 03/10] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-11 12:42       ` Andrew Rybchenko
2022-02-12  2:19         ` Alexander Kozyrev
2022-02-12  9:25           ` Thomas Monjalon
2022-02-16 22:49             ` Alexander Kozyrev
2022-02-17  8:18               ` Thomas Monjalon
2022-02-17 11:02                 ` Andrew Rybchenko
2022-02-16 13:34           ` Andrew Rybchenko
2022-02-16 14:53             ` Ori Kam
2022-02-17 10:52               ` Andrew Rybchenko
2022-02-17 11:08                 ` Ori Kam
2022-02-17 14:16                   ` Ori Kam
2022-02-17 14:34                     ` Thomas Monjalon
2022-02-16 15:15             ` Ori Kam
2022-02-17 11:10               ` Andrew Rybchenko
2022-02-17 11:19                 ` Ori Kam
2022-02-11  2:26     ` [PATCH v5 04/10] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 05/10] app/testpmd: add flow template management Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 06/10] app/testpmd: add flow table management Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 07/10] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 08/10] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 09/10] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-11  2:26     ` [PATCH v5 10/10] app/testpmd: add async indirect actions creation/destruction Alexander Kozyrev
2022-02-12  4:19     ` [PATCH v6 00/10] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 02/10] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 03/10] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 04/10] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 05/10] app/testpmd: add flow template management Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 06/10] app/testpmd: add flow table management Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 07/10] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 08/10] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 09/10] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-12  4:19       ` [PATCH v6 10/10] app/testpmd: add async indirect actions creation/destruction Alexander Kozyrev
2022-02-19  4:11       ` [PATCH v7 00/10] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 01/11] ethdev: introduce flow engine configuration Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 02/11] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 03/11] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 04/11] ethdev: bring in async indirect actions operations Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 05/11] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 06/11] app/testpmd: add flow template management Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 07/11] app/testpmd: add flow table management Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 08/11] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 09/11] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 10/11] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-19  4:11         ` [PATCH v7 11/11] app/testpmd: add async indirect actions operations Alexander Kozyrev
2022-02-20  3:43         ` [PATCH v8 00/10] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-20  3:43           ` [PATCH v8 01/11] ethdev: introduce flow engine configuration Alexander Kozyrev
2022-02-21  9:47             ` Andrew Rybchenko
2022-02-21  9:52               ` Andrew Rybchenko
2022-02-21 12:53                 ` Ori Kam
2022-02-21 14:33                   ` Alexander Kozyrev
2022-02-21 14:53                   ` Andrew Rybchenko
2022-02-21 15:49                     ` Thomas Monjalon
2022-02-20  3:44           ` [PATCH v8 02/11] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-21 10:57             ` Andrew Rybchenko
2022-02-21 13:12               ` Ori Kam
2022-02-21 15:05                 ` Andrew Rybchenko
2022-02-21 15:43                   ` Ori Kam
2022-02-21 15:14                 ` Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 03/11] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-21 14:49             ` Andrew Rybchenko
2022-02-21 15:35               ` Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 04/11] ethdev: bring in async indirect actions operations Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 05/11] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 06/11] app/testpmd: add flow template management Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 07/11] app/testpmd: add flow table management Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 08/11] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 09/11] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 10/11] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-20  3:44           ` [PATCH v8 11/11] app/testpmd: add async indirect actions operations Alexander Kozyrev
2022-02-21 23:02           ` [PATCH v9 00/11] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 01/11] ethdev: introduce flow engine configuration Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 02/11] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 03/11] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 04/11] ethdev: bring in async indirect actions operations Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 05/11] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 06/11] app/testpmd: add flow template management Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 07/11] app/testpmd: add flow table management Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 08/11] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 09/11] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 10/11] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-21 23:02             ` [PATCH v9 11/11] app/testpmd: add async indirect actions operations Alexander Kozyrev
2022-02-23  3:02             ` [PATCH v10 00/11] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 01/11] ethdev: introduce flow engine configuration Alexander Kozyrev
2022-02-24  8:22                 ` Andrew Rybchenko
2022-02-23  3:02               ` [PATCH v10 02/11] ethdev: add flow item/action templates Alexander Kozyrev
2022-02-24  8:34                 ` Andrew Rybchenko
2022-02-23  3:02               ` [PATCH v10 03/11] ethdev: bring in async queue-based flow rules operations Alexander Kozyrev
2022-02-24  8:35                 ` Andrew Rybchenko
2022-02-23  3:02               ` [PATCH v10 04/11] ethdev: bring in async indirect actions operations Alexander Kozyrev
2022-02-24  8:37                 ` Andrew Rybchenko
2022-02-23  3:02               ` [PATCH v10 05/11] app/testpmd: add flow engine configuration Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 06/11] app/testpmd: add flow template management Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 07/11] app/testpmd: add flow table management Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 08/11] app/testpmd: add async flow create/destroy operations Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 09/11] app/testpmd: add flow queue push operation Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 10/11] app/testpmd: add flow queue pull operation Alexander Kozyrev
2022-02-23  3:02               ` [PATCH v10 11/11] app/testpmd: add async indirect actions operations Alexander Kozyrev
2022-02-24 13:07               ` [PATCH v10 00/11] ethdev: datapath-focused flow rules management Ferruh Yigit
2022-02-24 13:13                 ` Ferruh Yigit
2022-02-24 13:14                   ` Raslan Darawsheh
2022-02-22 16:41           ` [PATCH v8 00/10] " Ferruh Yigit
2022-02-22 16:49             ` Ferruh Yigit

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=20220206032526.816079-7-akozyrev@nvidia.com \
    --to=akozyrev@nvidia.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=jerinj@marvell.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=orika@nvidia.com \
    --cc=qi.z.zhang@intel.com \
    --cc=thomas@monjalon.net \
    /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).