From: Sinan Kaya <okaya@codeaurora.org>
To: okaya@codeaurora.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH V2] PCI: enable extended tags support for PCIe devices
Date: Fri, 20 Jan 2017 09:16:51 -0500 [thread overview]
Message-ID: <1484921814-8511-1-git-send-email-okaya@codeaurora.org> (raw)
Each PCIe device can issue up to 32 transactions at a time by default.
This limitation is historically coming from PCI. Each transaction is
tracked by a tag number on the bus. 2.2.6.2. Transaction Descriptor
– Transaction ID Field section of the PCIe 3.1 specification describes
extended tags.
PCI supports 32 outstanding non-posted requests at a given time. This
number has been extended to 256 on PCI Express. According to the
specification, all PCIe devices are required to support receiving
8-bit Tags (Tag completer). The PCIe-PCI bridges handle the translation
of 8-bit tags to 5-bit tags.
However, the generation of 8-bit tags is left optional to a particular HW
implementation. The code needs to check HW support before attempting
to enable extended tags producer capability.
32 outstanding transactions is not enough for some performance critical
applications especially when a lot of small sized frames are transmitted.
Extended tags support increases this number to 256. Devices not
supporting extended tags tie-off this field to 0. According to ECN, it
is safe to enable this feature for all PCIe devices.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/pci/probe.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e164b5c..1192475 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1650,12 +1650,28 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
*/
}
+static void pci_configure_extended_tags(struct pci_dev *pdev)
+{
+ u32 dev_cap;
+ int ret;
+
+ ret = pcie_capability_read_dword(pdev, PCI_EXP_DEVCAP, &dev_cap);
+
+ if (ret)
+ return;
+
+ if (dev_cap & PCI_EXP_DEVCAP_EXT_TAG)
+ pcie_capability_set_word(pdev, PCI_EXP_DEVCTL,
+ PCI_EXP_DEVCTL_EXT_TAG);
+}
+
static void pci_configure_device(struct pci_dev *dev)
{
struct hotplug_params hpp;
int ret;
pci_configure_mps(dev);
+ pci_configure_extended_tags(dev);
memset(&hpp, 0, sizeof(hpp));
ret = pci_get_hp_params(dev, &hpp);
--
1.9.1
next reply other threads:[~2017-01-20 14:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 14:16 Sinan Kaya [this message]
2017-01-20 14:36 ` [PATCH V2] PCI: enable extended tags support for PCIe devices Sinan Kaya
2017-02-09 23:33 ` Bjorn Helgaas
2017-02-09 23:40 ` Sinan Kaya
-- strict thread matches above, loose matches on Subject: below --
2017-01-20 14:19 Sinan Kaya
2017-01-20 14:20 Sinan Kaya
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=1484921814-8511-1-git-send-email-okaya@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.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).