From: Bjorn Helgaas <helgaas@kernel.org>
To: Martin Mares <mj@ucw.cz>
Cc: "Pali Rohár" <pali@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Matthew Wilcox" <willy@infradead.org>,
linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH] lspci: Don't report PCIe link downgrades for downstream ports
Date: Thu, 18 Mar 2021 12:11:22 -0500 [thread overview]
Message-ID: <20210318171122.GA151712@bjorn-Precision-5520> (raw)
In-Reply-To: <20210318170244.151240-1-helgaas@kernel.org>
On Thu, Mar 18, 2021 at 12:02:44PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> After b47b5bd408e1 ("lspci: Report if the PCIe link speed/width is full or
> downgraded"), we report "downgraded" or "ok" for PCIe links operating at
> lower speed or width than they're capable of:
>
> LnkCap: Port #1, Speed 8GT/s, Width x1, ASPM L1, Exit Latency L1 <16us
> LnkSta: Speed 5GT/s (downgraded), Width x1 (ok)
>
> Previously we did this for both ends of the link, but I don't think it's
> very useful for Downstream Ports (the upstream end of the link) because we
> claim the link is downgraded even if (1) there's no device on the other end
> or (2) the other device doesn't support anything faster/wider.
>
> Drop the "downgraded" reporting for Downstream Ports. If there is a device
> below, we'll still complain at that end if it supports a faster/wider link
> than is available.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> ls-caps.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/ls-caps.c b/ls-caps.c
> index db56556..dd17c6b 100644
> --- a/ls-caps.c
> +++ b/ls-caps.c
> @@ -758,13 +758,16 @@ static char *link_speed(int speed)
> }
> }
>
> -static char *link_compare(int sta, int cap)
> +static char *link_compare(int type, int sta, int cap)
> {
> + if ((type == PCI_EXP_TYPE_ROOT_PORT) || (type == PCI_EXP_TYPE_DOWNSTREAM) ||
> + (type == PCI_EXP_TYPE_PCIE_BRIDGE))
> + return "";
> if (sta < cap)
> - return "downgraded";
> + return " (downgraded)";
> if (sta > cap)
> - return "strange";
> - return "ok";
> + return " (strange)";
> + return " (ok)";
Personally I would probably just return "" by default and drop the
"(ok)" notes because they don't really seem necessary. But either way
is OK.
> }
>
> static char *aspm_support(int code)
> @@ -837,11 +840,11 @@ static void cap_express_link(struct device *d, int where, int type)
> w = get_conf_word(d, where + PCI_EXP_LNKSTA);
> sta_speed = w & PCI_EXP_LNKSTA_SPEED;
> sta_width = (w & PCI_EXP_LNKSTA_WIDTH) >> 4;
> - printf("\t\tLnkSta:\tSpeed %s (%s), Width x%d (%s)\n",
> + printf("\t\tLnkSta:\tSpeed %s%s, Width x%d%s\n",
> link_speed(sta_speed),
> - link_compare(sta_speed, cap_speed),
> + link_compare(type, sta_speed, cap_speed),
> sta_width,
> - link_compare(sta_width, cap_width));
> + link_compare(type, sta_width, cap_width));
> printf("\t\t\tTrErr%c Train%c SlotClk%c DLActive%c BWMgmt%c ABWMgmt%c\n",
> FLAG(w, PCI_EXP_LNKSTA_TR_ERR),
> FLAG(w, PCI_EXP_LNKSTA_TRAIN),
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-03-18 17:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 17:02 [PATCH] lspci: Don't report PCIe link downgrades for downstream ports Bjorn Helgaas
2021-03-18 17:11 ` Bjorn Helgaas [this message]
2021-03-18 17:33 ` Matthew Wilcox
2022-01-21 13:20 ` Martin Mareš
2021-03-21 16:09 ` Pali Rohár
2021-03-21 16:32 ` Matthew Wilcox
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=20210318171122.GA151712@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=mj@ucw.cz \
--cc=pali@kernel.org \
--cc=willy@infradead.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).