From patchwork Thu Oct 15 08:44:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11838793 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C22B5C43457 for ; Thu, 15 Oct 2020 08:45:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64CD322267 for ; Thu, 15 Oct 2020 08:45:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="sMvl/x85" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388281AbgJOIpa (ORCPT ); Thu, 15 Oct 2020 04:45:30 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:42563 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387422AbgJOIp3 (ORCPT ); Thu, 15 Oct 2020 04:45:29 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201015084517euoutp01736d814e272f9bd611fdcdc84321fa27~_HgNbO_-L1458814588euoutp01e for ; Thu, 15 Oct 2020 08:45:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201015084517euoutp01736d814e272f9bd611fdcdc84321fa27~_HgNbO_-L1458814588euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602751517; bh=y0oCq68YdRF8NXo3BoF+euePbj27PoHRi5+zdDHBL9E=; h=From:To:Cc:Subject:Date:References:From; b=sMvl/x85sFi4K4rR8Q+X771Rfd4XMVtb34n6mqgTiNUksRE3ilZdYDlZM6qbMO7zr dgBqWVfQeLd9qel/mCE0EaqUIxwpXUuuLyhiJ5AU9T/jwDfadS+IopisvYnHSh/GkZ LrJSIe3xZTVfGs+IoUV96X4DLCLVd1F/bC+fGwPg= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201015084514eucas1p233f9f5da7d4dc04178aab2ef3ba72461~_HgKoQEp-3079930799eucas1p2k; Thu, 15 Oct 2020 08:45:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A6.54.05997.A1C088F5; Thu, 15 Oct 2020 09:45:14 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84~_HgKNHJKM3079530795eucas1p2U; Thu, 15 Oct 2020 08:45:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201015084513eusmtrp2766b126b06102e13b168439f659e7c4d~_HgKMfAzK0782407824eusmtrp2w; Thu, 15 Oct 2020 08:45:13 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-d3-5f880c1ac3ef Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5E.1D.06017.91C088F5; Thu, 15 Oct 2020 09:45:13 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201015084513eusmtip1cc1450371704605ce86930770bfe9efd~_HgKAupoJ2954629546eusmtip10; Thu, 15 Oct 2020 08:45:13 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Bart=C5=82omiej_=C5=BBolnierkiewicz?= , Marek Szyprowski , =?utf-8?q?=C5=81ukasz_Stelmach?= Subject: [PATCH v2] net: phy: Prevent reporting advertised modes when autoneg is off Date: Thu, 15 Oct 2020 10:44:35 +0200 Message-Id: <20201015084435.24368-1-l.stelmach@samsung.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA02SfyyUcRzH+97zPHePy/F1LB9qpUurtPzol2e71mjZnvWX+iNNK108O4Zj d4hqJUrY+V3IjxgLUURcDqlddSpxTEuaS5mxrFaNtur65Txn+e/9+Xxe7+/789m+NCHtoNzp KFUCp1YpYmRCMakz/hjc5m6fGeZ7qYBiTGYDwbSWtlBMhekiydR8LqWYIV0uxYwZGhAz0lUh ZAxX7yPm9mOziDFWrwoQsyOvhgm2/eaYgNWXmUVsW2OWkNV3zgnY3PZGxM61rQ0WhYr3RHAx UUmc2mfvCXHkG+0DMl5rn1yr05KpqFOcjexowDvh5XAekY3EtBQ3IHgx2S3ki3kEtZZsAV/M IXjYbUFLlrG+ChtVj6C48+PiQIpnEOTObrBqIQ6EvBtPKSvkgr8hmJq+g6wFgXsR6N9eIayU Mz4MM01m0qpJvBGac8wLfZqWYDkM6Xz5tHVwuf6e0Kol2AmeXZtaxB2xF9xKG13UxAKT3lG+ eATgXhEUNRUJePN+yGoaJHntDLN97SJer4G/+iqBNQvweSgq3M17tQh0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e1+BCjKdA3E5mlRJPzgTGfVxJvaGpobmFp aG5sbmxmoSTO2yFwMEZIID2xJDU7NbUgtQimj4mDU6qBUcxbYpfb34+rNRZ+/R+yYvpPlm+R ReGHc5UsotysA5+srHu24iL3vpC3LNECeqzyIfUFs++1vd4d+t66ccd7k+Ohj+4WSr1dwZMZ pTd3d9bZkF9CDDN/fpnQcKjat5Nz2WV9DomML3rxl0QFwpi1qjoY/R5Fe59b6Ck/xbvubMzb Ta0PNWfNVWIpzkg01GIuKk4EAKPQG6jBAgAA X-CMS-MailID: 20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84 X-Msg-Generator: CA X-RootMTR: 20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84 References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Do not report advertised link modes (local and remote) when autonegotiation is turned off. mii_ethtool_get_link_ksettings() exhibits the same behaviour and this patch aims at unifying the behavior of both functions. Signed-off-by: Ɓukasz Stelmach --- Changes in v2: - clear lp_advertising - set ETHTOOL_LINK_MODE_TP_BIT and ETHTOOL_LINK_MODE_MII_BIT in advertising drivers/net/phy/phy.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 35525a671400..6ede9c1c138c 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -315,8 +315,17 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev, struct ethtool_link_ksettings *cmd) { linkmode_copy(cmd->link_modes.supported, phydev->supported); - linkmode_copy(cmd->link_modes.advertising, phydev->advertising); - linkmode_copy(cmd->link_modes.lp_advertising, phydev->lp_advertising); + if (phydev->autoneg) { + linkmode_copy(cmd->link_modes.advertising, phydev->advertising); + linkmode_copy(cmd->link_modes.lp_advertising, phydev->lp_advertising); + } else { + linkmode_zero(cmd->link_modes.lp_advertising); + linkmode_zero(cmd->link_modes.advertising); + linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, + cmd->link_modes.advertising); + linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, + cmd->link_modes.advertising); + } cmd->base.speed = phydev->speed; cmd->base.duplex = phydev->duplex;