Received: by 10.192.165.148 with SMTP id m20csp782110imm; Fri, 27 Apr 2018 07:26:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrBrSgiOzECe5gM4mIXvj3eoGcINCchDfPhprG3xmS88tGywjcrgNjKohMuC8YWww2azo6a X-Received: by 2002:a17:902:5914:: with SMTP id o20-v6mr2552877pli.40.1524839202628; Fri, 27 Apr 2018 07:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524839202; cv=none; d=google.com; s=arc-20160816; b=Foz8P7SDT1LdAos3tIr/Y5AIM7CYmctb69B2PrnujRsZbnLjQE8LLf77nzmrJtXfIw Tw5sds2RmkGjEazWghu0SDbxzHKuBgy0geLSEJZGMr5899TO+ABxJty7ISorZxg5Qgnz SNdwsVA2LUOsibxeJVK/VO1PVqI5nzea2YY9NvTgIKF8i+reCwp7YZ4XdjwWjc+Vfn6q pcc4sHuFh75O1kUgh8f5kA05tvHmPdb65EeqXsBir0n1cY+kAuWqz4VYqQhA9+8VCFEb tWBN+6QCB0BAHBasdXtnDBNcWk3Cex9FF2oH3vhdRinGxoDISyikcxGb1wTFnCcRerrn uADg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=8zdOqj+hBv/UaJQOkBhbMJCA4zRiGw7eKb1KtUo0i4E=; b=AxPyoBUz2QIDnZ3wT1cgZA6Psz4Fn3B3pStbDtvwSEWjh0FjPaHwZvAtiA6qQ3srO4 b5No+pLVW88mXAQkKCrnUuZHCFqn0O9fNJvkcbFVQ9cGFnAYt4J0WS/99RMjEUw3lL+K DR5YmG6sRUZZFA8jyb3h2DqSrTtF0PZ2sUTJH7eJVd9/CjJ2a0LAUQZ2js+3HYqCwCsv kijm7k6adB9SALIhhpWu0vOJq2+6HcSDaoTy8BLWrW5JJ+l3IA5QFF3II9K7UrN2nQJm 2F4dUwIDwmgVQm2JZWaSKzj2HlzCdPvnL8ZA/3dT5icQz/9XxQp+HFhq9MMPFpK2w6pC THqw== ARC-Authentication-Results: i=1; mx.google.com; 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 e15-v6si1344160pga.573.2018.04.27.07.26.28; Fri, 27 Apr 2018 07:26:42 -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; 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 S935219AbeD0OZ3 (ORCPT + 99 others); Fri, 27 Apr 2018 10:25:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:56376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935058AbeD0OLg (ORCPT ); Fri, 27 Apr 2018 10:11:36 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 18FA721892; Fri, 27 Apr 2018 14:11:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18FA721892 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , "David S. Miller" Subject: [PATCH 4.16 35/81] amd-xgbe: Add pre/post auto-negotiation phy hooks Date: Fri, 27 Apr 2018 15:58:37 +0200 Message-Id: <20180427135745.031028636@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135743.216853156@linuxfoundation.org> References: <20180427135743.216853156@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tom Lendacky [ Upstream commit 4d945663a6a0acf3cbe45940503f2eb9584bfee7 ] Add hooks to the driver auto-negotiation (AN) flow to allow the different phy implementations to perform any steps necessary to improve AN. Signed-off-by: Tom Lendacky Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 16 ++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -437,6 +437,9 @@ static void xgbe_an73_disable(struct xgb static void xgbe_an_restart(struct xgbe_prv_data *pdata) { + if (pdata->phy_if.phy_impl.an_pre) + pdata->phy_if.phy_impl.an_pre(pdata); + switch (pdata->an_mode) { case XGBE_AN_MODE_CL73: case XGBE_AN_MODE_CL73_REDRV: @@ -453,6 +456,9 @@ static void xgbe_an_restart(struct xgbe_ static void xgbe_an_disable(struct xgbe_prv_data *pdata) { + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + switch (pdata->an_mode) { case XGBE_AN_MODE_CL73: case XGBE_AN_MODE_CL73_REDRV: @@ -637,11 +643,11 @@ static enum xgbe_an xgbe_an73_incompat_l return XGBE_AN_NO_LINK; } - xgbe_an73_disable(pdata); + xgbe_an_disable(pdata); xgbe_switch_mode(pdata); - xgbe_an73_restart(pdata); + xgbe_an_restart(pdata); return XGBE_AN_INCOMPAT_LINK; } @@ -820,6 +826,9 @@ static void xgbe_an37_state_machine(stru pdata->an_result = pdata->an_state; pdata->an_state = XGBE_AN_READY; + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", xgbe_state_as_string(pdata->an_result)); } @@ -903,6 +912,9 @@ again: pdata->kx_state = XGBE_RX_BPA; pdata->an_start = 0; + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", xgbe_state_as_string(pdata->an_result)); } --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -833,6 +833,7 @@ struct xgbe_hw_if { /* This structure represents implementation specific routines for an * implementation of a PHY. All routines are required unless noted below. * Optional routines: + * an_pre, an_post * kr_training_pre, kr_training_post */ struct xgbe_phy_impl_if { @@ -875,6 +876,10 @@ struct xgbe_phy_impl_if { /* Process results of auto-negotiation */ enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *); + /* Pre/Post auto-negotiation support */ + void (*an_pre)(struct xgbe_prv_data *); + void (*an_post)(struct xgbe_prv_data *); + /* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct xgbe_prv_data *); void (*kr_training_post)(struct xgbe_prv_data *);