Improve locking of multicast addresses in VLAN and LAGG interfaces.

This fixes several scenarios of reproducible panics, cause by races
between multicast address changes and interface destruction.

MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269492 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add support for Windows dialect of EXTENDED COPY command, aka Microsoft ODX.

This allows to avoid extra network traffic when copying files on NTFS iSCSI
disks within one storage host by drag'n'dropping them in Windows Explorer
of Windows 8/2012.  It should also accelerate Hyper-V VM operations, etc.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269497 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make the ixgbe(4) module buildable outside of the tree.

It defaults to RSS not being enabled.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269500 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make igb(4) build outside of the kernel build.

Ths defaults to RSS being disabled.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269501 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix an overflow in getsockopt(). optval isn't big enough to hold
sbintime_t.
Re-introduce r255030 behaviour capping socket timeouts to INT_32
if they're too large.

CR:	https://phabric.freebsd.org/D433
Reported by:	demon
Reviewed by:	bde [1], jhb [2]
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269502 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove hardcoded path to TESTSDIR (Makefile, ld_library_pathfds.c) at
build time by using atf_tc_get_config_var(tc, "srcdir"))

This will allow end-users to move the binaries to different locations
after they've been built without having to rebuild the binaries with
the new paths

Phabric: D525 (part of a larger patch)

