Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10485302rwp; Thu, 20 Jul 2023 23:09:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlEgEjWbNg3rcBlEEvOn/IohnBc2T6T0mGIMiduKxZlvJkPk+CygXqwckIAe+Ty6793UR3G5 X-Received: by 2002:a05:6402:7c4:b0:521:e502:baf8 with SMTP id u4-20020a05640207c400b00521e502baf8mr840526edy.11.1689919741445; Thu, 20 Jul 2023 23:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689919741; cv=none; d=google.com; s=arc-20160816; b=CAFg6wmgGL0nN8752BPsO1tKVTR8zVc9cb8fk7zpYisNgEoP/XQ1L1SVPWe1cEZuov dFO15NTDP8X6O3j8X0cXi0uWIxKD04DiSRGoQ7xvd9hqnm8+MZYJ2utH+zjJh4mHqZHJ 1y9+ZTURsI4wLYYpaDPuWUA5MON5qzBhaXCpgkIVbffRfrun+PGPQB1fWSeg5CH/or84 1HWcy0+CcbXscTWsKIuVglwUoqbn7Iek8HUn+QChBhLwaRFYf86PsnOZejaxvQ6iENQ6 wMgo3LW9WlY6So2NUWGp7hV0ekHW54qMPvHYsWCh3IWso9Dhpyh/anG4MM2h/8XTHJ6N HdGw== 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:date:subject:cc:to:from :dkim-signature; bh=PHiTZ9pzHqVBJ1YR4hHxUglPB5vWZzzVSCrV0mNZoZI=; fh=qv6R2IaILI1S1xEIxOZzAcF4rN0hGtVsF9kjKc0mAD0=; b=NmvT8zC3u+ajqEdpnLre62DfoSfaowAj2tABXpxjL7DfSf4tLUgRIbWN15GUcIf5qd QgdDhJLnnk+TZXYpyfFuB4J2zlLsqR/lE9+L/dY/jdO7hxWhyY0rdiQsW/dEhiZ4AeL0 oQseR582sGS5u03QT4sT4djt/KaokKTfra3eHrBze5YcmjHvdLPTq/p0+gvbgNGUx4aM t0gnsicirsQcGEP6SjY+/2bfWUdl+PPDiSL2QwgqeJcQ1UDKkm9F9hbktGUEkBG0As5X jXlBVnIXDARYIwEODNsG0piZJXtJtyqFmZMIHmiuWHMdQKqLn9icgq6HqmQ5dy6dLkyB iuNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="Nm/P8HjB"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020aa7d64c000000b0051e0c84ecc8si1945636edr.317.2023.07.20.23.08.36; Thu, 20 Jul 2023 23:09:01 -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=@microchip.com header.s=mchp header.b="Nm/P8HjB"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjGUGB0 (ORCPT + 99 others); Fri, 21 Jul 2023 02:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbjGUGBN (ORCPT ); Fri, 21 Jul 2023 02:01:13 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE9CA30FD; Thu, 20 Jul 2023 23:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1689919255; x=1721455255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IJ4zMep/FrHtkrZh2iWP+xN+ImKeKg5u57KkhqSuw2I=; b=Nm/P8HjBZXokHMFAI7c4C/nHvrpR4wwyamp+axblIUMlYUjBaRcsUYEr IgbWZMhQGkmevxK/aCBhsXySycw4Y8WPNWa9lpkiCPbIxGeV2fAPGqoaE UIWeN0aHlbhwjw6H1lWoNul2WBNT2yC/oaubG+0JkFRY8cdd3q53X9RIE bo2s1RTwKvweaylpa/iKC1OWaDfkJDPrL8+3joDCvWL52wi59n5bnj1RZ qm5T0RxkycpSFgUBYfZ8JSAKvQFy6mEumLCgWkIgJJg/kLyvEHd/sMNHk w06K+BOIAiav/kk2Av01MuxoxNVI6ZGrBhwGSvdLO+3oUKmBmO9NIWCpl Q==; X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="236881402" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jul 2023 23:00:54 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 20 Jul 2023 23:00:54 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Thu, 20 Jul 2023 23:00:51 -0700 From: Raju Lakkaraju To: CC: , , , , , , Subject: [PATCH net-next 6/7] net: lan743x: Add support to ethtool phylink get and set settings Date: Fri, 21 Jul 2023 11:30:18 +0530 Message-ID: <20230721060019.2737-7-Raju.Lakkaraju@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721060019.2737-1-Raju.Lakkaraju@microchip.com> References: <20230721060019.2737-1-Raju.Lakkaraju@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Add support to ethtool phylink get/set settings for the network interface via ethtool like speed, duplex etc. Signed-off-by: Raju Lakkaraju --- .../net/ethernet/microchip/lan743x_ethtool.c | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c index 2db5949b4c7e..3004863bebf8 100644 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c @@ -1134,6 +1134,36 @@ static int lan743x_ethtool_set_eee(struct net_device *netdev, return phy_ethtool_set_eee(phydev, eee); } +static int lan743x_ethtool_set_link_ksettings(struct net_device *netdev, + const struct ethtool_link_ksettings *cmd) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + int ret; + + if (adapter->phylink) { + ret = lan743x_lsd_update(cmd->base.speed, cmd->base.duplex, + cmd->base.master_slave_state); + if (ret < 0) + return ret; + + adapter->sgmii_lsd = ret; + return phylink_ethtool_ksettings_set(adapter->phylink, cmd); + } + + return phy_ethtool_set_link_ksettings(netdev, cmd); +} + +static int lan743x_ethtool_get_link_ksettings(struct net_device *netdev, + struct ethtool_link_ksettings *cmd) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + + if (adapter->phylink) + return phylink_ethtool_ksettings_get(adapter->phylink, cmd); + + return phy_ethtool_get_link_ksettings(netdev, cmd); +} + #ifdef CONFIG_PM static void lan743x_ethtool_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) @@ -1400,8 +1430,8 @@ const struct ethtool_ops lan743x_ethtool_ops = { .get_ts_info = lan743x_ethtool_get_ts_info, .get_eee = lan743x_ethtool_get_eee, .set_eee = lan743x_ethtool_set_eee, - .get_link_ksettings = phy_ethtool_get_link_ksettings, - .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_link_ksettings = lan743x_ethtool_get_link_ksettings, + .set_link_ksettings = lan743x_ethtool_set_link_ksettings, .get_regs_len = lan743x_get_regs_len, .get_regs = lan743x_get_regs, .get_pauseparam = lan743x_get_pauseparam, -- 2.25.1