Update to FreeBSD head 2016-08-23

Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
Sebastian Huber
2016-10-07 15:10:20 +02:00
parent 8c0eebac7d
commit c40e45b75e
1040 changed files with 156866 additions and 67039 deletions

View File

@@ -70,6 +70,7 @@ struct vnet {
u_int vnet_magic_n;
u_int vnet_ifcnt;
u_int vnet_sockcnt;
u_int vnet_state; /* SI_SUB_* */
void *vnet_data_mem;
uintptr_t vnet_data_base;
};
@@ -85,6 +86,61 @@ struct vnet {
#ifdef _KERNEL
#define VNET_PCPUSTAT_DECLARE(type, name) \
VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
#define VNET_PCPUSTAT_DEFINE(type, name) \
VNET_DEFINE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
#define VNET_PCPUSTAT_ALLOC(name, wait) \
COUNTER_ARRAY_ALLOC(VNET(name), \
sizeof(VNET(name)) / sizeof(counter_u64_t), (wait))
#define VNET_PCPUSTAT_FREE(name) \
COUNTER_ARRAY_FREE(VNET(name), sizeof(VNET(name)) / sizeof(counter_u64_t))
#define VNET_PCPUSTAT_ADD(type, name, f, v) \
counter_u64_add(VNET(name)[offsetof(type, f) / sizeof(uint64_t)], (v))
#define VNET_PCPUSTAT_FETCH(type, name, f) \
counter_u64_fetch(VNET(name)[offsetof(type, f) / sizeof(uint64_t)])
#define VNET_PCPUSTAT_SYSINIT(name) \
static void \
vnet_##name##_init(const void *unused) \
{ \
VNET_PCPUSTAT_ALLOC(name, M_WAITOK); \
} \
VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_INIT_IF, \
SI_ORDER_FIRST, vnet_ ## name ## _init, NULL)
#define VNET_PCPUSTAT_SYSUNINIT(name) \
static void \
vnet_##name##_uninit(const void *unused) \
{ \
VNET_PCPUSTAT_FREE(name); \
} \
VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_INIT_IF, \
SI_ORDER_FIRST, vnet_ ## name ## _uninit, NULL)
#ifdef SYSCTL_OID
#define SYSCTL_VNET_PCPUSTAT(parent, nbr, name, type, array, desc) \
static int \
array##_sysctl(SYSCTL_HANDLER_ARGS) \
{ \
type s; \
CTASSERT((sizeof(type) / sizeof(uint64_t)) == \
(sizeof(VNET(array)) / sizeof(counter_u64_t))); \
COUNTER_ARRAY_COPY(VNET(array), &s, sizeof(type) / sizeof(uint64_t));\
if (req->newptr) \
COUNTER_ARRAY_ZERO(VNET(array), \
sizeof(type) / sizeof(uint64_t)); \
return (SYSCTL_OUT(req, &s, sizeof(type))); \
} \
SYSCTL_PROC(parent, nbr, name, CTLFLAG_VNET | CTLTYPE_OPAQUE | CTLFLAG_RW, \
NULL, 0, array ## _sysctl, "I", desc)
#endif /* SYSCTL_OID */
#ifdef VIMAGE
#include <rtems/bsd/sys/lock.h>
#include <sys/proc.h> /* for struct thread */
@@ -232,53 +288,6 @@ void *vnet_data_alloc(int size);
void vnet_data_copy(void *start, int size);
void vnet_data_free(void *start_arg, int size);
/*
* Sysctl variants for vnet-virtualized global variables. Include
* <sys/sysctl.h> to expose these definitions.
*
* Note: SYSCTL_PROC() handler functions will need to resolve pointer
* arguments themselves, if required.
*/
#ifdef SYSCTL_OID
int vnet_sysctl_handle_int(SYSCTL_HANDLER_ARGS);
int vnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
int vnet_sysctl_handle_string(SYSCTL_HANDLER_ARGS);
int vnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS);
#define SYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
ptr, val, vnet_sysctl_handle_int, "I", descr)
#define SYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler, \
fmt, descr) \
CTASSERT(((access) & CTLTYPE) != 0); \
SYSCTL_OID(parent, nbr, name, CTLFLAG_VNET|(access), ptr, arg, \
handler, fmt, descr)
#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \
descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, len, \
vnet_sysctl_handle_opaque, fmt, descr)
#define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_STRING|CTLFLAG_VNET|(access), \
arg, len, vnet_sysctl_handle_string, "A", descr)
#define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, \
sizeof(struct type), vnet_sysctl_handle_opaque, "S," #type, \
descr)
#define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_UINT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
ptr, val, vnet_sysctl_handle_uint, "IU", descr)
#define VNET_SYSCTL_ARG(req, arg1) do { \
if (arg1 != NULL) \
arg1 = (void *)(TD_TO_VNET((req)->td)->vnet_data_base + \
(uintptr_t)(arg1)); \
} while (0)
#endif /* SYSCTL_OID */
/*
* Virtual sysinit mechanism, allowing network stack components to declare
* startup and shutdown methods to be run when virtual network stack
@@ -401,29 +410,6 @@ do { \
#define VNET_PTR(n) (&(n))
#define VNET(n) (n)
/*
* When VIMAGE isn't compiled into the kernel, virtaulized SYSCTLs simply
* become normal SYSCTLs.
*/
#ifdef SYSCTL_OID
#define SYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_INT(parent, nbr, name, access, ptr, val, descr)
#define SYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler, \
fmt, descr) \
SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, \
descr)
#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \
descr) \
SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)
#define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \
SYSCTL_STRING(parent, nbr, name, access, arg, len, descr)
#define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \
SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr)
#define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)
#define VNET_SYSCTL_ARG(req, arg1)
#endif /* SYSCTL_OID */
/*
* When VIMAGE isn't compiled into the kernel, VNET_SYSINIT/VNET_SYSUNINIT
* map into normal sysinits, which have the same ordering properties.