From patchwork Wed Dec 13 18:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13491726 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dZyeq8Qf" Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72ADAF3; Wed, 13 Dec 2023 10:16:02 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3360ae1b937so3694112f8f.0; Wed, 13 Dec 2023 10:16:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702491361; x=1703096161; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=XWFAx4kAF7hKrrXw5IZi1qHuzEkNqyvfaO25OJOU7sA=; b=dZyeq8QfVckkss0cDgsppzOC5CyNkvPCZgbub7jwwbBaGTHKlXOYChgbLNf2+QBLN0 1+uPcWl9aKr2DvDU8jbmD8ZnMv2zW5IzGSY9Bvx3VrWIfu8k/3DsRZ1bMUdAMGCZ1gly EkDPWUPio+t1o755n7YKZZb8OX+oq/sO4DJY/aN2ItvHoAd8reKhgdQEYQGJa2LVeQ1t OSDKuuQn0z002xv1rulQjYOUEsIJaSiR39UPp4OUQQy/04GX1qHd0iv/8KIgpBUXEnTW nqDaHZ7VNh4dVIi/1qLGKil+NMaSZ43fGM8sAB5+5IZ4VOETdJWVD8Bp2DVbuBcaCcta d57A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702491361; x=1703096161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XWFAx4kAF7hKrrXw5IZi1qHuzEkNqyvfaO25OJOU7sA=; b=np6YiJy4Whs5sDbILvdaWeWKTiAyPol9nlnggGGhwqHjilMY9VGHAiai4grEoS30Xt eDg/WTasSpqvlSbsVgH6rULWqrHzLIvSm/kzZqT2Jvh3Px0+kN6sDHpsZELJUGxb+hag cYFPU/gvD5wrkjLjZ+2ths9msdz2uoF86i34YT8U1k0P+PmR8MLI/zaf+BVuN7hReAld xXpjqWP9BounwEQzGnyDhvw9iFR+tDnrVpNMZ4wTNPXvL2PLCxt2vLr3mj8PAEK2jRd6 EQRMMp7OhPWev4TGNtpmkx8W25Hr53cKh3wt0q9iR5JCorJUVOzlnqN7KW4GW7V4+gRs qrrw== X-Gm-Message-State: AOJu0YwM6cBqRie2f6sPZeQJZa43z5c1uXYy3KQcyINsE/iCHTgNoHOf xWKqI65p3kYGuJ5Atg8ACN8= X-Google-Smtp-Source: AGHT+IF3VN4QIifOoqZDFbvLMgXXwW7fuo63SscdTRFZdEs59zHjEPp5uovEwoB5YbVV8qYnEGH0RQ== X-Received: by 2002:adf:fb43:0:b0:334:b1f4:5d59 with SMTP id c3-20020adffb43000000b00334b1f45d59mr4781640wrs.40.1702491360826; Wed, 13 Dec 2023 10:16:00 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id e33-20020a5d5961000000b0033346fe9b9bsm13947762wri.83.2023.12.13.10.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 10:16:00 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Vincent Mailhol , Kees Cook , Christian Marangi , Piergiorgio Beruto , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH 1/2] net: ethtool: add define for link speed mode number Date: Wed, 13 Dec 2023 19:15:53 +0100 Message-Id: <20231213181554.4741-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231213181554.4741-1-ansuelsmth@gmail.com> References: <20231213181554.4741-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add define to reference the number of link speed mode defined in the system. This can be handy for generic parsing of the different link speed mode. Signed-off-by: Christian Marangi --- include/uapi/linux/ethtool.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index f7fba0dc87e5..59f394a663ab 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -1884,6 +1884,28 @@ enum ethtool_link_mode_bit_indices { * Update drivers/net/phy/phy.c:phy_speed_to_str() and * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. */ +enum ethtool_link_speeds { + SPEED_10 = 0, + SPEED_100, + SPEED_1000, + SPEED_2500, + SPEED_5000, + SPEED_10000, + SPEED_14000, + SPEED_20000, + SPEED_25000, + SPEED_40000, + SPEED_50000, + SPEED_56000, + SPEED_100000, + SPEED_200000, + SPEED_400000, + SPEED_800000, + + /* must be last entry */ + __LINK_SPEEDS_NUM, +}; + #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 From patchwork Wed Dec 13 18:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13491727 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XMoTufx+" Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FF2106; Wed, 13 Dec 2023 10:16:03 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33644eeb305so63492f8f.1; Wed, 13 Dec 2023 10:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702491362; x=1703096162; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=XMG3yQ4EhHz7n1fTiev23HEWg/+c7EuzwQ2dfmF7Rmg=; b=XMoTufx+OeIPW34gfPpeVxDpRiIxjX4vlTTolc4V28F59I2Q1lrrv/hBTLObTvOBqd rIZpBfNa8J7nA9jbuqnwSLHD3O3RIIrGGxmhWvOpyqQInIcE/ZSxAFmiYsru3miamo63 A0PmRTUB6V0rJBfAsz+beWABJ4IiUhZTwhZnU3oNfbgg0igibe+XRPW332/we0koy2Ql j72W5JG+E6YhV2HbK92xP6kb1JDAkAfR5ZlfzyeDSUP8YXhb7aAT5Zt8qjOUCVWuSbBk f0Q7IS3LVX5/Mrf7jtJ0nb7LUrA5PszIO9jXRuPFO5YOTXHmyR07DW8cknu8q/LqzyaZ x5XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702491362; x=1703096162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XMG3yQ4EhHz7n1fTiev23HEWg/+c7EuzwQ2dfmF7Rmg=; b=CfLQX9fd961rIGCAnoGkL/7VX/nQorguhp97L5xqQGDDF/JOlVVq7lU59ewPB3KHAU 4Ujqkvvit2VJ39/uNOH/psdJQw5HpY1iY5gE0cQDxY6O+inNo/mFfFyy9/o2E+84zmlY YYqKx7laSjYewT9NR/xb7rVWrJnpYENn+Ks183KTkoMjDDKtPlMaVafHbF1BLtOZMzYv imvdVQd2gVInC25W9Y12egLW5xt3rIRiszlgSaN8lcHII/0SvH72ila2DZdu5DMuFyfK FkbhqWtvRbdhVZ2amYcEQwi08Qkr6wXVLz1Ot6hbGrGiIIIytkK6/cX2X/D4M4Day4pn qYLw== X-Gm-Message-State: AOJu0YyyfNvbZlWlX+d6LyZZooDmMWrOViXwqRAGSxdKDhO1QUYbEaEh 8BXMBxjMmgbJq3TDREv2u0k= X-Google-Smtp-Source: AGHT+IGfvlJWy8A+tUbhwzhf34qHnlbjkRS8NLj7gu6M2pIDkvJTFnHhvzFE8wq1HoMSDUtbGj6dqw== X-Received: by 2002:adf:fd49:0:b0:336:35ed:af18 with SMTP id h9-20020adffd49000000b0033635edaf18mr1385090wrs.17.1702491361917; Wed, 13 Dec 2023 10:16:01 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id e33-20020a5d5961000000b0033346fe9b9bsm13947762wri.83.2023.12.13.10.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 10:16:01 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Vincent Mailhol , Kees Cook , Christian Marangi , Piergiorgio Beruto , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH 2/2] net: phy: leds: use new define for link speed modes number Date: Wed, 13 Dec 2023 19:15:54 +0100 Message-Id: <20231213181554.4741-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231213181554.4741-1-ansuelsmth@gmail.com> References: <20231213181554.4741-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Use new define __LINK_SPEEDS_NUM for the speeds array instead of declaring a big enough array of 50 elements to handle future link speed modes. Signed-off-by: Christian Marangi --- drivers/net/phy/phy_led_triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_led_triggers.c b/drivers/net/phy/phy_led_triggers.c index f550576eb9da..40cb0fa9ace0 100644 --- a/drivers/net/phy/phy_led_triggers.c +++ b/drivers/net/phy/phy_led_triggers.c @@ -84,7 +84,7 @@ static void phy_led_trigger_unregister(struct phy_led_trigger *plt) int phy_led_triggers_register(struct phy_device *phy) { int i, err; - unsigned int speeds[50]; + unsigned int speeds[__LINK_SPEEDS_NUM]; phy->phy_num_led_triggers = phy_supported_speeds(phy, speeds, ARRAY_SIZE(speeds));