From: Florian Fainelli <f.fainelli@gmail.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
davem@davemloft.net, Rob Herring <robh+dt@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Richard Cochran <richardcochran@gmail.com>,
Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com,
UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v3 3/4] net: phy: Add helper to derive the number of ports from a phy mode
Date: Fri, 29 Jul 2022 10:19:54 -0700 [thread overview]
Message-ID: <056164ec-3525-479b-3b71-834af48d323c@gmail.com> (raw)
In-Reply-To: <20220729153356.581444-4-maxime.chevallier@bootlin.com>
On 7/29/22 08:33, Maxime Chevallier wrote:
> Some phy modes such as QSGMII multiplex several MAC<->PHY links on one
> single physical interface. QSGMII used to be the only one supported, but
> other modes such as QUSGMII also carry multiple links.
>
> This helper allows getting the number of links that are multiplexed
> on a given interface.
>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> V1->V2 : New patch
> V2->V3 : Made PHY_INTERFACE_MODE_INTERNAL 1 port, and added the MAX
> case.
>
> drivers/net/phy/phy-core.c | 52 ++++++++++++++++++++++++++++++++++++++
> include/linux/phy.h | 2 ++
> 2 files changed, 54 insertions(+)
>
> diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
> index 1f2531a1a876..f8ec12d3d6ae 100644
> --- a/drivers/net/phy/phy-core.c
> +++ b/drivers/net/phy/phy-core.c
> @@ -74,6 +74,58 @@ const char *phy_duplex_to_str(unsigned int duplex)
> }
> EXPORT_SYMBOL_GPL(phy_duplex_to_str);
>
> +/**
> + * phy_interface_num_ports - Return the number of links that can be carried by
> + * a given MAC-PHY physical link. Returns 0 if this is
> + * unknown, the number of links else.
> + *
> + * @interface: The interface mode we want to get the number of ports
> + */
> +int phy_interface_num_ports(phy_interface_t interface)
> +{
> + switch (interface) {
> + case PHY_INTERFACE_MODE_NA:
> + return 0;
> + case PHY_INTERFACE_MODE_INTERNAL:
Maybe this was covered in the previous iteration, but cannot the default case return 1, and all of the cases that need an explicit non-1 return value are handled? Enumeration all of those that do need to return 1 does not really scale.
--
Florian
next prev parent reply other threads:[~2022-07-29 17:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 15:33 [PATCH net-next v3 0/4] net: Introduce QUSGMII " Maxime Chevallier
2022-07-29 15:33 ` [PATCH net-next v3 1/4] net: phy: Introduce QUSGMII PHY mode Maxime Chevallier
2022-07-30 3:55 ` Andrew Lunn
2022-07-29 15:33 ` [PATCH net-next v3 2/4] dt-bindings: net: ethernet-controller: add QUSGMII mode Maxime Chevallier
2022-07-30 3:55 ` Andrew Lunn
2022-07-29 15:33 ` [PATCH net-next v3 3/4] net: phy: Add helper to derive the number of ports from a phy mode Maxime Chevallier
2022-07-29 17:19 ` Florian Fainelli [this message]
2022-07-30 3:54 ` Andrew Lunn
2022-07-29 15:33 ` [PATCH net-next v3 4/4] net: lan966x: Add QUSGMII support for lan966x Maxime Chevallier
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=056164ec-3525-479b-3b71-834af48d323c@gmail.com \
--to=f.fainelli@gmail.com \
--cc=Allan.Nielsen@microchip.com \
--cc=Horatiu.Vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=hkallweit1@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.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
all inboxes | Powered by JetHome®