From patchwork Wed Oct 19 08:25:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350454wrs; Wed, 19 Oct 2022 07:13:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mq5oR3O9TuWo/uvXgJLbNRiIzyyhKRZaYq6Dc51R7R0GCiGZiH6q52hArwc/K4SEPMnA4 X-Received: by 2002:a17:902:b48b:b0:182:42ce:5779 with SMTP id y11-20020a170902b48b00b0018242ce5779mr8902774plr.103.1666188822321; Wed, 19 Oct 2022 07:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188822; cv=none; d=google.com; s=arc-20160816; b=ZShT+uN6/6jT6m3KgEalysrP4zQEjk8uPp0PL0ka2ZpidDvXSjsYUKtv97jAJqT8Nd nznAiQqV/1zd9QR9F9JzfwSeS8GQ3VFyfL+UT1C/hkrBvcnJToQ8ite2reRXTsBKcwY8 ho3FOgiOfMVRzdj023JnEnvSI5tB7w2EVsQRtGBM4hPCZYhDD7ftl+8fa7ELIcGKGzy3 PxBDxaLiZ36cITJHgmG/sCL/YqlGZ7QRTa+TSlE0vJImEWwuLiTH7KEUQBwM4nHMFcgc b1xqeGuiCT7qqMniiTn33DNsHYiheQSZ2F3VTuoCUeemzH+P4ZMGdHz/pta3ofIjWJke KOLg== 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=rhGRmicf1RgERPaYU3E1l2dx+nlPFQv+4byeRcNEc48=; b=TKP23ApiGh4oKb+DNxfm9L+qmJ8uaUOVpSwMbD2cKfGHy5TBqMgw4ezXV7pCkL7Ols G0wv2S1Oo8d/eXVETlAM/RKKAqIapsBuN+WdUIazdNHyIMefZve9hZCLgXMvxmYEfxUO g4TDY2buO4JWSgTecONjWCrheBc5fQqrjK1jUUhd5TzxG72ZEsGXUOePbrD1BB4JF8tz 6/E4hYtfGJCB+RW8Yrl9kt30JxnLXAWx5lz6Z4ekMLjAg1VRyhagN5sL8t0geNqm0LrU gklXGDlL9rMzBdrKdlaiOcLEsClZXhJo2HP+29AFLycpVMyxiCXY4Jw/g2OfdwjDO6oQ yW7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wt5WdrNq; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t64-20020a635f43000000b0044fb0824e52si19392583pgb.171.2022.10.19.07.13.19; Wed, 19 Oct 2022 07:13:42 -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=wt5WdrNq; 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 S232957AbiJSN5i (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233924AbiJSNyY (ORCPT ); Wed, 19 Oct 2022 09:54:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599F9193748; Wed, 19 Oct 2022 06:37:16 -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 A860BB82383; Wed, 19 Oct 2022 08:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20439C433C1; Wed, 19 Oct 2022 08:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169421; bh=AWBYzKuSRGASn1poCM4D5EdymKeSS6RHn7wjl5AtJDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wt5WdrNqjN+qaJGSOYvEfhZzMi65mnHFefvBzGjcTqFGveecyRVOpHbKWJ/0yz+fX SeH/u03I3bKWtaR7AyXEFy2PWQvtm3wJGWymfYlVhT7+zH8Uer2Q1sVL3yYuaX/XU/ PDon/pu1cMWXnq2SfEqYXvNJFBQC0v5Z5Lalw0ZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Mazur , Maksym Glubokiy , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 236/862] net: prestera: cache port state for non-phylink ports too Date: Wed, 19 Oct 2022 10:25:23 +0200 Message-Id: <20221019083300.474641938@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125610726299622?= X-GMAIL-MSGID: =?utf-8?q?1747125610726299622?= From: Maksym Glubokiy [ Upstream commit 704438dd4f030c1b3d28a2a9c8f182c32d9b6bc4 ] Port event data must stored to port-state cache regardless of whether the port uses phylink or not since this data is used by ethtool. Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support") Signed-off-by: Oleksandr Mazur Signed-off-by: Maksym Glubokiy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/marvell/prestera/prestera_main.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index a895862b4821..a0ad0bcbf89f 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -799,32 +799,30 @@ static void prestera_port_handle_event(struct prestera_switch *sw, caching_dw = &port->cached_hw_stats.caching_dw; - if (port->phy_link) { - memset(&smac, 0, sizeof(smac)); - smac.valid = true; - smac.oper = pevt->data.mac.oper; - if (smac.oper) { - smac.mode = pevt->data.mac.mode; - smac.speed = pevt->data.mac.speed; - smac.duplex = pevt->data.mac.duplex; - smac.fc = pevt->data.mac.fc; - smac.fec = pevt->data.mac.fec; - phylink_mac_change(port->phy_link, true); - } else { - phylink_mac_change(port->phy_link, false); - } - prestera_port_mac_state_cache_write(port, &smac); + memset(&smac, 0, sizeof(smac)); + smac.valid = true; + smac.oper = pevt->data.mac.oper; + if (smac.oper) { + smac.mode = pevt->data.mac.mode; + smac.speed = pevt->data.mac.speed; + smac.duplex = pevt->data.mac.duplex; + smac.fc = pevt->data.mac.fc; + smac.fec = pevt->data.mac.fec; } + prestera_port_mac_state_cache_write(port, &smac); if (port->state_mac.oper) { - if (!port->phy_link) + if (port->phy_link) + phylink_mac_change(port->phy_link, true); + else netif_carrier_on(port->dev); if (!delayed_work_pending(caching_dw)) queue_delayed_work(prestera_wq, caching_dw, 0); - } else if (netif_running(port->dev) && - netif_carrier_ok(port->dev)) { - if (!port->phy_link) + } else { + if (port->phy_link) + phylink_mac_change(port->phy_link, false); + else if (netif_running(port->dev) && netif_carrier_ok(port->dev)) netif_carrier_off(port->dev); if (delayed_work_pending(caching_dw))