Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3252820pxj; Mon, 7 Jun 2021 06:18:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ggr/60uJTcXlq5ed0PrwPoxynziY2JhWIFJHvEOj5NF3w3B0iv0tGbYnaUevcJb0k9n6 X-Received: by 2002:a50:d64a:: with SMTP id c10mr6112317edj.199.1623071930061; Mon, 07 Jun 2021 06:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623071930; cv=none; d=google.com; s=arc-20160816; b=AD+GokMs2S/HHEwdxby+omlREdilelBe2Fe0E5XtgudmtOCnoFi/X6wWPAGmrE0VRq GQAFvpXJDdH7keZzt4lc9LbIuR2kYFVGO8YAvw6MVkMp5qGkadIdN/mvOm+ikMKsG0Bw Ur4mF3z27hsYcXS4CyMqRuxE2J0ei+K9Fm10zNKALg5Qr9sfaANtA55ALy3NXFKq3MCy 5Zv0AHCiz8k73OWWHeIiweqcwLG8YeGJHOJ++qU3yyaAW5HfNe+gOVgXSjHbxLmYf0s3 dwd7wEApdI2MfSAmEKPmjQnBDWXniVtzW6jjz/X6lW5Y1lLPzQfNgauq6xaE/Pc3fbp+ smKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=3dGAudagzRTvkoR2XIwZeG30phayXKEraPiN+N9tVLI=; b=QTqVvRaAmxwRfYtapeIZo8cEJoLcsqPGkSEw6AdVEtmPWDYb1k4r7DG+A4tN3Ko4Py 5J1PuMaf5ukaBPFqUsUU9cBz7JuunfLG1QoZViq7nhO497FACffPLAzmHE3nRCkhE2uv 6XnLXNpLVVgxVDDDdkz8cT8eVqdU7M7tf7xLLrv6RxzLivgSctraPfsFuJiQCj8g9+Gr QtjGqM3Cs/b0bvayU3LwejhyhlDLXR/vW3YceZ+1EWuuMhe6XrtNGEY35lqR5Rxy60CA sFZJWP7OYgItCP3kQz/dEXS64g/kUgiD2hch8nBHGGjDEJ//s2H7qziX1oi64hI0Po1V B1cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si12291948ejo.445.2021.06.07.06.18.26; Mon, 07 Jun 2021 06:18:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbhFGNTG convert rfc822-to-8bit (ORCPT + 99 others); Mon, 7 Jun 2021 09:19:06 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:37005 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbhFGNTG (ORCPT ); Mon, 7 Jun 2021 09:19:06 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-232-PLAYMgjKODCUrXQ11EE9cw-1; Mon, 07 Jun 2021 14:17:12 +0100 X-MC-Unique: PLAYMgjKODCUrXQ11EE9cw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 7 Jun 2021 14:17:11 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.018; Mon, 7 Jun 2021 14:17:11 +0100 From: David Laight To: 'Andrew Lunn' CC: 'Koba Ko' , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , "netdev@vger.kernel.org" , Linux Kernel Mailing List Subject: RE: [PATCH] r8169: introduce polling method for link change Thread-Topic: [PATCH] r8169: introduce polling method for link change Thread-Index: AQHXW1Z1J4XkbqR7K0q4sy48RuQacKsIelDA///1bwCAABSCIA== Date: Mon, 7 Jun 2021 13:17:11 +0000 Message-ID: <85afdf3eb2de443da78f6c10c8eb4dc7@AcuMS.aculab.com> References: <20210603025414.226526-1-koba.ko@canonical.com> <3d2e7a11-92ad-db06-177b-c6602ef1acd4@gmail.com> <16f24c21776a4772ac41e6d3e0a9150c@AcuMS.aculab.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn > Sent: 07 June 2021 13:50 > > On Mon, Jun 07, 2021 at 12:32:29PM +0000, David Laight wrote: > > From: Koba Ko > > > Sent: 07 June 2021 05:35 > > ... > > > After consulting with REALTEK, I can identify RTL8106e by PCI_VENDOR > > > REALTEK, DEVICE 0x8136, Revision 0x7. > > > I would like to make PHY_POLL as default for RTL8106E on V2. > > > because there's no side effects besides the cpu usage rate would be a > > > little higher, > > > How do you think? > > > > If reading the PHY registers involves a software bit-bang > > of an MII register (rather than, say, a sleep for interrupt > > while the MAC unit does the bit-bang) then you can clobber > > interrupt latency because of all the time spent spinning. > > That is not what PHY IRQ/POLL means in the PHY subsystem. > > Many PHYs don't actually have there interrupt output connected to a > GPIO. This is partially because 803.2 C22 and C45 standards don't > define interrupts. Each vendor which supports interrupts uses > proprietary registers. So by default, the PHY subsystem will poll the > status of the PHY once per second to see if the link has changed > state. If the combination of PHY hardware, board hardware and PHY > driver does have interrupts, the PHY subsystem will not poll, but wait > for an interrupt, and then check the status of the link. I know. I might be 30 years since I wrote anything to read MII but I don't remember seeing anything that made it less horrid. One of the MAC units (probably AMD lance based) could be configured to repeatedly read one PHY register and generate a MAC interrupt if it changed - but I've not seen that on some later MAC chips. > As for MII bus masters, i only know of one which is interrupt driven, > rather than polled IO, for completion. The hardware is clocking out 64 > bits at 2.5MHz. So it is done rather quickly. I profiled that one > using interrupts, and the overhead of dealing with the interrupt is > bigger than polling. 64 bits at 2.5MHz is some 64000 cpu clocks - not inconsiderable. It has to be said that I don't know how to solve the delays associated with software bit-bang (apart from persuading the hardware engineers it isn't a good idea). With my 'hardware engineer' hat on (I'm currently (ir)responsible for some FPGA internals as well as the drivers) the logic to do things like I2C (etc) reads and writes from fpga memory sits in a tiny corner of a modern device. One possibility for 'slow polls' is to do them slowly! One edge per timer tick - although 'tickless' probably kills that. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)