Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5495526rwd; Sun, 18 Jun 2023 12:44:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5YaVab/PXOa8Z3CcHn5250usSr03MiK4N/cF5Skp8MbrRO2FBYjfUEeQIZwILUiC7tM5+T X-Received: by 2002:a05:6358:9f9d:b0:129:c564:63e0 with SMTP id fy29-20020a0563589f9d00b00129c56463e0mr3784271rwb.23.1687117481929; Sun, 18 Jun 2023 12:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687117481; cv=none; d=google.com; s=arc-20160816; b=vcC0OSealfSWcIW/x4S6AWYknwEhVuiUwxUDgC9eMSAKHw2NtcodbiyvzKvMYXFAyk 0NEIIkOWm1L20HBBvVLZKzwUYRNhjdF1SlBnAne5SPKxMbdDerJ4eixSwaNOameRepOb 8Otm4yO5x+OAJQB0Km4SALJ0EXywyY7lmH/7Ar79yXlBBB2paF8nWJhIvbP2hTJslbMp P2t0esFQebKk/AocbpPL78GCrMLHUmtZ/z/Nm1+c4NzROSDCfaEPb6PkaPhLZMXOQ8aL YvHSXfqPDPNki6TU+kFb8uexVSqoLteZWmIDcjA8Lsz7TAP/W2hYImAJrRjEiKvd9Qlo yDtA== 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 :message-id:date:subject:to:from:dkim-signature; bh=MgtexUEGrgjvYhEdRHaEOKyKO3yC+i0FtmJ8yuwDDUk=; b=XlipMuD1JiH2JiPc0Rg8ZoM7+XyfjqPBYlGGYI9Rk9i70Diorf8M1QUMwMjys/Hqzf lvIRKmEVQbBXVuIwBOPl7e86clStD2KgKnslR9Ijd0R5KgpHBVtQVozl4DpZEndDLuZk uMPKhpMbV4TqC5EqY1qqKEuu2T9Lx337TPzTh6jVtbBwi7GlSfiBpYvwVkepR3mn5Qt4 aUN6O8a8IuBuMWxv6YCwdrVrAJe73Uhel7a354Tq7X1CAYeW18HjSc6RqlmceAgtr+2a pCmpJ5w6+pvPyFLGiub9cCsdY0iRar5zufmARC0vWxoMWv6RvGR9l3xgTQH88X55X7fp X1Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ZTUEfNFn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902c41000b001b3ca91e3c7si10914490plk.7.2023.06.18.12.44.25; Sun, 18 Jun 2023 12:44:41 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20221208 header.b=ZTUEfNFn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229519AbjFRTYH (ORCPT + 99 others); Sun, 18 Jun 2023 15:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjFRTYG (ORCPT ); Sun, 18 Jun 2023 15:24:06 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691CCFC; Sun, 18 Jun 2023 12:24:05 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-30adc51b65cso2677464f8f.0; Sun, 18 Jun 2023 12:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687116244; x=1689708244; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=MgtexUEGrgjvYhEdRHaEOKyKO3yC+i0FtmJ8yuwDDUk=; b=ZTUEfNFnsN3qCpA6c5F/hubR6UpGpjGoV+qI2yERWYINBgSNgzb4XHWD44vsFA1BZk l+Cx6ZJBL6600ujRWVN1xAnVo2A+m0eRo+5aAO+CM3YskeDafWTKLwSnXa4GXcjo7lUy vx8D8uW3+lB0Yyl8UF3KJAhrGZqbcktSClCBxHFCFwU07ehOEqrguW21O6nN6XvEjSS/ Ql5eaxrmK8ntUt37lRLwHGRr0M/LkeNNo5jFgikl/qAZk+Rj+YlsdE+1ufdyrowuRpsh xjTwCwFC/c/hsc/S65m/+rK5Hl9d056CrgyIqNgFhgQzfCg4UN4SGloWcsiUX48PK+DY atQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687116244; x=1689708244; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MgtexUEGrgjvYhEdRHaEOKyKO3yC+i0FtmJ8yuwDDUk=; b=OsMp0Kty0sspW/+/tOYfKiPfuprqO4HewHv8uWWT6miISBAIQtd9017P732UjInjQZ Bkw7HCraM1pvgI/pN2dWwSSEZMua8T4IeVvcE85wnGBMdQmGI76xS41WnplJOs/7+3Mo wDn/P2qEmPaxdq3eFCKTmAix7ZFILaULWut1to440wmpScTEYJogfisl17TloYnpoTQl 9oLWjodZMSw/kfgfS6MFGdjbuKc9VKqYVotsevn54H5NE4JDZicYv5TUtCd+Gp1oRXD9 nWmjxjPP0Rqyc3DB37KfVolQqxfY8t8OPkHG9WhV2YGT2GPYkKBpVYCRZX10VMoieWae jm/A== X-Gm-Message-State: AC+VfDxHa0T/fBU8Pu9s9dIvV/bqq95jlc9vqCJxAFWA4vRquII4Eokc u8ThfK1RBVFlGqRP3NTZiFUvO47TI/o= X-Received: by 2002:adf:fa06:0:b0:30f:bdc5:c150 with SMTP id m6-20020adffa06000000b0030fbdc5c150mr7986343wrr.33.1687116243467; Sun, 18 Jun 2023 12:24:03 -0700 (PDT) Received: from localhost.localdomain (93-34-93-173.ip49.fastwebnet.it. [93.34.93.173]) by smtp.googlemail.com with ESMTPSA id h12-20020adffd4c000000b0031130b9b173sm4065871wrs.34.2023.06.18.12.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jun 2023 12:24:03 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Christian Marangi , Andrew Lunn , "David S. Miller" , Yang Li , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [net-next PATCH v4 0/3] leds: trigger: netdev: add additional modes Date: Sat, 17 Jun 2023 13:53:52 +0200 Message-Id: <20230617115355.22868-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 This is a continue of [1]. It was decided to take a more gradual approach to implement LEDs support for switch and phy starting with basic support and then implementing the hw control part when we have all the prereq done. This should be the final part for the netdev trigger. I added net-next tag and added netdev mailing list since I was informed that this should be merged with netdev branch. We collect some info around and we found a good set of modes that are common in almost all the PHY and Switch. These modes are: - Modes for dedicated link speed(10, 100, 1000 mbps). Additional mode can be added later following this example. - Modes for half and full duplex. The original idea was to add hw control only modes. While the concept makes sense in practice it would results in lots of additional code and extra check to make sure we are setting correct modes. With the suggestion from Andrew it was pointed out that using the ethtool APIs we can actually get the current link speed and duplex and this effectively removed the problem of having hw control only modes since we can fallback to software. Since these modes are supported by software, we can skip providing an user for this in the LED driver to support hw control for these new modes (that will come right after this is merged) and prevent this to be another multi subsystem series. For link speed and duplex we use ethtool APIs. To call ethtool APIs, rtnl lock is needed but this can be skipped on handling netdev events as the lock is already held. [1] https://lore.kernel.org/lkml/20230216013230.22978-1-ansuelsmth@gmail.com/ Changes v4: - Add net-next tag - Add additional patch to expose hw_control via sysfs - CC netdev mailing list Changes v3: - Add Andrew review tag - Use SPEED_UNKNOWN to init link_speed - Fix using HALF_DUPLEX as duplex init and use DUPLEX_UNKNOWN instead Changes v2: - Drop ACTIVITY patch as it can be handled internally in the LED driver - Reduce duplicate code and move the link state to a dedicated helper Christian Marangi (3): leds: trigger: netdev: add additional specific link speed mode leds: trigger: netdev: add additional specific link duplex mode leds: trigger: netdev: expose hw_control status via sysfs drivers/leds/trigger/ledtrig-netdev.c | 114 +++++++++++++++++++++++--- include/linux/leds.h | 5 ++ 2 files changed, 109 insertions(+), 10 deletions(-) -- 2.40.1