From patchwork Tue Nov 28 04:00:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 170527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3667524vqx; Mon, 27 Nov 2023 20:01:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJQ0RxrwUOGoT8qEcI/jwN5KO/1DLmedclaIm2euyp34lqKGwf641iD1rmDLyuh3UJc8bc X-Received: by 2002:a17:902:7897:b0:1cf:ee16:84fd with SMTP id q23-20020a170902789700b001cfee1684fdmr1955093pll.53.1701144097619; Mon, 27 Nov 2023 20:01:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701144097; cv=none; d=google.com; s=arc-20160816; b=D6U1j2SCFVY0k2r9Xh8guxojDPfWTqNNwrKGdgNgUgAr+dCauRpf2ByETCy4Wh917V N0gF+RC1AcdQ05Du6OO8jAKJRtkvejYNZv15hzKiRqa+ycXmVzA+oEbvX2O5E5M46UFF 1xBg4e9Yjv5x2ZXdsT0okpMGkZDBTFq+dj9+Ou3lG+vPCIVAD+lbIV/Cp9PPlKxU9nOM xN6MipS3JQQ0dvqukaL2lPKWzqRlrZPP/0D9qCetw8+oOlDm6M7LWlus7CgZUG7jilDu 65/eYpL34dhRVx05fJ2wXhtjPIxc5VMENSoOyZU1q/FKmYPFB/yGwkVztDB4QmvleKXx JCzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=L0BW7bLPOwZD2T1Apl83PsyxNzQpw7KOZC+q9QdQ1WY=; fh=qfmQhbWisslBEAIJDr/wN6/hX92ICDIG4Wyq5kvA/yI=; b=giaUFAUM+WKAXgCC3FwbZacOYQjhRwPfX0EzX/Kzr52+z2VAiWDC+jKdyjJxLPUMhW v3Hj9QhiiAtQn6kMklGU8pRbzoeRuZRGZ2go8HIBItPjDZD6jXICg6zDks9EPc4jl2mG YJSkB11Lk5JjX62/OjBm7etuJ07cf6WvziJ6TMoStUIQWZfEz+69M1oZMXsD9wCRvjH/ ePzHLxfPI3KQH3CEJCzypP2BGyTLE66T/KgQ/YFVB0Nawi4byglPq0iKD7bu+DX9GJFV 5XgPtrN4QVnu3toaa0BTUYYCvYXBBoEoOOp54keIyhXNFFhgSsW3dza78NOoSYh4o9+e 9KRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ba10-20020a170902720a00b001cfc42b3b65si4573583plb.422.2023.11.27.20.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 20:01:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A0D36807EDAF; Mon, 27 Nov 2023 20:00:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234447AbjK1EA1 (ORCPT + 99 others); Mon, 27 Nov 2023 23:00:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjK1EA0 (ORCPT ); Mon, 27 Nov 2023 23:00:26 -0500 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17D7C1; Mon, 27 Nov 2023 20:00:31 -0800 (PST) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1r7pGf-0002hW-02; Tue, 28 Nov 2023 04:00:14 +0000 Date: Tue, 28 Nov 2023 04:00:10 +0000 From: Daniel Golle To: Pavel Machek , Lee Jones , Andrew Lunn , Jakub Kicinski , Marek =?iso-8859-1?q?Beh=FAn?= , Daniel Golle , Christian Marangi , "David S. Miller" , Li Zetao , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: [PATCH v3 1/2] leds: trigger: netdev: extend speeds up to 10G Message-ID: <99e7d3304c6bba7f4863a4a80764a869855f2085.1701143925.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 20:00:36 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783778873162095344 X-GMAIL-MSGID: 1783778873162095344 Add 2.5G, 5G and 10G as available speeds to the netdev LED trigger. Signed-off-by: Daniel Golle Reviewed-by: Andrew Lunn --- v3: no changes v2: add missing sysfs entries drivers/leds/trigger/ledtrig-netdev.c | 32 ++++++++++++++++++++++++++- include/linux/leds.h | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index e358e77e4b38f..bd68da15c723e 100644 --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c @@ -99,6 +99,18 @@ static void set_baseline_state(struct led_netdev_data *trigger_data) trigger_data->link_speed == SPEED_1000) blink_on = true; + if (test_bit(TRIGGER_NETDEV_LINK_2500, &trigger_data->mode) && + trigger_data->link_speed == SPEED_2500) + blink_on = true; + + if (test_bit(TRIGGER_NETDEV_LINK_5000, &trigger_data->mode) && + trigger_data->link_speed == SPEED_5000) + blink_on = true; + + if (test_bit(TRIGGER_NETDEV_LINK_10000, &trigger_data->mode) && + trigger_data->link_speed == SPEED_10000) + blink_on = true; + if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &trigger_data->mode) && trigger_data->duplex == DUPLEX_HALF) blink_on = true; @@ -286,6 +298,9 @@ static ssize_t netdev_led_attr_show(struct device *dev, char *buf, case TRIGGER_NETDEV_LINK_10: case TRIGGER_NETDEV_LINK_100: case TRIGGER_NETDEV_LINK_1000: + case TRIGGER_NETDEV_LINK_2500: + case TRIGGER_NETDEV_LINK_5000: + case TRIGGER_NETDEV_LINK_10000: case TRIGGER_NETDEV_HALF_DUPLEX: case TRIGGER_NETDEV_FULL_DUPLEX: case TRIGGER_NETDEV_TX: @@ -316,6 +331,9 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf, case TRIGGER_NETDEV_LINK_10: case TRIGGER_NETDEV_LINK_100: case TRIGGER_NETDEV_LINK_1000: + case TRIGGER_NETDEV_LINK_2500: + case TRIGGER_NETDEV_LINK_5000: + case TRIGGER_NETDEV_LINK_10000: case TRIGGER_NETDEV_HALF_DUPLEX: case TRIGGER_NETDEV_FULL_DUPLEX: case TRIGGER_NETDEV_TX: @@ -334,7 +352,10 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf, if (test_bit(TRIGGER_NETDEV_LINK, &mode) && (test_bit(TRIGGER_NETDEV_LINK_10, &mode) || test_bit(TRIGGER_NETDEV_LINK_100, &mode) || - test_bit(TRIGGER_NETDEV_LINK_1000, &mode))) + test_bit(TRIGGER_NETDEV_LINK_1000, &mode) || + test_bit(TRIGGER_NETDEV_LINK_2500, &mode) || + test_bit(TRIGGER_NETDEV_LINK_5000, &mode) || + test_bit(TRIGGER_NETDEV_LINK_10000, &mode))) return -EINVAL; cancel_delayed_work_sync(&trigger_data->work); @@ -364,6 +385,9 @@ DEFINE_NETDEV_TRIGGER(link, TRIGGER_NETDEV_LINK); DEFINE_NETDEV_TRIGGER(link_10, TRIGGER_NETDEV_LINK_10); DEFINE_NETDEV_TRIGGER(link_100, TRIGGER_NETDEV_LINK_100); DEFINE_NETDEV_TRIGGER(link_1000, TRIGGER_NETDEV_LINK_1000); +DEFINE_NETDEV_TRIGGER(link_2500, TRIGGER_NETDEV_LINK_2500); +DEFINE_NETDEV_TRIGGER(link_5000, TRIGGER_NETDEV_LINK_5000); +DEFINE_NETDEV_TRIGGER(link_10000, TRIGGER_NETDEV_LINK_10000); DEFINE_NETDEV_TRIGGER(half_duplex, TRIGGER_NETDEV_HALF_DUPLEX); DEFINE_NETDEV_TRIGGER(full_duplex, TRIGGER_NETDEV_FULL_DUPLEX); DEFINE_NETDEV_TRIGGER(tx, TRIGGER_NETDEV_TX); @@ -422,6 +446,9 @@ static struct attribute *netdev_trig_attrs[] = { &dev_attr_link_10.attr, &dev_attr_link_100.attr, &dev_attr_link_1000.attr, + &dev_attr_link_2500.attr, + &dev_attr_link_5000.attr, + &dev_attr_link_10000.attr, &dev_attr_full_duplex.attr, &dev_attr_half_duplex.attr, &dev_attr_rx.attr, @@ -519,6 +546,9 @@ static void netdev_trig_work(struct work_struct *work) test_bit(TRIGGER_NETDEV_LINK_10, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_LINK_100, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_LINK_1000, &trigger_data->mode) || + test_bit(TRIGGER_NETDEV_LINK_2500, &trigger_data->mode) || + test_bit(TRIGGER_NETDEV_LINK_5000, &trigger_data->mode) || + test_bit(TRIGGER_NETDEV_LINK_10000, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &trigger_data->mode); interval = jiffies_to_msecs( diff --git a/include/linux/leds.h b/include/linux/leds.h index aa16dc2a8230f..1bdf7f5a0d7c0 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -588,6 +588,9 @@ enum led_trigger_netdev_modes { TRIGGER_NETDEV_LINK_10, TRIGGER_NETDEV_LINK_100, TRIGGER_NETDEV_LINK_1000, + TRIGGER_NETDEV_LINK_2500, + TRIGGER_NETDEV_LINK_5000, + TRIGGER_NETDEV_LINK_10000, TRIGGER_NETDEV_HALF_DUPLEX, TRIGGER_NETDEV_FULL_DUPLEX, TRIGGER_NETDEV_TX, From patchwork Tue Nov 28 04:00:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 170526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3667143vqx; Mon, 27 Nov 2023 20:00:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0wNbaxGn1V6CMh56jn68Y4sHe9X8OAD6X3qze4ZwOiVTjHsoolTDSEZtPa2NuwDwThRN5 X-Received: by 2002:a17:90b:3883:b0:285:98dc:2d19 with SMTP id mu3-20020a17090b388300b0028598dc2d19mr14402529pjb.28.1701144056923; Mon, 27 Nov 2023 20:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701144056; cv=none; d=google.com; s=arc-20160816; b=pjtNXn44VEVbu5xNKYeAwJPIJbOxArXvUoPhZVLzorbx+LrELEMskVjhAe8A9GcYN0 s65jsynAQ2kjWTvJxTgOXHv7CC9FWQ67QOrNk9EvU51VK4c6VScy1ckdF6EYR/+aCzGk ruqZ0dDK2nqsNy2KmQ4tDdc2UIkbI3na9YmpiO7aAGDB1Ad66DBkzWpallQQl7j4kAmO HzMxycbeqo0XCqs4yXL4TGGLvQbsRmsv6PaomhQY4HKLrcE5LbhlbAckGIRqHuhD9Oj7 B+vdbnK8cG/9SGBmnq5T/tY0UXj6JYIgrAon1aKYJfAxFHTBEJtL3ObfILZxuirz3TlX QEdw== 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:to:from:date; bh=27+b6xwHXl+grO6avI5kPwfwsSourrfI9OpzZiEvK0Y=; fh=qfmQhbWisslBEAIJDr/wN6/hX92ICDIG4Wyq5kvA/yI=; b=SjUYvQl+1iFF0+6VYtH+lBqSTaXwtGOFbvTl854QLf4BalJG7qZuY/aVmXsY6lbWuF VWdg9WiVd+W/1/3cRyArOWZevBMxWwH9I6+ZlPAIV1s2XOgZn6B0XQ1O7w7WMCjb0weU apvROgGn1/osgqiIOKeIxgjgo4H59OQfXcrsTodSghOqaa52JgbNjtippHU+cIpunBH4 JMkiZHW1EIAzu64KkJTLdzX2a4RCJXZPGT0NBnf26iSN5ZZKjgKS3QZOgSnvfNUoUOfD 4KjJLbnMlhoEfPSaFwGBfsZQ2IJkSByHhY0va/1+K+tX3AhIOFvi/k+d3bFjUukYiFCB 45gQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id jc3-20020a17090325c300b001cc411b53f4si9405301plb.106.2023.11.27.20.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 20:00:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B1FBE80FFD88; Mon, 27 Nov 2023 20:00:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbjK1EAo (ORCPT + 99 others); Mon, 27 Nov 2023 23:00:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234478AbjK1EAm (ORCPT ); Mon, 27 Nov 2023 23:00:42 -0500 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363571AD; Mon, 27 Nov 2023 20:00:48 -0800 (PST) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1r7pH7-0002hr-09; Tue, 28 Nov 2023 04:00:42 +0000 Date: Tue, 28 Nov 2023 04:00:39 +0000 From: Daniel Golle To: Pavel Machek , Lee Jones , Andrew Lunn , Jakub Kicinski , Marek =?iso-8859-1?q?Beh=FAn?= , Daniel Golle , Christian Marangi , "David S. Miller" , Li Zetao , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: [PATCH v3 2/2] docs: ABI: sysfs-class-led-trigger-netdev: add new modes and entry Message-ID: References: <99e7d3304c6bba7f4863a4a80764a869855f2085.1701143925.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <99e7d3304c6bba7f4863a4a80764a869855f2085.1701143925.git.daniel@makrotopia.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 27 Nov 2023 20:00:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783778830708740542 X-GMAIL-MSGID: 1783778830708740542 Document newly introduced modes for the LED netdev trigger. Add documentation for new modes: - link_2500 - link_5000 - link_10000 Signed-off-by: Daniel Golle --- v3: include this documentation patch as well .../testing/sysfs-class-led-trigger-netdev | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-led-trigger-netdev b/Documentation/ABI/testing/sysfs-class-led-trigger-netdev index f6d9d72ce77b7..a6c307c4befa0 100644 --- a/Documentation/ABI/testing/sysfs-class-led-trigger-netdev +++ b/Documentation/ABI/testing/sysfs-class-led-trigger-netdev @@ -114,6 +114,45 @@ Description: speed of 1000Mbps of the named network device. Setting this value also immediately changes the LED state. +What: /sys/class/leds//link_2500 +Date: Nov 2023 +KernelVersion: 6.8 +Contact: linux-leds@vger.kernel.org +Description: + Signal the link speed state of 2500Mbps of the named network device. + + If set to 0 (default), the LED's normal state is off. + + If set to 1, the LED's normal state reflects the link state + speed of 2500Mbps of the named network device. + Setting this value also immediately changes the LED state. + +What: /sys/class/leds//link_5000 +Date: Nov 2023 +KernelVersion: 6.8 +Contact: linux-leds@vger.kernel.org +Description: + Signal the link speed state of 5000Mbps of the named network device. + + If set to 0 (default), the LED's normal state is off. + + If set to 1, the LED's normal state reflects the link state + speed of 5000Mbps of the named network device. + Setting this value also immediately changes the LED state. + +What: /sys/class/leds//link_10000 +Date: Nov 2023 +KernelVersion: 6.8 +Contact: linux-leds@vger.kernel.org +Description: + Signal the link speed state of 10000Mbps of the named network device. + + If set to 0 (default), the LED's normal state is off. + + If set to 1, the LED's normal state reflects the link state + speed of 10000Mbps of the named network device. + Setting this value also immediately changes the LED state. + What: /sys/class/leds//half_duplex Date: Jun 2023 KernelVersion: 6.5