From: Wathsala Vithanage <wathsala.vithanage@arm.com>
To: Ian Stokes <ian.stokes@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, nd@arm.com,
Wathsala Vithanage <wathsala.vithanage@arm.com>
Subject: [PATCH v5 4/4] net/i40e: enable TPH in i40e
Date: Mon, 2 Jun 2025 22:38:04 +0000 [thread overview]
Message-ID: <20250602223805.816816-5-wathsala.vithanage@arm.com> (raw)
In-Reply-To: <20250602223805.816816-1-wathsala.vithanage@arm.com>
Adds stashing_capabilities_get, stashing_{rx,tx}_hinst_set functions
to eth_dev_ops of the i40e driver. Enables TPH in device-specific
mode, so that steering-tags are set in LAN queue contexts.
Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
---
drivers/net/intel/i40e/i40e_ethdev.c | 128 +++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 90eba3419f..326e323dfb 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -18,6 +18,7 @@
#include <rte_pci.h>
#include <bus_pci_driver.h>
#include <rte_ether.h>
+#include <rte_ethdev.h>
#include <ethdev_driver.h>
#include <ethdev_pci.h>
#include <rte_memzone.h>
@@ -410,6 +411,11 @@ static int i40e_fec_get_capability(struct rte_eth_dev *dev,
struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
static int i40e_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa);
static int i40e_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa);
+static int i40e_stashing_cap_get(struct rte_eth_dev *dev, uint16_t *objects);
+static int i40e_stashing_rx_hints_set(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_stashing_config *config);
+static int i40e_stashing_tx_hints_set(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_stashing_config *config);
static const char *const valid_keys[] = {
ETH_I40E_FLOATING_VEB_ARG,
@@ -527,6 +533,9 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.fec_get_capability = i40e_fec_get_capability,
.fec_get = i40e_fec_get,
.fec_set = i40e_fec_set,
+ .stashing_capabilities_get = i40e_stashing_cap_get,
+ .stashing_rx_hints_set = i40e_stashing_rx_hints_set,
+ .stashing_tx_hints_set = i40e_stashing_tx_hints_set,
};
/* store statistics names and its offset in stats structure */
@@ -3878,6 +3887,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
+ dev_info->dev_capa |= RTE_ETH_DEV_CAPA_CACHE_STASHING;
dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) *
sizeof(uint32_t);
@@ -12544,6 +12554,124 @@ i40e_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
return 0;
}
+static int
+i40e_stashing_cap_get(struct rte_eth_dev *dev, uint16_t *objects)
+{
+ RTE_SET_USED(dev);
+
+ *objects = RTE_ETH_DEV_STASH_OBJECT_DESC |
+ RTE_ETH_DEV_STASH_OBJECT_HEADER |
+ RTE_ETH_DEV_STASH_OBJECT_PAYLOAD;
+
+ return 0;
+}
+
+static int
+i40e_stashing_hints_set(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_stashing_config *config,
+ enum i40e_hmc_lan_rsrc_type hmc_type)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ int err = I40E_SUCCESS;
+ struct i40e_hmc_obj_rxq rxq;
+ struct i40e_hmc_obj_txq txq;
+
+ if (!config) {
+ err = -EINVAL;
+ goto out;
+ }
+
+ struct rte_tph_info tph = {
+ .cpu_id = config->lcore_id,
+ .cache_level = config->cache_level,
+ .flags = RTE_PCI_TPH_MEM_TYPE_VMEM | RTE_PCI_TPH_HINT_BIDIR,
+ .index = 0,
+ };
+
+ if (!pci_dev->tph_enabled)
+ err = rte_pci_tph_enable(pci_dev, RTE_PCI_TPH_CAP_ST_DS);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Failed enabling TPH");
+ goto out;
+ }
+
+ err = rte_pci_tph_st_get(pci_dev, &tph, 1);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Failed ST read for lcore: %u and cache-level: %u",
+ tph.cpu_id, tph.cache_level);
+ goto out;
+ }
+
+ switch (hmc_type) {
+ case I40E_HMC_LAN_RX:
+ err = i40e_get_lan_rx_queue_context(hw, queue_id, &rxq);
+ if (err != I40E_SUCCESS) {
+ PMD_DRV_LOG(ERR, "Failed to get LAN RX queue context");
+ goto out;
+ }
+
+ rxq.cpuid = tph.st;
+
+ if (config->objects & RTE_ETH_DEV_STASH_OBJECT_DESC) {
+ rxq.tphrdesc_ena = 1;
+ rxq.tphwdesc_ena = 1;
+ }
+
+ if (config->objects & RTE_ETH_DEV_STASH_OBJECT_PAYLOAD)
+ rxq.tphdata_ena = 1;
+
+ if (config->objects & RTE_ETH_DEV_STASH_OBJECT_HEADER)
+ rxq.tphhead_ena = 1;
+
+ err = i40e_set_lan_rx_queue_context(hw, queue_id, &rxq);
+ if (err != I40E_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to set LAN RX queue context");
+ break;
+ case I40E_HMC_LAN_TX:
+ err = i40e_get_lan_tx_queue_context(hw, queue_id, &txq);
+ if (err != I40E_SUCCESS) {
+ PMD_DRV_LOG(ERR, "Failed to get LAN TX queue context");
+ goto out;
+ }
+
+ txq.cpuid = tph.st;
+
+ if (config->objects & RTE_ETH_DEV_STASH_OBJECT_DESC) {
+ txq.tphrdesc_ena = 1;
+ txq.tphwdesc_ena = 1;
+ }
+
+ if (config->objects & (RTE_ETH_DEV_STASH_OBJECT_PAYLOAD |
+ RTE_ETH_DEV_STASH_OBJECT_HEADER))
+ txq.tphrpacket_ena = 1;
+
+ err = i40e_set_lan_tx_queue_context(hw, queue_id, &txq);
+ if (err != I40E_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to set LAN TX queue context");
+ break;
+ default:
+ err = -EINVAL;
+ }
+
+out:
+ return err;
+}
+
+static int
+i40e_stashing_rx_hints_set(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_stashing_config *config)
+{
+ return i40e_stashing_hints_set(dev, queue_id, config, I40E_HMC_LAN_RX);
+}
+
+static int
+i40e_stashing_tx_hints_set(struct rte_eth_dev *dev, uint16_t queue_id,
+ struct rte_eth_stashing_config *config)
+{
+ return i40e_stashing_hints_set(dev, queue_id, config, I40E_HMC_LAN_TX);
+}
+
RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
RTE_LOG_REGISTER_SUFFIX(i40e_logtype_driver, driver, NOTICE);
#ifdef RTE_ETHDEV_DEBUG_RX
--
2.43.0
next prev parent reply other threads:[~2025-06-02 22:38 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 22:11 [RFC v2] ethdev: an API for cache stashing hints Wathsala Vithanage
2024-07-17 2:27 ` Stephen Hemminger
2024-07-18 18:48 ` Wathsala Wathawana Vithanage
2024-07-20 3:05 ` Honnappa Nagarahalli
2024-07-17 10:32 ` Konstantin Ananyev
2024-07-22 11:18 ` Ferruh Yigit
2024-07-26 20:01 ` Wathsala Wathawana Vithanage
2024-09-22 21:43 ` Ferruh Yigit
2024-10-04 17:52 ` Stephen Hemminger
2024-10-04 18:46 ` Wathsala Wathawana Vithanage
2024-10-21 1:52 ` [RFC v3 0/2] An API for Stashing Packets into CPU caches Wathsala Vithanage
2024-10-21 1:52 ` [RFC v3 1/2] pci: introduce the PCIe TLP Processing Hints API Wathsala Vithanage
2024-12-03 20:54 ` Stephen Hemminger
2024-10-21 1:52 ` [RFC v3 2/2] ethdev: introduce the cache stashing hints API Wathsala Vithanage
2024-10-21 7:36 ` Morten Brørup
2024-10-24 5:49 ` Jerin Jacob
2024-10-24 6:59 ` Morten Brørup
2024-10-24 15:12 ` Wathsala Wathawana Vithanage
2024-10-24 15:04 ` Wathsala Wathawana Vithanage
2024-12-03 21:13 ` Stephen Hemminger
2024-12-05 15:40 ` David Marchand
2024-12-05 21:00 ` Stephen Hemminger
2024-10-21 7:35 ` [RFC v3 0/2] An API for Stashing Packets into CPU caches Chenbo Xia
2024-10-21 12:01 ` Wathsala Wathawana Vithanage
2024-10-22 1:12 ` Stephen Hemminger
2024-10-22 18:37 ` Wathsala Wathawana Vithanage
2024-10-22 21:23 ` Stephen Hemminger
2025-05-17 15:17 ` [RFC PATCH v4 0/3] " Wathsala Vithanage
2025-05-17 15:17 ` [RFC PATCH v4 1/3] pci: add non-merged Linux uAPI changes Wathsala Vithanage
2025-05-19 6:41 ` David Marchand
2025-05-19 17:55 ` Wathsala Wathawana Vithanage
2025-05-17 15:17 ` [RFC PATCH v4 2/3] bus/pci: introduce the PCIe TLP Processing Hints API Wathsala Vithanage
2025-05-19 6:44 ` David Marchand
2025-05-19 17:57 ` Wathsala Wathawana Vithanage
2025-05-17 15:17 ` [RFC PATCH v4 3/3] ethdev: introduce the cache stashing hints API Wathsala Vithanage
2025-05-20 13:53 ` Stephen Hemminger
2025-06-02 22:38 ` [PATCH v5 0/4] An API for Cache Stashing with TPH Wathsala Vithanage
2025-06-02 22:38 ` [PATCH v5 1/4] pci: add non-merged Linux uAPI changes Wathsala Vithanage
2025-06-02 23:11 ` Wathsala Wathawana Vithanage
2025-06-02 23:16 ` Wathsala Wathawana Vithanage
2025-06-04 20:43 ` Stephen Hemminger
2025-06-02 22:38 ` [PATCH v5 2/4] bus/pci: introduce the PCIe TLP Processing Hints API Wathsala Vithanage
2025-06-03 8:11 ` Morten Brørup
2025-06-04 16:54 ` Bruce Richardson
2025-06-02 22:38 ` [PATCH v5 3/4] ethdev: introduce the cache stashing hints API Wathsala Vithanage
2025-06-03 8:43 ` Morten Brørup
2025-06-02 22:38 ` Wathsala Vithanage [this message]
2025-06-04 16:51 ` [PATCH v5 0/4] An API for Cache Stashing with TPH Stephen Hemminger
2024-10-23 17:59 ` [RFC v2] ethdev: an API for cache stashing hints Mattias Rönnblom
2024-10-23 20:18 ` Stephen Hemminger
2024-10-24 14:59 ` Wathsala Wathawana Vithanage
2024-10-25 7:43 ` Andrew Rybchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250602223805.816816-5-wathsala.vithanage@arm.com \
--to=wathsala.vithanage@arm.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ian.stokes@intel.com \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).