lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4095b969-ead4-4230-add2-e2b5c0b89a75@gmail.com>
Date: Mon, 3 Nov 2025 21:50:16 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Alexander Duyck <alexander.duyck@...il.com>, netdev@...r.kernel.org
Cc: kuba@...nel.org, kernel-team@...a.com, andrew+netdev@...n.ch,
 linux@...linux.org.uk, pabeni@...hat.com, davem@...emloft.net
Subject: Re: [net-next PATCH v2 05/11] net: phy: Add fbnic specific PHY driver
 fbnic_phy

On 11/3/2025 6:00 PM, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@...com>
> 
> With this change we are effectively adding a stub PHY driver for the fbnic
> driver to enable it to report link state of the PMA/PMD separately from the
> PCS. This is needed as the firmware will be performing link training when
> the link is first detected and this will in turn cause the PCS to link flap
> if we don't add a delay to the PMD link up process to allow for this.
> 
> With this change we are able to identify the device based on the PMA/PMD
> and PCS pair being used. The logic is mostly in place to just handle the
> link detection and report the correct speed for the link.
> 
> This patch is using the gen10g_config_aneg stub to skip doing any
> configuration for now. Eventually this will likely be replaced as we
> actually start adding configuration bits to the driver.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@...com>
> ---
>  MAINTAINERS                 |    1 +
>  drivers/net/phy/Kconfig     |    6 +++++
>  drivers/net/phy/Makefile    |    1 +
>  drivers/net/phy/fbnic_phy.c |   52 +++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 60 insertions(+)
>  create mode 100644 drivers/net/phy/fbnic_phy.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1ab7e8746299..ce18b92f3157 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16712,6 +16712,7 @@ R:	kernel-team@...a.com
>  S:	Maintained
>  F:	Documentation/networking/device_drivers/ethernet/meta/
>  F:	drivers/net/ethernet/meta/
> +F:	drivers/net/phy/fbnic_phy.c
>  
>  METHODE UDPU SUPPORT
>  M:	Robert Marko <robert.marko@...tura.hr>
> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index 98700d069191..16d943bbb883 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -230,6 +230,12 @@ config DAVICOM_PHY
>  	help
>  	  Currently supports dm9161e and dm9131
>  
> +config FBNIC_PHY
> +	tristate "FBNIC PHY"
> +	help
> +	  Supports the Meta Platforms 25G/50G/100G Ethernet PHY included in
> +	  fbnic network driver.
> +
>  config ICPLUS_PHY
>  	tristate "ICPlus PHYs"
>  	help
> diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
> index 76e0db40f879..29b47d9d0425 100644
> --- a/drivers/net/phy/Makefile
> +++ b/drivers/net/phy/Makefile
> @@ -59,6 +59,7 @@ obj-$(CONFIG_DP83869_PHY)	+= dp83869.o
>  obj-$(CONFIG_DP83TC811_PHY)	+= dp83tc811.o
>  obj-$(CONFIG_DP83TD510_PHY)	+= dp83td510.o
>  obj-$(CONFIG_DP83TG720_PHY)	+= dp83tg720.o
> +obj-$(CONFIG_FBNIC_PHY)		+= fbnic_phy.o
>  obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
>  obj-$(CONFIG_ICPLUS_PHY)	+= icplus.o
>  obj-$(CONFIG_INTEL_XWAY_PHY)	+= intel-xway.o
> diff --git a/drivers/net/phy/fbnic_phy.c b/drivers/net/phy/fbnic_phy.c
> new file mode 100644
> index 000000000000..5b9be27aec32
> --- /dev/null
> +++ b/drivers/net/phy/fbnic_phy.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) Meta Platforms, Inc. and affiliates. */
> +
> +#include <linux/ethtool.h>
> +#include <linux/kernel.h>
> +#include <linux/mdio.h>
> +#include <linux/module.h>
> +#include <linux/pcs/pcs-xpcs.h>
> +#include <linux/phylink.h>
> +
> +MODULE_DESCRIPTION("Meta Platforms FBNIC PHY driver");
> +MODULE_LICENSE("GPL");
> +
> +static int fbnic_phy_match_phy_device(struct phy_device *phydev,
> +				      const struct phy_driver *phydrv)
> +{
> +	u32 *device_ids = phydev->c45_ids.device_ids;
> +
> +	return device_ids[MDIO_MMD_PMAPMD] == MP_FBNIC_XPCS_PMA_100G_ID &&
> +	       device_ids[MDIO_MMD_PCS] == DW_XPCS_ID;
> +}
> +
> +static int fbnic_phy_get_features(struct phy_device *phydev)
> +{
> +	phylink_set(phydev->supported, 100000baseCR2_Full);

Better not use phylink functionality in phylib. Use linkmode_set_bit()
instead, internally it uses __set_bit() as well.

> +	phylink_set(phydev->supported, 50000baseCR_Full);
> +	phylink_set(phydev->supported, 50000baseCR2_Full);
> +	phylink_set(phydev->supported, 25000baseCR_Full);
> +
> +	return 0;
> +}
> +
> +static struct phy_driver fbnic_phy_driver[] = {
> +{
> +	.phy_id			= MP_FBNIC_XPCS_PMA_100G_ID,
> +	.phy_id_mask		= 0xffffffff,

You can use helper macro PHY_ID_MATCH_EXACT here.

> +	.name			= "Meta Platforms FBNIC PHY Driver",
> +	.match_phy_device	= fbnic_phy_match_phy_device,
> +	.get_features		= fbnic_phy_get_features,
> +	.read_status		= genphy_c45_read_status,
> +	.config_aneg		= gen10g_config_aneg,
> +},
> +};
> +
> +module_phy_driver(fbnic_phy_driver);
> +
> +static const struct mdio_device_id __maybe_unused fbnic_phy_tbl[] = {
> +	{ MP_FBNIC_XPCS_PMA_100G_ID, 0xffffffff },

Here PHY_ID_MATCH_EXACT can be used too.

> +	{ }
> +};
> +
> +MODULE_DEVICE_TABLE(mdio, fbnic_phy_tbl);
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