Presently, Rx metadata is sent to PMD by default, leading
to a performance drop as processing for the same in rx path
takes extra cycles.

Hence, introducing command line argument, 'nic-to-pmd-rx-metadata'
to control passing rx metadata to PMD. By default it’s disabled.

Signed-off-by: Hanumanth Pothula <hpoth...@marvell.com>

v3:
- Updated run_app.rst with the new command line argument,
  nic-to-pmd-rx-metadata.
- Updated commit text.
v2:
- taken cared alignment issues
- renamed command line argument from rx-metadata to nic-to-pmd-rx-metadata
- renamed variable name from rx-metadata to nic_to_pmd_rx_metadata
---
 app/test-pmd/parameters.c             | 4 ++++
 app/test-pmd/testpmd.c                | 6 +++++-
 app/test-pmd/testpmd.h                | 2 ++
 doc/guides/testpmd_app_ug/run_app.rst | 3 +++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index cfd7cd1e50..2b1314771f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -202,6 +202,7 @@ usage(char* progname)
        printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
               "    0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
               "    0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
+       printf("  --nic-to-pmd-rx-metadata: let the NIC deliver per-packet Rx 
metadata to PMD\n");
 }
 
 #ifdef RTE_LIB_CMDLINE
@@ -695,6 +696,7 @@ launch_args_parse(int argc, char** argv)
                { "record-burst-stats",         0, 0, 0 },
                { PARAM_NUM_PROCS,              1, 0, 0 },
                { PARAM_PROC_ID,                1, 0, 0 },
+               { "nic-to-pmd-rx-metadata",     0, 0, 0 },
                { 0, 0, 0, 0 },
        };
 
@@ -1434,6 +1436,8 @@ launch_args_parse(int argc, char** argv)
                                num_procs = atoi(optarg);
                        if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
                                proc_id = atoi(optarg);
+                       if (!strcmp(lgopts[opt_idx].name, 
"nic-to-pmd-rx-metadata"))
+                               nic_to_pmd_rx_metadata = 1;
                        break;
                case 'h':
                        usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 77741fc41f..938072bb88 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -411,6 +411,9 @@ uint8_t clear_ptypes = true;
 /* Hairpin ports configuration mode. */
 uint16_t hairpin_mode;
 
+/* Send Rx metadata */
+uint8_t nic_to_pmd_rx_metadata;
+
 /* Pretty printing of ethdev events */
 static const char * const eth_event_desc[] = {
        [RTE_ETH_EVENT_UNKNOWN] = "unknown",
@@ -1595,7 +1598,8 @@ init_config_port_offloads(portid_t pid, uint32_t 
socket_id)
        int ret;
        int i;
 
-       eth_rx_metadata_negotiate_mp(pid);
+       if (nic_to_pmd_rx_metadata)
+               eth_rx_metadata_negotiate_mp(pid);
 
        port->dev_conf.txmode = tx_mode;
        port->dev_conf.rxmode = rx_mode;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index ddf5e21849..8522024364 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -615,6 +615,8 @@ extern struct rte_ether_addr 
peer_eth_addrs[RTE_MAX_ETHPORTS];
 extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for 
mac-retry. */
 extern uint32_t burst_tx_retry_num;  /**< Burst tx retry number for mac-retry. 
*/
 
+extern uint8_t nic_to_pmd_rx_metadata;
+
 #ifdef RTE_LIB_GRO
 #define GRO_DEFAULT_ITEM_NUM_PER_FLOW 32
 #define GRO_DEFAULT_FLOW_NUM (RTE_GRO_MAX_BURST_ITEM_NUM / \
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 8b41b960c8..24e2e8aa69 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -539,6 +539,9 @@ The command line options are:
 
     The default value is 0. Hairpin will use single port mode and implicit Tx 
flow mode.
 
+*   ``--nic_to_pmd_rx_metadata``
+
+    Enable passing Rx metadata to PMD.
 
 Testpmd Multi-Process Command-line Options
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.25.1

Reply via email to