[v4,1/2] ethdev: control Rx metadata negotiation

Message ID 20221220200250.2413443-1-hpothula@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series [v4,1/2] ethdev: control Rx metadata negotiation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation warning apply patch failure

Commit Message

Hanumanth Pothula Dec. 20, 2022, 8:02 p.m. UTC
  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, adding a new eth port configuration filed,
'nic_to_pmd_rx_metadata', to control NIC to PMD Rx metadata
negotiation.

Also, reset dev_configured flag as part of device reset, this helps
in reconfiguring porting cleanly. Rx metadata negotiation,
rte_eth_rx_metadata_negotiate(), is allowed only when dev_configured
flag is reset.

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
v4:
 - As per spec rte_eth_rx_metadata_negotiate() is processed only when
   dev_configured is set. Hence can't enable automatically when a flow
   command requests metadata.
 - Add new testpmd command to allow NIC to PMD Rx metadata negotiation.
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
---
 lib/ethdev/rte_ethdev.c | 2 ++
 lib/ethdev/rte_ethdev.h | 1 +
 2 files changed, 3 insertions(+)
  

Patch

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 5d5e18db1e..18c59044bc 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1629,6 +1629,8 @@  rte_eth_dev_reset(uint16_t port_id)
 			port_id, rte_strerror(-ret));
 	}
 	ret = dev->dev_ops->dev_reset(dev);
+	if (!ret)
+		dev->data->dev_configured = 0;
 
 	return eth_err(port_id, ret);
 }
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index c129ca1eaf..f1160a8aca 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -1487,6 +1487,7 @@  struct rte_eth_conf {
 	    is needed,and the variable must be set RTE_ETH_DCB_PFC_SUPPORT. */
 	uint32_t dcb_capability_en;
 	struct rte_eth_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	uint8_t nic_to_pmd_rx_metadata; /**< send rx metadata to PMD. */
 };
 
 /**