From patchwork Tue Feb 20 16:04:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13564219 X-Patchwork-Delegate: kuba@kernel.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 3228E763F7; Tue, 20 Feb 2024 16:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445055; cv=none; b=jbPkDCckNe4Lo5ip1GodcJgFVz8AuJ1ht1YJUmOC/qMsdK+aPyh1Mn3RAgrrlz+Hn4H1SIbWHzZ8b8llWvWxQShgcRob1MGE1qL+1Jz1hokY9bnM72b0YWgp4H4L0ZaYVVEfblPI8NJgoEXpjdKy51HBhYCh8N67ym5CmFdmUOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445055; c=relaxed/simple; bh=e41ssPMtOCWf4hbqr3GXct4QQnRw3mF4E7IEVePoDhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JD0zUEtVTcd56k+h0snKjtXOQ5Z1SHrJNRBUQkzI4kGVcL5qEuDszatnOpNWpQ84UnG7A1dIGv/fI2eFpmyU74/hcodXgtkLRgwd8PgDgHHQZ9BGb1HSJVzYfL+pcbyQFA7Awd7tYAculxshTo0nCfjkK66GRd25c+YAFK81pHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=e9VXrQs1; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="e9VXrQs1" Received: by mail.gandi.net (Postfix) with ESMTPSA id B4A73FF80F; Tue, 20 Feb 2024 16:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708445050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0j6vyH8gSlQbmr8S5of7XqDa6oIEuqXtwYh8mWu5L1k=; b=e9VXrQs18lCFf1/zRSAhj5sva9sLY6gW28X4oZhRCpaATEU01ZwKgzaPAE7osDAQOLL+Zk rc9n54imIh0tbLeo21+VkT2DxsiOfIYCVWRsF2KMsV8G9Ykbg6PNKi7R2h5tP/sM8wHmkP t7S7Ex42lpQN1tr4r3ERIft66lrT4qpo+7JXIoU1gOig6hP8SZ2G3jTn/KY1hoDIKgd8TO G5WEbBVw1xPk23qy6zKyVAnITo6Xhel8WHfoVbA+IksW+vSi6rssx/3+/6gGPboTmQgxDN EV+vRk/fNKvqKB9W71mZ4AM4oZ2K2lpMb5421VrUi2f26CI0uC5AERxea+kWcw== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Florian Fainelli , Heiner Kallweit , Jonathan Corbet Subject: [PATCH net-next 1/2] doc: sfp-phylink: drop the mention to phylink_config->pcs_poll Date: Tue, 20 Feb 2024 17:04:03 +0100 Message-ID: <20240220160406.3363002-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240220160406.3363002-1-maxime.chevallier@bootlin.com> References: <20240220160406.3363002-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-Patchwork-Delegate: kuba@kernel.org commit 64b4a0f8b51b ("net: phylink: remove phylink_config's pcs_poll") dropped the phylink_config->pcs_poll field, which is no longer required to be set by MAC drivers. Remove that mention in the phylink porting guide. Signed-off-by: Maxime Chevallier --- Documentation/networking/sfp-phylink.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/networking/sfp-phylink.rst b/Documentation/networking/sfp-phylink.rst index 8054d33f449f..bc3365bbf096 100644 --- a/Documentation/networking/sfp-phylink.rst +++ b/Documentation/networking/sfp-phylink.rst @@ -264,8 +264,7 @@ this documentation. phylink_mac_change(priv->phylink, link_is_up); where ``link_is_up`` is true if the link is currently up or false - otherwise. If a MAC is unable to provide these interrupts, then - it should set ``priv->phylink_config.pcs_poll = true;`` in step 9. + otherwise. 11. Verify that the driver does not call:: From patchwork Tue Feb 20 16:04:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13564218 X-Patchwork-Delegate: kuba@kernel.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 C85EF763FE; Tue, 20 Feb 2024 16:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445055; cv=none; b=Xy6/WPZjlZ0kjcyfAfUKFXhgpa4uxADQeH4iPUlluKSdIYlD7Ckz1irZjqbh43omrZGN5yWSATexnqWfm/DcR4ytKm1t553A2KHu2ngp7735nBijJXowyah6HwNeYLmfonc02l/Ne9Kf0OjZCibbl4BPsH4KjTx9KVivhk9TVM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445055; c=relaxed/simple; bh=Wwuqz9ZJr5TQFfwVUHEQzVdrwp0bIBroh6UK8Drtlvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UOA0jBnrwyjJyfxwuebvGDoH35/UjPk0gzSPZWIr9gZFl8QyJM4cr8OGYaZa/hiDVya0bcsqMoOOlrg4+YiDBrHPuJLv47brLC8S9C0xwsFGw+fGlg3yyRc0Fx+A7Q/Znabg3Gu/hu+cF3Q3VRKY5CqTkgaM0UxE1AExyhFD/2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=YKAKuv+o; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="YKAKuv+o" Received: by mail.gandi.net (Postfix) with ESMTPSA id 809F3FF811; Tue, 20 Feb 2024 16:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708445051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zCS/sZcLThB2p5pcBcwaJElg/lIAc4UxkvYvhKEBitk=; b=YKAKuv+oFy32r4yzngvTxz9ZzEgGhWjaUcK7o+FIJMrj1YXCyIlyS3m0P+F75guQjxERxx 5GN8UifikXPh6osJXnzA3KPoBnnxAc2c4MvF60T4hJekHW2LnOtArroVxgAzjFICjCMx+t 2tlkYeY7ytuSl/nYtQDRS7cK1w8tFu02pelhyC0L+GEX3iRTtzxuYqJM48QZl9bvOmM477 4zsJIkhwm26GwBCimrxKnHt7bgalvcrRv23xIvZ5R88FRQ/zLXpBnbGH7/i+Fde8K8l1yA Nlav6FoPXJLcDK88R2hSzJ05ByuZFXBy9D8XZdkvCjBoiUgbZZ4VDAuxRVVBjA== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Florian Fainelli , Heiner Kallweit , Jonathan Corbet Subject: [PATCH net-next 2/2] doc: sfp-phylink: mention the mac_capabilities and supported_interfaces Date: Tue, 20 Feb 2024 17:04:04 +0100 Message-ID: <20240220160406.3363002-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240220160406.3363002-1-maxime.chevallier@bootlin.com> References: <20240220160406.3363002-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-Patchwork-Delegate: kuba@kernel.org When porting a driver from bare phylib to phylink, one of the mandatory steps is to fill-in the phylink_config.mac_capabilities and the supported_interfaces. Add a dedicated step in the porting guide, with some examples. Signed-off-by: Maxime Chevallier --- Documentation/networking/sfp-phylink.rst | 45 +++++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/Documentation/networking/sfp-phylink.rst b/Documentation/networking/sfp-phylink.rst index bc3365bbf096..30b1f2cf997f 100644 --- a/Documentation/networking/sfp-phylink.rst +++ b/Documentation/networking/sfp-phylink.rst @@ -231,16 +231,43 @@ this documentation. For further information on these methods, please see the inline documentation in :c:type:`struct phylink_mac_ops `. -9. Remove calls to of_parse_phandle() for the PHY, - of_phy_register_fixed_link() for fixed links etc. from the probe - function, and replace with: +9. Fill-in the :c:type:`struct phylink_config ` fields with + a reference to the :c:type:`struct device ` associated to your + :c:type:`struct net_device `: .. code-block:: c - struct phylink *phylink; priv->phylink_config.dev = &dev.dev; priv->phylink_config.type = PHYLINK_NETDEV; + Fill-in the various speeds, pause and duplex modes your MAC can handle: + + .. code-block:: c + + priv->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; + + Fill-in all the :c:type:`phy_interface_t ` (i.e. all MAC to + PHY link modes) that your MAC can output. The following example shows a + configuration for a MAC that can handle all RGMII modes, SGMII and 1000BaseX. + You must adjust these according to what your MAC is capable of, and not just + the interface you wish to use: + + .. code-block:: c + + phy_interface_set_rgmii(priv->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + priv->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + priv->phylink_config.supported_interfaces); + +10. Remove calls to of_parse_phandle() for the PHY, + of_phy_register_fixed_link() for fixed links etc. from the probe + function, and replace with: + + .. code-block:: c + + struct phylink *phylink; + phylink = phylink_create(&priv->phylink_config, node, phy_mode, &phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); @@ -249,14 +276,14 @@ this documentation. priv->phylink = phylink; - and arrange to destroy the phylink in the probe failure path as - appropriate and the removal path too by calling: + and arrange to destroy the phylink in the probe failure path as + appropriate and the removal path too by calling: - .. code-block:: c + .. code-block:: c phylink_destroy(priv->phylink); -10. Arrange for MAC link state interrupts to be forwarded into +11. Arrange for MAC link state interrupts to be forwarded into phylink, via: .. code-block:: c @@ -266,7 +293,7 @@ this documentation. where ``link_is_up`` is true if the link is currently up or false otherwise. -11. Verify that the driver does not call:: +12. Verify that the driver does not call:: netif_carrier_on() netif_carrier_off()