From b9e7fb1edf7de59ec638ce5c1c83b43a216d9311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 29 Feb 2016 15:26:19 +0100 Subject: [PATCH] dde_linux: update wifi to 4.4.3 Issue #1974. --- repos/dde_linux/include/wifi/socket_call.h | 3 +- .../lib/import/import-wifi_include.mk | 30 +- repos/dde_linux/lib/mk/libnl.inc | 2 + repos/dde_linux/lib/mk/spec/x86_32/wifi.mk | 2 + repos/dde_linux/lib/mk/spec/x86_64/wifi.mk | 2 + repos/dde_linux/lib/mk/wifi.inc | 30 +- repos/dde_linux/lib/mk/wpa_driver_nl80211.mk | 1 + repos/dde_linux/patches/wifi.patch | 99 +- repos/dde_linux/patches/wifi_crypto.patch | 9 +- repos/dde_linux/patches/wifi_mem.patch | 66 +- repos/dde_linux/ports/dde_linux.hash | 2 +- repos/dde_linux/ports/dde_linux.port | 95 +- repos/dde_linux/run/wifi.run | 10 +- repos/dde_linux/src/drivers/wifi/main.cc | 6 +- repos/dde_linux/src/drivers/wifi/wpa.h | 13 +- repos/dde_linux/src/lib/libnl/socket.cc | 4 + repos/dde_linux/src/lib/wifi/dummies.cc | 125 +- repos/dde_linux/src/lib/wifi/event.cc | 198 -- .../src/lib/wifi/include/extern_c_begin.h | 26 - .../src/lib/wifi/include/extern_c_end.h | 20 - .../src/lib/wifi/include/firmware_list.h | 6 +- repos/dde_linux/src/lib/wifi/include/list.h | 102 - .../dde_linux/src/lib/wifi/include/lx_emul.h | 3099 +++++++---------- .../src/lib/wifi/include/net/protocol.h | 6 + .../src/lib/wifi/include/scheduler.h | 249 -- .../wifi/include/spec/x86_32/platform/types.h | 27 - .../wifi/include/spec/x86_64/platform/types.h | 27 - repos/dde_linux/src/lib/wifi/init.cc | 92 +- repos/dde_linux/src/lib/wifi/irq.cc | 290 -- repos/dde_linux/src/lib/wifi/lx.h | 26 +- repos/dde_linux/src/lib/wifi/lxc.h | 40 + repos/dde_linux/src/lib/wifi/lxc_emul.c | 263 +- repos/dde_linux/src/lib/wifi/lxcc_emul.cc | 897 ++--- repos/dde_linux/src/lib/wifi/nic.cc | 99 +- repos/dde_linux/src/lib/wifi/pci_driver.cc | 489 --- repos/dde_linux/src/lib/wifi/scheduler.cc | 262 -- repos/dde_linux/src/lib/wifi/socket.c | 110 - repos/dde_linux/src/lib/wifi/socket_call.cc | 77 +- repos/dde_linux/src/lib/wifi/timer.cc | 357 -- repos/dde_linux/src/lib/wifi/work.cc | 281 -- repos/dde_linux/src/lib/wpa_supplicant/main.c | 7 +- repos/dde_linux/wifi.list | 673 ++-- repos/ports/run/netperf.inc | 8 +- 43 files changed, 2682 insertions(+), 5548 deletions(-) delete mode 100644 repos/dde_linux/src/lib/wifi/event.cc delete mode 100644 repos/dde_linux/src/lib/wifi/include/extern_c_begin.h delete mode 100644 repos/dde_linux/src/lib/wifi/include/extern_c_end.h delete mode 100644 repos/dde_linux/src/lib/wifi/include/list.h create mode 100644 repos/dde_linux/src/lib/wifi/include/net/protocol.h delete mode 100644 repos/dde_linux/src/lib/wifi/include/scheduler.h delete mode 100644 repos/dde_linux/src/lib/wifi/include/spec/x86_32/platform/types.h delete mode 100644 repos/dde_linux/src/lib/wifi/include/spec/x86_64/platform/types.h delete mode 100644 repos/dde_linux/src/lib/wifi/irq.cc create mode 100644 repos/dde_linux/src/lib/wifi/lxc.h delete mode 100644 repos/dde_linux/src/lib/wifi/pci_driver.cc delete mode 100644 repos/dde_linux/src/lib/wifi/scheduler.cc delete mode 100644 repos/dde_linux/src/lib/wifi/socket.c delete mode 100644 repos/dde_linux/src/lib/wifi/timer.cc delete mode 100644 repos/dde_linux/src/lib/wifi/work.cc diff --git a/repos/dde_linux/include/wifi/socket_call.h b/repos/dde_linux/include/wifi/socket_call.h index 83e458e792..88b8c4116c 100644 --- a/repos/dde_linux/include/wifi/socket_call.h +++ b/repos/dde_linux/include/wifi/socket_call.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -68,6 +68,7 @@ struct Wifi::Msghdr unsigned msg_namelen; Iov msg_iov[MAX_IOV_LEN]; unsigned msg_iovlen; + unsigned msg_count; /* XXX recvmsg msg_flags ? */ void *msg_control; unsigned msg_controllen; diff --git a/repos/dde_linux/lib/import/import-wifi_include.mk b/repos/dde_linux/lib/import/import-wifi_include.mk index 79d8a0a67a..4b3228a5ea 100644 --- a/repos/dde_linux/lib/import/import-wifi_include.mk +++ b/repos/dde_linux/lib/import/import-wifi_include.mk @@ -1,19 +1,27 @@ WIFI_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/wifi -DRIVERS_DIR := $(WIFI_CONTRIB_DIR)/drivers -WIFI_DIR := $(WIFI_CONTRIB_DIR)/net +SRC_DIR := $(REP_DIR)/src/lib/wifi + +# architecture-dependent includes +ifeq ($(filter-out $(SPECS),x86),) + ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86 + ifeq ($(filter-out $(SPECS),32bit),) + ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86_32 + endif # 32bit + ifeq ($(filter-out $(SPECS),64bit),) + ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/x86_64 + endif # 64bit +endif # x86 -LIB_DIR := $(REP_DIR)/src/lib/wifi -LIB_INC_DIR := $(LIB_DIR)/include # # The order of include-search directories is important, we need to look into # 'contrib' before falling back to our custom 'lx_emul.h' header. # -INC_DIR += $(LIB_INC_DIR) -INC_DIR += $(WIFI_CONTRIB_DIR)/include $(WIFI_CONTRIB_DIR)/include/uapi \ -INC_DIR += $(LIB_DIR) - -INC_DIR += $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLWIFI) -INC_DIR += $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLEGACY) - +INC_DIR += $(SRC_DIR) \ + $(SRC_DIR)/include +INC_DIR += $(REP_DIR)/src/include +INC_DIR += $(ARCH_SRC_INC_DIR) +INC_DIR += $(WIFI_CONTRIB_DIR)/include \ + $(WIFI_CONTRIB_DIR)/include/uapi \ + $(WIFI_CONTRIB_DIR)/drivers/net/wireless/iwlwifi INC_DIR += $(LIB_CACHE_DIR)/wifi_include/include/include/include diff --git a/repos/dde_linux/lib/mk/libnl.inc b/repos/dde_linux/lib/mk/libnl.inc index 332e1c8341..b2e84b6866 100644 --- a/repos/dde_linux/lib/mk/libnl.inc +++ b/repos/dde_linux/lib/mk/libnl.inc @@ -20,6 +20,8 @@ SRC_C += $(addprefix lib/genl/, ctrl.c family.c genl.c mngt.c) CC_OPT += -DSYSCONFDIR=\"/\" CC_C_OPT += -include $(LIB_INC_DIR)/libnl_emul.h +CC_OPT += -D_LINUX_SOCKET_H + # libnl-route #SRC_C += $(wildcard lib/fib_lookup/*.c) \ # $(wildcard lib/route/act/*.c) \ diff --git a/repos/dde_linux/lib/mk/spec/x86_32/wifi.mk b/repos/dde_linux/lib/mk/spec/x86_32/wifi.mk index c889df2ccf..593ae2237f 100644 --- a/repos/dde_linux/lib/mk/spec/x86_32/wifi.mk +++ b/repos/dde_linux/lib/mk/spec/x86_32/wifi.mk @@ -1,3 +1,5 @@ include $(REP_DIR)/lib/mk/wifi.inc INC_DIR += $(LIB_INC_DIR)/spec/32bit $(LIB_INC_DIR)/spec/x86_32 $(LIB_INC_DIR)/spec/x86 + +vpath %.S $(REP_DIR)/src/lx_kit/spec/x86_32 diff --git a/repos/dde_linux/lib/mk/spec/x86_64/wifi.mk b/repos/dde_linux/lib/mk/spec/x86_64/wifi.mk index 482ca98da7..9f9a3d59e3 100644 --- a/repos/dde_linux/lib/mk/spec/x86_64/wifi.mk +++ b/repos/dde_linux/lib/mk/spec/x86_64/wifi.mk @@ -1,3 +1,5 @@ include $(REP_DIR)/lib/mk/wifi.inc INC_DIR += $(LIB_INC_DIR)/spec/64bit $(LIB_INC_DIR)/spec/x86_64 $(LIB_INC_DIR)/spec/x86 + +vpath %.S $(REP_DIR)/src/lx_kit/spec/x86_64 diff --git a/repos/dde_linux/lib/mk/wifi.inc b/repos/dde_linux/lib/mk/wifi.inc index 9e192656b7..9bdd576969 100644 --- a/repos/dde_linux/lib/mk/wifi.inc +++ b/repos/dde_linux/lib/mk/wifi.inc @@ -11,14 +11,19 @@ SHARED_LIB = yes # wifi_include *must* be the first library, otherwise the include # order is wrong # -LIBS += wifi_include libc-setjmp libc +LIBS += wifi_include libc LD_OPT += --version-script=$(LIB_DIR)/symbol.map -SRC_CC += dummies.cc init.cc lxcc_emul.cc pci_driver.cc timer.cc irq.cc \ - work.cc nic.cc socket_call.cc scheduler.cc event.cc +SRC_CC += dummies.cc init.cc lxcc_emul.cc nic.cc socket_call.cc -SRC_C += lxc_emul.c socket.c +# lx_kit +CC_OPT += -DUSE_INTERNAL_SETJMP +SRC_CC += mapped_io_mem_range.cc irq.cc pci.cc malloc.cc scheduler.cc \ + work.cc timer.cc printf.cc +SRC_S += setjmp.S + +SRC_C += lxc_emul.c CC_WARN = CC_OPT += -fno-builtin-toupper @@ -72,20 +77,23 @@ SRC_C += net/netlink/genetlink.c SRC_C += net/packet/af_packet.c # netlink -SRC_C += lib/average.c SRC_C += lib/nlattr.c SRC_C += lib/rbtree.c +SRC_C += lib/rhashtable.c # wifi mac80211 SRC_C += $(addprefix net/mac80211/, $(notdir $(wildcard $(WIFI_DIR)/mac80211/*.c))) +CC_OPT += -DCONFIG_MAC80211_RC_MINSTREL -DCONFIG_MAC80211_RC_MINSTREL_HT +CC_OPT += -DCONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # wifi rfkill SRC_C += $(addprefix net/rfkill/, $(notdir $(wildcard $(WIFI_DIR)/rfkill/*.c))) INC_DIR += $(WIFI_DIR)/rfkill # wifi cfg80211 -SRC_C += $(addprefix net/wireless/, $(notdir $(wildcard $(WIFI_DIR)/wireless/*.c))) +SRC_C += $(addprefix net/wireless/, $(notdir $(wildcard $(WIFI_DIR)/wireless/*.c))) INC_DIR += $(WIFI_DIR)/wireless +CC_OPT += -DCONFIG_CFG80211_REG_RELAX_NO_IR=0 # led driver SRC_C += $(addprefix drivers/leds/, $(notdir $(wildcard $(DRIVERS_DIR)/leds/*.c))) @@ -99,21 +107,15 @@ SRC_C += $(addprefix $(DRV_DIR_IWLWIFI)/, $(notdir $(wildcard $(WIFI_CONTRI SRC_C += $(addprefix $(DRV_DIR_IWLWIFI)/dvm/, $(notdir $(wildcard $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLWIFI)/dvm/*.c))) SRC_C += $(addprefix $(DRV_DIR_IWLWIFI)/mvm/, $(notdir $(wildcard $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLWIFI)/mvm/*.c))) SRC_C += $(addprefix $(DRV_DIR_IWLWIFI)/pcie/, $(notdir $(wildcard $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLWIFI)/pcie/*.c))) -CC_OPT += -DCONFIG_IWLMVM -DCONFIG_IWLDVM +CC_OPT += -DCONFIG_IWLMVM -DCONFIG_IWLDVM -DCONFIG_IWLWIFI_LEDS CC_OPT += -DCONFIG_IWLWIFI_DEBUG -# iwlegacy driver -DRV_DIR_IWLEGACY := drivers/net/wireless/iwlegacy -SRC_C += $(addprefix $(DRV_DIR_IWLEGACY)/, $(notdir $(wildcard $(WIFI_CONTRIB_DIR)/$(DRV_DIR_IWLEGACY)/*.c))) -CC_OPT += -DCONFIG_IWL3945 -DCONFIG_IWL4965 -CC_OPT += -DCONFIG_IWLEGACY_DEBUG - vpath %.c $(DRIVERS_DIR) vpath %.c $(WIFI_CONTRIB_DIR)/drivers/net/wireless/ vpath %.c $(WIFI_DIR) vpath %.c $(WIFI_CONTRIB_DIR) vpath %.c $(LIB_DIR) vpath %.cc $(LIB_DIR) -vpath %.cc $(LIB_DIR)/signal +vpath %.cc $(REP_DIR)/src/lx_kit # vi: set ft=make : diff --git a/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk b/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk index db7529fc07..0d29c2dbd2 100644 --- a/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk +++ b/repos/dde_linux/lib/mk/wpa_driver_nl80211.mk @@ -27,6 +27,7 @@ INC_DIR += $(WS_CONTRIB_DIR)/src/drivers \ CC_OPT += -DCONFIG_DRIVER_NL80211 CC_OPT += -DCONFIG_LIBNL20 +CC_OPT += -D_LINUX_SOCKET_H vpath %.c $(WS_CONTRIB_DIR) vpath %.cc $(LIB_DIR) diff --git a/repos/dde_linux/patches/wifi.patch b/repos/dde_linux/patches/wifi.patch index 69848401a6..ed9579175e 100644 --- a/repos/dde_linux/patches/wifi.patch +++ b/repos/dde_linux/patches/wifi.patch @@ -12,10 +12,10 @@ index 0977d93..3ccfd0e 100644 /* revert to active table if search table is not valid*/ tbl->lq_type = LQ_NONE; diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c -index 8a44f59..1045fe5 100644 +index 09feff4..f218fe6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.c +++ b/drivers/net/wireless/iwlwifi/iwl-debug.c -@@ -80,7 +80,9 @@ void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ +@@ -78,7 +78,9 @@ void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ \ va_start(args, fmt); \ vaf.va = &args; \ @@ -26,7 +26,7 @@ index 8a44f59..1045fe5 100644 trace_iwlwifi_ ##fn(&vaf); \ va_end(args); \ } -@@ -103,10 +105,12 @@ void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only, +@@ -101,10 +103,12 @@ void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only, va_start(args, fmt); vaf.va = &args; if (!trace_only) { @@ -41,21 +41,33 @@ index 8a44f59..1045fe5 100644 } trace_iwlwifi_err(&vaf); va_end(args); -@@ -127,9 +131,11 @@ void __iwl_dbg(struct device *dev, +@@ -125,9 +129,12 @@ void __iwl_dbg(struct device *dev, vaf.va = &args; #ifdef CONFIG_IWLWIFI_DEBUG if (iwl_have_debug_level(level) && - (!limit || net_ratelimit())) -- dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', -- function, &vaf); +- dev_printk(KERN_DEBUG, dev, "%c %s %pV", +- in_interrupt() ? 'I' : 'U', function, &vaf); + (!limit || net_ratelimit())) { + char buf[256]; + vsnprintf(buf, sizeof(buf), vaf.fmt, *vaf.va); -+ dev_dbg(dev, "%c %s %s", in_interrupt() ? 'I' : 'U', function, buf); ++ dev_printk(KERN_DEBUG, dev, "%c %s %s", ++ in_interrupt() ? 'I' : 'U', function, buf); + } #endif trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); va_end(args); +--- a/drivers/net/wireless/iwlwifi/iwl-trans.c ++++ b/drivers/net/wireless/iwlwifi/iwl-trans.c +@@ -96,7 +96,7 @@ + sizeof(struct iwl_device_cmd) + + trans->dev_cmd_headroom, + sizeof(void *), +- SLAB_HWCACHE_ALIGN, ++ SLAB_HWCACHE_ALIGN | SLAB_LX_DMA, + NULL); + if (!trans->dev_cmd_pool) + goto free; diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 9a856e5..e70f9b7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -82,34 +94,6 @@ index 2b0ba1f..8de16d0 100644 #include #include #include -diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c -index 529d991..5b4c766 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/ops.c -+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c -@@ -385,6 +385,11 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, - trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); - trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K; - -+ if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT) -+ mvm->pm_ops = &pm_mac_ops; -+ else -+ mvm->pm_ops = &pm_legacy_ops; -+ - if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DW_BC_TABLE) - trans_cfg.bc_table_dword = true; - -@@ -462,11 +467,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, - if (err) - goto out_unregister; - -- if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT) -- mvm->pm_ops = &pm_mac_ops; -- else -- mvm->pm_ops = &pm_legacy_ops; -- - memset(&mvm->rx_stats, 0, sizeof(struct mvm_statistics_rx)); - - return op_mode; diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index e526a8c..f3134fe 100644 --- a/include/linux/ieee80211.h @@ -294,3 +278,48 @@ index 9ee6bc1..02d740d 100644 }; int wiphy_sysfs_init(void) +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -3281,7 +3281,7 @@ + + if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) { + __skb_checksum_complete(skb); +- skb_postpull_rcsum(skb, skb->data, ptr - (void *)skb->data); ++ skb_postpull_rcsum(skb, skb->data, (unsigned char*)ptr - skb->data); + } + + delta = remcsum_adjust(ptr, skb->csum, start, offset); +--- a/drivers/net/wireless/iwlwifi/mvm/rx.c ++++ b/drivers/net/wireless/iwlwifi/mvm/rx.c +@@ -115,7 +115,11 @@ + * to do so) we should revisit this and ieee80211_data_to_8023(). + */ + hdrlen = (len <= skb_tailroom(skb)) ? len : +- sizeof(*hdr) + crypt_len + 8; ++ sizeof(*hdr);// + crypt_len + 8; ++ /* ++ * XXX decreasing the hdrlen by removing the appendage makes the ++ * driver work... why? ++ */ + + memcpy(skb_put(skb, hdrlen), hdr, hdrlen); + fraglen = len - hdrlen; +--- a/crypto/scatterwalk.c ++++ b/crypto/scatterwalk.c +@@ -115,9 +115,13 @@ + + sg = scatterwalk_ffwd(tmp, sg, start); + +- if (sg_page(sg) == virt_to_page(buf) && +- sg->offset == offset_in_page(buf)) +- return; ++ // ++ // We have no working virt_to_page and offset_in_page ++ // for this use case. ++ // ++ // if (sg_page(sg) == virt_to_page(buf) && ++ // sg->offset == offset_in_page(buf)) ++ // return; + + scatterwalk_start(&walk, sg); + scatterwalk_copychunks(buf, &walk, nbytes, out); diff --git a/repos/dde_linux/patches/wifi_crypto.patch b/repos/dde_linux/patches/wifi_crypto.patch index 188b945025..5b4ba39888 100644 --- a/repos/dde_linux/patches/wifi_crypto.patch +++ b/repos/dde_linux/patches/wifi_crypto.patch @@ -1,8 +1,8 @@ diff --git a/crypto/ccm.c b/crypto/ccm.c -index 1df8421..a5ee033 100644 +index cc31ea4..7eabdb8 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c -@@ -52,7 +52,8 @@ static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx( +@@ -58,7 +58,8 @@ static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx( { unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req)); @@ -12,13 +12,12 @@ index 1df8421..a5ee033 100644 } static int set_msg_len(u8 *block, unsigned int msglen, int csize) -@@ -681,8 +682,10 @@ static struct aead_request *crypto_rfc4309_crypt(struct aead_request *req) - struct crypto_aead *aead = crypto_aead_reqtfm(req); +@@ -710,8 +711,9 @@ static struct aead_request *crypto_rfc4309_crypt(struct aead_request *req) struct crypto_rfc4309_ctx *ctx = crypto_aead_ctx(aead); struct crypto_aead *child = ctx->child; + struct scatterlist *sg; - u8 *iv = PTR_ALIGN((u8 *)(subreq + 1) + crypto_aead_reqsize(child), - crypto_aead_alignmask(child) + 1); -+ + unsigned long m = crypto_aead_alignmask(child) + 1; + u8 *p = (u8 *)(subreq + 1) + crypto_aead_reqsize(child); + u8 *iv = PTR_ALIGN(p, m); diff --git a/repos/dde_linux/patches/wifi_mem.patch b/repos/dde_linux/patches/wifi_mem.patch index afe7e44522..f4c31fa279 100644 --- a/repos/dde_linux/patches/wifi_mem.patch +++ b/repos/dde_linux/patches/wifi_mem.patch @@ -20,17 +20,6 @@ if (!priv->scan_cmd) { IWL_DEBUG_SCAN(priv, "fail to allocate memory for scan\n"); ---- a/drivers/net/wireless/iwlwifi/pcie/trans.c -+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c -@@ -1593,7 +1593,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, - sizeof(struct iwl_device_cmd) - + trans->dev_cmd_headroom, - sizeof(void *), -- SLAB_HWCACHE_ALIGN, -+ SLAB_HWCACHE_ALIGN | SLAB_LX_DMA, - NULL); - - if (!trans->dev_cmd_pool) { --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c @@ -492,7 +492,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, @@ -80,26 +69,6 @@ /* * Try a regular allocation, when that fails and we're not entitled * to the reserves, fail. ---- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c -+++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c -@@ -365,7 +365,7 @@ - if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX)) - return 0; - -- bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); -+ bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL | GFP_LX_DMA); - if (!bt_cmd) - return -ENOMEM; - cmd.data[0] = bt_cmd; -@@ -467,7 +467,7 @@ - - mvm->bt_kill_msk = bt_kill_msk; - -- bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); -+ bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL | GFP_LX_DMA); - if (!bt_cmd) - return -ENOMEM; - cmd.data[0] = bt_cmd; --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c +++ a/drivers/net/wireless/iwlwifi/iwl-phy-db.c @@ -233,7 +233,7 @@ @@ -111,14 +80,41 @@ if (!entry->data) { entry->size = 0; return -ENOMEM; +diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c +index 13c97f6..68a8657 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c -@@ -450,7 +450,7 @@ - scan_size = sizeof(struct iwl_scan_cmd) + - mvm->fw->ucode_capa.max_probe_length + - (MAX_NUM_SCAN_CHANNELS * sizeof(struct iwl_scan_channel)); +@@ -574,7 +574,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, + + scan_size = iwl_mvm_scan_size(mvm); + - mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL); + mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL | GFP_LX_DMA); if (!mvm->scan_cmd) goto out_free; +--- a/drivers/net/wireless/iwlwifi/mvm/scan.c ++++ b/drivers/net/wireless/iwlwifi/mvm/scan.c +@@ -481,11 +481,11 @@ + else + blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; + +- blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL); ++ blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL|GFP_LX_DMA); + if (!blacklist) + return -ENOMEM; + +- profile_cfg = kzalloc(sizeof(*profile_cfg), GFP_KERNEL); ++ profile_cfg = kzalloc(sizeof(*profile_cfg), GFP_KERNEL|GFP_LX_DMA); + if (!profile_cfg) { + ret = -ENOMEM; + goto free_blacklist; +@@ -916,7 +916,7 @@ + + cmd_size = sizeof(*scan_config) + mvm->fw->ucode_capa.n_scan_channels; + +- scan_config = kzalloc(cmd_size, GFP_KERNEL); ++ scan_config = kzalloc(cmd_size, GFP_KERNEL|GFP_LX_DMA); + if (!scan_config) + return -ENOMEM; + diff --git a/repos/dde_linux/ports/dde_linux.hash b/repos/dde_linux/ports/dde_linux.hash index 235ae14211..76513228bc 100644 --- a/repos/dde_linux/ports/dde_linux.hash +++ b/repos/dde_linux/ports/dde_linux.hash @@ -1 +1 @@ -4bb8e968b614220a0c3931aa669e06f1ad99579b +0391d74c0aa610098907fafca8ef399875a12a70 diff --git a/repos/dde_linux/ports/dde_linux.port b/repos/dde_linux/ports/dde_linux.port index d7d98befbd..46a3db59ce 100644 --- a/repos/dde_linux/ports/dde_linux.port +++ b/repos/dde_linux/ports/dde_linux.port @@ -1,8 +1,9 @@ -LICENSE := GPL -VERSION := 1 -DOWNLOADS := dwc_otg.git usb.archive lxip.archive intel_fb.archive wifi.archive \ - libnl.archive wpa_supplicant.archive \ - fw_6000.archive fw_6205a.archive fw_6205b.archive fw_7260.archive fw_7265.archive +LICENSE := GPLv2 +VERSION := 2 +DOWNLOADS := dwc_otg.git usb.archive intel_fb.archive lxip.archive \ + wifi.archive libnl.archive wpa_supplicant.archive \ + fw_6000.archive fw_6205a.archive fw_6205b.archive fw_7260.archive \ + fw_7265.archive fw_8260.archive # # Tools @@ -13,6 +14,7 @@ $(call check_tool,bison) FLEX = flex YACC = bison + # # The git checkout checks for the existence of SRC_DIR, which is created by the # Linux extraction, therefore make sure to checkout the GIT sources first. @@ -37,6 +39,7 @@ URL(dwc_otg) := https://github.com/nfeske/dwc_otg.git REV(dwc_otg) := r2 DIR(dwc_otg) := $(SRC_DIR_USB)/drivers/usb/host/dwc_otg + # # Intel framebuffer driver # @@ -48,11 +51,11 @@ TAR_OPT(intel_fb) := --strip-components=1 --files-from $(REP_DIR)/intel_fb.list HASH_INPUT += $(REP_DIR)/intel_fb.list # -# mac80211 stack, iwlwifi and iwslegacy sources +# mac80211 stack, iwlwifi sources # SRC_DIR_WIFI := src/lib/wifi -URL(wifi) := ${URL(usb)} -SHA(wifi) := ${SHA(usb)} +URL(wifi) := https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.3.tar.xz +SHA(wifi) := 336d66925a15ce9077cbf2c38acbdc6c2644e33f DIR(wifi) := $(SRC_DIR_WIFI) TAR_OPT(wifi) := --strip-components=1 --files-from $(REP_DIR)/wifi.list HASH_INPUT += $(REP_DIR)/wifi.list @@ -69,6 +72,7 @@ TAR_OPT(lxip) := --strip-components=1 --files-from $(REP_DIR)/lxip.list HASH_INPUT += $(REP_DIR)/lxip.list +# # libnl sources # URL(libnl) := http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz @@ -100,58 +104,54 @@ DIR(wpa_supplicant) := src/app/wpa_supplicant # # Firmware images for iwlwifi Ultimate-N 6300 and Advanced-N 6200 # -URL(fw_6000) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000-ucode-9.221.4.1.tgz -SHA(fw_6000) := a888cf54974702594e82bcbfca20c26d8f906e9f -DIR(fw_6000) := firmware - -default: symlink_fw_6000 -symlink_fw_6000: $(DOWNLOADS) - @$(MSG_PREFIX)symlink firmware 6000-4 to 6000-6 - $(VERBOSE)ln -sf iwlwifi-6000-4.ucode firmware/iwlwifi-6000-6.ucode +URL(fw_6000) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000-ucode-9.221.4.1.tgz +SHA(fw_6000) := a888cf54974702594e82bcbfca20c26d8f906e9f +DIR(fw_6000) := firmware # # Firmware images for iwlwifi Advanced-N 6205 # -URL(fw_6205a) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000g2a-ucode-18.168.6.1.tgz -SHA(fw_6205a) := a542c82dba96e0bfb1b0e01817a59575c5c87fc4 -DIR(fw_6205a) := firmware +URL(fw_6205a) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000g2a-ucode-18.168.6.1.tgz +SHA(fw_6205a) := a542c82dba96e0bfb1b0e01817a59575c5c87fc4 +DIR(fw_6205a) := firmware # # Firmware images for iwlwifi Advanced-N 6230 / 6235 and Wireless-N 130 / 1030 # -URL(fw_6205b) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000g2b-ucode-18.168.6.1.tgz -SHA(fw_6205b) := f4c72b75ae8415661182d63154234dc0a55bc3db -DIR(fw_6205b) := firmware +URL(fw_6205b) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-6000g2b-ucode-18.168.6.1.tgz +SHA(fw_6205b) := f4c72b75ae8415661182d63154234dc0a55bc3db +DIR(fw_6205b) := firmware # # Firmware images for iwlwifi Wireless 7260 # -URL(fw_7260) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7260-ucode-22.24.8.0.tgz -SHA(fw_7260) := d4ef19560464b9dc9a2278c31d6158f0615871c7 -DIR(fw_7260) := firmware +URL(fw_7260) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7260-ucode-16.242414.0.tgz +SHA(fw_7260) := e167ae4d3ed5ac5ca4d8b5f154d47324809717e6 +DIR(fw_7260) := firmware # # Firmware images for iwlwifi Wireless 7265 # -URL(fw_7265) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7265-ucode-22.24.8.0.tgz -SHA(fw_7265) := 92ab0629010c2545689a868bc53b808474410159 -DIR(fw_7265) := firmware +URL(fw_7265) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7265-ucode-16.242414.0.tgz +SHA(fw_7265) := 2a408809f51d552aa2c5d26c9a582d7729ce612b +DIR(fw_7265) := firmware + +# +# Firmware images for iwlwifi Wireless 8260 +# +URL(fw_8260) := https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-8000-ucode-16.242414.0.tgz +SHA(fw_8260) := ec5ee829aeebab93e1228848a7675e4469ab3ce2 +DIR(fw_8260) := firmware + # # Patches # -PATCHES := $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/*.patch))) - -# USB -USB_OPT = -p1 -d$(SRC_DIR_USB) -PATCH_OPT(patches/usb_ax88179.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_csum.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_evdev.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_mem.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_usbnet.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_xchi-quirks.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_wacom.patch) := $(USB_OPT) -PATCH_OPT(patches/usb_xhci-ring.patch) := $(USB_OPT) +PATCHES := $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/w*.patch))) +PATCHES += $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/libnl*.patch))) +PATCHES += $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/lxip*.patch))) +PATCHES += $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/intel*.patch))) +PATCHES += $(addprefix patches/,$(notdir $(wildcard $(REP_DIR)/patches/usb*.patch))) #IP stack LXIP_OPT = -p1 -d$(SRC_DIR_LXIP) @@ -163,9 +163,9 @@ PATCH_OPT(patches/lxip_netlink.patch) := $(LXIP_OPT) # WIFI WIFI_OPT = -p1 -d$(SRC_DIR_WIFI) -PATCH_OPT(patches/wifi.patch) := $(WIFI_OPT) +PATCH_OPT(patches/wifi.patch) := $(WIFI_OPT) PATCH_OPT(patches/wifi_crypto.patch) := $(WIFI_OPT) -PATCH_OPT(patches/wifi_mem.patch) := $(WIFI_OPT) +PATCH_OPT(patches/wifi_mem.patch) := $(WIFI_OPT) # libnl PATCH_OPT(patches/libnl.patch) := -p1 -d ${DIR(libnl)} @@ -180,4 +180,15 @@ PATCH_OPT(patches/intel_fb_update.patch) := -p1 -d ${DIR(intel_fb)} PATCH_OPT(patches/intel_fb_x201.patch) := -p1 -d ${DIR(intel_fb)} PATCH_OPT(patches/intel_fb_report.patch) := -p1 -d ${DIR(intel_fb)} +# USB +USB_OPT = -p1 -d$(SRC_DIR_USB) +PATCH_OPT(patches/usb_ax88179.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_csum.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_evdev.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_mem.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_usbnet.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_xchi-quirks.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_wacom.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_xhci-ring.patch) := $(USB_OPT) + # vi: set ft=make : diff --git a/repos/dde_linux/run/wifi.run b/repos/dde_linux/run/wifi.run index 628db6b6c8..e228b09b3e 100644 --- a/repos/dde_linux/run/wifi.run +++ b/repos/dde_linux/run/wifi.run @@ -92,7 +92,7 @@ append config { - + @@ -128,11 +128,13 @@ append config { install_config $config set firmware_modules { - iwlwifi-6000-6.ucode + iwlwifi-6000-4.ucode iwlwifi-6000g2a-6.ucode iwlwifi-6000g2b-6.ucode - iwlwifi-7260-8.ucode - iwlwifi-7265-8.ucode + iwlwifi-7260-16.ucode + iwlwifi-7265-16.ucode + iwlwifi-7265D-16.ucode + iwlwifi-8000C-16.ucode } # diff --git a/repos/dde_linux/src/drivers/wifi/main.cc b/repos/dde_linux/src/drivers/wifi/main.cc index 65b35f8d7f..3b8b3e2a46 100644 --- a/repos/dde_linux/src/drivers/wifi/main.cc +++ b/repos/dde_linux/src/drivers/wifi/main.cc @@ -231,10 +231,12 @@ struct Main : _ep(ep) { + Genode::Xml_node config = Genode::config()->xml_node(); try { - config_verbose = Genode::config()->xml_node().attribute("verbose").has_value("yes"); + config_verbose = config.attribute("verbose").has_value("yes"); } catch (...) { } - _wpa = new (Genode::env()->heap()) Wpa_thread(wpa_startup_lock()); + + _wpa = new (Genode::env()->heap()) Wpa_thread(wpa_startup_lock(), config_verbose); _wpa->start(); diff --git a/repos/dde_linux/src/drivers/wifi/wpa.h b/repos/dde_linux/src/drivers/wifi/wpa.h index d74dfceb00..a1df001771 100644 --- a/repos/dde_linux/src/drivers/wifi/wpa.h +++ b/repos/dde_linux/src/drivers/wifi/wpa.h @@ -18,7 +18,7 @@ #include /* entry function */ -extern "C" int wpa_main(void); +extern "C" int wpa_main(int); extern "C" void wpa_conf_reload(void); class Wpa_thread : public Genode::Thread_deprecated<8 * 1024 * sizeof(long)> @@ -26,18 +26,21 @@ class Wpa_thread : public Genode::Thread_deprecated<8 * 1024 * sizeof(long)> private: Genode::Lock &_lock; - int _exit; + int _exit; + bool _debug_msg; public: - Wpa_thread(Genode::Lock &lock) - : Thread_deprecated("wpa_supplicant"), _lock(lock), _exit(-1) { } + Wpa_thread(Genode::Lock &lock, bool debug_msg) + : + Thread_deprecated("wpa_supplicant"), + _lock(lock), _exit(-1), _debug_msg(debug_msg) { } void entry() { /* wait until the wifi driver is up and running */ _lock.lock(); - _exit = wpa_main(); + _exit = wpa_main(_debug_msg); Genode::sleep_forever(); } }; diff --git a/repos/dde_linux/src/lib/libnl/socket.cc b/repos/dde_linux/src/lib/libnl/socket.cc index e3d2494738..21144b83ee 100644 --- a/repos/dde_linux/src/lib/libnl/socket.cc +++ b/repos/dde_linux/src/lib/libnl/socket.cc @@ -180,6 +180,7 @@ ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, w_msg.msg_iovlen = 1; w_msg.msg_iov[0].iov_base = buf; w_msg.msg_iov[0].iov_len = len; + w_msg.msg_count = len; /* FIXME convert to/from Sockaddr */ /* FIXME flags values */ @@ -221,6 +222,7 @@ ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags) for (unsigned i = 0; i < w_msg.msg_iovlen; ++i) { w_msg.msg_iov[i].iov_base = msg->msg_iov[i].iov_base; w_msg.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; + w_msg.msg_count += msg->msg_iov[i].iov_len; } w_msg.msg_control = msg->msg_control; @@ -279,6 +281,7 @@ ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags) for (unsigned i = 0; i < w_msg.msg_iovlen; ++i) { w_msg.msg_iov[i].iov_base = msg->msg_iov[i].iov_base; w_msg.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; + w_msg.msg_count += msg->msg_iov[i].iov_len; } int const err = socket_call.sendmsg(s, &w_msg, Wifi::WIFI_F_NONE); @@ -306,6 +309,7 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, w_msg.msg_iovlen = 1; w_msg.msg_iov[0].iov_base = const_cast(buf); w_msg.msg_iov[0].iov_len = len; + w_msg.msg_count = len; /* FIXME convert to/from Sockaddr */ /* FIXME flags values */ diff --git a/repos/dde_linux/src/lib/wifi/dummies.cc b/repos/dde_linux/src/lib/wifi/dummies.cc index cba5e00189..a63a11041c 100644 --- a/repos/dde_linux/src/lib/wifi/dummies.cc +++ b/repos/dde_linux/src/lib/wifi/dummies.cc @@ -5,19 +5,20 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #include +#include extern "C" { typedef long DUMMY; enum { - SHOW_DUMMY = 0, + SHOW_DUMMY = 1, SHOW_SKIP = 0, SHOW_RET = 0, }; @@ -36,6 +37,15 @@ enum { return retval; \ } +#define DUMMY_STOP(retval, name) \ + DUMMY name(void) { \ + do { \ + PWRN( #name " called (from %p) stopped", __builtin_return_address(0)); \ + Genode::sleep_forever(); \ + } while (0); \ + return retval; \ +} + #define DUMMY_RET(retval, name) \ DUMMY name(void) { \ if (SHOW_RET) \ @@ -114,8 +124,8 @@ DUMMY_SKIP(0, local_bh_disable) DUMMY_SKIP(0, local_bh_enable) DUMMY_SKIP(0, dma_unmap_page) -/*FIXME*/DUMMY(0, dma_set_coherent_mask) -/*FIXME*/DUMMY(0, dma_set_mask) +DUMMY_SKIP(0, dma_set_coherent_mask) /* we set the mask always to ~0UL */ +DUMMY_SKIP(0, dma_set_mask) /* in the PCI driver */ DUMMY(-1, dma_sync_single_for_cpu) DUMMY(-1, dma_sync_single_for_device) @@ -148,11 +158,9 @@ DUMMY(-1, generic_pipe_buf_confirm) DUMMY(-1, generic_pipe_buf_map) DUMMY(-1, generic_pipe_buf_unmap) DUMMY(-1, linkwatch_fire_event) -DUMMY(-1, mod_delayed_work) DUMMY(-1, need_resched) DUMMY(-1, open_softirq) DUMMY(-1, raw_notifier_chain_unregister) -DUMMY(-1, system_wq) DUMMY(-1, vlan_do_receive) DUMMY(-1, vlan_untag) DUMMY(-1, yield) @@ -163,7 +171,7 @@ DUMMY(-1, add_device_randomness) DUMMY(0, add_uevent_var) DUMMY(0, atomic64_read) DUMMY(0, bitmap_empty) -DUMMY(0, call_rcu) +DUMMY_SKIP(0, call_rcu) DUMMY(0, csum_block_add) DUMMY(0, csum_fold) DUMMY(0, csum_partial) @@ -194,7 +202,6 @@ DUMMY(0, idr_find) DUMMY(0, idr_for_each) DUMMY(0, idr_init) DUMMY(0, idr_remove) -DUMMY(0, init_timer_deferrable) DUMMY(0, ip_hdr) DUMMY(0, ipv4_get_dsfield) DUMMY(0, ipv6_get_dsfield) @@ -209,7 +216,7 @@ DUMMY(0, kstrtoul) DUMMY(0, linkwatch_init_dev) DUMMY(0, local_softirq_pending) DUMMY(0, mb) -DUMMY(0, misc_register) +DUMMY_SKIP(0, misc_register) DUMMY(0, mmiowb) DUMMY(0, net_dmaengine_put) DUMMY(0, net_info_ratelimited) @@ -256,8 +263,6 @@ DUMMY(0, poll_wait) DUMMY(0, preempt_disable) DUMMY(0, preempt_enable) DUMMY(0, put_cpu) -DUMMY(0, put_unaligned_be16) -DUMMY(0, put_unaligned_le16) DUMMY(0, put_unaligned_le64) DUMMY(0, qdisc_all_tx_empty) DUMMY(0, raise_softirq_irqoff) @@ -287,7 +292,7 @@ DUMMY(0, this_cpu_inc) DUMMY(0, toupper) DUMMY(0, wait_event_interruptible) DUMMY(0, work_busy) -DUMMY(0, class_register) +DUMMY_SKIP(0, class_register) DUMMY(0, class_unregister) DUMMY(0, debugfs_remove) DUMMY(0, dev_set_uevent_suppress) @@ -312,14 +317,13 @@ DUMMY(0, kernel_sendmsg) DUMMY(0, put_cmsg) DUMMY(0, put_cred) DUMMY(0, put_pid) -DUMMY(0, remove_wait_queue) DUMMY(0, schedule) DUMMY(-1, security_sk_free) DUMMY(0, set_current_state) DUMMY(0, signal_pending) DUMMY(0, smp_wmb) -DUMMY(0, sock_update_classid) -DUMMY(0, sock_update_netprioidx) +DUMMY_SKIP(0, sock_update_classid) +DUMMY_SKIP(0, sock_update_netprioidx) DUMMY(0, sock_wake_async) DUMMY(0, static_key_slow_dec) DUMMY(0, task_tgid_vnr) @@ -332,8 +336,6 @@ DUMMY(-1, csum_partial_ext) DUMMY(-1, genl_register_family_with_ops_groups) DUMMY(-1, ktime_sub) DUMMY(-1, sg_init_one) -DUMMY(-1, sg_init_table) -DUMMY(-1, sg_set_buf) DUMMY(-1, vlan_hw_offload_capable) DUMMY(-1, vlan_tx_tag_get_id) DUMMY(-1, vzalloc) @@ -363,26 +365,19 @@ DUMMY(-1, unregister_pernet_device) DUMMY(0, __hw_addr_init) DUMMY(0, __hw_addr_sync) DUMMY(0, __hw_addr_unsync) -DUMMY(0, dev_alloc_name) +DUMMY_SKIP(0, dev_alloc_name) DUMMY(0, dev_change_net_namespace) DUMMY(0, dev_close) DUMMY(0, dev_kfree_skb_any) -DUMMY(0, dev_net_set) +DUMMY_SKIP(0, dev_net_set) DUMMY(0, dev_open) DUMMY_SKIP(0, dev_hold) DUMMY_SKIP(0, dev_put) DUMMY(0, dst_release) DUMMY(0, free_netdev) DUMMY(0, net_disable_timestamp) -DUMMY(0, netdev_set_default_ethtool_ops) -DUMMY(0, netif_rx_ni) -DUMMY(0, netif_start_subqueue) -DUMMY(0, netif_stop_subqueue) -DUMMY(0, netif_tx_start_all_queues) -DUMMY(0, netif_tx_stop_all_queues) -DUMMY(0, netif_wake_subqueue) DUMMY(0, next_net_device) -DUMMY(0, synchronize_net) +DUMMY_SKIP(0, synchronize_net) DUMMY(0, unregister_netdevice_many) DUMMY(0, unregister_netdevice_notifier) DUMMY(0, unregister_netdevice_queue) @@ -404,11 +399,8 @@ DUMMY(0, device_can_wakeup) DUMMY(0, device_reprobe) DUMMY(0, device_set_wakeup_enable) DUMMY(0, ip_fast_csum) -DUMMY(0, iwl_mvm_sf_update) -DUMMY(0, prandom_u32) DUMMY(0, request_firmware) DUMMY(0, tcp_v4_check) -DUMMY(0, netif_rx) DUMMY(0, sk_attach_filter) DUMMY(0, __class_create) @@ -464,8 +456,6 @@ DUMMY(0, rfkill_remove_epo_lock) DUMMY(0, rfkill_restore_states) DUMMY(0, rfkill_switch_all) DUMMY(0, send_sigurg) -DUMMY(0, sg_mark_end) -DUMMY(0, sg_set_page) DUMMY(0, simple_strtoul) DUMMY(0, skb_gro_len) DUMMY(0, skb_gro_offset) @@ -482,12 +472,9 @@ DUMMY(0, xfrm_sk_free_policy) DUMMY(0, strncpy) DUMMY(0, __ethtool_get_settings) -DUMMY(0, __netif_tx_lock_bh) -DUMMY(0, __netif_tx_unlock_bh) DUMMY(0, __skb_get_hash) DUMMY(0, __sock_recv_ts_and_drops) DUMMY(0, cpu_relax) -DUMMY(0, dev_get_by_index_rcu) DUMMY(0, dev_get_by_name) DUMMY(0, dev_get_by_name_rcu) DUMMY(0, dev_mc_add) @@ -504,9 +491,6 @@ DUMMY(0, getnstimeofday) DUMMY(0, ip_check_defrag) DUMMY(0, ktime_to_timespec_cond) DUMMY(0, netdev_get_tx_queue) -DUMMY(0, netif_skb_features) -DUMMY(0, netif_supports_nofcs) -DUMMY(0, netif_xmit_frozen_or_stopped) DUMMY(0, offset_in_page) DUMMY(0, prandom_u32_max) DUMMY(0, raw_smp_processor_id) @@ -541,23 +525,72 @@ DUMMY(0, netdev_boot_setup) DUMMY(0, netdev_master_upper_dev_get) DUMMY(0, netdev_state_change) DUMMY(0, netdev_unregistering_wq) -DUMMY(0, netif_dormant) DUMMY(0, autoremove_wake_function) DUMMY(0, get_user_pages_fast) -DUMMY(0, iov_length) DUMMY(0, memcpy_toiovecend) DUMMY(0, netdev_rx_csum_fault) DUMMY(0, release_pages) DUMMY(0, sk_busy_loop) DUMMY(0, sk_can_busy_loop) -DUMMY(0, sg_next) -DUMMY(0, complete_all) -DUMMY(0, module_put_and_exit) -DUMMY(0, simple_strtol) -DUMMY(0, alg_test) +DUMMY_SKIP(0, complete_all) +DUMMY_SKIP(0, module_put_and_exit) +DUMMY_SKIP(0, simple_strtol) +DUMMY_SKIP(0, alg_test) -DUMMY(0, alloc_workqueue) +DUMMY(0, __cfg80211_leave_ocb) +DUMMY(0, __skb_flow_dissect) +DUMMY(0, __sock_tx_timestamp) +DUMMY(0, bpf_prog_create_from_user) +DUMMY(0, bpf_prog_destroy) +DUMMY(0, bpf_prog_run_clear_cb) +DUMMY(0, cfg80211_join_ocb) +DUMMY(0, cfg80211_leave_ocb) +DUMMY(0, class_find_device) +DUMMY(0, config_enabled) +DUMMY(0, dev_change_proto_down) +DUMMY(0, dev_get_iflink) +DUMMY(0, dev_get_phys_port_name) +DUMMY(0, device_create_with_groups) +DUMMY(0, device_enable_async_suspend) +DUMMY(0, fatal_signal_pending) +DUMMY_RET(1, file_ns_capable) +DUMMY(0, flow_keys_dissector) +DUMMY(0, get_net_ns_by_id) +DUMMY(0, gfpflags_allow_blocking) +DUMMY(0, init_dummy_netdev) +DUMMY(0, napi_gro_flush) +DUMMY(0, netdev_start_xmit) +DUMMY_RET(0, netdev_uses_dsa) +DUMMY_RET(0, page_is_pfmemalloc) +DUMMY_RET(0, peernet2id) +DUMMY(0, pr_err_once) +DUMMY(0, sk_attach_bpf) +DUMMY(0, sk_filter_uncharge) +DUMMY(0, skb_checksum_help) +DUMMY(0, skb_get_tx_queue) +DUMMY(0, skb_gso_segment) +DUMMY(0, skb_vlan_tag_get) +DUMMY(0, skb_vlan_tag_present) +DUMMY(0, smp_mb__before_atomic) +DUMMY(0, sock_diag_broadcast_destroy) +DUMMY(0, sock_diag_has_destroy_listeners) +DUMMY(0, switchdev_port_attr_get) + +DUMMY_RET(0, netif_dormant) +DUMMY(0, netif_napi_add) +DUMMY(0, netif_napi_del) +DUMMY_STOP(0, netif_rx) +DUMMY(0, netif_skb_features) +DUMMY(0, netif_supports_nofcs) +DUMMY(0, netif_xmit_frozen_or_drv_stopped) +DUMMY(0, netif_xmit_frozen_or_stopped) +DUMMY_STOP(0, netif_rx_ni) +DUMMY_STOP(0, netif_tx_start_all_queues) +DUMMY_STOP(0, netif_tx_stop_all_queues) + +DUMMY(0, peernet_has_id) +DUMMY(0, peernet2id_alloc) } /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/event.cc b/repos/dde_linux/src/lib/wifi/event.cc deleted file mode 100644 index 83f5b18164..0000000000 --- a/repos/dde_linux/src/lib/wifi/event.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* - * \brief Completions and events - * \author Christian Helmuth - * \author Josef Soentgen - * \date 2014-10-14 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include - -/* local includes */ -#include -#include - -#include -# include -#include - -static bool const verbose = false; -#define PWRNV(...) do { if (verbose) PWRN(__VA_ARGS__); } while (0) - -extern "C" { - -/************************ - ** linux/completion.h ** - ************************/ - -typedef Lx::Task::List_element Wait_le; -typedef Lx::Task::List Wait_list; - -void init_waitqueue_head(wait_queue_head_t *wq) -{ - wq->list = new (Genode::env()->heap()) Wait_list; -} - - -int waitqueue_active(wait_queue_head_t *wq) -{ - Wait_list *list = static_cast(wq->list); - if (!list) - return 0; - - return list->first() ? 1 : 0; -} - - -void __wake_up(wait_queue_head_t *wq, bool all) -{ - Wait_list *list = static_cast(wq->list); - if (!list) { - PWRNV("wait_queue_head_t is empty, wq: %p called from: %p", wq, __builtin_return_address(0)); - return; - } - - Wait_le *le = list->first(); - do { - if (!le) - return; - - le->object()->unblock(); - } while (all && (le = le->next())); -} - - -void wake_up_interruptible_sync_poll(wait_queue_head_t *wq, int) -{ - __wake_up(wq, false); -} - - -void __wait_event(wait_queue_head_t wq) -{ - Wait_list *list = static_cast(wq.list); - if (!list) { - PERR("__wait_event(): empty list in wq: %p", &wq); - Genode::sleep_forever(); - } - - Lx::Task *task = Lx::scheduler().current(); - - task->wait_enqueue(list); - task->block_and_schedule(); - task->wait_dequeue(list); -} - - -void init_completion(struct completion *work) -{ - work->done = 0; -} - - -void complete(struct completion *work) -{ - work->done = 1; -} - - -static void __wait_completion(struct completion *work) -{ - // PERR("%s:%d: FIXME", __func__, __LINE__); -} - - -unsigned long wait_for_completion_timeout(struct completion *work, - unsigned long timeout) -{ - __wait_completion(work); - return 1; -} - - -int wait_for_completion_interruptible(struct completion *work) -{ - __wait_completion(work); - return 0; -} - - -long wait_for_completion_interruptible_timeout(struct completion *work, - unsigned long timeout) -{ - __wait_completion(work); - return 1; -} - - -void wait_for_completion(struct completion *work) -{ - __wait_completion(work); -} - - -/****************** - ** linux/wait.h ** - ******************/ - -void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *w, int state) -{ - if (!q) { - PWRNV("prepare_to_wait: wait_queue_head_t is 0, ignore, called from: %p", - __builtin_return_address(0)); - return; - } - - Wait_list *list = static_cast(q->list); - Lx::Task *task = Lx::scheduler().current(); - - task->wait_enqueue(list); -} - - -void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *w, int state) -{ - prepare_to_wait(q, w, state); -} - - -void finish_wait(wait_queue_head_t *q, wait_queue_t *w) -{ - if (!q) { - PWRNV("finish_wait: wait_queue_head_t is 0, ignore, called from: %p", - __builtin_return_address(0)); - return; - } - - Wait_list *list = static_cast(q->list); - Lx::Task *task = Lx::scheduler().current(); - - task->wait_dequeue(list); -} - - -/******************* - ** linux/timer.h ** - *******************/ - -signed long schedule_timeout_uninterruptible(signed long timeout) -{ - // PERR("%s:%d: FIXME", __func__, __LINE__); - return 0; -} - - -int wake_up_process(struct task_struct *tsk) -{ - // PERR("%s:%d: FIXME does task: %p needs to be woken up?", __func__, __LINE__, tsk); - return 0; -} - -} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h b/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h deleted file mode 100644 index 8fadabf14f..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/extern_c_begin.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * \brief Include before including Linux headers in C++ - * \author Christian Helmuth - * \date 2014-08-21 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#define extern_c_begin - -extern "C" { - -/* some warnings should only be switched of for Linux headers */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpointer-arith" -#pragma GCC diagnostic ignored "-Wsign-compare" - -/* deal with C++ keywords used for identifiers etc. */ -#define private private_ -#define class class_ -#define new new_ diff --git a/repos/dde_linux/src/lib/wifi/include/extern_c_end.h b/repos/dde_linux/src/lib/wifi/include/extern_c_end.h deleted file mode 100644 index ac6b23f8df..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/extern_c_end.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * \brief Include after including Linux headers in C++ - * \author Christian Helmuth - * \date 2014-08-21 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#undef new -#undef class -#undef private - -#pragma GCC diagnostic pop - -} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/include/firmware_list.h b/repos/dde_linux/src/lib/wifi/include/firmware_list.h index 3fbca1354c..ab06e94ac8 100644 --- a/repos/dde_linux/src/lib/wifi/include/firmware_list.h +++ b/repos/dde_linux/src/lib/wifi/include/firmware_list.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -18,9 +18,9 @@ typedef __SIZE_TYPE__ size_t; struct Firmware_list { - char const *name; + char const *requested_name; size_t size; + char const *available_name; }; #endif /* _FIRMWARE_LIST_H_ */ - diff --git a/repos/dde_linux/src/lib/wifi/include/list.h b/repos/dde_linux/src/lib/wifi/include/list.h deleted file mode 100644 index c12fdaf1ad..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/list.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * \brief Slightly improved list - * \author Christian Helmuth - * \date 2014-09-25 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _LIST_H_ -#define _LIST_H_ - -#include - - -namespace Lx { - template class List; - template class List_element; -} - -template -class Lx::List : private Genode::List -{ - private: - - typedef Genode::List Base; - - public: - - using Base::Element; - - void append(LT const *le) - { - LT *at = nullptr; - - for (LT *l = first(); l; l = l->next()) - at = l; - - Base::insert(le, at); - } - - void prepend(LT const *le) - { - Base::insert(le); - } - - void insert_before(LT const *le, LT const *at) - { - if (at == first()) { - prepend(le); - return; - } else if (!at) { - append(le); - return; - } - - for (LT *l = first(); l; l = l->next()) - if (l->next() == at) - at = l; - - Base::insert(le, at); - } - - - /**************************** - ** Genode::List interface ** - ****************************/ - - LT *first() { return Base::first(); } - LT const *first() const { return Base::first(); } - - void insert(LT const *le, LT const *at = 0) - { - Base::insert(le, at); - } - - void remove(LT const *le) - { - Base::remove(le); - } -}; - - -template -class Lx::List_element : public Lx::List >::Element -{ - private: - - T *_object; - - public: - - List_element(T *object) : _object(object) { } - - T *object() const { return _object; } -}; - -#endif /* _LIST_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/lx_emul.h b/repos/dde_linux/src/lib/wifi/include/lx_emul.h index deed15e5e2..36b09a4a5f 100644 --- a/repos/dde_linux/src/lib/wifi/include/lx_emul.h +++ b/repos/dde_linux/src/lib/wifi/include/lx_emul.h @@ -8,7 +8,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -17,54 +17,33 @@ #ifndef _LX_EMUL_H_ #define _LX_EMUL_H_ -#if defined(__cplusplus) && !defined(extern_c_begin) -#error Include extern_c_begin.h before lx_emul.h -#endif /* __cplusplus */ - #include +#include -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#define LINUX_VERSION_CODE KERNEL_VERSION(3,14,5) +#include #define KBUILD_MODNAME "mod-noname" +/***************** + ** asm/param.h ** + *****************/ + +enum { HZ = 100 }; + #define DEBUG_LINUX_PRINTK 1 - -void lx_printf(char const *, ...) __attribute__((format(printf, 1, 2))); -void lx_vprintf(char const *, va_list); - +#include /*************** ** asm/bug.h ** ***************/ -#define WARN_ON(condition) ({ \ - int ret = !!(condition); \ - if (ret) lx_printf("[%s] WARN_ON(" #condition ") ", __func__); \ - ret; }) +#include -#define WARN(condition, fmt, arg...) ({ \ - int ret = !!(condition); \ - if (ret) lx_printf("[%s] *WARN* " fmt , __func__ , ##arg); \ - ret; }) +#define BUILD_BUG_ON(condition) -#define BUG() do { \ - lx_printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ - while (1) ; \ -} while (0) - -#define WARN_ON_ONCE WARN_ON -#define WARN_ONCE WARN - -#define BUG_ON(condition) do { if (condition) BUG(); } while(0) - - -/********************* - ** linux/kconfig.h ** - *********************/ - -#define IS_ENABLED(x) x +#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ + BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) /********************* @@ -74,122 +53,213 @@ void lx_vprintf(char const *, va_list); void cpu_relax(void); -/***************** - ** asm/param.h ** - *****************/ - -enum { HZ = 100 }; - - -/******************* - ** asm/cmpxchg.h ** - *******************/ - -#define cmpxchg(ptr, o, n) ({ \ - typeof(*ptr) prev = *ptr; \ - *ptr = (*ptr == o) ? n : *ptr; \ - prev;\ - }) - -#define xchg(ptr, x) ({ \ - typeof(*ptr) old = *ptr; \ - *ptr = x; \ - old; \ -}) - - -/******************************* - ** asm-generic/bitsperlong.h ** - *******************************/ - -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) - - /****************** ** asm/atomic.h ** ******************/ -#include +#include -#define ATOMIC_INIT(i) { (i) } - -typedef struct atomic { long counter; } atomic_t; -typedef atomic_t atomic_long_t; - -static inline int atomic_read(const atomic_t *p) { return p->counter; } -static inline void atomic_set(atomic_t *p, int i) { p->counter = i; } -static inline void atomic_sub(int i, atomic_t *p) { p->counter -= i; } -static inline void atomic_add(int i, atomic_t *p) { p->counter += i; } -static inline int atomic_sub_return(int i, atomic_t *p) { p->counter -= i; return p->counter; } -static inline int atomic_add_return(int i, atomic_t *p) { p->counter += i; return p->counter; } -static inline int atomic_sub_and_test(int i, atomic_t *p) { return atomic_sub_return(i, p) == 0; } - -static inline void atomic_dec(atomic_t *p) { atomic_sub(1, p); } -static inline void atomic_inc(atomic_t *p) { atomic_add(1, p); } -static inline int atomic_dec_return(atomic_t *p) { return atomic_sub_return(1, p); } -static inline int atomic_inc_return(atomic_t *p) { return atomic_add_return(1, p); } -static inline int atomic_dec_and_test(atomic_t *p) { return atomic_sub_and_test(1, p); } -static inline int atomic_inc_not_zero(atomic_t *p) { return p->counter ? atomic_inc_return(p) : 0; } - -static inline void atomic_long_inc(atomic_long_t *p) { atomic_add(1, p); } -static inline void atomic_long_sub(int i, atomic_long_t *p) { atomic_sub(i, p); } -static inline long atomic_long_add_return(long i, atomic_long_t *p) { return atomic_add_return(i, p); } -static inline long atomic_long_read(atomic_long_t *p) { return atomic_read(p); } - -static inline int atomic_cmpxchg(atomic_t *v, int old, int n) +static inline int atomic_dec_if_positive(atomic_t *v) { - return cmpxchg(&v->counter, old, n); + int c, old, dec; + c = atomic_read(v); + for (;;) { + dec = c - 1; + if (dec < 0) break; + old = atomic_cmpxchg((v), c, dec); + if (old == c) break; + c = old; + } + return dec; } -static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) +static inline void atomic_long_set(atomic_long_t *l, long i) { - int val, c = hint; - - /* sanity test, should be removed by compiler if hint is a constant */ - if (!hint) - return atomic_inc_not_zero(v); - - do { - val = atomic_cmpxchg(v, c, c + 1); - if (val == c) - return 1; - c = val; - } while (c); - - return 0; + l->counter = i; } -static inline int atomic_add_unless(atomic_t *v, int a, int u) -{ - int ret; - unsigned long flags; - (void)flags; - ret = v->counter; - if (ret != u) - v->counter += a; +/******************* + ** linux/types.h ** + *******************/ - return ret != u; -} +#include -#define smp_mb__before_atomic_dec() +typedef int clockid_t; + +typedef size_t __kernel_size_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; + +#define __aligned_u64 __u64 __attribute__((aligned(8))) + +#define DECLARE_BITMAP(name,bits) \ + unsigned long name[BITS_TO_LONGS(bits)] -/******************************* - ** asm-generic/atomic-long.h ** - *******************************/ +/************************ + ** uapi/linux/types.h ** + ************************/ -#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i) +#define __bitwise__ + +typedef __u16 __le16; +typedef __u32 __le32; +typedef __u64 __le64; +typedef __u16 __be16; +typedef __u32 __be32; +typedef __u64 __be64; + +typedef __u16 __sum16; +typedef __u32 __wsum; + +/* + * needed by include/net/cfg80211.h + */ +struct callback_head { + struct callback_head *next; + void (*func)(struct callback_head *head); +}; +#define rcu_head callback_head /******************* ** asm/barrier.h ** *******************/ -#define mb() asm volatile ("": : :"memory") -#define smp_mb() mb() -#define smp_rmb() mb() -#define smp_wmb() mb() +#include + +#define smp_load_acquire(p) *(p) +#define smp_store_release(p, v) *(p) = v; +#define smp_mb__before_atomic() mb() + + +/********************** + ** asm-generic/io.h ** + **********************/ + +#include + +#define mmiowb() barrier() +struct device; + +void *ioremap(resource_size_t offset, unsigned long size); +void iounmap(volatile void *addr); +void *devm_ioremap(struct device *dev, resource_size_t offset, + unsigned long size); +void *devm_ioremap_nocache(struct device *dev, resource_size_t offset, + unsigned long size); + +void *ioremap_wc(resource_size_t phys_addr, unsigned long size); + +#define ioremap_nocache ioremap + +void *phys_to_virt(unsigned long address); + + +/********************** + ** linux/compiler.h ** + **********************/ + +#include + +#define __cond_lock(x,c) (c) + +#define noinline_for_stack noinline + +static inline void __write_once_size(volatile void *p, void *res, int size) +{ + switch (size) { + case 1: *(volatile __u8 *)p = *(__u8 *)res; break; + case 2: *(volatile __u16 *)p = *(__u16 *)res; break; + case 4: *(volatile __u32 *)p = *(__u32 *)res; break; + case 8: *(volatile __u64 *)p = *(__u64 *)res; break; + default: + barrier(); + __builtin_memcpy((void *)p, (const void *)res, size); + barrier(); + } +} + +static inline void __read_once_size(const volatile void *p, void *res, int size) +{ + switch (size) { + case 1: *(__u8 *)res = *(volatile __u8 *)p; break; + case 2: *(__u16 *)res = *(volatile __u16 *)p; break; + case 4: *(__u32 *)res = *(volatile __u32 *)p; break; + case 8: *(__u64 *)res = *(volatile __u64 *)p; break; + default: + barrier(); + __builtin_memcpy((void *)res, (const void *)p, size); + barrier(); + } +} + +#define READ_ONCE(x) \ +({ \ + union { typeof(x) __val; char __c[1]; } __u; \ + __read_once_size(&(x), __u.__c, sizeof(x)); \ + __u.__val; \ +}) + + +/************************** + ** linux/compiler-gcc.h ** + **************************/ + +#ifdef __aligned +#undef __aligned +#endif +#define __aligned(x) __attribute__((aligned(x))) +#define __visible __attribute__((externally_visible)) + +#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) + + +/******************** + ** linux/module.h ** + ********************/ + +#include + +static inline bool module_sig_ok(struct module *module) { return true; } + +#define module_name(mod) "foobar" + + +/************************* + ** linux/moduleparam.h ** + *************************/ + +#define __MODULE_INFO(tag, name, info) + +static inline void kernel_param_lock(struct module *mod) { } +static inline void kernel_param_unlock(struct module *mod) { } + + +/******************* + ** linux/errno.h ** + *******************/ + +#include + + +/***************** + ** linux/err.h ** + *****************/ + +static inline int PTR_ERR_OR_ZERO(const void *ptr) +{ + if (IS_ERR(ptr)) return PTR_ERR(ptr); + else return 0; +} + + +/******************** + ** linux/poison.h ** + ********************/ + +#include /**************** @@ -234,203 +304,11 @@ enum pageflags **********************/ void flush_dcache_page(struct page *page); - - -/******************* - ** linux/types.h ** - *******************/ - -#include - -typedef uint32_t uint; -typedef unsigned long ulong; - -typedef int8_t s8; -typedef uint8_t u8; -typedef int16_t s16; -typedef uint16_t u16; -typedef int32_t s32; -typedef uint32_t u32; -typedef int64_t s64; -typedef uint64_t u64; - -typedef int8_t __s8; -typedef uint8_t __u8; -typedef int16_t __s16; -typedef uint16_t __u16; -typedef int32_t __s32; -typedef uint32_t __u32; -typedef int64_t __s64; -typedef uint64_t __u64; - -typedef __u16 __le16; -typedef __u32 __le32; -typedef __u64 __le64; -typedef __u16 __be16; -typedef __u32 __be32; -typedef __u64 __be64; - -typedef __u16 __sum16; -typedef __u32 __wsum; - -typedef u64 sector_t; -typedef int clockid_t; - -struct list_head { - struct list_head *next, *prev; -}; - -struct hlist_head { - struct hlist_node *first; -}; - -struct hlist_node { - struct hlist_node *next, **pprev; -}; - -#ifndef __cplusplus -typedef _Bool bool; -enum { true = 1, false = 0 }; -#endif /* __cplusplus */ - -#ifndef NULL -#ifdef __cplusplus -#define NULL nullptr -#else -#define NULL ((void *)0) -#endif /* __cplusplus */ -#endif /* NULL */ - -typedef unsigned gfp_t; -typedef unsigned long dma_addr_t; -typedef unsigned long pgoff_t; -typedef long long loff_t; -typedef long ssize_t; -typedef unsigned long uintptr_t; -typedef int dev_t; -typedef size_t resource_size_t; -typedef long off_t; -typedef int pid_t; -typedef unsigned fmode_t; -typedef u32 uid_t; -typedef u32 gid_t; -typedef long __kernel_time_t; -typedef unsigned short umode_t; -typedef __u16 __be16; -typedef __u32 __be32; -typedef size_t __kernel_size_t; -typedef long __kernel_time_t; -typedef long __kernel_suseconds_t; -typedef unsigned long dma_addr_t; -typedef long clock_t; - -#ifndef __cplusplus -typedef u16 wchar_t; -#endif - -#define __aligned_u64 __u64 __attribute__((aligned(8))) - -/* - * needed by include/net/cfg80211.h - */ -struct callback_head { - struct callback_head *next; - void (*func)(struct callback_head *head); -}; -#define rcu_head callback_head - -#if defined(__x86_64__) -typedef unsigned int mode_t; -#else -typedef unsigned short mode_t; -#endif - -#define DECLARE_BITMAP(name,bits) \ - unsigned long name[BITS_TO_LONGS(bits)] +enum { ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE = 1 }; /* XXX */ /********************** - ** linux/compiler.h ** - **********************/ - -#define likely -#define unlikely - -#define __user -#define __iomem /* needed by drivers/net/wireless/iwlwifi/pcie/internal.h */ -#define __rcu -#define __percpu -#define __must_check -#define __force -#define __read_mostly - -#define __cond_lock(x,c) (c) /* needed by drivers/net/wireless/iwlwifi/dvm/main.c */ - -#define __releases(x) /* needed by usb/core/devio.c */ -#define __acquires(x) /* needed by usb/core/devio.c */ -#define __force -#define __maybe_unused -#define __bitwise - -# define __acquire(x) (void)0 -# define __release(x) (void)0 - -#define __must_check - -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) - -#define __attribute_const__ -#undef __always_inline -#define __always_inline - -#undef __unused - -#define __printf(a, b) __attribute__((format(printf, a, b))) - -#define noinline __attribute__((noinline)) - - -/************************** - ** linux/compiler-gcc.h ** - **************************/ - -#define uninitialized_var(x) x = x -#ifdef __aligned -#undef __aligned -#endif -#define __aligned(x) __attribute__((aligned(x))) -#define __noreturn __attribute__((noreturn)) - -#define barrier() __asm__ __volatile__("": : :"memory") - -#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) - -#define __visible __attribute__((externally_visible)) - - -/******************** - ** linux/poison.h ** - ********************/ - -/* - * In list.h, LIST_POISON1 and LIST_POISON2 are assigned to 'struct list_head - * *' as well as 'struct hlist_node *' pointers. Consequently, C++ compiler - * produces an error "cannot convert... in assignment". To compile 'list.h' - * included by C++ source code, we have to define these macros to the only - * value universally accepted for pointer assigments.h - */ - -#ifdef __cplusplus -#define LIST_POISON1 nullptr -#define LIST_POISON2 nullptr -#else -#define LIST_POISON1 ((void *)0x00100100) -#define LIST_POISON2 ((void *)0x00200200) -#endif /* __cplusplus */ - - -/********************** - ** linux/mm_types.h ** + ** linux/mm-types.h ** **********************/ struct vm_operations_struct; @@ -447,6 +325,316 @@ struct vm_area_struct struct file * vm_file; }; +struct page_frag +{ + struct page *page; + __u16 offset; + __u16 size; +}; + +struct page_frag_cache +{ + bool pfmemalloc; +}; + + +/***************** + ** linux/gfp.h ** + *****************/ + +#include + +struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order); + +struct page *alloc_pages(gfp_t gfp_mask, unsigned int order); + +#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) + +unsigned long get_zeroed_page(gfp_t gfp_mask); +#define free_page(p) kfree((void *)p) + +bool gfp_pfmemalloc_allowed(gfp_t); +unsigned long __get_free_page(gfp_t); +unsigned long __get_free_pages(gfp_t, unsigned int); +void free_pages(unsigned long, unsigned int); +void __free_pages(struct page *page, unsigned int order); +void __free_page_frag(void *addr); + +bool gfpflags_allow_blocking(const gfp_t gfp_flags); + +void *__alloc_page_frag(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask); + + +/******************** + ** linux/string.h ** + ********************/ + +#include + + +/********************** + ** linux/spinlock.h ** + **********************/ + +#include + + +/******************* + ** linux/mutex.h ** + *******************/ + +#include + + +/******************* + ** linux/rwsem.h ** + *******************/ + +#include + + +/******************** + ** linux/kernel.h ** + ********************/ + +#include + +#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) + +char *kasprintf(gfp_t gfp, const char *fmt, ...); +int kstrtouint(const char *s, unsigned int base, unsigned int *res); + +#define PTR_ALIGN(p, a) ({ \ + unsigned long _p = (unsigned long)p; \ + _p = (_p + a - 1) & ~(a - 1); \ + p = (typeof(p))_p; \ + p; \ +}) + +static inline u32 reciprocal_scale(u32 val, u32 ep_ro) +{ + return (u32)(((u64) val * ep_ro) >> 32); +} + +int kstrtoul(const char *s, unsigned int base, unsigned long *res); + +int strict_strtoul(const char *s, unsigned int base, unsigned long *res); +long simple_strtoul(const char *cp, char **endp, unsigned int base); +long simple_strtol(const char *,char **,unsigned int); + +int hex_to_bin(char ch); + +/* needed by drivers/net/wireless/iwlwifi/iwl-drv.c */ +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) __attribute__((format(printf, 3, 0))); +int sprintf(char *buf, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + +int sscanf(const char *, const char *, ...); + +/* XXX */ +#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#define SIZE_MAX (~(size_t)0) + +#define U8_MAX ((u8)~0U) +#define S8_MAX ((s8)(U8_MAX>>1)) +#define S8_MIN ((s8)(-S8_MAX - 1)) +#define U16_MAX ((u16)~0U) +#define U32_MAX ((u32)~0U) +#define S32_MAX ((s32)(U32_MAX>>1)) +#define S32_MIN ((s32)(-S32_MAX - 1)) + + +/********************* + ** linux/jiffies.h ** + *********************/ + +#include + +static inline unsigned int jiffies_to_usecs(const unsigned long j) { return j * JIFFIES_TICK_US; } + + +/****************** + ** linux/time.h ** + ******************/ + +#include + +enum { + MSEC_PER_SEC = 1000L, + USEC_PER_SEC = MSEC_PER_SEC * 1000L, + USEC_PER_MSEC = 1000L, +}; + +unsigned long get_seconds(void); +void getnstimeofday(struct timespec *); +#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) + +#define ktime_to_ns(kt) ((kt).tv64) + +struct timespec ktime_to_timespec(const ktime_t kt); +bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts); + +int ktime_equal(const ktime_t, const ktime_t); +s64 ktime_us_delta(const ktime_t, const ktime_t); + +static inline s64 ktime_to_ms(const ktime_t kt) +{ + return kt.tv64 / NSEC_PER_MSEC; +} + +static inline void ktime_get_ts(struct timespec *ts) +{ + ts->tv_sec = jiffies * (1000/HZ); + ts->tv_nsec = 0; +} + + +/******************* + ** linux/timer.h ** + *******************/ + +#include + + +/********************* + ** linux/kconfig.h ** + *********************/ + +#define config_enabled(cfg) 0 + + +/******************************* + ** linux/byteorder/generic.h ** + *******************************/ + +#include + +#define cpu_to_be64 __cpu_to_be64 +#define be64_to_cpup __be64_to_cpup + +#define htonl(x) __cpu_to_be32(x) +#define htons(x) __cpu_to_be16(x) +#define ntohl(x) __be32_to_cpu(x) +#define ntohs(x) __be16_to_cpu(x) + + +/************************************* + ** linux/unaligned/packed_struct.h ** + *************************************/ + +struct __una_u16 { u16 x; } __attribute__((packed)); +struct __una_u32 { u32 x; } __attribute__((packed)); +struct __una_u64 { u64 x; } __attribute__((packed)); + + +/******************************* + ** linux/unaligned/generic.h ** + *******************************/ + +static inline void put_unaligned_le16(u16 val, void *p) { + *((__le16 *)p) = cpu_to_le16(val); } + +static inline void put_unaligned_be16(u16 val, void *p) { + *((__be16 *)p) = cpu_to_be16(val); } + +static inline void put_unaligned_le32(u32 val, void *p) { + *((__le32 *)p) = cpu_to_le32(val); } + +static inline u16 get_unaligned_le16(const void *p) +{ + const struct __una_u16 *ptr = (const struct __una_u16 *)p; + return ptr->x; +} + +static inline u32 get_unaligned_le32(const void *p) +{ + const struct __una_u32 *ptr = (const struct __una_u32 *)p; + return ptr->x; +} + +static inline u16 get_unaligned_be16(const void *p) +{ + const __u8 *be = (__u8*)p; + return (be[1]<<0)|(be[0]<<8); +} + +void put_unaligned_le64(u64 val, void *p); + +#define put_unaligned(val, ptr) ({ \ + void *__gu_p = (ptr); \ + switch (sizeof(*(ptr))) { \ + case 1: \ + *(u8 *)__gu_p = (u8)(val); \ + break; \ + case 2: \ + put_unaligned_le16((u16)(val), __gu_p); \ + break; \ + case 4: \ + put_unaligned_le32((u32)(val), __gu_p); \ + break; \ + case 8: \ + put_unaligned_le64((u64)(val), __gu_p); \ + break; \ + } \ + (void)0; }) + + +static inline void le32_add_cpu(__le32 *var, u32 val) { + *var = cpu_to_le32(le32_to_cpu(*var) + val); } + + +static inline u32 __get_unaligned_cpu32(const void *p) +{ + const struct __una_u32 *ptr = (const struct __una_u32 *)p; + return ptr->x; +} + + +/**************************************** + ** asm-generic/bitops/const_hweight.h ** + ****************************************/ + +#define __const_hweight8(w) \ + ( (!!((w) & (1ULL << 0))) + \ + (!!((w) & (1ULL << 1))) + \ + (!!((w) & (1ULL << 2))) + \ + (!!((w) & (1ULL << 3))) + \ + (!!((w) & (1ULL << 4))) + \ + (!!((w) & (1ULL << 5))) + \ + (!!((w) & (1ULL << 6))) + \ + (!!((w) & (1ULL << 7))) ) + +#define hweight8(w) (__const_hweight8(w)) + +unsigned int hweight16(unsigned int w); +unsigned int hweight32(unsigned int w); +unsigned int hweight64(__u64 w); + + +/********************************** + ** linux/bitops.h, asm/bitops.h ** + **********************************/ + +#include + +static inline unsigned long hweight_long(unsigned long w) { + return sizeof(w) == 4 ? hweight32(w) : hweight64(w); } + + +/******************************* + ** asm-generic/bitops/find.h ** + *******************************/ + +unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); +unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); +unsigned long find_last_bit(const unsigned long *addr, unsigned long size); + +#define find_first_bit(addr, size) find_next_bit((addr), (size), 0) +#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) + /**************** ** linux/mm.h ** @@ -483,6 +671,28 @@ struct vm_operations_struct { int get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages); int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); +bool page_is_pfmemalloc(struct page *page); + +#define PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)addr, PAGE_SIZE) + + +/********************* + ** linux/kobject.h ** + *********************/ + +#include + +enum kobject_action +{ + KOBJ_ADD, + KOBJ_REMOVE, + KOBJ_CHANGE, +}; + +void kobject_put(struct kobject *); +int kobject_uevent(struct kobject *, enum kobject_action); +int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp[]); + /********************* ** linux/vmalloc.h ** @@ -503,61 +713,6 @@ static inline void kunmap(struct page *page) { } static inline void kunmap_atomic(void *addr) { } -/***************** - ** linux/gfp.h ** - *****************/ - -enum { - __GFP_DMA = 0x00000001u, - __GFP_HIGHMEM = 0x00000002u, - __GFP_DMA32 = 0x00000004u, - __GFP_MOVABLE = 0x00000008u, - __GFP_WAIT = 0x00000010u, - __GFP_HIGH = 0x00000020u, - __GFP_IO = 0x00000040u, - __GFP_FS = 0x00000080u, - __GFP_COLD = 0x00000100u, - __GFP_NOWARN = 0x00000200u, - __GFP_REPEAT = 0x00000400u, - __GFP_NOFAIL = 0x00000800u, - __GFP_NORETRY = 0x00001000u, - __GFP_MEMALLOC = 0x00002000u, - __GFP_COMP = 0x00004000u, - __GFP_ZERO = 0x00008000u, - __GFP_NOMEMALLOC = 0x00010000u, - __GFP_HARDWALL = 0x00020000u, - __GFP_THISNODE = 0x00040000u, - __GFP_RECLAIMABLE = 0x00080000u, - __GFP_KMEMCG = 0x00100000u, - __GFP_NOTRACK = 0x00200000u, - __GFP_NO_KSWAPD = 0x00400000u, - __GFP_OTHER_NODE = 0x00800000u, - __GFP_WRITE = 0x01000000u, - - GFP_LX_DMA = 0x80000000u, - - GFP_ATOMIC = __GFP_HIGH, - GFP_DMA = __GFP_DMA, - GFP_KERNEL = __GFP_WAIT | __GFP_IO | __GFP_FS, - GFP_USER = __GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL, -}; - -struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order); - -struct page *alloc_pages(gfp_t gfp_mask, unsigned int order); - -#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) - -unsigned long get_zeroed_page(gfp_t gfp_mask); -#define free_page(p) kfree((void *)p) - -bool gfp_pfmemalloc_allowed(gfp_t); -unsigned long __get_free_page(gfp_t); -unsigned long __get_free_pages(gfp_t, unsigned int); -void free_pages(unsigned long, unsigned int); -void __free_pages(struct page *page, unsigned int order); - - /****************** ** linux/slab.h ** ******************/ @@ -577,6 +732,8 @@ void kfree(const void *); void kzfree(const void *); void *kmalloc(size_t size, gfp_t flags); void *kcalloc(size_t n, size_t size, gfp_t flags); +void *kmalloc_array(size_t n, size_t size, gfp_t flags); +void kvfree(const void *); struct kmem_cache; struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, unsigned long, void (*)(void *)); @@ -592,34 +749,6 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int } -/******************** - ** linux/string.h ** - ********************/ -#undef memcpy - -void *memcpy(void *d, const void *s, size_t n); -void *memset(void *s, int c, size_t n); -int memcmp(const void *, const void *, size_t); -void *memscan(void *addr, int c, size_t size); -char *strcat(char *dest, const char *src); -int strcmp(const char *s1, const char *s2); -int strncmp(const char *cs, const char *ct, size_t count); -char *strcpy(char *to, const char *from); -char *strncpy(char *, const char *, size_t); -char *strchr(const char *, int); -char *strrchr(const char *,int); -size_t strlcat(char *dest, const char *src, size_t n); -size_t strlcpy(char *dest, const char *src, size_t size); -size_t strlen(const char *); -size_t strnlen(const char *, size_t); -char * strsep(char **,const char *); -char *strstr(const char *, const char *); -char *kstrdup(const char *s, gfp_t gfp); -void *kmemdup(const void *src, size_t len, gfp_t gfp); -void *memmove(void *, const void *, size_t); -void * memchr(const void *, int, size_t); - - /************************* ** linux/irq_cpustat.h ** *************************/ @@ -637,416 +766,11 @@ int local_softirq_pending(void); #define local_irq_restore(flags) do { (void)flags; } while (0) -/********************** - ** linux/spinlock.h ** - **********************/ - -typedef struct spinlock { unsigned unused; } spinlock_t; -#define DEFINE_SPINLOCK(name) spinlock_t name - -void spin_lock(spinlock_t *lock); -void spin_lock_nested(spinlock_t *lock, int subclass); -void spin_unlock(spinlock_t *lock); -void spin_lock_init(spinlock_t *lock); -void spin_lock_irqsave(spinlock_t *lock, unsigned long flags); -void spin_lock_irqrestore(spinlock_t *lock, unsigned long flags); -void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags); -void spin_lock_irq(spinlock_t *lock); -void spin_unlock_irq(spinlock_t *lock); -void assert_spin_locked(spinlock_t *lock); -void spin_lock_bh(spinlock_t *lock); -void spin_unlock_bh(spinlock_t *lock); -int spin_trylock(spinlock_t *lock); - - -/**************************** - ** linux/spinlock_types.h ** - ****************************/ - -#define __SPIN_LOCK_UNLOCKED(x) 0 - - -/******************* - ** linux/mutex.h ** - *******************/ - -struct mutex -{ - int state; - void *holder; - void *waiters; - unsigned id; /* for debugging */ -}; - -#define DEFINE_MUTEX(mutexname) \ - struct mutex mutexname; \ - static void __attribute__((constructor)) mutex_init_ ## mutexname(void) \ - { mutex_init(&mutexname); } - -void mutex_init(struct mutex *m); -void mutex_destroy(struct mutex *m); -void mutex_lock(struct mutex *m); -void mutex_unlock(struct mutex *m); -int mutex_trylock(struct mutex *m); -int mutex_is_locked(struct mutex *m); - -/* special case in net/wireless/util.c:1357 */ -#define mutex_lock_nested(lock, subclass) mutex_lock(lock) - - -/******************* - ** linux/rwsem.h ** - *******************/ - -struct rw_semaphore { int dummy; }; - -#define DECLARE_RWSEM(name) \ - struct rw_semaphore name = { 0 } - -#define init_rwsem(sem) do { (void)sem; } while (0) - -void down_read(struct rw_semaphore *sem); -void up_read(struct rw_semaphore *sem); -void down_write(struct rw_semaphore *sem); -void up_write(struct rw_semaphore *sem); - -#define __RWSEM_INITIALIZER(name) { 0 } - - -/******************* - ** linux/timer.h ** - *******************/ - -struct tvec_base; -extern struct tvec_base boot_tvec_bases; /* needed by 'dwc_common_linux.c' */ - -struct timer_list -{ - void (*function)(unsigned long); - unsigned long data; - void *timer; - unsigned long expires; - struct tvec_base *base; /* needed by 'dwc_common_linux.c' */ -}; - -void init_timer(struct timer_list *); -void init_timer_deferrable(struct timer_list *); -int mod_timer(struct timer_list *timer, unsigned long expires); -int del_timer(struct timer_list * timer); -void setup_timer(struct timer_list *timer, void (*function)(unsigned long), - unsigned long data); -int timer_pending(const struct timer_list * timer); -unsigned long round_jiffies(unsigned long j); -unsigned long round_jiffies_relative(unsigned long j); -unsigned long round_jiffies_up(unsigned long j); - -void set_timer_slack(struct timer_list *time, int slack_hz); -static inline void add_timer(struct timer_list *timer) { mod_timer(timer, timer->expires); } - -static inline -int del_timer_sync(struct timer_list * timer) { return del_timer(timer); } - - -/*********************** - ** linux/workqueue.h ** - ***********************/ - -enum { - WQ_MEM_RECLAIM, - WQ_CPU_INTENSIVE, -}; - -struct work_struct; -typedef void (*work_func_t)(struct work_struct *work); - -struct work_struct { - atomic_long_t data; - work_func_t func; - struct list_head entry; -}; - -struct delayed_work { - struct timer_list timer; - struct work_struct work; -}; - -bool cancel_work_sync(struct work_struct *work); -bool cancel_delayed_work_sync(struct delayed_work *work); -bool cancel_delayed_work(struct delayed_work *dwork); -int schedule_delayed_work(struct delayed_work *work, unsigned long delay); -int schedule_work(struct work_struct *work); - -bool flush_work(struct work_struct *work); -bool flush_work_sync(struct work_struct *work); - - -#define PREPARE_WORK(_work, _func) \ - do { (_work)->func = (_func); } while (0) - -#define PREPARE_DELAYED_WORK(_work, _func) \ - PREPARE_WORK(&(_work)->work, (_func)) - -#define __INIT_WORK(_work, _func, on_stack) \ - do { \ - INIT_LIST_HEAD(&(_work)->entry); \ - PREPARE_WORK((_work), (_func)); \ - } while (0) - -#define INIT_WORK(_work, _func)\ - do { __INIT_WORK((_work), (_func), 0); } while (0) - -#define INIT_DELAYED_WORK(_work, _func) \ - do { \ - INIT_WORK(&(_work)->work, (_func)); \ - init_timer(&(_work)->timer); \ - } while (0) - - -/* dummy for queue_delayed_work call in storage/usb.c */ -#define system_freezable_wq 0 -struct workqueue_struct { unsigned unused; }; - -struct workqueue_struct *create_singlethread_workqueue(const char *name); -struct workqueue_struct *alloc_ordered_workqueue(const char *fmt, unsigned int flags, ...) __printf(1, 3); -struct workqueue_struct *alloc_workqueue(const char *fmt, unsigned int flags, - int max_active, ...) __printf(1, 4); -void destroy_workqueue(struct workqueue_struct *wq); -void flush_workqueue(struct workqueue_struct *wq); -bool queue_delayed_work(struct workqueue_struct *, struct delayed_work *, unsigned long); -bool flush_delayed_work(struct delayed_work *dwork); -bool queue_work(struct workqueue_struct *wq, struct work_struct *work); - -#define DECLARE_DELAYED_WORK(n, f) \ - struct delayed_work n - -bool mod_delayed_work(struct workqueue_struct *, struct delayed_work *, - unsigned long); - -extern struct workqueue_struct *system_wq; - -enum { - WORK_STRUCT_STATIC = 0, - - WORK_STRUCT_COLOR_SHIFT = 4, - WORK_STRUCT_COLOR_BITS = 4, - WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + WORK_STRUCT_COLOR_BITS, - WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, - - WORK_OFFQ_FLAG_BITS = 1, - WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS, - WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT, - WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31, - WORK_OFFQ_POOL_NONE = (1LU << WORK_OFFQ_POOL_BITS) - 1, - - WORK_STRUCT_NO_POOL = (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT, -}; - -#define WORK_DATA_STATIC_INIT() \ - ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC) - -#define __WORK_INIT_LOCKDEP_MAP(n, k) - -#define __WORK_INITIALIZER(n, f) { \ - .data = WORK_DATA_STATIC_INIT(), \ - .entry = { &(n).entry, &(n).entry }, \ - .func = (f), \ - __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ -} - -#define DECLARE_WORK(n, f) \ - struct work_struct n = __WORK_INITIALIZER(n, f) - - -/******************** - ** linux/kernel.h ** - ********************/ - -/* - * Log tags - */ -#define KERN_ALERT "ALERT: " -#define KERN_CRIT "CRTITCAL: " -#define KERN_DEBUG "DEBUG: " -#define KERN_EMERG "EMERG: " -#define KERN_ERR "ERROR: " -#define KERN_INFO "INFO: " -#define KERN_NOTICE "NOTICE: " -#define KERN_WARNING "WARNING: " -#define KERN_WARN "WARNING: " - -/* - * Debug macros - */ -#if DEBUG_LINUX_PRINTK -#define printk _printk -#define vprintk lx_vprintf -#else -#define printk(...) -#define vprintk(...) -#endif - -static inline __printf(1, 2) void panic(const char *fmt, ...) __noreturn; -static inline void panic(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - lx_vprintf(fmt, args); - va_end(args); - lx_printf("panic()"); - while (1) ; -} - -/* - * Bits and types - */ - -/* needed by linux/list.h */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/* normally provided by linux/stddef.h, needed by linux/list.h */ -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#define max_t(type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1: __max2; }) - -/** - * Return minimum of two given values - * - * XXX check how this function is used (argument types) - */ -static inline size_t min(size_t a, size_t b) { - return a < b ? a : b; } - -/** - * Return maximum of two given values - * - * XXX check how this function is used (argument types) - */ -#define max(x, y) ({ \ - typeof(x) _max1 = (x); \ - typeof(y) _max2 = (y); \ - (void) (&_max1 == &_max2); \ - _max1 > _max2 ? _max1 : _max2; }) - -#define min_t(type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1: __min2; }) - -#define abs(x) ( { \ - typeof (x) _x = (x); \ - _x < 0 ? -_x : _x; }) - -#define lower_32_bits(n) ((u32)(n)) -#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) - -#define roundup(x, y) ( \ -{ \ - const typeof(y) __y = y; \ - (((x) + (__y - 1)) / __y) * __y; \ -}) - -#define clamp_val(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(val) __min = (min); \ - typeof(val) __max = (max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) - - -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - -#define BUILD_BUG_ON(condition) - -#define _RET_IP_ (unsigned long)__builtin_return_address(0) - -void might_sleep(); -#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) - -#define INT_MAX ((int)(~0U>>1)) -#define UINT_MAX (~0U) - -char *kasprintf(gfp_t gfp, const char *fmt, ...); -int kstrtouint(const char *s, unsigned int base, unsigned int *res); - -#define clamp(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(min) __min = (min); \ - typeof(max) __max = (max); \ - (void) (&__val == &__min); \ - (void) (&__val == &__max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) - -#define DIV_ROUND_CLOSEST(x, divisor)( \ -{ \ - typeof(x) __x = x; \ - typeof(divisor) __d = divisor; \ - (((typeof(x))-1) > 0 || \ - ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ - (((__x) + ((__d) / 2)) / (__d)) : \ - (((__x) - ((__d) / 2)) / (__d)); \ -}) - -#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) - -#define PTR_ALIGN(p, a) ({ \ - unsigned long _p = (unsigned long)p; \ - _p = (_p + a - 1) & ~(a - 1); \ - p = (typeof(p))_p; \ - p; \ -}) - -static inline u32 reciprocal_scale(u32 val, u32 ep_ro) -{ - return (u32)(((u64) val * ep_ro) >> 32); -} - -int kstrtoul(const char *s, unsigned int base, unsigned long *res); - -int strict_strtoul(const char *s, unsigned int base, unsigned long *res); -long simple_strtoul(const char *cp, char **endp, unsigned int base); -long simple_strtol(const char *,char **,unsigned int); - -int hex_to_bin(char ch); - -#define INT_MIN (-INT_MAX - 1) -#define USHRT_MAX ((u16)(~0U)) -#define LONG_MAX ((long)(~0UL>>1)) - -/* needed by drivers/net/wireless/iwlwifi/iwl-drv.c */ -int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) __attribute__((format(printf, 3, 0))); -int sprintf(char *buf, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4))); - -int sscanf(const char *, const char *, ...); - -/* XXX */ -#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) -#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) -#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) - -#define swap(a, b) \ - do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) - - /******************** ** linux/printk.h ** ********************/ static inline int _printk(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -static inline int _printk(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - lx_vprintf(fmt, args); - va_end(args); - return 0; -} static inline int no_printk(const char *fmt, ...) __attribute__((format(printf, 1, 2))); static inline int no_printk(const char *fmt, ...) { return 0; } @@ -1073,282 +797,66 @@ static inline int no_printk(const char *fmt, ...) { return 0; } #define pr_debug(fmt, ...) no_printk(KERN_DEBUG fmt, ##__VA_ARGS__) #endif +#define pr_warn_ratelimited(fmt, ...) printk(KERN_WARNING fmt, ##__VA_ARGS__) + enum { DUMP_PREFIX_OFFSET }; -struct va_format -{ - const char *fmt; - va_list *va; -}; - int snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii) { - printk("hex_dump: "); + _printk("hex_dump: "); size_t i; for (i = 0; i < len; i++) { - printk("%x ", ((char*)buf)[i]); + _printk("%x ", ((char*)buf)[i]); } - printk("\n"); + _printk("\n"); } -void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii); +void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, + char *linebuf, size_t linebuflen, bool ascii); void dump_stack(void); - -/************************************* - ** linux/byteorder/little_endian.h ** - *************************************/ - -#include +unsigned long int_sqrt(unsigned long); -/******************************* - ** linux/byteorder/generic.h ** - *******************************/ +/*********************** + ** linux/workqueue.h ** + ***********************/ -#define le16_to_cpu __le16_to_cpu -#define be16_to_cpu __be16_to_cpu -#define le32_to_cpu __le32_to_cpu -#define be32_to_cpu __be32_to_cpu -#define le16_to_cpus __le16_to_cpus -#define cpu_to_le16p __cpu_to_le16p -#define cpu_to_be16p __cpu_to_be16p -#define cpu_to_le16 __cpu_to_le16 -#define cpu_to_le16s __cpu_to_le16s -#define cpu_to_be16 __cpu_to_be16 -#define cpu_to_le32 __cpu_to_le32 -#define cpu_to_be32 __cpu_to_be32 -#define cpu_to_le32s __cpu_to_le32s -#define cpu_to_le64 __cpu_to_le64 -#define cpu_to_be64 __cpu_to_be64 -#define le16_to_cpup __le16_to_cpup -#define be16_to_cpup __be16_to_cpup -#define le32_to_cpup __le32_to_cpup -#define le32_to_cpus __le32_to_cpus -#define be32_to_cpup __be32_to_cpup -#define be64_to_cpup __be64_to_cpup -#define le64_to_cpu __le64_to_cpu +struct workqueue_struct; /* XXX fix in lx_emul/work.h */ -#define htonl(x) __cpu_to_be32(x) -#define htons(x) __cpu_to_be16(x) -#define ntohl(x) __be32_to_cpu(x) -#define ntohs(x) __be16_to_cpu(x) - -struct __una_u16 { u16 x; } __attribute__((packed)); -struct __una_u32 { u32 x; } __attribute__((packed)); -struct __una_u64 { u64 x; } __attribute__((packed)); - -u32 __get_unaligned_cpu32(const void *p); - -void put_unaligned_le16(u16 val, void *p); -void put_unaligned_be16(u16 val, void *p); - -static inline void put_unaligned_le32(u32 val, void *p) -{ - *((__le32 *)p) = cpu_to_le32(val); -} - -static inline u16 get_unaligned_le16(const void *p) -{ - const struct __una_u16 *ptr = (const struct __una_u16 *)p; - return ptr->x; -} - -static inline u32 get_unaligned_le32(const void *p) -{ - const struct __una_u32 *ptr = (const struct __una_u32 *)p; - return ptr->x; -} - -void put_unaligned_le64(u64 val, void *p); - -#define put_unaligned(val, ptr) ({ \ - void *__gu_p = (ptr); \ - switch (sizeof(*(ptr))) { \ - case 1: \ - *(u8 *)__gu_p = (u8)(val); \ - break; \ - case 2: \ - put_unaligned_le16((u16)(val), __gu_p); \ - break; \ - case 4: \ - put_unaligned_le32((u32)(val), __gu_p); \ - break; \ - case 8: \ - put_unaligned_le64((u64)(val), __gu_p); \ - break; \ - } \ - (void)0; }) - -/* needed by net/wireless/util.c */ -#define htons(x) __cpu_to_be16(x) - -static inline void le32_add_cpu(__le32 *var, u32 val) -{ - *var = cpu_to_le32(le32_to_cpu(*var) + val); -} - - -/********************** - ** linux/if_ether.h ** - **********************/ +#include enum { - ETH_ALEN = 6, /* octets in one ethernet addr */ - ETH_HLEN = 14, /* total octets in header */ - ETH_DATA_LEN = 1500, /* Max. octets in payload */ - ETH_P_8021Q = 0x8100, /* 802.1Q VLAN Extended Header */ - - ETH_FRAME_LEN = 1514, + WQ_UNBOUND = 1<<1, + // WQ_MEM_RECLAIM = 1<<3, + WQ_HIGHPRI = 1<<4, + // WQ_CPU_INTENSIVE = 1<<5, }; -#define ETH_P_TDLS 0x890D /* TDLS */ +extern struct workqueue_struct *system_power_efficient_wq; + +#undef DECLARE_DELAYED_WORK +/* XXX gives incompatible pointers warning */ +#define DECLARE_DELAYED_WORK(n, f) \ + struct delayed_work n = { { .function = f } }; -/********************************** - ** linux/bitops.h, asm/bitops.h ** - **********************************/ +/****************** + ** linux/wait.h ** + ******************/ -#define BITS_PER_BYTE 8 -#define BIT(nr) (1UL << (nr)) -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) - -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) - -#include - -#define test_and_clear_bit(nr, addr) \ - __test_and_clear_bit(nr, (volatile unsigned long *)(addr)) -#define test_and_set_bit(nr, addr) \ - __test_and_set_bit(nr, (volatile unsigned long *)(addr)) -#define set_bit(nr, addr) \ - __set_bit(nr, (volatile unsigned long *)(addr)) -#define clear_bit(nr, addr) \ - __clear_bit(nr, (volatile unsigned long *)(addr)) - -#define smp_mb__before_clear_bit() -#define smp_mb__after_clear_bit() smp_mb() - -/** - * Find first zero bit (limit to machine word size) - */ -long find_next_zero_bit_le(const void *addr, - unsigned long size, unsigned long offset); +long wait_woken(wait_queue_t *wait, unsigned mode, long timeout); -#include -#include -#include -#include -#include - -static inline unsigned fls_long(unsigned long l) -{ - if (sizeof(l) == 4) - return fls(l); - return fls64(l); -} - -static inline unsigned long __ffs64(u64 word) -{ -#if BITS_PER_LONG == 32 - if (((u32)word) == 0UL) - return __ffs((u32)(word >> 32)) + 32; -#elif BITS_PER_LONG != 64 -#error BITS_PER_LONG not 32 or 64 -#endif - return __ffs((unsigned long)word); -} - -#include - -#define for_each_set_bit(bit, addr, size) \ - for ((bit) = find_first_bit((addr), (size)); \ - (bit) < (size); \ - (bit) = find_next_bit((addr), (size), (bit) + 1)) - -static inline int get_bitmask_order(unsigned int count) { - return __builtin_clz(count) ^ 0x1f; } - -static inline __s32 sign_extend32(__u32 value, int index) -{ - __u8 shift = 31 - index; - return (__s32)(value << shift) >> shift; -} - -static inline __u32 rol32(__u32 word, unsigned int shift) -{ - return (word << shift) | (word >> (32 - shift)); -} - -static inline __u32 ror32(__u32 word, unsigned int shift) -{ - return (word >> shift) | (word << (32 - shift)); -} - -static inline __u16 ror16(__u16 word, unsigned int shift) -{ - return (word >> shift) | (word << (16 - shift)); -} - - -/**************************************** - ** asm-generic/bitops/const_hweight.h ** - ****************************************/ - -#define __const_hweight8(w) \ - ( (!!((w) & (1ULL << 0))) + \ - (!!((w) & (1ULL << 1))) + \ - (!!((w) & (1ULL << 2))) + \ - (!!((w) & (1ULL << 3))) + \ - (!!((w) & (1ULL << 4))) + \ - (!!((w) & (1ULL << 5))) + \ - (!!((w) & (1ULL << 6))) + \ - (!!((w) & (1ULL << 7))) ) - -#define hweight8(w) (__const_hweight8(w)) - -unsigned int hweight16(unsigned int w); -unsigned int hweight32(unsigned int w); -unsigned int hweight64(__u64 w); - - -/********************* - ** linux/kobject.h ** - *********************/ - -enum kobject_action -{ - KOBJ_ADD, - KOBJ_REMOVE, - KOBJ_CHANGE, -}; - -struct kobject { struct kobject *parent; }; - -void kobject_put(struct kobject *); -int kobject_uevent(struct kobject *, enum kobject_action); -int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp[]); - -struct kobj_uevent_env -{ - char buf[32]; - int buflen; -}; - -struct kobj_uevent_env; - -int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); -char *kobject_name(const struct kobject *kobj); -char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask); - +/****************** + ** linux/poll.h ** + ******************/ typedef struct poll_table_struct { int dummy; } poll_table; @@ -1412,26 +920,8 @@ void sysfs_remove_link(struct kobject *kobj, const char *name); ** linux/pm.h ** ****************/ -struct device; +#include -typedef struct pm_message { int event; } pm_message_t; - -struct dev_pm_info { pm_message_t power_state; }; - -struct dev_pm_ops { - int (*suspend)(struct device *dev); - int (*resume)(struct device *dev); - int (*freeze)(struct device *dev); - int (*thaw)(struct device *dev); - int (*poweroff)(struct device *dev); - int (*restore)(struct device *dev); -}; - -#define PMSG_IS_AUTO(msg) 0 - -enum { PM_EVENT_AUTO_SUSPEND = 0x402 }; - -#define PM_EVENT_SUSPEND 0x0002 #define PM_EVENT_HIBERNATE 0x0004 #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) @@ -1676,15 +1166,17 @@ struct class struct dma_parms; /* DEVICE */ -struct device { +struct device +{ const char *name; struct device *parent; struct kobject kobj; const struct device_type *type; struct device_driver *driver; void *platform_data; - u64 *dma_mask; /* needed by usb/hcd.h */ - u64 coherent_dma_mask; /* omap driver */ + u64 _dma_mask_buf; + u64 *dma_mask; + u64 coherent_dma_mask; struct dev_pm_info power; dev_t devt; const struct attribute_group **groups; @@ -1738,8 +1230,13 @@ int dev_to_node(struct device *dev); void set_dev_node(struct device *dev, int node); struct device *device_create(struct class *cls, struct device *parent, - dev_t devt, void *drvdata, - const char *fmt, ...); + dev_t devt, void *drvdata, + const char *fmt, ...); +struct device *device_create_with_groups(struct class *cls, + struct device *parent, dev_t devt, + void *drvdata, + const struct attribute_group **groups, + const char *fmt, ...); int device_add(struct device *dev); void device_destroy(struct class *cls, dev_t devt); int device_register(struct device *dev); @@ -1798,6 +1295,9 @@ struct class *__class_create(struct module *owner, int class_register(struct class *cls); void class_unregister(struct class *cls); void class_destroy(struct class *cls); +struct device *class_find_device(struct class *cls, struct device *start, + const void *data, + int (*match)(struct device *, const void *)); typedef void (*dr_release_t)(struct device *dev, void *res); typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); @@ -1805,8 +1305,10 @@ typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp); void devres_add(struct device *dev, void *res); int devres_destroy(struct device *dev, dr_release_t release, - dr_match_t match, void *match_data); + dr_match_t match, void *match_data); void devres_free(void *res); +int devres_release(struct device *dev, dr_release_t release, + dr_match_t match, void *match_data); void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); @@ -1883,7 +1385,6 @@ struct ifmap { }; - /************************* ** linux/uapi/if_arp.h ** *************************/ @@ -1895,6 +1396,26 @@ enum { }; +/********************** + ** linux/if_ether.h ** + **********************/ + +enum { + ETH_ALEN = 6, /* octets in one ethernet addr */ + ETH_HLEN = 14, /* total octets in header */ + ETH_DATA_LEN = 1500, /* Max. octets in payload */ + ETH_P_8021Q = 0x8100, /* 802.1Q VLAN Extended Header */ + ETH_P_8021AD = 0x88A8, /* 802.1ad Service VLAN */ + ETH_P_PAE = 0x888E, /* Port Access Entity (IEEE 802.1X) */ + + ETH_P_802_3_MIN = 0x0600, + + ETH_FRAME_LEN = 1514, +}; + +#define ETH_P_TDLS 0x890D /* TDLS */ + + /*************************** ** linux/uapi/if_ether.h ** ***************************/ @@ -2089,101 +1610,6 @@ static inline unsigned long ewma_read(const struct ewma *avg) } -/******************************** - ** include/uapi/linux/types.h ** - ********************************/ - -#define __bitwise__ - - -/******************************* - ** linux/errno.h and friends ** - *******************************/ - -/** - * Error codes - * - * Note that the codes do not correspond to those of the Linux kernel. - */ -enum { - /* - * The following numbers correspond to FreeBSD - */ - EPERM = 1, - ENOENT = 2, - ESRCH = 3, - EINTR = 4, - EIO = 5, - ENXIO = 6, - E2BIG = 7, - EDEADLK = 11, - ENOMEM = 12, - EACCES = 13, - EFAULT = 14, - EBUSY = 16, - EEXIST = 17, - EXDEV = 18, - ENODEV = 19, - EINVAL = 22, - ENFILE = 23, - EFBIG = 27, - ENOSPC = 28, - ESPIPE = 29, - EPIPE = 32, - EDOM = 33, - ERANGE = 34, - EAGAIN = 35, - EINPROGRESS = 36, - EALREADY = 37, - ENOTSOCK = 38, - EDESTADDRREQ = 39, - EMSGSIZE = 40, - ENOPROTOOPT = 42, - EPROTONOSUPPORT = 43, - ESOCKTNOSUPPORT = 44, - EOPNOTSUPP = 45, - EPFNOSUPPORT = 46, - EAFNOSUPPORT = 47, - EADDRINUSE = 48, - EADDRNOTAVAIL = 49, - ENETDOWN = 50, - ENETUNREACH = 51, - ECONNABORTED = 53, - ECONNRESET = 54, - ENOBUFS = 55, - EISCONN = 56, - ENOTCONN = 57, - ETIMEDOUT = 60, - ECONNREFUSED = 61, - ENAMETOOLONG = 63, - EHOSTDOWN = 64, - EHOSTUNREACH = 65, - ENOSYS = 78, - ENOMSG = 83, - EOVERFLOW = 84, - ECANCELED = 85, - EILSEQ = 86, - EBADMSG = 89, - ENOLINK = 91, - EPROTO = 92, - - /* - * The following numbers correspond to nothing - */ - EREMOTEIO = 200, - ERESTARTSYS = 201, - ENODATA = 202, - ETOOSMALL = 203, - ENOIOCTLCMD = 204, - ENONET = 205, - ENOTSUPP = 206, - ENOTUNIQ = 207, - ERFKILL = 208, - - MAX_ERRNO = 4095, -}; - - /************************** ** linux/preempt_mask.h ** **************************/ @@ -2203,9 +1629,9 @@ int softirq_count(void); #define preempt_enable() barrier() -/********************** - ** linux/inerrupt.h ** - **********************/ +/*********************** + ** linux/interrupt.h ** + ***********************/ struct tasklet_struct { @@ -2306,8 +1732,6 @@ struct ieee80211_low_level_stats; ** linux/rculist.h ** *********************/ -#include - #define list_for_each_entry_rcu(pos, head, member) \ list_for_each_entry(pos, head, member) @@ -2362,104 +1786,6 @@ void list_replace_rcu(struct list_head *, struct list_head *); #include -/********************* - ** linux/jiffies.h ** - *********************/ - -#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1) - -extern unsigned long jiffies; - -unsigned int jiffies_to_msecs(const unsigned long); -unsigned long usecs_to_jiffies(const unsigned int u); -unsigned long msecs_to_jiffies(const unsigned int); -clock_t jiffies_to_clock_t(unsigned long x); -static inline clock_t jiffies_delta_to_clock_t(long delta) -{ - return jiffies_to_clock_t(max(0L, delta)); -} - -#define time_after(a,b) ((long)((b) - (a)) < 0) -#define time_after_eq(a,b) ((long)((a) - (b)) >= 0) -#define time_before(a,b) time_after(b,a) -#define time_before_eq(a,b) time_after_eq(b,a) - -#define time_is_after_jiffies(a) time_before(jiffies, a) - - -/****************** - ** linux/time.h ** - ******************/ - -struct timeval -{ - __kernel_time_t tv_sec; - __kernel_suseconds_t tv_usec; -}; - -struct timespec { - __kernel_time_t tv_sec; - long tv_nsec; -}; - -enum { - MSEC_PER_SEC = 1000L, - USEC_PER_SEC = MSEC_PER_SEC * 1000L, - NSEC_PER_USEC = 1000L, - NSEC_PER_MSEC = NSEC_PER_USEC * 1000L, - NSEC_PER_SEC = MSEC_PER_SEC * NSEC_PER_MSEC, - USEC, - USEC_PER_MSEC = 1000L, -}; - -unsigned long get_seconds(void); -void getnstimeofday(struct timespec *); -#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) - - -/******************* - ** linux/ktime.h ** - *******************/ - -union ktime { - s64 tv64; -}; - -typedef union ktime ktime_t; - -#define ktime_to_ns(kt) ((kt).tv64) - -struct timeval ktime_to_timeval(const ktime_t); -struct timespec ktime_to_timespec(const ktime_t kt); -bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts); - -ktime_t ktime_sub(const ktime_t, const ktime_t); -ktime_t ktime_get(void); -int ktime_equal(const ktime_t, const ktime_t); -s64 ktime_us_delta(const ktime_t, const ktime_t); - -static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) -{ - return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; -} - -static inline s64 ktime_to_ms(const ktime_t kt) -{ - return kt.tv64 / NSEC_PER_MSEC; -} - -static inline ktime_t ktime_get_real(void) -{ - return (ktime_t) { .tv64 = (s64)(jiffies * (1000 / HZ) * NSEC_PER_MSEC) }; -} - -static inline void ktime_get_ts(struct timespec *ts) -{ - ts->tv_sec = jiffies * (1000/HZ); - ts->tv_nsec = 0; -} - - /*********************** ** linux/kmemcheck.h ** ***********************/ @@ -2500,61 +1826,6 @@ void seqlock_init (seqlock_t *); #define __SEQLOCK_UNLOCKED(x) 0 -/****************** - ** linux/init.h ** - ******************/ - -#define __init -#define __exit -#define __devinitconst - -#define _SETUP_CONCAT(a, b) __##a##b -#define SETUP_CONCAT(a, b) _SETUP_CONCAT(a, b) -#define __setup(str, fn) static void SETUP_CONCAT(fn, SETUP_SUFFIX)(void *addrs) { fn(addrs); } - -#define core_initcall(fn) void core_##fn(void) { fn(); } -#define subsys_initcall(fn) void subsys_##fn(void) { fn(); } -#define pure_initcall(fd) void pure_##fn(void) { printk("PURE_INITCALL"); fn(); } - - -/******************** - ** linux/module.h ** - ********************/ - -#define EXPORT_SYMBOL(x) -#define EXPORT_SYMBOL_GPL(x) -#define MODULE_LICENSE(x) -#define MODULE_NAME_LEN (64 - sizeof(long)) -#define MODULE_ALIAS(name) -#define MODULE_AUTHOR(name) -#define MODULE_DESCRIPTION(desc) -#define MODULE_VERSION(version) -#define THIS_MODULE 0 -#define MODULE_FIRMWARE(_firmware) -#define MODULE_DEVICE_TABLE(type, name) - - -struct module; -#define module_init(fn) void module_##fn(void) { fn(); } -#define module_exit(fn) void module_exit_##fn(void) { fn(); } -void module_put_and_exit(int); - -void module_put(struct module *); -void __module_get(struct module *module); -int try_module_get(struct module *); - - -/************************* - ** linux/moduleparam.h ** - *************************/ - -#define module_param(name, type, perm) -#define module_param_named(name, value, type, perm) -#define MODULE_PARM_DESC(_parm, desc) -#define kparam_block_sysfs_write(name) -#define kparam_unblock_sysfs_write(name) - - /*********************************** ** linux/rwlock_types.h/rwlock.h ** ***********************************/ @@ -2608,7 +1879,7 @@ struct percpu_counter s64 count; }; -static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) +static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp) { fbc->count = amount; return 0; @@ -2720,6 +1991,15 @@ void eth_random_addr(u8 *addr); static inline void eth_broadcast_addr(u8 *addr) { memset(addr, 0xff, ETH_ALEN); } +static inline void eth_zero_addr(u8 *addr) { + memset(addr, 0x00, ETH_ALEN); } + +static inline void ether_addr_copy(u8 *dst, const u8 *src) +{ + *(u32 *)dst = *(const u32 *)src; + *(u16 *)(dst+ 4) = *(const u16 *)(src + 4); +} + static inline bool is_broadcast_ether_addr(const u8 *addr) { return (*(const u16 *)(addr + 0) & @@ -2740,6 +2020,11 @@ static inline bool is_multicast_ether_addr(const u8 *addr) return 0x01 & addr[0]; } +static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2]) +{ + return is_multicast_ether_addr(addr); +} + static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], const u8 addr2[6+2]) { u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2); @@ -2747,6 +2032,42 @@ static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], const u8 addr2[6 return (fold << 16) == 0; } +static inline bool is_unicast_ether_addr(const u8 *addr) { + return !(0x01 & addr[0]); } + +static inline bool is_zero_ether_addr(const u8 *addr) +{ + return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); +} + +/* Reserved Ethernet Addresses per IEEE 802.1Q */ +static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) = +{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; + +static inline bool is_link_local_ether_addr(const u8 *addr) +{ + __be16 *a = (__be16 *)addr; + static const __be16 *b = (const __be16 *)eth_reserved_addr_base; + static const __be16 m = cpu_to_be16(0xfff0); + + return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0; +} + +static inline bool eth_proto_is_802_3(__be16 proto) +{ + proto &= htons(0xFF00); + return (u16)proto >= (u16)htons(ETH_P_802_3_MIN); +} + +static inline unsigned long compare_ether_header(const void *a, const void *b) +{ + u32 *a32 = (u32 *)((u8 *)a + 2); + u32 *b32 = (u32 *)((u8 *)b + 2); + + return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | + (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); + +} /************************ ** net/netns/packet.h ** @@ -2839,6 +2160,8 @@ static inline void put_net(struct net *net) { } static inline int net_eq(const struct net *net1, const struct net *net2) { return 1; } +typedef struct { unsigned dummy; } possible_net_t; + struct net *get_net_ns_by_pid(pid_t pid); struct net *get_net_ns_by_fd(int pid); @@ -2851,6 +2174,8 @@ void release_net(struct net *net); int rt_genid(struct net *); void rt_genid_bump(struct net *); +int peernet2id(struct net *net, struct net *peer); + /************************* ** net/netns/generic.h ** @@ -2901,9 +2226,21 @@ enum { NETDEV_UNREGISTER_FINAL = 0x0011, NETDEV_RELEASE = 0x0012, NETDEV_JOIN = 0x0014, - + NETDEV_BONDING_INFO = 0x0019, }; +enum { + NET_NAME_UNKNOWN = 0, + NET_NAME_ENUM = 1, + NET_NAME_USER = 3, +}; + +enum netdev_priv_flags +{ + IFF_EBRIDGE = 1<<1, +}; + + #include #define netif_err(priv, type, dev, fmt, args...) lx_printf("netif_err: " fmt, ## args); @@ -2953,11 +2290,14 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev, struct sk_buff *skb); struct ifla_vf_info; +struct ifla_vf_stats; struct nlattr; struct ndmsg; struct netlink_callback; struct nlmsghdr; +struct netdev_phys_item_id; + struct net_device_ops { int (*ndo_init)(struct net_device *dev); @@ -2976,24 +2316,35 @@ struct net_device_ops struct ifmap *map); void (*ndo_tx_timeout) (struct net_device *dev); int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); + struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, + struct rtnl_link_stats64 *storage); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_set_vf_mac)(struct net_device *dev, int queue, u8 *mac); int (*ndo_set_vf_vlan)(struct net_device *dev, int queue, u16 vlan, u8 qos); + int (*ndo_set_vf_rate)(struct net_device *dev, + int vf, int min_tx_rate, + int max_tx_rate); int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); + int (*ndo_set_vf_trust)(struct net_device *dev, + int vf, bool setting); int (*ndo_get_vf_config)(struct net_device *dev, int vf, struct ifla_vf_info *ivf); int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); + int (*ndo_get_vf_stats)(struct net_device *dev, + int vf, struct ifla_vf_stats *vf_stats); int (*ndo_set_vf_port)(struct net_device *dev, int vf, struct nlattr *port[]); int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); + int (*ndo_set_vf_rss_query_en)(struct net_device *dev, + int vf, bool setting); int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); int (*ndo_add_slave)(struct net_device *dev, @@ -3002,23 +2353,32 @@ struct net_device_ops struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, + u16 vid, u16 flags); int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, - const unsigned char *addr); + const unsigned char *addr, + u16 vid); int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev, + struct net_device *filter_dev, int idx); int (*ndo_bridge_setlink)(struct net_device *dev, - struct nlmsghdr *nlh); + struct nlmsghdr *nlh, + u16 flags); int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, - u32 filter_mask); + u32 filter_mask, + int nlflags); int (*ndo_bridge_dellink)(struct net_device *dev, - struct nlmsghdr *nlh); + struct nlmsghdr *nlh, + u16 flags); + int (*ndo_get_iflink)(const struct net_device *dev); + // int (*ndo_change_proto_down)(struct net_device *dev, + // bool proto_down); }; struct net_device_stats @@ -3059,8 +2419,24 @@ struct netdev_queue { struct net_device *dev; int numa_node; + + unsigned long state; }; +enum { + NETDEV_QUEUE_START = 1<<1, +}; + +struct pcpu_sw_netstats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; +}; + +#define netdev_alloc_pcpu_stats(type) alloc_percpu(type) + /* NET_DEVICE */ struct net_device { @@ -3072,10 +2448,14 @@ struct net_device unsigned long base_addr; /* device I/O address */ int irq; /* device IRQ number */ + atomic_t carrier_changes; + u32 features; u32 hw_features; struct net_device_stats stats; + atomic_long_t tx_dropped; + const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; @@ -3127,6 +2507,19 @@ struct net_device int watchdog_timeo; /* used by dev_watchdog() */ struct hlist_node index_hlist; + enum { + NETREG_UNINITIALIZED=0, + NETREG_REGISTERED, + // NETREG_UNREGISTERING, + // NETREG_UNREGISTERED, + // NETREG_RELEASED, + // NETREG_DUMMY, + } reg_state; + + union { + struct pcpu_sw_netstats *tstats; + }; + enum { RTNL_LINK_INITIALIZED, RTNL_LINK_INITIALIZING, @@ -3147,6 +2540,8 @@ struct net_device int group; void *lx_nic_device; /* our own Nic_device */ + + bool proto_down; }; @@ -3209,7 +2604,11 @@ bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue); static inline void netif_addr_lock_bh(struct net_device *dev) { } static inline void netif_addr_unlock_bh(struct net_device *dev) { } -void netdev_set_default_ethtool_ops(struct net_device *dev, const struct ethtool_ops *ops); +static inline void netdev_set_default_ethtool_ops(struct net_device *dev, + const struct ethtool_ops *ops) +{ + dev->ethtool_ops = ops; +} int netdev_mc_empty(struct net_device *); unsigned netdev_mc_count(struct net_device * dev); int register_netdev(struct net_device *); @@ -3226,7 +2625,8 @@ static inline void unregister_netdevice(struct net_device *dev) struct net_device *netdev_master_upper_dev_get(struct net_device *dev); void netdev_state_change(struct net_device *dev); int call_netdevice_notifiers(unsigned long val, struct net_device *dev); -struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs); +struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, unsigned char name_assign_type, + void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs); struct netdev_notifier_info; struct net_device * netdev_notifier_info_to_dev(struct netdev_notifier_info *info); int register_netdevice_notifier(struct notifier_block *nb); @@ -3252,7 +2652,7 @@ struct net_device *dev_get_by_name(struct net *net, const char *name); struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); int dev_queue_xmit(struct sk_buff *skb); struct netdev_phys_port_id; -int dev_get_phys_port_id(struct net_device *dev, struct netdev_phys_port_id *ppid); +int dev_get_phys_port_id(struct net_device *dev, struct netdev_phys_item_id *ppid); unsigned int dev_get_flags(const struct net_device *); struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, struct rtnl_link_stats64 *storage); int dev_change_net_namespace(struct net_device *, struct net *, const char *); @@ -3286,6 +2686,10 @@ int dev_mc_add(struct net_device *dev, const unsigned char *addr); int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); int dev_mc_del(struct net_device *dev, const unsigned char *addr); +int dev_change_proto_down(struct net_device *dev, bool proto_down); +int dev_get_iflink(const struct net_device *dev); +int dev_get_phys_port_name(struct net_device *dev, char *name, size_t len); + enum { LL_MAX_HEADER = 96, /* XXX check CONFIG_WLAN_MESH */ }; @@ -3310,6 +2714,8 @@ extern rwlock_t dev_base_lock; #define for_each_netdev(net, d) \ list_for_each_entry(d, &(net)->dev_base_head, dev_list) +#define for_each_netdev_safe(net, d, n) \ + list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) #define for_each_netdev_rcu(net, d) \ list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list) @@ -3330,6 +2736,7 @@ enum { struct napi_gro_cb { + u16 flush; u16 count; u8 same_flow; u8 free; @@ -3404,6 +2811,50 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_li void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len); void __hw_addr_init(struct netdev_hw_addr_list *list); +struct napi_struct +{ + int (*poll)(struct napi_struct *, int); + struct net_device *dev; +}; + +enum { MAX_PHYS_ITEM_ID_LEN = 32 }; + +struct netdev_phys_item_id { + unsigned char id[MAX_PHYS_ITEM_ID_LEN]; + unsigned char id_len; +}; + +struct offload_callbacks { + struct sk_buff *(*gso_segment)(struct sk_buff *skb, netdev_features_t features); + struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); + int (*gro_complete)(struct sk_buff *skb, int nhoff); +}; + +struct packet_offload +{ + __be16 type; + u16 priority; + struct offload_callbacks callbacks; + struct list_head list; +}; + +/* XXX */ +#define HARD_TX_LOCK(dev, txq, cpu) +#define HARD_TX_UNLOCK(dev, txq) + +void netif_napi_add(struct net_device *dev, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight); +void netif_napi_del(struct napi_struct *napi); + +typedef int gro_result_t; + +gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); +void napi_gro_flush(struct napi_struct *napi, bool flush_old); + +int init_dummy_netdev(struct net_device *dev); + +void dev_add_offload(struct packet_offload *po); + /************************* ** linux/percpu-defs.h ** @@ -3428,112 +2879,15 @@ void __hw_addr_init(struct netdev_hw_addr_list *list); #include -/************************* - ** linux/etherdevice.h ** - *************************/ - -static inline bool is_unicast_ether_addr(const u8 *addr) { - return !(0x01 & addr[0]); } - -static inline bool is_zero_ether_addr(const u8 *addr) -{ - return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); -} - -/* Reserved Ethernet Addresses per IEEE 802.1Q */ -static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) = -{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; - -static inline bool is_link_local_ether_addr(const u8 *addr) -{ - __be16 *a = (__be16 *)addr; - static const __be16 *b = (const __be16 *)eth_reserved_addr_base; - static const __be16 m = cpu_to_be16(0xfff0); - - return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0; -} - - -/****************** - ** linux/wait.h ** - ******************/ - -typedef struct wait_queue_head { void *list; } wait_queue_head_t; -typedef struct wait_queue { unsigned unused; } wait_queue_t; - -#define DEFINE_WAIT(name) \ - wait_queue_t name; - -#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { 0 } - -#define DECLARE_WAITQUEUE(name, tsk) \ - wait_queue_t name - -#define DECLARE_WAIT_QUEUE_HEAD(name) \ - wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name) - -#define DEFINE_WAIT_FUNC(name, function) \ - wait_queue_t name - -/* simplified signature */ -void __wake_up(wait_queue_head_t *q, bool all); - -#define wake_up(x) __wake_up(x, false) -#define wake_up_all(x) __wake_up(x, true) -#define wake_up_interruptible(x) __wake_up(x, false) -#define wake_up_interruptible_all(x) __wake_up(x, true) - -void init_waitqueue_head(wait_queue_head_t *); -int waitqueue_active(wait_queue_head_t *); - -/* void wake_up_interruptible(wait_queue_head_t *); */ -void wake_up_interruptible_sync_poll(wait_queue_head_t *, int); -void wake_up_interruptible_poll(wait_queue_head_t *, int); - -void prepare_to_wait(wait_queue_head_t *, wait_queue_t *, int); -void prepare_to_wait_exclusive(wait_queue_head_t *, wait_queue_t *, int); -void finish_wait(wait_queue_head_t *, wait_queue_t *); - -int autoremove_wake_function(wait_queue_t *, unsigned, int, void *); -void add_wait_queue(wait_queue_head_t *, wait_queue_t *); -void add_wait_queue_exclusive(wait_queue_head_t *, wait_queue_t *); -void remove_wait_queue(wait_queue_head_t *, wait_queue_t *); - -/* our wait event implementation - it's okay as value */ -void __wait_event(wait_queue_head_t); - -#define _wait_event(wq, condition) while (!(condition)) { __wait_event(wq); } -#define wait_event(wq, condition) ({ _wait_event(wq, condition); }) -#define wait_event_interruptible(wq, condition) ({ _wait_event(wq, condition); 0; }) - -#define _wait_event_timeout(wq, condition, timeout) \ - ({ int res = 1; \ - prepare_to_wait(&wq, 0, 0); \ - while (1) { \ - if ((condition) || !res) { \ - break; \ - } \ - res = schedule_timeout(jiffies + timeout); \ - } \ - finish_wait(&wq, 0); \ - res; \ - }) - -#define wait_event_timeout(wq, condition, timeout) \ - ({ \ - int ret = _wait_event_timeout(wq, (condition), timeout); \ - ret; \ - }) - - -/************************ - ** linux/capability.h ** - ************************/ +/***************************** + ** uapi/linux/capability.h ** + *****************************/ enum { - CAP_NET_ADMIN = 12, - CAP_NET_RAW = 13, - CAP_SYS_ADMIN = 21, + CAP_NET_BROADCAST = 11, + CAP_NET_ADMIN = 12, + CAP_NET_RAW = 13, + CAP_SYS_ADMIN = 21, }; bool capable(int cap); @@ -3740,21 +3094,29 @@ void dma_free_coherent(struct device *, size_t size, void *vaddr, dma_addr_t bus int dma_set_coherent_mask(struct device *dev, u64 mask); void *dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag); +static inline int is_device_dma_capable(struct device *dev) { return *dev->dma_mask; } /************************ ** linux/completion.h ** ************************/ -struct completion { unsigned done; }; +struct completion +{ + unsigned done; + void *task; +}; +long __wait_completion(struct completion *work, unsigned long timeout); void complete(struct completion *); void complete_all(struct completion *); void init_completion(struct completion *x); +int wait_for_completion_killable(struct completion *x); unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); void wait_for_completion(struct completion *x); int wait_for_completion_interruptible(struct completion *x); long wait_for_completion_interruptible_timeout(struct completion *x, unsigned long timeout); +long wait_for_completion_killable_timeout(struct completion *x, unsigned long timeout); /********************** @@ -3774,33 +3136,18 @@ void release_firmware(const struct firmware *fw); int request_firmware_nowait( struct module *module, bool uevent, const char *name, struct device *device, gfp_t gfp, void *context, void (*cont)(const struct firmware *fw, void *context)); -/*********************** - ** linux/irqreturn.h ** - ***********************/ - -typedef enum irqreturn { - IRQ_NONE = 0, - IRQ_HANDLED = 1, - IRQ_WAKE_THREAD = 2, -} irqreturn_t; - - /******************** ** linux/ioport.h ** ********************/ -#define IORESOURCE_IO 0x00000100 -#define IORESOURCE_MEM 0x00000200 -#define IORESOURCE_IRQ 0x00000400 +#include -struct resource -{ - resource_size_t start; - resource_size_t end; - const char *name; - unsigned long flags; -}; +/*********************** + ** linux/irqreturn.h ** + ***********************/ + +#include /*********************** ** linux/interrupt.h ** @@ -3813,12 +3160,6 @@ enum { }; #define IRQF_SHARED 0x00000080 -/* #define IRQF_DISABLED 0x00000020 */ - -/* void local_irq_enable(void); */ -/* void local_irq_disable(void); */ - -typedef irqreturn_t (*irq_handler_t)(int, void *); int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev); void free_irq(unsigned int, void *); @@ -3828,37 +3169,25 @@ void tasklet_disable(struct tasklet_struct *t); void tasklet_enable(struct tasklet_struct *t); +/*********************** + ** uapi/linux/uuid.h ** + ***********************/ + +typedef struct uuid_le uuid_le; +struct uuid_le +{ + __u8 b[16]; +}; + + /***************** ** linux/pci.h ** *****************/ -#include -#include - -enum { - PCI_DMA_BIDIRECTIONAL = 0, - PCI_DMA_TODEVICE, - PCI_DMA_FROMDEVICE, - PCI_DMA_NONE -}; - - -enum { PCI_ANY_ID = ~0U }; -enum { DEVICE_COUNT_RESOURCE = 6 }; - - -typedef enum { - PCI_D3cold = 4 -} pci_power_t; - - -#include - -/* - * PCI types - */ struct pci_bus; +enum { DEVICE_COUNT_RESOURCE = 6 }; + struct pci_dev { unsigned int devfn; unsigned int irq; @@ -3874,114 +3203,16 @@ struct pci_dev { u16 pcie_flags_reg; }; -struct pci_driver { - char *name; - const struct pci_device_id *id_table; - int (*probe) (struct pci_dev *dev, - const struct pci_device_id *id); - void (*remove) (struct pci_dev *dev); - struct device_driver driver; -}; +#include +void pci_set_drvdata(struct pci_dev *pdev, void *data); -static inline uint32_t PCI_DEVFN(unsigned slot, unsigned func) { -return ((slot & 0x1f) << 3) | (func & 0x07); } - -int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val); -int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 *val); -int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 *val); -int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val); -int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val); -int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val); - -static inline -int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) { -return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); } - -static inline -int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) { -return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); } - -static inline -int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) { -return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); } - -static inline -int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) { -return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); } - -static inline -int pci_write_config_word(struct pci_dev *dev, int where, u16 val) { -return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); } - -static inline -int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) { -return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); } - -size_t pci_resource_len(struct pci_dev *dev, unsigned bar); -size_t pci_resource_start(struct pci_dev *dev, unsigned bar); -void pci_dev_put(struct pci_dev *dev); -struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from); - -int pci_enable_device(struct pci_dev *dev); -void pci_disable_device(struct pci_dev *dev); -int pci_register_driver(struct pci_driver *driver); -void pci_unregister_driver(struct pci_driver *driver); -const char *pci_name(const struct pci_dev *pdev); -bool pci_dev_run_wake(struct pci_dev *dev); -unsigned int pci_resource_flags(struct pci_dev *dev, unsigned bar); -void pci_set_master(struct pci_dev *dev); -int pci_set_mwi(struct pci_dev *dev); -bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); -int pci_find_capability(struct pci_dev *dev, int cap); -struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); -const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); -int pci_request_regions(struct pci_dev *dev, const char *res_name); -void pci_release_regions(struct pci_dev *dev); -void *pci_ioremap_bar(struct pci_dev *pdev, int bar); -void pci_disable_link_state(struct pci_dev *pdev, int state); - -int pci_enable_msi(struct pci_dev *dev); -void pci_disable_msi(struct pci_dev *dev); - -#define DEFINE_PCI_DEVICE_TABLE(_table) \ - const struct pci_device_id _table[] __devinitconst - -#define to_pci_dev(n) container_of(n, struct pci_dev, dev) - -int pci_register_driver(struct pci_driver *driver); - -int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); - -static inline void *pci_get_drvdata(struct pci_dev *pdev) -{ - return dev_get_drvdata(&pdev->dev); -} - -static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) -{ - dev_set_drvdata(&pdev->dev, data); -} - -#define dev_is_pci(d) (1) - -int pci_num_vf(struct pci_dev *dev); - -/* XXX will this cast ever work? */ -#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf((struct pci_dev *)d) : 0)) +/* XXX needed for iwl device table, maybe remove later? */ +#include #include -/********************** - ** linux/pci-aspm.h ** - **********************/ - -#define PCIE_LINK_STATE_L0S 1 -#define PCIE_LINK_STATE_L1 2 -#define PCIE_LINK_STATE_CLKPM 4 - - /****************** ** linux/kmod.h ** ******************/ @@ -3992,27 +3223,6 @@ int request_module(const char *name, ...); ((x) ?: (__request_module(true, mod), (x))) - /***************** - ** linux/err.h ** - *****************/ - -#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) - -static inline bool IS_ERR(void const *ptr) { - return (unsigned long)(ptr) > (unsigned long)(-1000); } - -static inline void * ERR_PTR(long error) { - return (void *) error; } - -static inline void * ERR_CAST(const void *ptr) { - return (void *) ptr; } - -static inline long IS_ERR_OR_NULL(const void *ptr) { - return !ptr || IS_ERR_VALUE((unsigned long)ptr); } - -static inline long PTR_ERR(const void *ptr) { return (long) ptr; } - - /***************** ** linux/uio.h ** *****************/ @@ -4031,6 +3241,18 @@ struct kvec size_t iov_len; }; +struct iov_iter { + int type; + size_t iov_offset; + size_t count; + union { + const struct iovec *iov; + const struct kvec *kvec; + const struct bio_vec *bvec; + }; + unsigned long nr_segs; +}; + static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) { unsigned long seg; @@ -4041,38 +3263,42 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) return ret; } +static inline size_t iov_iter_count(struct iov_iter *i) { + return i->count; } + int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); +void iov_iter_advance(struct iov_iter *i, size_t bytes); -/********************** - ** asm-generic/io.h ** - **********************/ +size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); +size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); +size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i); +size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); +size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); -#define mmiowb() do { } while (0) +ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, + size_t maxsize, unsigned maxpages, size_t *start); -void *ioremap(resource_size_t offset, unsigned long size); -void iounmap(volatile void *addr); -void *devm_ioremap(struct device *dev, resource_size_t offset, - unsigned long size); -void *devm_ioremap_nocache(struct device *dev, resource_size_t offset, - unsigned long size); +size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); +size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); -/** - * Map I/O memory write combined - */ -void *ioremap_wc(resource_size_t phys_addr, unsigned long size); - -#define ioremap_nocache ioremap - -void *phys_to_virt(unsigned long address); - -#define writel(value, addr) (*(volatile uint32_t *)(addr) = (value)) -#define writeb(value, addr) (*(volatile uint8_t *)(addr) = (value)) -#define readl(addr) (*(volatile uint32_t *)(addr)) -#define readb(addr) (*(volatile uint8_t *)(addr)) +/*********************** + ** linux/if_bridge.h ** + ***********************/ +enum { + BR_HAIRPIN_MODE = BIT(0), + BR_BPDU_GUARD = BIT(1), + BR_ROOT_BLOCK = BIT(2), + BR_MULTICAST_FAST_LEAVE = BIT(3), + BR_LEARNING = BIT(5), + BR_FLOOD = BIT(6), + BR_PROXYARP = BIT(8), + BR_LEARNING_SYNC = BIT(9), + BR_PROXYARP_WIFI = BIT(10), +}; /********************* ** linux/if_vlan.h ** @@ -4080,12 +3306,15 @@ void *phys_to_virt(unsigned long address); enum { VLAN_HLEN = 4, + VLAN_ETH_HLEN = 18, VLAN_PRIO_SHIFT = 13, VLAN_PRIO_MASK = 0xe000, + VLAN_VID_MASK = 0x0fff, }; struct vlan_hdr { + __be16 h_vlan_TCI; __be16 h_vlan_encapsulated_proto; }; @@ -4119,6 +3348,7 @@ void *__alloc_percpu(size_t size, size_t align); #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu);(typeof(*(ptr)) *)(ptr); }) #define __get_cpu_var(var) var +#define this_cpu_ptr(ptr) ptr #define this_cpu_inc(pcp) pcp += 1 #define this_cpu_dec(pcp) pcp -= 1 @@ -4126,13 +3356,6 @@ void *__alloc_percpu(size_t size, size_t align); #define __this_cpu_dec(pcp) this_cpu_dec(pcp) -/********************* - ** linux/hrtimer.h ** - *********************/ - -struct hrtimer { unsigned unused; }; - - /******************* ** asm/current.h ** *******************/ @@ -4152,6 +3375,24 @@ int res_counter_charge_nofail(struct res_counter *counter, unsigned long val, st u64 res_counter_uncharge(struct res_counter *counter, unsigned long val); u64 res_counter_read_u64(struct res_counter *counter, int member); + +/************************** + ** linux/page_counter.h ** + **************************/ + +struct page_counter +{ + atomic_long_t count; + unsigned long limit; +}; + +static inline unsigned long page_counter_read(struct page_counter *counter) { + return atomic_long_read(&counter->count); } + +void page_counter_charge(struct page_counter *counter, unsigned long nr_pages); +void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages); + + /************************ ** linux/memcontrol.h ** ************************/ @@ -4162,16 +3403,12 @@ enum { UNDER_LIMIT, SOFT_LIMIT, OVER_LIMIT }; void sock_update_memcg(struct sock *sk); - -/********************** - ** linux/mm-types.h ** - **********************/ - -struct page_frag +struct cg_proto { - struct page *page; - __u16 offset; - __u16 size; + struct page_counter memory_allocated; + struct percpu_counter sockets_allocated; + int memory_pressure; + long sysctl_mem[3]; }; @@ -4215,6 +3452,10 @@ bool need_resched(void); int cond_resched(void); int cond_resched_softirq(void); +u64 local_clock(void); + +int fatal_signal_pending(struct task_struct *p); + /************************ ** uapi/linux/sched.h ** @@ -4252,7 +3493,7 @@ extern struct user_namespace init_user_ns; static inline void current_uid_gid(kuid_t *u, kgid_t *g) { *u = 0; - *g =0; + *g = 0; } @@ -4274,6 +3515,7 @@ struct inet6_dev; *********************/ enum { + IPPROTO_IP = 0, IPPROTO_TCP = 6, IPPROTO_UDP = 17, IPPROTO_AH = 51, @@ -4382,10 +3624,13 @@ struct frag_hdr __sum16 tcp_v4_check(int len, __be32 saddr, __be32 daddr, __wsum base); + /********************** ** uapi/linux/tcp.h ** **********************/ +enum { TCP_CA_NAME_MAX = 16 }; + struct tcphdr { __be16 source; @@ -4409,12 +3654,21 @@ struct tcphdr struct tcphdr *tcp_hdr(const struct sk_buff *skb); +char *tcp_ca_get_name_by_key(u32 key, char *buffer); + /***************** ** linux/tcp.h ** *****************/ +struct tcp_sock +{ + u32 snd_una; +}; + unsigned int tcp_hdrlen(const struct sk_buff *skb); +static inline struct tcp_sock *tcp_sk(const struct sock *sk) { + return (struct tcp_sock *)sk; } /********************** @@ -4454,6 +3708,8 @@ for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) #define hotcpu_notifier(fn, pri) +#define num_possible_cpus() 1U + /************************ ** linux/jump_label.h ** @@ -4555,11 +3811,20 @@ struct kiocb ** uapi/linux/filter.h ** *************************/ -struct sock_filter { /* Filter block */ - __u16 code; /* Actual filter code */ - __u8 jt; /* Jump true */ - __u8 jf; /* Jump false */ - __u32 k; /* Generic multiuse field */ +struct sock_filter { /* Filter block */ + __u16 code; /* Actual filter code */ + __u8 jt; /* Jump true */ + __u8 jf; /* Jump false */ + __u32 k; /* Generic multiuse field */ +}; + + +/********************** + ** uapi/linux/bpf.h ** + **********************/ + +enum bpf_prog_type { + BPF_PROG_TYPE_SOCKET_FILTER, }; @@ -4570,13 +3835,22 @@ struct sock_filter { /* Filter block */ struct sk_buff; struct sock_filter; struct sock_fprog; + +struct bpf_prog +{ + u32 len; + enum bpf_prog_type type; + + union { + struct sock_filter insns[0]; + }; +}; + struct sk_filter { atomic_t refcnt; - unsigned int len; struct rcu_head rcu; - - struct sock_filter insns[0]; + struct bpf_prog *prog; }; unsigned int sk_filter_size(unsigned int proglen); @@ -4591,6 +3865,25 @@ int sk_get_filter(struct sock *, struct sock_filter *, unsigned); int bpf_tell_extensions(void); +typedef int (*bpf_aux_classic_check_t)(struct sock_filter *filter, + unsigned int flen); + +int bpf_prog_create_from_user(struct bpf_prog **pfp, struct sock_fprog *fprog, + bpf_aux_classic_check_t trans, bool save_orig); +void bpf_prog_destroy(struct bpf_prog *fp); +u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog, struct sk_buff *skb); + + + +/***************** + ** linux/bpf.h ** + *****************/ + +static inline struct bpf_prog *bpf_prog_get(u32 ufd) { + return (struct bpf_prog*)ERR_PTR(-EOPNOTSUPP); } + +static inline void bpf_prog_put(struct bpf_prog *prog) { } + /************************** ** linux/seq_file_net.h ** @@ -4672,8 +3965,24 @@ static inline unsigned long __copy_from_user_nocache(void *to, const void __user ** asm-generic/scatterlist.h ** *******************************/ +/* + * XXX cannot use emul header, see comment below. + */ +// #include + struct scatterlist { + /* + * We use a dummy struct page member because there is + * none for abitrary addresses that were not allocated + * with alloc_page() and save the buf pointer given in + * sg_set_buf directly to page_dummy.addr and hope for + * the best. This dummy is then stored in page_link. + * The offset is always 0. + */ + struct page page_dummy; + unsigned int page_flags; + unsigned long page_link; unsigned int offset; unsigned int length; @@ -4686,23 +3995,26 @@ struct scatterlist *sg_next(struct scatterlist *); void sg_init_table(struct scatterlist *, unsigned int); void sg_init_one(struct scatterlist *, const void *, unsigned int); -#define sg_is_last(sg) ((sg)->page_link & 0x02) -#define sg_chain_ptr(sg) ((struct scatterlist *) ((sg)->page_link & ~0x03)) +#define sg_is_chain(sg) ((sg)->page_flags & 0x01) +#define sg_is_last(sg) ((sg)->page_flags & 0x02) +#define sg_chain_ptr(sg) ((struct scatterlist *) ((sg)->page_link)) static inline struct page *sg_page(struct scatterlist *sg) { - return (struct page *)((sg)->page_link & ~0x3); } + return (struct page *)((sg)->page_link); } + +void sg_chain(struct scatterlist *prv, unsigned int prv_nents, struct scatterlist *sgl); /************** ** net/ip.h ** **************/ -enum { IP_DEFRAG_AF_PACKET }; /* XXX original value is not 0 */ +enum { IP_DEFRAG_AF_PACKET = 42, }; struct inet_skb_parm { unsigned unused; }; unsigned int ip_hdrlen(const struct sk_buff *skb); -struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user); +struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user); /******************** @@ -4719,17 +4031,6 @@ unsigned int full_name_hash(const unsigned char *, unsigned int); u32 hash_32(u32 val, unsigned int); -/******************************* - ** asm-generic/bitops/find.h ** - *******************************/ - -unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); -unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); - -#define find_first_bit(addr, size) find_next_bit((addr), (size), 0) -#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) - - /******************** ** net/checksum.h ** ********************/ @@ -4749,6 +4050,8 @@ __wsum csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len); void csum_replace2(__sum16 *, __be16, __be16); +__wsum remcsum_adjust(void *ptr, __wsum csum, int start, int offset); + /************************ ** net/ip6_checksum.h ** @@ -4816,46 +4119,6 @@ typedef void (*smp_call_func_t)(void *info); int on_each_cpu(smp_call_func_t, void *, int); -/**************************** - ** uapi/linux/genetlink.h ** - ****************************/ - -/* #define GENL_NAMSIZ 16 */ -/* #define GENL_ID_GENERATE 0 */ -/* #define GENL_ADMIN_PERM 0x01 */ - -/* struct genlmsghdr { */ -/* u8 cmd; */ -/* u8 version; */ -/* u16 reserved; */ -/* }; */ - -/* #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) */ - -/* */ -/* struct nlattr { */ -/* u16 nla_len; */ -/* u16 nla_type; */ -/* }; */ -/* */ - -/* #define NLM_F_MULTI 2 */ - -/* */ -/* struct nlmsghdr { */ -/* u32 nlmsg_len; */ -/* u16 nlmsg_type; */ -/* u16 nlmsg_flags; */ -/* u32 nlmsg_seq; */ -/* u32 nlmsg_pid; */ -/* }; */ -/* */ - -/* #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) */ - -/* #define NLMSG_ALIGNTO 4U */ -/* #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) */ - /************************** ** uapi/linux/netlink.h ** **************************/ @@ -4864,109 +4127,14 @@ int on_each_cpu(smp_call_func_t, void *, int); #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) -/******************* - ** net/netlink.h ** - *******************/ - -/* -enum { - NLA_U8, - NLA_U16, - NLA_U32, - NLA_U64, - NLA_STRING, - NLA_FLAG, - NLA_NESTED, - NLA_NUL_STRING, - NLA_BINARY, -}; - -struct nla_policy { - u16 type; - u16 len; -}; - - -static inline int nla_ok(const struct nlattr *nla, int remaining) -{ - return remaining >= (int) sizeof(*nla) && - nla->nla_len >= sizeof(*nla) && - nla->nla_len <= remaining; -} - -static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) -{ - int totlen = NLA_ALIGN(nla->nla_len); - *remaining -= totlen; - return (struct nlattr *) ((char *) nla + totlen); -} - -#define nla_for_each_attr(pos, head, len, rem) \ - for (pos = head, rem = len; \ - nla_ok(pos, rem); \ - pos = nla_next(pos, &(rem))) - -#define nla_for_each_nested(pos, nla, rem) \ - nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) -*/ - - /*********************** ** linux/genetlink.h ** ***********************/ -/* struct genl_info { */ -/* u32 snd_seq; */ -/* u32 snd_portid; */ -/* struct genlmsghdr *genlhdr; */ -/* struct nlattr **attrs; */ -/* void *user_ptr[2]; */ -/* }; */ - -/* struct netlink_callback; */ - -/* struct genl_ops { */ -/* u8 cmd; */ -/* u8 internal_flags; */ -/* unsigned int flags; */ -/* const struct nla_policy *policy; */ -/* int (*doit)(struct sk_buff *skb, */ -/* struct genl_info *info); */ -/* int (*dumpit)(struct sk_buff *skb, */ -/* struct netlink_callback *cb); */ -/* int (*done)(struct netlink_callback *cb); */ -/* struct list_head ops_list; */ -/* }; */ - -/* struct genl_multicast_group { */ -/* char name[GENL_NAMSIZ]; */ -/* u32 id; */ -/* }; */ - -/* struct genl_family { */ -/* unsigned int id; */ -/* unsigned int hdrsize; */ -/* char name[GENL_NAMSIZ]; */ -/* unsigned int version; */ -/* unsigned int maxattr; */ -/* bool netnsok; */ -/* int (*pre_doit)(struct genl_ops *ops, */ -/* struct sk_buff *skb, */ -/* struct genl_info *info); */ -/* void (*post_doit)(struct genl_ops *ops, */ -/* struct sk_buff *skb, */ -/* struct genl_info *info); */ -/* struct nlattr ** attrbuf; /1* private *1/ */ -/* struct list_head ops_list; /1* private *1/ */ -/* struct list_head family_list; /1* private *1/ */ -/* struct list_head mcast_groups; /1* private *1/ */ -/* }; */ - #define MODULE_ALIAS_GENL_FAMILY(family) \ MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family) - /***************************** ** uapi/linux/net_tstamp.h ** *****************************/ @@ -4977,8 +4145,10 @@ enum { SOF_TIMESTAMPING_RX_HARDWARE = 1 << 2, SOF_TIMESTAMPING_RX_SOFTWARE = 1 << 3, SOF_TIMESTAMPING_SOFTWARE = 1 << 4, - SOF_TIMESTAMPING_SYS_HARDWARE = 1 << 5, - SOF_TIMESTAMPING_RAW_HARDWARE = 1 << 6, + SOF_TIMESTAMPING_SYS_HARDWARE = 1 << 5, + SOF_TIMESTAMPING_RAW_HARDWARE = 1 << 6, + SOF_TIMESTAMPING_OPT_ID = 1 << 7, + SOF_TIMESTAMPING_OPT_TSONLY = 1 << 11, SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | SOF_TIMESTAMPING_RAW_HARDWARE, }; @@ -5038,6 +4208,13 @@ void * krealloc(void *, size_t, gfp_t); ** net/flow_keys.h ** *********************/ +struct flow_dissector_key_control +{ + u16 thoff; + u16 addr_type; + u32 flags; +}; + struct flow_keys { /* (src,dst) must be grouped, in the same way than in IP header */ @@ -5049,10 +4226,54 @@ struct flow_keys }; u16 thoff; u8 ip_proto; + + struct flow_dissector_key_control control; }; -bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); -__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto); +struct flow_dissector_key +{ + unsigned dummy; +}; + +struct flow_dissector +{ + unsigned dummy; +}; + +extern struct flow_dissector flow_keys_dissector; +extern struct flow_dissector flow_keys_buf_dissector; + +bool flow_keys_have_l4(struct flow_keys *keys); + + +/**************** + ** net/flow.h ** + ****************/ + +enum { + FLOWI_FLAG_ANYSRC = 0x01, +}; + +struct flowi4 +{ + unsigned dummy; +}; + +struct flowi6 +{ + unsigned dummy; +}; + +struct flowi +{ + union { + struct flowi4 ip4; + struct flowi6 ip6; + } u; +}; + +__u32 __get_hash_from_flowi4(const struct flowi4 *fl4, struct flow_keys *keys); +__u32 __get_hash_from_flowi6(const struct flowi6 *fl6, struct flow_keys *keys); /*********************** @@ -5069,8 +4290,30 @@ extern const struct pipe_buf_operations nosteal_pipe_buf_ops; #define ACPI_PTR(_ptr) (NULL) #define ACPI_HANDLE(dev) (NULL) +struct acpi_device; + const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); +struct acpi_gpio_params { + unsigned int crs_entry_index; + unsigned int line_index; + bool active_low; +}; + +struct acpi_gpio_mapping { + const char *name; + const struct acpi_gpio_params *data; + unsigned int size; +}; + +static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, + const struct acpi_gpio_mapping *gpios) +{ + return -ENXIO; +} + +static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} + /******************** ** linux/random.h ** @@ -5086,9 +4329,18 @@ static inline void get_random_bytes(void *buf, int nbytes) b[i] = i + 1; } -u32 prandom_u32(void); +static inline u32 prandom_u32(void) +{ + return 4; // fair dice roll +} + static inline u32 prandom_u32_max(u32 ep_ro) { return (u32)(((u64) prandom_u32() * ep_ro) >> 32); } +static inline void prandom_bytes(void *buf, size_t nbytes) +{ + get_random_bytes(buf, nbytes); +} + /********************* ** linux/proc_fs.h ** @@ -5150,6 +4402,8 @@ static inline void bitmap_zero(unsigned long *dst, int nbits) void bitmap_fill(unsigned long *dst, int nbits); int bitmap_empty(const unsigned long *src, int nbits); +#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) + /******************************* ** uapi/asm-generic/ioctls.h ** @@ -5200,6 +4454,7 @@ void synchronize_irq(unsigned int irq); **************************/ void udelay(unsigned long usecs); +void mdelay(unsigned long msecs); /**************************** @@ -5276,7 +4531,7 @@ bool sk_busy_loop(struct sock *sk, int nonblock); static inline void secpath_reset(struct sk_buff *skb) { } int __xfrm_sk_clone_policy(struct sock *sk); void xfrm_sk_free_policy(struct sock *sk); -int xfrm_sk_clone_policy(struct sock *sk); +int xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk); /************************* @@ -5383,4 +4638,190 @@ void *kthread_run(int (*threadfn)(void *), void *data, char const *name); int alg_test(const char *driver, const char *alg, u32 type, u32 mask); +enum { fips_enabled = 0 }; + + +/********************* + ** net/switchdev.h ** + *********************/ + +enum switchdev_attr_id { + SWITCHDEV_ATTR_ID_UNDEFINED, + SWITCHDEV_ATTR_ID_PORT_PARENT_ID, +}; + +struct switchdev_attr +{ + enum switchdev_attr_id id; + u32 flags; + union { + struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */ + u8 stp_state; /* PORT_STP_STATE */ + unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */ + u32 ageing_time; /* BRIDGE_AGEING_TIME */ + } u; + +}; + +int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr); + +#define SWITCHDEV_F_NO_RECURSE BIT(0) + + +/************************************ + ** uapi/linux/input-event-codes.h ** + ************************************/ + +enum { + EV_KEY = 0x01, + EV_SW = 0x05, + + SW_RFKILL_ALL = 0x03, + + KEY_BLUETOOTH = 237, + KEY_WLAN = 238, + KEY_UWB = 239, + KEY_WIMAX = 246, + KEY_RFKILL = 247, +}; + + +/********************* + ** gpio/consumer.h ** + *********************/ + +enum gpiod_flags { + GPIOD_FLAGS_BIT_DIR_SET = 1 << 0, + GPIOD_FLAGS_BIT_DIR_OUT = 1 << 1, + GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, +}; + +/******************* + ** linux/input.h ** + *******************/ + +struct input_dev +{ + unsigned long evbit;//[BITS_TO_LONGS(EV_CNT)]; + unsigned long swbit;//[BITS_TO_LONGS(SW_CNT)]; + unsigned long sw;//[BITS_TO_LONGS(SW_CNT)]; + + spinlock_t event_lock; +}; + +struct input_handle; +struct input_device_id; + +struct input_handler +{ + void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); + int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); + void (*disconnect)(struct input_handle *handle); + void (*start)(struct input_handle *handle); + + const char *name; + const struct input_device_id *id_table; +}; + +struct input_handle +{ + const char *name; + + struct input_dev *dev; + struct input_handler *handler; +}; + +/*********************** + ** uapi/linux/mlps.h ** + ***********************/ + +enum { + MPLS_LS_TC_MASK = 0x00000E00, + MPLS_LS_TC_SHIFT = 9u, +}; + +struct mpls_label +{ + __be32 entry; +}; + + +/************************* + ** linux/devcoredump.h ** + *************************/ + +static inline void dev_coredumpm(struct device *dev, struct module *owner, + const void *data, size_t datalen, gfp_t gfp, + ssize_t (*read)(char *buffer, loff_t offset, + size_t count, const void *data, size_t datalen), + void (*free)(const void *data)) +{ + free(data); +} + + +/************************* + ** linux/timekeeping.h ** + *************************/ + +typedef __s64 time64_t; + +time64_t ktime_get_seconds(void); + + +/*********************************** + ** uapi/linux/virtio_types.h:42: ** + ***********************************/ + +typedef __u16 __virtio16; + + +/******************************* + ** linux/virtio_byteorder.h ** + *******************************/ + +static inline bool virtio_legacy_is_little_endian(void) { return true; } + +static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val) +{ + if (little_endian) return le16_to_cpu((__le16)val); + else return be16_to_cpu((__be16)val); +} + +static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val) +{ + if (little_endian) return (__virtio16)cpu_to_le16(val); + else return (__virtio16)cpu_to_be16(val); +} + + +/******************** + ** linux/mmzone.h ** + ********************/ + +enum { PAGE_ALLOC_COSTLY_ORDER = 3u }; + + +/**************************** + ** linux/u64_stats_sync.h ** + ****************************/ + +struct u64_stats_sync; + +static inline void u64_stats_update_begin(struct u64_stats_sync *p) { } + +static inline void u64_stats_update_end(struct u64_stats_sync *p) { } + +static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *p) +{ + return 0; +} + +static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *p, unsigned int s) +{ + return false; +} + +#include + #endif /* _LX_EMUL_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/net/protocol.h b/repos/dde_linux/src/lib/wifi/include/net/protocol.h new file mode 100644 index 0000000000..919fe79b24 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/include/net/protocol.h @@ -0,0 +1,6 @@ +/* + * net/core/sock.c needs but it does not + * include this header directly. is normally + * provided by lx_emul.h and is included by sock.c. + */ +#include diff --git a/repos/dde_linux/src/lib/wifi/include/scheduler.h b/repos/dde_linux/src/lib/wifi/include/scheduler.h deleted file mode 100644 index 01017251d4..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/scheduler.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * \brief User-level scheduling - * \author Sebastian Sumpf - * \author Josef Soentgen - * \author Christian Helmuth - * \date 2012-04-25 - */ - -/* - * Copyright (C) 2012-2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _SCHEDULER_H_ -#define _SCHEDULER_H_ - -/* Genode includes */ -#include -#include -#include - -/* libc includes */ -#include - -/* local includes */ -#include - - -namespace Lx { - class Scheduler; - class Task; - - Scheduler &scheduler(); -}; - - -/** - * Allows pseudo-parallel execution of functions - */ -class Lx::Task : public Lx::List::Element -{ - public: - - /** - * TODO generalize - higher is more important - */ - enum Priority { PRIORITY_0, PRIORITY_1, PRIORITY_2, PRIORITY_3 }; - - /** - * Runtime state - * - * INIT - * | - * [run] - * v - * BLOCKED <--[block]--- RUNNING ---[mutex_block]--> MUTEX_BLOCKED - * --[unblock]-> <-[mutex_unblock]-- - * - * Transitions between BLOCKED and MUTEX_BLOCKED are not possible. - */ - enum State { STATE_INIT, STATE_RUNNING, STATE_BLOCKED, STATE_MUTEX_BLOCKED, STATE_WAIT_BLOCKED }; - - /** - * List element type - */ - typedef Lx::List_element List_element; - - /** - * List type - */ - typedef Lx::List List; - - private: - - State _state = STATE_INIT; - - /* sub-classes may overwrite the runnable condition */ - virtual bool _runnable() const; - - void *_stack = nullptr; /* stack pointer */ - jmp_buf _env; /* execution state */ - jmp_buf _saved_env; /* saved state of thread calling run() */ - - Priority _priority; - Scheduler &_scheduler; /* scheduler this task is attached to */ - - void (*_func)(void *); /* function to call*/ - void *_arg; /* argument for function */ - char const *_name; /* name of task */ - - List_element _mutex_le { this }; /* list element for mutex_blocked state */ - - List *_wait_list { 0 }; - List_element _wait_le { this }; - bool _wait_le_enqueued { false }; - - public: - - Task(void (*func)(void*), void *arg, char const *name, - Priority priority, Scheduler &scheduler); - virtual ~Task(); - - State state() const { return _state; } - Priority priority() const { return _priority; } - - void wait_enqueue(List *list) - { - if (_wait_le_enqueued) { - PERR("%p already queued in %p", this, _wait_list); - Genode::sleep_forever(); - } - - _wait_le_enqueued = true; - _wait_list = list; - _wait_list->append(&_wait_le); - } - - void wait_dequeue(List *list) - { - if (!_wait_le_enqueued) { - PERR("%p not queued", this); - Genode::sleep_forever(); - } - - if (_wait_list != list) { - PERR("especially not in list %p", list); - Genode::sleep_forever(); - } - - _wait_list->remove(&_wait_le); - _wait_list = 0; - _wait_le_enqueued = false; - } - - /******************************* - ** Runtime state transitions ** - *******************************/ - - void block() - { - if (_state == STATE_RUNNING) { - _state = STATE_BLOCKED; - } - } - - void unblock() - { - if (_state == STATE_BLOCKED) { - _state = STATE_RUNNING; - } - } - - void mutex_block(List *list) - { - if (_state == STATE_RUNNING) { - _state = STATE_MUTEX_BLOCKED; - list->append(&_mutex_le); - } - } - - void mutex_unblock(List *list) - { - if (_state == STATE_MUTEX_BLOCKED) { - _state = STATE_RUNNING; - list->remove(&_mutex_le); - } - } - - /** - * Run task until next preemption point - * - * \return true if run, false if not runnable - */ - bool run(); - - /** - * Request scheduling (of other tasks) - * - * Note, this task may not be blocked when calling schedule() depending - * on the use case. - */ - void schedule(); - - /** - * Shortcut to enter blocking state and request scheduling - */ - void block_and_schedule() - { - block(); - schedule(); - } - - /** - * Return the name of the task (mainly for debugging purposes) - */ - char const *name() { return _name; } -}; - - -/** - * Scheduler - * - * FIXME The old mechanism for removal via check_dead() was removed and has to - * be reimplemented later. - */ -class Lx::Scheduler -{ - private: - - Lx::List _present_list; - Genode::Lock _present_list_mutex; - - Task *_current = nullptr; /* currently scheduled task */ - - bool _run_task(Task *); - - public: - - Scheduler(); - ~Scheduler(); - - /** - * Return currently scheduled task - */ - Task *current(); - - /** - * Add new task to the present list - */ - void add(Task *); - - /** - * Schedule all present tasks - * - * Returns if no task is runnable. - */ - void schedule(); - - /** - * Log current state of tasks in present list (debug) - * - * Log lines are prefixed with 'prefix' - */ - void log_state(char const *prefix); -}; - -#endif /* _SCHEDULER_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/spec/x86_32/platform/types.h b/repos/dde_linux/src/lib/wifi/include/spec/x86_32/platform/types.h deleted file mode 100644 index f567a3951b..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/spec/x86_32/platform/types.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * \brief Platform specific types - * \author Josef Soentgen - * \date 2014-10-17 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _X86_32__TYPES_H_ -#define _X86_32__TYPES_H_ - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __SIZE_TYPE__ size_t; -typedef long long int64_t; -typedef unsigned long long uint64_t; - -#endif /* _X86_32__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/include/spec/x86_64/platform/types.h b/repos/dde_linux/src/lib/wifi/include/spec/x86_64/platform/types.h deleted file mode 100644 index 90df54ae7b..0000000000 --- a/repos/dde_linux/src/lib/wifi/include/spec/x86_64/platform/types.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * \brief Platform specific types - * \author Josef Soentgen - * \date 2014-10-17 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _X86_64__TYPES_H_ -#define _X86_64__TYPES_H_ - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __SIZE_TYPE__ size_t; -typedef long long int64_t; -typedef unsigned long long uint64_t; - -#endif /* _X86_64__TYPES_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/init.cc b/repos/dde_linux/src/lib/wifi/init.cc index 8ec501be03..39805ef17a 100644 --- a/repos/dde_linux/src/lib/wifi/init.cc +++ b/repos/dde_linux/src/lib/wifi/init.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -19,9 +19,12 @@ #include #include -#include -# include -#include +#include + +#include +#include +#include + extern "C" void core_netlink_proto_init(void); extern "C" void core_sock_init(void); @@ -39,6 +42,9 @@ extern "C" void module_arc4_init(void); extern "C" void module_chainiv_module_init(void); extern "C" void module_krng_mod_init(void); +struct workqueue_struct *system_power_efficient_wq; +struct workqueue_struct *system_wq; + static bool mac80211_only = false; struct pernet_operations loopback_net_ops; @@ -48,40 +54,41 @@ LIST_HEAD(net_namespace_list); Firmware_list fw_list[] = { - { "iwlwifi-1000-3.ucode", 335056 }, - { "iwlwifi-1000-5.ucode", 337520 }, - { "iwlwifi-105-6.ucode", 689680 }, - { "iwlwifi-135-6.ucode", 701228 }, - { "iwlwifi-2000-6.ucode", 695876 }, - { "iwlwifi-2030-6.ucode", 707392 }, - { "iwlwifi-3160-7.ucode", 670484 }, - { "iwlwifi-3160-8.ucode", 667284 }, - { "iwlwifi-3160-9.ucode", 666792 }, - { "iwlwifi-3945-2.ucode", 150100 }, - { "iwlwifi-4965-2.ucode", 187972 }, - { "iwlwifi-5000-1.ucode", 345008 }, - { "iwlwifi-5000-2.ucode", 353240 }, - { "iwlwifi-5000-5.ucode", 340696 }, - { "iwlwifi-5150-2.ucode", 337400 }, - { "iwlwifi-6000-4.ucode", 454608 }, + { "iwlwifi-1000-3.ucode", 335056, nullptr }, + { "iwlwifi-1000-5.ucode", 337520, nullptr }, + { "iwlwifi-105-6.ucode", 689680, nullptr }, + { "iwlwifi-135-6.ucode", 701228, nullptr }, + { "iwlwifi-2000-6.ucode", 695876, nullptr }, + { "iwlwifi-2030-6.ucode", 707392, nullptr }, + { "iwlwifi-3160-7.ucode", 670484, nullptr }, + { "iwlwifi-3160-8.ucode", 667284, nullptr }, + { "iwlwifi-3160-9.ucode", 666792, nullptr }, + { "iwlwifi-3945-2.ucode", 150100, nullptr }, + { "iwlwifi-4965-2.ucode", 187972, nullptr }, + { "iwlwifi-5000-1.ucode", 345008, nullptr }, + { "iwlwifi-5000-2.ucode", 353240, nullptr }, + { "iwlwifi-5000-5.ucode", 340696, nullptr }, + { "iwlwifi-5150-2.ucode", 337400, nullptr }, + { "iwlwifi-6000-4.ucode", 454608, nullptr }, /** * Actually, there is no -6 firmware. The last one is revision 4, * but certain devices support up to revision 6 and want to use - * this one. Our fw loading mechanism sadly will not work in this - * case, therefore we add -6 to the fw whitelist have to provide - * a renamed image. + * this one. To make things simple we refer to the available + * firmware under the requested name. */ - { "iwlwifi-6000-6.ucode", 454608 }, /* XXX same as -4 */ - { "iwlwifi-6000g2a-5.ucode", 444128 }, - { "iwlwifi-6000g2a-6.ucode", 677296 }, - { "iwlwifi-6000g2b-5.ucode", 460236 }, - { "iwlwifi-6000g2b-6.ucode", 679436 }, - { "iwlwifi-6050-4.ucode", 463692 }, - { "iwlwifi-6050-5.ucode", 469780 }, - { "iwlwifi-7260-7.ucode", 683236 }, - { "iwlwifi-7260-8.ucode", 679780 }, - { "iwlwifi-7260-9.ucode", 679380 }, - { "iwlwifi-7265-8.ucode", 690452 } + { "iwlwifi-6000-6.ucode", 454608, "iwlwifi-6000-4.ucode" }, + { "iwlwifi-6000g2a-5.ucode", 444128, nullptr }, + { "iwlwifi-6000g2a-6.ucode", 677296, nullptr }, + { "iwlwifi-6000g2b-5.ucode", 460236, nullptr }, + { "iwlwifi-6000g2b-6.ucode", 679436, nullptr }, + { "iwlwifi-6050-4.ucode", 463692, nullptr }, + { "iwlwifi-6050-5.ucode", 469780, nullptr }, + { "iwlwifi-7260-16.ucode", 1049284, nullptr }, + { "iwlwifi-7260-17.ucode", 1049284, "iwlwifi-7260-16.ucode" }, + { "iwlwifi-7265-16.ucode", 1180356, nullptr }, + { "iwlwifi-7265D-16.ucode", 1384500, nullptr }, + { "iwlwifi-8000C-16.ucode", 2351636, nullptr }, + { "iwlwifi-8000C-19.ucode", 2351636, "iwlwifi-8000C-16.ucode" } }; @@ -93,6 +100,9 @@ static Genode::Lock *_wpa_lock; static void run_linux(void *) { + system_power_efficient_wq = alloc_workqueue("system_power_efficient_wq", 0, 0); + system_wq = alloc_workqueue("system_wq", 0, 0); + core_sock_init(); core_netlink_proto_init(); module_packet_init(); @@ -107,7 +117,7 @@ static void run_linux(void *) module_aes_init(); module_arc4_init(); module_chainiv_module_init(); - module_krng_mod_init(); + // module_krng_mod_init(); if (!mac80211_only) { module_iwl_drv_init(); @@ -120,6 +130,8 @@ static void run_linux(void *) } } +unsigned long jiffies; + void wifi_init(Server::Entrypoint &ep, Genode::Lock &lock) { @@ -138,9 +150,13 @@ void wifi_init(Server::Entrypoint &ep, Genode::Lock &lock) /* add init_net namespace to namespace list */ list_add_tail_rcu(&init_net.list, &net_namespace_list); - Lx::timer_init(ep); - Lx::irq_init(ep); - Lx::work_init(ep); + Lx::scheduler(); + + Lx::timer(&ep, &jiffies); + + Lx::Irq::irq(&ep, Genode::env()->heap()); + Lx::Work::work_queue(Genode::env()->heap()); + Lx::socket_init(ep); Lx::nic_init(ep); diff --git a/repos/dde_linux/src/lib/wifi/irq.cc b/repos/dde_linux/src/lib/wifi/irq.cc deleted file mode 100644 index 492bc1f1d2..0000000000 --- a/repos/dde_linux/src/lib/wifi/irq.cc +++ /dev/null @@ -1,290 +0,0 @@ -/* - * \brief Signal context for IRQ's - * \author Josef Soentgen - * \author Christian Helmuth - * \date 2014-10-14 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include - -/* local includes */ -#include - -#include -# include -#include - -namespace { - - /** - * Helper utilty for composing IRQ related names - */ - struct Name_composer - { - char name[16]; - Name_composer(unsigned irq) { - Genode::snprintf(name, sizeof(name), "irq_%02x", irq); } - }; -} - -/** - * Task for interrupts - * - * Allows flagging of IRQs from other threads. - */ -struct Irq_task -{ - private: - - Lx::Task _task; - - public: - - Irq_task(void (*func)(void *), void *args, char const *name) - : _task(func, args, name, Lx::Task::PRIORITY_3, Lx::scheduler()) { } - - void unblock() { _task.unblock(); } - - char const *name() { return _task.name(); } -}; - - -/** - * This contains the Linux-driver handlers - */ -struct Lx_irq_handler : public Lx::List::Element -{ - void *dev; /* Linux device */ - irq_handler_t handler; /* Linux handler */ - irq_handler_t thread_fn; /* Linux thread function */ - - Lx_irq_handler(void *dev, irq_handler_t handler, irq_handler_t thread_fn) - : dev(dev), handler(handler), thread_fn(thread_fn) { } -}; - - -namespace Lx { - class Irq; -} - -static void run_irq(void *args); - -extern "C" Platform::Device_capability pci_device_cap; - -/** - * Lx::Irq - */ -class Lx::Irq -{ - public: - - /** - * Context encapsulates the handling of an IRQ - */ - class Context : public Lx::List::Element - { - private: - - Name_composer _name; - - unsigned int _irq; /* IRQ number */ - Genode::Irq_session_client _irq_sess; - Lx::List _handler; /* List of registered handlers */ - Irq_task _task; - - Genode::Signal_transmitter _sender; - Genode::Signal_rpc_member _dispatcher; - - /** - * Call one IRQ handler - */ - bool _handle_one(Lx_irq_handler *h) - { - bool handled = false; - - /* XXX the handler as well as the thread_fn are called in a synchronouse fashion */ - switch (h->handler(_irq, h->dev)) { - case IRQ_WAKE_THREAD: - { - h->thread_fn(_irq, h->dev); - } - case IRQ_HANDLED: - handled = true; - break; - case IRQ_NONE: - break; - } - - return handled; - } - - /** - * Signal handler - */ - void _handle(unsigned) - { - _task.unblock(); - - /* kick off scheduling */ - Lx::scheduler().schedule(); - } - - public: - - /** - * Constructor - */ - Context(Server::Entrypoint &ep, unsigned irq, - Platform::Device_capability pci_dev) - : - _name(irq), - _irq(irq), - _irq_sess(Platform::Device_client(pci_dev).irq(0)), - _task(run_irq, this, _name.name), - _dispatcher(ep, *this, &Context::_handle) - { - _irq_sess.sigh(_dispatcher); - - /* initial ack to receive further IRQ signals */ - _irq_sess.ack_irq(); - } - - /** - * Return IRQ number - */ - unsigned irq() { return _irq; } - - /** - * Handle IRQ - */ - void handle_irq() - { - bool handled = false; - - /* report IRQ to all clients */ - for (Lx_irq_handler *h = _handler.first(); h; h = h->next()) { - if ((handled = _handle_one(h))) - break; - } - - _irq_sess.ack_irq(); - } - - /** - * Add linux handler to context - */ - void add_handler(Lx_irq_handler *h) { _handler.append(h); } - }; - - private: - - Server::Entrypoint &_ep; - Lx::List _list; - - Genode::Tslab _context_alloc; - Genode::Tslab _handler_alloc; - - /** - * Find context for given IRQ number - */ - Context *_find_context(unsigned int irq) - { - for (Context *i = _list.first(); i; i = i->next()) - if (i->irq() == irq) - return i; - - return 0; - } - - public: - - /** - * Constructor - */ - Irq(Server::Entrypoint &ep) - : - _ep(ep), - _context_alloc(Genode::env()->heap()), - _handler_alloc(Genode::env()->heap()) - { } - - /** - * Request an IRQ - */ - void request_irq(unsigned int irq, irq_handler_t handler, void *dev, - irq_handler_t thread_fn = 0) - { - Context *ctx = _find_context(irq); - - /* if this IRQ is not registered */ - if (!ctx) - ctx = new (&_context_alloc) Context(_ep, irq, pci_device_cap); - - /* register Linux handler */ - Lx_irq_handler *h = new (&_handler_alloc) - Lx_irq_handler(dev, handler, thread_fn); - ctx->add_handler(h); - } -}; - - -static Lx::Irq *_lx_irq; - - -void Lx::irq_init(Server::Entrypoint &ep) -{ - static Lx::Irq irq_context(ep); - _lx_irq = &irq_context; -} - - -static void run_irq(void *args) -{ - Lx::Irq::Context *ctx = static_cast(args); - - while (1) { - Lx::scheduler().current()->block_and_schedule(); - - ctx->handle_irq(); - } -} - - -extern "C" { - -/*********************** - ** linux/interrupt.h ** - ***********************/ - -int request_irq(unsigned int irq, irq_handler_t handler, - unsigned long flags, const char *name, void *dev) -{ - _lx_irq->request_irq(irq, handler, dev); - return 0; -} - - -int request_threaded_irq(unsigned int irq, irq_handler_t handler, - irq_handler_t thread_fn, - unsigned long flags, const char *name, - void *dev) -{ - _lx_irq->request_irq(irq, handler, dev, thread_fn); - return 0; -} - -} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wifi/lx.h b/repos/dde_linux/src/lib/wifi/lx.h index d155908593..5f0ae50041 100644 --- a/repos/dde_linux/src/lib/wifi/lx.h +++ b/repos/dde_linux/src/lib/wifi/lx.h @@ -18,47 +18,23 @@ #include /* local includes */ -#include +#include -#define DEBUG_COMPLETION 0 -#define DEBUG_DMA 0 -#define DEBUG_DRIVER 0 -#define DEBUG_IRQ 0 -#define DEBUG_KREF 0 #define DEBUG_PRINTK 1 #define DEBUG_DEV_DBG 1 -#define DEBUG_PCI 0 -#define DEBUG_SKB 0 -#define DEBUG_SLAB 0 -#define DEBUG_TIMER 0 -#define DEBUG_THREAD 0 -#define DEBUG_TRACE 0 -#define DEBUG_MUTEX 0 #define DEBUG_SCHEDULING 0 -#define DEBUG_WORK 0 namespace Lx { - void timer_init(Server::Entrypoint &); - void timer_update_jiffies(); - - void work_init(Server::Entrypoint &); - void socket_init(Server::Entrypoint &); void nic_init(Server::Entrypoint &); - void irq_init(Server::Entrypoint &); - Genode::Ram_dataspace_capability backend_alloc(Genode::addr_t, Genode::Cache_attribute); void backend_free(Genode::Ram_dataspace_capability); - void printf(char const *fmt, ...); - void debug_printf(int level, char const *fmt, ...); - - void get_mac_address(unsigned char *); } diff --git a/repos/dde_linux/src/lib/wifi/lxc.h b/repos/dde_linux/src/lib/wifi/lxc.h new file mode 100644 index 0000000000..85e42f83d5 --- /dev/null +++ b/repos/dde_linux/src/lib/wifi/lxc.h @@ -0,0 +1,40 @@ +/* + * \brief Lx C env + * \author Josef Soentgen + * \date 2016-03-04 + */ + +/* + * Copyright (C) 2016 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LXC_H_ +#define _LXC_H_ + +/* + * The sk_buff struct contains empty array members whose + * size differs between C and C++. Since we want to access + * certain members of the sk_buff from C++ we have to use + * a uniform format useable from both languages.W + * + * Note: we pull struct skb_buff as well as size_t from + * headers included before this one. + */ +struct Skb +{ + void *packet; + size_t packet_size; + void *frag; + size_t frag_size; +}; + +struct Skb skb_helper(struct sk_buff *skb); +bool is_eapol(struct sk_buff *skb); + +struct sk_buff *lxc_alloc_skb(size_t len, size_t headroom); +unsigned char *lxc_skb_put(struct sk_buff *skb, size_t len); + +#endif /* _LXC_H_ */ diff --git a/repos/dde_linux/src/lib/wifi/lxc_emul.c b/repos/dde_linux/src/lib/wifi/lxc_emul.c index 456f015f8b..c706991bdd 100644 --- a/repos/dde_linux/src/lib/wifi/lxc_emul.c +++ b/repos/dde_linux/src/lib/wifi/lxc_emul.c @@ -5,15 +5,79 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ +/* linux includes */ #include #include #include +#include + +/* local includes */ +#include + + +/************************************* + ** private Lx C env implementation ** + *************************************/ + +bool is_eapol(struct sk_buff *skb) +{ + return ntohs(skb->protocol) == ETH_P_PAE; +} + + +struct Skb skb_helper(struct sk_buff *skb) +{ + struct Skb helper; + + skb_push(skb, ETH_HLEN); + + helper.packet = skb->data; + helper.packet_size = ETH_HLEN; + helper.frag = 0; + helper.frag_size = 0; + + /** + * If received packets are too large (as of now 128 bytes) the actually + * payload is put into a fragment. Otherwise the payload is stored directly + * in the sk_buff. + */ + if (skb_shinfo(skb)->nr_frags) { + if (skb_shinfo(skb)->nr_frags > 1) + printk("more than 1 fragment in skb: %p nr_frags: %d", skb, + skb_shinfo(skb)->nr_frags); + + skb_frag_t *f = &skb_shinfo(skb)->frags[0]; + helper.frag = skb_frag_address(f); + helper.frag_size = skb_frag_size(f); + } + else + helper.packet_size += skb->len; + + return helper; +} + + +extern int verbose_alloc; + + +struct sk_buff *lxc_alloc_skb(size_t len, size_t headroom) +{ + struct sk_buff *skb = alloc_skb(len + headroom, GFP_KERNEL); + skb_reserve(skb, headroom); + return skb; +} + + +unsigned char *lxc_skb_put(struct sk_buff *skb, size_t len) +{ + return skb_put(skb, len); +} /**************************** @@ -60,6 +124,24 @@ unsigned int hweight32(unsigned int w) } +unsigned long find_last_bit(const unsigned long *addr, unsigned long size) +{ + if (size) { + unsigned long val = BITMAP_LAST_WORD_MASK(size); + unsigned long idx = (size-1) / BITS_PER_LONG; + + do { + val &= addr[idx]; + if (val) + return idx * BITS_PER_LONG + __fls(val); + + val = ~0ul; + } while (idx--); + } + return size; +} + + /***************************** ** linux/platform_device.h ** *****************************/ @@ -126,3 +208,182 @@ pdev_out: void netdev_run_todo() { __rtnl_unlock(); } + + +/******************** + ** linux/kernel.h ** + ********************/ + +unsigned long int_sqrt(unsigned long x) +{ + unsigned long b, m, y = 0; + + if (x <= 1) return x; + + m = 1UL << (BITS_PER_LONG - 2); + while (m != 0) { + b = y + m; + y >>= 1; + + if (x >= b) { + x -= b; + y += m; + } + m >>= 2; + } + + return y; +} + + +/************************* + ** linux/scatterlist.h ** + *************************/ + +void sg_chain(struct scatterlist *prv, unsigned int prv_nents, + struct scatterlist *sgl) +{ + prv[prv_nents - 1].offset = 0; + prv[prv_nents - 1].length = 0; + prv[prv_nents - 1].page_link = (unsigned long)sgl; + + prv[prv_nents - 1].page_flags |= 0x01; + prv[prv_nents - 1].page_flags &= ~0x02; +} + + +void sg_init_table(struct scatterlist *sgl, unsigned int nents) +{ + memset(sgl, 0, sizeof(*sgl) * nents); + sg_mark_end(&sgl[nents -1]); +} + + +void sg_mark_end(struct scatterlist *sg) +{ + sg->page_flags |= 0x02; + sg->page_flags &= ~0x01; +} + + +struct scatterlist *sg_next(struct scatterlist *sg) +{ + if (sg_is_last(sg)) + return NULL; + + sg++; + + if (sg_is_chain(sg)) + sg = sg_chain_ptr(sg); + + return sg; +} + + +void sg_set_buf(struct scatterlist *sg, const void *buf, unsigned int buflen) +{ + struct page *page = &sg->page_dummy; + sg->page_dummy.addr = (void*)buf; + sg_set_page(sg, page, buflen, 0); +} + + +void sg_set_page(struct scatterlist *sg, struct page *page, unsigned int len, unsigned int offset) +{ + sg->page_link = (unsigned long) page; + sg->offset = offset; + sg->length = len; +} + + +/**************** + ** net/sock.h ** + ****************/ + +static const struct net_proto_family *net_families[NPROTO]; + +int sock_register(const struct net_proto_family *ops) +{ + if (ops->family >= NPROTO) { + printk("protocol %d >= NPROTO (%d)\n", ops->family, NPROTO); + return -ENOBUFS; + } + + net_families[ops->family] = ops; + pr_info("NET: Registered protocol family %d\n", ops->family); + return 0; +} + + +struct socket *sock_alloc(void) +{ + return (struct socket *)kmalloc(sizeof(struct socket), 0); +} + + +int sock_create_lite(int family, int type, int protocol, struct socket **res) + +{ + struct socket *sock = sock_alloc(); + + if (!sock) return -ENOMEM; + + sock->type = type; + *res = sock; + return 0; +} + + +int sock_create_kern(struct net *net, int family, int type, int proto, + struct socket **res) +{ + struct socket *sock; + const struct net_proto_family *pf; + int err; + + if (family < 0 || family > NPROTO) + return -EAFNOSUPPORT; + + if (type < 0 || type > SOCK_MAX) + return -EINVAL; + + pf = net_families[family]; + + if (!pf) { + printk("No protocol found for family %d\n", family); + return -ENOPROTOOPT; + } + + if (!(sock = (struct socket *)kzalloc(sizeof(struct socket), 0))) { + printk("Could not allocate socket\n"); + return -ENFILE; + } + + sock->type = type; + + err = pf->create(&init_net, sock, proto, 1); + if (err) { + kfree(sock); + return err; + } + + *res = sock; + + return 0; +} + + +void log_sock(struct socket *socket) +{ + printk("\nNEW socket %p sk %p fsk %lx &sk %p &fsk %p\n\n", + socket, socket->sk, socket->flags, &socket->sk, &socket->flags); +} + + +static void sock_init(void) +{ + skb_init(); +} + + +core_initcall(sock_init); diff --git a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc index 6a2c11dec9..d199a42700 100644 --- a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc +++ b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -24,13 +24,13 @@ #include /* local includes */ -#include #include #include +#include + +#include +#include -#include -# include -#include static bool const verbose = false; #define PWRNV(...) do { if (verbose) PWRN(__VA_ARGS__); } while (0) @@ -39,405 +39,6 @@ typedef Genode::size_t size_t; typedef Genode::addr_t addr_t; -namespace Lx { - class Slab_backend_alloc; - class Slab_alloc; -} - -/** - * Back-end allocator for Genode's slab allocator - */ -class Lx::Slab_backend_alloc : public Genode::Allocator, - public Genode::Rm_connection, - public Genode::Region_map_client -{ - private: - - enum { - VM_SIZE = 24 * 1024 * 1024, /* size of VM region to reserve */ - BLOCK_SIZE = 1024 * 1024, /* 1 MiB */ - ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */ - }; - - addr_t _base; /* virt. base address */ - Genode::Cache_attribute _cached; /* non-/cached RAM */ - Genode::Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */ - addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */ - int _index; /* current index in ds_cap */ - Genode::Allocator_avl _range; /* manage allocations */ - - bool _alloc_block() - { - if (_index == ELEMENTS) { - PERR("Slab-backend exhausted!"); - return false; - } - - try { - _ds_cap[_index] = Lx::backend_alloc(BLOCK_SIZE, _cached); - /* attach at index * BLOCK_SIZE */ - Region_map_client::attach_at(_ds_cap[_index], _index * BLOCK_SIZE, BLOCK_SIZE, 0); - - /* lookup phys. address */ - _ds_phys[_index] = Genode::Dataspace_client(_ds_cap[_index]).phys_addr(); - } catch (...) { return false; } - - /* return base + offset in VM area */ - addr_t block_base = _base + (_index * BLOCK_SIZE); - ++_index; - - _range.add_range(block_base, BLOCK_SIZE); - return true; - } - - public: - - Slab_backend_alloc(Genode::Cache_attribute cached) - : - Region_map_client(Rm_connection::create(VM_SIZE)), - _cached(cached), _index(0), _range(Genode::env()->heap()) - { - /* reserver attach us, anywere */ - _base = Genode::env()->rm_session()->attach(dataspace()); - } - - /** - * Allocate - */ - bool alloc(size_t size, void **out_addr) override - { - bool done = _range.alloc(size, out_addr); - - if (done) - return done; - - done = _alloc_block(); - if (!done) { - PERR("Backend allocator exhausted\n"); - return false; - } - - return _range.alloc(size, out_addr); - } - - void free(void *addr, size_t size) override { _range.free(addr, size); } - size_t overhead(size_t size) const override { return 0; } - bool need_size_for_free() const override { return false; } - - /** - * Return phys address for given virtual addr. - */ - addr_t phys_addr(addr_t addr) - { - if (addr < _base || addr >= (_base + VM_SIZE)) - return ~0UL; - - int index = (addr - _base) / BLOCK_SIZE; - - /* physical base of dataspace */ - addr_t phys = _ds_phys[index]; - - if (!phys) - return ~0UL; - - /* add offset */ - phys += (addr - _base - (index * BLOCK_SIZE)); - return phys; - } - - /** - * Translate given physical address to virtual address - * - * \return virtual address, or 0 if no translation exists - */ - addr_t virt_addr(addr_t phys) - { - for (unsigned i = 0; i < ELEMENTS; i++) { - if (_ds_cap[i].valid() && - phys >= _ds_phys[i] && phys < _ds_phys[i] + BLOCK_SIZE) - return _base + i*BLOCK_SIZE + phys - _ds_phys[i]; - } - - PWRN("virt_addr(0x%lx) - no translation", phys); - return 0; - } - - addr_t start() const { return _base; } - addr_t end() const { return _base + VM_SIZE - 1; } - - /** - * Cached memory backend allocator - */ - static Slab_backend_alloc & mem() - { - static Slab_backend_alloc inst(Genode::CACHED); - return inst; - } - - /** - * DMA memory backend allocator - */ - static Slab_backend_alloc & dma() - { - static Slab_backend_alloc inst(Genode::UNCACHED); - return inst; - } -}; - - -/** - * Slab allocator using our back-end allocator - */ -class Lx::Slab_alloc : public Genode::Slab -{ - private: - - Genode::size_t const _object_size; - - static Genode::size_t _calculate_block_size(Genode::size_t object_size) - { - Genode::size_t const block_size = 16*object_size; - return Genode::align_addr(block_size, 12); - } - - public: - - Slab_alloc(Genode::size_t object_size, Slab_backend_alloc &allocator) - : - Slab(object_size, _calculate_block_size(object_size), 0, &allocator), - _object_size(object_size) - { } - - Genode::addr_t alloc() - { - Genode::addr_t result; - return (Slab::alloc(_object_size, (void **)&result) ? result : 0); - } - - void free(void *ptr) { Slab::free(ptr, _object_size); } -}; - - -/** - * Memory interface used for Linux emulation - */ -class Malloc -{ - private: - - enum { - SLAB_START_LOG2 = 3, /* 8 B */ - SLAB_STOP_LOG2 = 16, /* 64 KiB */ - NUM_SLABS = (SLAB_STOP_LOG2 - SLAB_START_LOG2) + 1, - }; - - typedef Genode::addr_t addr_t; - typedef Lx::Slab_alloc Slab_alloc; - typedef Lx::Slab_backend_alloc Slab_backend_alloc; - - Slab_backend_alloc &_back_allocator; - Slab_alloc *_allocator[NUM_SLABS]; - Genode::Cache_attribute _cached; /* cached or un-cached memory */ - addr_t _start; /* VM region of this allocator */ - addr_t _end; - - /** - * Set 'value' at 'addr' - */ - void _set_at(addr_t addr, addr_t value) { *((addr_t *)addr) = value; } - - /** - * Retrieve slab index belonging to given address - */ - unsigned _slab_index(Genode::addr_t **addr) - { - using namespace Genode; - /* get index */ - addr_t index = *(*addr - 1); - - /* - * If index large, we use aligned memory, retrieve beginning of slab entry - * and read index from there - */ - if (index > 32) { - *addr = (addr_t *)*(*addr - 1); - index = *(*addr - 1); - } - - return index; - } - - /** - * Get the originally requested size of the allocation - */ - size_t _get_orig_size(Genode::addr_t **addr) - { - using namespace Genode; - - addr_t index = *(*addr - 1); - if (index > 32) { - *addr = (addr_t *) * (*addr - 1); - } - - return *(*addr - 2); - } - - public: - - Malloc(Slab_backend_alloc &alloc, Genode::Cache_attribute cached) - : - _back_allocator(alloc), _cached(cached), _start(alloc.start()), - _end(alloc.end()) - { - /* init slab allocators */ - for (unsigned i = SLAB_START_LOG2; i <= SLAB_STOP_LOG2; i++) - _allocator[i - SLAB_START_LOG2] = new (Genode::env()->heap()) - Slab_alloc(1U << i, alloc); - } - - /** - * Alloc in slabs - */ - void *alloc(Genode::size_t size, int align = 0, Genode::addr_t *phys = 0) - { - using namespace Genode; - - /* save requested size */ - size_t orig_size = size; - size += sizeof(addr_t); - - /* += slab index + aligment size */ - size += sizeof(addr_t) + (align > 2 ? (1 << align) : 0); - - int msb = Genode::log2(size); - - if (size > (1U << msb)) - msb++; - - if (size < (1U << SLAB_START_LOG2)) - msb = SLAB_STOP_LOG2; - - if (msb > SLAB_STOP_LOG2) { - // PERR("Slab too large %u reqested %zu cached %d", 1U << msb, size, _cached); - return 0; - } - - addr_t addr = _allocator[msb - SLAB_START_LOG2]->alloc(); - if (!addr) { - PERR("Failed to get slab for %u", 1 << msb); - return 0; - } - - _set_at(addr, orig_size); - addr += sizeof(addr_t); - - _set_at(addr, msb - SLAB_START_LOG2); - addr += sizeof(addr_t); - - if (align > 2) { - /* save */ - addr_t ptr = addr; - addr_t align_val = (1U << align); - addr_t align_mask = align_val - 1; - /* align */ - addr = (addr + align_val) & ~align_mask; - /* write start address before aligned address */ - _set_at(addr - sizeof(addr_t), ptr); - } - - if (phys) - *phys = _back_allocator.phys_addr(addr); - return (addr_t *)addr; - } - - void free(void const *a) - { - using namespace Genode; - addr_t *addr = (addr_t *)a; - - /* XXX changes addr */ - unsigned nr = _slab_index(&addr); - /* we need to decrease addr by 2, orig_size and index come first */ - _allocator[nr]->free((void *)(addr - 2)); - } - - size_t size(void const *a) - { - using namespace Genode; - addr_t *addr = (addr_t *)a; - - /* XXX changes addr */ - return _get_orig_size(&addr); - } - - Genode::addr_t phys_addr(void *a) - { - return _back_allocator.phys_addr((addr_t)a); - } - - Genode::addr_t virt_addr(Genode::addr_t phys) - { - return _back_allocator.virt_addr(phys); - } - - /** - * Belongs given address to this allocator - */ - bool inside(addr_t const addr) const { return (addr > _start) && (addr <= _end); } - - /** - * Cached memory allocator - */ - static Malloc & mem() - { - static Malloc inst(Slab_backend_alloc::mem(), Genode::CACHED); - return inst; - } - - /** - * DMA memory allocator - */ - static Malloc & dma() - { - static Malloc inst(Slab_backend_alloc::dma(), Genode::UNCACHED); - return inst; - } -}; - - -void Lx::debug_printf(int level, char const *fmt, ...) -{ - if (level) { - va_list va; - va_start(va, fmt); - Genode::vprintf(fmt, va); - va_end(va); - } -} - - -void Lx::printf(char const *fmt, ...) -{ - va_list va; - va_start(va, fmt); - Genode::vprintf(fmt, va); - va_end(va); -} - - -extern "C" void lx_printf(char const *fmt, ...) -{ - va_list va; - va_start(va, fmt); - Genode::vprintf(fmt, va); - va_end(va); -} - - -extern "C" void lx_vprintf(char const *fmt, va_list va) { - Genode::vprintf(fmt, va); } - - /******************** ** linux/string.h ** ********************/ @@ -673,6 +274,80 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) } +size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) +{ + if (bytes > i->count) + bytes = i->count; + + if (bytes == 0) + return 0; + + char *kdata = reinterpret_cast(addr); + struct iovec const *iov = i->iov; + + size_t len = bytes; + while (len > 0) { + if (iov->iov_len) { + size_t copy_len = (size_t)len < iov->iov_len ? len : iov->iov_len; + Genode::memcpy(kdata, iov->iov_base, copy_len); + + len -= copy_len; + kdata += copy_len; + } + iov++; + } + + // PDBG("addr: %p bytes: %zu iov_base: %p iov_len: %zu len: %zu", + // addr, bytes, i->iov->iov_base, i->iov->iov_len, len); + + return bytes; +} + + +size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i) +{ + if (bytes > i->count) + bytes = i->count; + + if (bytes == 0) + return 0; + + char *kdata = reinterpret_cast(addr); + struct iovec const *iov = i->iov; + + size_t len = bytes; + while (len > 0) { + if (iov->iov_len) { + size_t copy_len = (size_t)len < iov->iov_len ? len : iov->iov_len; + Genode::memcpy(iov->iov_base, kdata, copy_len); + + len -= copy_len; + kdata += copy_len; + } + iov++; + } + + // PDBG("addr: %p bytes: %zu iov_base: %p iov_len: %zu len: %zu", + // addr, bytes, i->iov->iov_base, i->iov->iov_len, len); + + return bytes; +} + + +size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, + struct iov_iter *i) +{ + return copy_to_iter(reinterpret_cast(page->addr) + offset, bytes, i); +} + + +size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, + struct iov_iter *i) +{ + return copy_from_iter(reinterpret_cast(page->addr) + offset, bytes, i); +} + + /******************** ** linux/socket.h ** ********************/ @@ -705,165 +380,22 @@ extern "C" int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov ** Memory allocation * **********************/ -void *kmalloc(size_t size, gfp_t flags) +#include + + +void *kmalloc_array(size_t n, size_t size, gfp_t flags) { - if (flags & __GFP_DMA) - PWRN("GFP_DMA memory (below 16 MiB) requested (%p)", __builtin_return_address(0)); - if (flags & __GFP_DMA32) - PWRN("GFP_DMA32 memory (below 4 GiB) requested (%p)", __builtin_return_address(0)); - - void *addr = flags & GFP_LX_DMA ? Malloc::dma().alloc(size, 12) - : Malloc::mem().alloc(size); - - if ((addr_t)addr & 0x3) - PERR("unaligned kmalloc %lx", (addr_t)addr); - - if (flags & __GFP_ZERO) - Genode::memset(addr, 0, size); - - return addr; + if (size != 0 && n > SIZE_MAX / size) return NULL; + return kmalloc(n * size, flags); } -void *kzalloc(size_t size, gfp_t flags) +void kvfree(const void *p) { - return kmalloc(size, flags | __GFP_ZERO); -} - - -void *kzalloc_node(size_t size, gfp_t flags, int node) -{ - return kzalloc(size, 0); -} - - -void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > (~0UL / size)) - return 0; - - return kzalloc(n * size, flags); -} - - -void kfree(void const *p) -{ - if (!p) return; - - if (Malloc::mem().inside((Genode::addr_t)p)) - Malloc::mem().free(p); - else if (Malloc::dma().inside((Genode::addr_t)p)) - Malloc::dma().free(p); - else - PERR("%s: unknown block at %p, called from %p", __func__, - p, __builtin_return_address(0)); -} - - -void kzfree(void const *p) -{ - if (!p) return; - - size_t len = ksize(const_cast(p)); - - Genode::memset((void*)p, 0, len); - kfree(p); } -void *kmalloc_node_track_caller(size_t size, gfp_t flags, int node) -{ - return kmalloc(size, flags); -} - - -static size_t _ksize(void *p) -{ - size_t size = 0; - - if (Malloc::mem().inside((Genode::addr_t)p)) - size = Malloc::mem().size(p); - else if (Malloc::dma().inside((Genode::addr_t)p)) - size = Malloc::dma().size(p); - else - PERR("%s: unknown block at %p", __func__, p); - - return size; -} - - -size_t ksize(void *p) -{ - return _ksize(p); -} - - -void *krealloc(void *p, size_t size, gfp_t flags) -{ - /* XXX handle short-cut where size == old_size */ - void *addr = kmalloc(size, flags); - - if (addr && p) { - size_t old_size = _ksize(p); - - Genode::memcpy(addr, p, old_size); - kfree(p); - } - - return addr; -} - - -void *kmemdup(const void *src, size_t size, gfp_t flags) -{ - void *addr = kmalloc(size, flags); - - if (addr) - Genode::memcpy(addr, src, size); - - return addr; -} - - -/****************** - ** linux/slab.h ** - ******************/ - -struct kmem_cache : Lx::Slab_alloc -{ - kmem_cache(size_t object_size, bool dma) - : - Lx::Slab_alloc(object_size, dma ? Lx::Slab_backend_alloc::dma() - : Lx::Slab_backend_alloc::mem()) - { } -}; - - -struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, - unsigned long flags, void (*ctor)(void *)) -{ - if (ctor) { - PERR("%s: ctor not supported", __func__); - return nullptr; - } - - return new (Genode::env()->heap()) kmem_cache(size, flags & SLAB_LX_DMA); -} - - -void * kmem_cache_alloc(struct kmem_cache *cache, gfp_t flags) -{ - return (void *)cache->alloc(); -} - - -void kmem_cache_free(struct kmem_cache *cache, void *objp) -{ - cache->free(objp); -} - - /********************* ** linux/vmalloc.h ** *********************/ @@ -999,7 +531,8 @@ void *dev_get_drvdata(const struct device *dev) int dev_set_drvdata(struct device *dev, void *data) { - dev->driver_data = data; return 0; + dev->driver_data = data; + return 0; } @@ -1074,20 +607,6 @@ void msleep(unsigned int msecs) void mdelay(unsigned long msecs) { msleep(msecs); } -/********************* - ** linux/jiffies.h ** - *********************/ - -enum { - JIFFIES_TICK_MS = 1000/HZ, - JIFFIES_TICK_US = 1000*1000/HZ, -}; - -unsigned long msecs_to_jiffies(const unsigned int m) { return m / JIFFIES_TICK_MS; } -unsigned int jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; } -unsigned long usecs_to_jiffies(const unsigned int u) { return u / JIFFIES_TICK_US; } - - /******************* ** linux/timer.h ** *******************/ @@ -1134,6 +653,26 @@ unsigned long round_jiffies_relative(unsigned long j) } +/******************* + ** linux/ktime.h ** + *******************/ + +ktime_t ktime_get_real(void) +{ + return (ktime_t) { .tv64 = (s64)(jiffies * (1000 / HZ) * NSEC_PER_MSEC) }; +} + + +/************************* + ** linux/timekeeping.h ** + *************************/ + +time64_t ktime_get_seconds(void) +{ + return jiffies_to_msecs(jiffies) / 1000; +} + + /*********************** ** linux/workqueue.h ** ***********************/ @@ -1149,6 +688,12 @@ struct workqueue_struct *alloc_ordered_workqueue(char const *name , unsigned int return create_singlethread_workqueue(name); } +struct workqueue_struct *alloc_workqueue(const char *fmt, unsigned int flags, + int max_active, ...) +{ + return create_singlethread_workqueue(nullptr); +} + /********************** ** linux/firmware.h ** @@ -1166,33 +711,37 @@ int request_firmware_nowait(struct module *module, bool uevent, /* only try to load known firmware images */ Firmware_list *fwl = 0; for (size_t i = 0; i < fw_list_len; i++) { - if (Genode::strcmp(name, fw_list[i].name) == 0) { + if (Genode::strcmp(name, fw_list[i].requested_name) == 0) { fwl = &fw_list[i]; break; } } if (!fwl) { - PERR("firmware '%s' is not in the firmware white list.", name); + PERR("Firmware '%s' is not in the firmware white list.", name); return -1; } - Genode::Rom_connection rom(fwl->name); + char const *fw_name = fwl->available_name + ? fwl->available_name : fwl->requested_name; + Genode::Rom_connection rom(fw_name); Genode::Dataspace_capability ds_cap = rom.dataspace(); - if (!ds_cap.valid()) + if (!ds_cap.valid()) { + PERR("Could not get firmware ROM dataspace"); return -1; + } firmware *fw = (firmware *)kzalloc(sizeof (firmware), 0); if (!fw) { - PERR("could not allocate memory for struct firmware"); + PERR("Could not allocate memory for firmware metadata"); return -1; } /* use Genode env because our slab only goes up to 64KiB */ fw->data = (u8*)Genode::env()->heap()->alloc(fwl->size); if (!fw->data) { - PERR("could not allocate memory for firmware image"); + PERR("Could not allocate memory for firmware image"); kfree(fw); return -1; } @@ -1223,7 +772,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { dma_addr_t dma_addr; - void *addr = Malloc::dma().alloc(size, 12, &dma_addr); + void *addr = Lx::Malloc::dma().alloc(size, 12, &dma_addr); if (!addr) { // PERR("dma alloc: %zu failed", size); @@ -1251,8 +800,8 @@ void *dma_zalloc_coherent(struct device *dev, size_t size, void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) { - if (Malloc::dma().inside((Genode::addr_t)vaddr)) - Malloc::dma().free(vaddr); + if (Lx::Malloc::dma().inside((Genode::addr_t)vaddr)) + Lx::Malloc::dma().free(vaddr); else PERR("vaddr: %p is not DMA memory", vaddr); } @@ -1262,10 +811,10 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction direction) { - if (!Malloc::dma().inside((Genode::addr_t)page->addr)) + if (!Lx::Malloc::dma().inside((Genode::addr_t)page->addr)) PERR("page->page: %p not DMA address", page->addr); - dma_addr_t dma_addr = (dma_addr_t) Malloc::dma().phys_addr(page->addr); + dma_addr_t dma_addr = (dma_addr_t) Lx::Malloc::dma().phys_addr(page->addr); if (dma_addr == ~0UL) PERR("%s: virtual address %p not registered for DMA, called from: %p", @@ -1277,13 +826,12 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction direction) { - dma_addr_t dma_addr = (dma_addr_t) Malloc::dma().phys_addr(cpu_addr); + dma_addr_t dma_addr = (dma_addr_t) Lx::Malloc::dma().phys_addr(cpu_addr); if (dma_addr == ~0UL) PERR("%s: virtual address %p not registered for DMA, called from: %p", __func__, cpu_addr, __builtin_return_address(0)); - return dma_addr; } @@ -1347,7 +895,7 @@ class Addr_to_page_mapping : public Genode::List::Element static void insert(struct page *page) { Addr_to_page_mapping *m = (Addr_to_page_mapping*) - Malloc::mem().alloc(sizeof (Addr_to_page_mapping)); + Lx::Malloc::mem().alloc(sizeof (Addr_to_page_mapping)); m->_addr = (unsigned long)page->addr; m->_page = page; @@ -1364,7 +912,7 @@ class Addr_to_page_mapping : public Genode::List::Element if (mp) { _list()->remove(mp); - Malloc::mem().free(mp); + Lx::Malloc::mem().free(mp); } } @@ -1397,7 +945,7 @@ struct page *alloc_pages(gfp_t gfp_mask, unsigned int order) size_t size = PAGE_SIZE << order; - page->addr = Malloc::dma().alloc(size, 12); + page->addr = Lx::Malloc::dma().alloc(size, 12); if (!page->addr) { PERR("alloc_pages: %zu failed", size); @@ -1413,6 +961,23 @@ struct page *alloc_pages(gfp_t gfp_mask, unsigned int order) } +void *__alloc_page_frag(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask) +{ + struct page *page = alloc_pages(gfp_mask, fragsz / PAGE_SIZE); + if (!page) return nullptr; + + return page->addr; +} + + +void __free_page_frag(void *addr) +{ + struct page *page = virt_to_head_page(addr); + __free_pages(page, 0xdeadbeef); +} + + void __free_pages(struct page *page, unsigned int order) { if (!atomic_dec_and_test(&page->_count)) { @@ -1423,7 +988,7 @@ void __free_pages(struct page *page, unsigned int order) Addr_to_page_mapping::remove(page); - Malloc::dma().free(page->addr); + Lx::Malloc::dma().free(page->addr); kfree(page); } @@ -1470,10 +1035,15 @@ void get_page(struct page *page) void put_page(struct page *page) { + if (!page) { + PWRN("put_page: page is zero called from: %p", __builtin_return_address(0)); + return; + } + if (!atomic_dec_and_test(&page->_count)) return; - Malloc::dma().free(page->addr); + Lx::Malloc::dma().free(page->addr); kfree(page); } @@ -1763,3 +1333,156 @@ void *kthread_run(int (*threadfn)(void *), void *data, char const *name) return (void*)42; } + + +/***************** + ** linux/pci.h ** + *****************/ + +#include + + +void *pci_get_drvdata(struct pci_dev *pdev) +{ + return dev_get_drvdata(&pdev->dev); +} + + +void pci_set_drvdata(struct pci_dev *pdev, void *data) +{ + dev_set_drvdata(&pdev->dev, data); +} + + +/*********************** + ** linux/interrupt.h ** + ***********************/ + +#include + + +int request_irq(unsigned int irq, irq_handler_t handler, + unsigned long flags, const char *name, void *dev) +{ + Lx::Pci_dev *pci_dev = Lx::pci_dev_registry()->first(); + Lx::Irq::irq().request_irq(pci_dev->client(), handler, dev); + return 0; +} + + +int request_threaded_irq(unsigned int irq, irq_handler_t handler, + irq_handler_t thread_fn, + unsigned long flags, const char *name, + void *dev) +{ + Lx::Pci_dev *pci_dev = Lx::pci_dev_registry()->first(); + Lx::Irq::irq().request_irq(pci_dev->client(), handler, dev, thread_fn); + return 0; +} + + +/*********************** + ** linux/workquque.h ** + ***********************/ + +/* Linux emul includes */ +#include + + +static void execute_delayed_work(unsigned long dwork) +{ + Lx::Work::work_queue().schedule_delayed((struct delayed_work *)dwork, 0); + Lx::Work::work_queue().unblock(); +} + + +bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, + unsigned long delay) +{ + /* treat delayed work without delay like any other work */ + if (delay == 0) { + execute_delayed_work((unsigned long)dwork); + } else { + mod_timer(&dwork->timer, delay); + } + return true; +} + + +/*********************** + ** linux/interrupt.h ** + ***********************/ + +void tasklet_init(struct tasklet_struct *t, void (*f)(unsigned long), unsigned long d) +{ + t->func = f; + t->data = d; +} + + +void tasklet_schedule(struct tasklet_struct *tasklet) +{ + Lx::Work::work_queue().schedule_tasklet(tasklet); +} + + +void tasklet_hi_schedule(struct tasklet_struct *tasklet) +{ + tasklet_schedule(tasklet); +} + + +/************************ + ** linux/completion.h ** + ************************/ + +#include + + +long __wait_completion(struct completion *work, unsigned long timeout) { + return timeout ? 1 : 0; } + + +int wait_for_completion_killable(struct completion *work) +{ + __wait_completion(work, 0); + return 0; +} + + +long wait_for_completion_killable_timeout(struct completion *work, + unsigned long timeout) +{ + __wait_completion(work, 0); + return 1; +} + + +/****************** + ** linux/wait.h ** + ******************/ + +#include + + +/******************* + ** linux/timer.h ** + *******************/ + +#include + + +void init_timer_deferrable(struct timer_list *timer) { /* XXX */ } + + +signed long schedule_timeout_uninterruptible(signed long timeout) { return 0; } + + +int wake_up_process(struct task_struct *tsk) { return 0; } + + +/******************* + ** linux/sched.h ** + *******************/ + +#include diff --git a/repos/dde_linux/src/lib/wifi/nic.cc b/repos/dde_linux/src/lib/wifi/nic.cc index e1c6a18ecb..1489a266d2 100644 --- a/repos/dde_linux/src/lib/wifi/nic.cc +++ b/repos/dde_linux/src/lib/wifi/nic.cc @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2012-2013 Genode Labs GmbH + * Copyright (C) 2012-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -24,11 +24,13 @@ /* local includes */ #include - -#include #include -#include -#include + +#include +# include +# include +# include +#include extern bool config_verbose; @@ -36,6 +38,7 @@ enum { HEAD_ROOM = 128, /* XXX guessed value but works */ }; + /** * Nic::Session implementation */ @@ -64,14 +67,9 @@ class Wifi_session_component : public Nic::Session_component return true; } - struct sk_buff *skb = ::alloc_skb(packet.size() + HEAD_ROOM, GFP_KERNEL); - if (skb == nullptr) { - PERR("Could not allocate new sk_buff"); - return false; - } - skb_reserve(skb, HEAD_ROOM); + struct sk_buff *skb = lxc_alloc_skb(packet.size() + HEAD_ROOM, HEAD_ROOM); - unsigned char *data = skb_put(skb, packet.size()); + unsigned char *data = lxc_skb_put(skb, packet.size()); Genode::memcpy(data, _tx.sink()->packet_content(packet), packet.size()); _ndev->netdev_ops->ndo_start_xmit(skb, _ndev); @@ -123,44 +121,24 @@ class Wifi_session_component : public Nic::Session_component { _handle_packet_stream(); - if (!_rx.source()->ready_to_submit()) + if (!_rx.source()->ready_to_submit()) { + PWRN("Not ready to receive packet"); return; - - /* get mac header back */ - skb_push(skb, ETH_HLEN); - - void *packet = skb->data; - size_t packet_size = ETH_HLEN; - void *frag = 0; - size_t frag_size = 0; - - /** - * If received packets are too large (as of now 128 bytes) the actually - * payload is put into a fragment. Otherwise the payload is stored directly - * in the sk_buff. - */ - if (skb_shinfo(skb)->nr_frags) { - if (skb_shinfo(skb)->nr_frags > 1) - PERR("more than 1 fragment in skb"); - - skb_frag_t *f = &skb_shinfo(skb)->frags[0]; - frag = skb_frag_address(f); - frag_size = skb_frag_size(f); } - else - packet_size += skb->len; + Skb s = skb_helper(skb); try { - Nic::Packet_descriptor p = _rx.source()->alloc_packet(packet_size + frag_size); + Nic::Packet_descriptor p = _rx.source()->alloc_packet(s.packet_size + s.frag_size); void *buffer = _rx.source()->packet_content(p); - memcpy(buffer, packet, packet_size); - if (frag_size) - memcpy((char *)buffer + packet_size, frag, frag_size); + memcpy(buffer, s.packet, s.packet_size); + + if (s.frag_size) + memcpy((char *)buffer + s.packet_size, s.frag, s.frag_size); _rx.source()->submit_packet(p); } catch (...) { - PDBG("failed to process received packet"); + PWRN("failed to process received packet"); } } @@ -270,7 +248,7 @@ class Lx::Notifier Block(struct notifier_block *nb) : nb(nb) { } }; - Lx::List _list; + Lx_kit::List _list; Genode::Tslab _block_alloc; public: @@ -379,7 +357,7 @@ extern "C" struct net_device * netdev_notifier_info_to_dev(struct netdev_notifie } -struct Proto_hook : public Lx::List::Element +struct Proto_hook : public Lx_kit::List::Element { struct packet_type &pt; @@ -391,7 +369,7 @@ class Proto_hook_list { private: - Lx::List _list; + Lx_kit::List _list; Genode::Allocator &_alloc; public: @@ -445,6 +423,12 @@ extern "C" struct net_device *__dev_get_by_index(struct net *net, int ifindex) } +extern "C" struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex) +{ + return __dev_get_by_index(net, ifindex); +} + + extern "C" struct net_device *dev_get_by_index(struct net *net, int ifindex) { return __dev_get_by_index(net, ifindex); @@ -589,7 +573,7 @@ extern "C" int netif_receive_skb(struct sk_buff *skb) */ /* send EAPOL related frames only to the wpa_supplicant */ - if (ntohs(skb->protocol) == ETH_P_PAE) { + if (is_eapol(skb)) { /* XXX call only AF_PACKET hook */ for (Proto_hook* ph = proto_hook_list().first(); ph; ph = ph->next()) { ph->pt.func(skb, Root::instance->device, &ph->pt, Root::instance->device); @@ -605,6 +589,30 @@ extern "C" int netif_receive_skb(struct sk_buff *skb) } +gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) +{ + return netif_receive_skb(skb); +} + + +extern "C" void netif_start_subqueue(struct net_device *dev, u16 queue_index) +{ + dev->_tx[queue_index].state = NETDEV_QUEUE_START; +} + + +extern "C" void netif_stop_subqueue(struct net_device *dev, u16 queue_index) +{ + dev->_tx[queue_index].state = 0; +} + + +extern "C" void netif_wake_subqueue(struct net_device *dev, u16 queue_index) +{ + dev->_tx[queue_index].state = NETDEV_QUEUE_START; +} + + extern "C" u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) { if (queue_index > dev-> real_num_tx_queues) { @@ -618,6 +626,7 @@ extern "C" u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) extern "C" struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, + unsigned char name_assign_type, void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs) { diff --git a/repos/dde_linux/src/lib/wifi/pci_driver.cc b/repos/dde_linux/src/lib/wifi/pci_driver.cc deleted file mode 100644 index ccd1eedd5a..0000000000 --- a/repos/dde_linux/src/lib/wifi/pci_driver.cc +++ /dev/null @@ -1,489 +0,0 @@ -/* - * \brief Emulate 'pci_dev' structure - * \author Sebastian Sumpf - * \author Josef Soentgen - * \date 2012-04-02 - */ - -/* - * Copyright (C) 2012-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode inludes */ -#include -#include -#include -#include -#include -#include - -/* local includes */ -#include - -#include -# include -#include - - -static bool const verbose = false; -#define PDBGV(...) do { if (verbose) PDBG(__VA_ARGS__); } while (0) - - -struct bus_type pci_bus_type; - - -/** - * Scan PCI bus and probe for HCDs - */ -class Pci_driver -{ - private: - - pci_driver *_drv; /* Linux PCI driver */ - Platform::Device_capability _cap; /* PCI cap */ - pci_device_id const *_id; /* matched id for this driver */ - - public: - - pci_dev *_dev; /* Linux PCI device */ - - private: - - /* offset used in PCI config space */ - enum Pci_config { IRQ = 0x3c, REV = 0x8, CMD = 0x4, - STATUS = 0x4, CAP = 0x34 }; - enum Pci_cap { CAP_LIST = 0x10, CAP_EXP = 0x10, - CAP_EXP_FLAGS = 0x2, CAP_EXP_DEVCAP = 0x4 }; - - /** - * Fill Linux device informations - */ - bool _setup_pci_device() - { - using namespace Platform; - - Device_client client(_cap); - if (client.device_id() != _id->device) - return false; - - _dev = new (Genode::env()->heap()) pci_dev; - - _dev->vendor = client.vendor_id(); - _dev->device = client.device_id(); - _dev->class_ = client.class_code(); - _dev->revision = client.config_read(REV, Device::ACCESS_8BIT); - _dev->dev.driver = &_drv->driver; - - /* dummy dma mask used to mark device as DMA capable */ - static u64 dma_mask = ~(u64)0; - _dev->dev.dma_mask = &dma_mask; - _dev->dev.coherent_dma_mask = ~0; - - /* read interrupt line */ - _dev->irq = client.config_read(IRQ, Device::ACCESS_8BIT); - - /* hide ourselfs in bus structure */ - _dev->bus = (struct pci_bus *)this; - - /* setup resources */ - bool io = false; - for (int i = 0; i < Device::NUM_RESOURCES; i++) { - Device::Resource res = client.resource(i); - if (res.type() == Device::Resource::INVALID) - continue; - - _dev->resource[i].start = res.base(); - _dev->resource[i].end = res.base() + res.size() - 1; - _dev->resource[i].flags = res.type() == Device::Resource::IO - ? IORESOURCE_IO : 0; - - PDBGV("base: %x size: %x type: %u", - res.base(), res.size(), res.type()); - - /* request I/O memory (write combined) */ - if (res.type() == Device::Resource::MEMORY) - PDBGV("I/O memory [%x-%x)", res.base(), - res.base() + res.size()); - } - - /* enable bus master and io bits */ - uint16_t cmd = client.config_read(CMD, Device::ACCESS_16BIT); - cmd |= io ? 0x1 : 0; - - /* enable bus master */ - cmd |= 0x4; - client.config_write(CMD, cmd, Device::ACCESS_16BIT); - - /* get pci express capability */ - _dev->pcie_cap = 0; - uint16_t status = client.config_read(STATUS, Device::ACCESS_32BIT) >> 16; - if (status & CAP_LIST) { - uint8_t offset = client.config_read(CAP, Device::ACCESS_8BIT); - while (offset != 0x00) { - uint8_t value = client.config_read(offset, Device::ACCESS_8BIT); - - if (value == CAP_EXP) - _dev->pcie_cap = offset; - - offset = client.config_read(offset + 1, Device::ACCESS_8BIT); - } - } - - if (_dev->pcie_cap) { - uint16_t reg_val = client.config_read(_dev->pcie_cap, Device::ACCESS_16BIT); - _dev->pcie_flags_reg = reg_val; - } - - return true; - } - - /** - * Probe device with driver - */ - bool _probe() - { - - /* only probe if the device matches */ - if (!_setup_pci_device()) - return false; - - /* PDBG("probe: %p 0x%x", _dev, _id); */ - - if (!_drv->probe(_dev, _id)) { - return true; - } - - return false; - } - - template - Platform::Device::Access_size _access_size(T t) - { - switch (sizeof(T)) - { - case 1: - return Platform::Device::ACCESS_8BIT; - case 2: - return Platform::Device::ACCESS_16BIT; - default: - return Platform::Device::ACCESS_32BIT; - } - } - - public: - - Pci_driver(pci_driver *drv, Platform::Device_capability cap, - pci_device_id const * id) - : _drv(drv), _cap(cap), _id(id), _dev(0) - { - if (!_probe()) - throw -1; - } - - ~Pci_driver() - { - if (!_dev) - return; - - destroy(Genode::env()->heap(), _dev); - } - - /** - * Read/write data from/to config space - */ - template - void config_read(unsigned int devfn, T *val) - { - Platform::Device_client client(_cap); - *val = client.config_read(devfn, _access_size(*val)); - } - - template - void config_write(unsigned int devfn, T val) - { - Platform::Device_client client(_cap); - client.config_write(devfn, val, _access_size(val)); - } -}; - - -/******************************** - ** Backend memory definitions ** - ********************************/ - -struct Memory_object_base : Genode::Object_pool::Entry -{ - Memory_object_base(Genode::Ram_dataspace_capability cap) - : Genode::Object_pool::Entry(cap) {} - virtual ~Memory_object_base() {}; - - virtual void free() = 0; - - Genode::Ram_dataspace_capability ram_cap() - { - using namespace Genode; - return reinterpret_cap_cast(cap()); - } -}; - - -struct Ram_object : Memory_object_base -{ - Ram_object(Genode::Ram_dataspace_capability cap) - : Memory_object_base(cap) {} - - void free(); -}; - - -struct Dma_object : Memory_object_base -{ - Dma_object(Genode::Ram_dataspace_capability cap) - : Memory_object_base(cap) {} - - void free(); -}; - - -/********************* - ** Linux interface ** - *********************/ - -extern "C" { Platform::Device_capability pci_device_cap; } -static Platform::Connection *pci() -{ - static Platform::Connection _pci; - return &_pci; -} -static Genode::Object_pool memory_pool; - - -extern "C" int pci_register_driver(struct pci_driver *drv) -{ - drv->driver.name = drv->name; - - if (!drv->id_table) return -ENODEV; - - using namespace Genode; - - enum { - PCI_CLASS_MASK = 0xfff000, - /** - * This is actually PCI_CLASS_NETWORK_OTHER and may only work - * for the iwlwifi driver. - */ - PCI_CLASS_WIFI = 0x028000, - }; - - bool found = false; - - for (Platform::Device_capability cap = pci()->first_device(PCI_CLASS_WIFI, - PCI_CLASS_MASK); - cap.valid() && !found;) { - Pci_driver *pci_drv = nullptr; - pci_device_cap = cap; - - for (pci_device_id const *id = drv->id_table; id->device && !found; id++) { - - if (id->class_ == (unsigned)PCI_ANY_ID) continue; - - try { - retry( - [&] { - /* probe device */ - pci_drv = new (env()->heap()) Pci_driver(drv, cap, id); - pci()->on_destruction(Platform::Connection::KEEP_OPEN); - found = true; - }, - [&] { - Genode::env()->parent()->upgrade(pci()->cap(), "ram_quota=4096"); - }); - } catch (...) { - destroy(env()->heap(), pci_drv); - pci_drv = nullptr; - } - } - - Platform::Device_capability free_up = cap; - cap = pci()->next_device(cap, PCI_CLASS_WIFI, PCI_CLASS_MASK); - if (!pci_drv) - pci()->release_device(free_up); - } - - if (!found) PERR("no usable wireless device found"); - - return found ? 0 : -ENODEV; -} - - -extern "C" size_t pci_resource_start(struct pci_dev *dev, unsigned bar) -{ - if (bar >= DEVICE_COUNT_RESOURCE) - return 0; - - return dev->resource[bar].start; -} - - -extern "C" size_t pci_resource_len(struct pci_dev *dev, unsigned bar) -{ - size_t start = pci_resource_start(dev, bar); - - if (!start) - return 0; - - return (dev->resource[bar].end - start) + 1; -} - - -extern "C" void *pci_ioremap_bar(struct pci_dev *dev, int bar) -{ - using namespace Genode; - - if (bar >= DEVICE_COUNT_RESOURCE || bar < 0) - return 0; - - size_t start = pci_resource_start(dev, bar); - size_t size = pci_resource_len(dev, bar); - - if (!start) - return 0; - - Io_mem_session_client *io_mem; - try { - Platform::Device_client device(pci_device_cap); - io_mem = new (env()->heap()) Io_mem_session_client(device.io_mem(device.phys_bar_to_virt(bar))); - } catch (...) { - PERR("Failed to request I/O memory: [%zx,%zx)", start, start + size); - return 0; - } - - if (!io_mem->dataspace().valid()) { - PERR("I/O memory not accessible"); - return 0; - } - - addr_t map_addr = env()->rm_session()->attach(io_mem->dataspace()); - map_addr |= start & 0xfff; - - return (void*)map_addr; -} - - -extern "C" unsigned int pci_resource_flags(struct pci_dev *dev, unsigned bar) -{ - if (bar >= DEVICE_COUNT_RESOURCE) - return 0; - - return dev->resource[bar].flags; -} - - -extern "C" int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int, int where, u8 *val) -{ - Pci_driver *drv = (Pci_driver *)bus; - drv->config_read(where, val); - return 0; -} - - -extern "C" int pci_bus_read_config_word(struct pci_bus *bus, unsigned int, int where, u16 *val) -{ - Pci_driver *drv = (Pci_driver *)bus; - drv->config_read(where, val); - return 0; -} - - -extern "C" int pci_bus_write_config_word(struct pci_bus *bus, unsigned int, int where, u16 val) -{ - Pci_driver *drv = (Pci_driver *)bus; - drv->config_write(where, val); - return 0; -} - - -extern "C" int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int, int where, u8 val) -{ - Pci_driver *drv = (Pci_driver *)bus; - drv->config_write(where, val); - return 0; -} - - -extern "C" const char *pci_name(const struct pci_dev *pdev) -{ - /* simply return driver name */ - return "dummy"; -} - - -extern "C" int pcie_capability_read_word(struct pci_dev *pdev, int pos, u16 *val) -{ - Pci_driver *drv = (Pci_driver *)pdev->bus; - switch (pos) { - case PCI_EXP_LNKCTL: - drv->config_read(pdev->pcie_cap + PCI_EXP_LNKCTL, val); - return 0; - break; - default: - break; - } - - return 1; -} - - -void Ram_object::free() { Genode::env()->ram_session()->free(ram_cap()); } - - -void Dma_object::free() { pci()->free_dma_buffer(ram_cap()); } - - -Genode::Ram_dataspace_capability -Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) -{ - using namespace Genode; - - Memory_object_base *o; - Genode::Ram_dataspace_capability cap; - if (cached == CACHED) { - cap = env()->ram_session()->alloc(size); - o = new (env()->heap()) Ram_object(cap); - } else { - size_t donate = size; - cap = Genode::retry( - [&] () { return pci()->alloc_dma_buffer(size); }, - [&] () { - char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", - donate); - Genode::env()->parent()->upgrade(pci()->cap(), quota); - donate = donate * 2 > size ? 4096 : donate * 2; - }); - o = new (env()->heap()) Dma_object(cap); - } - - memory_pool.insert(o); - return cap; -} - - -void Lx::backend_free(Genode::Ram_dataspace_capability cap) -{ - using namespace Genode; - - Memory_object_base *object; - auto lambda = [&] (Memory_object_base *o) { - object = o; - if (object) { - object->free(); - memory_pool.remove(object); - } - }; - memory_pool.apply(cap, lambda); - if (object) destroy(env()->heap(), object); -} diff --git a/repos/dde_linux/src/lib/wifi/scheduler.cc b/repos/dde_linux/src/lib/wifi/scheduler.cc deleted file mode 100644 index bdda10e6f3..0000000000 --- a/repos/dde_linux/src/lib/wifi/scheduler.cc +++ /dev/null @@ -1,262 +0,0 @@ -/* - * \brief User-level scheduling - * \author Sebastian Sumpf - * \author Josef Soentgen - * \author Christian Helmuth - * \date 2012-04-25 - * - * We use a pseudo-thread implementation based on setjmp/longjmp. - */ - -/* - * Copyright (C) 2012-2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include - -/* local includes */ -#include -#include -#include - - -#define PDBGV(...) \ - do { if (DEBUG_SCHEDULING) PDBG(__VA_ARGS__); } while (0) - - -/********** - ** Task ** - **********/ - -bool Lx::Task::_runnable() const -{ - switch (_state) { - case STATE_INIT: return true; - case STATE_RUNNING: return true; - case STATE_BLOCKED: return false; - case STATE_MUTEX_BLOCKED: return false; - case STATE_WAIT_BLOCKED: return false; - } - - PERR("state %d not handled by switch", _state); - Genode::sleep_forever(); -} - - -bool Lx::Task::run() -{ - if (!_runnable()) - return false; - - /* - * Save the execution environment. The scheduled task returns to this point - * after execution, i.e., at the next preemption point. - */ - if (_setjmp(_saved_env)) - return true; - - if (_state == STATE_INIT) { - /* setup execution environment and call task's function */ - _state = STATE_RUNNING; - Genode::Thread *th = Genode::Thread::myself(); - - enum { STACK_SIZE = 32 * 1024 }; /* FIXME make stack size configurable */ - _stack = th->alloc_secondary_stack(_name, STACK_SIZE); - - /* switch stack and call '_func(_arg)' */ - platform_execute(_stack, (void *)_func, _arg); - } else { - /* restore execution environment */ - _longjmp(_env, 1); - } - - /* never reached */ - PERR("Unexpected return of Task"); - Genode::sleep_forever(); -} - - -void Lx::Task::schedule() -{ - /* - * Save the execution environment. The task will resume from here on next - * schedule. - */ - if (_setjmp(_env)) { - return; - } - - /* return to thread calling run() */ - _longjmp(_saved_env, 1); -} - - -Lx::Task::Task(void (*func)(void*), void *arg, char const *name, - Priority priority, Scheduler &scheduler) -: - _priority(priority), _scheduler(scheduler), - _func(func), _arg(arg), _name(name) -{ - scheduler.add(this); - - PDBGV("name: '%s' func: %p arg: %p prio: %u t: %p", name, func, arg, priority, this); -} - - -Lx::Task::~Task() -{ -// scheduler.remove(this); - if (_stack) - Genode::Thread::myself()->free_secondary_stack(_stack); -} - - -/*************** - ** Scheduler ** - ***************/ - -Lx::Scheduler & Lx::scheduler() -{ - static Lx::Scheduler inst; - return inst; -} - - -Lx::Task *Lx::Scheduler::current() -{ - if (!_current) { - PERR("BUG: _current is zero!"); - Genode::sleep_forever(); - } - - return _current; -} - - -void Lx::Scheduler::add(Task *task) -{ - Lx::Task *p = _present_list.first(); - for ( ; p; p = p->next()) { - if (p->priority() <= task->priority()) { - _present_list.insert_before(task, p); - break; - } - } - if (!p) - _present_list.append(task); -} - - -void Lx::Scheduler::schedule() -{ - bool at_least_one = false; - - /* - * Iterate over all tasks and run first runnable. - * - * (1) If one runnable tasks was run start over from beginning of - * list. - * - * (2) If no task is runnable quit scheduling (break endless - * loop). - */ - while (true) { - /* update jiffies before running task */ - Lx::timer_update_jiffies(); - - bool was_run = false; - for (Task *t = _present_list.first(); t; t = t->next()) { - /* update current before running task */ - _current = t; - - if ((was_run = t->run())) { - at_least_one = true; - break; - } - } - if (!was_run) - break; - } - - if (!at_least_one) { - PWRN("schedule() called without runnable tasks"); - log_state("SCHEDULE"); - } - - /* clear current as no task is running */ - _current = nullptr; -} - - -#include - -namespace { - struct Logger : Genode::Thread_deprecated<0x4000> - { - Timer::Connection _timer; - Lx::Scheduler &_scheduler; - unsigned const _interval; - - Logger(Lx::Scheduler &scheduler, unsigned interval_seconds) - : - Genode::Thread_deprecated<0x4000>("logger"), - _scheduler(scheduler), _interval(interval_seconds) - { - start(); - } - - void entry() - { - PWRN("Scheduler::Logger is up"); - _timer.msleep(1000 * _interval); - while (true) { - _scheduler.log_state("LOGGER"); - _timer.msleep(2000); - } - } - }; -} - -#define ANSI_ESC_RESET "\033[00m" -#define ANSI_ESC_BLACK "\033[30m" -#define ANSI_ESC_RED "\033[31m" -#define ANSI_ESC_YELLOW "\033[33m" - -static char const *state_color(Lx::Task::State state) -{ - switch (state) { - case Lx::Task::STATE_INIT: return ANSI_ESC_RESET; - case Lx::Task::STATE_RUNNING: return ANSI_ESC_RED; - case Lx::Task::STATE_BLOCKED: return ANSI_ESC_YELLOW; - case Lx::Task::STATE_MUTEX_BLOCKED: return ANSI_ESC_YELLOW; - case Lx::Task::STATE_WAIT_BLOCKED: return ANSI_ESC_YELLOW; - } - - return ANSI_ESC_BLACK; -} - - -void Lx::Scheduler::log_state(char const *prefix) -{ - unsigned i; - Lx::Task *t; - for (i = 0, t = _present_list.first(); t; t = t->next(), ++i) { - Genode::printf("%s [%u] prio: %u state: %s%u" ANSI_ESC_RESET " %s\n", - prefix, i, t->priority(), state_color(t->state()), - t->state(), t->name()); - } -} - - -Lx::Scheduler::Scheduler() -{ - if (DEBUG_SCHEDULING) - new (Genode::env()->heap()) Logger(*this, 10); -} - - -Lx::Scheduler::~Scheduler() { } diff --git a/repos/dde_linux/src/lib/wifi/socket.c b/repos/dde_linux/src/lib/wifi/socket.c deleted file mode 100644 index a3606d0697..0000000000 --- a/repos/dde_linux/src/lib/wifi/socket.c +++ /dev/null @@ -1,110 +0,0 @@ -/** - * \brief Linux emulation code - * \author Sebastian Sumpf - * \date 2014-03-07 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#include -#include - - -/**************** - ** net/sock.h ** - ****************/ - -static const struct net_proto_family *net_families[NPROTO]; - -int sock_register(const struct net_proto_family *ops) -{ - if (ops->family >= NPROTO) { - printk("protocol %d >= NPROTO (%d)\n", ops->family, NPROTO); - return -ENOBUFS; - } - - net_families[ops->family] = ops; - pr_info("NET: Registered protocol family %d\n", ops->family); - return 0; -} - - - -struct socket *sock_alloc(void) -{ - return (struct socket *)kmalloc(sizeof(struct socket), 0); -} - - -int sock_create_lite(int family, int type, int protocol, struct socket **res) - -{ - struct socket *sock = sock_alloc(); - - if (!sock) - return -ENOMEM; - - sock->type = type; - *res = sock; - return 0; -} - - -int sock_create_kern(int family, int type, int proto, - struct socket **res) -{ - struct socket *sock; - const struct net_proto_family *pf; - int err; - - if (family < 0 || family > NPROTO) - return -EAFNOSUPPORT; - - if (type < 0 || type > SOCK_MAX) - return -EINVAL; - - pf = net_families[family]; - - if (!pf) { - printk("No protocol found for family %d\n", family); - return -ENOPROTOOPT; - } - - if (!(sock = (struct socket *)kzalloc(sizeof(struct socket), 0))) { - printk("Could not allocate socket\n"); - return -ENFILE; - } - - sock->type = type; - - err = pf->create(&init_net, sock, proto, 1); - if (err) { - kfree(sock); - return err; - } - - *res = sock; - - return 0; -} - - -void log_sock(struct socket *socket) -{ - printk("\nNEW socket %p sk %p fsk %lx &sk %p &fsk %p\n\n", - socket, socket->sk, socket->flags, &socket->sk, &socket->flags); -} - - -static void sock_init(void) -{ - skb_init(); -} - - -core_initcall(sock_init); diff --git a/repos/dde_linux/src/lib/wifi/socket_call.cc b/repos/dde_linux/src/lib/wifi/socket_call.cc index 2624b9cffe..9cb65c110c 100644 --- a/repos/dde_linux/src/lib/wifi/socket_call.cc +++ b/repos/dde_linux/src/lib/wifi/socket_call.cc @@ -5,24 +5,25 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ /* Genode includes */ +#include #include /* local includes */ #include +#include -#include -# include +#include # include # include # include -#include +#include #include @@ -142,7 +143,7 @@ class Lx::Socket void _do_socket() { struct socket *s; - int res = sock_create_kern(_call.socket.domain, _call.socket.type, + int res = sock_create_kern(nullptr, _call.socket.domain, _call.socket.type, _call.socket.protocol, &s); if (!res) { _call.socket.result = s; @@ -186,22 +187,14 @@ class Lx::Socket struct socket *sock = _call_socket(); struct msghdr *msg = &_call.recvmsg.msg; - /* needed by AF_NETLINK */ - struct sock_iocb siocb; - Genode::memset(&siocb, 0, sizeof(struct sock_iocb)); - struct kiocb kiocb; - Genode::memset(&kiocb, 0, sizeof(struct kiocb)); - - kiocb.private_ = &siocb; - if (_call.handle->non_block) msg->msg_flags |= MSG_DONTWAIT; size_t iovlen = 0; - for (size_t i = 0; i < msg->msg_iovlen; i++) - iovlen += msg->msg_iov[i].iov_len; + for (size_t i = 0; i < msg->msg_iter.nr_segs; i++) + iovlen += msg->msg_iter.iov[i].iov_len; - _call.err = sock->ops->recvmsg(&kiocb, sock, msg, iovlen, _call.recvmsg.flags); + _call.err = sock->ops->recvmsg(sock, msg, iovlen, _call.recvmsg.flags); } void _do_sendmsg() @@ -209,22 +202,14 @@ class Lx::Socket struct socket *sock = _call_socket(); struct msghdr *msg = const_cast(&_call.sendmsg.msg); - /* needed by AF_NETLINK */ - struct sock_iocb siocb; - Genode::memset(&siocb, 0, sizeof(struct sock_iocb)); - struct kiocb kiocb; - Genode::memset(&kiocb, 0, sizeof(struct kiocb)); - - kiocb.private_ = &siocb; - if (_call.handle->non_block) msg->msg_flags |= MSG_DONTWAIT; size_t iovlen = 0; - for (size_t i = 0; i < msg->msg_iovlen; i++) - iovlen += msg->msg_iov[i].iov_len; + for (size_t i = 0; i < msg->msg_iter.nr_segs; i++) + iovlen += msg->msg_iter.iov[i].iov_len; - _call.err = sock->ops->sendmsg(&kiocb, sock, msg, iovlen); + _call.err = sock->ops->sendmsg(sock, msg, iovlen); } void _do_setsockopt() @@ -513,15 +498,16 @@ static int msg_flags(Wifi::Flags in) Wifi::ssize_t Socket_call::recvmsg(Socket *s, Wifi::Msghdr *msg, Wifi::Flags flags) { - _call.opcode = Call::RECVMSG; - _call.handle = s; - _call.recvmsg.msg.msg_name = msg->msg_name; - _call.recvmsg.msg.msg_namelen = msg->msg_namelen; - _call.recvmsg.msg.msg_iov = _call.recvmsg.iov; - _call.recvmsg.msg.msg_iovlen = msg->msg_iovlen; - _call.recvmsg.msg.msg_control = msg->msg_control; - _call.recvmsg.msg.msg_controllen = msg->msg_controllen; - _call.recvmsg.flags = msg_flags(flags); + _call.opcode = Call::RECVMSG; + _call.handle = s; + _call.recvmsg.msg.msg_name = msg->msg_name; + _call.recvmsg.msg.msg_namelen = msg->msg_namelen; + _call.recvmsg.msg.msg_iter.iov = _call.recvmsg.iov; + _call.recvmsg.msg.msg_iter.nr_segs = msg->msg_iovlen; + _call.recvmsg.msg.msg_iter.count = msg->msg_count; + _call.recvmsg.msg.msg_control = msg->msg_control; + _call.recvmsg.msg.msg_controllen = msg->msg_controllen; + _call.recvmsg.flags = msg_flags(flags); for (unsigned i = 0; i < msg->msg_iovlen; ++i) { _call.recvmsg.iov[i].iov_base = msg->msg_iov[i].iov_base; @@ -538,15 +524,16 @@ Wifi::ssize_t Socket_call::recvmsg(Socket *s, Wifi::Msghdr *msg, Wifi::Flags fla Wifi::ssize_t Socket_call::sendmsg(Socket *s, Wifi::Msghdr const *msg, Wifi::Flags flags) { - _call.opcode = Call::SENDMSG; - _call.handle = s; - _call.sendmsg.msg.msg_name = msg->msg_name; - _call.sendmsg.msg.msg_namelen = msg->msg_namelen; - _call.sendmsg.msg.msg_iov = _call.sendmsg.iov; - _call.sendmsg.msg.msg_iovlen = msg->msg_iovlen; - _call.sendmsg.msg.msg_control = 0; - _call.sendmsg.msg.msg_controllen = 0; - _call.sendmsg.flags = msg_flags(flags); + _call.opcode = Call::SENDMSG; + _call.handle = s; + _call.sendmsg.msg.msg_name = msg->msg_name; + _call.sendmsg.msg.msg_namelen = msg->msg_namelen; + _call.sendmsg.msg.msg_iter.iov = _call.sendmsg.iov; + _call.sendmsg.msg.msg_iter.nr_segs = msg->msg_iovlen; + _call.sendmsg.msg.msg_iter.count = msg->msg_count; + _call.sendmsg.msg.msg_control = 0; + _call.sendmsg.msg.msg_controllen = 0; + _call.sendmsg.flags = msg_flags(flags); for (unsigned i = 0; i < msg->msg_iovlen; ++i) { _call.sendmsg.iov[i].iov_base = msg->msg_iov[i].iov_base; diff --git a/repos/dde_linux/src/lib/wifi/timer.cc b/repos/dde_linux/src/lib/wifi/timer.cc deleted file mode 100644 index f6a39814ef..0000000000 --- a/repos/dde_linux/src/lib/wifi/timer.cc +++ /dev/null @@ -1,357 +0,0 @@ -/* - * \brief Signal context for timer events - * \author Josef Soentgen - * \date 2014-10-10 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include - -/* local includes */ -#include -#include - -#include -# include -#include - - -unsigned long jiffies; - - -static void run_timer(void*); - -namespace Lx { - class Timer; -} - -/** - * Lx::Timer - */ -class Lx::Timer -{ - public: - - /** - * Context encapsulates a regular linux timer_list - */ - struct Context : public Lx::List::Element - { - enum { INVALID_TIMEOUT = ~0UL }; - - struct timer_list *timer; - bool pending { false }; - unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */ - bool programmed { false }; - - Context(struct timer_list *timer) : timer(timer) { } - }; - - private: - - ::Timer::Connection _timer_conn; - Lx::List _list; - Lx::Task _timer_task; - Genode::Signal_rpc_member _dispatcher; - Genode::Tslab _timer_alloc; - - /** - * Lookup local timer - */ - Context *_find_context(struct timer_list const *timer) - { - for (Context *c = _list.first(); c; c = c->next()) - if (c->timer == timer) - return c; - - return 0; - } - - /** - * Program the first timer in the list - * - * The first timer is programmed if the 'programmed' flag was not set - * before. The second timer is flagged as not programmed as - * 'Timer::trigger_once' invalidates former registered one-shot - * timeouts. - */ - void _program_first_timer() - { - Context *ctx = _list.first(); - if (!ctx) - return; - - if (ctx->programmed) - return; - - /* calculate relative microseconds for trigger */ - unsigned long us = ctx->timeout > jiffies ? - jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; - _timer_conn.trigger_once(us); - - ctx->programmed = true; - - /* possibly programmed successor must be reprogrammed later */ - if (Context *next = ctx->next()) - next->programmed = false; - } - - /** - * Schedule timer - * - * Add the context to the scheduling list depending on its timeout - * and reprogram the first timer. - */ - void _schedule_timer(Context *ctx, unsigned long expires) - { - _list.remove(ctx); - - ctx->timeout = expires; - ctx->pending = true; - ctx->programmed = false; - /* - * Also write the timeout value to the expires field in - * struct timer_list because the wireless stack checks - * it directly. - */ - ctx->timer->expires = expires; - - Context *c; - for (c = _list.first(); c; c = c->next()) - if (ctx->timeout <= c->timeout) - break; - _list.insert_before(ctx, c); - - _program_first_timer(); - } - - /** - * Handle trigger_once signal - */ - void _handle(unsigned) - { - _timer_task.unblock(); - - Lx::scheduler().schedule(); - } - - public: - - /** - * Constructor - */ - Timer(Server::Entrypoint &ep) - : - _timer_task(run_timer, nullptr, "timer", Lx::Task::PRIORITY_2, - Lx::scheduler()), - _dispatcher(ep, *this, &Lx::Timer::_handle), - _timer_alloc(Genode::env()->heap()) - { - _timer_conn.sigh(_dispatcher); - } - - /** - * Add new linux timer - */ - void add(struct timer_list *timer) - { - Context *t = new (&_timer_alloc) Context(timer); - _list.append(t); - } - - /** - * Delete linux timer - */ - int del(struct timer_list *timer) - { - Context *ctx = _find_context(timer); - - /** - * If the timer expired it was already cleaned up after its - * execution. - */ - if (!ctx) - return 0; - - int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; - - _list.remove(ctx); - destroy(&_timer_alloc, ctx); - - return rv; - } - - /** - * Initial scheduling of linux timer - */ - int schedule(struct timer_list *timer, unsigned long expires) - { - Context *ctx = _find_context(timer); - if (!ctx) { - PERR("schedule unknown timer %p", timer); - return -1; /* XXX better use 0 as rv? */ - } - - /* - * If timer was already active return 1, otherwise 0. The return - * value is needed by mod_timer(). - */ - int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; - - _schedule_timer(ctx, expires); - - return rv; - } - - /** - * Schedule next linux timer - */ - void schedule_next() { _program_first_timer(); } - - /** - * Check if the timer is currently pending - */ - bool pending(struct timer_list const *timer) - { - Context *ctx = _find_context(timer); - if (!ctx) { - return false; - } - - return ctx->pending; - } - - Context *find(struct timer_list const *timer) { - return _find_context(timer); } - - /** - * Update jiffie counter - */ - void update_jiffies() - { - jiffies = msecs_to_jiffies(_timer_conn.elapsed_ms()); - } - - /** - * Get first timer context - */ - Context* first() { return _list.first(); } -}; - - -static Lx::Timer *_lx_timer; - - -void Lx::timer_init(Server::Entrypoint &ep) -{ - /* XXX safer way preventing possible nullptr access? */ - static Lx::Timer lx_timer(ep); - _lx_timer = &lx_timer; - - /* initialize value explicitly */ - jiffies = 0UL; -} - - -void Lx::timer_update_jiffies() { - _lx_timer->update_jiffies(); } - - -static void run_timer(void *) -{ - while (1) { - Lx::scheduler().current()->block_and_schedule(); - - while (Lx::Timer::Context *ctx = _lx_timer->first()) { - if (ctx->timeout > jiffies) - break; - - ctx->timer->function(ctx->timer->data); - _lx_timer->del(ctx->timer); - } - - _lx_timer->schedule_next(); - } -} - - -/******************* - ** linux/timer.h ** - *******************/ - -void init_timer(struct timer_list *timer) { } - - -int mod_timer(struct timer_list *timer, unsigned long expires) -{ - if (!_lx_timer->find(timer)) - _lx_timer->add(timer); - - return _lx_timer->schedule(timer, expires); -} - - -void setup_timer(struct timer_list *timer,void (*function)(unsigned long), - unsigned long data) -{ - timer->function = function; - timer->data = data; - init_timer(timer); -} - - -int timer_pending(const struct timer_list *timer) -{ - bool pending = _lx_timer->pending(timer); - - return pending; -} - - -int del_timer(struct timer_list *timer) -{ - int rv = _lx_timer->del(timer); - _lx_timer->schedule_next(); - - return rv; -} - - -/******************* - ** linux/sched.h ** - *******************/ - -static void unblock_task(unsigned long task) -{ - Lx::Task *t = (Lx::Task *)task; - - t->unblock(); -} - - -signed long schedule_timeout(signed long timeout) -{ - struct timer_list timer; - - setup_timer(&timer, unblock_task, (unsigned long)Lx::scheduler().current()); - mod_timer(&timer, timeout); - - Lx::scheduler().current()->block_and_schedule(); - - del_timer(&timer); - - timeout = (timeout - jiffies); - - return timeout < 0 ? 0 : timeout; -} diff --git a/repos/dde_linux/src/lib/wifi/work.cc b/repos/dde_linux/src/lib/wifi/work.cc deleted file mode 100644 index d8e457a06c..0000000000 --- a/repos/dde_linux/src/lib/wifi/work.cc +++ /dev/null @@ -1,281 +0,0 @@ -/* - * \brief Workqueue implementation - * \author Josef Soentgen - * \date 2014-10-14 - */ - -/* - * Copyright (C) 2014 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include - -/* local includes */ -#include - -#include -# include -#include - - -static void run_work(void *); -static void run_delayed_work(void *); - -namespace Lx { - class Work; -} - -/** - * Lx::Work - */ -class Lx::Work -{ - public: - - /** - * Context encapsulates a normal work item - */ - struct Context : public Lx::List::Element - { - void *work; - enum Type { NORMAL, DELAYED, TASKLET } type; - - void exec() { - switch (type) { - case NORMAL: - { - work_struct *w = static_cast(work); - w->func(w); - } - break; - case DELAYED: - { - delayed_work *w = static_cast(work); - w->work.func(&(w)->work); - } - break; - case TASKLET: - { - tasklet_struct *tasklet = static_cast(work); - tasklet->func(tasklet->data); - } - break; - } - } - - Context(delayed_work *w) : work(w), type(DELAYED) { } - Context(work_struct *w) : work(w), type(NORMAL) { } - Context(tasklet_struct *w) : work(w), type(TASKLET) { } - }; - - private: - - Lx::Task _task; - Lx::List _list; - - Genode::Tslab _work_alloc; - - public: - - Work(void (*func)(void*), char const *name) - : - _task(func, nullptr, name, Lx::Task::PRIORITY_2, Lx::scheduler()), - _work_alloc(Genode::env()->heap()) - { } - - /** - * Unblock corresponding task - */ - void unblock() { _task.unblock(); } - - /** - * Schedule work item - */ - template - void schedule(WORK *work) - { - Context *c = new (&_work_alloc) Context(work); - _list.append(c); - } - - /** - * Execute all available work items - */ - void exec() - { - while (Context *c = _list.first()) { - c->exec(); - _list.remove(c); - destroy(&_work_alloc, c); - } - } - - /** - * Cancel work item - */ - bool cancel_work(struct work_struct *work, bool sync = false) - { - for (Context *c = _list.first(); c; c = c->next()) { - if (c->work == work) { - if (sync) - c->exec(); - - _list.remove(c); - destroy(&_work_alloc, c); - return true; - } - } - - return false; - } -}; - - -static Lx::Work *_lx_work; -static Lx::Work *_lx_delayed_work; - - -void Lx::work_init(Server::Entrypoint &ep) -{ - static Lx::Work work_ctx(run_work, "work"); - _lx_work = &work_ctx; - - static Lx::Work delayed_work_ctx(run_delayed_work, "delayed_work"); - _lx_delayed_work = &delayed_work_ctx; -} - - -static void run_work(void *) -{ - while (1) { - Lx::scheduler().current()->block_and_schedule(); - - _lx_work->exec(); - } -} - - -static void run_delayed_work(void *) -{ - while (1) { - Lx::scheduler().current()->block_and_schedule(); - - _lx_delayed_work->exec(); - } -} - - -extern "C" { - -/*********************** - ** linux/workquque.h ** - ***********************/ - -int schedule_delayed_work(struct delayed_work *work, unsigned long delay) -{ - _lx_delayed_work->schedule(work); - _lx_delayed_work->unblock(); - - return 0; -} - - -int schedule_work(struct work_struct *work) -{ - _lx_work->schedule(work); - _lx_work->unblock(); - - return 1; -} - - -bool cancel_delayed_work(struct delayed_work *dwork) -{ - int pending = timer_pending(&dwork->timer); - del_timer(&dwork->timer); - - /* if the timer is still pending dwork was not executed */ - return pending; -} - - -bool cancel_delayed_work_sync(struct delayed_work *dwork) -{ - bool pending = cancel_delayed_work(dwork); - - if (pending) { - PERR("WARN: delayed_work %p is executed directly in current '%s' routine", - dwork, Lx::scheduler().current()->name()); - - dwork->work.func(&dwork->work); - } - - return pending; -} - - -static void execute_delayed_work(unsigned long dwork) -{ - _lx_delayed_work->schedule((struct delayed_work *)dwork); - _lx_delayed_work->unblock(); -} - - -bool queue_delayed_work(struct workqueue_struct *wq, - struct delayed_work *dwork, unsigned long delay) -{ - /* treat delayed work without delay like any other work */ - if (delay == 0) { - execute_delayed_work((unsigned long)dwork); - } else { - setup_timer(&dwork->timer, execute_delayed_work, (unsigned long)dwork); - mod_timer(&dwork->timer, delay); - } - return true; -} - - -bool cancel_work_sync(struct work_struct *work) -{ - return _lx_work->cancel_work(work, true); -} - - -bool queue_work(struct workqueue_struct *wq, struct work_struct *work) -{ - _lx_work->schedule(work); - _lx_work->unblock(); - - return true; -} - - -/*********************** - ** linux/interrupt.h ** - ***********************/ - -void tasklet_init(struct tasklet_struct *t, void (*f)(unsigned long), unsigned long d) -{ - t->func = f; - t->data = d; -} - - -void tasklet_schedule(struct tasklet_struct *tasklet) -{ - _lx_work->schedule(tasklet); -} - - -void tasklet_hi_schedule(struct tasklet_struct *tasklet) -{ - tasklet_schedule(tasklet); -} - -} /* extern "C" */ diff --git a/repos/dde_linux/src/lib/wpa_supplicant/main.c b/repos/dde_linux/src/lib/wpa_supplicant/main.c index c776a59357..1186f44437 100644 --- a/repos/dde_linux/src/lib/wpa_supplicant/main.c +++ b/repos/dde_linux/src/lib/wpa_supplicant/main.c @@ -32,9 +32,11 @@ #include "common.h" #include "wpa_supplicant_i.h" + static char const *conf_file = "/config/wpa_supplicant.conf"; -int wpa_main(void) + +int wpa_main(int debug_msg) { struct wpa_interface iface; int exitcode = 0; @@ -43,8 +45,7 @@ int wpa_main(void) memset(¶ms, 0, sizeof(params)); - params.wpa_debug_level = MSG_INFO; - // params.wpa_debug_level = MSG_DEBUG; + params.wpa_debug_level = debug_msg ? MSG_DEBUG : MSG_INFO; global = wpa_supplicant_init(¶ms); if (global == NULL) diff --git a/repos/dde_linux/wifi.list b/repos/dde_linux/wifi.list index 609b61b969..e6ee6ef212 100644 --- a/repos/dde_linux/wifi.list +++ b/repos/dde_linux/wifi.list @@ -1,330 +1,343 @@ -linux-3.14.5/crypto/ablkcipher.c -linux-3.14.5/crypto/aead.c -linux-3.14.5/crypto/aes_generic.c -linux-3.14.5/crypto/algapi.c -linux-3.14.5/crypto/algboss.c -linux-3.14.5/crypto/api.c -linux-3.14.5/crypto/arc4.c -linux-3.14.5/crypto/blkcipher.c -linux-3.14.5/crypto/ccm.c -linux-3.14.5/crypto/chainiv.c -linux-3.14.5/crypto/cipher.c -linux-3.14.5/crypto/compress.c -linux-3.14.5/crypto/crypto_wq.c -linux-3.14.5/crypto/ctr.c -linux-3.14.5/crypto/internal.h -linux-3.14.5/crypto/krng.c -linux-3.14.5/crypto/memneq.c -linux-3.14.5/crypto/rng.c -linux-3.14.5/crypto/scatterwalk.c -linux-3.14.5/drivers/leds/led-class.c -linux-3.14.5/drivers/leds/led-core.c -linux-3.14.5/drivers/leds/led-triggers.c -linux-3.14.5/drivers/leds/leds.h -linux-3.14.5/drivers/net/wireless/iwlegacy/3945-mac.c -linux-3.14.5/drivers/net/wireless/iwlegacy/3945-rs.c -linux-3.14.5/drivers/net/wireless/iwlegacy/3945.c -linux-3.14.5/drivers/net/wireless/iwlegacy/3945.h -linux-3.14.5/drivers/net/wireless/iwlegacy/4965-calib.c -linux-3.14.5/drivers/net/wireless/iwlegacy/4965-mac.c -linux-3.14.5/drivers/net/wireless/iwlegacy/4965-rs.c -linux-3.14.5/drivers/net/wireless/iwlegacy/4965.c -linux-3.14.5/drivers/net/wireless/iwlegacy/4965.h -linux-3.14.5/drivers/net/wireless/iwlegacy/commands.h -linux-3.14.5/drivers/net/wireless/iwlegacy/common.c -linux-3.14.5/drivers/net/wireless/iwlegacy/common.h -linux-3.14.5/drivers/net/wireless/iwlegacy/csr.h -linux-3.14.5/drivers/net/wireless/iwlegacy/iwl-spectrum.h -linux-3.14.5/drivers/net/wireless/iwlegacy/prph.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/agn.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/calib.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/calib.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/commands.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/dev.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/devices.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/led.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/led.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/lib.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/mac80211.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/main.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/power.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/power.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rs.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rs.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rx.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/rxon.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/scan.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/sta.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tt.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tt.h -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/tx.c -linux-3.14.5/drivers/net/wireless/iwlwifi/dvm/ucode.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-1000.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-2000.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-5000.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-6000.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-7000.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-agn-hw.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-config.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-csr.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-debug.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-debug.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-devtrace.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-drv.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-drv.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fh.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fw-file.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-fw.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-io.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-io.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-modparams.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-notif-wait.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-notif-wait.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-op-mode.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-phy-db.c -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-phy-db.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-prph.h -linux-3.14.5/drivers/net/wireless/iwlwifi/iwl-trans.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/binding.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/bt-coex.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/constants.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/d3.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw-api.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/fw.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/led.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mac80211.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/mvm.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/nvm.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/ops.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/power.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/power_legacy.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/quota.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rs.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rs.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/rx.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/scan.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/sta.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/sta.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/testmode.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/time-event.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/time-event.h -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/tt.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/tx.c -linux-3.14.5/drivers/net/wireless/iwlwifi/mvm/utils.c -linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/drv.c -linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/internal.h -linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/rx.c -linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/trans.c -linux-3.14.5/drivers/net/wireless/iwlwifi/pcie/tx.c -linux-3.14.5/include/asm-generic/atomic64.h -linux-3.14.5/include/asm-generic/bitops/__ffs.h -linux-3.14.5/include/asm-generic/bitops/__fls.h -linux-3.14.5/include/asm-generic/bitops/ffs.h -linux-3.14.5/include/asm-generic/bitops/fls.h -linux-3.14.5/include/asm-generic/bitops/fls64.h -linux-3.14.5/include/asm-generic/bitops/non-atomic.h -linux-3.14.5/include/asm-generic/pci-dma-compat.h -linux-3.14.5/include/crypto/aead.h -linux-3.14.5/include/crypto/aes.h -linux-3.14.5/include/crypto/algapi.h -linux-3.14.5/include/crypto/crypto_wq.h -linux-3.14.5/include/crypto/ctr.h -linux-3.14.5/include/crypto/internal/aead.h -linux-3.14.5/include/crypto/internal/rng.h -linux-3.14.5/include/crypto/internal/skcipher.h -linux-3.14.5/include/crypto/rng.h -linux-3.14.5/include/crypto/scatterwalk.h -linux-3.14.5/include/crypto/skcipher.h -linux-3.14.5/include/linux/crypto.h -linux-3.14.5/include/linux/cryptouser.h -linux-3.14.5/include/linux/ctype.h -linux-3.14.5/include/linux/errqueue.h -linux-3.14.5/include/linux/genetlink.h -linux-3.14.5/include/linux/hashtable.h -linux-3.14.5/include/linux/ieee80211.h -linux-3.14.5/include/linux/if_ether.h -linux-3.14.5/include/linux/if_link.h -linux-3.14.5/include/linux/input.h -linux-3.14.5/include/linux/jhash.h -linux-3.14.5/include/linux/leds.h -linux-3.14.5/include/linux/list.h -linux-3.14.5/include/linux/list_nulls.h -linux-3.14.5/include/linux/lockdep.h -linux-3.14.5/include/linux/log2.h -linux-3.14.5/include/linux/mod_devicetable.h -linux-3.14.5/include/linux/net.h -linux-3.14.5/include/linux/netdev_features.h -linux-3.14.5/include/linux/netlink.h -linux-3.14.5/include/linux/pci_ids.h -linux-3.14.5/include/linux/rbtree.h -linux-3.14.5/include/linux/rbtree_augmented.h -linux-3.14.5/include/linux/rfkill-gpio.h -linux-3.14.5/include/linux/rfkill-regulator.h -linux-3.14.5/include/linux/rfkill.h -linux-3.14.5/include/linux/rtnetlink.h -linux-3.14.5/include/linux/skbuff.h -linux-3.14.5/include/linux/socket.h -linux-3.14.5/include/linux/swab.h -linux-3.14.5/include/net/cfg80211.h -linux-3.14.5/include/net/dsfield.h -linux-3.14.5/include/net/dst.h -linux-3.14.5/include/net/dst_ops.h -linux-3.14.5/include/net/genetlink.h -linux-3.14.5/include/net/ieee80211_radiotap.h -linux-3.14.5/include/net/inet_frag.h -linux-3.14.5/include/net/mac80211.h -linux-3.14.5/include/net/neighbour.h -linux-3.14.5/include/net/netlink.h -linux-3.14.5/include/net/netns/ipv4.h -linux-3.14.5/include/net/netns/mib.h -linux-3.14.5/include/net/regulatory.h -linux-3.14.5/include/net/request_sock.h -linux-3.14.5/include/net/rtnetlink.h -linux-3.14.5/include/net/snmp.h -linux-3.14.5/include/net/sock.h -linux-3.14.5/include/net/tcp_states.h -linux-3.14.5/include/net/timewait_sock.h -linux-3.14.5/include/trace/events/skb.h -linux-3.14.5/include/trace/events/sock.h -linux-3.14.5/include/uapi/asm-generic/socket.h -linux-3.14.5/include/uapi/linux/byteorder/little_endian.h -linux-3.14.5/include/uapi/linux/errqueue.h -linux-3.14.5/include/uapi/linux/genetlink.h -linux-3.14.5/include/uapi/linux/if_bridge.h -linux-3.14.5/include/uapi/linux/if_ether.h -linux-3.14.5/include/uapi/linux/if_link.h -linux-3.14.5/include/uapi/linux/if_packet.h -linux-3.14.5/include/uapi/linux/input.h -linux-3.14.5/include/uapi/linux/neighbour.h -linux-3.14.5/include/uapi/linux/net.h -linux-3.14.5/include/uapi/linux/netlink.h -linux-3.14.5/include/uapi/linux/nl80211.h -linux-3.14.5/include/uapi/linux/pci_regs.h -linux-3.14.5/include/uapi/linux/rfkill.h -linux-3.14.5/include/uapi/linux/rtnetlink.h -linux-3.14.5/include/uapi/linux/snmp.h -linux-3.14.5/include/uapi/linux/socket.h -linux-3.14.5/include/uapi/linux/sockios.h -linux-3.14.5/include/uapi/linux/swab.h -linux-3.14.5/lib/average.c -linux-3.14.5/lib/crc32.c -linux-3.14.5/lib/crc32defs.h -linux-3.14.5/lib/ctype.c -linux-3.14.5/lib/nlattr.c -linux-3.14.5/lib/rbtree.c -linux-3.14.5/net/core/datagram.c -linux-3.14.5/net/core/rtnetlink.c -linux-3.14.5/net/core/skbuff.c -linux-3.14.5/net/core/sock.c -linux-3.14.5/net/ethernet/eth.c -linux-3.14.5/net/mac80211/aes_ccm.c -linux-3.14.5/net/mac80211/aes_ccm.h -linux-3.14.5/net/mac80211/aes_cmac.c -linux-3.14.5/net/mac80211/aes_cmac.h -linux-3.14.5/net/mac80211/agg-rx.c -linux-3.14.5/net/mac80211/agg-tx.c -linux-3.14.5/net/mac80211/cfg.c -linux-3.14.5/net/mac80211/cfg.h -linux-3.14.5/net/mac80211/chan.c -linux-3.14.5/net/mac80211/debug.h -linux-3.14.5/net/mac80211/debugfs.h -linux-3.14.5/net/mac80211/debugfs_key.h -linux-3.14.5/net/mac80211/debugfs_netdev.h -linux-3.14.5/net/mac80211/debugfs_sta.h -linux-3.14.5/net/mac80211/driver-ops.h -linux-3.14.5/net/mac80211/event.c -linux-3.14.5/net/mac80211/ht.c -linux-3.14.5/net/mac80211/ibss.c -linux-3.14.5/net/mac80211/ieee80211_i.h -linux-3.14.5/net/mac80211/iface.c -linux-3.14.5/net/mac80211/key.c -linux-3.14.5/net/mac80211/key.h -linux-3.14.5/net/mac80211/led.c -linux-3.14.5/net/mac80211/led.h -linux-3.14.5/net/mac80211/main.c -linux-3.14.5/net/mac80211/mesh.c -linux-3.14.5/net/mac80211/mesh.h -linux-3.14.5/net/mac80211/mesh_hwmp.c -linux-3.14.5/net/mac80211/mesh_pathtbl.c -linux-3.14.5/net/mac80211/mesh_plink.c -linux-3.14.5/net/mac80211/mesh_ps.c -linux-3.14.5/net/mac80211/mesh_sync.c -linux-3.14.5/net/mac80211/michael.c -linux-3.14.5/net/mac80211/michael.h -linux-3.14.5/net/mac80211/mlme.c -linux-3.14.5/net/mac80211/offchannel.c -linux-3.14.5/net/mac80211/pm.c -linux-3.14.5/net/mac80211/rate.c -linux-3.14.5/net/mac80211/rate.h -linux-3.14.5/net/mac80211/rc80211_pid.h -linux-3.14.5/net/mac80211/rc80211_pid_algo.c -linux-3.14.5/net/mac80211/rx.c -linux-3.14.5/net/mac80211/scan.c -linux-3.14.5/net/mac80211/spectmgmt.c -linux-3.14.5/net/mac80211/sta_info.c -linux-3.14.5/net/mac80211/sta_info.h -linux-3.14.5/net/mac80211/status.c -linux-3.14.5/net/mac80211/tkip.c -linux-3.14.5/net/mac80211/tkip.h -linux-3.14.5/net/mac80211/trace.c -linux-3.14.5/net/mac80211/trace.h -linux-3.14.5/net/mac80211/tx.c -linux-3.14.5/net/mac80211/util.c -linux-3.14.5/net/mac80211/vht.c -linux-3.14.5/net/mac80211/wep.c -linux-3.14.5/net/mac80211/wep.h -linux-3.14.5/net/mac80211/wme.c -linux-3.14.5/net/mac80211/wme.h -linux-3.14.5/net/mac80211/wpa.c -linux-3.14.5/net/mac80211/wpa.h -linux-3.14.5/net/netlink/af_netlink.c -linux-3.14.5/net/netlink/af_netlink.h -linux-3.14.5/net/netlink/genetlink.c -linux-3.14.5/net/packet/af_packet.c -linux-3.14.5/net/packet/internal.h -linux-3.14.5/net/rfkill/core.c -linux-3.14.5/net/rfkill/input.c -linux-3.14.5/net/rfkill/rfkill-gpio.c -linux-3.14.5/net/rfkill/rfkill-regulator.c -linux-3.14.5/net/rfkill/rfkill.h -linux-3.14.5/net/wireless/ap.c -linux-3.14.5/net/wireless/chan.c -linux-3.14.5/net/wireless/core.c -linux-3.14.5/net/wireless/core.h -linux-3.14.5/net/wireless/debugfs.h -linux-3.14.5/net/wireless/ethtool.c -linux-3.14.5/net/wireless/ethtool.h -linux-3.14.5/net/wireless/ibss.c -linux-3.14.5/net/wireless/mesh.c -linux-3.14.5/net/wireless/mlme.c -linux-3.14.5/net/wireless/nl80211.c -linux-3.14.5/net/wireless/nl80211.h -linux-3.14.5/net/wireless/radiotap.c -linux-3.14.5/net/wireless/rdev-ops.h -linux-3.14.5/net/wireless/reg.c -linux-3.14.5/net/wireless/reg.h -linux-3.14.5/net/wireless/regdb.h -linux-3.14.5/net/wireless/scan.c -linux-3.14.5/net/wireless/sme.c -linux-3.14.5/net/wireless/sysfs.c -linux-3.14.5/net/wireless/sysfs.h -linux-3.14.5/net/wireless/trace.c -linux-3.14.5/net/wireless/trace.h -linux-3.14.5/net/wireless/util.c -linux-3.14.5/net/wireless/wext-compat.h +linux-4.4.3/crypto/ablkcipher.c +linux-4.4.3/crypto/aead.c +linux-4.4.3/crypto/aes_generic.c +linux-4.4.3/crypto/algapi.c +linux-4.4.3/crypto/algboss.c +linux-4.4.3/crypto/api.c +linux-4.4.3/crypto/arc4.c +linux-4.4.3/crypto/blkcipher.c +linux-4.4.3/crypto/ccm.c +linux-4.4.3/crypto/chainiv.c +linux-4.4.3/crypto/cipher.c +linux-4.4.3/crypto/compress.c +linux-4.4.3/crypto/crypto_wq.c +linux-4.4.3/crypto/ctr.c +linux-4.4.3/crypto/internal.h +linux-4.4.3/crypto/memneq.c +linux-4.4.3/crypto/rng.c +linux-4.4.3/crypto/scatterwalk.c +linux-4.4.3/drivers/leds/led-class.c +linux-4.4.3/drivers/leds/led-core.c +linux-4.4.3/drivers/leds/led-triggers.c +linux-4.4.3/drivers/leds/leds.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/agn.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/calib.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/calib.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/commands.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/dev.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/devices.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/led.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/led.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/lib.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/mac80211.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/main.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/power.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/power.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/rs.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/rs.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/rx.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/rxon.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/scan.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/sta.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/tt.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/tt.h +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/tx.c +linux-4.4.3/drivers/net/wireless/iwlwifi/dvm/ucode.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-1000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-2000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-5000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-6000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-7000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-8000.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-config.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-csr.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-debug.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-debug.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace-io.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace-iwlwifi.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace-msg.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-devtrace-ucode.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-drv.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-drv.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-fh.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-fw-file.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-fw.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-io.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-io.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-modparams.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-notif-wait.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-notif-wait.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-op-mode.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-phy-db.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-phy-db.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-prph.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-scd.h +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-trans.c +linux-4.4.3/drivers/net/wireless/iwlwifi/iwl-trans.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/binding.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/coex.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/constants.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/d3.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-rx.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-stats.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-tof.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw-api.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/fw.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/led.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/mac80211.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/mvm.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/nvm.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/offloading.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/ops.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/power.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/quota.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/rs.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/rs.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/rx.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/scan.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/sf.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/sta.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/sta.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/testmode.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/time-event.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/time-event.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/tdls.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/tof.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/tof.h +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/tt.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/tx.c +linux-4.4.3/drivers/net/wireless/iwlwifi/mvm/utils.c +linux-4.4.3/drivers/net/wireless/iwlwifi/pcie/drv.c +linux-4.4.3/drivers/net/wireless/iwlwifi/pcie/internal.h +linux-4.4.3/drivers/net/wireless/iwlwifi/pcie/rx.c +linux-4.4.3/drivers/net/wireless/iwlwifi/pcie/trans.c +linux-4.4.3/drivers/net/wireless/iwlwifi/pcie/tx.c +linux-4.4.3/include/asm-generic/atomic64.h +linux-4.4.3/include/asm-generic/bitops/__ffs.h +linux-4.4.3/include/asm-generic/bitops/__fls.h +linux-4.4.3/include/asm-generic/bitops/ffs.h +linux-4.4.3/include/asm-generic/bitops/fls.h +linux-4.4.3/include/asm-generic/bitops/fls64.h +linux-4.4.3/include/asm-generic/bitops/non-atomic.h +linux-4.4.3/include/asm-generic/pci-dma-compat.h +linux-4.4.3/include/crypto/aead.h +linux-4.4.3/include/crypto/aes.h +linux-4.4.3/include/crypto/algapi.h +linux-4.4.3/include/crypto/crypto_wq.h +linux-4.4.3/include/crypto/ctr.h +linux-4.4.3/include/crypto/internal/aead.h +linux-4.4.3/include/crypto/internal/geniv.h +linux-4.4.3/include/crypto/internal/rng.h +linux-4.4.3/include/crypto/internal/skcipher.h +linux-4.4.3/include/crypto/null.h +linux-4.4.3/include/crypto/rng.h +linux-4.4.3/include/crypto/scatterwalk.h +linux-4.4.3/include/crypto/skcipher.h +linux-4.4.3/include/linux/average.h +linux-4.4.3/include/linux/crypto.h +linux-4.4.3/include/linux/ctype.h +linux-4.4.3/include/linux/ethtool.h +linux-4.4.3/include/linux/errqueue.h +linux-4.4.3/include/linux/genetlink.h +linux-4.4.3/include/linux/hashtable.h +linux-4.4.3/include/linux/ieee80211.h +linux-4.4.3/include/linux/if_ether.h +linux-4.4.3/include/linux/if_link.h +linux-4.4.3/include/linux/jhash.h +linux-4.4.3/include/linux/leds.h +linux-4.4.3/include/linux/list.h +linux-4.4.3/include/linux/list_nulls.h +linux-4.4.3/include/linux/lockdep.h +linux-4.4.3/include/linux/log2.h +linux-4.4.3/include/linux/mod_devicetable.h +linux-4.4.3/include/linux/net.h +linux-4.4.3/include/linux/netdev_features.h +linux-4.4.3/include/linux/netlink.h +linux-4.4.3/include/linux/pci_ids.h +linux-4.4.3/include/linux/rbtree.h +linux-4.4.3/include/linux/rbtree_augmented.h +linux-4.4.3/include/linux/rhashtable.h +linux-4.4.3/include/linux/rfkill-gpio.h +linux-4.4.3/include/linux/rfkill-regulator.h +linux-4.4.3/include/linux/rfkill.h +linux-4.4.3/include/linux/rtnetlink.h +linux-4.4.3/include/linux/skbuff.h +linux-4.4.3/include/linux/socket.h +linux-4.4.3/include/linux/swab.h +linux-4.4.3/include/net/cfg80211.h +linux-4.4.3/include/net/dsfield.h +linux-4.4.3/include/net/dst.h +linux-4.4.3/include/net/dst_ops.h +linux-4.4.3/include/net/genetlink.h +linux-4.4.3/include/net/ieee80211_radiotap.h +linux-4.4.3/include/net/inet_frag.h +linux-4.4.3/include/net/inet_sock.h +linux-4.4.3/include/net/mac80211.h +linux-4.4.3/include/net/neighbour.h +linux-4.4.3/include/net/netlink.h +linux-4.4.3/include/net/netns/ipv4.h +linux-4.4.3/include/net/netns/mib.h +linux-4.4.3/include/net/regulatory.h +linux-4.4.3/include/net/request_sock.h +linux-4.4.3/include/net/rtnetlink.h +linux-4.4.3/include/net/snmp.h +linux-4.4.3/include/net/sock.h +linux-4.4.3/include/net/tcp_states.h +linux-4.4.3/include/net/timewait_sock.h +linux-4.4.3/include/trace/events/skb.h +linux-4.4.3/include/trace/events/sock.h +linux-4.4.3/include/uapi/asm-generic/socket.h +linux-4.4.3/include/uapi/linux/byteorder/little_endian.h +linux-4.4.3/include/uapi/linux/cryptouser.h +linux-4.4.3/include/uapi/linux/errqueue.h +linux-4.4.3/include/uapi/linux/genetlink.h +linux-4.4.3/include/uapi/linux/if_bridge.h +linux-4.4.3/include/uapi/linux/if_ether.h +linux-4.4.3/include/uapi/linux/if_link.h +linux-4.4.3/include/uapi/linux/if_packet.h +linux-4.4.3/include/uapi/linux/neighbour.h +linux-4.4.3/include/uapi/linux/net.h +linux-4.4.3/include/uapi/linux/netlink.h +linux-4.4.3/include/uapi/linux/nl80211.h +linux-4.4.3/include/uapi/linux/pci_regs.h +linux-4.4.3/include/uapi/linux/rfkill.h +linux-4.4.3/include/uapi/linux/rtnetlink.h +linux-4.4.3/include/uapi/linux/snmp.h +linux-4.4.3/include/uapi/linux/socket.h +linux-4.4.3/include/uapi/linux/sockios.h +linux-4.4.3/include/uapi/linux/swab.h +linux-4.4.3/lib/crc32.c +linux-4.4.3/lib/crc32defs.h +linux-4.4.3/lib/ctype.c +linux-4.4.3/lib/nlattr.c +linux-4.4.3/lib/rbtree.c +linux-4.4.3/lib/rhashtable.c +linux-4.4.3/net/core/datagram.c +linux-4.4.3/net/core/rtnetlink.c +linux-4.4.3/net/core/skbuff.c +linux-4.4.3/net/core/sock.c +linux-4.4.3/net/ethernet/eth.c +linux-4.4.3/net/mac80211/aes_ccm.c +linux-4.4.3/net/mac80211/aes_ccm.h +linux-4.4.3/net/mac80211/aes_cmac.c +linux-4.4.3/net/mac80211/aes_cmac.h +linux-4.4.3/net/mac80211/aes_gcm.c +linux-4.4.3/net/mac80211/aes_gcm.h +linux-4.4.3/net/mac80211/aes_gmac.c +linux-4.4.3/net/mac80211/aes_gmac.h +linux-4.4.3/net/mac80211/agg-rx.c +linux-4.4.3/net/mac80211/agg-tx.c +linux-4.4.3/net/mac80211/cfg.c +linux-4.4.3/net/mac80211/chan.c +linux-4.4.3/net/mac80211/debug.h +linux-4.4.3/net/mac80211/debugfs.h +linux-4.4.3/net/mac80211/debugfs_key.h +linux-4.4.3/net/mac80211/debugfs_netdev.h +linux-4.4.3/net/mac80211/debugfs_sta.h +linux-4.4.3/net/mac80211/driver-ops.c +linux-4.4.3/net/mac80211/driver-ops.h +linux-4.4.3/net/mac80211/ethtool.c +linux-4.4.3/net/mac80211/ht.c +linux-4.4.3/net/mac80211/ibss.c +linux-4.4.3/net/mac80211/ieee80211_i.h +linux-4.4.3/net/mac80211/iface.c +linux-4.4.3/net/mac80211/key.c +linux-4.4.3/net/mac80211/key.h +linux-4.4.3/net/mac80211/led.c +linux-4.4.3/net/mac80211/led.h +linux-4.4.3/net/mac80211/main.c +linux-4.4.3/net/mac80211/mesh.c +linux-4.4.3/net/mac80211/mesh.h +linux-4.4.3/net/mac80211/mesh_hwmp.c +linux-4.4.3/net/mac80211/mesh_pathtbl.c +linux-4.4.3/net/mac80211/mesh_plink.c +linux-4.4.3/net/mac80211/mesh_ps.c +linux-4.4.3/net/mac80211/mesh_sync.c +linux-4.4.3/net/mac80211/michael.c +linux-4.4.3/net/mac80211/michael.h +linux-4.4.3/net/mac80211/mlme.c +linux-4.4.3/net/mac80211/ocb.c +linux-4.4.3/net/mac80211/offchannel.c +linux-4.4.3/net/mac80211/pm.c +linux-4.4.3/net/mac80211/rate.c +linux-4.4.3/net/mac80211/rate.h +linux-4.4.3/net/mac80211/rc80211_minstrel.c +linux-4.4.3/net/mac80211/rc80211_minstrel.h +linux-4.4.3/net/mac80211/rc80211_minstrel_ht.c +linux-4.4.3/net/mac80211/rc80211_minstrel_ht.h +linux-4.4.3/net/mac80211/rx.c +linux-4.4.3/net/mac80211/scan.c +linux-4.4.3/net/mac80211/spectmgmt.c +linux-4.4.3/net/mac80211/sta_info.c +linux-4.4.3/net/mac80211/sta_info.h +linux-4.4.3/net/mac80211/status.c +linux-4.4.3/net/mac80211/tdls.c +linux-4.4.3/net/mac80211/tkip.c +linux-4.4.3/net/mac80211/tkip.h +linux-4.4.3/net/mac80211/trace.c +linux-4.4.3/net/mac80211/trace.h +linux-4.4.3/net/mac80211/trace_msg.h +linux-4.4.3/net/mac80211/tx.c +linux-4.4.3/net/mac80211/util.c +linux-4.4.3/net/mac80211/vht.c +linux-4.4.3/net/mac80211/wep.c +linux-4.4.3/net/mac80211/wep.h +linux-4.4.3/net/mac80211/wme.c +linux-4.4.3/net/mac80211/wme.h +linux-4.4.3/net/mac80211/wpa.c +linux-4.4.3/net/mac80211/wpa.h +linux-4.4.3/net/netlink/af_netlink.c +linux-4.4.3/net/netlink/af_netlink.h +linux-4.4.3/net/netlink/genetlink.c +linux-4.4.3/net/packet/af_packet.c +linux-4.4.3/net/packet/internal.h +linux-4.4.3/net/rfkill/core.c +linux-4.4.3/net/rfkill/input.c +linux-4.4.3/net/rfkill/rfkill-gpio.c +linux-4.4.3/net/rfkill/rfkill-regulator.c +linux-4.4.3/net/rfkill/rfkill.h +linux-4.4.3/net/wireless/ap.c +linux-4.4.3/net/wireless/chan.c +linux-4.4.3/net/wireless/core.c +linux-4.4.3/net/wireless/core.h +linux-4.4.3/net/wireless/debugfs.h +linux-4.4.3/net/wireless/ethtool.c +linux-4.4.3/net/wireless/ibss.c +linux-4.4.3/net/wireless/mesh.c +linux-4.4.3/net/wireless/mlme.c +linux-4.4.3/net/wireless/nl80211.c +linux-4.4.3/net/wireless/nl80211.h +linux-4.4.3/net/wireless/radiotap.c +linux-4.4.3/net/wireless/rdev-ops.h +linux-4.4.3/net/wireless/reg.c +linux-4.4.3/net/wireless/reg.h +linux-4.4.3/net/wireless/regdb.h +linux-4.4.3/net/wireless/scan.c +linux-4.4.3/net/wireless/sme.c +linux-4.4.3/net/wireless/sysfs.c +linux-4.4.3/net/wireless/sysfs.h +linux-4.4.3/net/wireless/trace.c +linux-4.4.3/net/wireless/trace.h +linux-4.4.3/net/wireless/util.c +linux-4.4.3/net/wireless/wext-compat.h diff --git a/repos/ports/run/netperf.inc b/repos/ports/run/netperf.inc index 87e5d0b12d..5447f0433a 100644 --- a/repos/ports/run/netperf.inc +++ b/repos/ports/run/netperf.inc @@ -277,11 +277,13 @@ append_if $use_wifi_driver boot_modules { vfs_jitterentropy.lib.so wifi.lib.so wifi_drv - iwlwifi-6000-6.ucode + iwlwifi-6000-4.ucode iwlwifi-6000g2a-6.ucode iwlwifi-6000g2b-6.ucode - iwlwifi-7260-8.ucode - iwlwifi-7265-8.ucode + iwlwifi-7260-16.ucode + iwlwifi-7265-16.ucode + iwlwifi-7265D-16.ucode + iwlwifi-8000C-16.ucode } append_platform_drv_boot_modules