Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2906995iog; Mon, 27 Jun 2022 05:31:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sdAp4gr2YVxVre0xEJ3Q6MX8Z/TbgiLDVLNMUv2Xy+M9l2jBaEutwKqFaQeHaHOnovFSjw X-Received: by 2002:a17:906:4fd3:b0:726:2b29:9fb with SMTP id i19-20020a1709064fd300b007262b2909fbmr12188829ejw.370.1656333101225; Mon, 27 Jun 2022 05:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333101; cv=none; d=google.com; s=arc-20160816; b=sa6Qgjsy79Okvb7hZsIwYErJidpc8DlfwCnyfrDp9UIZOqiH4UKBTbAg1zrfJ423MD J4GrL7ifWuay6siAPSkZFybYB108QXu9Jxx+Udk2p94cChaYy3yd0aQNFRtHpeuTAVRh ybLTx241Zhu0eNMbjlJPufVtrXo/gxzwgho6VknY/FyG4L4ZD7+imn+56CuGXd/9A5nb xWhJWJxa3ISC+3MPxe0fPORWBSnawVMeSCptdTOUYXgEZiAkCjnqg5CwrqNParf6Fq8V IEJN/PeopMibE+YCbkmlTqs/D+sPmn4GM1qhRo0fWGGcma2X2hUmdoHq6t0LPHU1qE7p iSaw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1LY0WetwpoZ4N3vKnfRzEC1lnEgygnyWm/oX907hK9U=; b=aDPdnJ23F1HL3x3RuhwL3Vm/68gO1re52r8dp/4bDRb65qboFMnamuPBtgIe2Xq4rg WIkeOqFCoXSrQajUS2cf5JH/rBRx0MAvUGrukz58cXQ532IHJRs1BxAtqXm3fCUBXUZ6 ftRAUXQzSE+ngJHLBQzR1aGzIWtK7fSrPcqVi6dw7gcmeOtRL2HCPI0nKZ6WQgL6u1di bOMND7Fg8iTuroGbodi6ZTey1DXiZMW1eEI+Z4Q4Az5sEg9PIIIvdMbMUyOUVudaaC3y vnwrEF17pKdrFZqSTwG75yw8hw8N5lEWhVf2ySHgyEVf7RzfRPEppqmVaieI6cOO8H0z iAug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0DH+xdfg; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a170906380400b00722e5217355si8902200ejc.607.2022.06.27.05.31.15; Mon, 27 Jun 2022 05:31: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=@linuxfoundation.org header.s=korg header.b=0DH+xdfg; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239021AbiF0Lyl (ORCPT + 99 others); Mon, 27 Jun 2022 07:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238499AbiF0Lsb (ORCPT ); Mon, 27 Jun 2022 07:48:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E6C1BF71; Mon, 27 Jun 2022 04:41:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D0719B81123; Mon, 27 Jun 2022 11:41:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 495FBC3411D; Mon, 27 Jun 2022 11:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330115; bh=vrv4Yh2blM1vGcsZn1FcTcnNRd6Sdn0BVvm+oncPeZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0DH+xdfg5XdmzaEkjajqdPoGRQTZdFNELlFntAFLUqyA1tweK0/nff3n8jtel7jnY fptJiPAjgWr2H+0RIu0tfyHvFFVmGsiL6nIvzliZNwoPmQIuvzzG4iCi7ggDUdUltb d/bQM6lnbVOEsl93uvaEaKmI1AEhzjhaAkrT1e6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anatolii Gerasymenko , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 087/181] ice: ethtool: advertise 1000M speeds properly Date: Mon, 27 Jun 2022 13:21:00 +0200 Message-Id: <20220627111947.082274047@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anatolii Gerasymenko [ Upstream commit c3d184c83ff4b80167e34edfc3d21df424bf27ff ] In current implementation ice_update_phy_type enables all link modes for selected speed. This approach doesn't work for 1000M speeds, because both copper (1000baseT) and optical (1000baseX) standards cannot be enabled at once. Fix this, by adding the function `ice_set_phy_type_from_speed()` for 1000M speeds. Fixes: 48cb27f2fd18 ("ice: Implement handlers for ethtool PHY/link operations") Signed-off-by: Anatolii Gerasymenko Tested-by: Gurucharan (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 39 +++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 24cda7e1f916..2a6f30c26592 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -2191,6 +2191,42 @@ ice_setup_autoneg(struct ice_port_info *p, struct ethtool_link_ksettings *ks, return err; } +/** + * ice_set_phy_type_from_speed - set phy_types based on speeds + * and advertised modes + * @ks: ethtool link ksettings struct + * @phy_type_low: pointer to the lower part of phy_type + * @phy_type_high: pointer to the higher part of phy_type + * @adv_link_speed: targeted link speeds bitmap + */ +static void +ice_set_phy_type_from_speed(const struct ethtool_link_ksettings *ks, + u64 *phy_type_low, u64 *phy_type_high, + u16 adv_link_speed) +{ + /* Handle 1000M speed in a special way because ice_update_phy_type + * enables all link modes, but having mixed copper and optical + * standards is not supported. + */ + adv_link_speed &= ~ICE_AQ_LINK_SPEED_1000MB; + + if (ethtool_link_ksettings_test_link_mode(ks, advertising, + 1000baseT_Full)) + *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_T | + ICE_PHY_TYPE_LOW_1G_SGMII; + + if (ethtool_link_ksettings_test_link_mode(ks, advertising, + 1000baseKX_Full)) + *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_KX; + + if (ethtool_link_ksettings_test_link_mode(ks, advertising, + 1000baseX_Full)) + *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_SX | + ICE_PHY_TYPE_LOW_1000BASE_LX; + + ice_update_phy_type(phy_type_low, phy_type_high, adv_link_speed); +} + /** * ice_set_link_ksettings - Set Speed and Duplex * @netdev: network interface device structure @@ -2322,7 +2358,8 @@ ice_set_link_ksettings(struct net_device *netdev, adv_link_speed = curr_link_speed; /* Convert the advertise link speeds to their corresponded PHY_TYPE */ - ice_update_phy_type(&phy_type_low, &phy_type_high, adv_link_speed); + ice_set_phy_type_from_speed(ks, &phy_type_low, &phy_type_high, + adv_link_speed); if (!autoneg_changed && adv_link_speed == curr_link_speed) { netdev_info(netdev, "Nothing changed, exiting without setting anything.\n"); -- 2.35.1