Page MenuHomeFreeBSD

D37599.id114264.diff
No OneTemporary

D37599.id114264.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h
--- a/sys/compat/linuxkpi/common/include/linux/netdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h
@@ -53,6 +53,7 @@
#include <net/if_var.h>
#include <net/if_dl.h>
+#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/list.h>
#include <linux/device.h>
@@ -134,6 +135,7 @@
/* Not properly typed as-of now. */
int flags, type;
int name_assign_type, needed_headroom;
+ int threaded;
void (*priv_destructor)(struct net_device *);
@@ -266,6 +268,15 @@
#define napi_synchronize(_n) \
linuxkpi_napi_synchronize(_n)
+
+static inline void
+netif_napi_add_tx(struct net_device *dev, struct napi_struct *napi,
+ int(*napi_poll)(struct napi_struct *, int))
+{
+
+ netif_napi_add(dev, napi, napi_poll);
+}
+
/* -------------------------------------------------------------------------- */
static inline void
@@ -308,6 +319,126 @@
synchronize_rcu();
}
+static __inline void
+netif_receive_skb_list(struct list_head *head)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline int
+napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+ return (-1);
+}
+
+static __inline void
+ether_setup(struct net_device *ndev)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline void
+dev_net_set(struct net_device *dev, void *p)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+}
+
+/* -------------------------------------------------------------------------- */
+
+static __inline bool
+netif_carrier_ok(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+ return (false);
+}
+
+static __inline void
+netif_carrier_off(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline void
+netif_carrier_on(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+/* -------------------------------------------------------------------------- */
+
+static __inline bool
+netif_queue_stopped(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+ return (false);
+}
+
+static __inline void
+netif_stop_queue(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline void
+netif_wake_queue(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+/* -------------------------------------------------------------------------- */
+
+static __inline int
+register_netdevice(struct net_device *ndev)
+{
+
+ /* assert rtnl_locked? */
+ pr_debug("%s: TODO\n", __func__);
+ return (0);
+}
+
+static __inline int
+register_netdev(struct net_device *ndev)
+{
+ int error;
+
+ /* lock */
+ error = register_netdevice(ndev);
+ /* unlock */
+ pr_debug("%s: TODO\n", __func__);
+ return (error);
+}
+
+static __inline void
+unregister_netdev(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline void
+unregister_netdevice(struct net_device *ndev)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+/* -------------------------------------------------------------------------- */
+
+static __inline void
+netif_rx(struct sk_buff *skb)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+static __inline void
+netif_rx_ni(struct sk_buff *skb)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
/* -------------------------------------------------------------------------- */
struct net_device *linuxkpi_alloc_netdev(size_t, const char *, uint32_t,
@@ -331,5 +462,6 @@
#define rtnl_lock() do { } while(0)
#define rtnl_unlock() do { } while(0)
+#define rcu_dereference_rtnl(x) READ_ONCE(x)
#endif /* _LINUXKPI_LINUX_NETDEVICE_H */
diff --git a/sys/compat/linuxkpi/common/include/linux/platform_device.h b/sys/compat/linuxkpi/common/include/linux/platform_device.h
new file mode 100644
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/platform_device.h
@@ -0,0 +1,79 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020-2022 Bjoern A. Zeeb
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUXKPI_LINUX_PLATFORM_DEVICE_H
+#define _LINUXKPI_LINUX_PLATFORM_DEVICE_H
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+
+struct platform_device {
+ struct device dev;
+};
+
+struct platform_driver {
+ int (*remove)(struct platform_device *);
+ struct device_driver driver;
+};
+
+
+static __inline int
+platform_driver_register(struct platform_driver *pdrv)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+ return (-ENXIO);
+}
+
+static __inline void *
+dev_get_platdata(struct device *dev)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+ return (NULL);
+}
+
+static __inline int
+platform_driver_probe(struct platform_driver *pdrv,
+ int(*pd_probe_f)(struct platform_device *))
+{
+
+ pr_debug("%s: TODO\n", __func__);
+ return (-ENODEV);
+}
+
+static __inline void
+platform_driver_unregister(struct platform_driver *pdrv)
+{
+
+ pr_debug("%s: TODO\n", __func__);
+ return;
+}
+
+#endif /* _LINUXKPI_LINUX_PLATFORM_DEVICE_H */
diff --git a/sys/compat/linuxkpi/common/include/net/netlink.h b/sys/compat/linuxkpi/common/include/net/netlink.h
new file mode 100644
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/net/netlink.h
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2020,2022 Bjoern A. Zeeb
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINUXKPI_NET_NETLINK_H
+#define _LINUXKPI_NET_NETLINK_H
+
+#include <netlink/netlink.h>
+
+struct nla_policy {
+};
+
+struct netlink_callback {
+ int args[8];
+};
+
+static __inline int
+nla_put(struct sk_buff *skb, int attr, size_t len, void *data)
+{
+
+ pr_debug("%s: TODO -- now native?\n", __func__);
+ return (-ENXIO);
+}
+
+static __inline int
+nla_put_u16(struct sk_buff *skb, int attr, uint32_t val)
+{
+
+ return (nla_put(skb, attr, sizeof(uint32_t), &val));
+}
+
+#endif /* _LINUXKPI_NET_NETLINK_H */

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 8, 8:45 PM (3 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15711166
Default Alt Text
D37599.id114264.diff (8 KB)

Event Timeline