Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp603062pxb; Mon, 8 Nov 2021 19:32:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAqHXYbNyDXCFtrQljWjDoke/gZbynSHWJFncdePlbEVB2Qd7eGD+48hovNMhOiXYWAchC X-Received: by 2002:a05:6e02:1ca9:: with SMTP id x9mr3002846ill.273.1636428759059; Mon, 08 Nov 2021 19:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636428759; cv=none; d=google.com; s=arc-20160816; b=TrcBhQ19P4FoM+VTBLXXNISDIXsMnvSC0B8fu60OXO/ZNu34jOpvNpJ0bhQmnDR1vW rKkHW5GIhFrU0FMu0SH2zYW4GgrCF5A9GghgXrXEnKBeG22Gk/20kiWPJtYPSHKJga3N i8dEP3i/q0epksL5PpK35/ULHGTMbT+cZD9J3D8tChC5iN/grkRN90dwfGfTiqP0G62X D5sa+phqyJ5DaBevBgZ/p9VBbGZ7/8igK0KVhy9CFt7SjX3GXWBlOlos2vXsPccZg2HJ fp3A6gU8xqVuavtWvc0ry4ZLxisrdjhWMk/G/DVT+NoIvxCzhf4dppAPCSEeSm5L1zHn ZO3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=nvHu9sMwS3Jh1wyFZX2YYD0qX7HKWeqB/1p2X9MPQWE=; b=a5oNEtYwknkWaa3qR4/DEwTnVNAzhzgFejoASWHy294jCol5vTMwPtzBPl+5DddDNW jXX/HMANp6Nd5tqG/XCsq6Lja2z+aHsNQwOdkRi1eN3llwftG8tMj/GB1qzqOaXZUZCx LKsgZO3cy+F6czmjIiGEd+oBLqon13R07Qd5rlEpWgKgMTyqTyuBofocpYeCS0yYA8ls Zj1OnS6jTLZNAy2aQMv7nf7NFO9tyeo7jnWWo9D54kE7IDUqf2BQymXTR1H8UaOptNJA QAm/IduXpO1rmUbD8aoZNpGT8ghQiIGzd6SmfDDYBEWU+Xp/2fcc8sVk5lkh1OSCtjpT CweA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y9w0lTil; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si39191349ill.116.2021.11.08.19.32.24; Mon, 08 Nov 2021 19:32:39 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y9w0lTil; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238460AbhKHUOD (ORCPT + 99 others); Mon, 8 Nov 2021 15:14:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:35318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbhKHUOB (ORCPT ); Mon, 8 Nov 2021 15:14:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF69260234; Mon, 8 Nov 2021 20:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636402276; bh=rEhGYaNhEjOwF3udFY6tXD+7DrAWIkpttgy+7HoR1tU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Y9w0lTil+unC2FCt3Pd3O202/5SxrND+4WcKH3p9Z2H2N5+wxn+Dy/+d4djm0iGbW uFWQjQWTUnWfS7bG4Udikz5BZuQcvaZKCFYNvHURe1UjhRZKyYAJCo5RGGmw88jAvx I2+A+hxFnE7Qmxnm46Um1cZKlpFJB+Dnty2We9kVtWlxeJphppE3Io+YZTGuTf1ZF9 xfVh4F5rQ4+HFXOTcgE9iHGnu8heOlEkgT9vAT3qCAmVsz5/6g5wFzjeRWGT1SRY3K oYthfGTHH6BVwmmZ5ugGZKqjk7R8q3fXVMc64JumVidBT0N39LU2LtAVuSMAklVudd dG0ZmGQERQgMA== Date: Mon, 8 Nov 2021 21:11:10 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Andrew Lunn Cc: Ansuel Smith , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Rob Herring , Jonathan Corbet , Pavel Machek , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [RFC PATCH v2 1/5] leds: trigger: add API for HW offloading of triggers Message-ID: <20211108211110.4ad78e41@thinkpad> In-Reply-To: References: <20211108002500.19115-1-ansuelsmth@gmail.com> <20211108002500.19115-2-ansuelsmth@gmail.com> <20211108171312.0318b960@thinkpad> <20211108185637.21b63d40@thinkpad> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Nov 2021 20:53:36 +0100 Andrew Lunn wrote: > > I guess I will have to work on this again ASAP or we will end up with > > solution that I don't like. > > > > Nonetheless, what is your opinion about offloading netdev trigger vs > > introducing another trigger? > > It is a solution that fits the general pattern, do it in software, and > offload it if possible. > > However, i'm not sure the software solution actually works very well. > At least for switches. The two DSA drivers which implement > get_stats64() simply copy the cached statistics. The XRS700X updates > its cached values every 3000ms. The ar9331 is the same. Those are the > only two switch drivers which implement get_stats64 and none implement > get_stats. There was also was an issue that get_stats64() cannot > perform blocking calls. I don't remember if that was fixed, but if > not, get_stats64() is going to be pretty useless on switches. > > We also need to handle drivers which don't actually implement > dev_get_stats(). That probably means only supporting offloads, all > modes which cannot be offloaded need to be rejected. This is pretty > much the same case of software control of the LEDs is not possible. > Unfortunately, dev_get_stats() does not return -EOPNOTSUPP, you need > to look at dev->netdev_ops->ndo_get_stats64 and > dev->netdev_ops->ndo_get_stats. > > Are you working on Marvell switches? Have you implemented > get_stats64() for mv88e6xxx? How often do you poll the hardware for > the stats? > > Given this, i think we need to bias the API so that it very likely > ends up offloading, if offloading is available. I am working with Marvell PHYs and Marvell switches. I am aware of the problem that SW netdev does not work for switches because we don't have uptodate data. It seems to me that yes, if the user wants to blink the LEDs on activity on switch port, the netdev trigger should only work in offload mode and only on LEDs that are connected to switch pins, unless we implement a mechanism to get statistics at lest 10 times a second (which could maybe be done on marvell switches by reading the registers via ethernet frames instead of MDIO). Marvell switches don't seem to support rx only / tx only activity blinking, only rx/tx. I think this could be solved by making rx/tx sysfs files for netdev trigger behave so that writing to one would also write to another. But since currently netdev trigger does not work for these switches, I think making it so that it works at least to some fashion (in HW supported modes) would still be better that current situation. I will try to look into this, maybe work together with Ansuel. Marek