Reviewed by: jmmv
Approved by: jmmv (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269503 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a -Wsecurity warning with clang

Phabric: D525 (part of a larger patch)

Reviewed by: jmmv
Approved by: jmmv (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269504 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Move a -L argument from LDADD to LDFLAGS

Phabric: D525 (part of a larger patch)

Reviewed by: jmmv
Approved by: jmmv (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269505 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix BINDIR to not duplicate "${TESTSDIR}

This should fix 'make release' with MK_TESTS != no

Phabric: D525 (part of a larger patch)

Reviewed by: jmmv
Approved by: jmmv (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269506 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: implement event channel PIRQ support

This allows Dom0 to manage physical hardware, redirecting the
physical interrupts to event channels.

Sponsored by: Citrix Systems R&D

x86/xen/xen_intr.c:
 - Expand struct xenisrc to hold the level and triggering of PIRQ
   event channels.
 - Implement missing methods in xen_intr_pirq_pic.
 - Allow xen_intr_alloc_isrc to take a vector parameter that globally
   identifies the interrupt. This is only used for PIRQs that are
   bound to a specific hardware IRQ.
 - Introduce xen_register_pirq used to register IO APIC legacy PIRQ
   interrupts.
 - Add support for the dynamic PIRQ EOI map, this shared memory is
   modified by Xen (if it suppoorts that feature), and notifies the
   guest if an EOI is needed or not. If it's not available fall back
   to the old implementation using PHYSDEVOP_irq_status_query.
 - Rename xen_intr_isrc_count to xen_intr_auto_vector_count and
   replace it's usages.
 - Align static variables by name.

xen/xen_intr.h:
 - Add prototype for xen_register_pirq.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269507 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: mask all event channels on init

Mask all event channels during initialization. This is done so that we
don't receive spurious interrupts while dynamically registering new
event channels. There's a small window during registration where an
event channel can fire before we have attached a handler to it.

Sponsored by: Citrix Systems R&D

x86/xen/xen_intr.c:
 - Mask all event channels on init.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269508 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: add a DDB command to print event channel information

Add a new DDB command to dump all registered event channels.

Sponsored by: Citrix Systems R&D

x86/xen/xen_intr.c:
 - Add a new xen_evtchn command to DDB in order to dump all
   information related to event channels.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269509 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: change order of Xen intr init and IO APIC registration

This change inserts the Xen interrupt subsystem (event channels)
initialization between the system interrupt initialization and the IO
APIC source registration.

This is needed when running on Dom0, that routes physical interrupts
on top of event channels, so that the interrupt sources found during
IO APIC initialization can be registered using the Xen interrupt
subsystem.

The resulting order in the SI_SUB_INTR stage is the following:

- System intr initialization
- Xen intr initalization
- IO APIC source registration

Sponsored by: Citrix Systems R&D

x86/x86/local_apic.c:
 - Change order of apic_setup_io to be called after xen interrupt
   subsystem is setup.

x86/xen/xen_intr.c:
 - Init Xen event channels before apic_setup_io.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269510 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: change quality of the MADT ACPI enumerator

Lower the quality of the MADT ACPI enumerator, so on Xen Dom0 we can
force the usage of the Xen mptable enumerator even when ACPI is
detected.

This is needed because Xen might restrict the number of vCPUs
available to Dom0, but the MADT ACPI table parsed in FreeBSD is the
native one (which enumerates all the CPUs available in the system).

Sponsored by: Citrix Systems R&D
Reviewed by: gibbs

x86/acpica/madt.c:
 - Lower MADT enumerator quality to -50.

x86/xen/pvcpu_enum.c:
 - Rise Xen PV enumerator to 0.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269511 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
x86/madt: make the interrupt override parser a public function

Split a portion of the code in madt_parse_interrupt_override to a
separate function, that is public and can be used from other code.
This will be needed by the Xen port, since FreeBSD needs to parse the
interrupt overrides and notify Xen about them.

This commit should not introduce any functional change.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb, gibbs

x86/acpica/madt.c:
 - Introduce madt_parse_interrupt_values() that parses the intr
   information from ACPI and returns the triggering and the polarity.
   This is a subset of the functionality that used to be part of
   madt_parse_interrupt_override().
 - Make madt_found_sci_override a global variable that can be used
   from other files.

x86/include/acpica_machdep.h:
 - Prototype of madt_parse_interrupt_values.
 - Extern declaration of madt_found_sci_override.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269512 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: implement support for mapping IO APIC interrupts on Xen

Allow a privileged Xen guest (Dom0) to parse the MADT ACPI interrupt
overrides and register them with the interrupt subsystem.

Also add a Xen specific implementation for bus_config_intr that
registers interrupts on demand for all the vectors less than
FIRST_MSI_INT.

Sponsored by: Citrix Systems R&D

x86/xen/pvcpu_enum.c:
 - Use helper functions from x86/acpica/madt.c in order to parse
   interrupt overrides from the MADT.
 - Walk the MADT and register any interrupt override with the
   interrupt subsystem.

x86/xen/xen_nexus.c:
 - Add a custom bus_config_intr method for Xen that intercepts calls
   to configure unset interrupts and registers them on the fly (if the
   vector is < FIRST_MSI_INT).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269513 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: Dom0 console fixes

Minor fixes to make the Xen Dom0 console work. This includes always
returning there's pending input in xencons_has_input, because on Dom0
there's no shared ring and we cannot test the indexes. The second
fix is to use the CONSOLEIO_read hypercall in order to read input
data from the Xen console.

Sponsored by: Citrix Systems R&D

dev/xen/console/xencons_ring.c:
 - Always return true in xencons_has_input for Dom0.
 - Implement Dom0 console support for xencons_handle_input.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269514 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
xen: add ACPI bus to xen_nexus when running as Dom0

Also disable a couple of ACPI devices that are not usable under Dom0.
To this end a couple of booleans are added that allow disabling ACPI
specific devices.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb

x86/xen/xen_nexus.c:
 - Return BUS_PROBE_SPECIFIC in the Xen Nexus attachement routine to
   force the usage of the Xen Nexus.
 - Attach the ACPI bus when running as Dom0.

dev/acpica/acpi_cpu.c:
dev/acpica/acpi_hpet.c:
dev/acpica/acpi_timer.c
 - Add a variable that gates the addition of the devices.

x86/include/init.h:
 - Declare variables that control the attachment of ACPI cpu, hpet and
   timer devices.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269515 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added support for extra ifconfig args to jail ip4.addr & ip6.addr params

This allows for CARP interfaces to be  used in jails e.g.
ip4.addr = "em0|10.10.1.20/32 vhid 1 pass MyPass advskew 100"

Before this change using exec.prestart to configure a CARP address
would result in the wrong MAC being broadcast on startup as jail creates
IP aliases to support ip[4|6].addr before exec.prestart is executed.

PR:		191832
Reviewed by:	jamie
MFC after:	1 week
X-MFC-With:	r269340
Phabric:	D528
Sponsored by:	Multiplay


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269522 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
set EXT2_LINK_MAX to LINK_MAX

In linux EXT4_LINK_MAX is now 64000.  We can't really do that
since i_nlink and va_nlink are signed so setting higher values
is likely to cause trouble.

This is a system limitation so set the EXT_LINK_MAX to
what the system can handle.

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@269523 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f