From nobody Tue Sep 29 02:37:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C227620D4F0; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; cv=none; b=Vozlus2oTQX07VsTW2C6/TvlV8Z+aL23FQs1jqtcRrT3drzLieW9M6FTRVMUgWwiRyw6MuGHah69l+EXsjoP0YrhMaYntmWSQOhNUdxulr879IlLfYVimUa4nI49YT446ocYNXrEMRFCmJFkvRgxLBckfeOToseL6vztitqTbTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; c=relaxed/simple; bh=1LWOZA1JpmHoOap37jDVPpyz+UtWj4yhLw3/2VwgAtQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EftIFMYBw5/jcn8oTSA9kHf1wY5ByITmtlCJjuhWOd91WQ1r09zrF1feEPKG7wbTU9XLvpj1dID01luxkZaewBpm9UkKy3QzziTFdqAXx64b7UsKzlkwgh1+1kB8embDwSqdkiu3MB03y3hP+FJBfC8B6W3AN4cBvdKNGq0bomI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oCnZpWP2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oCnZpWP2" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6E0CCC2BCF6; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786590026; bh=1LWOZA1JpmHoOap37jDVPpyz+UtWj4yhLw3/2VwgAtQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=oCnZpWP2J+55tDkpZL8gIQhAYnCkVG7hVADKqpySv453bhwxRf9w5i71IfFJy+dWO iIrgLg/RdhZ1ted5wPgapxp4sieBufpl3JLVD1Bu6B/LfAqbPct+DnNLQ05VlzMeA2 9lfLZOEnY/gQ9Y2gWYZi7/f8TzXqQJ7Jd3YQSkSjwKeLtBI1Bll/tV6T9xQPbswyVI thkdA1xHfcwEH5DG4h8XI73jEu//elG2lmfa9lQOSYGCU3Ritl+voVoGXl67bCuyia z1Z40TU2a94LkZBRpP8gGaHmcjbWD1ximnomqvAVYDMppcagGoZvr1a7jLrycAr4dq rrowZT6QNGDYg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CFD1C5CFCF; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) From: Selvamani Rajagopal via B4 Relay Date: Wed, 12 Aug 2026 20:00:09 -0700 Subject: [PATCH net v6 1/4] net: ethernet: oa_tc6: Protect skb pointer used by two different kernel instances Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-fix-race-condition-and-crash-v6-1-6cf90f4a271a@onsemi.com> References: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> In-Reply-To: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> To: Parthiban Veerasooran , Andrew Lunn , Piergiorgio Beruto , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Parthiban Veerasooran , Selvamani Rajagopal X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786590011; l=7043; i=Selvamani.Rajagopal@onsemi.com; s=20260531; h=from:subject:message-id; bh=rW7yFemdHnqXiztjqrxe7xKeq7fyewhO33EUFetWIc8=; b=ASfcuP938L1XcmqVulLvRHTcMItj1ijp1FkHYvqAs98YiHvIJ8Xs3Hb8mQ7/+HKNOzDDEcWbH 5soEo/CyTDFCby+ZaqauySKhMbTzbnogIrcQXpaaysRTgexwroIv1XO X-Developer-Key: i=Selvamani.Rajagopal@onsemi.com; a=ed25519; pk=5QRdM0HS/LGWWcUZZ9hVfZ+qbPQGZCumcTXOiN7Fyug= X-Endpoint-Received: by B4 Relay for Selvamani.Rajagopal@onsemi.com/20260531 with auth_id=803 X-Original-From: Selvamani Rajagopal Reply-To: Selvamani.Rajagopal@onsemi.com From: Selvamani Rajagopal Threaded IRQ uses waiting_tx_skb. Transmit path also uses this pointer without any mutual exclusion protection. As a result, it might leak skb buffer, particularly if threaded IRQ sets disable_traffic true after start_xmit already checked and found that disable_traffic being false, if they happen to run on different cores. On fatal error, where disable_traffic is set, transmit function drops the packet and return NETDEV_TX_OK. Due to this change, skb_linearize call is moved up to the beginning of the transmit function. Since skb buffer may be freed from different contexts, dev_kfree_skb_any is used to free skb buffer now, replacing one of the kfree_skb call. oa_tc6_exit disables the irq before setting disable_traffic true. Fixes: b542d13fab0f ("net: ethernet: oa_tc6: Interrupt is active low, level= triggered.") Signed-off-by: Selvamani Rajagopal --- changes in v6 - Updated the comment section for start_xmit function. - disable_irq is called first before setting disable_traffic flag changes in v5 - Fixed the typo in commit message changes in v4 - No change changes in v3 - Added the missed out spin lock protection for waiting_tx_skb and disable_traffic flag changes in v2 - added the missing prefix to the title --- drivers/net/ethernet/oa_tc6.c | 109 +++++++++++++++++++++++++++++---------= ---- 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 0727d53345a3..62bcc2b01d83 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -652,6 +652,26 @@ static int oa_tc6_enable_data_transfer(struct oa_tc6 *= tc6) return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, value); } =20 +/* Called when a frame that is meant to be transmitted, is dropped. */ +static void oa_tc6_drop_tx_skb(struct oa_tc6 *tc6, struct sk_buff *skb) +{ + if (skb) { + tc6->netdev->stats.tx_dropped++; + dev_kfree_skb_any(skb); + } +} + +static struct sk_buff *oa_tc6_detach_waiting_tx_skb(struct oa_tc6 *tc6) +{ + struct sk_buff *skb; + + lockdep_assert_held(&tc6->tx_skb_lock); + skb =3D tc6->waiting_tx_skb; + tc6->waiting_tx_skb =3D NULL; + + return skb; +} + static void oa_tc6_cleanup_ongoing_rx_skb(struct oa_tc6 *tc6) { if (tc6->rx_skb) { @@ -663,26 +683,30 @@ static void oa_tc6_cleanup_ongoing_rx_skb(struct oa_t= c6 *tc6) =20 static void oa_tc6_cleanup_ongoing_tx_skb(struct oa_tc6 *tc6) { - if (tc6->ongoing_tx_skb) { - tc6->netdev->stats.tx_dropped++; - kfree_skb(tc6->ongoing_tx_skb); - tc6->ongoing_tx_skb =3D NULL; - } + oa_tc6_drop_tx_skb(tc6, tc6->ongoing_tx_skb); + tc6->ongoing_tx_skb =3D NULL; } =20 static void oa_tc6_cleanup_waiting_tx_skb(struct oa_tc6 *tc6) { - if (tc6->waiting_tx_skb) { - tc6->netdev->stats.tx_dropped++; - kfree_skb(tc6->waiting_tx_skb); - tc6->waiting_tx_skb =3D NULL; - } + struct sk_buff *skb; + + spin_lock_bh(&tc6->tx_skb_lock); + skb =3D oa_tc6_detach_waiting_tx_skb(tc6); + spin_unlock_bh(&tc6->tx_skb_lock); + + oa_tc6_drop_tx_skb(tc6, skb); } =20 -static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6) +static void oa_tc6_free_ongoing_skbs(struct oa_tc6 *tc6) { oa_tc6_cleanup_ongoing_tx_skb(tc6); oa_tc6_cleanup_ongoing_rx_skb(tc6); +} + +static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc6) +{ + oa_tc6_free_ongoing_skbs(tc6); oa_tc6_cleanup_waiting_tx_skb(tc6); } =20 @@ -693,9 +717,15 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc= 6) static void oa_tc6_disable_traffic(struct oa_tc6 *tc6) { u32 regval =3D INT_MASK0_ALL_INTERRUPTS; + struct sk_buff *skb; =20 + spin_lock_bh(&tc6->tx_skb_lock); tc6->disable_traffic =3D true; - oa_tc6_free_pending_skbs(tc6); + skb =3D oa_tc6_detach_waiting_tx_skb(tc6); + spin_unlock_bh(&tc6->tx_skb_lock); + + oa_tc6_drop_tx_skb(tc6, skb); + oa_tc6_free_ongoing_skbs(tc6); oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval); oa_tc6_read_register(tc6, OA_TC6_REG_STATUS0, ®val); oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, regval); @@ -1136,8 +1166,7 @@ static int oa_tc6_try_spi_transfer(struct oa_tc6 *tc6) if (ret =3D=3D -EAGAIN) continue; =20 - oa_tc6_cleanup_ongoing_tx_skb(tc6); - oa_tc6_cleanup_ongoing_rx_skb(tc6); + oa_tc6_free_ongoing_skbs(tc6); netdev_err(tc6->netdev, "Device error: %d\n", ret); return ret; } @@ -1159,15 +1188,20 @@ static irqreturn_t oa_tc6_macphy_threaded_irq(int i= rq, void *data) * no need to attempt spi transfer, once it fails. Pending skbs * are already freed. */ - if (!tc6->disable_traffic) { - while (tc6->int_flag || - (tc6->waiting_tx_skb && tc6->tx_credits)) { - ret =3D oa_tc6_try_spi_transfer(tc6); - if (ret) { - disable_irq_nosync(tc6->spi->irq); - oa_tc6_disable_traffic(tc6); - break; - } + spin_lock_bh(&tc6->tx_skb_lock); + if (tc6->disable_traffic) { + spin_unlock_bh(&tc6->tx_skb_lock); + return IRQ_HANDLED; + } + spin_unlock_bh(&tc6->tx_skb_lock); + + while (tc6->int_flag || + (tc6->waiting_tx_skb && tc6->tx_credits)) { + ret =3D oa_tc6_try_spi_transfer(tc6); + if (ret) { + disable_irq_nosync(tc6->spi->irq); + oa_tc6_disable_traffic(tc6); + break; } } =20 @@ -1245,23 +1279,30 @@ EXPORT_SYMBOL_GPL(oa_tc6_zero_align_receive_frame_e= nable); * @tc6: oa_tc6 struct. * @skb: socket buffer in which the ethernet frame is stored. * - * Return: NETDEV_TX_OK if the transmit ethernet frame skb added in the tx= _skb_q - * otherwise returns NETDEV_TX_BUSY. + * Return: NETDEV_TX_OK either on successful queueing of the packet for + * transmission, or on packet getting dropped. Packet can be dropped due to + * failure in linearizing the buffer or disable_traffic is set due to + * earlier fatal error. Returns NETDEV_TX_BUSY when there is no room + * to queue the packet. */ netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb) { - if (tc6->disable_traffic || tc6->waiting_tx_skb) { - netif_stop_queue(tc6->netdev); - return NETDEV_TX_BUSY; - } - if (skb_linearize(skb)) { - dev_kfree_skb_any(skb); - tc6->netdev->stats.tx_dropped++; + oa_tc6_drop_tx_skb(tc6, skb); return NETDEV_TX_OK; } =20 spin_lock_bh(&tc6->tx_skb_lock); + if (tc6->waiting_tx_skb) { + netif_stop_queue(tc6->netdev); + spin_unlock_bh(&tc6->tx_skb_lock); + return NETDEV_TX_BUSY; + } + if (tc6->disable_traffic) { + spin_unlock_bh(&tc6->tx_skb_lock); + oa_tc6_drop_tx_skb(tc6, skb); + return NETDEV_TX_OK; + } tc6->waiting_tx_skb =3D skb; spin_unlock_bh(&tc6->tx_skb_lock); =20 @@ -1393,8 +1434,10 @@ EXPORT_SYMBOL_GPL(oa_tc6_init); */ void oa_tc6_exit(struct oa_tc6 *tc6) { - tc6->disable_traffic =3D true; disable_irq(tc6->spi->irq); + spin_lock_bh(&tc6->tx_skb_lock); + tc6->disable_traffic =3D true; + spin_unlock_bh(&tc6->tx_skb_lock); oa_tc6_phy_exit(tc6); oa_tc6_free_pending_skbs(tc6); } --=20 2.43.0 From nobody Tue Sep 29 02:37:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C23672C3266; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; cv=none; b=kIejit2tB/Q0xZ1Ea2EH+Iv7fNjNMC+n6JxAJPwnPNfG/v2NcaySmp5XFSQmGg2aHX7i8hX2RSVofisgsBQjnO+Xo86E9+3c6A0CpodZkTouPdfkNbSv8Fr1AAxMsbCt12Xcz0prUEB3CM7Eyl645k9uCuvS0ve6iNE1BmB713o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; c=relaxed/simple; bh=k1V4qntYwYCFT4m/BhsU1EIoAO6tyNNX83Gv9ZfWtVc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iQIcETw5nKTITze/3plOYibb1ac6U8jxz2XIBRvtNBQiO+p2oOJux90Xf5zsgofPOD1tkrt5wsaqJ8eTdmA08q0K7iPFnxzujXuIi79ep0boOGgePsVJPmxpJhdxKcljJsVLCYJh/cRpcIWomBp5CAMI2aiN8P2m2IPvygdY3MU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o67NVD1Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o67NVD1Z" Received: by smtp.kernel.org (Postfix) with ESMTPS id 7A7DCC2BCB9; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786590026; bh=k1V4qntYwYCFT4m/BhsU1EIoAO6tyNNX83Gv9ZfWtVc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=o67NVD1ZDSYj7L2kQ+6IAesHgpOgcU8xX322kMPSDgfv+2KHMDSytjQc741WI9ZMN WcLivT+wrulDJZzx/5l7bS6j9WisXTUkpkmj+sY7UHMsjhCE8EttCMqVvty3TPDbz4 LgNyHbF6iQGTgg6Cu8bsIkC57iAyzATDAQwmzlEZ+XAGaE9vlK5gEh1WDlUO7Qa7yK t+CLuVjj/5hYDBqv2rwaugEpKAs6KtJKD5xxIp8RF1cTRkp62K8FIc3F4i8st3MQtZ mYmSVMyHlng6sV4ahHRmhcXlp2UD22rgrDsyY8/r3c0G6O/K3T1m21XnzcylIa3Zdk hBL5lO8xLlyaA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B0D1C5AD5A; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) From: Selvamani Rajagopal via B4 Relay Date: Wed, 12 Aug 2026 20:00:10 -0700 Subject: [PATCH net v6 2/4] net: ethernet: oa_tc6: Improve the error recovery Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-fix-race-condition-and-crash-v6-2-6cf90f4a271a@onsemi.com> References: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> In-Reply-To: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> To: Parthiban Veerasooran , Andrew Lunn , Piergiorgio Beruto , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Parthiban Veerasooran , Selvamani Rajagopal X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786590011; l=11936; i=Selvamani.Rajagopal@onsemi.com; s=20260531; h=from:subject:message-id; bh=QEysevfLelHvrJyLXVZb1h+BZga28t/LbaqFUZsJH60=; b=WDjdB+KGvYEr2IawPhMwREXYI5NIu03blXPLNqQ9rG4gcCGI+nbdYRckYWekiVkyBLDWZ7RF2 UZ6AgA49sq+CtQV+WISUsnTUL/fJBZJ3sNBYJB+YR0I5ogpMzyec91G X-Developer-Key: i=Selvamani.Rajagopal@onsemi.com; a=ed25519; pk=5QRdM0HS/LGWWcUZZ9hVfZ+qbPQGZCumcTXOiN7Fyug= X-Endpoint-Received: by B4 Relay for Selvamani.Rajagopal@onsemi.com/20260531 with auth_id=803 X-Original-From: Selvamani Rajagopal Reply-To: Selvamani.Rajagopal@onsemi.com From: Selvamani Rajagopal When oversubscribed traffic causes lot of buffer overflow errors, probably due to loss of data chunks, driver fails to find a data chunk with end_valid bit set, before it runs out of sk buffer space. As a result, assert is seen during skb_put. Now, check is made if skb buffer has enough tailroom for the incoming data before accepting. If there is no room, current frame is abandoned and it will start looking for a data chunk with start_valid bit, that is a new frame. SK buffer allocation error is considered as recoverable error. rx_buf_overflow flag is too specific and no longer the only condition this flag is used for. Therefore it is renamed as wait_until_start_valid. This is more appropriate as this flag is used to look for the next data chunk with SV bit set, after failures like buffer overflow, buffer allocation failure, skb pointer validity besides buffer overflow error. Not writing to status0 if it reads 0. Fixes: d70a0d8f2f2d ("net: ethernet: oa_tc6: implement receive path to rece= ive rx ethernet frames") Signed-off-by: Selvamani Rajagopal --- changes in v6 - Changed the rx_buf_overflow flag to more appropriate name - Using skb_tailroom instead of skb fields directly - Avoid reading status0, where it is not needed changes in v5 - Changed the summary to match the convention - Added more clarity to why the return code is not checked for the call to oa_tc6_prcs_rx_frame_end changes in v4 - rx_buf_overflow flag cleared, when end of frame and start of frame are handled in the same data chunk. - Added more comments to answer some of the AI review questions. changes in v3 - Continue processing more chunks on error code -EAGAIN. Previously we were bailing out. changes in v2 - Check rx_skb pointer before new allocation and NULL before use. --- drivers/net/ethernet/oa_tc6.c | 143 +++++++++++++++++++++++++++++++-------= ---- 1 file changed, 108 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 62bcc2b01d83..09bc293fb75b 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -127,7 +127,7 @@ struct oa_tc6 { u16 spi_data_tx_buf_offset; u16 tx_credits; u8 rx_chunks_available; - bool rx_buf_overflow; + bool wait_until_start_valid; bool int_flag; bool disable_traffic; }; @@ -710,6 +710,12 @@ static void oa_tc6_free_pending_skbs(struct oa_tc6 *tc= 6) oa_tc6_cleanup_waiting_tx_skb(tc6); } =20 +static void oa_tc6_look_for_new_frame(struct oa_tc6 *tc6) +{ + tc6->wait_until_start_valid =3D true; + oa_tc6_cleanup_ongoing_rx_skb(tc6); +} + /* If the failure is at SPI interface level, masking and clearing * the interrupt of the device won't work. Since SPI interrupt is * disabled, it should stop the repeated interrupts. @@ -744,6 +750,13 @@ static int oa_tc6_process_extended_status(struct oa_tc= 6 *tc6) return ret; } =20 + /* This function is called for each chunk received in a given SPI + * transaction. In case, extended status bit is set in more than + * one chunk, skip the write, if status0 is already cleared. + */ + if (!value) + return 0; + /* Clear the error interrupts status */ ret =3D oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, value); if (ret) { @@ -753,8 +766,7 @@ static int oa_tc6_process_extended_status(struct oa_tc6= *tc6) } =20 if (FIELD_GET(STATUS0_RX_BUFFER_OVERFLOW_ERROR, value)) { - tc6->rx_buf_overflow =3D true; - oa_tc6_cleanup_ongoing_rx_skb(tc6); + oa_tc6_look_for_new_frame(tc6); net_err_ratelimited("%s: Receive buffer overflow error\n", tc6->netdev->name); return -EAGAIN; @@ -780,6 +792,8 @@ static int oa_tc6_process_extended_status(struct oa_tc6= *tc6) =20 static int oa_tc6_process_rx_chunk_footer(struct oa_tc6 *tc6, u32 footer) { + int ret =3D 0; + /* Process rx chunk footer for the following, * 1. tx credits * 2. errors if any from MAC-PHY @@ -790,9 +804,11 @@ static int oa_tc6_process_rx_chunk_footer(struct oa_tc= 6 *tc6, u32 footer) footer); =20 if (FIELD_GET(OA_TC6_DATA_FOOTER_EXTENDED_STS, footer)) { - int ret =3D oa_tc6_process_extended_status(tc6); - - if (ret) + ret =3D oa_tc6_process_extended_status(tc6); + /* EAGAIN error is recoverable. Move on to check + * HEADER and SYNC errors before returning. + */ + if (ret && ret !=3D -EAGAIN) return ret; } =20 @@ -810,7 +826,7 @@ static int oa_tc6_process_rx_chunk_footer(struct oa_tc6= *tc6, u32 footer) return -ENODEV; } =20 - return 0; + return ret; } =20 static void oa_tc6_submit_rx_skb(struct oa_tc6 *tc6) @@ -835,13 +851,35 @@ static void oa_tc6_submit_rx_skb(struct oa_tc6 *tc6) tc6->rx_skb =3D NULL; } =20 -static void oa_tc6_update_rx_skb(struct oa_tc6 *tc6, u8 *payload, u8 lengt= h) +/* On oversubscribed traffic condition, particularly with overwhelming rx + * buffer overflow errors, there could be data chunk loss. If tail + length + * goes beyond end pointer, that is an indication that the data chunk with + * end_valid bit is lost. Time to look for a data chunk with start_valid b= it. + * + * If rx_skb is NULL, it is time to start looking for data chunk with + * start_bit. + */ +static int oa_tc6_update_rx_skb(struct oa_tc6 *tc6, u8 *payload, u8 length) { + if (!tc6->rx_skb || + skb_tailroom(tc6->rx_skb) < length) { + oa_tc6_look_for_new_frame(tc6); + return -EAGAIN; + } + memcpy(skb_put(tc6->rx_skb, length), payload, length); + return 0; } =20 +/* On overwhelming rx buffer overflow errors, due to data chunk loss, it is + * possible that we get two data chunks with start_valid bit set, without + * end_valid bit set in between. In this case, rx_skb would have a valid + * buffer pointer. We should release, if a valid pointer is found before + * allocating a new one. + */ static int oa_tc6_allocate_rx_skb(struct oa_tc6 *tc6) { + oa_tc6_cleanup_ongoing_rx_skb(tc6); tc6->rx_skb =3D netdev_alloc_skb_ip_align(tc6->netdev, tc6->netdev->mtu + ETH_HLEN + ETH_FCS_LEN); if (!tc6->rx_skb) { @@ -861,7 +899,9 @@ static int oa_tc6_prcs_complete_rx_frame(struct oa_tc6 = *tc6, u8 *payload, if (ret) return ret; =20 - oa_tc6_update_rx_skb(tc6, payload, size); + ret =3D oa_tc6_update_rx_skb(tc6, payload, size); + if (ret) + return ret; =20 oa_tc6_submit_rx_skb(tc6); =20 @@ -876,22 +916,24 @@ static int oa_tc6_prcs_rx_frame_start(struct oa_tc6 *= tc6, u8 *payload, u16 size) if (ret) return ret; =20 - oa_tc6_update_rx_skb(tc6, payload, size); - - return 0; + return oa_tc6_update_rx_skb(tc6, payload, size); } =20 -static void oa_tc6_prcs_rx_frame_end(struct oa_tc6 *tc6, u8 *payload, u16 = size) +static int oa_tc6_prcs_rx_frame_end(struct oa_tc6 *tc6, u8 *payload, u16 s= ize) { - oa_tc6_update_rx_skb(tc6, payload, size); + int ret; =20 - oa_tc6_submit_rx_skb(tc6); + ret =3D oa_tc6_update_rx_skb(tc6, payload, size); + if (!ret) + oa_tc6_submit_rx_skb(tc6); + return ret; } =20 -static void oa_tc6_prcs_ongoing_rx_frame(struct oa_tc6 *tc6, u8 *payload, - u32 footer) +static int oa_tc6_prcs_ongoing_rx_frame(struct oa_tc6 *tc6, u8 *payload, + u32 footer) { - oa_tc6_update_rx_skb(tc6, payload, OA_TC6_CHUNK_PAYLOAD_SIZE); + return oa_tc6_update_rx_skb(tc6, payload, + OA_TC6_CHUNK_PAYLOAD_SIZE); } =20 static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data, @@ -906,10 +948,10 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6= *tc6, u8 *data, u16 size; =20 /* Restart the new rx frame after receiving rx buffer overflow error */ - if (start_valid && tc6->rx_buf_overflow) - tc6->rx_buf_overflow =3D false; + if (start_valid && tc6->wait_until_start_valid) + tc6->wait_until_start_valid =3D false; =20 - if (tc6->rx_buf_overflow) + if (tc6->wait_until_start_valid) return 0; =20 /* Process the chunk with complete rx frame */ @@ -931,8 +973,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *= tc6, u8 *data, /* Process the chunk with only rx frame end */ if (end_valid && !start_valid) { size =3D end_byte_offset + 1; - oa_tc6_prcs_rx_frame_end(tc6, data, size); - return 0; + return oa_tc6_prcs_rx_frame_end(tc6, data, size); } =20 /* Process the chunk with previous rx frame end and next rx frame @@ -946,6 +987,15 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 = *tc6, u8 *data, if (tc6->rx_skb) { size =3D end_byte_offset + 1; oa_tc6_prcs_rx_frame_end(tc6, data, size); + + /* Return value from oa_tc6_prcs_rx_frame_end is not + * checked. If it returned an error, it is to make + * the code to look for new frame. At this stage, + * code below is going to process a new frame. So, + * error condition is set to false, in case it is + * set before proceeding. + */ + tc6->wait_until_start_valid =3D false; } size =3D OA_TC6_CHUNK_PAYLOAD_SIZE - start_byte_offset; return oa_tc6_prcs_rx_frame_start(tc6, @@ -954,9 +1004,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 = *tc6, u8 *data, } =20 /* Process the chunk with ongoing rx frame data */ - oa_tc6_prcs_ongoing_rx_frame(tc6, data, footer); - - return 0; + return oa_tc6_prcs_ongoing_rx_frame(tc6, data, footer); } =20 static u32 oa_tc6_get_rx_chunk_footer(struct oa_tc6 *tc6, u16 footer_offse= t) @@ -972,8 +1020,9 @@ static u32 oa_tc6_get_rx_chunk_footer(struct oa_tc6 *t= c6, u16 footer_offset) static int oa_tc6_process_spi_data_rx_buf(struct oa_tc6 *tc6, u16 length) { u16 no_of_rx_chunks =3D length / OA_TC6_CHUNK_SIZE; + bool retry =3D false; + int ret =3D 0; u32 footer; - int ret; =20 /* All the rx chunks in the receive SPI data buffer are examined here */ for (int i =3D 0; i < no_of_rx_chunks; i++) { @@ -982,8 +1031,11 @@ static int oa_tc6_process_spi_data_rx_buf(struct oa_t= c6 *tc6, u16 length) OA_TC6_CHUNK_PAYLOAD_SIZE); =20 ret =3D oa_tc6_process_rx_chunk_footer(tc6, footer); - if (ret) - return ret; + if (ret) { + if (ret !=3D -EAGAIN) + return ret; + retry =3D true; + } =20 /* If there is a data valid chunks then process it for the * information needed to determine the validity and the location @@ -995,12 +1047,35 @@ static int oa_tc6_process_spi_data_rx_buf(struct oa_= tc6 *tc6, u16 length) =20 ret =3D oa_tc6_prcs_rx_chunk_payload(tc6, payload, footer); - if (ret) - return ret; + if (ret) { + if (ret !=3D -ENOMEM && ret !=3D -EAGAIN) + return ret; + retry =3D true; + } } } =20 - return 0; + /* Not bailing out on recoverable error codes, -EAGAIN and + * -ENOMEM. If subsequent loop iterations, if any, succeeds, + * error code would be overwritten. retry flag helps to + * make the caller to continue and retry. Since recovery + * action for -ENOMEM and -EAGAIN are same, we are returning + * one of the error codes, that is -EAGAIN. + * + * Successful recovery depends on how small the frames are, + * how many chunks, among the received chunks triggered the + * error, whether data is intact even with error conditions. + * As a result, there is no single, best method to recover + * most data when error conditions hit. We do our best by + * processing all the chunks with good "footer header" and + * "data valid" bit set. + */ + if (retry) { + ret =3D -EAGAIN; + oa_tc6_look_for_new_frame(tc6); + } + + return ret; } =20 static __be32 oa_tc6_prepare_data_header(bool data_valid, bool start_valid, @@ -1162,10 +1237,8 @@ static int oa_tc6_try_spi_transfer(struct oa_tc6 *tc= 6) } =20 ret =3D oa_tc6_process_spi_data_rx_buf(tc6, spi_len); - if (ret) { - if (ret =3D=3D -EAGAIN) - continue; =20 + if (ret && ret !=3D -EAGAIN) { oa_tc6_free_ongoing_skbs(tc6); netdev_err(tc6->netdev, "Device error: %d\n", ret); return ret; --=20 2.43.0 From nobody Tue Sep 29 02:37:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C248E329C7C; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; cv=none; b=A9ZysYwtgPICjsMCoxrtbyE3A/oBvTyxAQdoq7CH5th4b8sTuaYr7AW6d054GPM9hOzPUdEE3rteLPts6qEQ0nygxHkScVapGbjHTAlc1x7OpXax7xGumqyQoNrlwywMNvKLLqtrkO3+LQz21INOrcq5Ry86qT87YIq6NZCEG1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; c=relaxed/simple; bh=sS7njM+sS7jFl8nJteD0V0/utBPQ/hAum/oTD0dPVM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=coefNvd3HsQeLahKLWWBrJfOQt/WSYWY7iLY0QevM9kNA4fhEdLASfZYC+soE3Tlwq6Btbu6aKRuch9Rrc78H80EP6/SgP/St4WNtFcqtakfvb7cP7xh7rj0o3VCIKing+lUmimt6ijVyE6SuJchSq1ODrSJRtx0V4+3cdIpOfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ijQ8gnAk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ijQ8gnAk" Received: by smtp.kernel.org (Postfix) with ESMTPS id 826A2C2BCFA; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786590026; bh=sS7njM+sS7jFl8nJteD0V0/utBPQ/hAum/oTD0dPVM0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ijQ8gnAkE6521RMLTYttpVlyoYodYX9TQ8r7mVbUu1HHyQ3sMmNARquz1GaQWbxu3 +3wMQC/+9CuW9fIbHkWzb4NzherdhGmV35vBJyx0nXE1dpTdNGCkl5/Po/7Ejomvik PewWZQXyQ4c2cYLL55UXK/glzZpe7jKBt/krRXjln1NSixdakr9556ENhapJPImLGw X4Dgu1hdoGzI2fIE1RJmHB3bAiDlXtKd7J7F3EUuwzbHuIT1x14EytJLFTkcb/WZso cUaipCMkSCDBTcyObamYh5UDovwUz5Hps3JRlei51hpbqS4ON0xxRrI9ojbvR6m6Bf 9eK1snlbTqgpg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D65C5DF65; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) From: Selvamani Rajagopal via B4 Relay Date: Wed, 12 Aug 2026 20:00:11 -0700 Subject: [PATCH net v6 3/4] net: ethernet: oa_tc6: Disable tx queues on fatal error Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-fix-race-condition-and-crash-v6-3-6cf90f4a271a@onsemi.com> References: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> In-Reply-To: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> To: Parthiban Veerasooran , Andrew Lunn , Piergiorgio Beruto , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Parthiban Veerasooran , Selvamani Rajagopal X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786590011; l=1843; i=Selvamani.Rajagopal@onsemi.com; s=20260531; h=from:subject:message-id; bh=QEbclI3MVrLiGQYLCknmELxAQxPOBDuJXfAlWYmfMyE=; b=2VfDC+V5c/knrnosiBAlzjlOoVLGftfR7YVREB1L4E+rBU3bWpKDq5aQ8beJlnXQ+BXTSudX0 tm++ez3HR2rDUH3I+LiOrUz90GkkmX3aBw2eP4trDuuTfNYYyiFn1qM X-Developer-Key: i=Selvamani.Rajagopal@onsemi.com; a=ed25519; pk=5QRdM0HS/LGWWcUZZ9hVfZ+qbPQGZCumcTXOiN7Fyug= X-Endpoint-Received: by B4 Relay for Selvamani.Rajagopal@onsemi.com/20260531 with auth_id=803 X-Original-From: Selvamani Rajagopal Reply-To: Selvamani.Rajagopal@onsemi.com From: Selvamani Rajagopal Previously, TX queue interface was stopped when disable_traffic flag was set, which would indicate fatal error. It is more appropriate to disable the queue as, unless driver is unloaded and reloaded, there is no recovery after disable_traffic is set. Queues may be re-enabled inadvertently by other layers. Intention of disable_traffic is only to stop the traffic from flowing on fatal error. Fixes: b542d13fab0f ("net: ethernet: oa_tc6: Interrupt is active low, level= triggered.") Signed-off-by: Selvamani Rajagopal --- changes in v6 - Updated the comment and commit message to reflect the usage of disable_traffic changes in v5 - Changed the commit message to accurately reflect the changes changes in v4 - Reverted the change that turned carrier off on disable_traffic, as it may have side effects changes in v3 - New patch. Carrier marked off once disable_traffic is set --- drivers/net/ethernet/oa_tc6.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 09bc293fb75b..5354ed3ece7e 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -730,6 +730,12 @@ static void oa_tc6_disable_traffic(struct oa_tc6 *tc6) skb =3D oa_tc6_detach_waiting_tx_skb(tc6); spin_unlock_bh(&tc6->tx_skb_lock); =20 + /* disable_traffic, when set, is a point of no return to working + * state. TX queues are disabled. In some cases, upper layer or + * vendor code may inadvertently enable the queue. Intention of + * the disable_traffic flag is to stop traffic from flowing. + */ + netif_tx_disable(tc6->netdev); oa_tc6_drop_tx_skb(tc6, skb); oa_tc6_free_ongoing_skbs(tc6); oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval); --=20 2.43.0 From nobody Tue Sep 29 02:37:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C22E2242D67; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; cv=none; b=bo2xhv7LbnlBV5cBhMYv/H8/Ayh+X8ZGumGhjj0rACA4MB/gfqf15dZkTyJYDcQwGS3ZE2HjmwA8fzG9lGJBhjy2nhikvdVan5M0ORw+RiuPg4eqvEw/og5Yz/4RuKd2LDG7mayQtknav5S4fzvPgzFykva+rYF2W4UnPKRPGKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786590026; c=relaxed/simple; bh=5kpSq+YZqBjwXavr5OCUEDCTfpqJn3lo1IRuwdRyHA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S783RgOdtD4TI2SFwsL2++Eh2F60FsNhzWWdJ8y5CIzfky7bZBHJtbnWTILygtSOnhwKDYGRh5C93TlRPDNcQLiQBMA6x+jVSHLCup1r3I5HniyhtSm3TbU05TOV+B+4wHLl9zGWBZ2RgZUuHRIdKSz25cjqJTjdJaF6cn3Ln/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aE3/e/O/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aE3/e/O/" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8EF02C2BCFB; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786590026; bh=5kpSq+YZqBjwXavr5OCUEDCTfpqJn3lo1IRuwdRyHA0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=aE3/e/O/ET17kk/TRKnVzED3JJoj/Mj/YxgALViZTi6mIQo4G9hNpDGluXPHpfjG3 FCm7oeH+WugQF+LjQsuW12NpMSULYux3hU0f6gz6O9uhUg8bf8d58X5qihO68hPkAm M1/gO4+Iy7E41padLWWf9C1ULSO9RUzVUQbyLFwSFmmy3SxRX+UOycp05R/wxm/r8p lRTbJg1yewSj2PsvaHSP/2HH3xxA3muQGoeM9xeyCdOFGLQEohy4R+wUO9QsVtr3bf l6Y3ifdh3dLF9O491X8LMO6YpYhdfKzhFK7ifJrURURBwdoOJE1H4wfFLHjmE71TWN QLqlEwgTISRSA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 752A1C5DF64; Thu, 13 Aug 2026 03:00:26 +0000 (UTC) From: Selvamani Rajagopal via B4 Relay Date: Wed, 12 Aug 2026 20:00:12 -0700 Subject: [PATCH net v6 4/4] net: ethernet: oa_tc6: Fix for the wrong data type Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-fix-race-condition-and-crash-v6-4-6cf90f4a271a@onsemi.com> References: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> In-Reply-To: <20260812-fix-race-condition-and-crash-v6-0-6cf90f4a271a@onsemi.com> To: Parthiban Veerasooran , Andrew Lunn , Piergiorgio Beruto , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Parthiban Veerasooran , Selvamani Rajagopal X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786590011; l=1024; i=Selvamani.Rajagopal@onsemi.com; s=20260531; h=from:subject:message-id; bh=YFjPZcvWNnqDXoOsWmMkWYtr6Pvxm21ISCYKMWeW2o8=; b=jsr3P1WBTd8zqeCs2tqao6XPhg9SuwOINt6bjta0Jt9G9aNi25/6zPjAZlV7Sr/+4d2wJf5ws QVP8haXw8a4CDjM3RZY9DIwsV+I1Cm8l3nhl/1vTwB7sjRQFPGgTczg X-Developer-Key: i=Selvamani.Rajagopal@onsemi.com; a=ed25519; pk=5QRdM0HS/LGWWcUZZ9hVfZ+qbPQGZCumcTXOiN7Fyug= X-Endpoint-Received: by B4 Relay for Selvamani.Rajagopal@onsemi.com/20260531 with auth_id=803 X-Original-From: Selvamani Rajagopal Reply-To: Selvamani.Rajagopal@onsemi.com From: Selvamani Rajagopal Inadvertently bool data type is used where int is supposed to be used. This might turn a negative error code into true or false and sign of the return code would be lost. Fixes: 8f9bf857e43b ("net: ethernet: oa_tc6: implement internal PHY initial= ization") Signed-off-by: Selvamani Rajagopal --- changes in v6 - No change changes in v5 - New patch. Fixed the wrong data type used. --- drivers/net/ethernet/oa_tc6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 5354ed3ece7e..6e27ed39a99b 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -423,7 +423,7 @@ static int oa_tc6_mdiobus_read(struct mii_bus *bus, int= addr, int regnum) { struct oa_tc6 *tc6 =3D bus->priv; u32 regval; - bool ret; + int ret; =20 ret =3D oa_tc6_read_register(tc6, OA_TC6_PHY_STD_REG_ADDR_BASE | (regnum & OA_TC6_PHY_STD_REG_ADDR_MASK), --=20 2.43.0