Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1707926rdb; Thu, 7 Dec 2023 06:54:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXBVpaOxth9Xi6tTlJJopClfwaCC1x5McOM1KWUGjj8Orh1LZ8wKSy1rF4TPxAOA+Jfr58 X-Received: by 2002:a17:902:e889:b0:1d0:c738:73c6 with SMTP id w9-20020a170902e88900b001d0c73873c6mr2603447plg.109.1701960885453; Thu, 07 Dec 2023 06:54:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701960885; cv=none; d=google.com; s=arc-20160816; b=LB70O347AALmSLQTrzMyvjj515I3RmzNVOqSRmlzNipOlqnR+jOaKOothMl6inW1dl FX4EfjtxJ0/NntEuMiSU5o7m3hdARuHJFOhqUeJXe5SklDn9LSDxQHouIr2LmGpt5s3F qEOeUobHx4AUCPlkE63lsIszPHNJ+Hf4mnyRwAamcHYb/xZlvPnQ4tLqHNTzoYpNqegY +OMPUR7VDyNpcpM/XWy2x3nKHP7Ufhhr5C/6mrkeE/tQG+/DWAB5Iyi/glJ9DmpuxJ+o /wdMVfPEezjwU23ATBkw4tJ2HcwPTgmj9hpWJNY8VyuDihawzqb4IiftUcJ+fQBunme1 mXhw== 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=HZuWJZJT56neic9r6wbg2bseNLCneoOJMEj6j6nq8xM=; fh=m7RHM5uPhUOBthW//BLCXovHwjcELYnrfoQwnidLxxc=; b=VhNKsOOROBHM8iis8J9PfZ2pQ0euWN5QpDUaRQ51zVEOnrSn5Ug2dsAklepmwPREqZ 5L+3uty5lVT0fucEaRXnUSBgaem3GAqU+J6JsBK4yY1RmJT75e+VEtYCbDr1m59eZr0m 37WG+MCIZJmKv5Fe2Rs6f+JTWdp+ZysKDK8BoPo3re/S4izWWs1v/fX4Qii1tPHUIhcv KM64KrEYAtziSKhfO60pAfKcIRgqJStQwy8AlEI8Ssa4HJQHbhykF9VFZP1nMHdPGHl2 74tyyQbBZ2sgEdF5gDdQI5wIAsALpDV7VAWfTyDlCg3hObs/+NiOh1yP3shwpmxxIo3r /I4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Kj5JYHCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id z24-20020a1709028f9800b001d07b6a0aeasi1200646plo.325.2023.12.07.06.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 06:54:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Kj5JYHCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 00243808A34A; Thu, 7 Dec 2023 06:54:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443432AbjLGOyY (ORCPT + 99 others); Thu, 7 Dec 2023 09:54:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443429AbjLGOyX (ORCPT ); Thu, 7 Dec 2023 09:54:23 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D4DCAC; Thu, 7 Dec 2023 06:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=HZuWJZJT56neic9r6wbg2bseNLCneoOJMEj6j6nq8xM=; b=Kj5JYHCnocsxjpn10612FX5k82 XXApSgMi9D34L1+NjQx1nN3zlGdK02Km1aTk/EkiYYLhdkgec/qv8lok6YMXxnHp4TtX8Gs6ewpJz OBOfjFGgABnc8jObbYw1cJmwhFhU67WIg9z21M19wwSNEFZENt9jo6NX4gsrVfw66a70=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rBFlQ-002K3T-Qc; Thu, 07 Dec 2023 15:54:08 +0100 Date: Thu, 7 Dec 2023 15:54:08 +0100 From: Andrew Lunn To: Serge Semin Cc: Maxime Chevallier , Heiner Kallweit , Russell King , Alexandre Torgue , Jose Abreu , Jose Abreu , Tomer Maimon , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 09/16] net: mdio: Add Synopsys DW XPCS management interface support Message-ID: <19ebc244-6d79-4e12-8ac4-fcf046106a07@lunn.ch> References: <20231205103559.9605-1-fancer.lancer@gmail.com> <20231205103559.9605-10-fancer.lancer@gmail.com> <20231205133205.3309ab91@device.home> <15e6857a-b1d1-465a-945e-6f31edac62fb@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 07 Dec 2023 06:54:43 -0800 (PST) On Thu, Dec 07, 2023 at 04:35:47PM +0300, Serge Semin wrote: > Hi Andrew > > On Wed, Dec 06, 2023 at 06:01:30PM +0100, Andrew Lunn wrote: > > > > You shouldn't use inline in C files, only in headers. > > > > > > Could you please clarify why? I failed to find such requirement in the > > > coding style doc. Moreover there are multiple examples of using the > > > static-inline-ers in the C files in the kernel including the net/mdio > > > subsystem. > > > > > The compiler does a better job at deciding what to inline than we > > humans do. If you can show the compiler is doing it wrong, then we > > might accept them. > > In general I would have agreed with you especially if the methods were > heavier than what they are: > static inline ptrdiff_t dw_xpcs_mmio_addr_format(int dev, int reg) > { > return FIELD_PREP(0x1f0000, dev) | FIELD_PREP(0xffff, reg); > } > > static inline u16 dw_xpcs_mmio_addr_page(ptrdiff_t csr) > { > return FIELD_GET(0x1fff00, csr); > } > > static inline ptrdiff_t dw_xpcs_mmio_addr_offset(ptrdiff_t csr) > { > return FIELD_GET(0xff, csr); > } > > > But in general, netdev does not like inline in .C > > file. > > I see. I'll do as you say if you don't change your mind after my > reasoning below. > > > Also, nothing in MDIO is hot path, it spends a lot of time > > waiting for a slow bus. So inline is likely to just bloat the code for > > no gain. > > I would have been absolutely with you in this matter, if we were talking > about a normal MDIO bus. In this case the devices are accessed over > the system IO-memory. So the bus isn't that slow. O.K, so its not slow. But how often is it used? PHYs tend to get polled once a second if interrupts are not used. But is the PCS also polled at the same time? Does this optimisation make a noticeable difference at once per second? Do you have a requirement that the system boots very very fast, and this optimisation makes a difference when there is heavier activity on the PCS at boot? Is the saving noticeable, when auto-neg takes a little over 1 second. The best way to make your case is show real world requirements and benchmark results. Andrew