Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp564358pxp; Wed, 9 Mar 2022 08:15:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQQw8ot13IyNMU++FOHwQR+8+mdF18U6nE4CcGFwnWCM6J3R3KKCJKUy/DGvRXZd0fKR7X X-Received: by 2002:a05:6402:1590:b0:416:3524:1f5a with SMTP id c16-20020a056402159000b0041635241f5amr146779edv.391.1646842536737; Wed, 09 Mar 2022 08:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646842536; cv=none; d=google.com; s=arc-20160816; b=yL6wRmPReCRXcrpTi7LLiVFwxsDr+FaTY1cMYqEIbviP75+bdR6WPDUAEQ5l5iySV2 RZxRB2pSTnH90gvGaO8+PpFiCBVO5AThEmEVL5JSW7K5Oi6ubVrtV0YUCJU+Omvq0tf+ h1ariy+/1xc52mTV2UWCPPOcqPBN7pWuy6WAWL+JACgmfezTEbdHpwn4kwzSr07aFGXB jXVapKmF/jijFhvRbMtbDm70/UPwtd6/Bu4IKOYG7WfGCN73Egh3dd9SqIQF1JdllvR1 e087Qx87M2iYb+Wr8/3ExjekaEm+jwZOFf3DBDTbASYMCtPVNqdxcTuvXC6guctuSSMJ hkCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p7uOA+NpkOWtJ+FUb3jLMFkoXozp92uSS+8wqoqG9Lo=; b=YLFFZrmbkHfAkvjo2ngUK+talon7CUC54vmR/CM6mdr/3CimBEBGrNv1uPYAKDLTeR aRhLa38zz62tc97q7ZVXNyS210neo4A6fXTqk2FZOGeKB4KV0LF6EtWLo/yIJJ2RhgJP nLEs31Lt0VtaEQhHJhN6W59OrZhACiZeSG2fG5rdQq4Ii2qykMpBZXq1lbyNee8tPYDl ujWcX1cNLqmF7lCrG7asFj/EBfNDbTckK/4R5ZV0orsGk63HcdtWsIDW2QZH0KYdl94W DwzwjRGR9Dnc0zuxVtLIN6ZIol1zIlcG+coiNIoSsUGHO06ukVd8dTP1QK68MDZ7fR1a duQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=DhZKW7tS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh14-20020a170906a0ce00b006cf23ce90fcsi1447505ejb.88.2022.03.09.08.15.12; Wed, 09 Mar 2022 08:15:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=DhZKW7tS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232699AbiCIMOl (ORCPT + 99 others); Wed, 9 Mar 2022 07:14:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232694AbiCIMOk (ORCPT ); Wed, 9 Mar 2022 07:14:40 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A774EA09; Wed, 9 Mar 2022 04:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646828020; x=1678364020; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NxvyaH3e4/PtErqMJQl+2Rz010Co0lkGzj2KC5uXBsM=; b=DhZKW7tS74+F8THhsgLE2oL3MyoGFyzLwl14qPNyeEREKGMfujJcg1QC QD8eCqvv6nepxxcIBDlnZ9+pt8BJzNqgRKDgJnhDukTJazt/G4MiQh0CX bePB1OJjfHDmGxhaglUYheagwe9PAv0/2rZ/a5eynhdX2TCc7To+UTVnZ 35dRmA64rpLkkufjEjJpOEbbo5EjG43FnAg0Pnh/GeqG22ATqRpgJYn41 W9Diw9R+urP6RCLzdosh0xBRPJZZCNx9t7rousWdPeg2VaIspGMPJ2ygK /t74bu28bYGyQm12xiqdAOR2sH2mSyRHb3vK2lHRkWIKzNTHZCFd+Iel6 Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643698800"; d="scan'208";a="165084468" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Mar 2022 05:13:40 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Wed, 9 Mar 2022 05:13:40 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Wed, 9 Mar 2022 05:13:39 -0700 Date: Wed, 9 Mar 2022 13:16:32 +0100 From: 'Horatiu Vultur' To: David Laight CC: Andrew Lunn , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "UNGLinuxDriver@microchip.com" , "davem@davemloft.net" , "kuba@kernel.org" Subject: Re: [PATCH net-next] net: lan966x: Improve the CPU TX bitrate. Message-ID: <20220309121632.d77v2x27kfaqiuzo@soft-dev3-1.localhost> References: <20220308165727.4088656-1-horatiu.vultur@microchip.com> <20220308223000.vwdc6tk6wa53x64c@soft-dev3-1.localhost> <20220309091129.b5q3gtiuqlk5skka@soft-dev3-1.localhost> <45a9f88b140d44af8522e7d8a6abcbbf@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <45a9f88b140d44af8522e7d8a6abcbbf@AcuMS.aculab.com> X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 03/09/2022 09:57, David Laight wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > From: 'Horatiu Vultur' > > Sent: 09 March 2022 09:11 > > > > The 03/08/2022 22:46, David Laight wrote: > > > > > > From: Horatiu Vultur > > > > Sent: 08 March 2022 22:30 > > > > > > > > The 03/08/2022 22:36, Andrew Lunn wrote: > > > > > > > > > > > static int lan966x_port_inj_ready(struct lan966x *lan966x, u8 grp) > > > > > > { > > > > > > - u32 val; > > > > > > + unsigned long time = jiffies + usecs_to_jiffies(READL_TIMEOUT_US); > > > > > > + int ret = 0; > > > > > > > > > > > > - return readx_poll_timeout_atomic(lan966x_port_inj_status, lan966x, val, > > > > > > - QS_INJ_STATUS_FIFO_RDY_GET(val) & BIT(grp), > > > > > > - READL_SLEEP_US, READL_TIMEOUT_US); > > > > > > + while (!(lan_rd(lan966x, QS_INJ_STATUS) & > > > > > > + QS_INJ_STATUS_FIFO_RDY_SET(BIT(grp)))) { > > > > > > + if (time_after(jiffies, time)) { > > > > > > + ret = -ETIMEDOUT; > > > > > > + break; > > > > > > + } > > > > > > > > > > Did you try setting READL_SLEEP_US to 0? readx_poll_timeout_atomic() > > > > > explicitly supports that. > > > > > > > > I have tried but it didn't improve. It was the same as before. > > > > > > How many times round the loop is it going ? > > > > In the tests that I have done, I have never seen entering in the loop. > > In which case I'd do an initial status check before even > faffing with 'jiffies'. That is a good idea. I will do this change in the next version. > > It might even be that the status read is so slow that space > is always available by the time it is processed. > PCIe reads can be horribly slow. > Into our fgpa they end up being slower than old ISA bus cycles. > Probably several thousand cpu clocks. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) -- /Horatiu