DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shaiq Wani <shaiq.wani@intel.com>
To: dev@dpdk.org, bruce.richardson@intel.com
Subject: [PATCH] dma/idxd: set defaults for GRPCFG traffic class
Date: Wed, 26 Jun 2024 05:45:23 +0000	[thread overview]
Message-ID: <20240626054523.3042796-1-shaiq.wani@intel.com> (raw)

Set GRPCFG traffic class to value of 1 for best performance on current
generation of accelerators. Applicable to gen1 and gen2 devices.

Signed-off-by: Shaiq Wani <shaiq.wani@intel.com>
---
 drivers/dma/idxd/idxd_pci.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 81637d9420..e551b2232d 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -12,6 +12,14 @@
 #define IDXD_VENDOR_ID		0x8086
 #define IDXD_DEVICE_ID_SPR	0x0B25
 
+#define DEVICE_VERSION_1	0x100
+#define DEVICE_VERSION_2	0x200
+/*
+ * Set bits for Traffic Class A & B
+ * TC-A (Bits 2:0) and TC-B (Bits 5:3)
+ */
+#define IDXD_SET_TC_A_B		0x9
+
 #define IDXD_PMD_DMADEV_NAME_PCI dmadev_idxd_pci
 
 const struct rte_pci_id pci_id_idxd_map[] = {
@@ -177,6 +185,7 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_dmadev *idxd,
 	uint16_t grp_offset, wq_offset; /* how far into bar0 the regs are */
 	uint16_t wq_size, total_wq_size;
 	uint8_t lg2_max_batch, lg2_max_copy_size;
+	uint32_t version;
 	unsigned int i, err_code;
 
 	pci = rte_malloc(NULL, sizeof(*pci), 0);
@@ -190,6 +199,7 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_dmadev *idxd,
 
 	/* assign the bar registers, and then configure device */
 	pci->regs = dev->mem_resource[0].addr;
+	version = pci->regs->version;
 	grp_offset = (uint16_t)pci->regs->offsets[0];
 	pci->grp_regs = RTE_PTR_ADD(pci->regs, grp_offset * 0x100);
 	wq_offset = (uint16_t)(pci->regs->offsets[0] >> 16);
@@ -234,6 +244,8 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_dmadev *idxd,
 	for (i = 0; i < nb_groups; i++) {
 		pci->grp_regs[i].grpengcfg = 0;
 		pci->grp_regs[i].grpwqcfg[0] = 0;
+		if (version <= DEVICE_VERSION_2)
+			pci->grp_regs[i].grpflags |= IDXD_SET_TC_A_B;
 	}
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
@@ -278,6 +290,7 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_dmadev *idxd,
 				(lg2_max_batch << WQ_BATCH_SZ_SHIFT);
 	}
 
+	IDXD_PMD_DEBUG("    Device Version: %"PRIx32, version);
 	/* dump the group configuration to output */
 	for (i = 0; i < nb_groups; i++) {
 		IDXD_PMD_DEBUG("## Group %d", i);
-- 
2.34.1


                 reply	other threads:[~2024-06-26  6:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240626054523.3042796-1-shaiq.wani@intel.com \
    --to=shaiq.wani@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).