Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp959154rdh; Thu, 26 Oct 2023 23:54:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+cahAEGZvJVUwS++3gEfUX/qMXeeDrPZAHzzjKjy56SrtRAsqZI9v8jDN9xin5cVcwYKj X-Received: by 2002:a05:620a:4551:b0:774:cf9:b206 with SMTP id u17-20020a05620a455100b007740cf9b206mr1930706qkp.42.1698389682800; Thu, 26 Oct 2023 23:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698389682; cv=none; d=google.com; s=arc-20160816; b=Fk/NLQY0hMqfCqjmbqkTbl47MYIDyXQCv3ABORPg6c3kYXI/geFgoi5YTZCXlJLkW0 RSSR1Hwdc3JOU7KQ3prwVQE+lKUGAu7hq0APAkTTwgrfwIfzWZ+HPeoFoPq//Nqw4G+T PkCnqHLMHJ+KTc64sDzQ4NoBS94GaKrVW8IW9K37nmUJAkxD31M16Kni+UDY0nmMoP3+ YotIzaCLbE4CkYPQlD3t2zVpmg/tCfq1twBx8zGbxkVdvF7/Uo1vmCkSXPZgA3OND9rz BiaSEEkgrYiuHfOSeNuNk+D8mZ4RnuvdlJQEA2ckcdo6fyw93Xk+WdXxKpt2rRkOAg1/ mVxA== 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:cc:to:from:dkim-signature; bh=sUQmlZkBpPAgHZivKc4H7oUZlaAH0nJqWxadM6h+oBI=; fh=CSdkpeQMZtYechySQp6aEMacGbd0Q3rYrIlDzoSws28=; b=ZSfuDvlt8tVfUOrucHLaORcb8Irsovx1lWiMC6uBy0Z0muh81FABZxuhHof7i5ug25 P8nqJTWleE1/M98J1A/ZNpQ+NCzdo89pd8MdUpTLfPEtyYsrDEyC+cQzn4A4o6dItMYq Fgjc8KG2Kp5COMZM0sA9xcHauaskVHfYwkWtzK7R0nP9HxUz1a1xQIV92mJ4C29qIAnL 2+y39jbfyMUuxOBvHi2OByW3IcZUhi0AfvxEv8gMLUPwh8CgYdw05qo5/fKvKnvYk7VU QF5KvNYYgM2MGbBz+aHES2aY1z0uh2n5PcXJjJF1Nlf9LsADlXr5ABOwxQMxXeiXSwW/ 6dOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S+iOBHWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id q9-20020a258209000000b00d7fd681a51asi1770853ybk.732.2023.10.26.23.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 23:54:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S+iOBHWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2560481EA72A; Thu, 26 Oct 2023 23:54:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345266AbjJ0Gya (ORCPT + 99 others); Fri, 27 Oct 2023 02:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbjJ0Gy2 (ORCPT ); Fri, 27 Oct 2023 02:54:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4298116; Thu, 26 Oct 2023 23:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698389667; x=1729925667; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FLxMqcP+5XqmQmOKGaFAfXKYkByQwryiGge0XuweW0I=; b=S+iOBHWU7sLWy/h2VgIQH+9iZP+9j7oLhUVH41XnTFVrQIllWxQutJQk Fls8wDniKpSMzmfpp4AGgCR0hCaH6MQ8iIc+kvKuwSvgFeosaj4Y0z1qc 6CQYAnK3kO6RgJ9gi5Lv2DwztrYn1FyMGRc+yy1pJRDcCexcYc3mPjSyV 4kmboAXynFj2hH9DvG+KjCNi2IulzZPiNbm6Qq4jXz6Fin7xMVymudr35 kVxjs++M2k0Dq+Gc9ihrL58Dq1QFJXp/h17lPREbUD5K8EdwXzU4x3V3Q nH8IpCmYqUkp0dLiJy6Tq2VMBbJ7BoYO/aHUIN2HqW6qSAqTdUFfZ40Ou A==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="539357" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="539357" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 23:54:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="753016032" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="753016032" Received: from ssid-ilbpg3-teeminta.png.intel.com ([10.88.227.74]) by orsmga007.jf.intel.com with ESMTP; 26 Oct 2023 23:54:21 -0700 From: Gan Yi Fang To: Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Looi Hong Aun , Voon Weifeng , Song Yoong Siang , Ahmad Tarmizi Noor Azura , Gan Yi Fang Subject: [PATCH net-next 1/1] net: stmmac: add check for advertising linkmode request for set-eee Date: Fri, 27 Oct 2023 14:50:54 +0800 Message-Id: <20231027065054.3808352-1-yi.fang.gan@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 26 Oct 2023 23:54:40 -0700 (PDT) From: Noor Azura Ahmad Tarmizi Add check for advertising linkmode set request with what is currently being supported by PHY before configuring the EEE. Unsupported setting will be rejected and a message will be prompted. No checking is required while setting the EEE to off. Signed-off-by: Noor Azura Ahmad Tarmizi Signed-off-by: Gan, Yi Fang --- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index f628411ae4ae..6c090d4b7117 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -867,8 +867,24 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, netdev_warn(priv->dev, "Setting EEE tx-lpi is not supported\n"); - if (!edata->eee_enabled) + if (!edata->eee_enabled) { stmmac_disable_eee_mode(priv); + } else { + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); + __ETHTOOL_DECLARE_LINK_MODE_MASK(advertised); + + ethtool_convert_legacy_u32_to_link_mode(supported, + edata->supported); + ethtool_convert_legacy_u32_to_link_mode(advertised, + edata->advertised); + + /*Check if the advertise speed is supported.*/ + if (!bitmap_subset(advertised, + supported, + __ETHTOOL_LINK_MODE_MASK_NBITS)){ + return -EOPNOTSUPP; + } + } ret = phylink_ethtool_set_eee(priv->phylink, edata); if (ret) -- 2.34.1