mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
dde_linux: remove legacy_lxip
Because legacy_lxlip is the last entry in dde_linux.port, remove the port as well. issue #5104
This commit is contained in:
parent
8755993123
commit
8aa3967201
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* \brief Lxip: Linux TCP/IP as a library
|
||||
* \author Christian Helmuth
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2013-09-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_LXIP_LXIP_H_
|
||||
#define _INCLUDE_LXIP_LXIP_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
|
||||
namespace Lxip {
|
||||
|
||||
struct Handle
|
||||
{
|
||||
void *socket;
|
||||
bool non_block;
|
||||
|
||||
Handle() : socket(0), non_block(false) { }
|
||||
};
|
||||
|
||||
enum Type { TYPE_STREAM, TYPE_DGRAM };
|
||||
|
||||
typedef Genode::uint8_t uint8_t;
|
||||
typedef Genode::uint16_t uint16_t;
|
||||
typedef Genode::uint32_t uint32_t;
|
||||
typedef signed long ssize_t;
|
||||
typedef Genode::size_t size_t;
|
||||
|
||||
enum Poll_mask {
|
||||
POLLIN = 0x1,
|
||||
POLLOUT = 0x2,
|
||||
POLLEX = 0x4,
|
||||
};
|
||||
|
||||
enum Message_flags {
|
||||
LINUX_MSG_COMPAT = 0x0,
|
||||
LINUX_MSG_OOB = 0x1,
|
||||
LINUX_MSG_PEEK = 0x2,
|
||||
LINUX_MSG_DONTROUTE = 0x4,
|
||||
LINUX_MSG_CTRUNC = 0x8,
|
||||
LINUX_MSG_TRUNC = 0x20,
|
||||
LINUX_MSG_DONTWAIT = 0x40,
|
||||
LINUX_MSG_EOR = 0x80,
|
||||
LINUX_MSG_WAITALL = 0x100,
|
||||
LINUX_MSG_EOF = 0x200,
|
||||
LINUX_MSG_NOSIGNAL = 0x4000,
|
||||
};
|
||||
|
||||
enum Socket_level {
|
||||
LINUX_SOL_SOCKET = 1,
|
||||
};
|
||||
|
||||
enum Ioctl_cmd {
|
||||
LINUX_FIONREAD = 0x541b, /* == SIOCINQ */
|
||||
LINUX_IFADDR = 0x8915, /* == SIOCGIFADDR */
|
||||
};
|
||||
|
||||
/*
|
||||
* Must match errno values from lx_emul.h
|
||||
*/
|
||||
enum Io_result {
|
||||
LINUX_EAGAIN = -35,
|
||||
LINUX_EINPROGRESS = -36,
|
||||
LINUX_EALREADY = -37,
|
||||
LINUX_EISCONN = -56,
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE_LXIP_LXIP_H_ */
|
@ -1,38 +0,0 @@
|
||||
LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip
|
||||
SRC_DIR := $(REP_DIR)/src/lib/legacy_lxip
|
||||
|
||||
# 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
|
||||
|
||||
ifeq ($(filter-out $(SPECS),arm),)
|
||||
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm
|
||||
ifeq ($(filter-out $(SPECS),arm_v6),)
|
||||
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v6
|
||||
endif # arm_v6
|
||||
ifeq ($(filter-out $(SPECS),arm_v7),)
|
||||
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
|
||||
endif # arm_v7
|
||||
endif # arm
|
||||
ifeq ($(filter-out $(SPECS),arm_v8),)
|
||||
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v8
|
||||
endif # arm_v8
|
||||
|
||||
#
|
||||
# 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 += $(SRC_DIR) \
|
||||
$(SRC_DIR)/include
|
||||
INC_DIR += $(REP_DIR)/src/include
|
||||
INC_DIR += $(ARCH_SRC_INC_DIR)
|
||||
INC_DIR += $(LXIP_CONTRIB_DIR)/include \
|
||||
$(LXIP_CONTRIB_DIR)/include/uapi
|
||||
INC_DIR += $(LIB_CACHE_DIR)/lxip_include/include/include/include
|
@ -1,54 +0,0 @@
|
||||
SHARED_LIB = yes
|
||||
|
||||
LIB_DIR = $(REP_DIR)/src/lib/legacy_lxip
|
||||
LIB_INC_DIR = $(LIB_DIR)/include
|
||||
|
||||
LIBS += lxip_include format
|
||||
|
||||
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip
|
||||
NET_DIR := $(LX_CONTRIB_DIR)/net
|
||||
|
||||
SETUP_SUFFIX =
|
||||
CC_OPT += -DSETUP_SUFFIX=$(SETUP_SUFFIX)
|
||||
|
||||
CC_OPT += -U__linux__ -D__KERNEL__
|
||||
CC_OPT += -DCONFIG_INET -DCONFIG_BASE_SMALL=0 -DCONFIG_DEBUG_LOCK_ALLOC \
|
||||
-DCONFIG_IP_PNP_DHCP
|
||||
|
||||
CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \
|
||||
-Wno-unused-function -Wno-overflow -Wno-pointer-arith \
|
||||
-Wno-sign-compare -Wno-builtin-declaration-mismatch
|
||||
|
||||
CC_C_OPT += -std=gnu89
|
||||
CC_C_OPT += -Wno-unused-but-set-variable -Wno-pointer-sign
|
||||
|
||||
CC_C_OPT += -include $(LIB_INC_DIR)/lx_emul.h
|
||||
CC_CXX_OPT += -fpermissive
|
||||
|
||||
SRC_CC = dummies.cc lxcc_emul.cc nic_handler.cc \
|
||||
timer_handler.cc random.cc
|
||||
|
||||
SRC_CC += malloc.cc printf.cc bug.cc env.cc
|
||||
|
||||
SRC_C += driver.c dummies_c.c lxc_emul.c
|
||||
|
||||
SRC_C += net/802/p8023.c
|
||||
SRC_C += $(addprefix net/core/,$(notdir $(wildcard $(NET_DIR)/core/*.c)))
|
||||
SRC_C += $(addprefix net/ipv4/,$(notdir $(wildcard $(NET_DIR)/ipv4/*.c)))
|
||||
SRC_C += net/ethernet/eth.c
|
||||
SRC_C += net/netlink/af_netlink.c
|
||||
SRC_C += net/sched/sch_generic.c
|
||||
SRC_C += lib/checksum.c
|
||||
SRC_C += lib/rhashtable.c
|
||||
SRC_C += drivers/net/loopback.c
|
||||
|
||||
#SRC_C = net/ipv4/inet_connection_sock.c
|
||||
|
||||
net/ethernet/eth.o: SETUP_SUFFIX="_eth"
|
||||
|
||||
vpath %.c $(LX_CONTRIB_DIR)
|
||||
vpath %.c $(LIB_DIR)
|
||||
vpath %.cc $(LIB_DIR)
|
||||
vpath %.cc $(REP_DIR)/src/lib/legacy/lx_kit
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,39 +0,0 @@
|
||||
ifeq ($(called_from_lib_mk),yes)
|
||||
|
||||
LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip
|
||||
LX_EMUL_H := $(REP_DIR)/src/lib/legacy_lxip/include/lx_emul.h
|
||||
|
||||
#
|
||||
# Determine the header files included by the contrib code. For each
|
||||
# of these header files we create a symlink to 'lx_emul.h'.
|
||||
#
|
||||
SCAN_DIRS := $(addprefix $(LXIP_CONTRIB_DIR)/include/, asm-generic linux net uapi) \
|
||||
$(addprefix $(LXIP_CONTRIB_DIR)/, drivers lib net)
|
||||
GEN_INCLUDES := $(shell grep -rIh "^\#include .*\/" $(SCAN_DIRS) |\
|
||||
sed "s/^\#include [^<\"]*[<\"]\([^>\"]*\)[>\"].*/\1/" |\
|
||||
sort | uniq)
|
||||
#
|
||||
# Filter out original Linux headers that exist in the contrib directory
|
||||
#
|
||||
NO_GEN_INCLUDES := $(shell cd $(LXIP_CONTRIB_DIR)/; find include -name "*.h" |\
|
||||
sed "s/.\///" | sed "s/.*include\///")
|
||||
GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES))
|
||||
|
||||
#
|
||||
# Put Linux headers in 'GEN_INC' dir, since some include use "../../" paths use
|
||||
# three level include hierarchy
|
||||
#
|
||||
GEN_INC := $(shell pwd)/include/include/include
|
||||
GEN_INCLUDES := $(addprefix $(GEN_INC)/,$(GEN_INCLUDES))
|
||||
|
||||
all: $(GEN_INCLUDES)
|
||||
|
||||
$(GEN_INCLUDES):
|
||||
$(VERBOSE)mkdir -p $(dir $@)
|
||||
$(VERBOSE)ln -s $(LX_EMUL_H) $@
|
||||
|
||||
endif
|
||||
|
||||
# vi: set ft=make :
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,154 +0,0 @@
|
||||
linux-x.x.x/drivers/net/loopback.c
|
||||
linux-x.x.x/include/asm-generic/atomic64.h
|
||||
linux-x.x.x/include/asm-generic/bitops/__ffs.h
|
||||
linux-x.x.x/include/asm-generic/bitops/__fls.h
|
||||
linux-x.x.x/include/asm-generic/bitops/ffs.h
|
||||
linux-x.x.x/include/asm-generic/bitops/fls.h
|
||||
linux-x.x.x/include/asm-generic/bitops/fls64.h
|
||||
linux-x.x.x/include/asm-generic/bitops/non-atomic.h
|
||||
linux-x.x.x/include/linux/errqueue.h
|
||||
linux-x.x.x/include/linux/etherdevice.h
|
||||
linux-x.x.x/include/linux/ethtool.h
|
||||
linux-x.x.x/include/linux/icmp.h
|
||||
linux-x.x.x/include/linux/if_arp.h
|
||||
linux-x.x.x/include/linux/if_ether.h
|
||||
linux-x.x.x/include/linux/if_link.h
|
||||
linux-x.x.x/include/linux/inetdevice.h
|
||||
linux-x.x.x/include/linux/jhash.h
|
||||
linux-x.x.x/include/linux/list.h
|
||||
linux-x.x.x/include/linux/list_nulls.h
|
||||
linux-x.x.x/include/linux/log2.h
|
||||
linux-x.x.x/include/linux/netdev_features.h
|
||||
linux-x.x.x/include/linux/netdevice.h
|
||||
linux-x.x.x/include/linux/net.h
|
||||
linux-x.x.x/include/linux/netlink.h
|
||||
linux-x.x.x/include/linux/rbtree.h
|
||||
linux-x.x.x/include/linux/rhashtable.h
|
||||
linux-x.x.x/include/linux/skbuff.h
|
||||
linux-x.x.x/include/linux/socket.h
|
||||
linux-x.x.x/include/linux/swab.h
|
||||
linux-x.x.x/include/linux/tcp.h
|
||||
linux-x.x.x/include/linux/udp.h
|
||||
linux-x.x.x/include/net/arp.h
|
||||
linux-x.x.x/include/net/datalink.h
|
||||
linux-x.x.x/include/net/dsfield.h
|
||||
linux-x.x.x/include/net/dst.h
|
||||
linux-x.x.x/include/net/dst_metadata.h
|
||||
linux-x.x.x/include/net/dst_ops.h
|
||||
linux-x.x.x/include/net/flow.h
|
||||
linux-x.x.x/include/net/icmp.h
|
||||
linux-x.x.x/include/net/inet_connection_sock.h
|
||||
linux-x.x.x/include/net/inet_frag.h
|
||||
linux-x.x.x/include/net/inet_hashtables.h
|
||||
linux-x.x.x/include/net/inetpeer.h
|
||||
linux-x.x.x/include/net/inet_sock.h
|
||||
linux-x.x.x/include/net/inet_timewait_sock.h
|
||||
linux-x.x.x/include/net/ipconfig.h
|
||||
linux-x.x.x/include/net/ip_fib.h
|
||||
linux-x.x.x/include/net/ip.h
|
||||
linux-x.x.x/include/net/neighbour.h
|
||||
linux-x.x.x/include/net/netlink.h
|
||||
linux-x.x.x/include/net/netns/ipv4.h
|
||||
linux-x.x.x/include/net/netns/mib.h
|
||||
linux-x.x.x/include/net/ping.h
|
||||
linux-x.x.x/include/net/pkt_sched.h
|
||||
linux-x.x.x/include/net/protocol.h
|
||||
linux-x.x.x/include/net/raw.h
|
||||
linux-x.x.x/include/net/request_sock.h
|
||||
linux-x.x.x/include/net/route.h
|
||||
linux-x.x.x/include/net/sch_generic.h
|
||||
linux-x.x.x/include/net/snmp.h
|
||||
linux-x.x.x/include/net/sock.h
|
||||
linux-x.x.x/include/net/tcp.h
|
||||
linux-x.x.x/include/net/tcp_states.h
|
||||
linux-x.x.x/include/net/timewait_sock.h
|
||||
linux-x.x.x/include/net/udp.h
|
||||
linux-x.x.x/include/net/udplite.h
|
||||
linux-x.x.x/include/uapi/asm-generic/socket.h
|
||||
linux-x.x.x/include/uapi/linux/byteorder/little_endian.h
|
||||
linux-x.x.x/include/uapi/linux/errqueue.h
|
||||
linux-x.x.x/include/uapi/linux/ethtool.h
|
||||
linux-x.x.x/include/uapi/linux/fib_rules.h
|
||||
linux-x.x.x/include/uapi/linux/gen_stats.h
|
||||
linux-x.x.x/include/uapi/linux/icmp.h
|
||||
linux-x.x.x/include/uapi/linux/if_addr.h
|
||||
linux-x.x.x/include/uapi/linux/if_arp.h
|
||||
linux-x.x.x/include/uapi/linux/if_ether.h
|
||||
linux-x.x.x/include/uapi/linux/if.h
|
||||
linux-x.x.x/include/uapi/linux/if_link.h
|
||||
linux-x.x.x/include/uapi/linux/if_packet.h
|
||||
linux-x.x.x/include/uapi/linux/in6.h
|
||||
linux-x.x.x/include/uapi/linux/inet_diag.h
|
||||
linux-x.x.x/include/uapi/linux/in.h
|
||||
linux-x.x.x/include/uapi/linux/in_route.h
|
||||
linux-x.x.x/include/uapi/linux/ip.h
|
||||
linux-x.x.x/include/uapi/linux/neighbour.h
|
||||
linux-x.x.x/include/uapi/linux/netconf.h
|
||||
linux-x.x.x/include/uapi/linux/netdevice.h
|
||||
linux-x.x.x/include/uapi/linux/netfilter.h
|
||||
linux-x.x.x/include/uapi/linux/net.h
|
||||
linux-x.x.x/include/uapi/linux/netlink.h
|
||||
linux-x.x.x/include/uapi/linux/pkt_sched.h
|
||||
linux-x.x.x/include/uapi/linux/route.h
|
||||
linux-x.x.x/include/uapi/linux/rtnetlink.h
|
||||
linux-x.x.x/include/uapi/linux/snmp.h
|
||||
linux-x.x.x/include/uapi/linux/socket.h
|
||||
linux-x.x.x/include/uapi/linux/sockios.h
|
||||
linux-x.x.x/include/uapi/linux/swab.h
|
||||
linux-x.x.x/include/uapi/linux/tcp.h
|
||||
linux-x.x.x/include/uapi/linux/udp.h
|
||||
linux-x.x.x/lib/checksum.c
|
||||
linux-x.x.x/lib/rbtree.c
|
||||
linux-x.x.x/lib/rhashtable.c
|
||||
linux-x.x.x/net/802/p8023.c
|
||||
linux-x.x.x/net/core/datagram.c
|
||||
linux-x.x.x/net/core/dev_addr_lists.c
|
||||
linux-x.x.x/net/core/dev.c
|
||||
linux-x.x.x/net/core/dst.c
|
||||
linux-x.x.x/net/core/ethtool.c
|
||||
linux-x.x.x/net/core/neighbour.c
|
||||
linux-x.x.x/net/core/net-sysfs.h
|
||||
linux-x.x.x/net/core/request_sock.c
|
||||
linux-x.x.x/net/core/skbuff.c
|
||||
linux-x.x.x/net/core/sock.c
|
||||
linux-x.x.x/net/core/stream.c
|
||||
linux-x.x.x/net/core/utils.c
|
||||
linux-x.x.x/net/ethernet/eth.c
|
||||
linux-x.x.x/net/ipv4/af_inet.c
|
||||
linux-x.x.x/net/ipv4/arp.c
|
||||
linux-x.x.x/net/ipv4/devinet.c
|
||||
linux-x.x.x/net/ipv4/datagram.c
|
||||
linux-x.x.x/net/ipv4/fib_frontend.c
|
||||
linux-x.x.x/net/ipv4/fib_lookup.h
|
||||
linux-x.x.x/net/ipv4/fib_semantics.c
|
||||
linux-x.x.x/net/ipv4/fib_trie.c
|
||||
linux-x.x.x/net/ipv4/icmp.c
|
||||
linux-x.x.x/net/ipv4/inet_connection_sock.c
|
||||
linux-x.x.x/net/ipv4/inet_fragment.c
|
||||
linux-x.x.x/net/ipv4/inet_hashtables.c
|
||||
linux-x.x.x/net/ipv4/inetpeer.c
|
||||
linux-x.x.x/net/ipv4/ipconfig.c
|
||||
linux-x.x.x/net/ipv4/ip_forward.c
|
||||
linux-x.x.x/net/ipv4/ip_fragment.c
|
||||
linux-x.x.x/net/ipv4/ip_input.c
|
||||
linux-x.x.x/net/ipv4/ip_options.c
|
||||
linux-x.x.x/net/ipv4/ip_output.c
|
||||
linux-x.x.x/net/ipv4/ip_sockglue.c
|
||||
linux-x.x.x/net/ipv4/ping.c
|
||||
linux-x.x.x/net/ipv4/protocol.c
|
||||
linux-x.x.x/net/ipv4/raw.c
|
||||
linux-x.x.x/net/ipv4/route.c
|
||||
linux-x.x.x/net/ipv4/tcp_cong.c
|
||||
linux-x.x.x/net/ipv4/tcp_cubic.c
|
||||
linux-x.x.x/net/ipv4/tcp_diag.c
|
||||
linux-x.x.x/net/ipv4/tcp_input.c
|
||||
linux-x.x.x/net/ipv4/tcp_ipv4.c
|
||||
linux-x.x.x/net/ipv4/tcp_minisocks.c
|
||||
linux-x.x.x/net/ipv4/tcp.c
|
||||
linux-x.x.x/net/ipv4/tcp_output.c
|
||||
linux-x.x.x/net/ipv4/tcp_timer.c
|
||||
linux-x.x.x/net/ipv4/udp_impl.h
|
||||
linux-x.x.x/net/ipv4/udp.c
|
||||
linux-x.x.x/net/netlink/af_netlink.c
|
||||
linux-x.x.x/net/netlink/af_netlink.h
|
||||
linux-x.x.x/net/sched/sch_generic.c
|
@ -1,12 +0,0 @@
|
||||
diff -r a4522abad72d net/ipv4/icmp.c
|
||||
--- a/net/ipv4/icmp.c Tue Oct 15 12:18:08 2013 +0200
|
||||
+++ b/net/ipv4/icmp.c Tue Oct 15 12:18:33 2013 +0200
|
||||
@@ -787,7 +787,7 @@
|
||||
if (!net->ipv4.sysctl_icmp_echo_ignore_all) {
|
||||
struct icmp_bxm icmp_param;
|
||||
|
||||
- icmp_param.data.icmph = *icmp_hdr(skb);
|
||||
+ memcpy(&icmp_param.data.icmph, icmp_hdr(skb), sizeof(struct icmphdr));
|
||||
icmp_param.data.icmph.type = ICMP_ECHOREPLY;
|
||||
icmp_param.skb = skb;
|
||||
icmp_param.offset = 0;
|
@ -1,113 +0,0 @@
|
||||
ip_config.patch
|
||||
|
||||
From: Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
|
||||
|
||||
|
||||
---
|
||||
net/ipv4/ipconfig.c | 55 ++++++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 45 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
|
||||
index 0bc7412..a92c6e3 100644
|
||||
--- a/net/ipv4/ipconfig.c
|
||||
+++ b/net/ipv4/ipconfig.c
|
||||
@@ -133,7 +133,7 @@ int ic_proto_enabled __initdata = 0
|
||||
static int ic_host_name_set __initdata; /* Host name set by us? */
|
||||
|
||||
__be32 ic_myaddr = NONE; /* My IP address */
|
||||
-static __be32 ic_netmask = NONE; /* Netmask for local subnet */
|
||||
+__be32 ic_netmask = NONE; /* Netmask for local subnet */
|
||||
__be32 ic_gateway = NONE; /* Gateway IP address */
|
||||
|
||||
__be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */
|
||||
@@ -153,7 +153,7 @@ static char dhcp_client_identifier[253] __initdata;
|
||||
/* Persistent data: */
|
||||
|
||||
static int ic_proto_used; /* Protocol used, if any */
|
||||
-static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
|
||||
+__be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
|
||||
static u8 ic_domain[64]; /* DNS (not NIS) domain name */
|
||||
|
||||
/*
|
||||
@@ -435,6 +435,33 @@ static int __init ic_setup_routes(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int __init ic_delete_routes(void)
|
||||
+{
|
||||
+ /* No need to delete device routes, only the default route... */
|
||||
+
|
||||
+ if (ic_gateway != NONE) {
|
||||
+ struct rtentry rm;
|
||||
+ int err;
|
||||
+
|
||||
+ memset(&rm, 0, sizeof(rm));
|
||||
+ if ((ic_gateway ^ ic_myaddr) & ic_netmask) {
|
||||
+ pr_err("IP-Config: Gateway not on directly connected network\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0);
|
||||
+ set_sockaddr((struct sockaddr_in *) &rm.rt_genmask, 0, 0);
|
||||
+ set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0);
|
||||
+ rm.rt_flags = RTF_UP | RTF_GATEWAY;
|
||||
+ if ((err = ic_route_ioctl(SIOCDELRT, &rm)) < 0) {
|
||||
+ pr_err("IP-Config: Cannot delete default route (%d)\n",
|
||||
+ err);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Fill in default values for all missing parameters.
|
||||
*/
|
||||
@@ -1531,24 +1558,24 @@ static int __init ip_auto_config(void)
|
||||
*/
|
||||
pr_info("IP-Config: Complete:\n");
|
||||
|
||||
- pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n",
|
||||
- ic_dev->name, ic_dev->addr_len, ic_dev->dev_addr,
|
||||
- &ic_myaddr, &ic_netmask, &ic_gateway);
|
||||
+ pr_info(" device=%s, len=%u hwaddr=" MAC_FMT ", ipaddr=" IP_FMT ", mask=" IP_FMT " , gw=" IP_FMT "\n",
|
||||
+ ic_dev->name, ic_dev->addr_len, MAC_ARG(ic_dev->dev_addr),
|
||||
+ IP_ARG(ic_myaddr), IP_ARG(ic_netmask), IP_ARG(ic_gateway));
|
||||
pr_info(" host=%s, domain=%s, nis-domain=%s\n",
|
||||
utsname()->nodename, ic_domain, utsname()->domainname);
|
||||
- pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s",
|
||||
- &ic_servaddr, &root_server_addr, root_server_path);
|
||||
+ pr_info(" bootserver=" IP_FMT ", rootserver=" IP_FMT ", rootpath=%s\n",
|
||||
+ IP_ARG(ic_servaddr), IP_ARG(root_server_addr), root_server_path);
|
||||
if (ic_dev_mtu)
|
||||
pr_cont(", mtu=%d", ic_dev_mtu);
|
||||
for (i = 0; i < CONF_NAMESERVERS_MAX; i++)
|
||||
if (ic_nameservers[i] != NONE) {
|
||||
- pr_info(" nameserver%u=%pI4",
|
||||
- i, &ic_nameservers[i]);
|
||||
+ pr_info(" nameserver%u=" IP_FMT,
|
||||
+ i, IP_ARG(ic_nameservers[i]));
|
||||
break;
|
||||
}
|
||||
for (i++; i < CONF_NAMESERVERS_MAX; i++)
|
||||
if (ic_nameservers[i] != NONE)
|
||||
- pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]);
|
||||
+ pr_cont(", nameserver%u=" IP_FMT, i, IP_ARG(ic_nameservers[i]));
|
||||
pr_cont("\n");
|
||||
#endif /* !SILENT */
|
||||
|
||||
@@ -1621,6 +1648,14 @@ static int __init ip_auto_config_setup(char *addrs)
|
||||
ic_set_manually = 1;
|
||||
ic_enable = 1;
|
||||
|
||||
+ ic_delete_routes();
|
||||
+
|
||||
+ ic_myaddr = NONE;
|
||||
+ ic_netmask = NONE;
|
||||
+ ic_gateway = NONE;
|
||||
+ ic_servaddr = NONE;
|
||||
+ ic_got_reply = 0;
|
||||
+
|
||||
/*
|
||||
* If any dhcp, bootp etc options are set, leave autoconfig on
|
||||
* and skip the below static IP processing.
|
@ -1,10 +0,0 @@
|
||||
--- a/include/linux/log2.h 2016-02-25 21:01:36.000000000 +0100
|
||||
+++ b/include/linux/log2.h 2020-01-03 14:59:54.572400301 +0100
|
||||
@@ -18,7 +18,6 @@
|
||||
/*
|
||||
* deal with unrepresentable constant logarithms
|
||||
*/
|
||||
-extern __attribute__((const, noreturn))
|
||||
int ____ilog2_NaN(void);
|
||||
|
||||
/*
|
@ -1,38 +0,0 @@
|
||||
--- a/include/net/netlink.h
|
||||
+++ b/include/net/netlink.h
|
||||
@@ -321,7 +321,7 @@
|
||||
static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh,
|
||||
int hdrlen)
|
||||
{
|
||||
- unsigned char *data = nlmsg_data(nlh);
|
||||
+ unsigned char *data = (unsigned char *)nlmsg_data(nlh);
|
||||
return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen));
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@
|
||||
static inline struct nlattr *
|
||||
nla_find_nested(const struct nlattr *nla, int attrtype)
|
||||
{
|
||||
- return nla_find(nla_data(nla), nla_len(nla), attrtype);
|
||||
+ return nla_find((const struct nlattr *)nla_data(nla), nla_len(nla), attrtype);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -746,7 +746,7 @@
|
||||
const struct nlattr *nla,
|
||||
const struct nla_policy *policy)
|
||||
{
|
||||
- return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
|
||||
+ return nla_parse(tb, maxtype, (const struct nlattr *)nla_data(nla), nla_len(nla), policy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1174,7 +1174,7 @@
|
||||
static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
|
||||
const struct nla_policy *policy)
|
||||
{
|
||||
- return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
|
||||
+ return nla_validate((const struct nlattr *)nla_data(start), nla_len(start), maxtype, policy);
|
||||
}
|
||||
|
||||
/**
|
@ -1,23 +0,0 @@
|
||||
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
|
||||
index a0dde04..dccc51f 100644
|
||||
--- a/include/net/request_sock.h
|
||||
+++ b/include/net/request_sock.h
|
||||
@@ -109,7 +109,7 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener,
|
||||
static inline void reqsk_free(struct request_sock *req)
|
||||
{
|
||||
/* temporary debugging */
|
||||
- WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0);
|
||||
+ // WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0);
|
||||
|
||||
req->rsk_ops->destructor(req);
|
||||
if (req->rsk_listener)
|
||||
@@ -120,7 +120,8 @@ static inline void reqsk_free(struct request_sock *req)
|
||||
|
||||
static inline void reqsk_put(struct request_sock *req)
|
||||
{
|
||||
- if (atomic_dec_and_test(&req->rsk_refcnt))
|
||||
+ if (atomic_dec_and_test(&req->rsk_refcnt)
|
||||
+ || req->rsk_refcnt.counter == 1)
|
||||
reqsk_free(req);
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
|
||||
index 5c5db66..6cb68a1 100644
|
||||
--- a/net/ipv4/af_inet.c
|
||||
+++ b/net/ipv4/af_inet.c
|
||||
@@ -733,6 +733,8 @@
|
||||
inet_autobind(sk))
|
||||
return -EAGAIN;
|
||||
|
||||
+ if (sk->sk_wq == 0) sk->sk_wq = sock->wq;
|
||||
+
|
||||
return sk->sk_prot->sendmsg(sk, msg, size);
|
||||
}
|
||||
EXPORT_SYMBOL(inet_sendmsg);
|
||||
@@ -764,6 +766,8 @@
|
||||
|
||||
sock_rps_record_flow(sk);
|
||||
|
||||
+ if (sk->sk_wq == 0) sk->sk_wq = sock->wq;
|
||||
+
|
||||
err = sk->sk_prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT,
|
||||
flags & ~MSG_DONTWAIT, &addr_len);
|
||||
if (err >= 0)
|
@ -1,13 +0,0 @@
|
||||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
|
||||
index 9147f9f..c63ee5c 100644
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -3281,7 +3281,7 @@ static inline void skb_remcsum_process(struct sk_buff *skb, void *ptr,
|
||||
|
||||
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);
|
@ -1 +0,0 @@
|
||||
489d34e0dfdb6dd5cc3c26d1bf69f9b0f06f0a29
|
@ -1,37 +0,0 @@
|
||||
LICENSE := GPLv2
|
||||
VERSION := individual (see sources)
|
||||
DOWNLOADS := lxip.archive
|
||||
|
||||
#
|
||||
# IP stack sources
|
||||
#
|
||||
SRC_DIR_LXIP := src/lib/lxip
|
||||
VERSION(lxip) := 4.4.3
|
||||
URL(lxip) := https://www.kernel.org/pub/linux/kernel/v4.x/linux-${VERSION(lxip)}.tar.xz
|
||||
SHA(lxip) := 0b379cb19bbd7e38fc5a9a000ea927db55cce519a7400ec7fa705c581a6491dd
|
||||
DIR(lxip) := $(SRC_DIR_LXIP)
|
||||
TAR_OPT(lxip) := --strip-components=1 --files-from - < <(sed 's/-x.x.x/-${VERSION(lxip)}/g' $(REP_DIR)/lxip.list)
|
||||
HASH_INPUT += $(REP_DIR)/lxip.list
|
||||
|
||||
#
|
||||
# Patches
|
||||
#
|
||||
PATCHES += patches/legacy_lxip_icmp.patch
|
||||
PATCHES += patches/legacy_lxip_ip_config.patch
|
||||
PATCHES += patches/legacy_lxip_log2.patch
|
||||
PATCHES += patches/legacy_lxip_netlink.patch
|
||||
PATCHES += patches/legacy_lxip_request_sock.patch
|
||||
PATCHES += patches/legacy_lxip_sk_wq.patch
|
||||
PATCHES += patches/legacy_lxip_skbuff_cast.patch
|
||||
|
||||
#IP stack
|
||||
LXIP_OPT = -p1 -d$(SRC_DIR_LXIP)
|
||||
PATCH_OPT(patches/legacy_lxip_icmp.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_ip_config.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_log2.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_netlink.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_request_sock.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_sk_wq.patch) := $(LXIP_OPT)
|
||||
PATCH_OPT(patches/legacy_lxip_skbuff_cast.patch) := $(LXIP_OPT)
|
||||
|
||||
# vi: set ft=make :
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* \brief Back-end driver for IP stack
|
||||
* \author Sebastian Sumpf
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2013-09-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lx_emul.h>
|
||||
#include <nic.h>
|
||||
|
||||
|
||||
static struct net_device *_dev;
|
||||
|
||||
|
||||
static int driver_net_open(struct net_device *dev)
|
||||
{
|
||||
_dev = dev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int driver_net_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev);
|
||||
int len = skb->len;
|
||||
void* addr = skb->data;
|
||||
|
||||
/* transmit to nic-session */
|
||||
if (net_tx(addr, len)) {
|
||||
/* tx queue is full, could not enqueue packet */
|
||||
pr_debug("TX packet dropped\n");
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
dev_kfree_skb(skb);
|
||||
|
||||
/* save timestamp */
|
||||
dev->trans_start = jiffies;
|
||||
|
||||
stats->tx_packets++;
|
||||
stats->tx_bytes += len;
|
||||
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
||||
static int driver_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
/* possible point to reflect successful MTU setting */
|
||||
return eth_change_mtu(dev, new_mtu);
|
||||
}
|
||||
|
||||
|
||||
static const struct net_device_ops driver_net_ops =
|
||||
{
|
||||
.ndo_open = driver_net_open,
|
||||
.ndo_start_xmit = driver_net_xmit,
|
||||
.ndo_change_mtu = driver_change_mtu,
|
||||
};
|
||||
|
||||
|
||||
static int driver_init(void)
|
||||
{
|
||||
struct net_device *dev;
|
||||
int err = -ENODEV;
|
||||
|
||||
dev = alloc_etherdev(0);
|
||||
|
||||
if (!(dev = alloc_etherdev(0)))
|
||||
goto out;
|
||||
|
||||
dev->netdev_ops = &driver_net_ops;
|
||||
|
||||
/* set MAC */
|
||||
net_mac(dev->dev_addr, ETH_ALEN);
|
||||
|
||||
if ((err = register_netdev(dev))) {
|
||||
panic("driver: Could not register back-end %d\n", err);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_free:
|
||||
free_netdev(dev);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
module_init(driver_init);
|
||||
|
||||
|
||||
/**
|
||||
* Called by Nic_client when a packet was received
|
||||
*/
|
||||
void net_driver_rx(void *addr, unsigned long size)
|
||||
{
|
||||
struct net_device_stats *stats;
|
||||
|
||||
if (!_dev)
|
||||
return;
|
||||
|
||||
stats = (struct net_device_stats*) netdev_priv(_dev);
|
||||
|
||||
/* allocate skb */
|
||||
enum {
|
||||
ADDITIONAL_HEADROOM = 4, /* smallest value found by trial & error */
|
||||
};
|
||||
struct sk_buff *skb = netdev_alloc_skb_ip_align(_dev, size + ADDITIONAL_HEADROOM);
|
||||
if (!skb) {
|
||||
printk(KERN_NOTICE "genode_net_rx: low on mem - packet dropped!\n");
|
||||
stats->rx_dropped++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy packet */
|
||||
memcpy(skb_put(skb, size), addr, size);
|
||||
|
||||
skb->dev = _dev;
|
||||
skb->protocol = eth_type_trans(skb, _dev);
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
netif_receive_skb(skb);
|
||||
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += size;
|
||||
}
|
@ -1,664 +0,0 @@
|
||||
/*
|
||||
* \brief Dummy functions
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2013-08-26
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
typedef long DUMMY;
|
||||
|
||||
enum {
|
||||
SHOW_DUMMY = 0,
|
||||
SHOW_SKIP = 0,
|
||||
SHOW_RET = 0,
|
||||
SHOW_SHOW = 1,
|
||||
};
|
||||
|
||||
#define DUMMY(retval, name) \
|
||||
DUMMY name(void) { \
|
||||
if (SHOW_DUMMY) \
|
||||
Genode::log(__func__, ": " #name " called " \
|
||||
"(from ", __builtin_return_address(0), ") " \
|
||||
"not implemented"); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define DUMMY_SKIP(retval, name) \
|
||||
DUMMY name(void) { \
|
||||
if (SHOW_SKIP) \
|
||||
Genode::log(__func__, ": " #name " called " \
|
||||
"(from ", __builtin_return_address(0), ") " \
|
||||
"skipped"); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define DUMMY_RET(retval, name) \
|
||||
DUMMY name(void) { \
|
||||
if (SHOW_RET) \
|
||||
Genode::log(__func__, ": " #name " called " \
|
||||
"(from ", __builtin_return_address(0), ") " \
|
||||
"return ", retval); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define DUMMY_SHOW(retval, name) \
|
||||
DUMMY name(void) { \
|
||||
if (SHOW_SHOW) \
|
||||
Genode::log(__func__, ": " #name " called " \
|
||||
"(from ", __builtin_return_address(0), ") " \
|
||||
"return ", retval); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define DUMMY_STOP(retval, name) \
|
||||
DUMMY name(void) { \
|
||||
do { \
|
||||
Genode::warning(__func__, ": " #name " called " \
|
||||
"(from ", __builtin_return_address(0), ") " \
|
||||
"stopped"); \
|
||||
Genode::sleep_forever(); \
|
||||
} while (0); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Changed return values
|
||||
*/
|
||||
DUMMY_RET(0, in_irq)
|
||||
DUMMY_RET(0, inet_twsk_alloc)
|
||||
DUMMY_RET(0, ipv6_only_sock)
|
||||
DUMMY_RET(0, netpoll_receive_skb)
|
||||
DUMMY_RET(0, netpoll_rx_disable)
|
||||
DUMMY_RET(1, nf_hook)
|
||||
DUMMY_RET(0, notifier_to_errno)
|
||||
DUMMY_RET(0, net_hash_mix)
|
||||
DUMMY_RET(0, netdev_kobject_init)
|
||||
DUMMY_RET(0, netdev_register_kobject)
|
||||
DUMMY_RET(0, netpoll_rx)
|
||||
DUMMY_RET(0, nla_put)
|
||||
DUMMY_RET(1, ns_capable)
|
||||
DUMMY_RET(1, num_possible_cpus)
|
||||
DUMMY_RET(0, read_seqretry)
|
||||
DUMMY_RET(0, secpath_exists)
|
||||
DUMMY_RET(0, security_inet_conn_request)
|
||||
DUMMY_RET(0, security_sk_alloc)
|
||||
DUMMY_RET(0, signal_pending)
|
||||
DUMMY_RET(0, sk_filter)
|
||||
DUMMY_RET(0, sock_tx_timestamp)
|
||||
DUMMY_RET(0, sscanf)
|
||||
DUMMY_RET(0, static_key_false)
|
||||
DUMMY_RET(0, vlan_tx_nonzero_tag_present)
|
||||
DUMMY_RET(0, vlan_tx_tag_present)
|
||||
DUMMY_RET(1, xfrm4_policy_check)
|
||||
DUMMY_RET(0, xfrm_sk_clone_policy)
|
||||
DUMMY_RET(0, xfrm_decode_session_reverse)
|
||||
DUMMY_RET(1, try_module_get) /* important in sk_prot_alloc() */
|
||||
|
||||
|
||||
/*
|
||||
* Unnecessary to trace
|
||||
*/
|
||||
DUMMY_SKIP( 0, ASSERT_RTNL)
|
||||
DUMMY_SKIP(-1, debug_check_no_locks_freed)
|
||||
DUMMY_SKIP(-1, local_bh_disable)
|
||||
DUMMY_SKIP(-1, local_bh_enable)
|
||||
DUMMY_SKIP(-1, local_irq_disable)
|
||||
DUMMY_SKIP(-1, local_irq_enable)
|
||||
DUMMY_SKIP(-1, local_irq_restore)
|
||||
DUMMY_SKIP(-1, local_irq_save)
|
||||
DUMMY_SKIP(-1, lockdep_init_map)
|
||||
DUMMY_SKIP(-1, lockdep_set_class_and_name)
|
||||
DUMMY_SKIP(-1, kmemcheck_annotate_variable)
|
||||
DUMMY_SKIP(-1, might_sleep)
|
||||
DUMMY_SKIP(-1, mutex_acquire)
|
||||
DUMMY_SKIP(-1, mutex_init)
|
||||
DUMMY_SKIP(-1, mutex_release)
|
||||
DUMMY_SKIP(-1, mutex_unlock)
|
||||
DUMMY_SKIP(-1, prefetchw)
|
||||
DUMMY_SKIP(-1, mutex_lock)
|
||||
DUMMY_SKIP(-1, rcu_read_lock)
|
||||
DUMMY_SKIP(-1, rcu_read_unlock)
|
||||
DUMMY_SKIP(-1, rcu_read_lock_bh)
|
||||
DUMMY_SKIP(-1, rcu_read_unlock_bh)
|
||||
DUMMY_SKIP(-1, read_lock)
|
||||
DUMMY_SKIP(-1, read_seqbegin)
|
||||
DUMMY_SKIP(-1, read_unlock)
|
||||
DUMMY_SKIP(-1, read_lock_bh)
|
||||
DUMMY_SKIP(-1, read_unlock_bh)
|
||||
DUMMY_SKIP(-1, rwlock_init)
|
||||
DUMMY_SKIP(-1, seqlock_init)
|
||||
DUMMY_SKIP(-1, smp_mb)
|
||||
DUMMY_SKIP(-1, smp_rmb)
|
||||
DUMMY_SKIP(-1, smp_wmb)
|
||||
DUMMY_SKIP(-1, spin_lock_irqsave)
|
||||
DUMMY_RET( 1, spin_trylock)
|
||||
DUMMY_SKIP(-1, spin_unlock_irqrestore)
|
||||
DUMMY_SKIP(-1, synchronize_rcu)
|
||||
DUMMY_SKIP(-1, trace_kfree_skb)
|
||||
DUMMY_SKIP(-1, trace_consume_skb)
|
||||
DUMMY_SKIP(-1, trace_net_dev_xmit)
|
||||
DUMMY_SKIP(-1, trace_netif_receive_skb)
|
||||
DUMMY_SKIP(-1, write_lock)
|
||||
DUMMY_SKIP(-1, write_lock_bh)
|
||||
DUMMY_SKIP(-1, write_lock_irq)
|
||||
DUMMY_SKIP(-1, write_seqlock)
|
||||
DUMMY_SKIP(-1, write_seqlock_bh)
|
||||
DUMMY_SKIP(-1, write_sequnlock)
|
||||
DUMMY_SKIP(-1, write_sequnlock_bh)
|
||||
DUMMY_SKIP(-1, write_unlock)
|
||||
DUMMY_SKIP(-1, write_unlock_bh)
|
||||
DUMMY_SKIP(-1, write_unlock_irq)
|
||||
|
||||
/* requires CONFIG_MEMCG_KMEM */
|
||||
DUMMY_SKIP(-1, sock_release_memcg)
|
||||
|
||||
DUMMY_SKIP(-1, waitqueue_active)
|
||||
DUMMY_SKIP(-1, wake_up)
|
||||
|
||||
/*
|
||||
* Test
|
||||
*/
|
||||
DUMMY_SKIP(-1, rtmsg_ifinfo)
|
||||
DUMMY_RET(0, rtnl_is_locked)
|
||||
DUMMY_SKIP(-1, rtnl_lock)
|
||||
DUMMY(-1, rtnl_set_sk_err)
|
||||
DUMMY_SKIP(-1, rtnl_unlock)
|
||||
DUMMY_RET(0, rtnetlink_put_metrics)
|
||||
DUMMY(-1, rtnl_af_register)
|
||||
DUMMY(-1, rtnl_put_cacheinfo)
|
||||
DUMMY_SKIP(-1, rtnl_register)
|
||||
DUMMY(-1, rtnl_unicast)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Dummies
|
||||
*/
|
||||
DUMMY(-1, access_ok)
|
||||
DUMMY(-1, add_device_randomness)
|
||||
DUMMY(-1, addrconf_finite_timeout)
|
||||
DUMMY(-1, addrconf_timeout_fixup)
|
||||
DUMMY(-1, add_wait_queue)
|
||||
DUMMY(-1, add_wait_queue_exclusive)
|
||||
DUMMY(-1, atomic_notifier_call_chain)
|
||||
DUMMY(-1, atomic_notifier_chain_register)
|
||||
DUMMY(-1, atomic_notifier_chain_unregister)
|
||||
DUMMY(-1, audit_enabled)
|
||||
DUMMY(-1, audit_get_loginuid)
|
||||
DUMMY(-1, audit_get_sessionid)
|
||||
DUMMY(-1, audit_log)
|
||||
DUMMY(-1, autoremove_wake_function)
|
||||
DUMMY(-1, blocking_notifier_chain_unregister)
|
||||
DUMMY(-1, call_netevent_notifiers)
|
||||
DUMMY(-1, cancel_delayed_work)
|
||||
DUMMY(-1, cancel_delayed_work_sync)
|
||||
DUMMY(-1, capable)
|
||||
DUMMY(-1, cipso_v4_validate)
|
||||
DUMMY(-1, __clear_bit)
|
||||
DUMMY(-1, clear_bit)
|
||||
DUMMY(-1, cond_resched)
|
||||
DUMMY(-1, cond_resched_softirq)
|
||||
DUMMY(-1, __copy_from_user_nocache)
|
||||
DUMMY(-1, csum_block_sub)
|
||||
DUMMY(-1, csum_replace2)
|
||||
DUMMY(-1, csum_sub)
|
||||
DUMMY(-1, csum_unfold)
|
||||
DUMMY(-1, current)
|
||||
DUMMY(-1, current_egid)
|
||||
DUMMY(-1, current_text_addr)
|
||||
DUMMY(-1, del_timer_sync)
|
||||
DUMMY(-1, dev_driver_string)
|
||||
DUMMY(-1, device_rename)
|
||||
DUMMY(-1, dev_ioctl)
|
||||
DUMMY(-1, dev_is_pci)
|
||||
DUMMY(-1, dev_load)
|
||||
DUMMY(-1, dev_name)
|
||||
DUMMY(-1, dev_num_vf)
|
||||
DUMMY(-1, dev_printk_emit)
|
||||
DUMMY(-1, div64_u64)
|
||||
DUMMY(-1, div_u64)
|
||||
DUMMY(-1, do_softirq)
|
||||
DUMMY(-1, dump_stack)
|
||||
DUMMY(-1, ether_addr_equal_64bits)
|
||||
DUMMY(-1, exit_fn)
|
||||
DUMMY(-1, file_inode)
|
||||
DUMMY(-1, free_pages)
|
||||
DUMMY(-1, from_kgid)
|
||||
DUMMY(-1, from_kgid_munged)
|
||||
DUMMY(-1, from_kuid)
|
||||
DUMMY(-1, from_kuid_munged)
|
||||
DUMMY(-1, generic_pipe_buf_confirm)
|
||||
DUMMY(-1, generic_pipe_buf_map)
|
||||
DUMMY(-1, generic_pipe_buf_unmap)
|
||||
DUMMY(-1, gen_kill_estimator)
|
||||
DUMMY(-1, get_current_groups)
|
||||
DUMMY(-1, get_ds)
|
||||
DUMMY(-1, __get_free_pages)
|
||||
|
||||
DUMMY_SKIP(0, get_fs)
|
||||
DUMMY_SKIP(0, set_fs)
|
||||
|
||||
DUMMY(-1, get_net_ns_by_fd)
|
||||
DUMMY(-1, get_net_ns_by_pid)
|
||||
DUMMY(-1, getnstimeofday)
|
||||
DUMMY(-1, get_nulls_value)
|
||||
DUMMY(-1, get_options)
|
||||
DUMMY(-1, get_page)
|
||||
DUMMY(-1, gfp_pfmemalloc_allowed)
|
||||
DUMMY(-1, gid_lte)
|
||||
DUMMY(-1, hash32_ptr)
|
||||
DUMMY(-1, hex_to_bin)
|
||||
DUMMY(-1, hlist_add_after_rcu)
|
||||
DUMMY(-1, hlist_add_before_rcu)
|
||||
DUMMY(-1, hlist_nulls_del)
|
||||
DUMMY(-1, hlist_nulls_empty)
|
||||
DUMMY(-1, hotcpu_notifier)
|
||||
DUMMY_STOP(0, hweight64)
|
||||
DUMMY(-1, inet_ctl_sock_destroy)
|
||||
DUMMY(-1, inet_diag_dump_icsk)
|
||||
DUMMY(-1, inet_diag_dump_one_icsk)
|
||||
DUMMY(-1, inet_diag_register)
|
||||
DUMMY(-1, inet_diag_unregister)
|
||||
DUMMY(-1, INET_ECN_dontxmit)
|
||||
DUMMY(-1, INET_ECN_is_not_ect)
|
||||
DUMMY(-1, INET_ECN_xmit)
|
||||
DUMMY(-1, inet_twdr_hangman)
|
||||
DUMMY(-1, inet_twdr_twcal_tick)
|
||||
DUMMY(-1, inet_twdr_twkill_work)
|
||||
DUMMY(-1, inet_twsk_bind_unhash)
|
||||
DUMMY(-1, inet_twsk_deschedule)
|
||||
DUMMY(-1, __inet_twsk_hashdance)
|
||||
DUMMY(-1, inet_twsk_purge)
|
||||
DUMMY(-1, inet_twsk_put)
|
||||
DUMMY(-1, inet_twsk_schedule)
|
||||
DUMMY(-1, inet_twsk_unhash)
|
||||
DUMMY(-1, inet_v6_ipv6only)
|
||||
DUMMY(-1, INIT_DEFERRABLE_WORK)
|
||||
DUMMY(-1, INIT_HLIST_NULLS_HEAD)
|
||||
DUMMY(-1, init_user_ns)
|
||||
DUMMY(-1, init_waitqueue_head)
|
||||
DUMMY(-1, INIT_WORK)
|
||||
DUMMY(-1, in_softirq)
|
||||
DUMMY(-1, ip_check_mc_rcu)
|
||||
DUMMY(-1, ip_mc_destroy_dev)
|
||||
DUMMY(-1, ip_mc_down)
|
||||
DUMMY(-1, ip_mc_drop_socket)
|
||||
DUMMY(-1, ip_mc_init_dev)
|
||||
DUMMY(-1, ip_mc_join_group)
|
||||
DUMMY(-1, ip_mc_leave_group)
|
||||
DUMMY(-1, ip_mc_msfilter)
|
||||
DUMMY(-1, ip_mc_remap)
|
||||
DUMMY(-1, ip_mc_sf_allow)
|
||||
DUMMY(-1, ip_mc_source)
|
||||
DUMMY(-1, ip_mc_unmap)
|
||||
DUMMY(-1, ip_mc_up)
|
||||
DUMMY(-1, ip_mroute_getsockopt)
|
||||
DUMMY(-1, ip_mroute_opt)
|
||||
DUMMY(-1, ip_mroute_setsockopt)
|
||||
DUMMY(-1, ipv4_is_local_multicast)
|
||||
DUMMY(-1, irqs_disabled)
|
||||
DUMMY(-1, is_vlan_dev)
|
||||
DUMMY(-1, kernel_sendmsg)
|
||||
DUMMY(-1, kobject_put)
|
||||
DUMMY(-1, kobject_uevent)
|
||||
DUMMY(-1, krealloc)
|
||||
DUMMY(-1, kstrdup)
|
||||
DUMMY(-1, ktime_equal)
|
||||
DUMMY(-1, ktime_to_timespec)
|
||||
DUMMY(-1, ktime_to_timeval)
|
||||
DUMMY(-1, ktime_us_delta)
|
||||
DUMMY(-1, kunmap)
|
||||
DUMMY(-1, kunmap_atomic)
|
||||
DUMMY(-1, linkwatch_fire_event)
|
||||
DUMMY(-1, linkwatch_forget_dev)
|
||||
DUMMY(-1, linkwatch_init_dev)
|
||||
DUMMY(-1, linkwatch_run_queue)
|
||||
DUMMY(-1, local_softirq_pending)
|
||||
DUMMY(-1, lockdep_rtnl_is_held)
|
||||
DUMMY(-1, module_put)
|
||||
DUMMY(-1, move_addr_to_kernel)
|
||||
DUMMY(-1, mq_qdisc_ops)
|
||||
DUMMY(-1, msleep)
|
||||
DUMMY(-1, mutex_is_locked)
|
||||
DUMMY(-1, need_resched)
|
||||
DUMMY(-1, netdev_queue_update_kobjects)
|
||||
DUMMY(-1, netdev_unregister_kobject)
|
||||
DUMMY(-1, net_dmaengine_get)
|
||||
DUMMY(-1, net_dmaengine_put)
|
||||
DUMMY(-1, net_eq)
|
||||
DUMMY(-1, net_namespace_list)
|
||||
DUMMY(-1, netpoll_poll_lock)
|
||||
DUMMY(-1, netpoll_poll_unlock)
|
||||
DUMMY(-1, netpoll_rx_enable)
|
||||
DUMMY(-1, netpoll_rx_on)
|
||||
DUMMY(-1, next_pseudo_random32)
|
||||
DUMMY(-1, nf_bridge_pad)
|
||||
DUMMY(-1, nf_ct_attach)
|
||||
DUMMY(-1, nla_find)
|
||||
DUMMY(-1, nla_memcpy)
|
||||
DUMMY(-1, nla_parse)
|
||||
DUMMY(-1, nla_reserve)
|
||||
DUMMY(-1, nla_strcmp)
|
||||
DUMMY(-1, nla_strlcpy)
|
||||
DUMMY(-1, nla_validate)
|
||||
DUMMY(-1, notifier_from_errno)
|
||||
DUMMY(-1, num_online_cpus)
|
||||
DUMMY(-1, on_each_cpu)
|
||||
DUMMY(-1, open_softirq)
|
||||
DUMMY(-1, PageHighMem)
|
||||
DUMMY(-1, percpu_counter_destroy)
|
||||
DUMMY(-1, percpu_counter_sum_positive)
|
||||
DUMMY(-1, pid_vnr)
|
||||
DUMMY(-1, pr_crit)
|
||||
DUMMY(-1, pr_err_once)
|
||||
DUMMY(-1, preempt_disable)
|
||||
DUMMY(-1, preempt_enable)
|
||||
DUMMY(-1, prefetch)
|
||||
DUMMY(-1, pr_emerg)
|
||||
|
||||
DUMMY_SKIP(0, finish_wait)
|
||||
DUMMY_SKIP(0, prepare_to_wait)
|
||||
DUMMY_SKIP(0, prepare_to_wait_exclusive)
|
||||
|
||||
DUMMY(-1, pr_err)
|
||||
DUMMY(-1, pr_info)
|
||||
DUMMY(-1, pr_info_once)
|
||||
DUMMY(-1, pr_warn)
|
||||
DUMMY(-1, put_cmsg)
|
||||
DUMMY(-1, put_cpu)
|
||||
DUMMY(-1, put_cpu_var)
|
||||
DUMMY(-1, put_cred)
|
||||
DUMMY(-1, put_device)
|
||||
DUMMY(-1, put_pid)
|
||||
DUMMY(-1, __raise_softirq_irqoff)
|
||||
DUMMY(-1, raise_softirq_irqoff)
|
||||
DUMMY(-1, random32)
|
||||
DUMMY(-1, ___ratelimit)
|
||||
DUMMY(-1, raw_notifier_chain_unregister)
|
||||
DUMMY(-1, rcu_barrier)
|
||||
DUMMY(-1, register_gifconf)
|
||||
DUMMY(-1, release_net)
|
||||
DUMMY(-1, remove_proc_entry)
|
||||
DUMMY(-1, remove_wait_queue)
|
||||
DUMMY(-1, request_module)
|
||||
DUMMY(-1, rt_genid_bump)
|
||||
DUMMY(-1, rtnetlink_init)
|
||||
DUMMY(-1, __rtnl_unlock)
|
||||
DUMMY_STOP(-1, schedule)
|
||||
DUMMY_STOP(-1, schedule_timeout_interruptible)
|
||||
DUMMY_STOP(-1, schedule_work)
|
||||
DUMMY(-1, scm_destroy)
|
||||
DUMMY(-1, scm_recv)
|
||||
DUMMY(-1, scm_send)
|
||||
DUMMY(-1, scnprintf)
|
||||
DUMMY(-1, secpath_reset)
|
||||
DUMMY(-1, secure_ip_id)
|
||||
DUMMY(-1, secure_ipv4_port_ephemeral)
|
||||
DUMMY(-1, secure_ipv6_id)
|
||||
DUMMY(-1, secure_tcp_sequence_number)
|
||||
DUMMY(-1, security_inet_conn_established)
|
||||
DUMMY(-1, security_inet_csk_clone)
|
||||
DUMMY(-1, security_netlink_send)
|
||||
DUMMY(-1, security_release_secctx)
|
||||
DUMMY(-1, security_req_classify_flow)
|
||||
DUMMY(-1, security_skb_classify_flow)
|
||||
DUMMY(-1, security_skb_owned_by)
|
||||
DUMMY(-1, security_sk_classify_flow)
|
||||
DUMMY(-1, security_sk_free)
|
||||
DUMMY(-1, security_socket_getpeersec_dgram)
|
||||
DUMMY(-1, security_socket_getpeersec_stream)
|
||||
DUMMY(-1, security_sock_graft)
|
||||
DUMMY(-1, send_sigurg)
|
||||
DUMMY(-1, send_sig)
|
||||
DUMMY_STOP(-1, set_bit)
|
||||
DUMMY(-1, __set_current_state)
|
||||
DUMMY(-1, set_current_state)
|
||||
DUMMY_STOP(-1, sg_mark_end)
|
||||
DUMMY_STOP(-1, sg_set_buf)
|
||||
DUMMY_STOP(-1, sg_set_page)
|
||||
DUMMY(-1, sha_transform)
|
||||
DUMMY(-1, si_meminfo)
|
||||
DUMMY(-1, S_ISSOCK)
|
||||
DUMMY(-1, sk_attach_filter)
|
||||
DUMMY(-1, sk_detach_filter)
|
||||
DUMMY(-1, sk_filter_len)
|
||||
DUMMY(-1, sk_filter_release_rcu)
|
||||
DUMMY(-1, sk_get_filter)
|
||||
DUMMY(-1, smp_mb__after_clear_bit)
|
||||
DUMMY(-1, smp_mb__before_atomic_dec)
|
||||
DUMMY(-1, __sock_recv_timestamp)
|
||||
DUMMY(-1, __sock_recv_ts_and_drops)
|
||||
DUMMY(-1, __sock_recv_wifi_status)
|
||||
DUMMY(-1, sock_release)
|
||||
DUMMY(-1, sock_update_classid)
|
||||
DUMMY(-1, sock_update_memcg)
|
||||
DUMMY(-1, sock_update_netprioidx)
|
||||
DUMMY(-1, sock_wake_async)
|
||||
DUMMY(-1, splice_to_pipe)
|
||||
DUMMY(-1, srandom32)
|
||||
DUMMY(-1, ssleep)
|
||||
DUMMY(-1, static_key_enabled)
|
||||
DUMMY(-1, static_key_slow_dec)
|
||||
DUMMY(-1, static_key_slow_inc)
|
||||
DUMMY(-1, strcat)
|
||||
DUMMY(-1, strsep)
|
||||
DUMMY(-1, strncpy_from_user)
|
||||
DUMMY(-1, synchronize_rcu_expedited)
|
||||
DUMMY(-1, sysctl_igmp_max_msf)
|
||||
DUMMY(-1, sysctl_tcp_fastopen)
|
||||
DUMMY(-1, system_wq)
|
||||
DUMMY(-1, tasklet_init)
|
||||
DUMMY(-1, tasklet_schedule)
|
||||
DUMMY(-1, task_pid_nr)
|
||||
DUMMY(-1, task_tgid_vnr)
|
||||
DUMMY(-1, tcp_fastopen_cache_get)
|
||||
DUMMY(-1, tcp_fastopen_cache_set)
|
||||
DUMMY(-1, tcp_fastopen_cookie_gen)
|
||||
DUMMY(-1, tcp_fetch_timewait_stamp)
|
||||
DUMMY(-1, tcp_hdrlen)
|
||||
DUMMY(-1, tcp_init_metrics)
|
||||
DUMMY(-1, tcp_metrics_init)
|
||||
DUMMY(-1, tcp_peer_is_proven)
|
||||
DUMMY(-1, tcp_remember_stamp)
|
||||
DUMMY(-1, tcp_tw_remember_stamp)
|
||||
DUMMY(-1, tcp_update_metrics)
|
||||
DUMMY(-1, textsearch_find)
|
||||
DUMMY(-1, __this_cpu_read)
|
||||
DUMMY_SKIP(-1, trace_napi_poll)
|
||||
DUMMY_SKIP(-1, trace_net_dev_queue)
|
||||
DUMMY_SKIP(-1, trace_netif_rx)
|
||||
DUMMY_SKIP(-1, trace_skb_copy_datagram_iovec)
|
||||
DUMMY_SKIP(-1, trace_sock_exceed_buf_limit)
|
||||
DUMMY_SKIP(-1, trace_sock_rcvqueue_full)
|
||||
DUMMY_SKIP(-1, trace_udp_fail_queue_rcv_skb)
|
||||
DUMMY(-1, tsk_restore_flags)
|
||||
DUMMY(-1, u64_stats_fetch_begin_bh)
|
||||
DUMMY(-1, u64_stats_fetch_retry_bh)
|
||||
DUMMY(-1, u64_stats_update_begin)
|
||||
DUMMY(-1, u64_stats_update_end)
|
||||
DUMMY(-1, udplite4_register)
|
||||
DUMMY(-1, uid_eq)
|
||||
DUMMY(-1, virt_to_page)
|
||||
DUMMY(-1, vlan_do_receive)
|
||||
DUMMY(-1, __vlan_put_tag)
|
||||
DUMMY(-1, vlan_untag)
|
||||
DUMMY(-1, vzalloc)
|
||||
DUMMY(-1, wake_up_interruptible)
|
||||
DUMMY(-1, wake_up_interruptible_all)
|
||||
DUMMY(-1, wake_up_interruptible_poll)
|
||||
DUMMY(-1, wake_up_interruptible_sync_poll)
|
||||
DUMMY(-1, WARN_ONCE)
|
||||
DUMMY(-1, write_seqcount_begin)
|
||||
DUMMY(-1, write_seqcount_end)
|
||||
DUMMY(-1, xfrm4_policy_check_reverse)
|
||||
DUMMY(-1, xfrm4_route_forward)
|
||||
DUMMY(-1, xfrm4_udp_encap_rcv)
|
||||
DUMMY(-1, xfrm_sk_free_policy)
|
||||
DUMMY(-1, xfrm_user_policy)
|
||||
DUMMY(-1, yield)
|
||||
|
||||
DUMMY(0, __inet_twsk_schedule)
|
||||
// DUMMY_RET(0xdeadbeef, __netlink_kernel_create) /* needs to be != 0, otherwise FIB will nag */
|
||||
// DUMMY(0, __nlmsg_put)
|
||||
DUMMY(0, __skb_flow_dissect)
|
||||
DUMMY(0, __skb_get_hash)
|
||||
DUMMY(0, __skb_get_poff)
|
||||
DUMMY(0, __sock_tx_timestamp)
|
||||
DUMMY(0, __this_cpu_write)
|
||||
DUMMY(0, __vlan_get_protocol)
|
||||
DUMMY(0, __vlan_hwaccel_push_inside)
|
||||
DUMMY(0, __vlan_hwaccel_put_tag)
|
||||
DUMMY(0, __vlan_insert_tag)
|
||||
DUMMY(0, bpf_tell_extensions)
|
||||
DUMMY_STOP(0, cancel_work_sync)
|
||||
DUMMY_STOP(0, copy_from_iter_nocache)
|
||||
// DUMMY(0, core_netlink_proto_init)
|
||||
// DUMMY(0, csum_and_copy_from_iter)
|
||||
// DUMMY_STOP(0, csum_and_copy_to_iter)
|
||||
DUMMY(0, csum_ipv6_magic)
|
||||
DUMMY(0, csum_replace4)
|
||||
DUMMY(0, file_ns_capable)
|
||||
DUMMY(0, flow_keys_buf_dissector)
|
||||
DUMMY(0, fnhe_genid)
|
||||
DUMMY(0, gfpflags_allow_blocking)
|
||||
DUMMY(0, hlist_add_behind_rcu)
|
||||
DUMMY(0, hlist_replace_rcu)
|
||||
DUMMY(0, hrtimer_cancel)
|
||||
DUMMY(0, hrtimer_init)
|
||||
DUMMY(0, hrtimer_start)
|
||||
DUMMY(0, icmp6_hdr)
|
||||
DUMMY(0, inet_twsk_deschedule_put)
|
||||
DUMMY(0, inet_twsk_free)
|
||||
DUMMY_STOP(0, iov_iter_advance)
|
||||
DUMMY_STOP(0, iov_iter_get_pages)
|
||||
DUMMY(0, ip_tunnel_core_init)
|
||||
DUMMY(0, iptunnel_metadata_reply)
|
||||
DUMMY(0, ipv6_hdr)
|
||||
DUMMY(0, ipv6_sk_rxinfo)
|
||||
DUMMY(0, is_vmalloc_addr)
|
||||
DUMMY(0, kstrtou8)
|
||||
DUMMY(0, kvfree)
|
||||
|
||||
/* only relevant when CONFIG_NET_L3_MASTER_DEV set */
|
||||
DUMMY_RET(0, l3mdev_fib_oif_rcu)
|
||||
DUMMY_RET(0, l3mdev_fib_table) /* 0 is valid if !CONFIG_IP_MULTIPLE_TABLES */
|
||||
DUMMY_RET(0, l3mdev_fib_table_by_index)
|
||||
DUMMY_RET(0, l3mdev_get_rtable)
|
||||
DUMMY_RET(0, l3mdev_get_saddr)
|
||||
DUMMY_RET(0, l3mdev_master_ifindex)
|
||||
DUMMY_RET(0, l3mdev_master_ifindex_rcu)
|
||||
|
||||
DUMMY(0, local_clock)
|
||||
|
||||
/* only relevant when CONFIG_LWTUNNEL set */
|
||||
DUMMY(0, lwt_tun_info)
|
||||
DUMMY(0, lwtstate_free)
|
||||
DUMMY(0, lwtstate_get)
|
||||
DUMMY_RET(0, lwtstate_put) /* no return value */
|
||||
DUMMY_RET(0, lwtunnel_cmp_encap)
|
||||
DUMMY(0, lwtunnel_fill_encap)
|
||||
DUMMY(0, lwtunnel_get_encap_size)
|
||||
DUMMY(0, lwtunnel_input_redirect)
|
||||
DUMMY(0, lwtunnel_output_redirect)
|
||||
|
||||
DUMMY(0, make_kgid)
|
||||
DUMMY(0, mod_timer_pending)
|
||||
DUMMY(0, mod_timer_pinned)
|
||||
DUMMY(0, netif_index_is_l3_master)
|
||||
// DUMMY(0, netlink_kernel_release)
|
||||
// DUMMY(0, netlink_unicast)
|
||||
DUMMY(0, netpoll_poll_disable)
|
||||
DUMMY(0, netpoll_poll_enable)
|
||||
DUMMY(0, nf_hook_ingress_init)
|
||||
DUMMY(0, nosteal_pipe_buf_ops)
|
||||
DUMMY(0, ns_to_ktime)
|
||||
DUMMY(0, page_is_pfmemalloc)
|
||||
DUMMY(0, page_private)
|
||||
DUMMY(0, percpu_counter_sum)
|
||||
DUMMY(0, pr_warn_once)
|
||||
DUMMY(0, prandom_seed)
|
||||
DUMMY(0, prandom_u32_max)
|
||||
DUMMY(0, put_group_info)
|
||||
DUMMY_SHOW(0, queue_delayed_work)
|
||||
DUMMY(0, raw_seqcount_begin)
|
||||
DUMMY(0, read_seqcount_retry)
|
||||
DUMMY(0, reciprocal_scale)
|
||||
DUMMY(0, round_down)
|
||||
DUMMY(0, rtmsg_ifinfo_build_skb)
|
||||
DUMMY(0, rtmsg_ifinfo_send)
|
||||
DUMMY_SKIP(0, sched_annotate_sleep)
|
||||
DUMMY(0, set_page_private)
|
||||
DUMMY(0, sk_attach_bpf)
|
||||
DUMMY(0, sk_busy_loop)
|
||||
DUMMY(0, sk_can_busy_loop)
|
||||
DUMMY(0, sk_filter_charge)
|
||||
DUMMY(0, sk_filter_uncharge)
|
||||
DUMMY(0, sk_mark_napi_id)
|
||||
DUMMY(0, skb_vlan_tag_get)
|
||||
DUMMY(0, skb_vlan_tag_get_id)
|
||||
DUMMY(0, skb_vlan_tag_present)
|
||||
DUMMY(0, skb_vlan_tagged)
|
||||
DUMMY(0, smp_mb__after_atomic)
|
||||
DUMMY(0, sock_diag_broadcast_destroy)
|
||||
DUMMY(0, sock_diag_has_destroy_listeners)
|
||||
|
||||
/* only relevant when CONFIG_NET_SWITCHDEV was set */
|
||||
DUMMY_RET(0, switchdev_fib_ipv4_abort) /* actually void, no return value */
|
||||
DUMMY_RET(0, switchdev_fib_ipv4_add)
|
||||
DUMMY_RET(0, switchdev_fib_ipv4_del)
|
||||
|
||||
DUMMY(0, sysctl_tcp_recovery)
|
||||
DUMMY(0, sysfs_create_link)
|
||||
DUMMY(0, sysfs_remove_link)
|
||||
DUMMY(0, tcp_fastopen_init_key_once)
|
||||
DUMMY(0, tcp_rack_advance)
|
||||
DUMMY(0, tcp_rack_mark_lost)
|
||||
DUMMY(0, tcp_try_fastopen)
|
||||
DUMMY(0, tcpv4_offload_init)
|
||||
DUMMY(0, this_cpu_ksoftirqd)
|
||||
DUMMY_SKIP(0, trace_fib_table_lookup)
|
||||
DUMMY_SKIP(0, trace_fib_table_lookup_nh)
|
||||
DUMMY_SKIP(0, trace_fib_validate_source)
|
||||
DUMMY_SKIP(0, trace_napi_gro_frags_entry)
|
||||
DUMMY_SKIP(0, trace_napi_gro_receive_entry)
|
||||
DUMMY_SKIP(0, trace_net_dev_start_xmit)
|
||||
DUMMY_SKIP(0, trace_netif_receive_skb_entry)
|
||||
DUMMY_SKIP(0, trace_netif_rx_entry)
|
||||
DUMMY_SKIP(0, trace_netif_rx_ni_entry)
|
||||
DUMMY(0, u64_stats_fetch_begin_irq)
|
||||
DUMMY(0, u64_stats_fetch_retry_irq)
|
||||
DUMMY(0, u64_stats_init)
|
||||
DUMMY(0, udpv4_offload_init)
|
||||
DUMMY(0, vlan_features_check)
|
||||
DUMMY(0, vlan_hw_offload_capable)
|
||||
DUMMY(0, vlan_set_encap_proto)
|
||||
DUMMY(0, wait_woken)
|
||||
DUMMY_STOP(0, work_pending)
|
||||
DUMMY(0, __module_get)
|
||||
DUMMY_RET(0, peernet2id)
|
||||
DUMMY(0, ktime_get_ns)
|
||||
DUMMY(0, ipv6_get_dsfield)
|
||||
|
||||
DUMMY_SKIP(0, spin_lock_init)
|
||||
DUMMY_SKIP(0, spin_lock_nested)
|
||||
DUMMY_SKIP(0, spin_lock)
|
||||
DUMMY_SKIP(0, spin_unlock)
|
||||
DUMMY_SKIP(0, spin_lock_bh)
|
||||
DUMMY_SKIP(0, spin_unlock_bh)
|
||||
|
||||
DUMMY(0, peernet_has_id)
|
||||
|
||||
} /* extern "C" */
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* \brief Dummies that cannot be implemented with the DUMMY macros
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2014-02-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* local includes */
|
||||
#include <lx_emul.h>
|
||||
|
||||
|
||||
int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
|
||||
{
|
||||
printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0));
|
||||
|
||||
*seclen = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
|
||||
struct ip_msfilter *optval, int *optlen)
|
||||
{
|
||||
printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0));
|
||||
|
||||
*optlen = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
|
||||
struct group_filter *optval, int *optlen)
|
||||
{
|
||||
printk("%s called (from %p) not implemented", __func__, __builtin_return_address(0));
|
||||
|
||||
*optlen = 0;
|
||||
return -1;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#define __UAPI_DEF_IN_ADDR 1
|
||||
#define __UAPI_DEF_SOCKADDR_IN 1
|
||||
#include <uapi/linux/in.h>
|
||||
#undef __UAPI_DEF_SOCKADDR_IN
|
||||
#undef __UAPI_DEF_IN_ADDR
|
@ -1,5 +0,0 @@
|
||||
#define __UAPI_DEF_IPPROTO_V6 1
|
||||
#define __UAPI_DEF_IN6_ADDR 1
|
||||
#include <uapi/linux/in6.h>
|
||||
#undef __UAPI_DEF_IN6_ADDR
|
||||
#undef __UAPI_DEF_IPPROTO_V6
|
@ -1,2 +0,0 @@
|
||||
#include <uapi/linux/in.h>
|
||||
#include <uapi/linux/ip.h>
|
@ -1,2 +0,0 @@
|
||||
#include <linux/udp.h>
|
||||
#include <net/inet_timewait_sock.h>
|
@ -1,3 +0,0 @@
|
||||
#ifndef pr_fmt
|
||||
#define pr_fmt(fmt) fmt
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
#include <uapi/linux/netfilter.h>
|
@ -1 +0,0 @@
|
||||
#include <uapi/linux/netfilter.h>
|
@ -1,2 +0,0 @@
|
||||
#include <uapi/asm-generic/socket.h>
|
||||
#include <uapi/linux/sockios.h>
|
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* \brief Complete initialization of msghdr
|
||||
* \author Christian Helmuth
|
||||
* \date 2017-05-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 202017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _MSGHDR_H_
|
||||
#define _MSGHDR_H_
|
||||
|
||||
#include <legacy/lx_emul/extern_c_begin.h>
|
||||
#include <linux/socket.h>
|
||||
#include <legacy/lx_emul/extern_c_end.h>
|
||||
|
||||
|
||||
static inline msghdr create_msghdr(void *name, int namelen, size_t datalen,
|
||||
struct iovec *iov)
|
||||
{
|
||||
msghdr msg;
|
||||
|
||||
msg.msg_name = name;
|
||||
msg.msg_namelen = namelen;
|
||||
msg.msg_iter.type = 0;
|
||||
msg.msg_iter.iov_offset = 0;
|
||||
msg.msg_iter.count = datalen;
|
||||
msg.msg_iter.iov = iov;
|
||||
msg.msg_iter.nr_segs = 1;
|
||||
msg.msg_control = nullptr;
|
||||
msg.msg_controllen = 0;
|
||||
msg.msg_flags = 0;
|
||||
msg.msg_iocb = nullptr;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
#endif /* _MSGHDR_H_ */
|
@ -1 +0,0 @@
|
||||
#include <uapi/linux/fib_rules.h>
|
@ -1 +0,0 @@
|
||||
#include <uapi/linux/gen_stats.h>
|
@ -1 +0,0 @@
|
||||
#include <net/inet_connection_sock.h>
|
@ -1,6 +0,0 @@
|
||||
#include <net/route.h>
|
||||
#include <linux/tcp.h>
|
||||
|
||||
struct ipv6hdr;
|
||||
|
||||
#include <net/dsfield.h>
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* \brief C back-end
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2013-09-09
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__NIC_H_
|
||||
#define _INCLUDE__NIC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void net_mac(void* mac, unsigned long size);
|
||||
int net_tx(void* addr, unsigned long len);
|
||||
void net_driver_rx(void *addr, unsigned long size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _INCLUDE__NIC_H_ */
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* \brief Lx env
|
||||
* \author Josef Soentgen
|
||||
* \author Emery Hemingway
|
||||
* \date 2014-10-17
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _LX_H_
|
||||
#define _LX_H_
|
||||
|
||||
#include <timer/timeout.h>
|
||||
#include <base/signal.h>
|
||||
|
||||
namespace Lx_kit { class Env; }
|
||||
|
||||
namespace Lx {
|
||||
|
||||
void nic_client_init(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
void (*ticker)());
|
||||
|
||||
void timer_init(Genode::Entrypoint &ep,
|
||||
::Timer::Connection &timer,
|
||||
Genode::Allocator &alloc,
|
||||
void (*ticker)());
|
||||
|
||||
void timer_update_jiffies();
|
||||
|
||||
void lxcc_emul_init(Lx_kit::Env &env);
|
||||
}
|
||||
|
||||
extern "C" void lxip_init();
|
||||
|
||||
extern "C" void lxip_configure_static(char const *addr,
|
||||
char const *netmask,
|
||||
char const *gateway,
|
||||
char const *nameserver);
|
||||
extern "C" void lxip_configure_dhcp();
|
||||
extern "C" void lxip_configure_mtu(unsigned mtu);
|
||||
|
||||
extern "C" bool lxip_do_dhcp();
|
||||
|
||||
#endif /* _LX_H_ */
|
@ -1,610 +0,0 @@
|
||||
/*
|
||||
* \brief Linux emulation code
|
||||
* \author Sebastian Sumpf
|
||||
* \author Josef Soentgen
|
||||
* \date 2013-08-30
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <uapi/linux/rtnetlink.h>
|
||||
#include <net/sock.h>
|
||||
#include <net/route.h>
|
||||
#include <net/ip_fib.h>
|
||||
#include <net/tcp.h>
|
||||
#include <net/tcp_states.h>
|
||||
|
||||
|
||||
/***********************
|
||||
** linux/genetlink.h **
|
||||
***********************/
|
||||
|
||||
/* needed by af_netlink.c */
|
||||
atomic_t genl_sk_destructing_cnt;
|
||||
wait_queue_head_t genl_sk_destructing_waitq;
|
||||
|
||||
|
||||
/****************************
|
||||
** asm-generic/atomic64.h **
|
||||
****************************/
|
||||
|
||||
long long atomic64_read(const atomic64_t *v)
|
||||
{
|
||||
return v->counter;
|
||||
}
|
||||
|
||||
|
||||
void atomic64_set(atomic64_t *v, long long i)
|
||||
{
|
||||
v->counter = i;
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** linux/bitmap.h **
|
||||
********************/
|
||||
|
||||
void bitmap_fill(unsigned long *dst, int nbits)
|
||||
{
|
||||
int count = nbits / (8 * sizeof (long));
|
||||
int i;
|
||||
|
||||
memset(dst, 0xff, count * sizeof(long));
|
||||
dst += count;
|
||||
|
||||
count = nbits % (8 * sizeof(long));
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
*dst |= (1 << i);
|
||||
}
|
||||
|
||||
|
||||
void bitmap_zero(unsigned long *dst, int nbits)
|
||||
{
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memset(dst, 0, len);
|
||||
}
|
||||
|
||||
|
||||
/*****************
|
||||
** linux/gfp.h **
|
||||
*****************/
|
||||
|
||||
unsigned long get_zeroed_page(gfp_t gfp_mask)
|
||||
{
|
||||
return (unsigned long)kzalloc(PAGE_SIZE, 0);
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** linux/percpu.h **
|
||||
********************/
|
||||
|
||||
void *__alloc_percpu(size_t size, size_t align)
|
||||
{
|
||||
return kzalloc(size, 0);
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
** linux/hash.h **
|
||||
******************/
|
||||
|
||||
u32 hash_32(u32 val, unsigned int bits)
|
||||
{
|
||||
enum { GOLDEN_RATIO_PRIME_32 = 0x9e370001UL };
|
||||
u32 hash = val * GOLDEN_RATIO_PRIME_32;
|
||||
|
||||
hash = hash >> (32 - bits);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
** linux/dcache **
|
||||
******************/
|
||||
|
||||
unsigned int full_name_hash(const unsigned char *name, unsigned int len)
|
||||
{
|
||||
unsigned hash = 0, i;
|
||||
for (i = 0; i < len; i++)
|
||||
hash += name[i];
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/******************************
|
||||
* net/core/net/namespace.h **
|
||||
******************************/
|
||||
|
||||
int register_pernet_subsys(struct pernet_operations *ops)
|
||||
{
|
||||
if (ops->init)
|
||||
ops->init(&init_net);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int register_pernet_device(struct pernet_operations *ops)
|
||||
{
|
||||
return register_pernet_subsys(ops);
|
||||
}
|
||||
|
||||
|
||||
/*************************
|
||||
** net/net_namespace.h **
|
||||
*************************/
|
||||
|
||||
int rt_genid(struct net *net)
|
||||
{
|
||||
int ret = atomic_read(&net->rt_genid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rt_genid_ipv4(struct net *net)
|
||||
{
|
||||
return atomic_read(&net->ipv4.rt_genid);
|
||||
}
|
||||
|
||||
void rt_genid_bump_ipv4(struct net *net)
|
||||
{
|
||||
atomic_inc(&net->ipv4.rt_genid);
|
||||
}
|
||||
|
||||
/**********************
|
||||
** linx/rtnetlink.h **
|
||||
**********************/
|
||||
|
||||
struct netdev_queue *dev_ingress_queue(struct net_device *dev)
|
||||
{
|
||||
return dev->ingress_queue;
|
||||
}
|
||||
|
||||
void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
|
||||
struct nlmsghdr *nlh, gfp_t flags)
|
||||
{
|
||||
nlmsg_free(skb);
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
** linux/ip.h **
|
||||
****************/
|
||||
|
||||
struct iphdr *ip_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct iphdr *)skb_network_header(skb);
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
** asm-generic/bitops/find.h **
|
||||
*******************************/
|
||||
|
||||
unsigned long find_first_zero_bit(unsigned long const *addr, unsigned long size)
|
||||
{
|
||||
unsigned long i, j;
|
||||
|
||||
for (i = 0; i < (size / BITS_PER_LONG); i++)
|
||||
if (addr[i] != ~0UL)
|
||||
break;
|
||||
|
||||
if (i == size)
|
||||
return size;
|
||||
|
||||
for (j = 0; j < BITS_PER_LONG; j++)
|
||||
if ((~addr[i]) & (1 << j))
|
||||
break;
|
||||
|
||||
return (i * BITS_PER_LONG) + j;
|
||||
}
|
||||
|
||||
|
||||
/****************************
|
||||
** asm-generic/getorder.h **
|
||||
****************************/
|
||||
|
||||
int get_order(unsigned long size)
|
||||
{
|
||||
int order;
|
||||
|
||||
size--;
|
||||
size >>= PAGE_SHIFT;
|
||||
|
||||
order = __builtin_ctzl(size);
|
||||
return order;
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
** linux/jiffies.h **
|
||||
*********************/
|
||||
|
||||
clock_t jiffies_to_clock_t(unsigned long j)
|
||||
{
|
||||
return j / HZ; /* XXX not sure if this is enough */
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
** linux/utsname.h **
|
||||
*********************/
|
||||
|
||||
struct uts_name init_uts_ns;
|
||||
|
||||
struct new_utsname *init_utsname(void) { return &init_uts_ns.name; }
|
||||
struct new_utsname *utsname(void) { return init_utsname(); }
|
||||
|
||||
|
||||
/**********************
|
||||
** linux/notifier.h **
|
||||
**********************/
|
||||
|
||||
int raw_notifier_chain_register(struct raw_notifier_head *nh,
|
||||
struct notifier_block *n)
|
||||
{
|
||||
struct notifier_block *nl = nh->head;
|
||||
struct notifier_block *pr = 0;
|
||||
while (nl) {
|
||||
if (n->priority > nl->priority)
|
||||
break;
|
||||
pr = nl;
|
||||
nl = nl->next;
|
||||
}
|
||||
|
||||
n->next = nl;
|
||||
if (pr)
|
||||
pr->next = n;
|
||||
else
|
||||
nh->head = n;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int raw_notifier_call_chain(struct raw_notifier_head *nh,
|
||||
unsigned long val, void *v)
|
||||
{
|
||||
int ret = NOTIFY_DONE;
|
||||
struct notifier_block *nb = nh->head;
|
||||
|
||||
while (nb) {
|
||||
|
||||
ret = nb->notifier_call(nb, val, v);
|
||||
if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
|
||||
break;
|
||||
|
||||
nb = nb->next;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
|
||||
struct notifier_block *n)
|
||||
{
|
||||
return raw_notifier_chain_register((struct raw_notifier_head *)nh, n);
|
||||
}
|
||||
|
||||
|
||||
int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
|
||||
unsigned long val, void *v)
|
||||
{
|
||||
return raw_notifier_call_chain((struct raw_notifier_head *)nh, val, v);
|
||||
}
|
||||
|
||||
|
||||
/****************************
|
||||
** asm-generic/checksum.h **
|
||||
****************************/
|
||||
|
||||
__sum16 csum_fold(__wsum csum)
|
||||
{
|
||||
u32 sum = (u32)csum;
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
return (__sum16)~sum;
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
** net/checksum.h **
|
||||
********************/
|
||||
|
||||
__wsum csum_add(__wsum csum, __wsum addend)
|
||||
{
|
||||
u32 res = (u32)csum;
|
||||
res += (u32)addend;
|
||||
return (__wsum)(res + (res < (u32)addend));
|
||||
}
|
||||
|
||||
|
||||
__wsum csum_block_add(__wsum csum, __wsum csum2, int offset)
|
||||
{
|
||||
u32 sum = (u32)csum2;
|
||||
if (offset&1)
|
||||
sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
|
||||
return csum_add(csum, (__wsum)sum);
|
||||
}
|
||||
|
||||
|
||||
__wsum csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
|
||||
{
|
||||
return csum_block_add(csum, csum2, offset);
|
||||
}
|
||||
|
||||
|
||||
/***************************
|
||||
** Linux socket function **
|
||||
***************************/
|
||||
|
||||
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)
|
||||
{
|
||||
struct socket *sock = (struct socket *)kzalloc(sizeof(struct socket), 0);
|
||||
|
||||
/*
|
||||
* Linux normally allocates the socket_wq when calling
|
||||
* sock_alloc_inode() while we do it here hoping for the best.
|
||||
*/
|
||||
sock->wq = (struct socket_wq*)kzalloc(sizeof(*sock->wq), 0);
|
||||
if (!sock->wq) {
|
||||
kfree(sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sock = sock_alloc();
|
||||
if (!sock) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static void sock_init(void)
|
||||
{
|
||||
skb_init();
|
||||
}
|
||||
|
||||
|
||||
core_initcall(sock_init);
|
||||
|
||||
|
||||
/*************************
|
||||
** Lxip initialization **
|
||||
*************************/
|
||||
|
||||
/*
|
||||
* Header declarations and tuning
|
||||
*/
|
||||
struct net init_net;
|
||||
|
||||
unsigned long *sysctl_local_reserved_ports;
|
||||
|
||||
|
||||
/**
|
||||
* nr_free_buffer_pages - count number of pages beyond high watermark
|
||||
*
|
||||
* nr_free_buffer_pages() counts the number of pages which are beyond the
|
||||
* high
|
||||
* watermark within ZONE_DMA and ZONE_NORMAL.
|
||||
*/
|
||||
unsigned long nr_free_buffer_pages(void)
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Declare stuff used
|
||||
*/
|
||||
int __ip_auto_config_setup(char *addrs);
|
||||
void core_sock_init(void);
|
||||
void core_netlink_proto_init(void);
|
||||
void subsys_net_dev_init(void);
|
||||
void fs_inet_init(void);
|
||||
void module_driver_init(void);
|
||||
void module_cubictcp_register(void);
|
||||
void late_ip_auto_config(void);
|
||||
void late_tcp_congestion_default(void);
|
||||
|
||||
|
||||
int __set_thash_entries(char *str);
|
||||
int __set_uhash_entries(char *str);
|
||||
|
||||
static void lxip_kernel_params(void)
|
||||
{
|
||||
__set_thash_entries("2048");
|
||||
__set_uhash_entries("2048");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize sub-systems
|
||||
*/
|
||||
void lxip_init()
|
||||
{
|
||||
/* init data */
|
||||
INIT_LIST_HEAD(&init_net.dev_base_head);
|
||||
|
||||
core_sock_init();
|
||||
core_netlink_proto_init();
|
||||
|
||||
/* sub-systems */
|
||||
subsys_net_dev_init();
|
||||
|
||||
lxip_kernel_params();
|
||||
fs_inet_init();
|
||||
|
||||
/* enable local accepts */
|
||||
IPV4_DEVCONF_ALL(&init_net, ACCEPT_LOCAL) = 0x1;
|
||||
|
||||
/* congestion control */
|
||||
module_cubictcp_register();
|
||||
|
||||
/* driver */
|
||||
module_driver_init();
|
||||
|
||||
/* late */
|
||||
late_tcp_congestion_default();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Network configuration
|
||||
*/
|
||||
static void lxip_configure(char const *address_config)
|
||||
{
|
||||
__ip_auto_config_setup((char *)address_config);
|
||||
late_ip_auto_config();
|
||||
}
|
||||
|
||||
|
||||
static bool dhcp_configured = false;
|
||||
static bool dhcp_pending = false;
|
||||
|
||||
void lxip_configure_mtu(unsigned mtu)
|
||||
{
|
||||
/* zero mtu means reset to default */
|
||||
unsigned new_mtu = mtu ? mtu : ETH_DATA_LEN;
|
||||
|
||||
struct net *net;
|
||||
struct net_device *dev;
|
||||
|
||||
for_each_net(net) {
|
||||
for_each_netdev(net, dev) {
|
||||
dev_set_mtu(dev, new_mtu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lxip_configure_static(char const *addr, char const *netmask,
|
||||
char const *gateway, char const *nameserver)
|
||||
{
|
||||
char address_config[128];
|
||||
|
||||
dhcp_configured = false;
|
||||
|
||||
snprintf(address_config, sizeof(address_config),
|
||||
"%s::%s:%s:::off:%s",
|
||||
addr, gateway, netmask, nameserver);
|
||||
lxip_configure(address_config);
|
||||
}
|
||||
|
||||
|
||||
void lxip_configure_dhcp()
|
||||
{
|
||||
dhcp_configured = true;
|
||||
dhcp_pending = true;
|
||||
|
||||
lxip_configure("dhcp");
|
||||
dhcp_pending = false;
|
||||
}
|
||||
|
||||
|
||||
bool lxip_do_dhcp()
|
||||
{
|
||||
return dhcp_configured && !dhcp_pending;
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
** Lxip private **
|
||||
******************/
|
||||
|
||||
void set_sock_wait(struct socket *sock, unsigned long ptr)
|
||||
{
|
||||
sock->sk->sk_wq = (struct socket_wq *)ptr;
|
||||
}
|
||||
|
||||
|
||||
int socket_check_state(struct socket *socket)
|
||||
{
|
||||
if (socket->sk->sk_state == TCP_CLOSE_WAIT)
|
||||
return -EINTR;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void log_sock(struct socket *socket)
|
||||
{
|
||||
printk("\nNEW socket %p sk %p fsk %x &sk %p &fsk %p\n\n",
|
||||
socket, socket->sk, socket->flags, &socket->sk, &socket->flags);
|
||||
}
|
@ -1,671 +0,0 @@
|
||||
/*
|
||||
* \brief Linux emulation code
|
||||
* \author Sebastian Sumpf
|
||||
* \author Emery Hemingway
|
||||
* \author Christian Helmuth
|
||||
* \date 2013-08-28
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/object_pool.h>
|
||||
#include <base/sleep.h>
|
||||
#include <dataspace/client.h>
|
||||
#include <region_map/client.h>
|
||||
#include <trace/timestamp.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
/* format-string includes */
|
||||
#include <format/snprintf.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lx_emul.h>
|
||||
#include <lx.h>
|
||||
|
||||
/* Lx_kit */
|
||||
#include <legacy/lx_kit/env.h>
|
||||
|
||||
/*********************************
|
||||
** Lx::Backend_alloc interface **
|
||||
*********************************/
|
||||
|
||||
#include <legacy/lx_kit/backend_alloc.h>
|
||||
|
||||
struct Memory_object_base;
|
||||
|
||||
static Lx_kit::Env *lx_env;
|
||||
|
||||
static Genode::Object_pool<Memory_object_base> *memory_pool_ptr;
|
||||
|
||||
|
||||
void Lx::lxcc_emul_init(Lx_kit::Env &env)
|
||||
{
|
||||
static Genode::Object_pool<Memory_object_base> memory_pool;
|
||||
|
||||
memory_pool_ptr = &memory_pool;
|
||||
|
||||
lx_env = &env;
|
||||
|
||||
LX_MUTEX_INIT(dst_gc_mutex);
|
||||
LX_MUTEX_INIT(proto_list_mutex);
|
||||
}
|
||||
|
||||
|
||||
struct Memory_object_base : Genode::Object_pool<Memory_object_base>::Entry
|
||||
{
|
||||
Memory_object_base(Genode::Ram_dataspace_capability cap)
|
||||
: Genode::Object_pool<Memory_object_base>::Entry(cap) {}
|
||||
|
||||
void free() { lx_env->ram().free(ram_cap()); }
|
||||
|
||||
Genode::Ram_dataspace_capability ram_cap()
|
||||
{
|
||||
using namespace Genode;
|
||||
return reinterpret_cap_cast<Ram_dataspace>(cap());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Genode::Ram_dataspace_capability
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Genode::Ram_dataspace_capability cap = lx_env->ram().alloc(size);
|
||||
Memory_object_base *o = new (lx_env->heap()) Memory_object_base(cap);
|
||||
|
||||
memory_pool_ptr->insert(o);
|
||||
return cap;
|
||||
}
|
||||
|
||||
|
||||
void Lx::backend_free(Genode::Ram_dataspace_capability cap)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Memory_object_base *object;
|
||||
memory_pool_ptr->apply(cap, [&] (Memory_object_base *o) {
|
||||
if (!o) return;
|
||||
|
||||
o->free();
|
||||
memory_pool_ptr->remove(o);
|
||||
|
||||
object = o; /* save for destroy */
|
||||
});
|
||||
destroy(lx_env->heap(), object);
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Lx::backend_dma_addr(Genode::Ram_dataspace_capability)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
** Memory allocation, linux/slab.h **
|
||||
*************************************/
|
||||
|
||||
#include <legacy/lx_emul/impl/slab.h>
|
||||
|
||||
|
||||
void *alloc_large_system_hash(const char *tablename,
|
||||
unsigned long bucketsize,
|
||||
unsigned long numentries,
|
||||
int scale,
|
||||
int flags,
|
||||
unsigned int *_hash_shift,
|
||||
unsigned int *_hash_mask,
|
||||
unsigned long low_limit,
|
||||
unsigned long high_limit)
|
||||
{
|
||||
unsigned long elements = numentries ? numentries : high_limit;
|
||||
unsigned long nlog2 = ilog2(elements);
|
||||
nlog2 <<= (1 << nlog2) < elements ? 1 : 0;
|
||||
|
||||
|
||||
return lx_env->heap().try_alloc(elements * bucketsize).convert<void *>(
|
||||
|
||||
[&] (void *table_ptr) {
|
||||
|
||||
if (_hash_mask)
|
||||
*_hash_mask = (1 << nlog2) - 1;
|
||||
|
||||
if (_hash_shift)
|
||||
*_hash_shift = nlog2;
|
||||
|
||||
return table_ptr;
|
||||
},
|
||||
|
||||
[&] (Genode::Allocator::Alloc_error) -> void * {
|
||||
Genode::error("alloc_large_system_hash allocation failed");
|
||||
return nullptr;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void *kmalloc_array(size_t n, size_t size, gfp_t flags)
|
||||
{
|
||||
if (size != 0 && n > SIZE_MAX / size) return NULL;
|
||||
return kmalloc(n * size, flags);
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** linux/slab.h **
|
||||
********************/
|
||||
|
||||
void *kmem_cache_alloc_node(struct kmem_cache *cache, gfp_t flags, int node)
|
||||
{
|
||||
return (void*)cache->alloc_element();
|
||||
}
|
||||
|
||||
void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags)
|
||||
{
|
||||
void *addr = (void*)cache->alloc_element();
|
||||
if (addr) { memset(addr, 0, cache->size()); }
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
** linux/vmalloc.h **
|
||||
*********************/
|
||||
|
||||
void *vmalloc(unsigned long size)
|
||||
{
|
||||
return kmalloc(size, 0);
|
||||
}
|
||||
|
||||
|
||||
void vfree(void const *addr)
|
||||
{
|
||||
kfree(addr);
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** linux/string.h **
|
||||
********************/
|
||||
|
||||
char *strcpy(char *to, const char *from)
|
||||
{
|
||||
char *save = to;
|
||||
for (; (*to = *from); ++from, ++to);
|
||||
return(save);
|
||||
}
|
||||
|
||||
|
||||
char *strncpy(char *dst, const char* src, size_t n)
|
||||
{
|
||||
Genode::copy_cstring(dst, src, n);
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
char *strchr(const char *p, int ch)
|
||||
{
|
||||
char c;
|
||||
c = ch;
|
||||
for (;; ++p) {
|
||||
if (*p == c)
|
||||
return ((char *)p);
|
||||
if (*p == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *strnchr(const char *p, size_t count, int ch)
|
||||
{
|
||||
char c;
|
||||
c = ch;
|
||||
for (; count; ++p, count--) {
|
||||
if (*p == c)
|
||||
return ((char *)p);
|
||||
if (*p == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
size_t strnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t c;
|
||||
for (c = 0; c < maxlen; c++)
|
||||
if (!s[c])
|
||||
return c;
|
||||
|
||||
return maxlen;
|
||||
}
|
||||
|
||||
|
||||
size_t strlen(const char *s) { return Genode::strlen(s); }
|
||||
|
||||
|
||||
int strcmp(const char *s1, const char *s2) { return Genode::strcmp(s1, s2); }
|
||||
|
||||
|
||||
int strncmp(const char *s1, const char *s2, size_t len) {
|
||||
return Genode::strcmp(s1, s2, len); }
|
||||
|
||||
|
||||
int memcmp(const void *p0, const void *p1, size_t size) {
|
||||
return Genode::memcmp(p0, p1, size); }
|
||||
|
||||
|
||||
int snprintf(char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
|
||||
Format::String_console sc(str, size);
|
||||
sc.vprintf(format, list);
|
||||
va_end(list);
|
||||
|
||||
return sc.len();
|
||||
}
|
||||
|
||||
|
||||
size_t strlcpy(char *dest, const char *src, size_t size)
|
||||
{
|
||||
size_t ret = strlen(src);
|
||||
|
||||
if (size) {
|
||||
size_t len = (ret >= size) ? size - 1 : ret;
|
||||
Genode::memcpy(dest, src, len);
|
||||
dest[len] = '\0';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* from linux/lib/string.c */
|
||||
char *strstr(char const *s1, char const *s2)
|
||||
{
|
||||
size_t l1, l2;
|
||||
|
||||
l2 = strlen(s2);
|
||||
if (!l2)
|
||||
return (char *)s1;
|
||||
l1 = strlen(s1);
|
||||
while (l1 >= l2) {
|
||||
l1--;
|
||||
if (!memcmp(s1, s2, l2))
|
||||
return (char *)s1;
|
||||
s1++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
return Genode::memset(s, c, n);
|
||||
}
|
||||
|
||||
|
||||
void *memcpy(void *d, const void *s, size_t n)
|
||||
{
|
||||
return Genode::memcpy(d, s, n);
|
||||
}
|
||||
|
||||
|
||||
void *memmove(void *d, const void *s, size_t n)
|
||||
{
|
||||
return Genode::memmove(d, s, n);
|
||||
}
|
||||
|
||||
|
||||
/*****************
|
||||
** linux/gfp.h **
|
||||
*****************/
|
||||
|
||||
class Avl_page : public Genode::Avl_node<Avl_page>
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::addr_t _addr;
|
||||
Genode::size_t _size;
|
||||
struct page *_page;
|
||||
|
||||
public:
|
||||
|
||||
Avl_page(Genode::size_t size) : _size(size)
|
||||
{
|
||||
_addr =(Genode::addr_t)kmalloc(size, 0);
|
||||
if (!_addr)
|
||||
throw -1;
|
||||
|
||||
_page = (struct page *) kzalloc(sizeof(struct page), 0);
|
||||
if (!_page) {
|
||||
kfree((void *)_addr);
|
||||
throw -2;
|
||||
}
|
||||
|
||||
_page->addr = (void *)_addr;
|
||||
atomic_set(&_page->_count, 1);
|
||||
|
||||
lx_log(DEBUG_SLAB, "alloc page: %p addr: %lx-%lx", _page, _addr, _addr + _size);
|
||||
}
|
||||
|
||||
virtual ~Avl_page()
|
||||
{
|
||||
lx_log(DEBUG_SLAB, "free page: %p addr: %lx-%lx", _page, _addr, _addr + _size);
|
||||
kfree((void *)_addr);
|
||||
kfree((void *)_page);
|
||||
}
|
||||
|
||||
struct page* page() { return _page; }
|
||||
|
||||
bool higher(Avl_page *c)
|
||||
{
|
||||
return c->_addr > _addr;
|
||||
}
|
||||
|
||||
Avl_page *find_by_address(Genode::addr_t addr)
|
||||
{
|
||||
if (addr >= _addr && addr < _addr + _size)
|
||||
return this;
|
||||
|
||||
bool side = addr > _addr;
|
||||
Avl_page *c = Avl_node<Avl_page>::child(side);
|
||||
return c ? c->find_by_address(addr) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static Genode::Avl_tree<Avl_page> & tree()
|
||||
{
|
||||
static Genode::Avl_tree<Avl_page> _tree;
|
||||
return _tree;
|
||||
}
|
||||
|
||||
|
||||
struct page *alloc_pages(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
Avl_page *p;
|
||||
try {
|
||||
p = (Avl_page *)new (lx_env->heap()) Avl_page(PAGE_SIZE << order);
|
||||
tree().insert(p);
|
||||
} catch (...) { return 0; }
|
||||
|
||||
return p->page();
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
Avl_page *p = tree().first()->find_by_address((Genode::addr_t)addr);
|
||||
|
||||
tree().remove(p);
|
||||
destroy(lx_env->heap(), p);
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
** linux/mm.h **
|
||||
****************/
|
||||
|
||||
struct page *virt_to_head_page(const void *x)
|
||||
{
|
||||
Avl_page *p = tree().first()->find_by_address((Genode::addr_t)x);
|
||||
lx_log(DEBUG_SLAB, "virt_to_head_page: %p page %p\n", x,p ? p->page() : 0);
|
||||
|
||||
return p ? p->page() : 0;
|
||||
}
|
||||
|
||||
|
||||
void put_page(struct page *page)
|
||||
{
|
||||
if (!atomic_dec_and_test(&page->_count))
|
||||
return;
|
||||
|
||||
lx_log(DEBUG_SLAB, "put_page: %p", page);
|
||||
Avl_page *p = tree().first()->find_by_address((Genode::addr_t)page->addr);
|
||||
|
||||
tree().remove(p);
|
||||
destroy(lx_env->heap(), p);
|
||||
}
|
||||
|
||||
|
||||
static void create_event(char const *fmt, va_list list)
|
||||
{
|
||||
enum { BUFFER_LEN = 64, EVENT_LEN = BUFFER_LEN + 32 };
|
||||
char buf[BUFFER_LEN];
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
Format::String_console sc(buf, BUFFER_LEN);
|
||||
sc.vprintf(fmt, list);
|
||||
|
||||
char event[EVENT_LEN];
|
||||
static Trace::Timestamp last = 0;
|
||||
Trace::Timestamp now = Trace::timestamp();
|
||||
Format::snprintf(event, sizeof(event), "delta = %llu ms %s",
|
||||
(now - last) / 2260000, buf);
|
||||
Thread::trace(event);
|
||||
last = now;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void lx_trace_event(char const *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
create_event(fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
||||
/*****************
|
||||
** linux/uio.h **
|
||||
*****************/
|
||||
|
||||
static inline size_t _copy_iter(void *addr, size_t bytes,
|
||||
struct iov_iter *i, bool to_iter)
|
||||
{
|
||||
if (addr == nullptr) { return 0; }
|
||||
|
||||
if (i->count == 0 ||
|
||||
i->iov == nullptr ||
|
||||
i->iov->iov_len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i->nr_segs > 1) {
|
||||
Genode::error(__func__, ": too many segments ", i->nr_segs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* make sure the whole iter fits as there is only 1 iovec */
|
||||
if (i->iov->iov_len < i->count) {
|
||||
Genode::error(__func__, ": "
|
||||
"iov->iov_len: ", i->iov->iov_len, " < "
|
||||
"i->count: ", i->count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct iovec const * const iov = i->iov;
|
||||
size_t const iov_len = iov->iov_len;
|
||||
void * const base = (iov->iov_base + i->iov_offset);
|
||||
|
||||
if (bytes > i->count) { bytes = i->count; }
|
||||
|
||||
size_t const len = (size_t)(bytes < iov_len ? bytes : iov_len);
|
||||
void * const dst = to_iter ? base : addr;
|
||||
void const * const src = to_iter ? addr : base;
|
||||
|
||||
/* actual function body */
|
||||
{
|
||||
Genode::memcpy(dst, src, len);
|
||||
}
|
||||
|
||||
i->iov_offset += len;
|
||||
i->count -= len;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
return _copy_iter(addr, bytes, i, false);
|
||||
}
|
||||
|
||||
|
||||
size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
return _copy_iter(addr, bytes, i, true);
|
||||
}
|
||||
|
||||
|
||||
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<unsigned char*>(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<unsigned char*>(page->addr) + offset, bytes, i);
|
||||
}
|
||||
|
||||
|
||||
static size_t _csum_and_copy_iter(void *addr, size_t bytes, __wsum *csum,
|
||||
struct iov_iter *i, bool to_iter)
|
||||
{
|
||||
if (addr == nullptr) { return 0; }
|
||||
|
||||
if (i->count == 0 ||
|
||||
i->iov == nullptr ||
|
||||
i->iov->iov_len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i->nr_segs > 1) {
|
||||
Genode::error(__func__, ": too many segments ", i->nr_segs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* make sure the whole iter fits as there is only 1 iovec */
|
||||
if (i->iov->iov_len < i->count) {
|
||||
Genode::error(__func__, ": "
|
||||
"iov->iov_len: ", i->iov->iov_len, " < "
|
||||
"i->count: ", i->count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct iovec const * const iov = i->iov;
|
||||
size_t const iov_len = iov->iov_len;
|
||||
void * const base = (iov->iov_base + i->iov_offset);
|
||||
|
||||
if (bytes > i->count) { bytes = i->count; }
|
||||
|
||||
size_t const len = (size_t)(bytes < iov_len ? bytes : iov_len);
|
||||
void * const dst = to_iter ? base : addr;
|
||||
void const * const src = to_iter ? addr : base;
|
||||
|
||||
/* actual function body */
|
||||
{
|
||||
int err = 0;
|
||||
__wsum next = csum_and_copy_from_user(src, dst, len, 0, &err);
|
||||
|
||||
if (err) {
|
||||
Genode::error(__func__, ": err: ", err, " - sleeping");
|
||||
Genode::sleep_forever();
|
||||
}
|
||||
|
||||
*csum = csum_block_add(*csum, next, 0);
|
||||
}
|
||||
|
||||
i->iov_offset += len;
|
||||
i->count -= len;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i)
|
||||
{
|
||||
return _csum_and_copy_iter(addr, bytes, csum, i, false);
|
||||
}
|
||||
|
||||
|
||||
size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i)
|
||||
{
|
||||
return _csum_and_copy_iter(addr, bytes, csum, i, true);
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
** linux/wait.h **
|
||||
******************/
|
||||
|
||||
void __wake_up(wait_queue_head_t *q, bool all) { }
|
||||
|
||||
|
||||
/***********************
|
||||
** linux/workqueue.h **
|
||||
***********************/
|
||||
|
||||
static void execute_delayed_work(unsigned long dwork)
|
||||
{
|
||||
delayed_work *d = (delayed_work *)dwork;
|
||||
d->work.func(&d->work);
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
if (!dwork->timer.function) {
|
||||
setup_timer(&dwork->timer, execute_delayed_work,
|
||||
(unsigned long)dwork);
|
||||
}
|
||||
mod_timer(&dwork->timer, jiffies + delay);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay)
|
||||
{
|
||||
return mod_delayed_work(0, dwork, delay);
|
||||
}
|
||||
|
||||
|
||||
int kstrtoul(const char *s, unsigned int base, unsigned long *res)
|
||||
{
|
||||
unsigned long val = 0;
|
||||
Genode::ascii_to(s, val);
|
||||
*res = val;
|
||||
return 0;
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
/*
|
||||
* \brief Linux emulation code
|
||||
* \author Sebastian Sumpf
|
||||
* \author Josef Soentgen
|
||||
* \author Emery Hemingway
|
||||
* \date 2013-08-28
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <nic/packet_allocator.h>
|
||||
#include <nic_session/connection.h>
|
||||
|
||||
/* format-string includes */
|
||||
#include <format/snprintf.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lx.h>
|
||||
#include <nic.h>
|
||||
|
||||
bool ic_link_state = false;
|
||||
|
||||
|
||||
class Nic_client
|
||||
{
|
||||
private:
|
||||
|
||||
enum {
|
||||
PACKET_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE,
|
||||
BUF_SIZE = Nic::Session::QUEUE_SIZE * PACKET_SIZE,
|
||||
};
|
||||
|
||||
Nic::Packet_allocator _tx_block_alloc;
|
||||
Nic::Connection _nic;
|
||||
|
||||
Genode::Io_signal_handler<Nic_client> _sink_ack;
|
||||
Genode::Io_signal_handler<Nic_client> _sink_submit;
|
||||
Genode::Io_signal_handler<Nic_client> _source_ack;
|
||||
Genode::Io_signal_handler<Nic_client> _link_state_change;
|
||||
|
||||
void (*_tick)();
|
||||
|
||||
void _link_state()
|
||||
{
|
||||
bool const link_state = _nic.link_state();
|
||||
ic_link_state = link_state;
|
||||
|
||||
if (link_state == false || lxip_do_dhcp() == false)
|
||||
return;
|
||||
|
||||
Lx::timer_update_jiffies();
|
||||
|
||||
/* reconnect dhcp client */
|
||||
lxip_configure_dhcp();
|
||||
}
|
||||
|
||||
/**
|
||||
* submit queue not empty anymore
|
||||
*/
|
||||
void _packet_avail()
|
||||
{
|
||||
Lx::timer_update_jiffies();
|
||||
|
||||
/* process a batch of only MAX_PACKETS in one run */
|
||||
enum { MAX_PACKETS = 20 };
|
||||
|
||||
int count = 0;
|
||||
while (_nic.rx()->packet_avail() &&
|
||||
_nic.rx()->ready_to_ack() &&
|
||||
count++ < MAX_PACKETS)
|
||||
{
|
||||
Nic::Packet_descriptor p = _nic.rx()->get_packet();
|
||||
try { net_driver_rx(_nic.rx()->packet_content(p), p.size()); }
|
||||
catch (Genode::Packet_descriptor::Invalid_packet) {
|
||||
Genode::error("received invalid Nic packet"); }
|
||||
_nic.rx()->acknowledge_packet(p);
|
||||
}
|
||||
|
||||
/* schedule next batch if there are still packets available */
|
||||
if (_nic.rx()->packet_avail())
|
||||
Genode::Signal_transmitter(_sink_submit).submit();
|
||||
|
||||
/* tick the higher layer of the component */
|
||||
_tick();
|
||||
}
|
||||
|
||||
/**
|
||||
* acknoledgement queue not full anymore
|
||||
*/
|
||||
void _ready_to_ack()
|
||||
{
|
||||
_packet_avail();
|
||||
}
|
||||
|
||||
/**
|
||||
* acknoledgement queue not empty anymore
|
||||
*/
|
||||
void _ack_avail()
|
||||
{
|
||||
while (_nic.tx()->ack_avail()) {
|
||||
Nic::Packet_descriptor p = _nic.tx()->get_acked_packet();
|
||||
_nic.tx()->release_packet(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Nic_client(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
void (*ticker)())
|
||||
:
|
||||
_tx_block_alloc(&alloc),
|
||||
_nic(env, &_tx_block_alloc, BUF_SIZE, BUF_SIZE),
|
||||
_sink_ack(env.ep(), *this, &Nic_client::_packet_avail),
|
||||
_sink_submit(env.ep(), *this, &Nic_client::_ready_to_ack),
|
||||
_source_ack(env.ep(), *this, &Nic_client::_ack_avail),
|
||||
_link_state_change(env.ep(), *this, &Nic_client::_link_state),
|
||||
_tick(ticker)
|
||||
{
|
||||
ic_link_state = _nic.link_state();
|
||||
|
||||
_nic.rx_channel()->sigh_ready_to_ack(_sink_ack);
|
||||
_nic.rx_channel()->sigh_packet_avail(_sink_submit);
|
||||
_nic.tx_channel()->sigh_ack_avail(_source_ack);
|
||||
_nic.link_state_sigh(_link_state_change);
|
||||
/* ready_to_submit not handled */
|
||||
}
|
||||
|
||||
Nic::Connection *nic() { return &_nic; }
|
||||
};
|
||||
|
||||
|
||||
static Nic_client *_nic_client;
|
||||
|
||||
|
||||
void Lx::nic_client_init(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
void (*ticker)())
|
||||
{
|
||||
static Nic_client _inst(env, alloc, ticker);
|
||||
_nic_client = &_inst;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call by back-end driver while initializing
|
||||
*/
|
||||
void net_mac(void* mac, unsigned long size)
|
||||
{
|
||||
enum { MAC_LEN = 17, ETH_ALEN = 6, };
|
||||
|
||||
char str[MAC_LEN + 1];
|
||||
using namespace Genode;
|
||||
|
||||
Nic::Mac_address m = _nic_client->nic()->mac_address();
|
||||
Genode::memcpy(mac, &m.addr, min(sizeof(m.addr), (size_t)size));
|
||||
|
||||
unsigned char const *mac_addr = (unsigned char const*)m.addr;
|
||||
for (int i = 0; i < ETH_ALEN; i++) {
|
||||
Format::snprintf((char *)&str[i * 3], 3, "%02x", mac_addr[i]);
|
||||
if ((i * 3) < MAC_LEN)
|
||||
str[(i * 3) + 2] = ':';
|
||||
}
|
||||
str[MAC_LEN] = 0;
|
||||
|
||||
Genode::log("Received mac: ", Cstring(str));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call by back-end driver when a packet should be sent
|
||||
*/
|
||||
int net_tx(void* addr, unsigned long len)
|
||||
{
|
||||
try {
|
||||
Nic::Packet_descriptor packet = _nic_client->nic()->tx()->alloc_packet(len);
|
||||
void* content = _nic_client->nic()->tx()->packet_content(packet);
|
||||
|
||||
Genode::memcpy((char *)content, addr, len);
|
||||
_nic_client->nic()->tx()->submit_packet(packet);
|
||||
|
||||
return 0;
|
||||
/* Packet_alloc_failed */
|
||||
} catch(...) { return 1; }
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* \brief Linux random emulation code
|
||||
* \author Josef Soentgen
|
||||
* \date 2016-10-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/fixed_stdint.h>
|
||||
#include <util/string.h>
|
||||
|
||||
|
||||
using Genode::uint64_t;
|
||||
|
||||
/*
|
||||
* Xoroshiro128+ written in 2014-2016 by Sebastiano Vigna (vigna@acm.org)
|
||||
*
|
||||
* (see http://xoroshiro.di.unimi.it/xorshift128plus.c and
|
||||
* http://xoroshiro.di.unimi.it/splitmix64.c)
|
||||
*/
|
||||
|
||||
struct Xoroshiro
|
||||
{
|
||||
uint64_t seed;
|
||||
|
||||
uint64_t splitmix64()
|
||||
{
|
||||
uint64_t z = (seed += __UINT64_C(0x9E3779B97F4A7C15));
|
||||
z = (z ^ (z >> 30)) * __UINT64_C(0xBF58476D1CE4E5B9);
|
||||
z = (z ^ (z >> 27)) * __UINT64_C(0x94D049BB133111EB);
|
||||
return z ^ (z >> 31);
|
||||
}
|
||||
|
||||
Xoroshiro(uint64_t seed) : seed(seed)
|
||||
{
|
||||
s[0] = splitmix64();
|
||||
s[1] = splitmix64();
|
||||
}
|
||||
|
||||
uint64_t s[2];
|
||||
|
||||
static uint64_t rotl(uint64_t const x, int k) {
|
||||
return (x << k) | (x >> (64 - k));
|
||||
}
|
||||
|
||||
uint64_t get()
|
||||
{
|
||||
uint64_t const s0 = s[0];
|
||||
uint64_t s1 = s[1];
|
||||
uint64_t const result = s0 + s1;
|
||||
|
||||
s1 ^= s0;
|
||||
|
||||
s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14);
|
||||
s[1] = rotl(s1, 36);
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static Xoroshiro & xoroshiro()
|
||||
{
|
||||
static Xoroshiro xoroshiro(42);
|
||||
return xoroshiro;
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** linux/random.h **
|
||||
********************/
|
||||
|
||||
extern "C" void get_random_bytes(void *buf, int nbytes)
|
||||
{
|
||||
if (nbytes <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *p = reinterpret_cast<char*>(buf);
|
||||
|
||||
int const rounds = nbytes / 8;
|
||||
for (int i = 0; i < rounds; i++) {
|
||||
uint64_t const v = xoroshiro().get();
|
||||
|
||||
Genode::memcpy(p, &v, 8);
|
||||
p += 8;
|
||||
}
|
||||
|
||||
int const remain = nbytes - rounds * 8;
|
||||
if (!remain) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t const v = xoroshiro().get();
|
||||
Genode::memcpy(p, &v, remain);
|
||||
}
|
||||
|
||||
|
||||
extern "C" unsigned int prandom_u32(void)
|
||||
{
|
||||
return xoroshiro().get();
|
||||
}
|
@ -1,504 +0,0 @@
|
||||
/*
|
||||
* \brief Signal context for timer events
|
||||
* \author Sebastian Sumpf
|
||||
* \author Emery Hemingway
|
||||
* \author Christian Helmuth
|
||||
* \date 2012-05-23
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <base/tslab.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
/* Linux kit includes */
|
||||
#include <legacy/lx_kit/internal/list.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lx_emul.h>
|
||||
#include <lx.h>
|
||||
|
||||
|
||||
/*********************
|
||||
** linux/jiffies.h **
|
||||
*********************/
|
||||
|
||||
unsigned long jiffies;
|
||||
|
||||
/**
|
||||
* Lx::Timer
|
||||
*/
|
||||
namespace Lx {
|
||||
class Timer;
|
||||
}
|
||||
|
||||
class Lx::Timer
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Context encapsulates a regular linux timer_list
|
||||
*/
|
||||
struct Context : public Lx_kit::List<Context>::Element
|
||||
{
|
||||
enum { INVALID_TIMEOUT = ~0UL };
|
||||
enum Type { LIST };
|
||||
|
||||
Type type;
|
||||
void *timer;
|
||||
bool pending { false };
|
||||
unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */
|
||||
|
||||
Context(struct timer_list *timer) : type(LIST), timer(timer) { }
|
||||
|
||||
void expires(unsigned long e)
|
||||
{
|
||||
if (type == LIST)
|
||||
static_cast<timer_list *>(timer)->expires = e;
|
||||
}
|
||||
|
||||
void function()
|
||||
{
|
||||
switch (type) {
|
||||
case LIST:
|
||||
{
|
||||
timer_list *t = static_cast<timer_list *>(timer);
|
||||
if (t->function)
|
||||
t->function(t->data);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Genode::Entrypoint &_ep;
|
||||
::Timer::Connection &_timer;
|
||||
|
||||
/* One-shot timeout for timer list */
|
||||
::Timer::One_shot_timeout<Lx::Timer> _timers_one_shot {
|
||||
_timer, *this, &Lx::Timer::_handle_timers };
|
||||
|
||||
/* One-shot timeout for 'wait' */
|
||||
::Timer::One_shot_timeout<Lx::Timer> _wait_one_shot {
|
||||
_timer, *this, &Lx::Timer::_handle_wait };
|
||||
|
||||
Lx_kit::List<Context> _list;
|
||||
Genode::Tslab<Context, 32 * sizeof(Context)> _timer_alloc;
|
||||
|
||||
void (*_tick)();
|
||||
|
||||
public:
|
||||
|
||||
bool ready { true };
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Lookup local timer
|
||||
*/
|
||||
Context *_find_context(void 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
|
||||
*/
|
||||
void _program_first_timer()
|
||||
{
|
||||
Context *ctx = _list.first();
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
/* calculate relative microseconds for trigger */
|
||||
Genode::uint64_t us = ctx->timeout > jiffies ?
|
||||
(Genode::uint64_t)jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
|
||||
_timers_one_shot.schedule(Genode::Microseconds{us});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* Also write the timeout value to the expires field in
|
||||
* struct timer_list because some code the checks
|
||||
* it directly.
|
||||
*/
|
||||
ctx->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();
|
||||
}
|
||||
|
||||
inline void _upate_jiffies(Genode::Duration dur)
|
||||
{
|
||||
auto new_jiffies = usecs_to_jiffies(dur.trunc_to_plain_us().value);
|
||||
if (new_jiffies < jiffies)
|
||||
jiffies = usecs_to_jiffies(_timer.curr_time().trunc_to_plain_us().value);
|
||||
else
|
||||
jiffies = new_jiffies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check timers and wake application
|
||||
*/
|
||||
void _handle_timers(Genode::Duration dur)
|
||||
{
|
||||
_upate_jiffies(dur);
|
||||
|
||||
while (Lx::Timer::Context *ctx = _list.first()) {
|
||||
if (ctx->timeout > jiffies)
|
||||
break;
|
||||
|
||||
ctx->pending = false;
|
||||
ctx->function();
|
||||
|
||||
if (!ctx->pending)
|
||||
del(ctx->timer);
|
||||
}
|
||||
|
||||
/* tick the higher layer of the component */
|
||||
_tick();
|
||||
}
|
||||
|
||||
void _handle_wait(Genode::Duration dur) { _upate_jiffies(dur); }
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Timer(Genode::Entrypoint &ep,
|
||||
::Timer::Connection &timer,
|
||||
Genode::Allocator &alloc,
|
||||
void (*tick)())
|
||||
:
|
||||
_ep(ep),
|
||||
_timer(timer),
|
||||
_timer_alloc(&alloc),
|
||||
_tick(tick)
|
||||
{
|
||||
update_jiffies();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new linux timer
|
||||
*/
|
||||
template <typename TIMER>
|
||||
void add(TIMER *timer)
|
||||
{
|
||||
Context *t = new (&_timer_alloc) Context(timer);
|
||||
_list.append(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete linux timer
|
||||
*/
|
||||
int del(void *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->pending ? 1 : 0;
|
||||
|
||||
_list.remove(ctx);
|
||||
destroy(&_timer_alloc, ctx);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial scheduling of linux timer
|
||||
*/
|
||||
int schedule(void *timer, unsigned long expires)
|
||||
{
|
||||
Context *ctx = _find_context(timer);
|
||||
if (!ctx) {
|
||||
Genode::error("schedule unknown timer ", 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->pending ? 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(void 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()
|
||||
{
|
||||
/*
|
||||
* Do not use lx_emul usecs_to_jiffies(unsigned int) because
|
||||
* of implicit truncation!
|
||||
*/
|
||||
jiffies = _timer.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first timer context
|
||||
*/
|
||||
Context* first() { return _list.first(); }
|
||||
|
||||
void wait(unsigned long timeo = 0)
|
||||
{
|
||||
/**
|
||||
* XXX
|
||||
* in contrast to wait_uninterruptible(), wait() should be interruptible
|
||||
* although we return immediately once we dispatched any signal, we
|
||||
* need to reflect this via signal_pending()
|
||||
*/
|
||||
|
||||
if (timeo > 0)
|
||||
_wait_one_shot.schedule(Genode::Microseconds(jiffies_to_usecs(timeo)));
|
||||
|
||||
_ep.wait_and_dispatch_one_io_signal();
|
||||
/* update jiffies if we dispatched another signal */
|
||||
if (_wait_one_shot.scheduled())
|
||||
update_jiffies();
|
||||
}
|
||||
|
||||
void wait_uninterruptible(unsigned long timeo)
|
||||
{
|
||||
if (timeo > 0) {
|
||||
_wait_one_shot.schedule(Genode::Microseconds(jiffies_to_usecs(timeo)));
|
||||
while (_wait_one_shot.scheduled())
|
||||
_ep.wait_and_dispatch_one_io_signal();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static Lx::Timer *_timer;
|
||||
|
||||
|
||||
void Lx::timer_init(Genode::Entrypoint &ep,
|
||||
::Timer::Connection &timer,
|
||||
Genode::Allocator &alloc,
|
||||
void (*tick)())
|
||||
{
|
||||
static Lx::Timer inst(ep, timer, alloc, tick);
|
||||
_timer = &inst;
|
||||
}
|
||||
|
||||
|
||||
void update_jiffies() { _timer->update_jiffies(); }
|
||||
|
||||
void Lx::timer_update_jiffies() { update_jiffies(); }
|
||||
|
||||
/*******************
|
||||
** linux/timer.h **
|
||||
*******************/
|
||||
|
||||
void init_timer(struct timer_list *timer) { }
|
||||
|
||||
|
||||
void add_timer(struct timer_list *timer)
|
||||
{
|
||||
BUG_ON(timer_pending(timer));
|
||||
mod_timer(timer, timer->expires);
|
||||
}
|
||||
|
||||
|
||||
int mod_timer(struct timer_list *timer, unsigned long expires)
|
||||
{
|
||||
update_jiffies();
|
||||
|
||||
if (!_timer->find(timer))
|
||||
_timer->add(timer);
|
||||
|
||||
return _timer->schedule(timer, expires);
|
||||
}
|
||||
|
||||
|
||||
void setup_timer(struct timer_list *timer,void (*function)(unsigned long),
|
||||
unsigned long data)
|
||||
{
|
||||
timer->function = function;
|
||||
timer->data = data;
|
||||
}
|
||||
|
||||
|
||||
int timer_pending(const struct timer_list * timer)
|
||||
{
|
||||
bool pending = _timer->pending(timer);
|
||||
lx_log(DEBUG_TIMER, "Pending %p %u", timer, pending);
|
||||
return pending;
|
||||
}
|
||||
|
||||
|
||||
int del_timer(struct timer_list *timer)
|
||||
{
|
||||
update_jiffies();
|
||||
lx_log(DEBUG_TIMER, "Delete timer %p", timer);
|
||||
int rv = _timer->del(timer);
|
||||
_timer->schedule_next();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
** linux/sched.h **
|
||||
*******************/
|
||||
|
||||
signed long schedule_timeout(signed long timeout)
|
||||
{
|
||||
unsigned long expire = timeout + jiffies;
|
||||
|
||||
/**
|
||||
* XXX
|
||||
* schedule_timeout is called from sock_wait_for_wmem() (UDP) and
|
||||
* sk_stream_wait_memory() (TCP) if sk_wmem_alloc (UDP) resp.
|
||||
* sk_wmem_queued (TCP) reaches are certain threshold
|
||||
* unfortunately, recovery from this state seems to be broken
|
||||
* so that we land here for every skb once we hit the threshold
|
||||
*/
|
||||
static bool warned = false;
|
||||
if (!warned) {
|
||||
Genode::warning(__func__, " called (tx throttled?)");
|
||||
warned = true;
|
||||
}
|
||||
|
||||
long start = jiffies;
|
||||
_timer->wait(timeout);
|
||||
timeout -= jiffies - start;
|
||||
|
||||
return timeout < 0 ? 0 : timeout;
|
||||
}
|
||||
|
||||
long schedule_timeout_uninterruptible(signed long timeout)
|
||||
{
|
||||
_timer->wait_uninterruptible(timeout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
|
||||
{
|
||||
_timer->wait();
|
||||
}
|
||||
|
||||
bool poll_does_not_wait(const poll_table *p)
|
||||
{
|
||||
return p == nullptr;
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
** linux/time.h **
|
||||
******************/
|
||||
|
||||
unsigned long get_seconds(void)
|
||||
{
|
||||
return jiffies / HZ;
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
** linux/timer.h **
|
||||
*******************/
|
||||
|
||||
static unsigned long round_jiffies(unsigned long j, bool force_up)
|
||||
{
|
||||
unsigned remainder = j % HZ;
|
||||
|
||||
/*
|
||||
* from timer.c
|
||||
*
|
||||
* If the target jiffie is just after a whole second (which can happen
|
||||
* due to delays of the timer irq, long irq off times etc etc) then
|
||||
* we should round down to the whole second, not up. Use 1/4th second
|
||||
* as cutoff for this rounding as an extreme upper bound for this.
|
||||
* But never round down if @force_up is set.
|
||||
*/
|
||||
|
||||
/* per default round down */
|
||||
j = j - remainder;
|
||||
|
||||
/* round up if remainder more than 1/4 second (or if we're forced to) */
|
||||
if (remainder >= HZ/4 || force_up)
|
||||
j += HZ;
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
unsigned long round_jiffies(unsigned long j)
|
||||
{
|
||||
return round_jiffies(j, false);
|
||||
}
|
||||
|
||||
|
||||
unsigned long round_jiffies_up(unsigned long j)
|
||||
{
|
||||
return round_jiffies(j, true);
|
||||
}
|
||||
|
||||
|
||||
unsigned long round_jiffies_relative(unsigned long j)
|
||||
{
|
||||
return round_jiffies(j + jiffies, false) - jiffies;
|
||||
}
|
Loading…
Reference in New Issue
Block a user