summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/include/endian.h90
-rw-r--r--sys/conf/files275
-rw-r--r--sys/conf/kern.pre.mk8
-rw-r--r--sys/conf/options8
-rw-r--r--sys/dev/hptmv/hptproc.c4
-rw-r--r--sys/i386/include/endian.h67
-rw-r--r--sys/kern/kern_intr.c58
-rw-r--r--sys/kern/kern_jail.c2
-rw-r--r--sys/kern/kern_sx.c2
-rw-r--r--sys/kern/kern_sysctl.c30
-rw-r--r--sys/kern/subr_bus.c4
-rw-r--r--sys/net/if.c6
-rw-r--r--sys/net/if_arp.h1
-rw-r--r--sys/net/if_llatbl.h5
-rw-r--r--sys/net/if_types.h1
-rw-r--r--sys/net/if_var.h3
-rw-r--r--sys/net/if_vlan.c263
-rw-r--r--sys/net/if_vlan_var.h18
-rw-r--r--sys/netinet/if_ether.c3
-rw-r--r--sys/netinet6/in6.c1
-rw-r--r--sys/netinet6/nd6.c1
-rw-r--r--sys/netinet6/nd6_nbr.c2
-rw-r--r--sys/sys/bus.h3
-rw-r--r--sys/sys/file.h1
-rw-r--r--sys/sys/interrupt.h1
-rw-r--r--sys/sys/jail.h2
-rw-r--r--sys/sys/sx.h8
-rw-r--r--sys/sys/sysctl.h10
-rw-r--r--sys/vm/uma_core.c2
-rw-r--r--sys/vm/vm_map.c27
-rw-r--r--sys/vm/vm_map.h2
-rw-r--r--usr.sbin/config/config.h1
-rw-r--r--usr.sbin/config/mkmakefile.c49
-rw-r--r--usr.sbin/ndp/ndp.c8
34 files changed, 770 insertions, 196 deletions
diff --git a/sys/amd64/include/endian.h b/sys/amd64/include/endian.h
index 712b5a5..de22c8b 100644
--- a/sys/amd64/include/endian.h
+++ b/sys/amd64/include/endian.h
@@ -69,73 +69,59 @@ extern "C" {
#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
-#define __byte_swap_int_var(x) \
-__extension__ ({ register __uint32_t __X = (x); \
- __asm ("bswap %0" : "+r" (__X)); \
- __X; })
-
-#ifdef __OPTIMIZE__
-
-#define __byte_swap_int_const(x) \
- ((((x) & 0xff000000) >> 24) | \
- (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | \
- (((x) & 0x000000ff) << 24))
-#define __byte_swap_int(x) (__builtin_constant_p(x) ? \
- __byte_swap_int_const(x) : __byte_swap_int_var(x))
-
-#else /* __OPTIMIZE__ */
-
-#define __byte_swap_int(x) __byte_swap_int_var(x)
-
-#endif /* __OPTIMIZE__ */
-
-#define __byte_swap_long_var(x) \
-__extension__ ({ register __uint64_t __X = (x); \
- __asm ("bswap %0" : "+r" (__X)); \
- __X; })
-
-#ifdef __OPTIMIZE__
-
-#define __byte_swap_long_const(x) \
- (((x >> 56) | \
- ((x >> 40) & 0xff00) | \
- ((x >> 24) & 0xff0000) | \
- ((x >> 8) & 0xff000000) | \
- ((x << 8) & (0xfful << 32)) | \
- ((x << 24) & (0xfful << 40)) | \
- ((x << 40) & (0xfful << 48)) | \
- ((x << 56))))
-
-#define __byte_swap_long(x) (__builtin_constant_p(x) ? \
- __byte_swap_long_const(x) : __byte_swap_long_var(x))
-
-#else /* __OPTIMIZE__ */
-
-#define __byte_swap_long(x) __byte_swap_long_var(x)
-
-#endif /* __OPTIMIZE__ */
+#define __bswap64_const(_x) \
+ (((_x) >> 56) | \
+ (((_x) >> 40) & (0xffUL << 8)) | \
+ (((_x) >> 24) & (0xffUL << 16)) | \
+ (((_x) >> 8) & (0xffUL << 24)) | \
+ (((_x) << 8) & (0xffUL << 32)) | \
+ (((_x) << 24) & (0xffUL << 40)) | \
+ (((_x) << 40) & (0xffUL << 48)) | \
+ ((_x) << 56))
+
+#define __bswap32_const(_x) \
+ (((_x) >> 24) | \
+ (((_x) & (0xff << 16)) >> 8) | \
+ (((_x) & (0xff << 8)) << 8) | \
+ ((_x) << 24))
+
+#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8)
static __inline __uint64_t
-__bswap64(__uint64_t _x)
+__bswap64_var(__uint64_t _x)
{
- return (__byte_swap_long(_x));
+ __asm ("bswap %0" : "+r" (_x));
+ return (_x);
}
static __inline __uint32_t
-__bswap32(__uint32_t _x)
+__bswap32_var(__uint32_t _x)
{
- return (__byte_swap_int(_x));
+ __asm ("bswap %0" : "+r" (_x));
+ return (_x);
}
static __inline __uint16_t
-__bswap16(__uint16_t _x)
+__bswap16_var(__uint16_t _x)
{
- return (_x << 8 | _x >> 8);
+
+ return (__bswap16_const(_x));
}
+#define __bswap64(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))
+
+#define __bswap32(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
+
+#define __bswap16(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
+
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
diff --git a/sys/conf/files b/sys/conf/files
index 83ec0f1..8af90a4 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2791,6 +2791,281 @@ nlm/nlm_prot_server.c optional nfslockd | nfsd
nlm/nlm_prot_svc.c optional nfslockd | nfsd
nlm/nlm_prot_xdr.c optional nfslockd | nfsd
nlm/sm_inter_xdr.c optional nfslockd | nfsd
+
+# OpenFabrics Enterprise Distribution (Infiniband)
+ofed/include/linux/linux_compat.c optional ofed \
+ no-depend compile-with "${OFED_C}"
+ofed/include/linux/linux_idr.c optional ofed \
+ no-depend compile-with "${OFED_C}"
+ofed/include/linux/linux_radix.c optional ofed \
+ no-depend compile-with "${OFED_C}"
+ofed/drivers/infiniband/core/addr.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/agent.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/cache.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+# XXX Mad.c must be ordered before cm.c for sysinit sets to occur in
+# the correct order.
+ofed/drivers/infiniband/core/mad.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/cm.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/cma.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/device.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/fmr_pool.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/iwcm.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/local_sa.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/mad_rmpp.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/multicast.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/notice.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/packer.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/sa_query.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/smi.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/sysfs.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/ucm.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/ucma.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/ud_header.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/umem.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/user_mad.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/uverbs_cmd.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/uverbs_main.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/uverbs_marshall.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ofed/drivers/infiniband/core/verbs.c optional ofed \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+
+ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c optional ipoib \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+#ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c optional ipoib \
+# no-depend \
+# compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c optional ipoib \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c optional ipoib \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c optional ipoib \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c optional ipoib \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+#ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c optional ipoib \
+# no-depend \
+# compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
+
+ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
+ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
+ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
+ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
+ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp \
+ no-depend \
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
+
+ofed/drivers/infiniband/hw/mlx4/ah.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/cq.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/doorbell.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/mad.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/main.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/mr.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/qp.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/srq.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/wc.c optional mlx4ib \
+ no-depend obj-prefix "mlx4ib_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+
+ofed/drivers/net/mlx4/alloc.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/catas.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/cmd.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/cq.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/eq.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/fw.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/icm.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/intf.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/main.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/mcg.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/mr.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/pd.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/port.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/profile.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/qp.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/reset.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/sense.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/srq.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/xrcd.c optional mlx4ib | mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+
+ofed/drivers/net/mlx4/en_cq.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_frag.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_main.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_netdev.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_port.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_resources.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_rx.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/en_tx.c optional mlxen \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+
+ofed/drivers/infiniband/hw/mthca/mthca_allocator.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_av.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_catas.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_cmd.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_cq.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_eq.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_mad.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_main.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_mcg.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_memfree.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_mr.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_pd.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_profile.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_provider.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_qp.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_reset.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_srq.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+ofed/drivers/infiniband/hw/mthca/mthca_uar.c optional mthca \
+ no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/"
+
# crypto support
opencrypto/cast.c optional crypto | ipsec
opencrypto/criov.c optional crypto
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index aa0f68a..4deaea8 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -142,6 +142,14 @@ NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
+# Infiniband C flags. Correct include paths and omit errors that linux
+# does not honor.
+OFEDINCLUDES= -I$S/ofed/include/
+OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
+OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
+OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
+OFED_C= ${OFED_C_NOIMP} ${.IMPSRC}
+
GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/}
SYSTEM_CFILES= config.c env.c hints.c vnode_if.c
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
diff --git a/sys/conf/options b/sys/conf/options
index 8207800..9224148 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -862,3 +862,11 @@ X86BIOS
# Flattened device tree options
FDT opt_platform.h
FDT_DTB_STATIC opt_platform.h
+
+# OFED Infiniband stack
+OFED opt_ofed.h
+OFED_DEBUG_INIT opt_ofed.h
+SDP opt_ofed.h
+SDP_DEBUG opt_ofed.h
+IPOIB_DEBUG opt_ofed.h
+IPOIB_CM opt_ofed.h
diff --git a/sys/dev/hptmv/hptproc.c b/sys/dev/hptmv/hptproc.c
index b93ab22..93eff51 100644
--- a/sys/dev/hptmv/hptproc.c
+++ b/sys/dev/hptmv/hptproc.c
@@ -51,8 +51,8 @@ int hpt_rescan_all(void);
static char hptproc_buffer[256];
extern char DRIVER_VERSION[];
-#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
- struct sysctl_req *req
+#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
+ intptr_t arg2, struct sysctl_req *req
#define REAL_HANDLER_ARGS oidp, arg1, arg2, req
typedef struct sysctl_req HPT_GET_INFO;
diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h
index 6522ec4..c09dfb1 100644
--- a/sys/i386/include/endian.h
+++ b/sys/i386/include/endian.h
@@ -69,50 +69,59 @@ extern "C" {
#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
-#define __byte_swap_int_var(x) \
-__extension__ ({ register __uint32_t __X = (x); \
- __asm ("bswap %0" : "+r" (__X)); \
- __X; })
-
-#ifdef __OPTIMIZE__
-
-#define __byte_swap_int_const(x) \
- ((((x) & 0xff000000) >> 24) | \
- (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | \
- (((x) & 0x000000ff) << 24))
-#define __byte_swap_int(x) (__builtin_constant_p(x) ? \
- __byte_swap_int_const(x) : __byte_swap_int_var(x))
-
-#else /* __OPTIMIZE__ */
-
-#define __byte_swap_int(x) __byte_swap_int_var(x)
-
-#endif /* __OPTIMIZE__ */
+#define __bswap64_const(_x) \
+ (((_x) >> 56) | \
+ (((_x) >> 40) & (0xffULL << 8)) | \
+ (((_x) >> 24) & (0xffULL << 16)) | \
+ (((_x) >> 8) & (0xffULL << 24)) | \
+ (((_x) << 8) & (0xffULL << 32)) | \
+ (((_x) << 24) & (0xffULL << 40)) | \
+ (((_x) << 40) & (0xffULL << 48)) | \
+ ((_x) << 56))
+
+#define __bswap32_const(_x) \
+ (((_x) >> 24) | \
+ (((_x) & (0xff << 16)) >> 8) | \
+ (((_x) & (0xff << 8)) << 8) | \
+ ((_x) << 24))
+
+#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8)
static __inline __uint64_t
-__bswap64(__uint64_t _x)
+__bswap64_var(__uint64_t __x)
{
- return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
- ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
- ((_x << 24) & ((__uint64_t)0xff << 40)) |
- ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
+ return __bswap64_const(__x);
}
+
static __inline __uint32_t
-__bswap32(__uint32_t _x)
+__bswap32_var(__uint32_t _x)
{
- return (__byte_swap_int(_x));
+ __asm ("bswap %0" : "+r" (_x));
+ return (_x);
}
static __inline __uint16_t
-__bswap16(__uint16_t _x)
+__bswap16_var(__uint16_t _x)
{
- return (_x << 8 | _x >> 8);
+
+ return (__bswap16_const(_x));
}
+#define __bswap64(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))
+
+#define __bswap32(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
+
+#define __bswap16(_x) \
+ (__builtin_constant_p(_x) ? \
+ __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
+
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index ea1aa1b..daeb2dc 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -74,6 +74,7 @@ struct intr_thread {
/* Interrupt thread flags kept in it_flags */
#define IT_DEAD 0x000001 /* Thread is waiting to exit. */
+#define IT_WAIT 0x000002 /* Thread is waiting for completion. */
struct intr_entropy {
struct thread *td;
@@ -735,6 +736,39 @@ intr_handler_source(void *cookie)
return (ie->ie_source);
}
+/*
+ * Sleep until an ithread finishes executing an interrupt handler.
+ *
+ * XXX Doesn't currently handle interrupt filters or fast interrupt
+ * handlers. This is intended for compatibility with linux drivers
+ * only. Do not use in BSD code.
+ */
+void
+_intr_drain(int irq)
+{
+ struct mtx *mtx;
+ struct intr_event *ie;
+ struct intr_thread *ithd;
+ struct thread *td;
+
+ ie = intr_lookup(irq);
+ if (ie == NULL)
+ return;
+ if (ie->ie_thread == NULL)
+ return;
+ ithd = ie->ie_thread;
+ td = ithd->it_thread;
+ thread_lock(td);
+ mtx = td->td_lock;
+ if (!TD_AWAITING_INTR(td)) {
+ ithd->it_flags |= IT_WAIT;
+ msleep_spin(ithd, mtx, "isync", 0);
+ }
+ mtx_unlock_spin(mtx);
+ return;
+}
+
+
#ifndef INTR_FILTER
int
intr_event_remove_handler(void *cookie)
@@ -1271,6 +1305,7 @@ ithread_loop(void *arg)
struct intr_event *ie;
struct thread *td;
struct proc *p;
+ int wake;
td = curthread;
p = td->td_proc;
@@ -1279,6 +1314,7 @@ ithread_loop(void *arg)
("%s: ithread and proc linkage out of sync", __func__));
ie = ithd->it_event;
ie->ie_count = 0;
+ wake = 0;
/*
* As long as we have interrupts outstanding, go through the
@@ -1319,12 +1355,20 @@ ithread_loop(void *arg)
* set again, so we have to check it again.
*/
thread_lock(td);
- if (!ithd->it_need && !(ithd->it_flags & IT_DEAD)) {
+ if (!ithd->it_need && !(ithd->it_flags & (IT_DEAD | IT_WAIT))) {
TD_SET_IWAIT(td);
ie->ie_count = 0;
mi_switch(SW_VOL | SWT_IWAIT, NULL);
}
+ if (ithd->it_flags & IT_WAIT) {
+ wake = 1;
+ ithd->it_flags &= ~IT_WAIT;
+ }
thread_unlock(td);
+ if (wake) {
+ wakeup(ithd);
+ wake = 0;
+ }
}
}
@@ -1439,6 +1483,7 @@ ithread_loop(void *arg)
struct thread *td;
struct proc *p;
int priv;
+ int wake;
td = curthread;
p = td->td_proc;
@@ -1449,6 +1494,7 @@ ithread_loop(void *arg)
("%s: ithread and proc linkage out of sync", __func__));
ie = ithd->it_event;
ie->ie_count = 0;
+ wake = 0;
/*
* As long as we have interrupts outstanding, go through the
@@ -1492,12 +1538,20 @@ ithread_loop(void *arg)
* set again, so we have to check it again.
*/
thread_lock(td);
- if (!ithd->it_need && !(ithd->it_flags & IT_DEAD)) {
+ if (!ithd->it_need && !(ithd->it_flags & (IT_DEAD | IT_WAIT))) {
TD_SET_IWAIT(td);
ie->ie_count = 0;
mi_switch(SW_VOL | SWT_IWAIT, NULL);
}
+ if (ithd->it_flags & IT_WAIT) {
+ wake = 1;
+ ithd->it_flags &= ~IT_WAIT;
+ }
thread_unlock(td);
+ if (wake) {
+ wakeup(ithd);
+ wake = 0;
+ }
}
}
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index ed98a77..08343dd 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -4182,7 +4182,7 @@ sysctl_jail_param(SYSCTL_HANDLER_ARGS)
i = 0;
return (SYSCTL_OUT(req, &i, sizeof(i)));
case CTLTYPE_STRING:
- snprintf(numbuf, sizeof(numbuf), "%d", arg2);
+ snprintf(numbuf, sizeof(numbuf), "%jd", (intmax_t)arg2);
return
(sysctl_handle_string(oidp, numbuf, sizeof(numbuf), req));
case CTLTYPE_STRUCT:
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 1333c66..b824eac 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -194,7 +194,7 @@ sx_sysinit(void *arg)
{
struct sx_args *sargs = arg;
- sx_init(sargs->sa_sx, sargs->sa_desc);
+ sx_init_flags(sargs->sa_sx, sargs->sa_desc, sargs->sa_flags);
}
void
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index c061a47..0f1e357 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -365,10 +365,31 @@ sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse)
return (error);
}
+int
+sysctl_remove_name(struct sysctl_oid *parent, const char *name,
+ int del, int recurse)
+{
+ struct sysctl_oid *p, *tmp;
+ int error;
+
+ error = ENOENT;
+ SYSCTL_XLOCK();
+ SLIST_FOREACH_SAFE(p, SYSCTL_CHILDREN(parent), oid_link, tmp) {
+ if (strcmp(p->oid_name, name) == 0) {
+ error = sysctl_remove_oid_locked(p, del, recurse);
+ break;
+ }
+ }
+ SYSCTL_XUNLOCK();
+
+ return (error);
+}
+
+
static int
sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse)
{
- struct sysctl_oid *p;
+ struct sysctl_oid *p, *tmp;
int error;
SYSCTL_ASSERT_XLOCKED();
@@ -387,7 +408,8 @@ sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse)
*/
if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
if (oidp->oid_refcnt == 1) {
- SLIST_FOREACH(p, SYSCTL_CHILDREN(oidp), oid_link) {
+ SLIST_FOREACH_SAFE(p,
+ SYSCTL_CHILDREN(oidp), oid_link, tmp) {
if (!recurse)
return (ENOTEMPTY);
error = sysctl_remove_oid_locked(p, del,
@@ -428,14 +450,13 @@ sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse)
}
return (0);
}
-
/*
* Create new sysctls at run time.
* clist may point to a valid context initialized with sysctl_ctx_init().
*/
struct sysctl_oid *
sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent,
- int number, const char *name, int kind, void *arg1, int arg2,
+ int number, const char *name, int kind, void *arg1, intptr_t arg2,
int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr)
{
struct sysctl_oid *oidp;
@@ -479,6 +500,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent,
SYSCTL_CHILDREN_SET(oidp, malloc(sizeof(struct sysctl_oid_list),
M_SYSCTLOID, M_WAITOK));
SLIST_INIT(SYSCTL_CHILDREN(oidp));
+ oidp->oid_arg2 = arg2;
} else {
oidp->oid_arg1 = arg1;
oidp->oid_arg2 = arg2;
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index f6b1ecc..a865586 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1038,7 +1038,7 @@ devclass_driver_added(devclass_t dc, driver_t *driver)
* @param dc the devclass to edit
* @param driver the driver to register
*/
-static int
+int
devclass_add_driver(devclass_t dc, driver_t *driver, int pass, devclass_t *dcp)
{
driverlink_t dl;
@@ -1172,7 +1172,7 @@ devclass_driver_deleted(devclass_t busclass, devclass_t dc, driver_t *driver)
* @param dc the devclass to edit
* @param driver the driver to unregister
*/
-static int
+int
devclass_delete_driver(devclass_t busclass, driver_t *driver)
{
devclass_t dc = devclass_find(driver->name);
diff --git a/sys/net/if.c b/sys/net/if.c
index 2e21ae9..729c1c2 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1881,6 +1881,11 @@ if_route(struct ifnet *ifp, int flag, int fam)
void (*vlan_link_state_p)(struct ifnet *); /* XXX: private from if_vlan */
void (*vlan_trunk_cap_p)(struct ifnet *); /* XXX: private from if_vlan */
+struct ifnet *(*vlan_trunkdev_p)(struct ifnet *);
+struct ifnet *(*vlan_devat_p)(struct ifnet *, uint16_t);
+int (*vlan_tag_p)(struct ifnet *, uint16_t *);
+int (*vlan_setcookie_p)(struct ifnet *, void *);
+void *(*vlan_cookie_p)(struct ifnet *);
/*
* Handle a change in the interface link state. To avoid LORs
@@ -1935,6 +1940,7 @@ do_link_state_change(void *arg, int pending)
if (log_link_state_change)
log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
(link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
+ EVENTHANDLER_INVOKE(ifnet_link_event, ifp, ifp->if_link_state);
CURVNET_RESTORE();
}
diff --git a/sys/net/if_arp.h b/sys/net/if_arp.h
index 2bb6358..38c6402 100644
--- a/sys/net/if_arp.h
+++ b/sys/net/if_arp.h
@@ -50,6 +50,7 @@ struct arphdr {
#define ARPHRD_ARCNET 7 /* arcnet hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
#define ARPHRD_IEEE1394 24 /* firewire hardware format */
+#define ARPHRD_INFINIBAND 32 /* infiniband hardware format */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
index babe743..9ed09f4 100644
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -30,6 +30,8 @@ __FBSDID("$FreeBSD$");
#ifndef _NET_IF_LLATBL_H_
#define _NET_IF_LLATBL_H_
+#include "opt_ofed.h"
+
#include <sys/_rwlock.h>
#include <netinet/in.h>
@@ -72,6 +74,9 @@ struct llentry {
union {
uint64_t mac_aligned;
uint16_t mac16[3];
+#ifdef OFED
+ uint8_t mac8[20]; /* IB needs 20 bytes. */
+#endif
} ll_addr;
/* XXX af-private? */
diff --git a/sys/net/if_types.h b/sys/net/if_types.h
index b2d3a15..c2effac 100644
--- a/sys/net/if_types.h
+++ b/sys/net/if_types.h
@@ -238,6 +238,7 @@
#define IFT_ATMVCIENDPT 0xc2 /* ATM VCI End Point */
#define IFT_OPTICALCHANNEL 0xc3 /* Optical Channel */
#define IFT_OPTICALTRANSPORT 0xc4 /* Optical Transport */
+#define IFT_INFINIBAND 0xc7 /* Infiniband */
#define IFT_BRIDGE 0xd1 /* Transparent bridge interface */
#define IFT_STF 0xd7 /* 6to4 interface */
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 6320352..b3ecb7d 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -352,6 +352,9 @@ EVENTHANDLER_DECLARE(ifnet_arrival_event, ifnet_arrival_event_handler_t);
/* interface departure event */
typedef void (*ifnet_departure_event_handler_t)(void *, struct ifnet *);
EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t);
+/* Interface link state change event */
+typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int);
+EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t);
/*
* interface groups
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 4e24a5f..9dd54e2 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/sx.h>
#include <net/bpf.h>
#include <net/ethernet.h>
@@ -90,13 +91,14 @@ struct ifvlantrunk {
};
struct vlan_mc_entry {
- struct ether_addr mc_addr;
+ struct sockaddr_dl mc_addr;
SLIST_ENTRY(vlan_mc_entry) mc_entries;
};
struct ifvlan {
struct ifvlantrunk *ifv_trunk;
struct ifnet *ifv_ifp;
+ void *ifv_cookie;
#define TRUNK(ifv) ((ifv)->ifv_trunk)
#define PARENT(ifv) ((ifv)->ifv_trunk->parent)
int ifv_pflags; /* special flags we have set on parent */
@@ -153,12 +155,12 @@ static eventhandler_tag iflladdr_tag;
* however on practice it does not. Probably this is because array
* is too big to fit into CPU cache.
*/
-static struct mtx ifv_mtx;
-#define VLAN_LOCK_INIT() mtx_init(&ifv_mtx, "vlan_global", NULL, MTX_DEF)
-#define VLAN_LOCK_DESTROY() mtx_destroy(&ifv_mtx)
-#define VLAN_LOCK_ASSERT() mtx_assert(&ifv_mtx, MA_OWNED)
-#define VLAN_LOCK() mtx_lock(&ifv_mtx)
-#define VLAN_UNLOCK() mtx_unlock(&ifv_mtx)
+static struct sx ifv_lock;
+#define VLAN_LOCK_INIT() sx_init(&ifv_lock, "vlan_global")
+#define VLAN_LOCK_DESTROY() sx_destroy(&ifv_lock)
+#define VLAN_LOCK_ASSERT() sx_assert(&ifv_lock, SA_LOCKED)
+#define VLAN_LOCK() sx_xlock(&ifv_lock)
+#define VLAN_UNLOCK() sx_xunlock(&ifv_lock)
#define TRUNK_LOCK_INIT(trunk) rw_init(&(trunk)->rw, VLANNAME)
#define TRUNK_LOCK_DESTROY(trunk) rw_destroy(&(trunk)->rw)
#define TRUNK_LOCK(trunk) rw_wlock(&(trunk)->rw)
@@ -386,6 +388,47 @@ vlan_dumphash(struct ifvlantrunk *trunk)
}
}
#endif /* 0 */
+#else
+
+static __inline struct ifvlan *
+vlan_gethash(struct ifvlantrunk *trunk, uint16_t tag)
+{
+
+ return trunk->vlans[tag];
+}
+
+static __inline int
+vlan_inshash(struct ifvlantrunk *trunk, struct ifvlan *ifv)
+{
+
+ if (trunk->vlans[ifv->ifv_tag] != NULL)
+ return EEXIST;
+ trunk->vlans[ifv->ifv_tag] = ifv;
+ trunk->refcnt++;
+
+ return (0);
+}
+
+static __inline int
+vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan *ifv)
+{
+
+ trunk->vlans[ifv->ifv_tag] = NULL;
+ trunk->refcnt--;
+
+ return (0);
+}
+
+static __inline void
+vlan_freehash(struct ifvlantrunk *trunk)
+{
+}
+
+static __inline void
+vlan_inithash(struct ifvlantrunk *trunk)
+{
+}
+
#endif /* !VLAN_ARRAY */
static void
@@ -394,9 +437,7 @@ trunk_destroy(struct ifvlantrunk *trunk)
VLAN_LOCK_ASSERT();
TRUNK_LOCK(trunk);
-#ifndef VLAN_ARRAY
vlan_freehash(trunk);
-#endif
trunk->parent->if_vlantrunk = NULL;
TRUNK_UNLOCK(trunk);
TRUNK_LOCK_DESTROY(trunk);
@@ -421,7 +462,6 @@ vlan_setmulti(struct ifnet *ifp)
struct ifmultiaddr *ifma, *rifma = NULL;
struct ifvlan *sc;
struct vlan_mc_entry *mc;
- struct sockaddr_dl sdl;
int error;
/*VLAN_LOCK_ASSERT();*/
@@ -432,17 +472,9 @@ vlan_setmulti(struct ifnet *ifp)
CURVNET_SET_QUIET(ifp_p->if_vnet);
- bzero((char *)&sdl, sizeof(sdl));
- sdl.sdl_len = sizeof(sdl);
- sdl.sdl_family = AF_LINK;
- sdl.sdl_index = ifp_p->if_index;
- sdl.sdl_type = IFT_ETHER;
- sdl.sdl_alen = ETHER_ADDR_LEN;
-
/* First, remove any existing filter entries. */
while ((mc = SLIST_FIRST(&sc->vlan_mc_listhead)) != NULL) {
- bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
- error = if_delmulti(ifp_p, (struct sockaddr *)&sdl);
+ error = if_delmulti(ifp_p, (struct sockaddr *)&mc->mc_addr);
if (error)
return (error);
SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries);
@@ -456,12 +488,11 @@ vlan_setmulti(struct ifnet *ifp)
mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT);
if (mc == NULL)
return (ENOMEM);
- bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- (char *)&mc->mc_addr, ETHER_ADDR_LEN);
+ bcopy(ifma->ifma_addr, &mc->mc_addr, ifma->ifma_addr->sa_len);
+ mc->mc_addr.sdl_index = ifp_p->if_index;
SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
- bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- LLADDR(&sdl), ETHER_ADDR_LEN);
- error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma);
+ error = if_addmulti(ifp_p, (struct sockaddr *)&mc->mc_addr,
+ &rifma);
if (error)
return (error);
}
@@ -503,7 +534,8 @@ vlan_iflladdr(void *arg __unused, struct ifnet *ifp)
LIST_FOREACH_SAFE(ifv, &ifp->if_vlantrunk->hash[i], ifv_list, next) {
#endif /* VLAN_ARRAY */
VLAN_UNLOCK();
- if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN);
+ if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp),
+ ifp->if_addrlen);
VLAN_LOCK();
}
VLAN_UNLOCK();
@@ -564,6 +596,92 @@ restart:
}
/*
+ * Return the trunk device for a virtual interface.
+ */
+static struct ifnet *
+vlan_trunkdev(struct ifnet *ifp)
+{
+ struct ifvlan *ifv;
+
+ if (ifp->if_type != IFT_L2VLAN)
+ return (NULL);
+ ifv = ifp->if_softc;
+ ifp = NULL;
+ VLAN_LOCK();
+ if (ifv->ifv_trunk)
+ ifp = PARENT(ifv);
+ VLAN_UNLOCK();
+ return (ifp);
+}
+
+/*
+ * Return the 16bit vlan tag for this interface.
+ */
+static int
+vlan_tag(struct ifnet *ifp, uint16_t *tagp)
+{
+ struct ifvlan *ifv;
+
+ if (ifp->if_type != IFT_L2VLAN)
+ return (EINVAL);
+ ifv = ifp->if_softc;
+ *tagp = ifv->ifv_tag;
+ return (0);
+}
+
+/*
+ * Return a driver specific cookie for this interface. Synchronization
+ * with setcookie must be provided by the driver.
+ */
+static void *
+vlan_cookie(struct ifnet *ifp)
+{
+ struct ifvlan *ifv;
+
+ if (ifp->if_type != IFT_L2VLAN)
+ return (NULL);
+ ifv = ifp->if_softc;
+ return (ifv->ifv_cookie);
+}
+
+/*
+ * Store a cookie in our softc that drivers can use to store driver
+ * private per-instance data in.
+ */
+static int
+vlan_setcookie(struct ifnet *ifp, void *cookie)
+{
+ struct ifvlan *ifv;
+
+ if (ifp->if_type != IFT_L2VLAN)
+ return (EINVAL);
+ ifv = ifp->if_softc;
+ ifv->ifv_cookie = cookie;
+ return (0);
+}
+
+/*
+ * Return the vlan device present at the specific tag.
+ */
+static struct ifnet *
+vlan_devat(struct ifnet *ifp, uint16_t tag)
+{
+ struct ifvlantrunk *trunk;
+ struct ifvlan *ifv;
+
+ trunk = ifp->if_vlantrunk;
+ if (trunk == NULL)
+ return (NULL);
+ ifp = NULL;
+ TRUNK_RLOCK(trunk);
+ ifv = vlan_gethash(trunk, tag);
+ if (ifv)
+ ifp = ifv->ifv_ifp;
+ TRUNK_RUNLOCK(trunk);
+ return (ifp);
+}
+
+/*
* VLAN support can be loaded as a module. The only place in the
* system that's intimately aware of this is ether_input. We hook
* into this code through vlan_input_p which is defined there and
@@ -593,6 +711,11 @@ vlan_modevent(module_t mod, int type, void *data)
vlan_input_p = vlan_input;
vlan_link_state_p = vlan_link_state;
vlan_trunk_cap_p = vlan_trunk_capabilities;
+ vlan_trunkdev_p = vlan_trunkdev;
+ vlan_cookie_p = vlan_cookie;
+ vlan_setcookie_p = vlan_setcookie;
+ vlan_tag_p = vlan_tag;
+ vlan_devat_p = vlan_devat;
#ifndef VIMAGE
if_clone_attach(&vlan_cloner);
#endif
@@ -615,6 +738,11 @@ vlan_modevent(module_t mod, int type, void *data)
vlan_input_p = NULL;
vlan_link_state_p = NULL;
vlan_trunk_cap_p = NULL;
+ vlan_trunkdev_p = NULL;
+ vlan_tag_p = NULL;
+ vlan_cookie_p = vlan_cookie;
+ vlan_setcookie_p = vlan_setcookie;
+ vlan_devat_p = NULL;
VLAN_LOCK_DESTROY();
if (bootverbose)
printf("vlan: unloaded\n");
@@ -665,7 +793,12 @@ vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
/* Check for <etherif>.<vlan> style interface names. */
IFNET_RLOCK_NOSLEEP();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- if (ifp->if_type != IFT_ETHER)
+ /*
+ * We can handle non-ethernet hardware types as long as
+ * they handle the tagging and headers themselves.
+ */
+ if (ifp->if_type != IFT_ETHER &&
+ (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
continue;
if (strncmp(ifp->if_xname, name, strlen(ifp->if_xname)) != 0)
continue;
@@ -916,7 +1049,7 @@ vlan_start(struct ifnet *ifp)
* devices that just discard such runts instead or mishandle
* them somehow.
*/
- if (soft_pad) {
+ if (soft_pad && p->if_type == IFT_ETHER) {
static char pad[8]; /* just zeros */
int n;
@@ -1020,11 +1153,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
}
TRUNK_RLOCK(trunk);
-#ifdef VLAN_ARRAY
- ifv = trunk->vlans[tag];
-#else
ifv = vlan_gethash(trunk, tag);
-#endif
if (ifv == NULL || !UP_AND_RUNNING(ifv->ifv_ifp)) {
TRUNK_RUNLOCK(trunk);
m_freem(m);
@@ -1050,7 +1179,8 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag)
/* VID numbers 0x0 and 0xFFF are reserved */
if (tag == 0 || tag == 0xFFF)
return (EINVAL);
- if (p->if_type != IFT_ETHER)
+ if (p->if_type != IFT_ETHER &&
+ (p->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
return (EPROTONOSUPPORT);
if ((p->if_flags & VLAN_IFFLAGS) != VLAN_IFFLAGS)
return (EPROTONOSUPPORT);
@@ -1060,15 +1190,11 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag)
if (p->if_vlantrunk == NULL) {
trunk = malloc(sizeof(struct ifvlantrunk),
M_VLAN, M_WAITOK | M_ZERO);
-#ifndef VLAN_ARRAY
vlan_inithash(trunk);
-#endif
VLAN_LOCK();
if (p->if_vlantrunk != NULL) {
/* A race that that is very unlikely to be hit. */
-#ifndef VLAN_ARRAY
vlan_freehash(trunk);
-#endif
free(trunk, M_VLAN);
goto exists;
}
@@ -1084,18 +1210,9 @@ exists:
}
ifv->ifv_tag = tag; /* must set this before vlan_inshash() */
-#ifdef VLAN_ARRAY
- if (trunk->vlans[tag] != NULL) {
- error = EEXIST;
- goto done;
- }
- trunk->vlans[tag] = ifv;
- trunk->refcnt++;
-#else
error = vlan_inshash(trunk, ifv);
if (error)
goto done;
-#endif
ifv->ifv_proto = ETHERTYPE_VLAN;
ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
ifv->ifv_mintu = ETHERMIN;
@@ -1125,8 +1242,19 @@ exists:
ifv->ifv_trunk = trunk;
ifp = ifv->ifv_ifp;
+ /*
+ * Initialize fields from our parent. This duplicates some
+ * work with ether_ifattach() but allows for non-ethernet
+ * interfaces to also work.
+ */
ifp->if_mtu = p->if_mtu - ifv->ifv_mtufudge;
ifp->if_baudrate = p->if_baudrate;
+ ifp->if_output = p->if_output;
+ ifp->if_input = p->if_input;
+ ifp->if_resolvemulti = p->if_resolvemulti;
+ ifp->if_addrlen = p->if_addrlen;
+ ifp->if_broadcastaddr = p->if_broadcastaddr;
+
/*
* Copy only a selected subset of flags from the parent.
* Other flags are none of our business.
@@ -1141,10 +1269,12 @@ exists:
vlan_capabilities(ifv);
/*
- * Set up our ``Ethernet address'' to reflect the underlying
+ * Set up our interface address to reflect the underlying
* physical interface's.
*/
- bcopy(IF_LLADDR(p), IF_LLADDR(ifp), ETHER_ADDR_LEN);
+ bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen);
+ ((struct sockaddr_dl *)ifp->if_addr->ifa_addr)->sdl_alen =
+ p->if_addrlen;
/*
* Configure multicast addresses that may already be
@@ -1187,7 +1317,6 @@ vlan_unconfig_locked(struct ifnet *ifp)
parent = NULL;
if (trunk != NULL) {
- struct sockaddr_dl sdl;
TRUNK_LOCK(trunk);
parent = trunk->parent;
@@ -1197,17 +1326,7 @@ vlan_unconfig_locked(struct ifnet *ifp)
* empty the list of multicast groups that we may have joined
* while we were alive from the parent's list.
*/
- bzero((char *)&sdl, sizeof(sdl));
- sdl.sdl_len = sizeof(sdl);
- sdl.sdl_family = AF_LINK;
- sdl.sdl_index = parent->if_index;
- sdl.sdl_type = IFT_ETHER;
- sdl.sdl_alen = ETHER_ADDR_LEN;
-
while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) {
- bcopy((char *)&mc->mc_addr, LLADDR(&sdl),
- ETHER_ADDR_LEN);
-
/*
* This may fail if the parent interface is
* being detached. Regardless, we should do a
@@ -1215,18 +1334,14 @@ vlan_unconfig_locked(struct ifnet *ifp)
* as possible as all callers expect vlan
* destruction to succeed.
*/
- (void)if_delmulti(parent, (struct sockaddr *)&sdl);
+ (void)if_delmulti(parent,
+ (struct sockaddr *)&mc->mc_addr);
SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries);
free(mc, M_VLAN);
}
vlan_setflags(ifp, 0); /* clear special flags on parent */
-#ifdef VLAN_ARRAY
- trunk->vlans[ifv->ifv_tag] = NULL;
- trunk->refcnt--;
-#else
vlan_remhash(trunk, ifv);
-#endif
ifv->ifv_trunk = NULL;
/*
@@ -1407,14 +1522,31 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct ifnet *p;
struct ifreq *ifr;
+ struct ifaddr *ifa;
struct ifvlan *ifv;
struct vlanreq vlr;
int error = 0;
ifr = (struct ifreq *)data;
+ ifa = (struct ifaddr *) data;
ifv = ifp->if_softc;
switch (cmd) {
+ case SIOCSIFADDR:
+ ifp->if_flags |= IFF_UP;
+#ifdef INET
+ if (ifa->ifa_addr->sa_family == AF_INET)
+ arp_ifinit(ifp, ifa);
+#endif
+ break;
+ case SIOCGIFADDR:
+ {
+ struct sockaddr *sa;
+
+ sa = (struct sockaddr *)&ifr->ifr_data;
+ bcopy(IF_LLADDR(ifp), sa->sa_data, ifp->if_addrlen);
+ }
+ break;
case SIOCGIFMEDIA:
VLAN_LOCK();
if (TRUNK(ifv) != NULL) {
@@ -1534,7 +1666,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
default:
- error = ether_ioctl(ifp, cmd, data);
+ error = EINVAL;
+ break;
}
return (error);
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index ec71df1..fd3fc4f 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -131,7 +131,25 @@ struct vlanreq {
(*vlan_trunk_cap_p)(_ifp); \
} while (0)
+#define VLAN_TRUNKDEV(_ifp) \
+ (_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL
+#define VLAN_TAG(_ifp, _tag) \
+ (_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_tag)) : EINVAL
+#define VLAN_COOKIE(_ifp) \
+ (_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL
+#define VLAN_SETCOOKIE(_ifp, _cookie) \
+ (_ifp)->if_type == IFT_L2VLAN ? \
+ (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL
+#define VLAN_DEVAT(_ifp, _tag) \
+ (_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_tag)) : NULL
+
extern void (*vlan_trunk_cap_p)(struct ifnet *);
+extern struct ifnet *(*vlan_trunkdev_p)(struct ifnet *);
+extern struct ifnet *(*vlan_devat_p)(struct ifnet *, uint16_t);
+extern int (*vlan_tag_p)(struct ifnet *, uint16_t *);
+extern int (*vlan_setcookie_p)(struct ifnet *, void *);
+extern void *(*vlan_cookie_p)(struct ifnet *);
+
#endif /* _KERNEL */
#endif /* _NET_IF_VLAN_VAR_H_ */
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 764046a..3afdc7d 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -441,7 +441,8 @@ arpintr(struct mbuf *m)
if (ntohs(ar->ar_hrd) != ARPHRD_ETHER &&
ntohs(ar->ar_hrd) != ARPHRD_IEEE802 &&
ntohs(ar->ar_hrd) != ARPHRD_ARCNET &&
- ntohs(ar->ar_hrd) != ARPHRD_IEEE1394) {
+ ntohs(ar->ar_hrd) != ARPHRD_IEEE1394 &&
+ ntohs(ar->ar_hrd) != ARPHRD_INFINIBAND) {
log(LOG_ERR, "arp: unknown hardware address format (0x%2D)\n",
(unsigned char *)&ar->ar_hrd, "");
m_freem(m);
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index ba3ceae9..c522422 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2298,6 +2298,7 @@ in6_if2idlen(struct ifnet *ifp)
#ifdef IFT_MIP
case IFT_MIP: /* ditto */
#endif
+ case IFT_INFINIBAND:
return (64);
case IFT_FDDI: /* RFC2467 */
return (64);
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index fe8bada..f1e48ea 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -2100,6 +2100,7 @@ nd6_need_cache(struct ifnet *ifp)
#ifdef IFT_CARP
case IFT_CARP:
#endif
+ case IFT_INFINIBAND:
case IFT_GIF: /* XXX need more cases? */
case IFT_PPP:
case IFT_TUNNEL:
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 720ae1f..3b4b655 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1132,6 +1132,7 @@ nd6_ifptomac(struct ifnet *ifp)
#ifdef IFT_CARP
case IFT_CARP:
#endif
+ case IFT_INFINIBAND:
case IFT_BRIDGE:
case IFT_ISO88025:
return IF_LLADDR(ifp);
@@ -1449,6 +1450,7 @@ nd6_dad_duplicated(struct ifaddr *ifa)
#ifdef IFT_IEEE80211
case IFT_IEEE80211:
#endif
+ case IFT_INFINIBAND:
in6 = ia->ia_addr.sin6_addr;
if (in6_get_hw_ifid(ifp, &in6) == 0 &&
IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &in6)) {
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 514eaba..abb4e64 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -464,7 +464,10 @@ void device_verbose(device_t dev);
/*
* Access functions for devclass.
*/
+int devclass_add_driver(devclass_t dc, driver_t *driver,
+ int pass, devclass_t *dcp);
devclass_t devclass_create(const char *classname);
+int devclass_delete_driver(devclass_t busclass, driver_t *driver);
devclass_t devclass_find(const char *classname);
const char *devclass_get_name(devclass_t dc);
device_t devclass_get_device(devclass_t dc, int unit);
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 061ce02..e4edac9 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -63,6 +63,7 @@ struct socket;
#define DTYPE_SHM 8 /* swap-backed shared memory */
#define DTYPE_SEM 9 /* posix semaphore */
#define DTYPE_PTS 10 /* pseudo teletype master device */
+#define DTYPE_DEV 11 /* Device specific fd type */
#ifdef _KERNEL
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 5c2f578..fb253ae 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -176,6 +176,7 @@ int intr_event_remove_handler(void *cookie);
int intr_getaffinity(int irq, void *mask);
void *intr_handler_source(void *cookie);
int intr_setaffinity(int irq, void *mask);
+void _intr_drain(int irq); /* Linux compat only. */
int swi_add(struct intr_event **eventp, const char *name,
driver_intr_t handler, void *arg, int pri, enum intr_type flags,
void **cookiep);
diff --git a/sys/sys/jail.h b/sys/sys/jail.h
index d7a0622..85c629a 100644
--- a/sys/sys/jail.h
+++ b/sys/sys/jail.h
@@ -379,7 +379,7 @@ int prison_check_af(struct ucred *cred, int af);
int prison_if(struct ucred *cred, struct sockaddr *sa);
char *prison_name(struct prison *, struct prison *);
int prison_priv_check(struct ucred *cred, int priv);
-int sysctl_jail_param(struct sysctl_oid *, void *, int , struct sysctl_req *);
+int sysctl_jail_param(SYSCTL_HANDLER_ARGS);
#endif /* _KERNEL */
#endif /* !_SYS_JAIL_H_ */
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index 67f7d97..da16b60 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -118,18 +118,22 @@ int sx_chain(struct thread *td, struct thread **ownerp);
struct sx_args {
struct sx *sa_sx;
const char *sa_desc;
+ int sa_flags;
};
-#define SX_SYSINIT(name, sxa, desc) \
+#define SX_SYSINIT_FLAGS(name, sxa, desc, flags) \
static struct sx_args name##_args = { \
(sxa), \
- (desc) \
+ (desc), \
+ (flags) \
}; \
SYSINIT(name##_sx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
sx_sysinit, &name##_args); \
SYSUNINIT(name##_sx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
sx_destroy, (sxa))
+#define SX_SYSINIT(name, sxa, desc) SX_SYSINIT_FLAGS(name, sxa, desc, 0)
+
/*
* Full lock operations that are suitable to be inlined in non-debug kernels.
* If the lock can't be acquired or released trivially then the work is
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index a4e6125..b2ebae3 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -117,8 +117,8 @@ struct ctlname {
#ifdef _KERNEL
#include <sys/linker_set.h>
-#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
- struct sysctl_req *req
+#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
+ intptr_t arg2, struct sysctl_req *req
/* definitions for sysctl_req 'lock' member */
#define REQ_UNWIRED 1
@@ -160,7 +160,7 @@ struct sysctl_oid {
int oid_number;
u_int oid_kind;
void *oid_arg1;
- int oid_arg2;
+ intptr_t oid_arg2;
const char *oid_name;
int (*oid_handler)(SYSCTL_HANDLER_ARGS);
const char *oid_fmt;
@@ -746,9 +746,11 @@ extern char kern_ident[];
/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
struct sysctl_oid_list *parent, int nbr, const char *name,
- int kind, void *arg1, int arg2,
+ int kind, void *arg1, intptr_t arg2,
int (*handler) (SYSCTL_HANDLER_ARGS),
const char *fmt, const char *descr);
+int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
+ int recurse);
void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
int sysctl_move_oid(struct sysctl_oid *oidp,
struct sysctl_oid_list *parent);
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index c4fa715..4434cdf 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -112,7 +112,7 @@ static uma_zone_t slabrefzone; /* With refcounters (for UMA_ZONE_REFCNT) */
static uma_zone_t hashzone;
/* The boot-time adjusted value for cache line alignment. */
-static int uma_align_cache = 64 - 1;
+int uma_align_cache = 64 - 1;
static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets");
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 79d90f5..22fbda1 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2324,7 +2324,11 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
unsigned int last_timestamp;
int rv;
boolean_t fictitious, need_wakeup, result, user_wire;
+ vm_prot_t prot;
+ prot = 0;
+ if (flags & VM_MAP_WIRE_WRITE)
+ prot |= VM_PROT_WRITE;
user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE;
vm_map_lock(map);
VM_MAP_RANGE_CHECK(map, start, end);
@@ -2392,20 +2396,17 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
* above.)
*/
entry->eflags |= MAP_ENTRY_IN_TRANSITION;
- /*
- *
- */
- if (entry->wired_count == 0) {
- if ((entry->protection & (VM_PROT_READ|VM_PROT_EXECUTE))
- == 0) {
- entry->eflags |= MAP_ENTRY_WIRE_SKIPPED;
- if ((flags & VM_MAP_WIRE_HOLESOK) == 0) {
- end = entry->end;
- rv = KERN_INVALID_ADDRESS;
- goto done;
- }
- goto next_entry;
+ if ((entry->protection & (VM_PROT_READ | VM_PROT_EXECUTE)) == 0
+ || (entry->protection & prot) != prot) {
+ entry->eflags |= MAP_ENTRY_WIRE_SKIPPED;
+ if ((flags & VM_MAP_WIRE_HOLESOK) == 0) {
+ end = entry->end;
+ rv = KERN_INVALID_ADDRESS;
+ goto done;
}
+ goto next_entry;
+ }
+ if (entry->wired_count == 0) {
entry->wired_count++;
saved_start = entry->start;
saved_end = entry->end;
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
index 4335efe..5311e02 100644
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -346,6 +346,8 @@ long vmspace_wired_count(struct vmspace *vmspace);
#define VM_MAP_WIRE_NOHOLES 0 /* region must not have holes */
#define VM_MAP_WIRE_HOLESOK 2 /* region may have holes */
+#define VM_MAP_WIRE_WRITE 4 /* Validate writable. */
+
#ifdef _KERNEL
boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t);
vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t);
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index 4abb567..6d66167 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -53,6 +53,7 @@ struct file_list {
char *f_depends; /* additional dependancies */
char *f_clean; /* File list to add to clean rule */
char *f_warn; /* warning message */
+ const char *f_objprefix; /* prefix string for object name */
};
struct files_name {
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index dd7aaa9..2372839 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -312,6 +312,7 @@ read_file(char *fname)
struct device *dp;
struct opt *op;
char *wd, *this, *compilewith, *depends, *clean, *warning;
+ const char *objprefix;
int compile, match, nreqs, std, filetype,
imp_rule, no_obj, before_depend, mandatory, nowerror;
@@ -326,6 +327,7 @@ next:
* [ compile-with "compile rule" [no-implicit-rule] ]
* [ dependency "dependency-list"] [ before-depend ]
* [ clean "file-list"] [ warning "text warning" ]
+ * [ obj-prefix "file prefix"]
*/
wd = get_word(fp);
if (wd == (char *)EOF) {
@@ -373,6 +375,7 @@ next:
before_depend = 0;
nowerror = 0;
filetype = NORMAL;
+ objprefix = "";
if (eq(wd, "standard")) {
std = 1;
/*
@@ -467,6 +470,16 @@ nextparam:
warning = ns(wd);
goto nextparam;
}
+ if (eq(wd, "obj-prefix")) {
+ next_quoted_word(fp, wd);
+ if (wd == 0) {
+ printf("%s: %s missing object prefix string.\n",
+ fname, this);
+ exit(1);
+ }
+ objprefix = ns(wd);
+ goto nextparam;
+ }
nreqs++;
if (eq(wd, "local")) {
filetype = LOCAL;
@@ -535,6 +548,7 @@ doneparam:
tp->f_depends = depends;
tp->f_clean = clean;
tp->f_warn = warning;
+ tp->f_objprefix = objprefix;
goto next;
}
@@ -619,11 +633,12 @@ do_objs(FILE *fp)
cp = sp + (len = strlen(sp)) - 1;
och = *cp;
*cp = 'o';
+ len += strlen(tp->f_objprefix);
if (len + lpos > 72) {
lpos = 8;
fprintf(fp, "\\\n\t");
}
- fprintf(fp, "%s ", sp);
+ fprintf(fp, "%s%s ", tp->f_objprefix, sp);
lpos += len + 1;
*cp = och;
}
@@ -699,30 +714,33 @@ do_rules(FILE *f)
och = *cp;
if (ftp->f_flags & NO_IMPLCT_RULE) {
if (ftp->f_depends)
- fprintf(f, "%s: %s\n", np, ftp->f_depends);
+ fprintf(f, "%s%s: %s\n",
+ ftp->f_objprefix, np, ftp->f_depends);
else
- fprintf(f, "%s: \n", np);
+ fprintf(f, "%s%s: \n", ftp->f_objprefix, np);
}
else {
*cp = '\0';
if (och == 'o') {
- fprintf(f, "%so:\n\t-cp $S/%so .\n\n",
- tail(np), np);
+ fprintf(f, "%s%so:\n\t-cp $S/%so .\n\n",
+ ftp->f_objprefix, tail(np), np);
continue;
}
if (ftp->f_depends) {
- fprintf(f, "%sln: $S/%s%c %s\n", tail(np),
- np, och, ftp->f_depends);
+ fprintf(f, "%s%sln: $S/%s%c %s\n",
+ ftp->f_objprefix, tail(np), np, och,
+ ftp->f_depends);
fprintf(f, "\t${NORMAL_LINT}\n\n");
- fprintf(f, "%so: $S/%s%c %s\n", tail(np),
- np, och, ftp->f_depends);
+ fprintf(f, "%s%so: $S/%s%c %s\n",
+ ftp->f_objprefix, tail(np), np, och,
+ ftp->f_depends);
}
else {
- fprintf(f, "%sln: $S/%s%c\n", tail(np),
- np, och);
+ fprintf(f, "%s%sln: $S/%s%c\n",
+ ftp->f_objprefix, tail(np), np, och);
fprintf(f, "\t${NORMAL_LINT}\n\n");
- fprintf(f, "%so: $S/%s%c\n", tail(np),
- np, och);
+ fprintf(f, "%s%so: $S/%s%c\n",
+ ftp->f_objprefix, tail(np), np, och);
}
}
compilewith = ftp->f_compilewith;
@@ -750,7 +768,10 @@ do_rules(FILE *f)
compilewith = cmd;
}
*cp = och;
- fprintf(f, "\t%s\n\n", compilewith);
+ if (strlen(ftp->f_objprefix))
+ fprintf(f, "\t%s $S/%s\n\n", compilewith, np);
+ else
+ fprintf(f, "\t%s\n\n", compilewith);
}
}
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 1f62230..e245ac2 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -822,11 +822,15 @@ static char *
ether_str(struct sockaddr_dl *sdl)
{
static char hbuf[NI_MAXHOST];
+ char *cp;
- if (sdl->sdl_alen > 0)
+ if (sdl->sdl_alen == ETHER_ADDR_LEN) {
strlcpy(hbuf, ether_ntoa((struct ether_addr *)LLADDR(sdl)),
sizeof(hbuf));
- else
+ } else if (sdl->sdl_alen) {
+ int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0;
+ snprintf(hbuf, sizeof(hbuf), "%s", link_ntoa(sdl) + n);
+ } else
snprintf(hbuf, sizeof(hbuf), "(incomplete)");
return(hbuf);
OpenPOWER on IntegriCloud