Received: by 10.213.65.68 with SMTP id h4csp2937027imn; Mon, 2 Apr 2018 17:33:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CVcQGxM3h8p1owJjXKfIGkxnP6fqsYP82zL2nxPW0zBIqXPPGi+fBUYuLnOaoJmJrurLO X-Received: by 2002:a17:902:d20f:: with SMTP id t15-v6mr7154260ply.263.1522715613174; Mon, 02 Apr 2018 17:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522715613; cv=none; d=google.com; s=arc-20160816; b=lF5YsyaV59vGfbflBmVzZCAC63FSasSHjxuEAe1Y+BP5tyQCxZGWGilw751e/dg9v+ MDGHqLrpAmn+pcdaf2xcHC2v68ExaGzY/2MGr8xeAQQ5mPoNUeZeRblRToGRfoEnTnvS c1fB6hmqhoWTMJxgpQwN9yOtGYJECtqnx4ozbOfbYeLkkLCBQJ2ul0EL3+sS/vvvwIqH jloSdqKH1YWoyEhVTs5FpvTWeelVT9CwITUjMdVUIWn7/nfxfcmh+rLsuwOTvjb3kBt0 xhWGIJ1K7uxnKSx+WO0Ggp1yvz9qZAcIuKWMyjVT3T3pUr4inFF9VF2d7CfMeXigZjOg fD/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=fE9qqrtli0oD0ja8ltf+dvRXR4rym1DhiFyY/he6knk=; b=c++/VIFmD9ZAncsSMfWpls/DaGYyZ+h51UIaMo6J+P2V4BSA2AXyv2L6EwxK05FGiO X1/KZGYp4XQo3bTNAmEX5QmB3U0lYg7SP78M9FpOCBYjHewGSQMF5i3pBDe+fZuDFX+/ zmd3AXlq0W0T4BJ8xDmJvXJ8jnwH8xfIQkJfBlkxVcxdjyMtE8jnQLnufUhUptbJStGt G5fW2HxsfktgCFMW8EW8ktgm7vy4peD9gzWNjRlMamEmfvy8OzadKW4ZvVtdCQyKuDJ9 glhNh2ywiZUSEDd+8mckfO+xCIdXgDbSTSUrMWUPrHomjXBYXwt1STRxUE4Xc7jxPzlE 98LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kZN1wYm8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j23si1036691pgn.231.2018.04.02.17.33.08; Mon, 02 Apr 2018 17:33:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kZN1wYm8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754689AbeDCAbS (ORCPT + 99 others); Mon, 2 Apr 2018 20:31:18 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:55910 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754604AbeDCAbQ (ORCPT ); Mon, 2 Apr 2018 20:31:16 -0400 Received: by mail-wm0-f42.google.com with SMTP id b127so28532635wmf.5; Mon, 02 Apr 2018 17:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fE9qqrtli0oD0ja8ltf+dvRXR4rym1DhiFyY/he6knk=; b=kZN1wYm8modVKPDz0kHIlS9Fgjc/uThe60+X++Bqp1wCxJjjslP/vjrawy81xmMVbO G/BB1JjdSpnW3BXb9RhIAU2IDVVq6E7WDJQ89OKXrcZsDNAt5UqkU4Mj5zj9hmZ/vIF0 N2Rj1Kr5iCErNOryPM9m74v1DLTUqcdPyP3BD7d9zABXeV0vHbqmaIHprHbrWzojNJ6G bdVhiwLfSqAz9BcDge5DnzC+Tvi5bNYMzS7P9OvMr6TBjAD+tAFvVV5aNT4BWlw7jCxd J3xoRuH4dEdOTtHUYMAZhPbnZKn1u7KfFDbBfmG62DnCPi+W/RJhP4Lhy/y8I1TobjoS NBow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fE9qqrtli0oD0ja8ltf+dvRXR4rym1DhiFyY/he6knk=; b=NrZEFczKgCdZ6ihJScCCzsXv/1DHePK93UUj7l3BWuY2lM0aghWWTuKyZQq7hQoyg0 y/64tMLWyWKvlnv7ooK7VxVTxP+dejsLFbWTTwb+GFSkfhNsa45MmF126YWJa2Dht1Gj oto7j5+iysPgK9xPK53rWkhr3+Q+IptXFbuYpcRb1dygD/fIF4LQwVreVp5ZoxFlpa+C ZIJeUINs+x/yiEiCNHi+/z3k2ApU6W7OZQwIokhMPdHKZ/VdTIvaZNnTECVNmspEepD5 6Qb29Ez406GbbQGii0UZCjkE7v5Ywcz6USjdWJnu+4ffOzYrD6KfBGpTyvqniuoLbhq8 bZlw== X-Gm-Message-State: AElRT7EBIYIh84PBtkVWOylbxFQIG96lhJyvsDqxZWtWSmSEwBrthAUN lImBHg0VJq52EIfs7O555VFUZXdaPhsv6iVdJympYw== X-Received: by 10.80.243.136 with SMTP id g8mr14094715edm.133.1522715474561; Mon, 02 Apr 2018 17:31:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.203.135 with HTTP; Mon, 2 Apr 2018 17:30:54 -0700 (PDT) In-Reply-To: <20180402140501.GA244675@bhelgaas-glaptop.roam.corp.google.com> References: <152244269202.135666.3064353823697623332.stgit@bhelgaas-glaptop.roam.corp.google.com> <152244390359.135666.14890735614456271032.stgit@bhelgaas-glaptop.roam.corp.google.com> <31e66048-e8b8-47ba-baf5-023560b4c124@mellanox.com> <20180402004049.GA131023@bhelgaas-glaptop.roam.corp.google.com> <50346f44-de3f-b226-69ad-6de45e94e261@mellanox.com> <20180402140501.GA244675@bhelgaas-glaptop.roam.corp.google.com> From: Jacob Keller Date: Mon, 2 Apr 2018 17:30:54 -0700 Message-ID: Subject: Re: [PATCH v5 03/14] PCI: Add pcie_bandwidth_capable() to compute max supported link bandwidth To: Bjorn Helgaas Cc: Tal Gilboa , Tariq Toukan , Jacob Keller , Ariel Elior , Ganesh Goudar , Jeff Kirsher , everest-linux-l2@cavium.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 2, 2018 at 7:05 AM, Bjorn Helgaas wrote: > +/* PCIe speed to Mb/s reduced by encoding overhead */ > +#define PCIE_SPEED2MBS_ENC(speed) \ > + ((speed) == PCIE_SPEED_16_0GT ? (16000*(128/130)) : \ > + (speed) == PCIE_SPEED_8_0GT ? (8000*(128/130)) : \ > + (speed) == PCIE_SPEED_5_0GT ? (5000*(8/10)) : \ > + (speed) == PCIE_SPEED_2_5GT ? (2500*(8/10)) : \ > + 0) > + Should this be "(speed * x ) / y" instead? wouldn't they calculate 128/130 and truncate that to zero before multiplying by the speed? Or are compilers smart enough to do this the other way to avoid the losses? Thanks, Jake