public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: "Gupta, Suraj" <Suraj.Gupta2@amd.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"upstream@airoha.com" <upstream@airoha.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Simek, Michal" <michal.simek@amd.com>,
	"Pandey, Radhey Shyam" <radhey.shyam.pandey@amd.com>,
	Robert Hancock <robert.hancock@calian.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [net-next PATCH v2 11/14] net: axienet: Convert to use PCS subsystem
Date: Tue, 8 Apr 2025 11:33:26 -0400	[thread overview]
Message-ID: <b4626fc1-0e4a-4306-9b89-57bb0cea443d@linux.dev> (raw)
In-Reply-To: <BL3PR12MB65713BB652BE4E0E3FAAEF7BC9B52@BL3PR12MB6571.namprd12.prod.outlook.com>

On 4/8/25 08:19, Gupta, Suraj wrote:
> [AMD Official Use Only - AMD Internal Distribution Only]
> 
>> -----Original Message-----
>> From: Sean Anderson <sean.anderson@linux.dev>
>> Sent: Tuesday, April 8, 2025 4:51 AM
>> To: netdev@vger.kernel.org; Andrew Lunn <andrew+netdev@lunn.ch>; David S .
>> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
>> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Russell King
>> <linux@armlinux.org.uk>
>> Cc: Heiner Kallweit <hkallweit1@gmail.com>; upstream@airoha.com; Kory
>> Maincent <kory.maincent@bootlin.com>; Christian Marangi
>> <ansuelsmth@gmail.com>; linux-kernel@vger.kernel.org; Simek, Michal
>> <michal.simek@amd.com>; Pandey, Radhey Shyam
>> <radhey.shyam.pandey@amd.com>; Robert Hancock
>> <robert.hancock@calian.com>; linux-arm-kernel@lists.infradead.org; Sean
>> Anderson <sean.anderson@linux.dev>
>> Subject: [net-next PATCH v2 11/14] net: axienet: Convert to use PCS subsystem
>>
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>>
>>
>> Convert the AXI Ethernet driver to use the PCS subsystem, including the new Xilinx
>> PCA/PMA driver. Unfortunately, we must use a helper to work with bare MDIO
>> nodes without a compatible.
>>
> 
> AXI ethernet changes looks fine to me, except one minor nit mentioned below. Using DT changesets for backward compatibility is impressive :)
> I'll try reviewing pcs/pma patch also and test it with our setups.
>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> 
> Reviewed-by: Suraj Gupta <suraj.gupta2@amd.com>
>> ---
>>
>> (no changes since v1)
>>
>>  drivers/net/ethernet/xilinx/Kconfig           |   1 +
>>  drivers/net/ethernet/xilinx/xilinx_axienet.h  |   4 +-
>>  .../net/ethernet/xilinx/xilinx_axienet_main.c | 104 ++++--------------
>>  drivers/net/pcs/Kconfig                       |   1 -
>>  4 files changed, 22 insertions(+), 88 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig
>> index 7502214cc7d5..2eab64cf1646 100644
>> --- a/drivers/net/ethernet/xilinx/Kconfig
>> +++ b/drivers/net/ethernet/xilinx/Kconfig
>> @@ -27,6 +27,7 @@ config XILINX_AXI_EMAC
>>         tristate "Xilinx 10/100/1000 AXI Ethernet support"
>>         depends on HAS_IOMEM
>>         depends on XILINX_DMA
>> +       select OF_DYNAMIC if PCS_XILINX
>>         select PHYLINK
>>         select DIMLIB
>>         help
>> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h
>> b/drivers/net/ethernet/xilinx/xilinx_axienet.h
>> index 5ff742103beb..f46e862245eb 100644
>> --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
>> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
>> @@ -473,7 +473,6 @@ struct skbuf_dma_descriptor {
>>   * @dev:       Pointer to device structure
>>   * @phylink:   Pointer to phylink instance
>>   * @phylink_config: phylink configuration settings
>> - * @pcs_phy:   Reference to PCS/PMA PHY if used
>>   * @pcs:       phylink pcs structure for PCS PHY
>>   * @switch_x_sgmii: Whether switchable 1000BaseX/SGMII mode is enabled in
>> the core
>>   * @axi_clk:   AXI4-Lite bus clock
>> @@ -553,8 +552,7 @@ struct axienet_local {
>>         struct phylink *phylink;
>>         struct phylink_config phylink_config;
>>
>> -       struct mdio_device *pcs_phy;
>> -       struct phylink_pcs pcs;
>> +       struct phylink_pcs *pcs;
>>
>>         bool switch_x_sgmii;
>>
>> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
>> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
>> index 054abf283ab3..07487c4b2141 100644
>> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
>> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
>> @@ -35,6 +35,8 @@
>>  #include <linux/platform_device.h>
>>  #include <linux/skbuff.h>
>>  #include <linux/math64.h>
>> +#include <linux/pcs.h>
>> +#include <linux/pcs-xilinx.h>
>>  #include <linux/phy.h>
>>  #include <linux/mii.h>
>>  #include <linux/ethtool.h>
>> @@ -2519,63 +2521,6 @@ static const struct ethtool_ops axienet_ethtool_ops = {
>>         .get_rmon_stats = axienet_ethtool_get_rmon_stats,  };
>>
>> -static struct axienet_local *pcs_to_axienet_local(struct phylink_pcs *pcs) -{
>> -       return container_of(pcs, struct axienet_local, pcs);
>> -}
>> -
>> -static void axienet_pcs_get_state(struct phylink_pcs *pcs,
>> -                                 unsigned int neg_mode,
>> -                                 struct phylink_link_state *state)
>> -{
>> -       struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
>> -
>> -       phylink_mii_c22_pcs_get_state(pcs_phy, neg_mode, state);
>> -}
>> -
>> -static void axienet_pcs_an_restart(struct phylink_pcs *pcs) -{
>> -       struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
>> -
>> -       phylink_mii_c22_pcs_an_restart(pcs_phy);
>> -}
>> -
>> -static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
>> -                             phy_interface_t interface,
>> -                             const unsigned long *advertising,
>> -                             bool permit_pause_to_mac)
>> -{
>> -       struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
>> -       struct net_device *ndev = pcs_to_axienet_local(pcs)->ndev;
>> -       struct axienet_local *lp = netdev_priv(ndev);
>> -       int ret;
>> -
>> -       if (lp->switch_x_sgmii) {
>> -               ret = mdiodev_write(pcs_phy, XLNX_MII_STD_SELECT_REG,
>> -                                   interface == PHY_INTERFACE_MODE_SGMII ?
>> -                                       XLNX_MII_STD_SELECT_SGMII : 0);
>> -               if (ret < 0) {
>> -                       netdev_warn(ndev,
>> -                                   "Failed to switch PHY interface: %d\n",
>> -                                   ret);
>> -                       return ret;
>> -               }
>> -       }
>> -
>> -       ret = phylink_mii_c22_pcs_config(pcs_phy, interface, advertising,
>> -                                        neg_mode);
>> -       if (ret < 0)
>> -               netdev_warn(ndev, "Failed to configure PCS: %d\n", ret);
>> -
>> -       return ret;
>> -}
>> -
>> -static const struct phylink_pcs_ops axienet_pcs_ops = {
>> -       .pcs_get_state = axienet_pcs_get_state,
>> -       .pcs_config = axienet_pcs_config,
>> -       .pcs_an_restart = axienet_pcs_an_restart,
>> -};
>> -
>>  static struct phylink_pcs *axienet_mac_select_pcs(struct phylink_config *config,
>>                                                   phy_interface_t interface)  { @@ -2583,8 +2528,8
>> @@ static struct phylink_pcs *axienet_mac_select_pcs(struct phylink_config
>> *config,
>>         struct axienet_local *lp = netdev_priv(ndev);
>>
>>         if (interface == PHY_INTERFACE_MODE_1000BASEX ||
>> -           interface ==  PHY_INTERFACE_MODE_SGMII)
>> -               return &lp->pcs;
>> +           interface == PHY_INTERFACE_MODE_SGMII)
> 
> nit: unchanged check.

Just fixing up the spacing while I was "in the area"

--Sean


  reply	other threads:[~2025-04-08 15:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 23:17 [net-next PATCH v2 00/14] Add PCS core support Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 01/14] dt-bindings: net: Add Xilinx PCS Sean Anderson
2025-04-11 14:46   ` Rob Herring
2025-04-07 23:17 ` [net-next PATCH v2 02/14] device property: Add optional nargs_prop for get_reference_args Sean Anderson
2025-04-09  2:21   ` kernel test robot
2025-04-09  2:32   ` kernel test robot
2025-04-07 23:17 ` [net-next PATCH v2 03/14] device property: Add fwnode_property_get_reference_optional_args Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 04/14] scripts: kernel-doc: fix parsing function-like typedefs (again) Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 05/14] net: phylink: Support setting PCS link change callbacks Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 06/14] net: pcs: Add subsystem Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 07/14] net: dsa: ocelot: suppress PHY device scanning on the internal MDIO bus Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 08/14] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 09/14] net: phy: Export some functions Sean Anderson
2025-04-07 23:17 ` [net-next PATCH v2 10/14] net: pcs: Add Xilinx PCS driver Sean Anderson
2025-04-07 23:20 ` [net-next PATCH v2 11/14] net: axienet: Convert to use PCS subsystem Sean Anderson
2025-04-08 12:19   ` Gupta, Suraj
2025-04-08 15:33     ` Sean Anderson [this message]
2025-04-09  2:32   ` kernel test robot
2025-04-07 23:21 ` [net-next PATCH v2 12/14] net: macb: Move most of mac_config to mac_prepare Sean Anderson
2025-04-07 23:21 ` [net-next PATCH v2 13/14] net: macb: Support external PCSs Sean Anderson
2025-04-07 23:22 ` [net-next PATCH v2 14/14] of: property: Add device link support for PCS Sean Anderson
2025-04-11 14:47   ` Rob Herring (Arm)
2025-04-11 19:44     ` Saravana Kannan
2025-04-08 14:50 ` [net-next PATCH v2 00/14] Add PCS core support Jakub Kicinski
2025-04-08 15:30   ` Sean Anderson
2025-04-08 15:33     ` Jakub Kicinski
2025-04-08 17:27     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4626fc1-0e4a-4306-9b89-57bb0cea443d@linux.dev \
    --to=sean.anderson@linux.dev \
    --cc=Suraj.Gupta2@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michal.simek@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=robert.hancock@calian.com \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox