aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r--sys/compat/linuxkpi/common/include/acpi/actbl.h1
-rw-r--r--sys/compat/linuxkpi/common/include/asm/atomic.h5
-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.h13
-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.h9
-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.h57
-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/seqlock.h91
-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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.c118
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.h23
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211_macops.c48
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c37
-rw-r--r--sys/compat/linuxkpi/common/src/linux_netdev.c4
-rw-r--r--sys/compat/linuxkpi/common/src/linux_pci.c4
-rw-r--r--sys/compat/linuxkpi/common/src/linux_seq_file.c33
-rw-r--r--sys/compat/linuxkpi/common/src/linux_skbuff.c33
-rw-r--r--sys/compat/linuxkpi/common/src/linux_tasklet.c20
-rw-r--r--sys/compat/linuxkpi/dummy/include/linux/timekeeping.h0
53 files changed, 909 insertions, 152 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..bdd02e0e4f55 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(...)
@@ -220,6 +218,7 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
__ret.val; \
})
+#define cmpxchg64(...) cmpxchg(__VA_ARGS__)
#define cmpxchg_relaxed(...) cmpxchg(__VA_ARGS__)
#define xchg(ptr, new) ({ \
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..01395cc7a0d5 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,
@@ -357,8 +361,13 @@ dma_map_sgtable(struct device *dev, struct sg_table *sgt,
enum dma_data_direction dir,
unsigned long attrs)
{
+ int nents;
- return (dma_map_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs));
+ nents = dma_map_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs);
+ if (nents < 0)
+ return (nents);
+ sgt->nents = nents;
+ return (0);
}
static inline void
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..b5c6ef95637c 100644
--- a/sys/compat/linuxkpi/common/include/linux/moduleparam.h
+++ b/sys/compat/linuxkpi/common/include/linux/moduleparam.h
@@ -90,6 +90,15 @@
LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \
LINUXKPI_PARAM_DESC(name)))
+#define LINUXKPI_PARAM_bint(name, var, perm) \
+ LINUXKPI_PARAM_int(name, var, perm)
+
+#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..4b9f02497a59 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -145,22 +145,32 @@ MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \
#define PCI_EXP_TYPE_RC_EC PCIEM_TYPE_ROOT_EC /* Root Complex Event Collector */
#define PCI_EXP_LNKCAP_SLS_2_5GB 0x01 /* Supported Link Speed 2.5GT/s */
#define PCI_EXP_LNKCAP_SLS_5_0GB 0x02 /* Supported Link Speed 5.0GT/s */
-#define PCI_EXP_LNKCAP_SLS_8_0GB 0x04 /* Supported Link Speed 8.0GT/s */
-#define PCI_EXP_LNKCAP_SLS_16_0GB 0x08 /* Supported Link Speed 16.0GT/s */
+#define PCI_EXP_LNKCAP_SLS_8_0GB 0x03 /* Supported Link Speed 8.0GT/s */
+#define PCI_EXP_LNKCAP_SLS_16_0GB 0x04 /* Supported Link Speed 16.0GT/s */
+#define PCI_EXP_LNKCAP_SLS_32_0GB 0x05 /* Supported Link Speed 32.0GT/s */
+#define PCI_EXP_LNKCAP_SLS_64_0GB 0x06 /* Supported Link Speed 64.0GT/s */
#define PCI_EXP_LNKCAP_MLW 0x03f0 /* Maximum Link Width */
#define PCI_EXP_LNKCAP2_SLS_2_5GB 0x02 /* Supported Link Speed 2.5GT/s */
#define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */
#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */
#define PCI_EXP_LNKCAP2_SLS_16_0GB 0x10 /* Supported Link Speed 16.0GT/s */
+#define PCI_EXP_LNKCAP2_SLS_32_0GB 0x20 /* Supported Link Speed 32.0GT/s */
+#define PCI_EXP_LNKCAP2_SLS_64_0GB 0x40 /* Supported Link Speed 64.0GT/s */
#define PCI_EXP_LNKCTL2_TLS 0x000f
#define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */
#define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */
#define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */
#define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */
#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */
+#define PCI_EXP_LNKCTL2_TLS_64_0GT 0x0006 /* Supported Speed 64GT/s */
#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
@@ -174,6 +184,8 @@ enum pci_bus_speed {
PCIE_SPEED_5_0GT,
PCIE_SPEED_8_0GT,
PCIE_SPEED_16_0GT,
+ PCIE_SPEED_32_0GT,
+ PCIE_SPEED_64_0GT,
};
enum pcie_link_width {
@@ -202,6 +214,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 +302,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 +950,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
@@ -1233,6 +1255,10 @@ pcie_get_speed_cap(struct pci_dev *dev)
return (PCIE_SPEED_8_0GT);
if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_16_0GB)
return (PCIE_SPEED_16_0GT);
+ if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_32_0GB)
+ return (PCIE_SPEED_32_0GT);
+ if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_64_0GB)
+ return (PCIE_SPEED_64_0GT);
} else { /* pre-r3.0 */
lnkcap = pci_read_config(root, pos + PCIER_LINK_CAP, 4);
if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
@@ -1243,6 +1269,10 @@ pcie_get_speed_cap(struct pci_dev *dev)
return (PCIE_SPEED_8_0GT);
if (lnkcap & PCI_EXP_LNKCAP_SLS_16_0GB)
return (PCIE_SPEED_16_0GT);
+ if (lnkcap & PCI_EXP_LNKCAP_SLS_32_0GB)
+ return (PCIE_SPEED_32_0GT);
+ if (lnkcap & PCI_EXP_LNKCAP_SLS_64_0GB)
+ return (PCIE_SPEED_64_0GT);
}
return (PCI_SPEED_UNKNOWN);
}
@@ -1270,6 +1300,10 @@ PCIE_SPEED2MBS_ENC(enum pci_bus_speed spd)
{
switch(spd) {
+ case PCIE_SPEED_64_0GT:
+ return (64000 * 128 / 130);
+ case PCIE_SPEED_32_0GT:
+ return (32000 * 128 / 130);
case PCIE_SPEED_16_0GT:
return (16000 * 128 / 130);
case PCIE_SPEED_8_0GT:
@@ -1576,6 +1610,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 +1632,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/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h
index 6e81e7a0fa45..4a5385f5e095 100644
--- a/sys/compat/linuxkpi/common/include/linux/seqlock.h
+++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h
@@ -33,8 +33,11 @@
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/rwlock.h>
#include <sys/seqc.h>
+#include <linux/mutex.h>
+
struct lock_class_key;
struct seqcount {
@@ -48,6 +51,12 @@ struct seqlock {
};
typedef struct seqlock seqlock_t;
+struct seqcount_mutex {
+ struct mutex *seqm_lock;
+ struct seqcount seqm_count;
+};
+typedef struct seqcount_mutex seqcount_mutex_t;
+
static inline void
__seqcount_init(struct seqcount *seqcount, const char *name __unused,
struct lock_class_key *key __unused)
@@ -57,37 +66,99 @@ __seqcount_init(struct seqcount *seqcount, const char *name __unused,
#define seqcount_init(seqcount) __seqcount_init(seqcount, NULL, NULL)
static inline void
-write_seqcount_begin(struct seqcount *seqcount)
+seqcount_mutex_init(struct seqcount_mutex *seqcount, struct mutex *mutex)
+{
+ seqcount->seqm_lock = mutex;
+ seqcount_init(&seqcount->seqm_count);
+}
+
+#define write_seqcount_begin(s) \
+ _Generic(*(s), \
+ struct seqcount: lkpi_write_seqcount_begin, \
+ struct seqcount_mutex: lkpi_write_seqcount_mutex_begin \
+ )(s)
+
+static inline void
+lkpi_write_seqcount_begin(struct seqcount *seqcount)
{
seqc_sleepable_write_begin(&seqcount->seqc);
}
static inline void
-write_seqcount_end(struct seqcount *seqcount)
+lkpi_write_seqcount_mutex_begin(struct seqcount_mutex *seqcount)
+{
+ mutex_lock(seqcount->seqm_lock);
+ lkpi_write_seqcount_begin(&seqcount->seqm_count);
+}
+
+#define write_seqcount_end(s) \
+ _Generic(*(s), \
+ struct seqcount: lkpi_write_seqcount_end, \
+ struct seqcount_mutex: lkpi_write_seqcount_mutex_end \
+ )(s)
+
+static inline void
+lkpi_write_seqcount_end(struct seqcount *seqcount)
{
seqc_sleepable_write_end(&seqcount->seqc);
}
-/*
- * XXX: Are predicts from inline functions still not honored by clang?
- */
-#define __read_seqcount_retry(seqcount, gen) \
- (!seqc_consistent_no_fence(&(seqcount)->seqc, gen))
-#define read_seqcount_retry(seqcount, gen) \
- (!seqc_consistent(&(seqcount)->seqc, gen))
+static inline void
+lkpi_write_seqcount_mutex_end(struct seqcount_mutex *seqcount)
+{
+ lkpi_write_seqcount_end(&seqcount->seqm_count);
+ mutex_unlock(seqcount->seqm_lock);
+}
+
+#define read_seqcount_begin(s) \
+ _Generic(*(s), \
+ struct seqcount: lkpi_read_seqcount_begin, \
+ struct seqcount_mutex: lkpi_read_seqcount_mutex_begin \
+ )(s)
static inline unsigned
-read_seqcount_begin(const struct seqcount *seqcount)
+lkpi_read_seqcount_begin(const struct seqcount *seqcount)
{
return (seqc_read(&seqcount->seqc));
}
static inline unsigned
+lkpi_read_seqcount_mutex_begin(const struct seqcount_mutex *seqcount)
+{
+ return (lkpi_read_seqcount_begin(&seqcount->seqm_count));
+}
+
+static inline unsigned
raw_read_seqcount(const struct seqcount *seqcount)
{
return (seqc_read_any(&seqcount->seqc));
}
+/*
+ * XXX: Are predicts from inline functions still not honored by clang?
+ */
+#define __read_seqcount_retry(seqcount, gen) \
+ (!seqc_consistent_no_fence(&(seqcount)->seqc, gen))
+#define read_seqcount_retry(s, old) \
+ _Generic(*(s), \
+ struct seqcount: lkpi_read_seqcount_retry, \
+ struct seqcount_mutex: lkpi_read_seqcount_mutex_retry \
+ )(s, old)
+
+static inline int
+lkpi_read_seqcount_retry(
+ const struct seqcount *seqcount, unsigned int old)
+{
+ return (!seqc_consistent(&seqcount->seqc, old));
+}
+
+static inline int
+lkpi_read_seqcount_mutex_retry(
+ const struct seqcount_mutex *seqcount, unsigned int old)
+{
+ return (!seqc_consistent(&seqcount->seqm_count.seqc, old));
+}
+
static inline void
seqlock_init(struct seqlock *seqlock)
{
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), \
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 1eb520b2140f..998b39127993 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include <linux/workqueue.h>
#include "linux_80211.h"
+#define LKPI_80211_WME
/* #define LKPI_80211_HW_CRYPTO */
static MALLOC_DEFINE(M_LKPI80211, "lkpi80211", "LinuxKPI 80211 compat");
@@ -88,22 +89,6 @@ SYSCTL_NODE(_compat_linuxkpi, OID_AUTO, 80211, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
SYSCTL_INT(_compat_linuxkpi_80211, OID_AUTO, debug, CTLFLAG_RWTUN,
&linuxkpi_debug_80211, 0, "LinuxKPI 802.11 debug level");
-#ifndef D80211_TODO
-#define D80211_TODO 0x1
-#endif
-#ifndef D80211_IMPROVE
-#define D80211_IMPROVE 0x2
-#endif
-#define D80211_TRACE 0x10
-#define D80211_TRACEOK 0x20
-#define D80211_TRACE_TX 0x100
-#define D80211_TRACE_TX_DUMP 0x200
-#define D80211_TRACE_RX 0x1000
-#define D80211_TRACE_RX_DUMP 0x2000
-#define D80211_TRACE_RX_BEACONS 0x4000
-#define D80211_TRACEX (D80211_TRACE_TX|D80211_TRACE_RX)
-#define D80211_TRACEX_DUMP (D80211_TRACE_TX_DUMP|D80211_TRACE_RX_DUMP)
-#define D80211_TRACE_STA 0x10000
#define UNIMPLEMENTED if (linuxkpi_debug_80211 & D80211_TODO) \
printf("XXX-TODO %s:%d: UNIMPLEMENTED\n", __func__, __LINE__)
#define TRACEOK() if (linuxkpi_debug_80211 & D80211_TRACEOK) \
@@ -153,6 +138,9 @@ static struct lkpi_sta *lkpi_find_lsta_by_ni(struct lkpi_vif *,
struct ieee80211_node *);
static void lkpi_80211_txq_task(void *, int);
static void lkpi_ieee80211_free_skb_mbuf(void *);
+#ifdef LKPI_80211_WME
+static int lkpi_wme_update(struct lkpi_hw *, struct ieee80211vap *, bool);
+#endif
static void
lkpi_lsta_dump(struct lkpi_sta *lsta, struct ieee80211_node *ni,
@@ -922,7 +910,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
struct ieee80211_vif *vif;
struct ieee80211_node *ni;
struct lkpi_sta *lsta;
- struct ieee80211_sta *sta;
enum ieee80211_bss_changed bss_changed;
struct ieee80211_prep_tx_info prep_tx_info;
uint32_t changed;
@@ -1048,8 +1035,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_NOTEXIST, ("%s: lsta %p state not "
"NOTEXIST: %#x\n", __func__, lsta, lsta->state));
- sta = LSTA_TO_STA(lsta);
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NONE);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NONE);
if (error != 0) {
IMPROVE("do we need to undo the chan ctx?");
goto out;
@@ -1068,7 +1054,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
* XXX-BZ and by now we know that this does not work on all drivers
* for all queues.
*/
- lkpi_wake_tx_queues(hw, sta, false, false);
+ lkpi_wake_tx_queues(hw, LSTA_TO_STA(lsta), false, false);
/* Start mgd_prepare_tx. */
memset(&prep_tx_info, 0, sizeof(prep_tx_info));
@@ -1148,7 +1134,7 @@ lkpi_sta_auth_to_scan(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_NONE, ("%s: lsta %p state not "
"NONE: %#x, nstate %d arg %d\n", __func__, lsta, lsta->state, nstate, arg));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NOTEXIST);
if (error != 0) {
IMPROVE("do we need to undo the chan ctx?");
goto out;
@@ -1204,7 +1190,6 @@ lkpi_sta_auth_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, in
struct ieee80211_vif *vif;
struct ieee80211_node *ni;
struct lkpi_sta *lsta;
- struct ieee80211_sta *sta;
struct ieee80211_prep_tx_info prep_tx_info;
int error;
@@ -1225,8 +1210,7 @@ lkpi_sta_auth_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, in
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_NONE, ("%s: lsta %p state not "
"NONE: %#x\n", __func__, lsta, lsta->state));
- sta = LSTA_TO_STA(lsta);
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_AUTH);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_AUTH);
if (error != 0)
goto out;
@@ -1249,7 +1233,7 @@ lkpi_sta_auth_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, in
}
/* Wake tx queue to get packet out. */
- lkpi_wake_tx_queues(hw, sta, true, true);
+ lkpi_wake_tx_queues(hw, LSTA_TO_STA(lsta), true, true);
/*
* <twiddle> .. we end up in "assoc_to_run"
@@ -1394,7 +1378,7 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_AUTH, ("%s: lsta %p state not "
"AUTH: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NONE);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NONE);
if (error != 0)
goto out;
@@ -1404,7 +1388,7 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_NONE, ("%s: lsta %p state not "
"NONE: %#x, nstate %d arg %d\n", __func__, lsta, lsta->state, nstate, arg));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NOTEXIST);
if (error != 0) {
IMPROVE("do we need to undo the chan ctx?");
goto out;
@@ -1522,7 +1506,11 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
"AUTH: %#x\n", __func__, lsta, lsta->state));
sta = LSTA_TO_STA(lsta);
sta->aid = IEEE80211_NODE_AID(ni);
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_ASSOC);
+#ifdef LKPI_80211_WME
+ if (vap->iv_flags & IEEE80211_F_WME)
+ sta->wme = true;
+#endif
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_ASSOC);
if (error != 0)
goto out;
@@ -1530,6 +1518,9 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
/* Update bss info (bss_info_changed) (assoc, aid, ..). */
bss_changed = 0;
+#ifdef LKPI_80211_WME
+ bss_changed |= lkpi_wme_update(lhw, vap, true);
+#endif
if (!vif->bss_conf.assoc || vif->bss_conf.aid != IEEE80211_NODE_AID(ni)) {
vif->bss_conf.assoc = true;
vif->bss_conf.aid = IEEE80211_NODE_AID(ni);
@@ -1592,7 +1583,7 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_ASSOC, ("%s: lsta %p state not "
"ASSOC: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_AUTHORIZED);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_AUTHORIZED);
if (error != 0) {
IMPROVE("undo some changes?");
goto out;
@@ -1709,7 +1700,7 @@ lkpi_sta_run_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_AUTHORIZED, ("%s: lsta %p state not "
"AUTHORIZED: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_ASSOC);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_ASSOC);
if (error != 0)
goto out;
@@ -1719,7 +1710,7 @@ lkpi_sta_run_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_ASSOC, ("%s: lsta %p state not "
"ASSOC: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_AUTH);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_AUTH);
if (error != 0)
goto out;
@@ -1816,7 +1807,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_AUTHORIZED, ("%s: lsta %p state not "
"AUTHORIZED: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_ASSOC);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_ASSOC);
if (error != 0)
goto out;
@@ -1826,7 +1817,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_ASSOC, ("%s: lsta %p state not "
"ASSOC: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_AUTH);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_AUTH);
if (error != 0)
goto out;
@@ -1836,7 +1827,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_AUTH, ("%s: lsta %p state not "
"AUTH: %#x\n", __func__, lsta, lsta->state));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NONE);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NONE);
if (error != 0)
goto out;
@@ -1846,7 +1837,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
KASSERT(lsta->state == IEEE80211_STA_NONE, ("%s: lsta %p state not "
"NONE: %#x, nstate %d arg %d\n", __func__, lsta, lsta->state, nstate, arg));
- error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST);
+ error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_NOTEXIST);
if (error != 0) {
IMPROVE("do we need to undo the chan ctx?");
goto out;
@@ -2117,13 +2108,11 @@ out:
return (lvif->iv_update_bss(vap, ni));
}
+#ifdef LKPI_80211_WME
static int
-lkpi_ic_wme_update(struct ieee80211com *ic)
+lkpi_wme_update(struct lkpi_hw *lhw, struct ieee80211vap *vap, bool planned)
{
- /* This needs queuing and go at the right moment. */
-#ifdef WITH_WME_UPDATE
- struct ieee80211vap *vap;
- struct lkpi_hw *lhw;
+ struct ieee80211com *ic;
struct ieee80211_hw *hw;
struct lkpi_vif *lvif;
struct ieee80211_vif *vif;
@@ -2133,39 +2122,42 @@ lkpi_ic_wme_update(struct ieee80211com *ic)
enum ieee80211_bss_changed changed;
int error;
uint16_t ac;
-#endif
IMPROVE();
KASSERT(WME_NUM_AC == IEEE80211_NUM_ACS, ("%s: WME_NUM_AC %d != "
"IEEE80211_NUM_ACS %d\n", __func__, WME_NUM_AC, IEEE80211_NUM_ACS));
-#ifdef WITH_WME_UPDATE
- vap = TAILQ_FIRST(&ic->ic_vaps);
if (vap == NULL)
return (0);
- /* We should factor this out into per-vap (*wme_update). */
- lhw = ic->ic_softc;
+ if ((vap->iv_flags & IEEE80211_F_WME) == 0)
+ return (0);
+
if (lhw->ops->conf_tx == NULL)
return (0);
- /* XXX-BZ check amount of hw queues */
- hw = LHW_TO_HW(lhw);
- lvif = VAP_TO_LVIF(vap);
- vif = LVIF_TO_VIF(lvif);
+ if (!planned && (vap->iv_state != IEEE80211_S_RUN)) {
+ lhw->update_wme = true;
+ return (0);
+ }
+ lhw->update_wme = false;
+ ic = lhw->ic;
ieee80211_wme_ic_getparams(ic, &chp);
IEEE80211_LOCK(ic);
for (ac = 0; ac < WME_NUM_AC; ac++)
wmeparr[ac] = chp.cap_wmeParams[ac];
IEEE80211_UNLOCK(ic);
+ hw = LHW_TO_HW(lhw);
+ lvif = VAP_TO_LVIF(vap);
+ vif = LVIF_TO_VIF(lvif);
+
/* Configure tx queues (conf_tx) & send BSS_CHANGED_QOS. */
LKPI_80211_LHW_LOCK(lhw);
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
struct wmeParams *wmep;
- /* XXX-BZ should keep this in lvif? */
wmep = &wmeparr[ac];
bzero(&txqp, sizeof(txqp));
txqp.cw_min = wmep->wmep_logcwmin;
@@ -2179,10 +2171,30 @@ lkpi_ic_wme_update(struct ieee80211com *ic)
}
LKPI_80211_LHW_UNLOCK(lhw);
changed = BSS_CHANGED_QOS;
- lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
+ if (!planned)
+ lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
+
+ return (changed);
+}
#endif
- return (0);
+static int
+lkpi_ic_wme_update(struct ieee80211com *ic)
+{
+#ifdef LKPI_80211_WME
+ struct ieee80211vap *vap;
+ struct lkpi_hw *lhw;
+
+ IMPROVE("Use the per-VAP callback in net80211.");
+ vap = TAILQ_FIRST(&ic->ic_vaps);
+ if (vap == NULL)
+ return (0);
+
+ lhw = ic->ic_softc;
+
+ lkpi_wme_update(lhw, vap, false);
+#endif
+ return (0); /* unused */
}
static struct ieee80211vap *
@@ -3482,7 +3494,9 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
IEEE80211_C_STA |
IEEE80211_C_MONITOR |
IEEE80211_C_WPA | /* WPA/RSN */
+#ifdef LKPI_80211_WME
IEEE80211_C_WME |
+#endif
#if 0
IEEE80211_C_PMGT |
#endif
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h
index 65e78ba0fc08..d9f2ce68f4f1 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.h
+++ b/sys/compat/linuxkpi/common/src/linux_80211.h
@@ -42,6 +42,26 @@
#ifndef _LKPI_SRC_LINUX_80211_H
#define _LKPI_SRC_LINUX_80211_H
+/* #define LINUXKPI_DEBUG_80211 */
+
+#ifndef D80211_TODO
+#define D80211_TODO 0x1
+#endif
+#ifndef D80211_IMPROVE
+#define D80211_IMPROVE 0x2
+#endif
+#define D80211_TRACE 0x10
+#define D80211_TRACEOK 0x20
+#define D80211_TRACE_TX 0x100
+#define D80211_TRACE_TX_DUMP 0x200
+#define D80211_TRACE_RX 0x1000
+#define D80211_TRACE_RX_DUMP 0x2000
+#define D80211_TRACE_RX_BEACONS 0x4000
+#define D80211_TRACEX (D80211_TRACE_TX|D80211_TRACE_RX)
+#define D80211_TRACEX_DUMP (D80211_TRACE_TX_DUMP|D80211_TRACE_RX_DUMP)
+#define D80211_TRACE_STA 0x10000
+#define D80211_TRACE_MO 0x100000
+
struct lkpi_radiotap_tx_hdr {
struct ieee80211_radiotap_header wt_ihdr;
uint8_t wt_flags;
@@ -167,6 +187,7 @@ struct lkpi_hw { /* name it mac80211_sc? */
int scan_ie_len; /* Length of common per-band scan IEs. */
bool update_mc;
+ bool update_wme;
/* Must be last! */
struct ieee80211_hw hw __aligned(CACHE_LINE_SIZE);
@@ -219,7 +240,7 @@ u64 lkpi_80211_mo_prepare_multicast(struct ieee80211_hw *,
void lkpi_80211_mo_configure_filter(struct ieee80211_hw *, unsigned int,
unsigned int *, u64);
int lkpi_80211_mo_sta_state(struct ieee80211_hw *, struct ieee80211_vif *,
- struct ieee80211_sta *, enum ieee80211_sta_state);
+ struct lkpi_sta *, enum ieee80211_sta_state);
int lkpi_80211_mo_config(struct ieee80211_hw *, uint32_t);
int lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
struct ieee80211_chanctx_conf *);
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index 4fede921f017..762a54e4a823 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -39,6 +39,16 @@ __FBSDID("$FreeBSD$");
#include "linux_80211.h"
+/* Could be a different tracing framework later. */
+#ifdef LINUXKPI_DEBUG_80211
+#define LKPI_80211_TRACE_MO(fmt, ...) \
+ if (linuxkpi_debug_80211 & D80211_TRACE_MO) \
+ printf("LKPI_80211_TRACE_MO %s:%d:_" fmt "\n", \
+ __func__, __LINE__, __VA_ARGS__)
+#else
+#define LKPI_80211_TRACE_MO(...) do { } while(0)
+#endif
+
int
lkpi_80211_mo_start(struct ieee80211_hw *hw)
{
@@ -56,6 +66,7 @@ lkpi_80211_mo_start(struct ieee80211_hw *hw)
error = EEXIST;
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p", hw);
error = lhw->ops->start(hw);
if (error == 0)
lhw->sc_flags |= LKPI_MAC80211_DRV_STARTED;
@@ -73,6 +84,7 @@ lkpi_80211_mo_stop(struct ieee80211_hw *hw)
if (lhw->ops->stop == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p", hw);
lhw->ops->stop(hw);
lhw->sc_flags &= ~LKPI_MAC80211_DRV_STARTED;
}
@@ -89,6 +101,7 @@ lkpi_80211_mo_get_antenna(struct ieee80211_hw *hw, u32 *txs, u32 *rxs)
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p", hw);
error = lhw->ops->get_antenna(hw, txs, rxs);
out:
@@ -107,6 +120,7 @@ lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *hw, uint32_t frag_th)
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p frag_th %u", hw, frag_th);
error = lhw->ops->set_frag_threshold(hw, frag_th);
out:
@@ -125,6 +139,7 @@ lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *hw, uint32_t rts_th)
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p rts_th %u", hw, rts_th);
error = lhw->ops->set_rts_threshold(hw, rts_th);
out:
@@ -155,6 +170,7 @@ lkpi_80211_mo_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
}
LKPI_80211_LVIF_UNLOCK(lvif);
+ LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif);
error = lhw->ops->add_interface(hw, vif);
if (error == 0) {
LKPI_80211_LVIF_LOCK(lvif);
@@ -184,6 +200,7 @@ lkpi_80211_mo_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vi
}
LKPI_80211_LVIF_UNLOCK(lvif);
+ LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif);
lhw->ops->remove_interface(hw, vif);
LKPI_80211_LVIF_LOCK(lvif);
lvif->added_to_drv = false;
@@ -206,6 +223,7 @@ lkpi_80211_mo_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
}
lhw->scan_flags |= LKPI_LHW_SCAN_RUNNING;
+ LKPI_80211_TRACE_MO("hw %p vif %p sr %p", hw, vif, sr);
error = lhw->ops->hw_scan(hw, vif, sr);
if (error != 0)
lhw->scan_flags &= ~LKPI_LHW_SCAN_RUNNING;
@@ -223,6 +241,7 @@ lkpi_80211_mo_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
if (lhw->ops->cancel_hw_scan == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif);
lhw->ops->cancel_hw_scan(hw, vif);
}
@@ -235,6 +254,7 @@ lkpi_80211_mo_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vi
if (lhw->ops->sw_scan_complete == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif);
lhw->ops->sw_scan_complete(hw, vif);
lhw->scan_flags &= ~LKPI_LHW_SCAN_RUNNING;
}
@@ -249,6 +269,7 @@ lkpi_80211_mo_sw_scan_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (lhw->ops->sw_scan_start == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif);
lhw->ops->sw_scan_start(hw, vif, addr);
}
@@ -267,6 +288,7 @@ lkpi_80211_mo_prepare_multicast(struct ieee80211_hw *hw,
if (lhw->ops->prepare_multicast == NULL)
return (0);
+ LKPI_80211_TRACE_MO("hw %p mc_list %p", hw, mc_list);
ptr = lhw->ops->prepare_multicast(hw, mc_list);
return (ptr);
}
@@ -284,6 +306,7 @@ lkpi_80211_mo_configure_filter(struct ieee80211_hw *hw, unsigned int changed_fla
if (mc_ptr == 0)
return;
+ LKPI_80211_TRACE_MO("hw %p changed_flags %#x total_flags %p mc_ptr %ju", hw, changed_flags, total_flags, (uintmax_t)mc_ptr);
lhw->ops->configure_filter(hw, changed_flags, total_flags, mc_ptr);
}
@@ -313,6 +336,7 @@ lkpi_80211_mo_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta);
error = lhw->ops->sta_add(hw, vif, sta);
if (error == 0)
lsta->added_to_drv = true;
@@ -342,6 +366,7 @@ lkpi_80211_mo_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta);
error = lhw->ops->sta_remove(hw, vif, sta);
if (error == 0)
lsta->added_to_drv = false;
@@ -352,15 +377,16 @@ out:
int
lkpi_80211_mo_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, enum ieee80211_sta_state nstate)
+ struct lkpi_sta *lsta, enum ieee80211_sta_state nstate)
{
struct lkpi_hw *lhw;
- struct lkpi_sta *lsta;
+ struct ieee80211_sta *sta;
int error;
lhw = HW_TO_LHW(hw);
- lsta = STA_TO_LSTA(sta);
+ sta = LSTA_TO_STA(lsta);
if (lhw->ops->sta_state != NULL) {
+ LKPI_80211_TRACE_MO("hw %p vif %p sta %p nstate %d", hw, vif, sta, nstate);
error = lhw->ops->sta_state(hw, vif, sta, lsta->state, nstate);
if (error == 0) {
if (nstate == IEEE80211_STA_NOTEXIST)
@@ -405,6 +431,7 @@ lkpi_80211_mo_config(struct ieee80211_hw *hw, uint32_t changed)
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p changed %u", hw, changed);
error = lhw->ops->config(hw, changed);
out:
@@ -425,6 +452,7 @@ lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, chanctx_conf);
error = lhw->ops->assign_vif_chanctx(hw, vif, NULL, chanctx_conf);
if (error == 0)
vif->chanctx_conf = chanctx_conf;
@@ -446,6 +474,7 @@ lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif
if (*chanctx_conf == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, *chanctx_conf);
lhw->ops->unassign_vif_chanctx(hw, vif, NULL, *chanctx_conf);
*chanctx_conf = NULL;
}
@@ -464,6 +493,7 @@ lkpi_80211_mo_add_chanctx(struct ieee80211_hw *hw,
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p chanctx_conf %p", hw, chanctx_conf);
error = lhw->ops->add_chanctx(hw, chanctx_conf);
out:
@@ -480,6 +510,7 @@ lkpi_80211_mo_change_chanctx(struct ieee80211_hw *hw,
if (lhw->ops->change_chanctx == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p chanctx_conf %p changed %u", hw, chanctx_conf, changed);
lhw->ops->change_chanctx(hw, chanctx_conf, changed);
}
@@ -493,6 +524,7 @@ lkpi_80211_mo_remove_chanctx(struct ieee80211_hw *hw,
if (lhw->ops->remove_chanctx == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p chanctx_conf %p", hw, chanctx_conf);
lhw->ops->remove_chanctx(hw, chanctx_conf);
}
@@ -506,6 +538,7 @@ lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vi
if (lhw->ops->bss_info_changed == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p conf %p changed %#jx", hw, vif, conf, (uintmax_t)changed);
lhw->ops->bss_info_changed(hw, vif, conf, changed);
}
@@ -523,6 +556,7 @@ lkpi_80211_mo_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p vif %p ac %u txpq %p", hw, vif, ac, txqp);
error = lhw->ops->conf_tx(hw, vif, 0, ac, txqp);
out:
@@ -539,6 +573,7 @@ lkpi_80211_mo_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (lhw->ops->flush == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p nqueues %u drop %d", hw, vif, nqueues, drop);
lhw->ops->flush(hw, vif, nqueues, drop);
}
@@ -552,6 +587,7 @@ lkpi_80211_mo_mgd_prepare_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (lhw->ops->mgd_prepare_tx == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p txinfo %p", hw, vif, txinfo);
lhw->ops->mgd_prepare_tx(hw, vif, txinfo);
}
@@ -565,6 +601,7 @@ lkpi_80211_mo_mgd_complete_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif
if (lhw->ops->mgd_complete_tx == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p txinfo %p", hw, vif, txinfo);
lhw->ops->mgd_complete_tx(hw, vif, txinfo);
}
@@ -578,6 +615,7 @@ lkpi_80211_mo_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *txctrl,
if (lhw->ops->tx == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p txctrl %p skb %p", hw, txctrl, skb);
lhw->ops->tx(hw, txctrl, skb);
}
@@ -590,6 +628,7 @@ lkpi_80211_mo_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
if (lhw->ops->wake_tx_queue == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p txq %p", hw, txq);
lhw->ops->wake_tx_queue(hw, txq);
}
@@ -602,6 +641,7 @@ lkpi_80211_mo_sync_rx_queues(struct ieee80211_hw *hw)
if (lhw->ops->sync_rx_queues == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p", hw);
lhw->ops->sync_rx_queues(hw);
}
@@ -615,6 +655,7 @@ lkpi_80211_mo_sta_pre_rcu_remove(struct ieee80211_hw *hw,
if (lhw->ops->sta_pre_rcu_remove == NULL)
return;
+ LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta);
lhw->ops->sta_pre_rcu_remove(hw, vif, sta);
}
@@ -632,6 +673,7 @@ lkpi_80211_mo_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
goto out;
}
+ LKPI_80211_TRACE_MO("hw %p cmd %d vif %p sta %p kc %p", hw, cmd, vif, sta, kc);
error = lhw->ops->set_key(hw, cmd, vif, sta, kc);
out:
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 6f1def64fa0f..30cc094a5222 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -132,6 +132,7 @@ static void linux_cdev_deref(struct linux_cdev *ldev);
static struct vm_area_struct *linux_cdev_handle_find(void *handle);
cpumask_t cpu_online_mask;
+static cpumask_t static_single_cpu_mask[MAXCPU];
struct kobject linux_class_root;
struct device linux_root_device;
struct class linux_class_misc;
@@ -833,6 +834,18 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
return (0);
}
+void
+vma_set_file(struct vm_area_struct *vma, struct linux_file *file)
+{
+ struct linux_file *tmp;
+
+ /* Changing an anonymous vma with this is illegal */
+ get_file(file);
+ tmp = vma->vm_file;
+ vma->vm_file = file;
+ fput(tmp);
+}
+
static struct file_operations dummy_ldev_ops = {
/* XXXKIB */
};
@@ -2562,7 +2575,7 @@ struct list_sort_thunk {
};
static inline int
-linux_le_cmp(void *priv, const void *d1, const void *d2)
+linux_le_cmp(const void *d1, const void *d2, void *priv)
{
struct list_head *le1, *le2;
struct list_sort_thunk *thunk;
@@ -2590,7 +2603,7 @@ list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv,
ar[i++] = le;
thunk.cmp = cmp;
thunk.priv = priv;
- qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp);
+ qsort_r(ar, count, sizeof(struct list_head *), linux_le_cmp, &thunk);
INIT_LIST_HEAD(head);
for (i = 0; i < count; i++)
list_add_tail(ar[i], head);
@@ -2734,6 +2747,16 @@ bool linux_cpu_has_clflush;
struct cpuinfo_x86 boot_cpu_data;
#endif
+cpumask_t *
+lkpi_get_static_single_cpu_mask(int cpuid)
+{
+
+ KASSERT((cpuid >= 0 && cpuid < MAXCPU), ("%s: invalid cpuid %d\n",
+ __func__, cpuid));
+
+ return (&static_single_cpu_mask[cpuid]);
+}
+
static void
linux_compat_init(void *arg)
{
@@ -2743,6 +2766,7 @@ linux_compat_init(void *arg)
#if defined(__i386__) || defined(__amd64__)
linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH);
boot_cpu_data.x86_clflush_size = cpu_clflush_line_size;
+ boot_cpu_data.x86_max_cores = mp_ncpus;
boot_cpu_data.x86 = ((cpu_id & 0xf0000) >> 12) | ((cpu_id & 0xf0) >> 4);
#endif
rw_init(&linux_vma_lock, "lkpi-vma-lock");
@@ -2771,6 +2795,15 @@ linux_compat_init(void *arg)
init_waitqueue_head(&linux_var_waitq);
CPU_COPY(&all_cpus, &cpu_online_mask);
+ /*
+ * Generate a single-CPU cpumask_t for each CPU (possibly) in the system.
+ * CPUs are indexed from 0..(MAXCPU-1). The entry for cpuid 0 will only
+ * have itself in the cpumask, cupid 1 only itself on entry 1, and so on.
+ * This is used by cpumask_of() (and possibly others in the future) for,
+ * e.g., drivers to pass hints to irq_set_affinity_hint().
+ */
+ for (i = 0; i < MAXCPU; i++)
+ CPU_SET(i, &static_single_cpu_mask[i]);
}
SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL);
diff --git a/sys/compat/linuxkpi/common/src/linux_netdev.c b/sys/compat/linuxkpi/common/src/linux_netdev.c
index 3055b9c46767..69adcff67930 100644
--- a/sys/compat/linuxkpi/common/src/linux_netdev.c
+++ b/sys/compat/linuxkpi/common/src/linux_netdev.c
@@ -326,12 +326,12 @@ lkpi_napi_task(void *ctx, int pending)
void
linuxkpi_netif_napi_add(struct net_device *ndev, struct napi_struct *napi,
- int(*napi_poll)(struct napi_struct *, int), int budget)
+ int(*napi_poll)(struct napi_struct *, int))
{
napi->dev = ndev;
napi->poll = napi_poll;
- napi->budget = budget;
+ napi->budget = NAPI_POLL_WEIGHT;
INIT_LIST_HEAD(&napi->rx_list);
napi->rx_count = 0;
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index aaa6d646f04d..aab4bfb6650d 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -117,6 +117,10 @@ static device_method_t pci_methods[] = {
DEVMETHOD_END
};
+const char *pci_power_names[] = {
+ "UNKNOWN", "D0", "D1", "D2", "D3hot", "D3cold"
+};
+
struct linux_dma_priv {
uint64_t dma_mask;
bus_dma_tag_t dmat;
diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c
index 054917e2fc24..c358e4ae7dc1 100644
--- a/sys/compat/linuxkpi/common/src/linux_seq_file.c
+++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c
@@ -130,6 +130,29 @@ seq_open(struct linux_file *f, const struct seq_operations *op)
return (0);
}
+void *
+__seq_open_private(struct linux_file *f, const struct seq_operations *op, int size)
+{
+ struct seq_file *seq_file;
+ void *private;
+ int error;
+
+ private = malloc(size, M_LSEQ, M_NOWAIT|M_ZERO);
+ if (private == NULL)
+ return (NULL);
+
+ error = seq_open(f, op);
+ if (error < 0) {
+ free(private, M_LSEQ);
+ return (NULL);
+ }
+
+ seq_file = (struct seq_file *)f->private_data;
+ seq_file->private = private;
+
+ return (private);
+}
+
int
single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d)
{
@@ -167,6 +190,16 @@ seq_release(struct inode *inode __unused, struct linux_file *file)
}
int
+seq_release_private(struct inode *inode __unused, struct linux_file *f)
+{
+ struct seq_file *seq;
+
+ seq = (struct seq_file *)f->private_data;
+ free(seq->private, M_LSEQ);
+ return (seq_release(inode, f));
+}
+
+int
single_release(struct vnode *v, struct linux_file *f)
{
const struct seq_operations *op;
diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c b/sys/compat/linuxkpi/common/src/linux_skbuff.c
index df8e3fda8d56..c23a59b3c536 100644
--- a/sys/compat/linuxkpi/common/src/linux_skbuff.c
+++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c
@@ -151,6 +151,28 @@ linuxkpi_dev_alloc_skb(size_t size, gfp_t gfp)
}
struct sk_buff *
+linuxkpi_build_skb(void *data, size_t fragsz)
+{
+ struct sk_buff *skb;
+
+ if (data == NULL || fragsz == 0)
+ return (NULL);
+
+ /* Just allocate a skb without data area. */
+ skb = linuxkpi_alloc_skb(0, GFP_KERNEL);
+ if (skb == NULL)
+ return (NULL);
+
+ skb->_flags |= _SKB_FLAGS_SKBEXTFRAG;
+ skb->truesize = fragsz;
+ skb->head = skb->data = data;
+ skb_reset_tail_pointer(skb); /* XXX is that correct? */
+ skb->end = (void *)((uintptr_t)skb->head + fragsz);
+
+ return (skb);
+}
+
+struct sk_buff *
linuxkpi_skb_copy(struct sk_buff *skb, gfp_t gfp)
{
struct sk_buff *new;
@@ -233,6 +255,13 @@ linuxkpi_kfree_skb(struct sk_buff *skb)
}
}
+ if ((skb->_flags & _SKB_FLAGS_SKBEXTFRAG) != 0) {
+ void *p;
+
+ p = skb->head;
+ skb_free_frag(p);
+ }
+
#ifdef __LP64__
if (__predict_true(linuxkpi_skb_memlimit == 0))
free(skb, M_LKPISKB);
@@ -268,6 +297,7 @@ DB_SHOW_COMMAND(skb, db_show_skb)
skb->pkt_type, skb->dev, skb->sk);
db_printf("\tcsum_offset %d csum_start %d ip_summed %d protocol %d\n",
skb->csum_offset, skb->csum_start, skb->ip_summed, skb->protocol);
+ db_printf("\t_flags %#06x\n", skb->_flags); /* XXX-BZ print names? */
db_printf("\thead %p data %p tail %p end %p\n",
skb->head, skb->data, skb->tail, skb->end);
db_printf("\tshinfo %p m %p m_free_func %p\n",
@@ -298,7 +328,6 @@ DB_SHOW_COMMAND(skb, db_show_skb)
}
db_printf("}\n");
- db_printf("\t_spareu16_0 %#06x __scratch[0] %p\n",
- skb->_spareu16_0, skb->__scratch);
+ db_printf("\t__scratch[0] %p\n", skb->__scratch);
};
#endif
diff --git a/sys/compat/linuxkpi/common/src/linux_tasklet.c b/sys/compat/linuxkpi/common/src/linux_tasklet.c
index 26e7bb75cf19..d6e20a63c579 100644
--- a/sys/compat/linuxkpi/common/src/linux_tasklet.c
+++ b/sys/compat/linuxkpi/common/src/linux_tasklet.c
@@ -85,7 +85,10 @@ tasklet_handler(void *arg)
/* reset executing state */
TASKLET_ST_SET(ts, TASKLET_ST_EXEC);
- ts->func(ts->data);
+ if (ts->use_callback)
+ ts->callback(ts);
+ else
+ ts->func(ts->data);
} while (TASKLET_ST_CMPSET(ts, TASKLET_ST_EXEC,
TASKLET_ST_IDLE) == 0);
@@ -149,9 +152,24 @@ tasklet_init(struct tasklet_struct *ts,
ts->entry.tqe_prev = NULL;
ts->entry.tqe_next = NULL;
ts->func = func;
+ ts->callback = NULL;
ts->data = data;
atomic_set_int(&ts->tasklet_state, TASKLET_ST_IDLE);
atomic_set(&ts->count, 0);
+ ts->use_callback = false;
+}
+
+void
+tasklet_setup(struct tasklet_struct *ts, tasklet_callback_t *c)
+{
+ ts->entry.tqe_prev = NULL;
+ ts->entry.tqe_next = NULL;
+ ts->func = NULL;
+ ts->callback = c;
+ ts->data = 0;
+ atomic_set_int(&ts->tasklet_state, TASKLET_ST_IDLE);
+ atomic_set(&ts->count, 0);
+ ts->use_callback = true;
}
void
diff --git a/sys/compat/linuxkpi/dummy/include/linux/timekeeping.h b/sys/compat/linuxkpi/dummy/include/linux/timekeeping.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sys/compat/linuxkpi/dummy/include/linux/timekeeping.h