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 <bi...@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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",
-- 
2.5.5

Reply via email to