From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 A863B29292E for ; Thu, 22 May 2025 15:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747926915; cv=none; b=O1S3pqI4eqVO4jiNxy8yUtIbL3ZBzqHHMxiuiBd8rA+bpR00xrzbNii4m87ss+8SXYbonswNpZUiqdkuyD+PQaTKRyl7NAMStGTGCB6uLfAVSTs7wgR6JtaoV0hoS6EUxnle1FLRiSO5/8elH06dlONFMFBZ8XN2bhDO8ZEs52o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747926915; c=relaxed/simple; bh=khJ1ubnsgvo0EosL9A0wrR2WR+Qc+Yx33YoDRTYZ1JU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UqiYdupkJ7L2mJBuYbNrNIAnzSTb+oxs+Hd4tD3VPFjbSDvwBHWx6FJg3wmLD+VSUtXsEu77g6SC4QCGm+PT75RxEQ93qfK3MNAYUwjFp7p3PctsxaPsF1FaO7diXoVwzxlHY0ag8URXqx+3oQdBsUHAhrx2Wl7rTxSjqg8EvB8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=S8unWojt; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="S8unWojt" Message-ID: <6d9955ea-29c2-4df1-9618-b10e9185230b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1747926900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gfohxjPLWw+GeQ2Ofcf4RstTAbZNyvuhU8/jKxg1jEM=; b=S8unWojtKLgbJlR84BmKzFDvYTvvVe5pRqzPppRCgHJqXBtSaM1iQskTqv+bay9zU8M9T+ 1YR2eNOht6A6eNbQWY3IM7a3hq5absbugNXPuRGC2Gf1Z3oePO16jYQ8xrGay+hr5zh+pW YctQH0QY6jy5iRfq/i+KWtNgEalC/8Q= Date: Thu, 22 May 2025 11:14:53 -0400 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [net-next PATCH v4 03/11] net: pcs: Add subsystem To: Lei Wei , netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: upstream@airoha.com, Kory Maincent , Simon Horman , Christian Marangi , linux-kernel@vger.kernel.org, Heiner Kallweit , Jonathan Corbet , linux-doc@vger.kernel.org References: <20250512161013.731955-1-sean.anderson@linux.dev> <20250512161013.731955-4-sean.anderson@linux.dev> <4556e55b-2360-4780-a282-b2f04f5cc994@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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