Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551AbdGGVtA (ORCPT ); Fri, 7 Jul 2017 17:49:00 -0400 Received: from mail-by2nam01on0115.outbound.protection.outlook.com ([104.47.34.115]:62176 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751001AbdGGVs6 (ORCPT ); Fri, 7 Jul 2017 17:48:58 -0400 From: Casey Leedom To: Ding Tianhong , "ashok.raj@intel.com" , "helgaas@kernel.org" , "Michael Werner" , Ganesh GR , "asit.k.mallick@intel.com" , "patrick.j.cramer@intel.com" , "Suravee.Suthikulpanit@amd.com" , "Bob.Shaw@amd.com" , "l.stach@pengutronix.de" , "amira@mellanox.com" , "gabriele.paoloni@huawei.com" , "David.Laight@aculab.com" , "jeffrey.t.kirsher@intel.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "mark.rutland@arm.com" , "robin.murphy@arm.com" , "davem@davemloft.net" , "alexander.duyck@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v6 0/3] Add new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag Thread-Topic: [PATCH v6 0/3] Add new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag Thread-Index: AQHS61FojWeFUbyhA0yWrtj3U/TwHqJI9lhq Date: Fri, 7 Jul 2017 21:48:48 +0000 Message-ID: References: <1498133721-21152-1-git-send-email-dingtianhong@huawei.com> In-Reply-To: <1498133721-21152-1-git-send-email-dingtianhong@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=chelsio.com; x-originating-ip: [12.32.117.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR12MB1437;7:cxZFCc/yai/MwtHtMrTxKSeS9ueoSAlIldeu12kdoQ1cZd9rMT/1PLRVI/fA49qdoZEVh5M5Jr0MMYtqdWOECpFyUSDzg/9R3HkFm7JmWdfTjVb0DryibagdiE/orK25HbupCznBhPHq3V4dDDArwZmxNG+Z72pFKDJIkQnCtrQltvonFs465l1NBvOKRzJRWvfRj1+AteIbvDRdvwyw3bBzFGWGW8W3CyptvvjY5Nu43851LEhsTTt4Hdq9ZKZ6vlPILl3+W0b+wni2czdzHh8U8bzRrX8uBRLCwDElIirLb375ajoDH+J1Vm4MlLVmetRYm7bhUoeaYzDozKZQ4FKQcUt1IHMdH5NE6AbOCLjgNwO6sRf4cX6tV2TUtN6BMAYuDVaeKlLvJ0My3hU7bH5B+iVxiSheA0tbMPnnO9C0qPYh+o43L854epolHVbzW9UvqEBc3H1vjqMFvx+QIpjwtOeaXx2iG7RNNfBoUvefICZLJ1SYHWcLJB7jNAGRQG+UFWL43BTAMG0Fglmc/BWUz2kjdgM64mKc4Ll7BU4KvIHHQP/usyQcARATf9nC8/rcpsTTr3MCJds0uqG9ygEQqyCJ98z+SI75yP56tS0fVwQ6l93dbCHzzmbQ7tvsshS8D5e5ggopWQBa2kBaPzV/Do5lN+/eXaRMBRIO1K00OfnRyvQRFxYiE9CYht7kXUrak7qMpG7L0T8rlu10EPOB3+NgSRoMwrImiDGIf7Ac0uWnHDGP6u8ibJQdSbMMdfgNhzrQlavjkkoAT/47EjRQAkQPFAD1z8Seo0Y78dA= x-ms-office365-filtering-correlation-id: 54649245-e588-45ac-5692-08d4c581f322 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(300000503095)(300135400095)(2017052603031)(201703131423075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR12MB1437; x-ms-traffictypediagnostic: MWHPR12MB1437: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(236129657087228)(148574349560750)(247924648384137); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(2017060910069)(5005006)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123564025)(20161123558100)(2016111802025)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(6043046)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR12MB1437;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR12MB1437; x-forefront-prvs: 0361212EA8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39840400002)(39410400002)(39450400003)(39400400002)(51444003)(33656002)(2950100002)(76176999)(77096006)(54356999)(551934003)(189998001)(50986999)(99286003)(55016002)(7736002)(81166006)(8936002)(229853002)(9686003)(8666007)(8676002)(6436002)(2906002)(6506006)(305945005)(39060400002)(7696004)(7416002)(25786009)(53936002)(102836003)(3846002)(14454004)(66066001)(2900100001)(6246003)(38730400002)(2201001)(3660700001)(3280700002)(86362001)(6116002)(74316002)(5660300001)(478600001)(2501003)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR12MB1437;H:MWHPR12MB1600.namprd12.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-OriginatorOrg: chelsio.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2017 21:48:48.4177 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 065db76d-a7ae-4c60-b78a-501e8fc17095 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1437 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v67LnFU6025659 Content-Length: 3802 Lines: 73 Hey Ding, Bjorn, Alexander, et.al., Sorry for the insane delay in getting to this and thanks especially to Ding for picking up the ball on this feature. I got side=-tracked into a multi-week rewrite of our Firmware/Host Driver Port Capabilities code, then to the recent Ethernet Plug-Fest at the University of New Hampshire for a week, and finally the 4th of July weekend. Digging out from under email has been non-amusing. In any case, enough excuses. I'm looking at the "v6" version of the patches. If this isn't the corect version, please yell at me and I'll look at the correct one immediately. In the change to drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c (patch 3/3) it looks like the code is checking the Chelsio Adapter PCI Device to see if Relaxed Ordering is supported. But what we really want to test is the Root Complex port. I.e. something like: diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 38a5c67..546538d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -4620,6 +4620,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) struct port_info *pi; bool highdma = false; struct adapter *adapter = NULL; + struct pci_dev *root; struct net_device *netdev; void __iomem *regs; u32 whoami, pl_rev; @@ -4726,6 +4727,24 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) adapter->msg_enable = DFLT_MSG_ENABLE; memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); + /* If possible, we use PCIe Relaxed Ordering Attribute to deliver + * Ingress Packet Data to Free List Buffers in order to allow for + * chipset performance optimizations between the Root Complex and + * Memory Controllers. (Messages to the associated Ingress Queue + * notifying new Packet Placement in the Free Lists Buffers will be + * send without the Relaxed Ordering Attribute thus guaranteeing that + * all preceding PCIe Transaction Layer Packets will be processed + * first.) But some Root Complexes have various issues with Upstream + * Transaction Layer Packets with the Relaxed Ordering Attribute set. + * The PCIe devices which under the Root Complexes will be cleared the + * Relaxed Ordering bit in the configuration space, So we check our + * PCIe configuration space to see if it's flagged with advice against + * using Relaxed Ordering. + */ + root = pci_find_pcie_root_port(pdev); + if (!pcie_relaxed_ordering_supported(root)) + adapter->flags |= ROOT_NO_RELAXED_ORDERING; + spin_lock_init(&adapter->stats_lock); spin_lock_init(&adapter->tid_release_lock); spin_lock_init(&adapter->win0_lock); The basic idea is that we want to find out if the Root Complex is okay with TLPs directed its way with the Relaxed Ordering Attribute set. I also have to say that I'm a bit confused by the pcie_relaxed_ordering_supported() in use here. It seems that it's testing whether the PCI Device's own Relaxed Ordering Enable is set which governs whether it will send TLPs with the Relaxed Ordering Attribute set. It has nothing to do with whether or not the device responds well to incoming TLPs with the Relaxed Ordering Attribute set. I think that we really want to use the pci_dev_should_disable_relaxed_ordering() API on the Root Complex Port because that tests whether the quirck fired on it? I.e.: + root = pci_find_pcie_root_port(pdev); + if (!pci_dev_should_disable_relaxed_ordering(root)) + adapter->flags |= ROOT_NO_RELAXED_ORDERING; Casey