Message ID | 20240215030500.3067426-2-yong.liang.choong@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp240127dyb; Thu, 15 Feb 2024 00:07:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWV5iuhPjwAd6/DOJHgs2PuF1r7rXD5v5s4Mx7lUJ78QJZLQTjCAw0Ji/BgijHmmlpwZbDZjlSsMQM11D8yu3AaZdgoFQ== X-Google-Smtp-Source: AGHT+IGUPPGCPxzM4dQSveJUdWKCzcrze+NAlDI2mfBLGqZoOHGtjbd40nzUeQAU94EKJBN4wgO1 X-Received: by 2002:a17:902:6841:b0:1db:28dd:a428 with SMTP id f1-20020a170902684100b001db28dda428mr930188pln.23.1707984465714; Thu, 15 Feb 2024 00:07:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707984465; cv=pass; d=google.com; s=arc-20160816; b=wGTe1kyX7b8uV+C/PkomRm9MLdGXcLubkY3UgqOXoHYwLWdwx4aMlhuvjP3yv6VSZT DMO9zgB0rhQ1TDpksekmOTjDOp/AYTkws6SxkctZFI3vPFU020UBhynv41yjKfh1sZTh 3MBUE0Bk2rSj9BqITs7PjIB1/+gpzBk4felqm5mww4mO74EQzC7EoXrVZA6KzeC5fZsc pnEuLnAYWz94gVEAluDwgflP4+rQrPXoHrGOamjaH9+5CcAuaclZ5UccP9tyLXcEKC1o ZswqsME6Ng4lLBSde5WrG3KCOpBmRUJq2ahDld+YsntFvOfX2yfua595apGoGIP/5F3B GtQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eeJEAN5Ez1X1BISwoi7jY8ezbgEUvbop9By/UAKZa0g=; fh=chTeah25dtsI+fnQYorT/69F850asxoXrFC8SVATgvA=; b=e87hdd9gome8a3YGJEGw3BewRB4ItMJ4bNBOl2krOV4U+ylXOGpPlR/rl2gflCE/jt 17KMzh1N9RyPztQlX4JFyVh9B8jaNVXCp33SwBjfarlaleN/ElF5KsGns/+PFi0Q/kWk 6rHifZpGN5ukDESyfAgI5qL8b6qXoqwTEEnFiA6+NTPOGhCD58voh0PHxVSU1qoBcUP3 13a7FFp6pSyrpTduU/2V2yx+tl0eGV+SeCcqQFMeflWADPv0c22rl0hlMnDBUd6uuNNM QsT4CRMlmSjR0bPpCL3xmIQqKn0DaFzaPy+EN0JFhvqoYuYo21AJKlavKIk6FIIEYDEC biWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JHe5034D; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u5-20020a170903124500b001d9bdc912ffsi724376plh.403.2024.02.15.00.07.45 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 00:07:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JHe5034D; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66252-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D121EB2902A for <ouuuleilei@gmail.com>; Thu, 15 Feb 2024 03:08:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE755C142; Thu, 15 Feb 2024 03:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JHe5034D" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 788EB8C1E; Thu, 15 Feb 2024 03:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707966459; cv=none; b=R4/yTjGaZ0K4dbyoLRPJgrK/tlbHpCbwZ/AnL8cACrAuKCE+QGOjiuDreepMZYvmRna3SnBizNOJnE257NH2v8vsKjHHkVQPqS92ltGiEyZOIx7vUx6FDVYHh5pW0qNyujJlWI8pv8J9nnoRElESinMoxl9IWkaa5j5sGyzV9xE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707966459; c=relaxed/simple; bh=Id7jaa6k0BX7PLQJS3cBe6qIs2K9RSyvcFT8QOa3qkE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UpQA4hHPZXNyohAs/NxgeJLwzqMEdlsjObqZW2Bi/lbHirWAC2FqNFNDfnoWis9KE87j+kBzhAbiv05h5qgdIQocub68sun07KPxrNk2keltIY1uZmIv1LB/pKTgIC/umnH1uUex1w+6NKoyhvhGA+TTMsnGVAgsATlSE/brhus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JHe5034D; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707966458; x=1739502458; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Id7jaa6k0BX7PLQJS3cBe6qIs2K9RSyvcFT8QOa3qkE=; b=JHe5034DGy5+/NTfiQ+rcMVtiGInq6FV40vtQMCJ4K+BbzD6suj/hiIS QQDv7H4Wd9aoMQxN2e0vZTeBAF1IAeDh/BlVCVu9JP/hoKGWr0Lk8/pSV /8JAgRRMQWDO4oKMvAxf75/y154zDtQrCcoAayfcvLVEFEZwMY/D4rIgu TjnA+hPffMPRMym1g2CI8tE5on7GWlAFsobwpi7tOjrnbuSXDmGyal+o0 PV6dOdNDVQD0fq42zORh8oU75HWpzuM4tl1GjcvmDOktMuKUVTW+L8erT 19KBesVneWJcBN942puWCa0kgWVQbm+ZfR9klckCUXfAXAsKvi0ipQxco Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10984"; a="19461225" X-IronPort-AV: E=Sophos;i="6.06,161,1705392000"; d="scan'208";a="19461225" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2024 19:07:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,161,1705392000"; d="scan'208";a="3385660" Received: from yongliang-ubuntu20-ilbpg12.png.intel.com ([10.88.229.33]) by fmviesa009.fm.intel.com with ESMTP; 14 Feb 2024 19:07:29 -0800 From: Choong Yong Liang <yong.liang.choong@linux.intel.com> To: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>, David E Box <david.e.box@linux.intel.com>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <Jose.Abreu@synopsys.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Richard Cochran <richardcochran@gmail.com>, Russell King <linux@armlinux.org.uk>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Philipp Zabel <p.zabel@pengutronix.de> Cc: Andrew Halaney <ahalaney@redhat.com>, Serge Semin <fancer.lancer@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org, bpf@vger.kernel.org, Voon Wei Feng <weifeng.voon@intel.com>, Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>, Lai Peter Jun Ann <jun.ann.lai@intel.com>, Abdul Rahim Faizal <faizal.abdul.rahim@intel.com> Subject: [PATCH net-next v5 1/9] net: phylink: provide mac_get_pcs_neg_mode() function Date: Thu, 15 Feb 2024 11:04:51 +0800 Message-Id: <20240215030500.3067426-2-yong.liang.choong@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215030500.3067426-1-yong.liang.choong@linux.intel.com> References: <20240215030500.3067426-1-yong.liang.choong@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790951518977346059 X-GMAIL-MSGID: 1790951518977346059 |
Series |
Enable SGMII and 2500BASEX interface mode switching for Intel platforms
|
|
Commit Message
Choong Yong Liang
Feb. 15, 2024, 3:04 a.m. UTC
Phylink invokes the 'mac_get_pcs_neg_mode' function during interface mode
switching and initial startup.
This function is optional; if 'phylink_pcs_neg_mode' fails to accurately
reflect the current PCS negotiation mode, the MAC driver can determine the
mode based on the interface mode, current link negotiation mode, and
advertising link mode.
For instance, if the interface switches from 2500baseX to SGMII mode,
and the current link mode is MLO_AN_PHY, calling 'phylink_pcs_neg_mode'
would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require
PHYLINK_PCS_NEG_INBAND_ENABLED, the 'mac_get_pcs_neg_mode' function
will calculate the mode based on the interface, current link negotiation
mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to
enable the PCS to configure the correct settings.
Signed-off-by: Choong Yong Liang <yong.liang.choong@linux.intel.com>
---
drivers/net/phy/phylink.c | 14 +++++++++++---
include/linux/phylink.h | 5 +++++
2 files changed, 16 insertions(+), 3 deletions(-)
Comments
> > For instance, if the interface switches from 2500baseX to SGMII mode, > > and the current link mode is MLO_AN_PHY, calling > 'phylink_pcs_neg_mode' > > would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver > > require PHYLINK_PCS_NEG_INBAND_ENABLED, the > 'mac_get_pcs_neg_mode' > > function will calculate the mode based on the interface, current link > > negotiation mode, and advertising link mode, returning > > PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct > settings. > > This paragraph doesn't make sense - at least to me. It first talks about > requiring PHYLINK_PCS_NEG_INBAND_ENABLED when in SGMII mode. On > this: The example given here is a very specific condition and that probably why there are some confusions here. Basically, this patch provides an optional function for MAC driver to change the phy interface on-the-fly without the need of reinitialize the Ethernet driver. As we know that the 2500base-x is messy, in our case the 2500base-x does not support inband. To complete the picture, we are using SGMII c37 to handle speed 10/100/1000. Hence, to enable user to switch link speed from 2500 to 1000/100/10 and vice versa on-the-fly, the phy interface need to be configured to inband SGMII for speed 10/100/1000, and outband 2500base-x for speed 2500. Lastly, the newly introduced "mac_get_pcs_neg_mode"callback function enables MAC driver to reconfigure pcs negotiation mode to inband or outband based on the interface mode, current link negotiation mode, and advertising link mode. > > 1) are you sure that the hardware can't be programmed for the SGMII > symbol repititions? > No, the HW can be program for SGMII symbol repetitions. > 2) what happens if you're paired with a PHY (e.g. on a SFP module) which > uses SGMII but has no capability of providing the inband data? > (They do exist.) If your hardware truly does require inband data, it is going to > be fundamentally inoperative with these modules. > Above explanation should have already cleared your doubts. Inband or outband capability is configured based on the phy interface. > Next, you then talk about returning PHYLINK_PCS_NEG_OUTBAND for the > "correct settings". How does this relate to the first part where you basically > describe the problem as SGMII requring inband? Basically the two don't > follow. It should be a typo mistake. SGMII should return PHYLINK_PCS_NEG_INBAND_ENABLED. > > How, from a design point of view, because this fundamentally allows drivers > to change how the system behaves, it will allow radically different behaviours > for the same parameters between different drivers. > I am opposed to that - I want to see a situation where we have uniform > behaviour for the same configuration, and where hardware doesn't support > something, we have some way to indicate that via some form of capabilities. > Hi Russell, If I understand you correctly, MAC driver should not interfere with pcs negotiation mode and it should be standardized in the generic function, e.g., phylink_pcs_neg_mode()? > The issue of whether 2500base-X has inband or not is a long standing issue, > and there are arguments (and hardware) that take totally opposing views on > this. There is hardware where 2500base-X inband _must_ be used or the link > doesn't come up. There is also hardware where 2500base-X inband is not > "supported" in documentation but works in practice. There is also hardware > where 2500base-X inband doesn't work. The whole thing is a total mess > (thanks IEEE 802.3 for not getting on top of this early enough... and what's > now stated in 802.3 for 2500base-X is now irrelevant because they were too > late to the > party.) > Agreed. And I have also seen some of your comments regarding the 2500SGMII and 2500BASEX.
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 503fd7c40523..b38b39a6d1f0 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1151,9 +1151,17 @@ static void phylink_major_config(struct phylink *pl, bool restart, phylink_dbg(pl, "major config %s\n", phy_modes(state->interface)); - pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode, - state->interface, - state->advertising); + if (pl->mac_ops->mac_get_pcs_neg_mode) { + pl->pcs_neg_mode = pl->mac_ops->mac_get_pcs_neg_mode + (pl->config, + pl->cur_link_an_mode, + state->interface, + state->advertising); + } else { + pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode, + state->interface, + state->advertising); + } if (pl->using_mac_select_pcs) { pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 6ba411732a0d..f0a6c00e8dab 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -168,6 +168,7 @@ void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed); * @mac_finish: finish a major reconfiguration of the interface. * @mac_link_down: take the link down. * @mac_link_up: allow the link to come up. + * @mac_get_pcs_neg_mode: Get PCS negotiation mode for interface mode. * * The individual methods are described more fully below. */ @@ -188,6 +189,10 @@ struct phylink_mac_ops { struct phy_device *phy, unsigned int mode, phy_interface_t interface, int speed, int duplex, bool tx_pause, bool rx_pause); + unsigned int (*mac_get_pcs_neg_mode)(struct phylink_config *config, + unsigned int mode, + phy_interface_t interface, + const unsigned long *advertising); }; #if 0 /* For kernel-doc purposes only. */