Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2253550ybd; Mon, 24 Jun 2019 03:22:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyV+MDlm2phOkdlA+Q4a29d4Y/Ys+JhhAvkxJh0j6wi9JcVxdV6uw6Y073ZsdfJoDlpTAwe X-Received: by 2002:a17:90a:2343:: with SMTP id f61mr24110027pje.130.1561371720350; Mon, 24 Jun 2019 03:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371720; cv=none; d=google.com; s=arc-20160816; b=v0X1xOHzPTw98jUL9o8g38s03hEAEpyYYlcaiFerGsYBF5jddIgs8PnF9IQ6Ab5XtG inc8gXLpTseV+17ucbNkMkwbKvSEempUrKnDkJBGYpAMlCh+dYaP/24SavBMZ0zsQ3uq E+SPbUGKQ5f+9YMKGNu0r+PPxq3jLQ8wmRV/rI6CJHIL1pJLS6Z4JgXi6kGzuNYphoZo T2aIn7oS61d2c0l2zJxJCNt8RHO8sWq4NmcyjEaN1quylFjJj1nzJSmY0DWFrencd2nI jsTKP+0HATFjf0ppqJ0Xy0o2aEvD1EyXNWTIDSQXxw0JgTsq/B3TXhq2QRaVAzGi9cUj zMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gbcC8jdrUVVW5ijd+Pvkv+oQp5AdBdZLeorfQ1yBO7U=; b=Jm82VkaSWXsBecxPd0R8hMENuY7OJn33gF08Ji1Qocmn9KDomoCP2khwsChanxHtNt 7yEAAWR9j5d7XWB4KDLM2c8MmWO8oCTQ7m4Ijc/cQ1okQPG7iUijOM+Clr+3ho0gq2HD ZK/bdbBtIOMbaNRuEf2fN3EGnzevnxEESN3bzAId1vl9ja6hTotrQFvRn8WoW6iy33oJ gAfshN6kgzldVyuJCncbev6OE6wPktuTFswc1mMLImKv2l5QewqICoKATfT3hnrC8rqF UqxyvKsJ7LNbcpRQRuJQx5M+PdV3Fjv3w4xHKk9fQQVWYlhsnoJro0BqE8JxrN1OfODy OCSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="E3TsJj/o"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si9903068pgv.81.2019.06.24.03.21.44; Mon, 24 Jun 2019 03:22:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="E3TsJj/o"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729239AbfFXKVd (ORCPT + 99 others); Mon, 24 Jun 2019 06:21:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:57168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbfFXKVc (ORCPT ); Mon, 24 Jun 2019 06:21:32 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC4E220645; Mon, 24 Jun 2019 10:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371691; bh=SZxykeU4Vsmcs7B5/PXtHkSQeFdz7khlY6jwLUstk3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E3TsJj/oKOZ/t+4JONCE+uX8mrWvpWh/IKI+7avhFmKds3x+9qvGjXh0kraQB2QPO cusoAQC5FNYSNbN8W65LdsuTU04UvL97xZxMw+4WutVdGFVbW1m/xtCGWUOYwpymV/ xfB3AjBhXhGdW6VxRSghx4AN1O2AdWYOTMUGLjbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 076/121] net: phylink: avoid reducing support mask Date: Mon, 24 Jun 2019 17:56:48 +0800 Message-Id: <20190624092324.772292576@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 77316763321ee4050f0576ffd472183aa90dcb30 ] Avoid reducing the support mask as a result of the interface type selected for SFP modules, or when setting the link settings through ethtool - this should only change when the supported link modes of the hardware combination change. Signed-off-by: Russell King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/phylink.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index efa31fcda505..611dfc3d89a0 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1080,6 +1080,7 @@ EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_get); int phylink_ethtool_ksettings_set(struct phylink *pl, const struct ethtool_link_ksettings *kset) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(support); struct ethtool_link_ksettings our_kset; struct phylink_link_state config; int ret; @@ -1090,11 +1091,12 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, kset->base.autoneg != AUTONEG_ENABLE) return -EINVAL; + linkmode_copy(support, pl->supported); config = pl->link_config; /* Mask out unsupported advertisements */ linkmode_and(config.advertising, kset->link_modes.advertising, - pl->supported); + support); /* FIXME: should we reject autoneg if phy/mac does not support it? */ if (kset->base.autoneg == AUTONEG_DISABLE) { @@ -1104,7 +1106,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, * duplex. */ s = phy_lookup_setting(kset->base.speed, kset->base.duplex, - pl->supported, false); + support, false); if (!s) return -EINVAL; @@ -1133,7 +1135,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, __set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising); } - if (phylink_validate(pl, pl->supported, &config)) + if (phylink_validate(pl, support, &config)) return -EINVAL; /* If autonegotiation is enabled, we must have an advertisement */ @@ -1583,6 +1585,7 @@ static int phylink_sfp_module_insert(void *upstream, { struct phylink *pl = upstream; __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, }; + __ETHTOOL_DECLARE_LINK_MODE_MASK(support1); struct phylink_link_state config; phy_interface_t iface; int ret = 0; @@ -1610,6 +1613,8 @@ static int phylink_sfp_module_insert(void *upstream, return ret; } + linkmode_copy(support1, support); + iface = sfp_select_interface(pl->sfp_bus, id, config.advertising); if (iface == PHY_INTERFACE_MODE_NA) { netdev_err(pl->netdev, @@ -1619,7 +1624,7 @@ static int phylink_sfp_module_insert(void *upstream, } config.interface = iface; - ret = phylink_validate(pl, support, &config); + ret = phylink_validate(pl, support1, &config); if (ret) { netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n", phylink_an_mode_str(MLO_AN_INBAND), -- 2.20.1