From patchwork Sun Sep 27 17:42:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 289537 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=-13.5 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, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, USER_AGENT_GIT autolearn=ham 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 E31F0C4741F for ; Sun, 27 Sep 2020 17:43:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7FEF23718 for ; Sun, 27 Sep 2020 17:43:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="e87LrvWJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbgI0RnD (ORCPT ); Sun, 27 Sep 2020 13:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726460AbgI0Rmy (ORCPT ); Sun, 27 Sep 2020 13:42:54 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D050C0613D5 for ; Sun, 27 Sep 2020 10:42:54 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id y14so6207119pgf.12 for ; Sun, 27 Sep 2020 10:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zKx8NItLm16acUl6Jd2OXcmmoVpWoFCZZ3PqUD23OBg=; b=e87LrvWJHJMzWi//ZEqvDGJWiyuaEee4jSrWVkbcoH6tu8Yo5yY/Yug4fxKGXfOcK8 6eWoYT8lHUbKBMC7KrMq1ViOEgoJJwmmMnn96FNG5ws4Ae5F6LxYhKEdEsCrpXxL/pqM vlUaSCgjsRpLAtPWoob265X7YkSNiyoLThSQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zKx8NItLm16acUl6Jd2OXcmmoVpWoFCZZ3PqUD23OBg=; b=qsiZ+arYrhYnhNBhDKwKJzvh6HZNKfr0k3eTJBZcExlRohugCBrkt8V6lXdgRk5rSy 71GwKlFMKItANCwAJTkkpLQvjRUYwqSsxrcRZYrNsoQXzpW8lCW5VlIWD6tlOLeqt6ai pGoqVLD7kqbNljyZy8v3SuAon2nT43plQpWu5Og3gu07pv5aGPB4V7fN7a7OMd7vwcU+ h/MCDi0vuGXRcDRi3c7mQ8W3wM3JypCq8A2ocuAmqqfcXsz26783zSbpIMt6jbPhxF0i Z2oBFS/K3J/jNNykWLKlj5mBdHNGTmgg8kKWXcnRz7DocwSF447XNG58RPtopDitZc5F G24g== X-Gm-Message-State: AOAM531a2JsRN3w8+psnIgZg1EKGVnqCjahZHkPVIwcxLLO3GSw105e6 RyWE1FYyjjZelY6KZZQ6Yr34SQIkWZRngg== X-Google-Smtp-Source: ABdhPJysJxAw9ATp3T9KQmtOQk7H+A1+BYRZh+ZQLkfb9rDALdHddY1XmDYDUEbZ8vHHZxjnnYld6A== X-Received: by 2002:a05:6a00:23cc:b029:142:2501:34e5 with SMTP id g12-20020a056a0023ccb0290142250134e5mr7986783pfc.62.1601228573417; Sun, 27 Sep 2020 10:42:53 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o19sm8765570pfp.64.2020.09.27.10.42.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Sep 2020 10:42:52 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, Edwin Peer Subject: [PATCH net-next 07/11] bnxt_en: avoid link reset if speed is not changed Date: Sun, 27 Sep 2020 13:42:16 -0400 Message-Id: <1601228540-20852-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601228540-20852-1-git-send-email-michael.chan@broadcom.com> References: <1601228540-20852-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Edwin Peer PORT_PHY_CONFIG is always sent with REQ_FLAGS_RESET_PHY set. This flag must be set in order for the firmware to institute the requested PHY change immediately, but it results in a link flap. This is unnecessary and results in an improved user experience if the PHY reconfiguration is avoided when the user requested speed does not constitute a change. Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 2cb2495c2351..4fdb672a47a0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1736,6 +1736,11 @@ static int bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed) return -EINVAL; } + if (link_info->req_link_speed == fw_speed && + link_info->req_signal_mode == sig_mode && + link_info->autoneg == 0) + return -EALREADY; + link_info->req_link_speed = fw_speed; link_info->req_signal_mode = sig_mode; link_info->req_duplex = BNXT_LINK_DUPLEX_FULL; @@ -1816,8 +1821,11 @@ static int bnxt_set_link_ksettings(struct net_device *dev, } speed = base->speed; rc = bnxt_force_link_speed(dev, speed); - if (rc) + if (rc) { + if (rc == -EALREADY) + rc = 0; goto set_setting_exit; + } } if (netif_running(dev))