Skip to contentSkip to conversation

net: ethernet: rtsn: Add support for Renesas Ethernet-TSN

PATCH Applied Niklas Söderlund 2 participants 2 messages Jun 20, 2024 – Jun 21, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH v10 1/1 net: ethernet: rtsn: Add support for Renesas Ethernet-TSN

Add initial support for Renesas Ethernet-TSN End-station device of R-Car V4H. The Ethernet End-station can connect to an Ethernet network using a 10 Mbps, 100 Mbps, or 1 Gbps full-duplex link via MII/GMII/RMII/RGMII. Depending on the connected PHY.

The driver supports Rx checksum and offload and hardware timestamps.

While full power management and suspend/resume is not yet supported the driver enables runtime PM in order to enable the module clock. While explicit clock management using clk_enable() would suffice for the supported SoC, the module could be reused on SoCs where the module is part of a power domain.

---
* Changes since v9
- Only increase Rx stats when freeing descriptors if the descriptor is associated with an skb. This is only a cosmetic change to improve readability.
- Use napi_gro_receive() instead of netif_receive_skb(). This changed uncovered napi_complete_done() being called with a driver private lock held, fix that too.
- Add review tag form Andrew.

* Changes since v8
- Add check to make sure TX packet fits inside a single descriptor. This covers the case where multiple VLAN tags stacked on-top of each other could push it over the limit assumed from the MTU.

* Changes since v7
- Properly handle Rx when netpoll is called with 0 budget. Previously one Rx packet would be processed in this case.
- Use napi_alloc_skb() instead of netdev_alloc_skb() in Rx.
- Use device implemented 64 bit stats instead of using stats member in struct net_device.
- Implement ndo_hwtstamp_{g,s}et instead of acting on SIOC{G,S}HWTSTAMP in do_ioctl().
- Fix incorrect error sign when using PTR_ERR().
- Add missing cosmetic space when creating struct of_device_id.
- Rename label error_alloc to error_free.

* Changes since v6
- Fix warning added when removing delays depending on phy-mode logic.

* Changes since v5
- Removed delays depending on phy-mode logic. This is only needed on some SoCs (V4H multiple boards), and currently we can't test on them. As this have been a hot topic in review drop it for now so we can support V4H single boards which we can test and lets work on the delay on-top when we can test it.

* Changes since v4
- Enable GPOUT_RDM and GPOUT_TDM delays depending on phy-mode.

* Changes since v3
- Add description to commit message why PM operations are used instead of explicit management of the clock.

* Changes since v2
- Drop extra call to ether_setup(), already called by alloc_etherdev_mqs().
- Remove dependency on MII.
- Improve error paths when requestion IRQs.
- Correct the interpretation of which phy-mode to apply delays for, and mask the phy-mode passed to the PHY if MAC adds delays.

* Changes since v1
- Remove C45 read/write functions, the phy-core can do that for us.
- Rework the driver to register the MDIO bus at probe time instead of at ndo_open().
- Rework rtsn_rx() to take advantages of the improved design proposed and upstreamed for R-Car RAVB driver Rx code-path.
- Use napi_complete_done() instead of napi_complete().
- Update commit message to list that the driver supports Rx CSUM offload.
- Drop unneeded __iowmb() left from development as well as a stray ;.
- Consider all RGMII modes.
- Move the phy_stop() call to mirror where phy_start() is called.
- Forward IOCTLS from rtsn_do_ioctl() to PHY using ndo_eth_ioctl()
- Align variable names to match core for IOCTLS functions.
- Make sure DMA mask and PTP is registered before registering the ndev.
- Document why the RTSN driver needs to be able to apply delays
- Add checks for which phy-modes the MAC driver can apply delays
- Use snprintf() instead of sprintf()

* Changes since RFC
- Fix issues in MDIO communication.
- Use a dedicated OF node for the MDIO bus.

---
 MAINTAINERS                           |    8 +
 drivers/net/ethernet/renesas/Kconfig  |   10 +
 drivers/net/ethernet/renesas/Makefile |    2 +
 drivers/net/ethernet/renesas/rtsn.c   | 1391 +++++++++++++++++++++++++
 drivers/net/ethernet/renesas/rtsn.h   |  464 +++++++++
 5 files changed, 1875 insertions(+)
 create mode 100644 drivers/net/ethernet/renesas/rtsn.c
 create mode 100644 drivers/net/ethernet/renesas/rtsn.h
MAINTAINERS +8 -0
index e66b7d4324ae..77d1e4544426 100644
@@ -19032,6 +19032,14 @@ F:	drivers/net/ethernet/renesas/Makefile
 F:	drivers/net/ethernet/renesas/rcar_gen4*
 F:	drivers/net/ethernet/renesas/rswitch*
 
+RENESAS ETHERNET TSN DRIVER
+M:	Niklas Söderlund <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/net/renesas,ethertsn.yaml
+F:	drivers/net/ethernet/renesas/rtsn.*
+
 RENESAS IDT821034 ASoC CODEC
 M:	Herve Codina <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
drivers/net/ethernet/renesas/Kconfig +10 -0
index 83de7e56da61..9b7559c88bee 100644
@@ -59,4 +59,14 @@ config RENESAS_GEN4_PTP
 	help
 	  Renesas R-Car Gen4 gPTP device driver.
 
+config RTSN
+	tristate "Renesas Ethernet-TSN support"
+	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on PTP_1588_CLOCK
+	select CRC32
+	select PHYLIB
+	select RENESAS_GEN4_PTP
+	help
+	  Renesas Ethernet-TSN device driver.
+
 endif # NET_VENDOR_RENESAS
drivers/net/ethernet/renesas/Makefile +2 -0
index 9070acfd6aaf..f65fc76f8b4d 100644
@@ -11,3 +11,5 @@ obj-$(CONFIG_RAVB) += ravb.o
 obj-$(CONFIG_RENESAS_ETHER_SWITCH) += rswitch.o
 
 obj-$(CONFIG_RENESAS_GEN4_PTP) += rcar_gen4_ptp.o
+
+obj-$(CONFIG_RTSN) += rtsn.o
drivers/net/ethernet/renesas/rtsn.c new file +1391 -0

1,391 lines not on this page · raw message

drivers/net/ethernet/renesas/rtsn.h new file +464 -0

464 lines not on this page · raw message

Signature · 1 line
2.45.2
#1 lore raw
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 8 lines · On Thu, 20 Jun 2024 20:22:19 +0200 you wrote:

Add initial support for Renesas Ethernet-TSN End-station device of R-Car V4H. The Ethernet End-station can connect to an Ethernet network using a 10 Mbps, 100 Mbps, or 1 Gbps full-duplex link via MII/GMII/RMII/RGMII. Depending on the connected PHY.

The driver supports Rx checksum and offload and hardware timestamps.

[...]

Here is the summary with links:
- [net-next,v10] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN

    https://git.kernel.org/netdev/net-next/c/b0d3969d2b4d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html