From: Tal Gilboa <talgi@mellanox.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Linux PCI <linux-pci@vger.kernel.org>,
Tariq Toukan <tariqt@mellanox.com>
Subject: Re: [PATCH next V1 7/7] net/mlx5e: Use generic PCI function for BW calculation
Date: Sun, 25 Feb 2018 13:20:39 +0200 [thread overview]
Message-ID: <f1341aae-db08-74fc-461d-7a074198aed8@mellanox.com> (raw)
In-Reply-To: <20180222200901.GC16519@bhelgaas-glaptop.roam.corp.google.com>
On 2/22/2018 10:09 PM, Bjorn Helgaas wrote:
> On Mon, Jan 15, 2018 at 05:35:41PM +0200, Tal Gilboa wrote:
>> Newly introduced pcie_get_link_limits() function calculates
>> maximum available BW through the PCI chain. We can use this
>> value for mlx5e_get_pci_bw() instead of calculating ourselves.
>>
>> Signed-off-by: Tal Gilboa <talgi@mellanox.com>
>> Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 17 +++--------------
>> 1 file changed, 3 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> index d2b057a..d1d7427 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> @@ -3971,27 +3971,16 @@ static int mlx5e_get_pci_bw(struct mlx5_core_dev *mdev, u32 *pci_bw)
>> enum pcie_link_width width;
>> enum pci_bus_speed speed;
>> int err = 0;
>> + int bw;
>>
>> - err = pcie_get_minimum_link(mdev->pdev, &speed, &width);
>> + err = pcie_get_link_limits(mdev->pdev, &speed, &width, &bw);
>
> Why don't you refactor this a little so it calls
> pcie_print_link_status() like mlx5 and mlx4?
>
> I think this is the only call of pcie_get_link_limits() outside
> drivers/pci, and it seems like a little overkill here since you really
> don't need "speed" here.
I wouldn't like to call pcie_print_link_status() if I don't really want
to print the status. In this case mlx5e driver needs the PCI bandwidth
limitation in order to make a decision. I think it is good that we
expose a method to do precisely that.
>
> But I don't understand what's going on with mlx5e_get_max_linkspeed().
> It doesn't look like that is actually looking at the PCIe link speed,
> so maybe there's something special going on there.
mlx5e_get_max_linkspeed() queries for the port wire speed. mlx5e driver
might change some settings (CQE zipping, LRO) in case PCI bandwidth
can't support wire speed.
>
>> if (err)
>> return err;
>>
>> if (speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN)
>> return -EINVAL;
>>
>> - switch (speed) {
>> - case PCIE_SPEED_2_5GT:
>> - *pci_bw = 2500 * width;
>> - break;
>> - case PCIE_SPEED_5_0GT:
>> - *pci_bw = 5000 * width;
>> - break;
>> - case PCIE_SPEED_8_0GT:
>> - *pci_bw = 8000 * width;
>> - break;
>> - default:
>> - return -EINVAL;
>> - }
>> + *pci_bw = bw;
>>
>> return 0;
>> }
>> --
>> 1.8.3.1
>>
prev parent reply other threads:[~2018-02-25 11:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 15:35 [PATCH next V1 0/7] Report PCI device link status Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 1/7] PCI: Add a query function for PCI device's speed cap Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 2/7] PCI: Add a query function for PCI device's width cap Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 3/7] PCI: Calculate BW limitation for PCI devices Tal Gilboa
2018-02-22 20:21 ` Bjorn Helgaas
2018-02-27 12:17 ` Tal Gilboa
2018-02-27 15:19 ` Bjorn Helgaas
2018-02-27 15:34 ` Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 4/7] PCI: Print PCI device link status in kernel log Tal Gilboa
2018-02-22 19:57 ` Bjorn Helgaas
2018-02-25 9:30 ` Tal Gilboa
2018-02-27 12:18 ` Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 5/7] net/mlx4_core: Report PCI properties using dedicated function Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 6/7] net/mlx5: Report device PCI link status and issues Tal Gilboa
2018-01-15 15:35 ` [PATCH next V1 7/7] net/mlx5e: Use generic PCI function for BW calculation Tal Gilboa
2018-02-22 20:09 ` Bjorn Helgaas
2018-02-25 11:20 ` Tal Gilboa [this message]
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=f1341aae-db08-74fc-461d-7a074198aed8@mellanox.com \
--to=talgi@mellanox.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=tariqt@mellanox.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).