From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: hkallweit1@gmail.com, nic_swsd@realtek.com, bhelgaas@google.com
Cc: davem@davemloft.net, kuba@kernel.org, anthony.wong@canonical.com,
netdev@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
"Saheed O. Bolarinwa" <refactormyself@gmail.com>,
"Vidya Sagar" <vidyas@nvidia.com>,
"Krzysztof Wilczyński" <kw@linux.com>
Subject: [RFC] [PATCH net-next v5 1/3] PCI/ASPM: Introduce a new helper to report ASPM capability
Date: Thu, 16 Sep 2021 23:44:15 +0800 [thread overview]
Message-ID: <20210916154417.664323-2-kai.heng.feng@canonical.com> (raw)
In-Reply-To: <20210916154417.664323-1-kai.heng.feng@canonical.com>
Introduce a new helper, pcie_aspm_capable(), to report ASPM capability.
The user will be introduced by next patch.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v5:
- No change.
v4:
- Report aspm_capable instead.
v3:
- This is a new patch
drivers/pci/pcie/aspm.c | 11 +++++++++++
include/linux/pci.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 013a47f587cea..788e7496f33b1 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1201,6 +1201,17 @@ bool pcie_aspm_enabled(struct pci_dev *pdev)
}
EXPORT_SYMBOL_GPL(pcie_aspm_enabled);
+bool pcie_aspm_capable(struct pci_dev *pdev)
+{
+ struct pcie_link_state *link = pcie_aspm_get_link(pdev);
+
+ if (!link)
+ return false;
+
+ return link->aspm_capable;
+}
+EXPORT_SYMBOL_GPL(pcie_aspm_capable);
+
static ssize_t aspm_attr_show_common(struct device *dev,
struct device_attribute *attr,
char *buf, u8 state)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 34d7d94ddf6dc..d77919d125af1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1631,6 +1631,7 @@ int pci_disable_link_state_locked(struct pci_dev *pdev, int state);
void pcie_no_aspm(void);
bool pcie_aspm_support_enabled(void);
bool pcie_aspm_enabled(struct pci_dev *pdev);
+bool pcie_aspm_capable(struct pci_dev *pdev);
#else
static inline int pci_disable_link_state(struct pci_dev *pdev, int state)
{ return 0; }
@@ -1639,6 +1640,7 @@ static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
static inline void pcie_no_aspm(void) { }
static inline bool pcie_aspm_support_enabled(void) { return false; }
static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; }
+static inline bool pcie_aspm_capable(struct pci_dev *pdev) { return false; }
#endif
#ifdef CONFIG_PCIEAER
--
2.32.0
next prev parent reply other threads:[~2021-09-16 15:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 15:44 [RFC] [PATCH net-next v5 0/3] r8169: Implement dynamic ASPM mechanism for recent 1.0/2.5Gbps Realtek NICs Kai-Heng Feng
2021-09-16 15:44 ` Kai-Heng Feng [this message]
2021-09-16 15:44 ` [RFC] [PATCH net-next v5 2/3] r8169: Use PCIe ASPM status for NIC ASPM enablement Kai-Heng Feng
2021-09-16 17:07 ` Bjorn Helgaas
2021-09-17 4:09 ` Kai-Heng Feng
2021-09-17 15:26 ` Bjorn Helgaas
2021-10-01 4:32 ` Kai-Heng Feng
2021-09-16 15:44 ` [RFC] [PATCH net-next v5 3/3] r8169: Implement dynamic ASPM mechanism Kai-Heng Feng
2021-09-16 17:12 ` Bjorn Helgaas
2021-09-17 4:19 ` Kai-Heng Feng
2021-09-17 22:09 ` [RFC] [PATCH net-next v5 0/3] r8169: Implement dynamic ASPM mechanism for recent 1.0/2.5Gbps Realtek NICs Bjorn Helgaas
2021-10-01 4:17 ` Kai-Heng Feng
2021-10-07 19:10 ` Bjorn Helgaas
2021-10-08 13:56 ` Bjorn Helgaas
2021-10-07 16:15 [RFC] [PATCH net-next v6 " Kai-Heng Feng
2021-10-07 16:15 ` [RFC] [PATCH net-next v5 1/3] PCI/ASPM: Introduce a new helper to report ASPM capability Kai-Heng Feng
2021-10-08 22:18 ` Bjorn Helgaas
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=20210916154417.664323-2-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=anthony.wong@canonical.com \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=refactormyself@gmail.com \
--cc=vidyas@nvidia.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).