From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFD7B4F7976 for ; Fri, 15 May 2026 17:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778865171; cv=none; b=YvTBoiKiDKklvCS3gAvOpCmmI1Zq8fbMJk0k0WsmW+a0Vuv8ZjTs6KmCmMn8kPmmVyZjej5/m2WM0DDcaWriubk98LpwWnLPfGk7Qkv4R9B+RsYbd+C0i2a/RvNfGod2rMzNdPgRqVSwKbvAU7hWjqqPAw9Ws5w/Dghxhc+7+6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778865171; c=relaxed/simple; bh=0A+nM/+sysN2KGQXhhO4JcJYWEOq2c2OfNIxDSDBn70=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=M0sOYUJBqRqIM5HCtXp/OXfN7zzmlEWPx1Pqys9Qu+CnRYX94kq8O4ML8CzHc+02pUeE4DWjUJZrzHlTD46cU3pr/QraaXtShAnTRwBgd3w1EKp5Ogm3i1bkI2kbKUByf0QML9HxMWh10xeK9CUnxqD/pV6jjF0R0GFYMmKmO6I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nbC2z9VN; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nbC2z9VN" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-83537a80ab6so46163b3a.1 for ; Fri, 15 May 2026 10:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778865169; x=1779469969; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=j2H8+FgdgJN+H8gAB0oUD1LeAPsq2ZPySE5IJb34ngg=; b=nbC2z9VNJIseawfjAdnp/plrA0Dhm8GDib7Fvc427Rztntyzd4A8OL6JX8/RA81Wa1 frULWNkH5j4Brv2vfWxtqvzWjnlYiUD2ngvDbSgVynZuUwUqQwsNmbKsPZX3i44aJ0Lu agHCJ4kcOu7DVK7Qj5Wda1Ju1JxQeIEAuZc8zYoFszdLSbI7xaAorILvYT40+vDT5Bqe TqYIPqwjgYOJ1IU81dV22OyE1GtQvqvP7fl/kZkQ1jGsZ/Ddu2jB1d+7EwiK+v8Tl/9K vL4oCXgr3nxRoz6si5G84OPH2hLFQZxXL+j09jFw5Gviz3dRRdgnd/eOEUGSIB2wD8X+ VQZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778865169; x=1779469969; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j2H8+FgdgJN+H8gAB0oUD1LeAPsq2ZPySE5IJb34ngg=; b=fCWKGbIY+4VztCLJRrQcR6rfvyMS6KeOUuq9czXc+4QFwSiJE6M+gKMv9sJy8OQhUg s9v+V157GYviorKq+H+Lmq7c7CuflS3cj6XpmlPfTkluHaknh5Y7hQISI1LIoWTw+yy3 t+qulZcldr0L8zw9iGHNatio8X0Jm5hT0kAs5lxD+mWF5/tkM6dRxL5JOvwTW+j5Qkfe DXmfGb4w//GBSPTkyBVzkjpxBaPQdlad2TFAYwd0BQ4CiiYGnujahZMqVOKUEWBuIPi7 ukndCLUjaMirTJ8kT5iA4XYitpc0ip/dt1rdRgx3LIe1+cQGmk1v8fk3QtThxexIGBoU PizA== X-Forwarded-Encrypted: i=1; AFNElJ8zZAUtTtFXceInF+v9+qygGMSHa7t0hjSUUfSDYIS/not0ohdE+1xfk2CWxCKnPZgYK8z9CtXaJYsZI5M=@vger.kernel.org X-Gm-Message-State: AOJu0YxRZ6VeFJUo7tdDxMbEeZVSsJnPAq/Qzm9T0u58Pth3MDS4kuVl GRMtc7cM5Dw1lIAQgp3guoGUzlG4ApAjW+X09sFpgPmXEmY/pXLrM18qSLJrdQ== X-Gm-Gg: Acq92OHIhOJMGbOgOnyslL0JI+C8wGpdT9Z8W9d1pk9q9ISjgD76+j7UezNFTIc5tSf p8XuVyPmf0rnThptMoRNWVafMyE0LRoDlGMO4jtVMZbXUpZKVq7R2y7gVfiEejLquepoC3RQRnU atIjFlcuczdQFrXGKRcTmy9va1r4D7+mbb+6PvxPgbpIo5JzYkLK3Pyw5ERUUA8++RuhjiZoXY6 syifiOwXlPpBRWi24kNIP5O3EGcDd7/rn1Pdts+OoRXUdXdPcaPwTJvHXyPgfv2RLuLxQHcbgS7 oC5AcSPixCo3zd8JjBTA4JrbjSrjA9DxS0Xm1lUnb8e66p/I4teWnOom1UVaCgywF1A1J6SMENX MTP6ssdhM5K+xH9ES8Z8jxfYA7WjfbZCVTans/WgozWd2K8jiGBQwyCuRvQ+yj/PuBHP0X2pRMs rVRzY35WkkVtjKI1Ry799vPtWY8KaCrq3TZKhU3wC7FAg6LCNGB911IOdb7SUsjXRtug01a1qAU +/2DG2+/8CaWiKLePsQG42VeO7w8rshNT+j1mSL8CifyVWYor+UV6H7hmBIBfktvxPy X-Received: by 2002:a05:6a00:448a:b0:838:1c02:276c with SMTP id d2e1a72fcca58-83f33dee8b8mr5572533b3a.40.1778865168762; Fri, 15 May 2026 10:12:48 -0700 (PDT) Received: from ?IPv6:2605:59c8:829:4c00:82ee:73ff:fe41:9a02? ([2605:59c8:829:4c00:82ee:73ff:fe41:9a02]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-83f19c5c39esm7730851b3a.36.2026.05.15.10.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 10:12:48 -0700 (PDT) Message-ID: Subject: Re: [PATCH net-next v2 2/2] net: pcs: xpcs: Add handling for 4 channel rsfec device From: Alexander H Duyck To: mike.marciniszyn@gmail.com, Alexander Duyck , Jakub Kicinski , kernel-team@meta.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Paolo Abeni , Heiner Kallweit , Russell King , Kees Cook , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 15 May 2026 10:12:46 -0700 In-Reply-To: <20260511182604.1338-3-mike.marciniszyn@gmail.com> References: <20260511182604.1338-1-mike.marciniszyn@gmail.com> <20260511182604.1338-3-mike.marciniszyn@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Mon, 2026-05-11 at 14:26 -0400, mike.marciniszyn@gmail.com wrote: > From: "Mike Marciniszyn (Meta)" >=20 > This patch introduces the configuration of vendor specific > registers for alignment encoding, PCS Mode, and VL_INTVL > over the one or two instances as required. >=20 > The DW_PCS IP specification calls out the need to configure both > lanes identically when using 2 lane modes such as 50-R2 and 100-R2, so > the programming is repeated for each lane. >=20 > The encoding tables are derived from the IEEE 8023-2022 spec sections > 82.2.7 and tables 82-2 and 82-3 for the alignment markers and their > insertion. >=20 > Note that there is a conflict between VRs DW_VR_XS_PCS_DIG_STS and > and the DW_PCS_IP DW_VR_MII_PCS_PCS_MODE. The bit mask for > DW_VR_XS_PCS_DIG_STS/RX_FIFO_ERR fits within the reserved bits for > the DW_PCS IP the DW_VR_MII_PCS_PCS_MODE register so there is no issue. >=20 > There is also a confict between DW_VR_MII_PCS_VL_INTVL and > DW_VR_MII_AN_INTR_STS but an_mode differs, so again there is no issue. >=20 > Reviewed-by: Alexander Duyck > Signed-off-by: Mike Marciniszyn (Meta) > --- > v2: > - Replace xpcs_write_pcs_prtad() wiht xpcs_write_pcs_mdev() to > avoid hardcoded prtaddr value > v1: https://lore.kernel.org/all/20260506190904.4029-3-mike.marciniszyn@gm= ail.com/ >=20 > drivers/net/pcs/pcs-xpcs.c | 91 +++++++++++++++++++++++++++++++++++++- > drivers/net/pcs/pcs-xpcs.h | 25 +++++++++++ > 2 files changed, 115 insertions(+), 1 deletion(-) >=20 >=20 [...] > @@ -1464,6 +1521,23 @@ xpcs_config_rsfec_pma(struct dw_xpcs *xpcs, const = struct pma_pcs_values *v) > =20 > for (i =3D 0; mdev && ret >=3D 0 && i < v->lanes; > i++, mdev =3D xpcs_find_next_mdev(xpcs, mdev)) { The use of the "find_next_mdev" essentially taints this patch with the same issues from the first. We know the offsets. We shouldn't be blindly reaching around for devices and writing to them. If we need to we should be creating the devices for the second lane of the PCS ourselves and using that instead of letting the phy_device code autoprobe in a device based on the PMD. Specifically we should just be writing to our bus ID and bus ID + 1 in the case of the 50GR2 and 100G configurations as we have to configure the 2 lanes. We shouldn't risk this thing going off the rails and grabbing some random bus ID if it were loaded on another device. If we need to we could make it so that the Meta device ID on the PCS is what triggers it setting. My advice would be to look at creating a new version of xpcs_create_pcs_mdiodev, maybe "xpcs_create_pcs_mdiodevs", that you can pass a lanes value to and perhaps look at making addr an array of addresses. Then you could have that spawn the additional lanes via mdio_device_create, record them in the dw_xpcs struct, and avoid having to do as much blind searching to find the devices that you are currently doing.