linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: Lei Wei <quic_leiwei@quicinc.com>,
	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: upstream@airoha.com, Kory Maincent <kory.maincent@bootlin.com>,
	Simon Horman <horms@kernel.org>,
	Christian Marangi <ansuelsmth@gmail.com>,
	linux-kernel@vger.kernel.org,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org
Subject: Re: [net-next PATCH v4 03/11] net: pcs: Add subsystem
Date: Thu, 22 May 2025 11:14:53 -0400	[thread overview]
Message-ID: <6d9955ea-29c2-4df1-9618-b10e9185230b@linux.dev> (raw)
In-Reply-To: <a7edb7e8-37ac-45ae-b5c7-2c9034dce4d7@quicinc.com>

On 5/21/25 08:50, Lei Wei wrote:
> 
> 
> On 5/20/2025 1:43 AM, Sean Anderson wrote:
>> On 5/14/25 12:22, Lei Wei wrote:
>>>
>>>
>>> On 5/13/2025 12:10 AM, Sean Anderson wrote:
>>>> +/**
>>>> + * pcs_register_full() - register a new PCS
>>>> + * @dev: The device requesting the PCS
>>>> + * @fwnode: The PCS's firmware node; typically @dev.fwnode
>>>> + * @pcs: The PCS to register
>>>> + *
>>>> + * Registers a new PCS which can be attached to a phylink.
>>>> + *
>>>> + * Return: 0 on success, or -errno on error
>>>> + */
>>>> +int pcs_register_full(struct device *dev, struct fwnode_handle *fwnode,
>>>> +              struct phylink_pcs *pcs)
>>>> +{
>>>> +    struct pcs_wrapper *wrapper;
>>>> +
>>>> +    if (!dev || !pcs->ops)
>>>> +        return -EINVAL;
>>>> +
>>>> +    if (!pcs->ops->pcs_an_restart || !pcs->ops->pcs_config ||
>>>> +        !pcs->ops->pcs_get_state)
>>>> +        return -EINVAL;
>>>> +
>>>> +    wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL);
>>>> +    if (!wrapper)
>>>> +        return -ENOMEM;
>>>
>>> How about the case where pcs is removed and then comes back again? Should we find the original wrapper and attach it to pcs again instead of creating a new wrapper?
>>
>> When the PCS is removed the old wrapper is removed from pcs_wrappers, so
>> it can no longer be looked up any more. I think trying to save/restore
>> the wrapper would be much more trouble than it's worth.
>>
> 
> In the case where Ethernet is not removed but PCS is removed and then
> comes back (when the sysfs unbind followed by bind method is used),
> it will not work because the Ethernet probe will not be initiated again, to call "pcs_get" again to obtain the new wrapper, it would still hold the old wrapper.

Correct. You must then unbind/bind the MAC.

--Sean


  reply	other threads:[~2025-05-22 15:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-12 16:10 [net-next PATCH v4 00/11] Add PCS core support Sean Anderson
2025-05-12 16:10 ` [net-next PATCH v4 03/11] net: pcs: Add subsystem Sean Anderson
2025-05-14 16:22   ` Lei Wei
2025-05-19 17:43     ` Sean Anderson
2025-05-21 12:50       ` Lei Wei
2025-05-22 15:14         ` Sean Anderson [this message]
2025-05-12 17:11 ` [net-next PATCH v4 00/11] Add PCS core support Daniel Golle
2025-05-12 17:15   ` Sean Anderson

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=6d9955ea-29c2-4df1-9618-b10e9185230b@linux.dev \
    --to=sean.anderson@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_leiwei@quicinc.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;
as well as URLs for NNTP newsgroup(s).