git: 105331f658e2 - main - LinuxKPI: netdevice: add alloc_netdev_dummy()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Oct 2024 13:27:28 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=105331f658e2f14fb4daa64dcd076c7369505295
commit 105331f658e2f14fb4daa64dcd076c7369505295
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-09-26 21:06:52 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-10-17 13:27:05 +0000
LinuxKPI: netdevice: add alloc_netdev_dummy()
Add alloc_netdev_dummy() which is needed by an updated rtw88 driver.
Given we already call linuxkpi_init_dummy_netdev() ourselves allow the
setup function to be NULL to not initialize and start a tasq td twice.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D46802
---
sys/compat/linuxkpi/common/include/linux/netdevice.h | 2 ++
sys/compat/linuxkpi/common/src/linux_netdev.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h
index dde3ad07dec2..cd7d23077a62 100644
--- a/sys/compat/linuxkpi/common/include/linux/netdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h
@@ -466,6 +466,8 @@ void linuxkpi_free_netdev(struct net_device *);
#define alloc_netdev(_l, _n, _f, _func) \
linuxkpi_alloc_netdev(_l, _n, _f, _func)
+#define alloc_netdev_dummy(_l) \
+ linuxkpi_alloc_netdev(_l, "dummy", NET_NAME_UNKNOWN, NULL)
#define free_netdev(_n) \
linuxkpi_free_netdev(_n)
diff --git a/sys/compat/linuxkpi/common/src/linux_netdev.c b/sys/compat/linuxkpi/common/src/linux_netdev.c
index fe00e929c168..c36684f9fd97 100644
--- a/sys/compat/linuxkpi/common/src/linux_netdev.c
+++ b/sys/compat/linuxkpi/common/src/linux_netdev.c
@@ -409,7 +409,8 @@ linuxkpi_alloc_netdev(size_t len, const char *name, uint32_t flags,
/* This needs extending as we support more. */
- setup_func(ndev);
+ if (setup_func != NULL)
+ setup_func(ndev);
return (ndev);
}