Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2437727rdb; Fri, 8 Dec 2023 08:08:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGR/JeLAFWvfp0AY6+1mBBWZOyhPagYqEHIxBFoBKttuaWHG7otchE0jLLlY3ud+OebvOec X-Received: by 2002:a05:6358:7e83:b0:16e:33e:3a9c with SMTP id o3-20020a0563587e8300b0016e033e3a9cmr171335rwn.6.1702051690498; Fri, 08 Dec 2023 08:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702051690; cv=none; d=google.com; s=arc-20160816; b=AZyBMa9dtsYd/g2NMJqxghM3dlT2CB0a2BPhDWh79EWUXyl8TNHE7l834bAsp2bw8J X90C+bX8p4l2mQRtulQqGl/fgF9E8BPU3XI0QI3yNKiRxLbQ23qkNHEkeDzMguKm6GU8 ZHi39T6mB5Sp4xoc7q4doQFLi/TM0tymsvQWgU+7syD90Chlisk9gZQQAYaQ/xMuJgca ZfXUSBqyGj4mT72bjV0J2H/smJiBTioGyyBieGLmR7ZVAC5uB/is+9usdZPl+7fpcdBP dR8ldeRDxv7ETCvwwY4/lZvqD2ruqK0Mt4VlXZ6U2AgkMrJgBeg5OsUOZqismU7twpKf iRUA== 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=CfiPX6OGNhZRjUiwvlyjSmKemrJqXvraxcvBV131SRo=; fh=7T4hZd9JIMKPEPDyR8nco2Ku1T89EqNZFHQ7PfKuxrE=; b=eC7DW/YBpjxisPn4ZzTW0kBoAzq9etkN1qXkP4kAPjXRtB1eCpUWFNt+mXcqYAvE0F Rdn15ghPJ1yb/VsCQTbyHoroG1OHAgKrPdYHZBc0RINc/F5uC1H/wxFpVcslPWLlDZ2C ajKfMozoC6FoX9ViE+DaVxESjTxglj0Frk+hjPQjzcDpM2oVew0V7q1yOpwL0rf+IRNR flrNk8jaYVsKwJZ0j2+4MCeDcnAIYAZMFV7B6WRDC+EZdjQDO+9sbDjM6Gc6LHjQ3Lry bLwQZT0f4jSdtbzo9CRjuv28BZkM29KkcZJbzrcmjcjJQLlwjT0GddmXSebdM2lgZhO7 mMbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mrHUqZ91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x20-20020a631714000000b0057e21f51ab3si1676650pgl.665.2023.12.08.08.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:08:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mrHUqZ91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 18F538725CD4; Fri, 8 Dec 2023 08:07:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233599AbjLHQHn (ORCPT + 99 others); Fri, 8 Dec 2023 11:07:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbjLHQHl (ORCPT ); Fri, 8 Dec 2023 11:07:41 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62647173F; Fri, 8 Dec 2023 08:07:47 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2c9f7fe6623so27146861fa.3; Fri, 08 Dec 2023 08:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702051665; x=1702656465; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=CfiPX6OGNhZRjUiwvlyjSmKemrJqXvraxcvBV131SRo=; b=mrHUqZ91dhfQgERBnCN1Sm/97xw+v2x/YNlFJzYF6+G/JeSfUYBAK2A90iNepCR3CJ fdYWj2JpSCxW517qbEmMD/QLAV5R74rM1FSgST7uvIYsFBJy0gvlNRv5BB8QPz2qCd0w NT0b4V7UbT7fdcnPbWHIz2saxPiruZc918DuG0IuVCsnwSuAUIwAeL3VVjCYs6HNfXI6 xWeTtJNHSzACBGxSGzZdHKPrvKOWTtMZ275JNZd6afN0bI/BH0OZYl0XCPjqTKOtMann rQdR39D9zXh0Hy3s6HGXl7Op8TU91T3psdwjpZzGFNjKIJ3aFuaK8O2IiSc69vdVFLIC N7jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702051665; x=1702656465; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CfiPX6OGNhZRjUiwvlyjSmKemrJqXvraxcvBV131SRo=; b=GUYiIkYFI344ZBapEt/hkew1dg4mqpbxJGff9szzxJ/MTjE9DuGqZXzbBQ0u+eBPRV mpKjQSVuSW+AFQwg2t8j30cO4ZhFOwYT6V1fwR/n18pSlem+kZuKFGbZjqNubSsfF98m fPQMpAehpFxiw80hQ9fLm5Pk9hck5JkeUtOrguv9c1HBrvRVKjvydcvYfCr2MfDEG2IK etipxSiivFhRV5f7cJtrpuf2pUD8voj4Kmvaxhe/9Q0rsUmHu4JBU0R57gmxQR22DEE4 JWgUOeWKW5HZIikrupD1hHP1CZUfEaNDWsi58OhWmOBnkE8H2uyZPppMa4z+JQBDuVhn hzWA== X-Gm-Message-State: AOJu0YyWX71BJ3SkNQk7wEefJ8LLo04z8sJ5XjPazx4McwOm0+vyVn6S 2AZgY/dDmyFEhd0pSrZxLPk= X-Received: by 2002:a2e:3008:0:b0:2ca:a3d:dcda with SMTP id w8-20020a2e3008000000b002ca0a3ddcdamr41271ljw.57.1702051665318; Fri, 08 Dec 2023 08:07:45 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id w2-20020a05651c102200b002ca0e0c837asm259858ljm.100.2023.12.08.08.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:07:44 -0800 (PST) Date: Fri, 8 Dec 2023 19:07:42 +0300 From: Serge Semin To: Andrew Lunn 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: 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> <19ebc244-6d79-4e12-8ac4-fcf046106a07@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19ebc244-6d79-4e12-8ac4-fcf046106a07@lunn.ch> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 08:07:58 -0800 (PST) On Thu, Dec 07, 2023 at 03:54:08PM +0100, Andrew Lunn wrote: > 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. You do know how to well define your point.) Polling is what currently implemented in the XPCS driver indeed. So in this case such small optimization won't be even noticeable. Although theoretically the IO-access could be performed on the fast paths, in the IRQ context, but it could be relevant only if the DW XPCS device had the IRQ feature activated on the particular platform and the DW XPCS driver supported it. But seeing the driver currently doesn't support it and the DW XPCS could be also found on the DW MAC SMA MDIO bus (non-memory-mapped case), always handling IRQ in the hardware IRQ context would be wrong. Splitting up the handlers would be over-complication for indeed doubtful reason, since inlining those methods won't gain significant performance even in that case. And of course I don't have such strict requirements as you say. So I'll drop the inline keywords then. Thank you very much for having kept discussing the topic in order to fully clarify it for me, even though the issue could have seemed unimportant to spend time for. -Serge(y) > > Andrew