aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/include')
-rw-r--r--sys/compat/linuxkpi/common/include/acpi/actbl.h1
-rw-r--r--sys/compat/linuxkpi/common/include/asm/atomic.h4
-rw-r--r--sys/compat/linuxkpi/common/include/asm/atomic64.h3
-rw-r--r--sys/compat/linuxkpi/common/include/asm/io.h7
-rw-r--r--sys/compat/linuxkpi/common/include/asm/processor.h5
-rw-r--r--sys/compat/linuxkpi/common/include/linux/cpu.h4
-rw-r--r--sys/compat/linuxkpi/common/include/linux/debugfs.h11
-rw-r--r--sys/compat/linuxkpi/common/include/linux/device.h10
-rw-r--r--sys/compat/linuxkpi/common/include/linux/dma-buf-map.h91
-rw-r--r--sys/compat/linuxkpi/common/include/linux/dma-mapping.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/dmi.h13
-rw-r--r--sys/compat/linuxkpi/common/include/linux/efi.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/ethtool.h20
-rw-r--r--sys/compat/linuxkpi/common/include/linux/fs.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/gfp.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/ieee80211.h15
-rw-r--r--sys/compat/linuxkpi/common/include/linux/if_ether.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/interrupt.h17
-rw-r--r--sys/compat/linuxkpi/common/include/linux/irq_work.h7
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kernel.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/leds.h40
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mm.h3
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mman.h38
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mmzone.h11
-rw-r--r--sys/compat/linuxkpi/common/include/linux/moduleparam.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mutex.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/netdevice.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/nl80211.h9
-rw-r--r--sys/compat/linuxkpi/common/include/linux/page-flags.h34
-rw-r--r--sys/compat/linuxkpi/common/include/linux/pci.h34
-rw-r--r--sys/compat/linuxkpi/common/include/linux/pm.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/rculist.h5
-rw-r--r--sys/compat/linuxkpi/common/include/linux/seq_file.h3
-rw-r--r--sys/compat/linuxkpi/common/include/linux/skbuff.h76
-rw-r--r--sys/compat/linuxkpi/common/include/linux/slab.h12
-rw-r--r--sys/compat/linuxkpi/common/include/linux/smp.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/string.h21
-rw-r--r--sys/compat/linuxkpi/common/include/linux/sysfs.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/time.h2
-rw-r--r--sys/compat/linuxkpi/common/include/net/cfg80211.h20
-rw-r--r--sys/compat/linuxkpi/common/include/net/mac80211.h54
-rw-r--r--sys/compat/linuxkpi/common/include/net/regulatory.h4
42 files changed, 540 insertions, 76 deletions
diff --git a/sys/compat/linuxkpi/common/include/acpi/actbl.h b/sys/compat/linuxkpi/common/include/acpi/actbl.h
new file mode 100644
index 000000000000..dbb7db41bb66
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/acpi/actbl.h
@@ -0,0 +1 @@
+#include <contrib/dev/acpica/include/actbl.h>
diff --git a/sys/compat/linuxkpi/common/include/asm/atomic.h b/sys/compat/linuxkpi/common/include/asm/atomic.h
index d7e5338c0356..b4154274f3f8 100644
--- a/sys/compat/linuxkpi/common/include/asm/atomic.h
+++ b/sys/compat/linuxkpi/common/include/asm/atomic.h
@@ -166,9 +166,7 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
#define LINUXKPI_ATOMIC_16(...)
#endif
-#if !(defined(i386) || (defined(__mips__) && !(defined(__mips_n32) || \
- defined(__mips_n64))) || (defined(__powerpc__) && \
- !defined(__powerpc64__)))
+#if !(defined(i386) || (defined(__powerpc__) && !defined(__powerpc64__)))
#define LINUXKPI_ATOMIC_64(...) __VA_ARGS__
#else
#define LINUXKPI_ATOMIC_64(...)
diff --git a/sys/compat/linuxkpi/common/include/asm/atomic64.h b/sys/compat/linuxkpi/common/include/asm/atomic64.h
index 4ee0fa5ecf84..0d9634206a01 100644
--- a/sys/compat/linuxkpi/common/include/asm/atomic64.h
+++ b/sys/compat/linuxkpi/common/include/asm/atomic64.h
@@ -125,8 +125,7 @@ atomic64_fetch_add_unless(atomic64_t *v, int64_t a, int64_t u)
static inline int64_t
atomic64_xchg(atomic64_t *v, int64_t i)
{
-#if !((defined(__mips__) && !(defined(__mips_n32) || defined(__mips_n64))) || \
- (defined(__powerpc__) && !defined(__powerpc64__)))
+#if !(defined(__powerpc__) && !defined(__powerpc64__))
return (atomic_swap_64(&v->counter, i));
#else
int64_t ret = atomic64_read(v);
diff --git a/sys/compat/linuxkpi/common/include/asm/io.h b/sys/compat/linuxkpi/common/include/asm/io.h
index 49eca70a38eb..7787125f4f04 100644
--- a/sys/compat/linuxkpi/common/include/asm/io.h
+++ b/sys/compat/linuxkpi/common/include/asm/io.h
@@ -31,6 +31,13 @@
#ifndef _LINUXKPI_ASM_IO_H_
#define _LINUXKPI_ASM_IO_H_
+#include <sys/param.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
#include <linux/io.h>
+#define virt_to_phys(x) vtophys(x)
+
#endif /* _LINUXKPI_ASM_IO_H_ */
diff --git a/sys/compat/linuxkpi/common/include/asm/processor.h b/sys/compat/linuxkpi/common/include/asm/processor.h
index 450192750612..86d4ab9de98f 100644
--- a/sys/compat/linuxkpi/common/include/asm/processor.h
+++ b/sys/compat/linuxkpi/common/include/asm/processor.h
@@ -36,11 +36,12 @@
struct cpuinfo_x86 {
uint8_t x86;
uint16_t x86_clflush_size;
+ uint16_t x86_max_cores;
};
-#define cpu_relax() cpu_spinwait()
-
extern struct cpuinfo_x86 boot_cpu_data;
#endif
+#define cpu_relax() cpu_spinwait()
+
#endif /* _LINUXKPI_ASM_PROCESSOR_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/cpu.h b/sys/compat/linuxkpi/common/include/linux/cpu.h
index 53fa9db424c2..08e59b33e53a 100644
--- a/sys/compat/linuxkpi/common/include/linux/cpu.h
+++ b/sys/compat/linuxkpi/common/include/linux/cpu.h
@@ -44,6 +44,8 @@ typedef cpuset_t cpumask_t;
extern cpumask_t cpu_online_mask;
+cpumask_t *lkpi_get_static_single_cpu_mask(int);
+
static __inline int
cpumask_next(int cpuid, cpumask_t mask)
{
@@ -73,4 +75,6 @@ cpumask_set_cpu(int cpu, cpumask_t *mask)
CPU_SET(cpu, mask);
}
+#define cpumask_of(_cpu) (lkpi_get_static_single_cpu_mask(_cpu))
+
#endif /* _LINUXKPI_LINUX_CPU_H */
diff --git a/sys/compat/linuxkpi/common/include/linux/debugfs.h b/sys/compat/linuxkpi/common/include/linux/debugfs.h
index ba1fa009dc62..4c9f52a0bc0f 100644
--- a/sys/compat/linuxkpi/common/include/linux/debugfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/debugfs.h
@@ -47,6 +47,11 @@ struct debugfs_regset32 {
int nregs;
};
+struct debugfs_blob_wrapper {
+ void *data;
+ size_t size;
+};
+
struct dentry *debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops);
@@ -75,8 +80,12 @@ void debugfs_remove_recursive(struct dentry *dentry);
void debugfs_create_bool(const char *name, umode_t mode, struct dentry *parent,
bool *value);
-
+void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent,
+ uint8_t *value);
void debugfs_create_ulong(const char *name, umode_t mode, struct dentry *parent,
unsigned long *value);
+struct dentry *debugfs_create_blob(const char *name, umode_t mode,
+ struct dentry *parent, struct debugfs_blob_wrapper *value);
+
#endif /* _LINUXKPI_LINUX_DEBUGFS_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index 32195ad5b0a6..720a2019c0f0 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -127,6 +127,8 @@ struct device {
spinlock_t devres_lock;
struct list_head devres_head;
+
+ struct dev_pm_info power;
};
extern struct device linux_root_device;
@@ -204,6 +206,14 @@ show_class_attr_string(struct class *class,
} \
} while (0)
+#define dev_warn_once(dev, ...) do { \
+ static bool __dev_warn_once; \
+ if (!__dev_warn_once) { \
+ __dev_warn_once = 1; \
+ dev_warn(dev, __VA_ARGS__); \
+ } \
+} while (0)
+
#define dev_err_once(dev, ...) do { \
static bool __dev_err_once; \
if (!__dev_err_once) { \
diff --git a/sys/compat/linuxkpi/common/include/linux/dma-buf-map.h b/sys/compat/linuxkpi/common/include/linux/dma-buf-map.h
new file mode 100644
index 000000000000..567ce3b072b3
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/dma-buf-map.h
@@ -0,0 +1,91 @@
+/* Public domain. */
+
+#ifndef _LINUX_DMA_BUF_MAP_H
+#define _LINUX_DMA_BUF_MAP_H
+
+#include <linux/io.h>
+#include <linux/string.h>
+
+struct dma_buf_map {
+ union {
+ void *vaddr_iomem;
+ void *vaddr;
+ };
+ bool is_iomem;
+};
+
+static inline void
+dma_buf_map_incr(struct dma_buf_map *dbm, size_t n)
+{
+ if (dbm->is_iomem)
+ dbm->vaddr_iomem += n;
+ else
+ dbm->vaddr += n;
+}
+
+static inline void
+dma_buf_map_memcpy_to(struct dma_buf_map *dbm, const void *src, size_t len)
+{
+ if (dbm->is_iomem)
+ memcpy_toio(dbm->vaddr_iomem, src, len);
+ else
+ memcpy(dbm->vaddr, src, len);
+}
+
+static inline bool
+dma_buf_map_is_null(const struct dma_buf_map *dbm)
+{
+ if (dbm->is_iomem)
+ return (dbm->vaddr_iomem == NULL);
+ else
+ return (dbm->vaddr == NULL);
+}
+
+static inline bool
+dma_buf_map_is_set(const struct dma_buf_map *dbm)
+{
+ if (dbm->is_iomem)
+ return (dbm->vaddr_iomem != NULL);
+ else
+ return (dbm->vaddr != NULL);
+}
+
+static inline bool
+dma_buf_map_is_equal(
+ const struct dma_buf_map *dbm_a, const struct dma_buf_map *dbm_b)
+{
+ if (dbm_a->is_iomem != dbm_b->is_iomem)
+ return (false);
+
+ if (dbm_a->is_iomem)
+ return (dbm_a->vaddr_iomem == dbm_b->vaddr_iomem);
+ else
+ return (dbm_a->vaddr == dbm_b->vaddr);
+}
+
+static inline void
+dma_buf_map_clear(struct dma_buf_map *dbm)
+{
+ if (dbm->is_iomem) {
+ dbm->vaddr_iomem = NULL;
+ dbm->is_iomem = false;
+ } else {
+ dbm->vaddr = NULL;
+ }
+}
+
+static inline void
+dma_buf_map_set_vaddr_iomem(struct dma_buf_map *dbm, void *addr)
+{
+ dbm->vaddr_iomem = addr;
+ dbm->is_iomem = true;
+}
+
+static inline void
+dma_buf_map_set_vaddr(struct dma_buf_map *dbm, void *addr)
+{
+ dbm->vaddr = addr;
+ dbm->is_iomem = false;
+}
+
+#endif
diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
index 8401006fbf5f..d3d25fcce857 100644
--- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
@@ -288,11 +288,15 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
{
}
+#define DMA_MAPPING_ERROR (~(dma_addr_t)0)
+
static inline int
dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
- return (dma_addr == 0);
+ if (dma_addr == 0 || dma_addr == DMA_MAPPING_ERROR)
+ return (-ENOMEM);
+ return (0);
}
static inline unsigned int dma_set_max_seg_size(struct device *dev,
diff --git a/sys/compat/linuxkpi/common/include/linux/dmi.h b/sys/compat/linuxkpi/common/include/linux/dmi.h
index 339f622f89b2..a3514c66f9cd 100644
--- a/sys/compat/linuxkpi/common/include/linux/dmi.h
+++ b/sys/compat/linuxkpi/common/include/linux/dmi.h
@@ -34,6 +34,12 @@
#include <sys/types.h>
#include <linux/mod_devicetable.h>
+struct dmi_header {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+};
+
int linux_dmi_check_system(const struct dmi_system_id *);
bool linux_dmi_match(enum dmi_field, const char *);
const struct dmi_system_id *linux_dmi_first_match(const struct dmi_system_id *);
@@ -44,4 +50,11 @@ const char *linux_dmi_get_system_info(int);
#define dmi_first_match(sysid) linux_dmi_first_match(sysid)
#define dmi_get_system_info(sysid) linux_dmi_get_system_info(sysid)
+static inline int
+dmi_walk(void (*callbackf)(const struct dmi_header *, void *), void *arg)
+{
+
+ return (-ENXIO);
+}
+
#endif /* __LINUXKPI_LINUX_DMI_H__ */
diff --git a/sys/compat/linuxkpi/common/include/linux/efi.h b/sys/compat/linuxkpi/common/include/linux/efi.h
index 03702bba557a..a485b4b1fd94 100644
--- a/sys/compat/linuxkpi/common/include/linux/efi.h
+++ b/sys/compat/linuxkpi/common/include/linux/efi.h
@@ -29,6 +29,7 @@
#define _LINUXKPI_LINUX_EFI_H_
#include <sys/param.h>
+#include <sys/queue.h>
#include <sys/linker.h>
#include <sys/systm.h>
diff --git a/sys/compat/linuxkpi/common/include/linux/ethtool.h b/sys/compat/linuxkpi/common/include/linux/ethtool.h
index 9195766f752d..99f5219d0187 100644
--- a/sys/compat/linuxkpi/common/include/linux/ethtool.h
+++ b/sys/compat/linuxkpi/common/include/linux/ethtool.h
@@ -32,10 +32,28 @@
#include <linux/types.h>
-#define ETHTOOL_FWVERS_LEN 64
+#define ETH_GSTRING_LEN (2 * IF_NAMESIZE) /* Increase if not large enough */
+
+#define ETHTOOL_FWVERS_LEN 32
struct ethtool_stats {
uint8_t __dummy[0];
};
+enum ethtool_ss {
+ ETH_SS_STATS,
+};
+
+struct ethtool_drvinfo {
+ char driver[32];
+ char version[32];
+ char fw_version[ETHTOOL_FWVERS_LEN];
+ char bus_info[32];
+};
+
+struct net_device;
+struct ethtool_ops {
+ void(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
+};
+
#endif /* _LINUXKPI_LINUX_ETHTOOL_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h
index 55c2ee3e00c6..656b81b7be36 100644
--- a/sys/compat/linuxkpi/common/include/linux/fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/fs.h
@@ -307,6 +307,12 @@ default_llseek(struct file *file, loff_t offset, int whence)
}
static inline loff_t
+generic_file_llseek(struct file *file, loff_t offset, int whence)
+{
+ return (no_llseek(file, offset, whence));
+}
+
+static inline loff_t
noop_llseek(struct linux_file *file, loff_t offset, int whence)
{
diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h
index 6273fa969db8..63b23b4b637e 100644
--- a/sys/compat/linuxkpi/common/include/linux/gfp.h
+++ b/sys/compat/linuxkpi/common/include/linux/gfp.h
@@ -47,6 +47,7 @@
#define __GFP_HIGHMEM 0
#define __GFP_ZERO M_ZERO
#define __GFP_NORETRY 0
+#define __GFP_NOMEMALLOC 0
#define __GFP_RECLAIM 0
#define __GFP_RECLAIMABLE 0
#define __GFP_RETRY_MAYFAIL 0
diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index 5a29137d0510..fef68bda4882 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -282,6 +282,9 @@ struct ieee80211_ht_cap {
};
#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
+#define IEEE80211_HE_HT_MAX_AMPDU_FACTOR 16
+#define IEEE80211_HE_VHT_MAX_AMPDU_FACTOR 20
+#define IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR 13
enum ieee80211_ht_max_ampdu_len {
IEEE80211_HT_MAX_AMPDU_64K
@@ -347,11 +350,11 @@ enum ieee80211_smps_mode {
/* net80211::IEEE80211_S_* different but represents the state machine. */
/* Note: order here is important! */
enum ieee80211_sta_state {
- IEEE80211_STA_NOTEXIST,
- IEEE80211_STA_NONE,
- IEEE80211_STA_AUTH,
- IEEE80211_STA_ASSOC,
- IEEE80211_STA_AUTHORIZED, /* 802.1x */
+ IEEE80211_STA_NOTEXIST = 0,
+ IEEE80211_STA_NONE = 1,
+ IEEE80211_STA_AUTH = 2,
+ IEEE80211_STA_ASSOC = 3,
+ IEEE80211_STA_AUTHORIZED = 4, /* 802.1x */
};
enum ieee80211_sta_rx_bw {
@@ -550,7 +553,7 @@ enum ieee80211_eid {
WLAN_EID_MULTI_BSSID_IDX = 85,
WLAN_EID_EXT_CAPABILITY = 127,
WLAN_EID_VHT_CAPABILITY = 191, /* IEEE80211_ELEMID_VHT_CAP */
- WLAN_EID_VENDOR_SPECIFIC = 221,
+ WLAN_EID_VENDOR_SPECIFIC = 221, /* IEEE80211_ELEMID_VENDOR */
};
enum ieee80211_eid_ext {
diff --git a/sys/compat/linuxkpi/common/include/linux/if_ether.h b/sys/compat/linuxkpi/common/include/linux/if_ether.h
index c27583e62ebd..cb3e34a0823f 100644
--- a/sys/compat/linuxkpi/common/include/linux/if_ether.h
+++ b/sys/compat/linuxkpi/common/include/linux/if_ether.h
@@ -71,6 +71,4 @@ struct ethhdr {
uint16_t h_proto;
} __packed;
-#define ETH_GSTRING_LEN (2 * IF_NAMESIZE) /* Increase if not large enough */
-
#endif /* _LINUXKPI_LINUX_IF_ETHER_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h
index 905a29a77f91..4c914a7b45a1 100644
--- a/sys/compat/linuxkpi/common/include/linux/interrupt.h
+++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h
@@ -71,6 +71,14 @@ request_threaded_irq(int irq, irq_handler_t handler,
}
static inline int
+devm_request_irq(struct device *dev, int irq,
+ irq_handler_t handler, unsigned long flags, const char *name, void *arg)
+{
+
+ return (lkpi_request_irq(dev, irq, handler, NULL, flags, name, arg));
+}
+
+static inline int
devm_request_threaded_irq(struct device *dev, int irq,
irq_handler_t handler, irq_handler_t thread_handler,
unsigned long flags, const char *name, void *arg)
@@ -126,7 +134,9 @@ irq_set_affinity_hint(int vector, cpumask_t *mask)
/*
* LinuxKPI tasklet support
*/
+struct tasklet_struct;
typedef void tasklet_func_t(unsigned long);
+typedef void tasklet_callback_t(struct tasklet_struct *);
struct tasklet_struct {
TAILQ_ENTRY(tasklet_struct) entry;
@@ -135,6 +145,8 @@ struct tasklet_struct {
volatile u_int tasklet_state;
atomic_t count;
unsigned long data;
+ tasklet_callback_t *callback;
+ bool use_callback;
};
#define DECLARE_TASKLET(_name, _func, _data) \
@@ -142,6 +154,11 @@ struct tasklet_struct _name = { .func = (_func), .data = (_data) }
#define tasklet_hi_schedule(t) tasklet_schedule(t)
+/* Some other compat code in the tree has this defined as well. */
+#define from_tasklet(_dev, _t, _field) \
+ container_of(_t, typeof(*(_dev)), _field)
+
+void tasklet_setup(struct tasklet_struct *, tasklet_callback_t *);
extern void tasklet_schedule(struct tasklet_struct *);
extern void tasklet_kill(struct tasklet_struct *);
extern void tasklet_init(struct tasklet_struct *, tasklet_func_t *,
diff --git a/sys/compat/linuxkpi/common/include/linux/irq_work.h b/sys/compat/linuxkpi/common/include/linux/irq_work.h
index ec71a7ee094f..a263d730967b 100644
--- a/sys/compat/linuxkpi/common/include/linux/irq_work.h
+++ b/sys/compat/linuxkpi/common/include/linux/irq_work.h
@@ -51,7 +51,12 @@ typedef void (*irq_work_func_t)(struct irq_work *);
struct irq_work {
struct task irq_task;
- struct llist_node llnode;
+ union {
+ struct llist_node llnode;
+ struct {
+ struct llist_node llist;
+ } node;
+ };
irq_work_func_t func;
};
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 2c40b2f33c41..3ae8f31832fd 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -577,6 +577,8 @@ kstrtou8_from_user(const char __user *s, size_t count, unsigned int base,
#define offsetofend(t, m) \
(offsetof(t, m) + sizeof((((t *)0)->m)))
+#define typeof_member(s, e) typeof(((s *)0)->e)
+
#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max)
#define clamp(x, lo, hi) min( max(x,lo), hi)
#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
diff --git a/sys/compat/linuxkpi/common/include/linux/leds.h b/sys/compat/linuxkpi/common/include/linux/leds.h
new file mode 100644
index 000000000000..f7ee7a68dcf5
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/leds.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 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_LINUX_LEDS_H
+#define _LINUXKPI_LINUX_LEDS_H
+
+enum led_brightness {
+ __DUMMY,
+};
+
+struct led_classdev {
+ const char *name;
+ const char *default_trigger;
+ int (*blink_set)(struct led_classdev *, unsigned long *, unsigned long *);
+ void (*brightness_set)(struct led_classdev *, enum led_brightness);
+};
+
+#endif /* _LINUXKPI_LINUX_LEDS_H */
diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index a266b5913625..930d588902af 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -40,6 +40,7 @@
#include <linux/pfn.h>
#include <linux/list.h>
#include <linux/mmap_lock.h>
+#include <linux/shrinker.h>
#include <asm/pgtable.h>
@@ -310,4 +311,6 @@ void lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused,
#define PAGE_ALIGNED(p) __is_aligned(p, PAGE_SIZE)
+void vma_set_file(struct vm_area_struct *vma, struct linux_file *file);
+
#endif /* _LINUXKPI_LINUX_MM_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/mman.h b/sys/compat/linuxkpi/common/include/linux/mman.h
new file mode 100644
index 000000000000..eff80759b4cd
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/mman.h
@@ -0,0 +1,38 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2022 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
+ *
+ * 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 _LINUX_MMAN_H
+#define _LINUX_MMAN_H
+
+/*
+ * In Linux, <linux/mman.h> includes <linux/percpu_counter.h>, which includes
+ * <linux/smp.h>.
+ */
+#include <linux/smp.h>
+
+#endif /* _LINUX_MMAN_H */
diff --git a/sys/compat/linuxkpi/common/include/linux/mmzone.h b/sys/compat/linuxkpi/common/include/linux/mmzone.h
new file mode 100644
index 000000000000..49cc218c6fce
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/mmzone.h
@@ -0,0 +1,11 @@
+/* Public domain. */
+
+#ifndef _LINUX_MMZONE_H
+#define _LINUX_MMZONE_H
+
+#include <linux/mm_types.h>
+#include <linux/page-flags.h>
+
+#define MAX_ORDER 11
+
+#endif
diff --git a/sys/compat/linuxkpi/common/include/linux/moduleparam.h b/sys/compat/linuxkpi/common/include/linux/moduleparam.h
index d9485de88f56..ebf3b7a95c02 100644
--- a/sys/compat/linuxkpi/common/include/linux/moduleparam.h
+++ b/sys/compat/linuxkpi/common/include/linux/moduleparam.h
@@ -90,6 +90,12 @@
LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \
LINUXKPI_PARAM_DESC(name)))
+#define LINUXKPI_PARAM_hexint(name, var, perm) \
+ extern const char LINUXKPI_PARAM_DESC(name)[]; \
+ LINUXKPI_PARAM_PASS(SYSCTL_UINT(LINUXKPI_PARAM_PARENT, OID_AUTO, \
+ LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \
+ LINUXKPI_PARAM_DESC(name)))
+
#define LINUXKPI_PARAM_long(name, var, perm) \
extern const char LINUXKPI_PARAM_DESC(name)[]; \
LINUXKPI_PARAM_PASS(SYSCTL_LONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \
diff --git a/sys/compat/linuxkpi/common/include/linux/mutex.h b/sys/compat/linuxkpi/common/include/linux/mutex.h
index 7af95e9d2dc5..3490c6e59a70 100644
--- a/sys/compat/linuxkpi/common/include/linux/mutex.h
+++ b/sys/compat/linuxkpi/common/include/linux/mutex.h
@@ -36,6 +36,8 @@
#include <sys/lock.h>
#include <sys/sx.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h
index a904b7e70490..fdfd650a55e5 100644
--- a/sys/compat/linuxkpi/common/include/linux/netdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h
@@ -229,7 +229,7 @@ struct napi_struct {
void linuxkpi_init_dummy_netdev(struct net_device *);
void linuxkpi_netif_napi_add(struct net_device *, struct napi_struct *,
- int(*napi_poll)(struct napi_struct *, int), int);
+ int(*napi_poll)(struct napi_struct *, int));
void linuxkpi_netif_napi_del(struct napi_struct *);
bool linuxkpi_napi_schedule_prep(struct napi_struct *);
void linuxkpi___napi_schedule(struct napi_struct *);
@@ -243,8 +243,8 @@ void linuxkpi_napi_synchronize(struct napi_struct *);
#define init_dummy_netdev(_n) \
linuxkpi_init_dummy_netdev(_n)
-#define netif_napi_add(_nd, _ns, _p, _b) \
- linuxkpi_netif_napi_add(_nd, _ns, _p, _b)
+#define netif_napi_add(_nd, _ns, _p) \
+ linuxkpi_netif_napi_add(_nd, _ns, _p)
#define netif_napi_del(_n) \
linuxkpi_netif_napi_del(_n)
#define napi_schedule_prep(_n) \
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
index f8de2eedf1b7..76f97b1faaea 100644
--- a/sys/compat/linuxkpi/common/include/linux/nl80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -248,6 +248,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_TX_BITRATE,
NL80211_STA_INFO_TX_PACKETS,
NL80211_STA_INFO_TX_BYTES,
+ NL80211_STA_INFO_TX_BYTES64,
NL80211_STA_INFO_TX_FAILED,
NL80211_STA_INFO_TX_RETRIES,
NL80211_STA_INFO_RX_DURATION,
@@ -334,6 +335,10 @@ enum nl80211_dfs_regions {
NL80211_DFS_JP,
};
+enum nl80211_dfs_state {
+ NL80211_DFS_USABLE,
+};
+
enum nl80211_sar_type {
NL80211_SAR_TYPE_POWER,
};
@@ -373,6 +378,10 @@ enum nl80211_probe_resp_offload_support {
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P,
};
+enum nl80211_user_reg_hint_type {
+ NL80211_USER_REG_HINT_USER,
+};
+
#define NL80211_KCK_LEN 16
#define NL80211_KCK_EXT_LEN 24
#define NL80211_KEK_LEN 16
diff --git a/sys/compat/linuxkpi/common/include/linux/page-flags.h b/sys/compat/linuxkpi/common/include/linux/page-flags.h
new file mode 100644
index 000000000000..9dd49c8492a5
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/page-flags.h
@@ -0,0 +1,34 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2022 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
+ *
+ * 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_LINUX_PAGEFLAGS_H_
+#define _LINUXKPI_LINUX_PAGEFLAGS_H_
+
+#define PageHighMem(p) (0)
+
+#endif /* _LINUXKPI_LINUX_PAGEFLAGS_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 34076e0ff1d5..20f9b917fbdc 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -161,6 +161,11 @@ MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \
#define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */
#define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */
+#define PCI_MSI_ADDRESS_LO PCIR_MSI_ADDR
+#define PCI_MSI_ADDRESS_HI PCIR_MSI_ADDR_HIGH
+#define PCI_MSI_FLAGS PCIR_MSI_CTRL
+#define PCI_MSI_FLAGS_ENABLE PCIM_MSICTRL_MSI_ENABLE
+
#define PCI_EXP_LNKCAP_CLKPM 0x00040000
#define PCI_EXP_DEVSTA_TRPND 0x0020
@@ -202,6 +207,8 @@ typedef int pci_power_t;
#define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN
+extern const char *pci_power_names[6];
+
#define PCI_ERR_ROOT_COMMAND PCIR_AER_ROOTERR_CMD
#define PCI_ERR_ROOT_ERR_SRC PCIR_AER_COR_SOURCE_ID
@@ -288,6 +295,7 @@ struct pci_dev {
struct pci_driver *pdrv;
struct pci_bus *bus;
struct pci_dev *root;
+ pci_power_t current_state;
uint16_t device;
uint16_t vendor;
uint16_t subsystem_vendor;
@@ -935,6 +943,13 @@ lkpi_pci_restore_state(struct pci_dev *pdev)
#define pci_save_state(dev) lkpi_pci_save_state(dev)
#define pci_restore_state(dev) lkpi_pci_restore_state(dev)
+static inline int
+pci_reset_function(struct pci_dev *pdev)
+{
+
+ return (-ENOSYS);
+}
+
#define DEFINE_PCI_DEVICE_TABLE(_table) \
const struct pci_device_id _table[] __devinitdata
@@ -1576,6 +1591,17 @@ pci_ignore_hotplug(struct pci_dev *pdev)
{
}
+static inline const char *
+pci_power_name(pci_power_t state)
+{
+ int pstate = state + 1;
+
+ if (pstate >= 0 && pstate < nitems(pci_power_names))
+ return (pci_power_names[pstate]);
+ else
+ return (pci_power_names[0]);
+}
+
static inline int
pcie_get_readrq(struct pci_dev *dev)
{
@@ -1587,4 +1613,12 @@ pcie_get_readrq(struct pci_dev *dev)
return (128 << ((ctl & PCI_EXP_DEVCTL_READRQ) >> 12));
}
+static inline bool
+pci_is_enabled(struct pci_dev *pdev)
+{
+
+ return ((pci_read_config(pdev->dev.bsddev, PCIR_COMMAND, 2) &
+ PCIM_CMD_BUSMASTEREN) != 0);
+}
+
#endif /* _LINUXKPI_LINUX_PCI_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h
index d67cebb9764a..d054a95f17a3 100644
--- a/sys/compat/linuxkpi/common/include/linux/pm.h
+++ b/sys/compat/linuxkpi/common/include/linux/pm.h
@@ -33,6 +33,8 @@
#ifndef _LINUXKPI_LINUX_PM_H
#define _LINUXKPI_LINUX_PM_H
+#include <asm/atomic.h>
+
/* Needed but breaks linux_usb.c */
/* #include <linux/completion.h> */
/* #include <linux/wait.h> */
@@ -44,6 +46,10 @@ typedef struct pm_message {
struct dev_pm_domain {
};
+struct dev_pm_info {
+ atomic_t usage_count;
+};
+
#define PM_EVENT_FREEZE 0x0001
#define PM_EVENT_SUSPEND 0x0002
diff --git a/sys/compat/linuxkpi/common/include/linux/rculist.h b/sys/compat/linuxkpi/common/include/linux/rculist.h
index e0c3f79d9e5a..305c425574b4 100644
--- a/sys/compat/linuxkpi/common/include/linux/rculist.h
+++ b/sys/compat/linuxkpi/common/include/linux/rculist.h
@@ -44,6 +44,11 @@
&(pos)->member != (head); \
pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member))
+#define list_for_each_entry_from_rcu(pos, head, member) \
+ for (; \
+ &(pos)->member != (head); \
+ pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member))
+
#define list_for_each_entry_lockless(pos, head, member) \
list_for_each_entry_rcu(pos, head, member)
diff --git a/sys/compat/linuxkpi/common/include/linux/seq_file.h b/sys/compat/linuxkpi/common/include/linux/seq_file.h
index e925c6d8c2ae..8fb93646f9a5 100644
--- a/sys/compat/linuxkpi/common/include/linux/seq_file.h
+++ b/sys/compat/linuxkpi/common/include/linux/seq_file.h
@@ -69,6 +69,9 @@ struct seq_operations {
ssize_t seq_read(struct linux_file *, char *, size_t, off_t *);
int seq_write(struct seq_file *seq, const void *data, size_t len);
+void *__seq_open_private(struct linux_file *, const struct seq_operations *, int);
+int seq_release_private(struct inode *, struct linux_file *);
+
int seq_open(struct linux_file *f, const struct seq_operations *op);
int seq_release(struct inode *inode, struct linux_file *file);
diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index d3a795344f86..35d5a1fd9b80 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -143,7 +143,8 @@ struct sk_buff {
uint16_t l4hdroff; /* transport header offset from *head */
uint32_t priority;
uint16_t qmap; /* queue mapping */
- uint16_t _spareu16_0;
+ uint16_t _flags; /* Internal flags. */
+#define _SKB_FLAGS_SKBEXTFRAG 0x0001
enum sk_buff_pkt_type pkt_type;
/* "Scratch" area for layers to store metadata. */
@@ -174,6 +175,7 @@ struct sk_buff {
struct sk_buff *linuxkpi_alloc_skb(size_t, gfp_t);
struct sk_buff *linuxkpi_dev_alloc_skb(size_t, gfp_t);
+struct sk_buff *linuxkpi_build_skb(void *, size_t);
void linuxkpi_kfree_skb(struct sk_buff *);
struct sk_buff *linuxkpi_skb_copy(struct sk_buff *, gfp_t);
@@ -241,6 +243,16 @@ dev_kfree_skb_irq(struct sk_buff *skb)
dev_kfree_skb(skb);
}
+static inline struct sk_buff *
+build_skb(void *data, unsigned int fragsz)
+{
+ struct sk_buff *skb;
+
+ skb = linuxkpi_build_skb(data, fragsz);
+ SKB_TRACE(skb);
+ return (skb);
+}
+
/* -------------------------------------------------------------------------- */
/* XXX BZ review this one for terminal condition as Linux "queues" are special. */
@@ -467,6 +479,7 @@ skb_add_rx_frag(struct sk_buff *skb, int fragno, struct page *page,
shinfo->frags[fragno].size = size;
shinfo->nr_frags = fragno + 1;
skb->len += size;
+ skb->data_len += size;
skb->truesize += truesize;
/* XXX TODO EXTEND truesize? */
@@ -559,6 +572,18 @@ skb_queue_tail(struct sk_buff_head *q, struct sk_buff *skb)
}
static inline struct sk_buff *
+skb_peek(struct sk_buff_head *q)
+{
+ struct sk_buff *skb;
+
+ skb = q->next;
+ SKB_TRACE2(q, skb);
+ if (skb == (struct sk_buff *)q)
+ return (NULL);
+ return (skb);
+}
+
+static inline struct sk_buff *
skb_peek_tail(struct sk_buff_head *q)
{
struct sk_buff *skb;
@@ -736,13 +761,6 @@ skb_frag_size(const skb_frag_t *frag)
return (-1);
}
-static inline bool
-skb_is_nonlinear(struct sk_buff *skb)
-{
- SKB_TRACE(skb);
- return ((skb->data_len > 0) ? true : false);
-}
-
#define skb_walk_frags(_skb, _frag) \
for ((_frag) = (_skb); false; (_frag)++)
@@ -847,6 +865,13 @@ skb_network_header(struct sk_buff *skb)
return (skb->head + skb->l3hdroff);
}
+static inline bool
+skb_is_nonlinear(struct sk_buff *skb)
+{
+ SKB_TRACE(skb);
+ return ((skb->data_len > 0) ? true : false);
+}
+
static inline int
__skb_linearize(struct sk_buff *skb)
{
@@ -856,6 +881,13 @@ __skb_linearize(struct sk_buff *skb)
}
static inline int
+skb_linearize(struct sk_buff *skb)
+{
+
+ return (skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0);
+}
+
+static inline int
pskb_expand_head(struct sk_buff *skb, int x, int len, gfp_t gfp)
{
SKB_TRACE(skb);
@@ -910,14 +942,6 @@ skb_reset_mac_header(struct sk_buff *skb)
SKB_TODO();
}
-static inline struct sk_buff *
-skb_peek(struct sk_buff_head *q)
-{
- SKB_TRACE(q);
- SKB_TODO();
- return (NULL);
-}
-
static inline __sum16
csum_unfold(__sum16 sum)
{
@@ -936,7 +960,10 @@ skb_reset_tail_pointer(struct sk_buff *skb)
{
SKB_TRACE(skb);
+#ifdef SKB_DOING_OFFSETS_US_NOT
skb->tail = (uint8_t *)(uintptr_t)(skb->data - skb->head);
+#endif
+ skb->tail = skb->data;
SKB_TRACE(skb);
}
@@ -965,14 +992,6 @@ skb_copy_from_linear_data(const struct sk_buff *skb, void *dst, size_t len)
memcpy(dst, skb->data, len);
}
-static inline struct sk_buff *
-build_skb(void *data, unsigned int fragsz)
-{
-
- SKB_TODO();
- return (NULL);
-}
-
static inline int
skb_pad(struct sk_buff *skb, int pad)
{
@@ -998,15 +1017,6 @@ napi_consume_skb(struct sk_buff *skb, int budget)
SKB_TODO();
}
-static inline bool
-skb_linearize(struct sk_buff *skb)
-{
-
- SKB_TRACE(skb);
- SKB_TODO();
- return (false);
-}
-
#define SKB_WITH_OVERHEAD(_s) \
(_s) - ALIGN(sizeof(struct skb_shared_info), CACHE_LINE_SIZE)
diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h
index 16b5afcea693..915f33acf67e 100644
--- a/sys/compat/linuxkpi/common/include/linux/slab.h
+++ b/sys/compat/linuxkpi/common/include/linux/slab.h
@@ -90,6 +90,8 @@ struct linux_kmem_cache;
/* drm-kmod 5.4 compat */
#define kfree_async(ptr) kfree(ptr);
+#define ZERO_OR_NULL_PTR(x) ((x) == NULL)
+
static inline gfp_t
linux_check_m_flags(gfp_t flags)
{
@@ -178,6 +180,16 @@ krealloc(void *ptr, size_t size, gfp_t flags)
return (realloc(ptr, size, M_KMALLOC, linux_check_m_flags(flags)));
}
+static inline void *
+krealloc_array(void *ptr, size_t n, size_t size, gfp_t flags)
+{
+ if (WOULD_OVERFLOW(n, size)) {
+ return NULL;
+ }
+
+ return (realloc(ptr, n * size, M_KMALLOC, linux_check_m_flags(flags)));
+}
+
extern void linux_kfree_async(void *);
static inline void
diff --git a/sys/compat/linuxkpi/common/include/linux/smp.h b/sys/compat/linuxkpi/common/include/linux/smp.h
index c6d011fceb5f..581a5e6205b6 100644
--- a/sys/compat/linuxkpi/common/include/linux/smp.h
+++ b/sys/compat/linuxkpi/common/include/linux/smp.h
@@ -29,6 +29,8 @@
#ifndef _LINUXKPI_LINUX_SMP_H_
#define _LINUXKPI_LINUX_SMP_H_
+#include <asm/smp.h>
+
/*
* Important note about the use of the function provided below:
*
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index 52110feda6df..932bed81d034 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -236,4 +236,25 @@ memset_p(void **p, void *v, size_t n)
return (memset64((uint64_t *)p, (uintptr_t)v, n));
}
+static inline void
+memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
+{
+
+ if (len >= dstlen) {
+ memcpy(dst, src, dstlen);
+ } else {
+ memcpy(dst, src, len);
+ /* Pad with given padding character. */
+ memset((char *)dst + len, ch, dstlen - len);
+ }
+}
+
+#define memset_startat(ptr, bytepat, smember) \
+({ \
+ uint8_t *_ptr = (uint8_t *)(ptr); \
+ int _c = (int)(bytepat); \
+ size_t _o = offsetof(typeof(*(ptr)), smember); \
+ memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \
+})
+
#endif /* _LINUXKPI_LINUX_STRING_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h
index 0b6b479d9362..e6b8ad210f16 100644
--- a/sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -246,7 +246,7 @@ sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp)
struct attribute **attr;
struct sysctl_oid *oidp;
- SLIST_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp), oid_link) {
+ SYSCTL_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp)) {
if (strcmp(oidp->oid_name, grp->name) != 0)
continue;
for (attr = grp->attrs; *attr != NULL; attr++) {
diff --git a/sys/compat/linuxkpi/common/include/linux/time.h b/sys/compat/linuxkpi/common/include/linux/time.h
index c7a41a83f4aa..2b69ec46935c 100644
--- a/sys/compat/linuxkpi/common/include/linux/time.h
+++ b/sys/compat/linuxkpi/common/include/linux/time.h
@@ -28,6 +28,8 @@
#ifndef _LINUXKPI_LINUX_TIME_H_
#define _LINUXKPI_LINUX_TIME_H_
+#define MSEC_PER_SEC 1000L
+
#define NSEC_PER_USEC 1000L
#define NSEC_PER_MSEC 1000000L
#define NSEC_PER_SEC 1000000000L
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index 7995f633256f..e6f1bd88309d 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -173,9 +173,9 @@ struct ieee80211_rate {
};
struct ieee80211_sta_ht_cap {
- /* TODO FIXME */
- int ampdu_density, ampdu_factor;
bool ht_supported;
+ uint8_t ampdu_density;
+ uint8_t ampdu_factor;
uint16_t cap;
struct ieee80211_mcs_info mcs;
};
@@ -531,7 +531,7 @@ struct station_info {
int assoc_req_ies_len, connected_time;
int generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets;
int filled, rx_beacon, rx_beacon_signal_avg, signal_avg;
- int rx_duration, tx_failed, tx_retries;
+ int rx_duration, tx_duration, tx_failed, tx_retries;
int chains;
uint8_t chain_signal[IEEE80211_MAX_CHAINS];
@@ -652,7 +652,6 @@ struct linuxkpi_ieee80211_regdomain {
#define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x08
#define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x10
#define IEEE80211_HE_6GHZ_CAP_SM_PS 0x20
-#define IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR 0x40
#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x1
#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x2
@@ -756,6 +755,14 @@ struct linuxkpi_ieee80211_regdomain {
#define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x1
+#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x1
+#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 0x2
+
+#define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED 0x01
+#define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED 0x02
+#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT 0x04
+#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT 0x08
+
#define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT)
struct ieee80211_he_cap_elem {
@@ -791,9 +798,9 @@ struct ieee80211_he_obss_pd {
uint8_t min_offset;
uint8_t max_offset;
uint8_t non_srg_max_offset;
- uint8_t bss_color_bitmap;
- uint8_t partial_bssid_bitmap;
uint8_t sr_ctrl;
+ uint8_t bss_color_bitmap[8];
+ uint8_t partial_bssid_bitmap[8];
};
struct ieee80211_sta_he_6ghz_capa {
@@ -931,6 +938,7 @@ struct regulatory_request {
/* XXX TODO */
uint8_t alpha2[2];
int initiator, dfs_region;
+ int user_reg_hint_type;
};
enum wiphy_vendor_cmd_need_flags {
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 1dfc4d7506f6..75f2dac02be2 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -41,6 +41,7 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
+#include <linux/dcache.h>
#include <net/cfg80211.h>
#define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */
@@ -212,6 +213,17 @@ struct mac80211_fils_discovery {
uint32_t max_interval;
};
+struct ieee80211_chanctx_conf {
+ /* TODO FIXME */
+ int rx_chains_dynamic, rx_chains_static;
+ bool radar_enabled;
+ struct cfg80211_chan_def def;
+ struct cfg80211_chan_def min_def;
+
+ /* Must stay last. */
+ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
+};
+
#define WLAN_MEMBERSHIP_LEN (8)
#define WLAN_USER_POSITION_LEN (16)
@@ -228,6 +240,10 @@ struct ieee80211_bss_conf {
uint8_t membership[WLAN_MEMBERSHIP_LEN];
uint8_t position[WLAN_USER_POSITION_LEN];
} mu_group;
+ struct {
+ uint32_t params;
+ /* single field struct? */
+ } he_oper;
struct cfg80211_he_bss_color he_bss_color;
struct ieee80211_he_obss_pd he_obss_pd;
size_t ssid_len;
@@ -256,6 +272,7 @@ struct ieee80211_bss_conf {
int mcast_rate[NUM_NL80211_BANDS];
struct cfg80211_bitrate_mask beacon_tx_rate;
struct mac80211_fils_discovery fils_discovery;
+ struct ieee80211_chanctx_conf *chanctx_conf;
int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder;
int htc_trig_based_pkt_ext;
@@ -263,21 +280,10 @@ struct ieee80211_bss_conf {
int profile_periodicity;
int twt_requester, uora_exists, uora_ocw_range;
int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected;
- int he_oper, twt_responder, unsol_bcast_probe_resp_interval;
+ int twt_responder, unsol_bcast_probe_resp_interval;
int color_change_active;
};
-struct ieee80211_chanctx_conf {
- /* TODO FIXME */
- int rx_chains_dynamic, rx_chains_static;
- bool radar_enabled;
- struct cfg80211_chan_def def;
- struct cfg80211_chan_def min_def;
-
- /* Must stay last. */
- uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
-};
-
struct ieee80211_channel_switch {
/* TODO FIXME */
int block_tx, count, delay, device_timestamp, timestamp;
@@ -434,6 +440,7 @@ struct ieee80211_hw {
uint16_t uapsd_queues;
uint16_t max_tx_fragments;
uint16_t max_listen_interval;
+ uint32_t extra_beacon_tailroom;
netdev_features_t netdev_features;
unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
struct ieee80211_conf conf;
@@ -455,6 +462,7 @@ enum ieee802111_key_flag {
IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5),
IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6),
IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7),
+ IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(8),
};
struct ieee80211_key_conf {
@@ -615,13 +623,16 @@ struct ieee80211_link_sta {
#define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */
struct ieee80211_sta {
/* TODO FIXME */
- int max_amsdu_len, max_amsdu_subframes, max_rc_amsdu_len, max_sp;
- int mfp, smps_mode, tdls, tdls_initiator, uapsd_queues, wme;
+ int max_amsdu_len, max_amsdu_subframes, max_rc_amsdu_len;
+ int mfp, smps_mode, tdls, tdls_initiator;
struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */
struct ieee80211_sta_rates *rates; /* some rcu thing? */
uint32_t max_tid_amsdu_len[IEEE80211_NUM_TIDS];
uint8_t addr[ETH_ALEN];
uint16_t aid;
+ bool wme;
+ uint8_t max_sp;
+ uint8_t uapsd_queues;
struct ieee80211_link_sta deflink;
@@ -691,6 +702,10 @@ struct ieee80211_vif {
struct ieee80211_bss_conf bss_conf;
uint8_t hw_queue[IEEE80211_NUM_ACS];
+/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */
+ struct dentry *debugfs_dir;
+/* #endif */
+
/* Must stay last. */
uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
};
@@ -938,6 +953,10 @@ struct ieee80211_ops {
void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);
void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);
+
+/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */
+ void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
+/* #endif */
};
@@ -1451,6 +1470,13 @@ ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
linuxkpi_ieee80211_rx(hw, skb, NULL, NULL);
}
+static __inline void
+ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+
+ linuxkpi_ieee80211_rx(hw, skb, NULL, NULL);
+}
+
/* -------------------------------------------------------------------------- */
static __inline uint8_t
diff --git a/sys/compat/linuxkpi/common/include/net/regulatory.h b/sys/compat/linuxkpi/common/include/net/regulatory.h
index a7b31812e308..a020323ae7dd 100644
--- a/sys/compat/linuxkpi/common/include/net/regulatory.h
+++ b/sys/compat/linuxkpi/common/include/net/regulatory.h
@@ -32,6 +32,10 @@
#ifndef _LINUXKPI_NET_REGULATORY_H
#define _LINUXKPI_NET_REGULATORY_H
+enum environment_cap {
+ ENVIRON_INDOOR = 1, /* keep != 0 */
+};
+
#define REG_RULE(_begin, _end, _bw, _mag, _meirp, _flags) \
{ \
.flags = (_flags), \