* [PATCH net-next v10 1/7] PCI: add Edimax Vendor ID to pci_ids.h
2024-06-11 4:52 [PATCH net-next v10 0/7] add ethernet driver for Tehuti Networks TN40xx chips FUJITA Tomonori
@ 2024-06-11 4:52 ` FUJITA Tomonori
2024-06-11 15:01 ` Bjorn Helgaas
2024-06-11 4:52 ` [PATCH net-next v10 2/7] net: tn40xx: add pci driver for Tehuti Networks TN40xx chips FUJITA Tomonori
2024-06-13 16:14 ` [PATCH net-next v10 0/7] add ethernet " Joe Damato
2 siblings, 1 reply; 9+ messages in thread
From: FUJITA Tomonori @ 2024-06-11 4:52 UTC (permalink / raw)
To: netdev
Cc: andrew, horms, kuba, jiri, pabeni, linux, hfdevel, naveenm,
jdamato, bhelgaas, linux-pci
Add the Edimax Vendor ID (0x1432) for an ethernet driver for Tehuti
Networks TN40xx chips. This ID can be used for Realtek 8180 and Ralink
rt28xx wireless drivers.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
include/linux/pci_ids.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 942a587bb97e..677aea20d3e1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2126,6 +2126,8 @@
#define PCI_VENDOR_ID_CHELSIO 0x1425
+#define PCI_VENDOR_ID_EDIMAX 0x1432
+
#define PCI_VENDOR_ID_ADLINK 0x144a
#define PCI_VENDOR_ID_SAMSUNG 0x144d
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next v10 2/7] net: tn40xx: add pci driver for Tehuti Networks TN40xx chips
2024-06-11 4:52 [PATCH net-next v10 0/7] add ethernet driver for Tehuti Networks TN40xx chips FUJITA Tomonori
2024-06-11 4:52 ` [PATCH net-next v10 1/7] PCI: add Edimax Vendor ID to pci_ids.h FUJITA Tomonori
@ 2024-06-11 4:52 ` FUJITA Tomonori
2024-06-14 0:25 ` Jakub Kicinski
2024-06-13 16:14 ` [PATCH net-next v10 0/7] add ethernet " Joe Damato
2 siblings, 1 reply; 9+ messages in thread
From: FUJITA Tomonori @ 2024-06-11 4:52 UTC (permalink / raw)
To: netdev
Cc: andrew, horms, kuba, jiri, pabeni, linux, hfdevel, naveenm,
jdamato, bhelgaas, linux-pci
This just adds the scaffolding for an ethernet driver for Tehuti
Networks TN40xx chips.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
MAINTAINERS | 8 +++-
drivers/net/ethernet/tehuti/Kconfig | 12 ++++++
drivers/net/ethernet/tehuti/Makefile | 3 ++
drivers/net/ethernet/tehuti/tn40.c | 55 ++++++++++++++++++++++++++++
drivers/net/ethernet/tehuti/tn40.h | 9 +++++
5 files changed, 86 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/tehuti/tn40.c
create mode 100644 drivers/net/ethernet/tehuti/tn40.h
diff --git a/MAINTAINERS b/MAINTAINERS
index cd3277a98cfe..8dc47317f4ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22138,7 +22138,13 @@ TEHUTI ETHERNET DRIVER
M: Andy Gospodarek <andy@greyhouse.net>
L: netdev@vger.kernel.org
S: Supported
-F: drivers/net/ethernet/tehuti/*
+F: drivers/net/ethernet/tehuti/tehuti.*
+
+TEHUTI TN40XX ETHERNET DRIVER
+M: FUJITA Tomonori <fujita.tomonori@gmail.com>
+L: netdev@vger.kernel.org
+S: Supported
+F: drivers/net/ethernet/tehuti/tn40*
TELECOM CLOCK DRIVER FOR MCPL0010
M: Mark Gross <markgross@kernel.org>
diff --git a/drivers/net/ethernet/tehuti/Kconfig b/drivers/net/ethernet/tehuti/Kconfig
index 8735633765a1..849e3b4a71c1 100644
--- a/drivers/net/ethernet/tehuti/Kconfig
+++ b/drivers/net/ethernet/tehuti/Kconfig
@@ -23,4 +23,16 @@ config TEHUTI
help
Tehuti Networks 10G Ethernet NIC
+config TEHUTI_TN40
+ tristate "Tehuti Networks TN40xx 10G Ethernet adapters"
+ depends on PCI
+ help
+ This driver supports 10G Ethernet adapters using Tehuti Networks
+ TN40xx chips. Currently, adapters with Applied Micro Circuits
+ Corporation QT2025 are supported; Tehuti Networks TN9310,
+ DLink DXE-810S, ASUS XG-C100F, and Edimax EN-9320.
+
+ To compile this driver as a module, choose M here: the module
+ will be called tn40xx.
+
endif # NET_VENDOR_TEHUTI
diff --git a/drivers/net/ethernet/tehuti/Makefile b/drivers/net/ethernet/tehuti/Makefile
index 13a0ddd62088..1c468d99e476 100644
--- a/drivers/net/ethernet/tehuti/Makefile
+++ b/drivers/net/ethernet/tehuti/Makefile
@@ -4,3 +4,6 @@
#
obj-$(CONFIG_TEHUTI) += tehuti.o
+
+tn40xx-y := tn40.o
+obj-$(CONFIG_TEHUTI_TN40) += tn40xx.o
diff --git a/drivers/net/ethernet/tehuti/tn40.c b/drivers/net/ethernet/tehuti/tn40.c
new file mode 100644
index 000000000000..6ec436120d18
--- /dev/null
+++ b/drivers/net/ethernet/tehuti/tn40.c
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* Copyright (c) Tehuti Networks Ltd. */
+
+#include <linux/pci.h>
+
+#include "tn40.h"
+
+static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ int ret;
+
+ ret = pci_enable_device(pdev);
+ if (ret)
+ return ret;
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (ret) {
+ dev_err(&pdev->dev, "failed to set DMA mask.\n");
+ goto err_disable_device;
+ }
+ return 0;
+err_disable_device:
+ pci_disable_device(pdev);
+ return ret;
+}
+
+static void tn40_remove(struct pci_dev *pdev)
+{
+ pci_disable_device(pdev);
+}
+
+static const struct pci_device_id tn40_id_table[] = {
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, 0x4022,
+ PCI_VENDOR_ID_TEHUTI, 0x3015) },
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, 0x4022,
+ PCI_VENDOR_ID_DLINK, 0x4d00) },
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, 0x4022,
+ PCI_VENDOR_ID_ASUSTEK, 0x8709) },
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, 0x4022,
+ PCI_VENDOR_ID_EDIMAX, 0x8103) },
+ { }
+};
+
+static struct pci_driver tn40_driver = {
+ .name = TN40_DRV_NAME,
+ .id_table = tn40_id_table,
+ .probe = tn40_probe,
+ .remove = tn40_remove,
+};
+
+module_pci_driver(tn40_driver);
+
+MODULE_DEVICE_TABLE(pci, tn40_id_table);
+MODULE_AUTHOR("Tehuti networks");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Tehuti Network TN40xx Driver");
diff --git a/drivers/net/ethernet/tehuti/tn40.h b/drivers/net/ethernet/tehuti/tn40.h
new file mode 100644
index 000000000000..b45a2eef2850
--- /dev/null
+++ b/drivers/net/ethernet/tehuti/tn40.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Copyright (c) Tehuti Networks Ltd. */
+
+#ifndef _TN40_H_
+#define _TN40_H_
+
+#define TN40_DRV_NAME "tn40xx"
+
+#endif /* _TN40XX_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH net-next v10 0/7] add ethernet driver for Tehuti Networks TN40xx chips
2024-06-11 4:52 [PATCH net-next v10 0/7] add ethernet driver for Tehuti Networks TN40xx chips FUJITA Tomonori
2024-06-11 4:52 ` [PATCH net-next v10 1/7] PCI: add Edimax Vendor ID to pci_ids.h FUJITA Tomonori
2024-06-11 4:52 ` [PATCH net-next v10 2/7] net: tn40xx: add pci driver for Tehuti Networks TN40xx chips FUJITA Tomonori
@ 2024-06-13 16:14 ` Joe Damato
2024-06-17 22:04 ` FUJITA Tomonori
2 siblings, 1 reply; 9+ messages in thread
From: Joe Damato @ 2024-06-13 16:14 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: netdev, andrew, horms, kuba, jiri, pabeni, linux, hfdevel,
naveenm, bhelgaas, linux-pci
On Tue, Jun 11, 2024 at 01:52:10PM +0900, FUJITA Tomonori wrote:
> This patchset adds a new 10G ethernet driver for Tehuti Networks
> TN40xx chips. Note in mainline, there is a driver for Tehuti Networks
> (drivers/net/ethernet/tehuti/tehuti.[hc]), which supports TN30xx
> chips.
>
> Multiple vendors (DLink, Asus, Edimax, QNAP, etc) developed adapters
> based on TN40xx chips. Tehuti Networks went out of business but the
> drivers are still distributed under GPL2 with some of the hardware
> (and also available on some sites). With some changes, I try to
> upstream this driver with a new PHY driver in Rust.
>
> The major change is replacing the PHY abstraction layer in the original
> driver with phylink. TN40xx chips are used with various PHY hardware
> (AMCC QT2025, TI TLK10232, Aqrate AQR105, and Marvell MV88X3120,
> MV88X3310, and MV88E2010).
>
> I've also been working on a new PHY driver for QT2025 in Rust [1]. For
> now, I enable only adapters using QT2025 PHY in the PCI ID table of
> this driver. I've tested this driver and the QT2025 PHY driver with
> Edimax EN-9320 10G adapter and 10G-SR SFP+. In mainline, there are PHY
> drivers for AQR105 and Marvell PHYs, which could work for some TN40xx
> adapters with this driver.
>
> To make reviewing easier, this patchset has only basic functions. Once
> merged, I'll submit features like ethtool support.
Just a note for future feature support: it would be really great if
you also included the new netdev-genl APIs. For most drivers, it is
pretty easy to include and it allows userland to get more useful
information about the RX and TX queues.
Here's an example implementation for mlx4 to give you an idea of how
to use it:
https://lore.kernel.org/netdev/20240513172909.473066-1-jdamato@fastly.com/
specifically:
https://lore.kernel.org/netdev/20240513172909.473066-3-jdamato@fastly.com/
and
https://lore.kernel.org/netdev/20240513172909.473066-4-jdamato@fastly.com/
> v10:
> - Add Edimax Vendor ID to pci_ids.h (cleanup for wireless drivers later)
> - rename functions for mdio (use _c45 suffix for read/write and mdio_wait_nobusy)
> - clean up some tn40_rxdb_ functions
> - use unsinged int for static, nelem, and top in tn40_rxdb struct instead of int
> - return -ENODEV instead of -1 when PHY isn't found
> - remove the function to re-setting mdio speec to 1MHZ in tn40_priv_init()
> - cleanup tn40_mdio_set_speed()
> v9: https://lore.kernel.org/netdev/20240605232608.65471-1-fujita.tomonori@gmail.com/
> - move phylink_connect_phy() to simplify the ndo_open callback
> v8: https://lore.kernel.org/netdev/20240603064955.58327-1-fujita.tomonori@gmail.com/
> - remove phylink_mac_change() call
> - fix phylink_start() usage (call it after the driver is ready to operate).
> - simplify the way to get the private struct from phylink_config pointer
> - fix netif_stop_queue usage in mac_link_down callback
> - remove MLO_AN_PHY usage
> v7: https://lore.kernel.org/netdev/20240527203928.38206-7-fujita.tomonori@gmail.com/
> - use page pool API for rx allocation
> - fix NAPI API misuse
> - fix error checking of mdio write
> v6: https://lore.kernel.org/netdev/20240512085611.79747-2-fujita.tomonori@gmail.com/
> - use the firmware for TN30xx chips
> - move link up/down code to phylink's mac_link_up/mac_link_down callbacks
> - clean up mdio access code
> v5: https://lore.kernel.org/netdev/20240508113947.68530-1-fujita.tomonori@gmail.com/
> - remove dma_set_mask_and_coherent fallback
> - count tx_dropped
> - use ndo_get_stats64 instead of ndo_get_stats
> - remove unnecessary __packed attribute
> - fix NAPI API usage
> - rename tn40_recycle_skb to tn40_recycle_rx_buffer
> - avoid high order page allocation (the maximum is order-1 now)
> v4: https://lore.kernel.org/netdev/20240501230552.53185-1-fujita.tomonori@gmail.com/
> - fix warning on 32bit build
> - fix inline warnings
> - fix header file inclusion
> - fix TN40_NDEV_TXQ_LEN
> - remove 'select PHYLIB' in Kconfig
> - fix access to phydev
> - clean up readx_poll_timeout_atomic usage
> v3: https://lore.kernel.org/netdev/20240429043827.44407-1-fujita.tomonori@gmail.com/
> - remove driver version
> - use prefixes tn40_/TN40_ for all function, struct and define names
> v2: https://lore.kernel.org/netdev/20240425010354.32605-1-fujita.tomonori@gmail.com/
> - split mdio patch into mdio and phy support
> - add phylink support
> - clean up mdio read/write
> - use the standard bit operation macros
> - use upper_32/lower_32_bits macro
> - use tn40_ prefix instead of bdx_
> - fix Sparse errors
> - fix compiler warnings
> - fix style issues
> v1: https://lore.kernel.org/netdev/20240415104352.4685-1-fujita.tomonori@gmail.com/
>
> [1] https://lore.kernel.org/netdev/20240415104701.4772-1-fujita.tomonori@gmail.com/
>
> FUJITA Tomonori (7):
> PCI: add Edimax Vendor ID to pci_ids.h
> net: tn40xx: add pci driver for Tehuti Networks TN40xx chips
> net: tn40xx: add register defines
> net: tn40xx: add basic Tx handling
> net: tn40xx: add basic Rx handling
> net: tn40xx: add mdio bus support
> net: tn40xx: add phylink support
>
> MAINTAINERS | 8 +-
> drivers/net/ethernet/tehuti/Kconfig | 15 +
> drivers/net/ethernet/tehuti/Makefile | 3 +
> drivers/net/ethernet/tehuti/tn40.c | 1768 +++++++++++++++++++++++
> drivers/net/ethernet/tehuti/tn40.h | 231 +++
> drivers/net/ethernet/tehuti/tn40_mdio.c | 142 ++
> drivers/net/ethernet/tehuti/tn40_phy.c | 76 +
> drivers/net/ethernet/tehuti/tn40_regs.h | 245 ++++
> include/linux/pci_ids.h | 2 +
> 9 files changed, 2489 insertions(+), 1 deletion(-)
> create mode 100644 drivers/net/ethernet/tehuti/tn40.c
> create mode 100644 drivers/net/ethernet/tehuti/tn40.h
> create mode 100644 drivers/net/ethernet/tehuti/tn40_mdio.c
> create mode 100644 drivers/net/ethernet/tehuti/tn40_phy.c
> create mode 100644 drivers/net/ethernet/tehuti/tn40_regs.h
>
>
> base-commit: 2ebb87f45b3c6adc97b29291102ecb97274f913f
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread