[RFC v3 2/2] ethdev: introduce the cache stashing hints API
Stephen Hemminger
stephen at networkplumber.org
Tue Dec 3 22:13:22 CET 2024
On Mon, 21 Oct 2024 01:52:46 +0000
Wathsala Vithanage <wathsala.vithanage at arm.com> wrote:
> Extend the ethdev library to enable the stashing of different data
> objects, such as the ones listed below, into CPU caches directly
> from the NIC.
>
> - Rx/Tx queue descriptors
> - Rx packets
> - Packet headers
> - packet payloads
> - Data of a packet at an offset from the start of the packet
>
> The APIs are designed in a hardware/vendor agnostic manner such that
> supporting PMDs could use any capabilities available in the underlying
> hardware for fine-grained stashing of data objects into a CPU cache
> (e.g., Steering Tags int PCIe TLP Processing Hints).
>
> The API provides an interface to query the availability of stashing
> capabilities, i.e., platform/NIC support, stashable object types, etc,
> via the rte_eth_dev_stashing_capabilities_get interface.
>
> The function pair rte_eth_dev_stashing_rx_config_set and
> rte_eth_dev_stashing_tx_config_set sets the stashing hint (the CPU,
> cache level, and data object types) on the Rx and Tx queues.
>
> PMDs that support stashing must register their implementations with the
> following eth_dev_ops callbacks, which are invoked by the ethdev
> functions listed above.
>
> - stashing_capabilities_get
> - stashing_rx_hints_set
> - stashing_tx_hints_set
>
> Signed-off-by: Wathsala Vithanage <wathsala.vithanage at arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> Reviewed-by: Dhruv Tripathi <dhruv.tripathi at arm.com>
>
> ---
> lib/ethdev/ethdev_driver.h | 66 +++++++++++++++
> lib/ethdev/rte_ethdev.c | 120 +++++++++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 161 +++++++++++++++++++++++++++++++++++++
> lib/ethdev/version.map | 4 +
> 4 files changed, 351 insertions(+)
>
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 1fd4562b40..7caaea54a8 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1367,6 +1367,68 @@ enum rte_eth_dev_operation {
> typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev,
> enum rte_eth_dev_operation op);
>
> +/**
> + * @internal
> + * Set cache stashing hints in Rx queue.
> + *
> + * @param dev
> + * Port (ethdev) handle.
> + * @param queue_id
> + * Rx queue.
> + * @param config
> + * Stashing hints configuration for the queue.
> + *
> + * @return
> + * -ENOTSUP if the device or the platform does not support cache stashing.
> + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature.
> + * -EINVAL on invalid arguments.
> + * 0 on success.
> + */
> +typedef int (*eth_stashing_rx_hints_set_t)(struct rte_eth_dev *dev, uint16_t queue_id,
> + struct rte_eth_stashing_config *config);
> +
> +/**
> + * @internal
> + * Set cache stashing hints in Tx queue.
> + *
> + * @param dev
> + * Port (ethdev) handle.
> + * @param queue_id
> + * Tx queue.
> + * @param config
> + * Stashing hints configuration for the queue.
> + *
> + * @return
> + * -ENOTSUP if the device or the platform does not support cache stashing.
> + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature.
> + * -EINVAL on invalid arguments.
> + * 0 on success.
> + */
> +typedef int (*eth_stashing_tx_hints_set_t)(struct rte_eth_dev *dev, uint16_t queue_id,
> + struct rte_eth_stashing_config *config);
> +
> +/**
> + * @internal
> + * Get cache stashing object types supported in the ethernet device.
> + * The return value indicates availability of stashing hints support
> + * in the hardware and the PMD.
> + *
> + * @param dev
> + * Port (ethdev) handle.
> + * @param objects
> + * PMD sets supported bits on return.
> + *
> + * @return
> + * -ENOTSUP if the device or the platform does not support cache stashing.
> + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature.
> + * -EINVAL on NULL values for types or hints parameters.
> + * On return, types and hints parameters will have bits set for supported
> + * object types and hints.
> + * 0 on success.
> + */
> +typedef int (*eth_stashing_capabilities_get_t)(struct rte_eth_dev *dev,
> + uint16_t *objects);
> +
> /**
> * @internal A structure containing the functions exported by an Ethernet driver.
> */
> @@ -1393,6 +1455,10 @@ struct eth_dev_ops {
> eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */
> eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */
> eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */
> + eth_stashing_rx_hints_set_t stashing_rx_hints_set; /**< Set Rx cache stashing*/
> + eth_stashing_tx_hints_set_t stashing_tx_hints_set; /**< Set Tx cache stashing*/
> + /** Get supported stashing hints*/
> + eth_stashing_capabilities_get_t stashing_capabilities_get;
> /** Set list of multicast addresses */
> eth_set_mc_addr_list_t set_mc_addr_list;
> mtu_set_t mtu_set; /**< Set MTU */
Since eth_dev_ops is visible in application binary, it is part of the ABI.
Therefore it can not be changed until 25.11 release.
More information about the dev
mailing list