[RFC,v2,2/4] testpmd: add item transmit queue in flow CLI

Message ID 1600012140-70151-3-git-send-email-bingz@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series introduce support for hairpin between two ports |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bing Zhao Sept. 13, 2020, 3:48 p.m. UTC
  In the testpmd command line for flow creation, add the keyword
'tx_queue' in the pattern scope so the item transmit queue ID
could be specified during the flow creation.
The index of the transmit queue should be in the range
[0, nb_tx_queue - 1] supplied to rte_eth_dev_configure() during
initialization. Normal TX queues and hairpin TX queues will have a
unified index number sequence.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6263d30..f7816fc 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -109,6 +109,8 @@  enum index {
 	ITEM_PHY_PORT_INDEX,
 	ITEM_PORT_ID,
 	ITEM_PORT_ID_ID,
+	ITEM_TX_QUEUE,
+	ITEM_TX_QUEUE_ID,
 	ITEM_MARK,
 	ITEM_MARK_ID,
 	ITEM_RAW,
@@ -759,6 +761,7 @@  static const enum index next_item[] = {
 	ITEM_VF,
 	ITEM_PHY_PORT,
 	ITEM_PORT_ID,
+	ITEM_TX_QUEUE,
 	ITEM_MARK,
 	ITEM_RAW,
 	ITEM_ETH,
@@ -1954,6 +1957,21 @@  static const struct token token_list[] = {
 		.next = NEXT(item_port_id, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_port_id, id)),
 	},
+	[ITEM_TX_QUEUE] = {
+		.name = "tx_queue",
+		.help = "match traffic from a given transmit queue",
+		.priv = PRIV_ITEM(QUEUE,
+				  sizeof(struct rte_flow_item_tx_queue)),
+		.next = NEXT(NEXT_ENTRY(ITEM_TX_QUEUE_ID)),
+		.call = parse_vc,
+	},
+	[ITEM_TX_QUEUE_ID] = {
+		.name = "index",
+		.help = "TX queue index of this port",
+		.next = NEXT(NEXT_ENTRY(ITEM_NEXT), NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tx_queue, queue)),
+	},
 	[ITEM_MARK] = {
 		.name = "mark",
 		.help = "match traffic against value set in previously matched rule",