Commit Graph

30511 Commits

Author SHA1 Message Date
Michal Meloun
086a6314e8 OFW: Fix ofw_bus_string_list_to_array() function.
Originally committed version was unfinished and didn't work at all,
because I took it from the wrong WIP branch by mistake.

Approved by:	kib (mentor)
2016-01-20 14:49:01 +00:00
Zbigniew Bodek
1e92574faa Fix invalid root link detection in mv_pci driver
mv_pci driver omitted slot 0, which can be valid device on Armada38x.
New mechanism detects if device is root link, basing on vendor's
and device's IDs.
It is restricted to Armada38x; on other machines, behaviour remains
the same.

Reviewed by:    andrew
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4377
2016-01-20 14:05:21 +00:00
Zbigniew Bodek
5c8fae4064 Improve attachment of the ehci_mv driver
Driver was modified to ensure it attaches properly to "marvell,orion-ehci"
node, which doesn't have error interrupt line defined. Neccessary
ofw_compat_data struct was added and probe procedure was altered.

Reviewed by:    andrew, ian
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4369
2016-01-20 13:58:07 +00:00
Zbigniew Bodek
8abfc69d11 Fix busy-detect when using DesignWare UART
uart_dev_ns8250 now relies on compatible property instead of additional
'busy-detect' cell. All drivers with compatible = "snps,dw-apb-uart" have
busy detection turned on. DTS files of devices affected by the change
were modified and 'busy-detect' property was removed.

Reviewed by:    andrew, ian, imp
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4218
2016-01-20 13:51:14 +00:00
Zbigniew Bodek
a6c981778c Add compatibility string for dw-apb-uart in ns8250 driver
This compatibility string is used in .dts file of Armada38x
and isrequired for driver attachment.

Reviewed by:    andrew, ian, imp
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Michal Stanek <mst@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4216
2016-01-20 13:47:44 +00:00
Zbigniew Bodek
b2ea73e3bb Do not require strict compatibility on simplebus
Strict compatibility requirement is a root of problems when simplebus'
node has two compatibility strings (i.e. on Armada38x). Removing this
requirement should not interfere with other platforms.

fdt_is_compatible_strict() and fdt_find_compatible() calls were changed
in fdt_common.c and mv_common.c.

Reviewed by:    ian, imp
Obtained from:	Semihalf
Sponsored by:	Stormshield
Submitted by:	Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4602
2016-01-20 13:35:06 +00:00
Andrew Rybchenko
a63987426f sfxge: refresh version to note matching version of out-of-tree driver
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-20 06:56:18 +00:00
Andrew Rybchenko
d2a37b9c9d sfxge: cleanup: support __out_bcount_part[_opt] PREfast annotations
New annotation coming into use in the common code. Support its use by
adding null macro definitions for non-Windows platforms.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
X-MFC with:     r293901
2016-01-20 06:50:30 +00:00
Marius Strobl
9750d9e5b6 Fix tty_drain() and, thus, TIOCDRAIN of the current tty(4) incarnation
to actually wait until the TX FIFOs of UARTs have be drained before
returning. This is done by bringing the equivalent of the TS_BUSY flag
found in the previous implementation back in an ABI-preserving way.
Reported and tested by: Patrick Powell

Most likely, drivers for USB-serial-adapters likewise incorporating
TX FIFOs as well as other terminal devices that buffer output in some
form should also provide implementations of tsw_busy.

MFC after:	3 days
2016-01-19 23:34:27 +00:00
Hans Petter Selasky
e936121d31 Add optimizing LRO wrapper:
- Add optimizing LRO wrapper which pre-sorts all incoming packets
  according to the hash type and flowid. This prevents exhaustion of
  the LRO entries due to too many connections at the same time.
  Testing using a larger number of higher bandwidth TCP connections
  showed that the incoming ACK packet aggregation rate increased from
  ~1.3:1 to almost 3:1. Another test showed that for a number of TCP
  connections greater than 16 per hardware receive ring, where 8 TCP
  connections was the LRO active entry limit, there was a significant
  improvement in throughput due to being able to fully aggregate more
  than 8 TCP stream. For very few very high bandwidth TCP streams, the
  optimizing LRO wrapper will add CPU usage instead of reducing CPU
  usage. This is expected. Network drivers which want to use the
  optimizing LRO wrapper needs to call "tcp_lro_queue_mbuf()" instead
  of "tcp_lro_rx()" and "tcp_lro_flush_all()" instead of
  "tcp_lro_flush()". Further the LRO control structure must be
  initialized using "tcp_lro_init_args()" passing a non-zero number
  into the "lro_mbufs" argument.

- Make LRO statistics 64-bit. Previously 32-bit integers were used for
  statistics which can be prone to wrap-around. Fix this while at it
  and update all SYSCTL's which expose LRO statistics.

- Ensure all data is freed when destroying a LRO control structures,
  especially leftover LRO entries.

- Reduce number of memory allocations needed when setting up a LRO
  control structure by precomputing the total amount of memory needed.

- Add own memory allocation counter for LRO.

- Bump the FreeBSD version to force recompilation of all KLDs due to
  change of the LRO control structure size.

Sponsored by:	Mellanox Technologies
Reviewed by:	gallatin, sbruno, rrs, gnn, transport
Tested by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D4914
2016-01-19 15:33:28 +00:00
Hans Petter Selasky
d7633a3070 Fix an issue where the network adapter could be left in down state
after changing the HW LRO sysctl when previously in up state.

Reviewed by:	gnn
Sponsored by:	Mellanox Technologies
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D4941
2016-01-19 10:24:47 +00:00
Hans Petter Selasky
636d1fec4d Add clarifying comment about CQE zipping.
Reviewed by:	gnn
Sponsored by:	Mellanox Technologies
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D4940
2016-01-19 10:19:33 +00:00
Hans Petter Selasky
1558d49bb1 Declare local variables at top of function.
Reviewed by:	gnn
Sponsored by:	Mellanox Technologies
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D4939
2016-01-19 10:17:24 +00:00
Hans Petter Selasky
4d3b91a762 Allow RX and TX pause frames to be set through ifconfig.
Reviewed by:	gnn
Sponsored by:	Mellanox Technologies
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D4817
2016-01-19 10:10:02 +00:00
Andrew Rybchenko
c0b9f85bd6 sfxge: improve error handling in ef10_ev_rx()
Ensure that checksum flags and L3/L4 fields are ignored
if lower level errors are reported in the event.

Remove checks for CRC0_ERR (bad iSCSI header CRC) and
CRC1_ERR (bad iSCSI payload or FCoE/FCoIP CRC) as they
are not used by any existing code.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4975
2016-01-19 06:07:39 +00:00
Andrew Rybchenko
9ad7e03f72 sfxge: select whether to read current or backup partition in Medford A/B scheme
The dynamic config on Medford is stored using two partitions in flash, and at
any time one is the 'current' partition, used to provide the active config,
and the other 'backup' partition is used for writes.  This means that there
are two potential partitions that can be used to service reads, and which is
required can depend on, for example, whether the read is to get the current
contents or to verify a write.

When the partition write lock is held, the default behaviour is to read from
the backup partition, which was wrong for most reads in the common code which
require the current partition. This change allows the current partition to be
read whilst the write lock is held.
There is one read in Manftest which needs the backup partition.

ef10_nvram_partn_read_mode() is created to avoid changing
ef10_nvram_partn_read() which shares a prototype with the equivalent Falcon
and Siena methods.

MC_CMD_NVRAM_READ_IN_V2 adds an extra field, but firmware which doesn't support
it just ignores it.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4974
2016-01-19 06:03:44 +00:00
Ian Lepore
2a81017500 Use OF_decode_addr() to create a bus_space tag and handle for the console
on FDT/OFW platforms.

After the refactoring of the powerpc code so that OF_decode_addr() is usable
on all FDT/OFW platforms, this switches uart(4) to using it.

Differential Revision:	https://reviews.freebsd.org/D4675
2016-01-18 17:03:12 +00:00
Andrew Rybchenko
e78e1b4ddc sfxge: regenerate EF10 registers definition for Medford
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:59:00 +00:00
Andrew Rybchenko
199852a593 sfxge: fix unused function warning
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:54:15 +00:00
Andrew Rybchenko
e76a641b7a sfxge: regenerate siena_flash.h from FW sources
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:45:45 +00:00
Andrew Rybchenko
3e83cbac2a sfxge: cleanup: remove extra empty lines
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:39:06 +00:00
Andrew Rybchenko
5a59cbc95e sfxge: highlight that descriptor cache sizes are configured using TLV now
Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:38:21 +00:00
Andrew Rybchenko
8b18714db0 sfxge: support RFID-selectable segments of dynamic configuration
tlv_partition_header has field *preset* to support RFID-selectable
segments of dynamic configuration

Submitted by:   Mateusz Wrzesinski <mwrzesinski at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:33:15 +00:00
Andrew Rybchenko
08c5af79d9 sfxge: if supported by firmware, use enhanced SET_MAC command to only configure the MTU
This allows an MTU change to be requested on unpriviliged functions
without also setting all the other parameters supported by MC_CMD_SET_MAC.

The enhanced SET_MAC command was introduced in v4_7 firmware.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4958
2016-01-18 06:19:28 +00:00
Andrew Rybchenko
6d0b856c80 sfxge: convert nvram set_version method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:18:01 +00:00
Andrew Rybchenko
9218711910 sfxge: convert nvram get_version method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:16:51 +00:00
Andrew Rybchenko
eb9703da94 sfxge: convert nvram rw_finish method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-18 06:14:43 +00:00
Andrew Rybchenko
134c4c4a6c sfxge: convert nvram write method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4961
2016-01-18 06:13:09 +00:00
Adrian Chadd
88ecff8b96 [iwm] fix up the rate control setup code to initialise rates in the order
we want to use it.

The rate table was being initialised in low->high, but the link quality
table was being initialised high->low. So, when we did a lookup, we
would get the indexes wrong.

This started by a patch from dragonflybsd which reversed how the ni->in_ridx[]
array is being used; I'd rather it all be consistent.  So, this is consistent.

Inspired by: what I did to iwn(4) a while ago
Inspired by: DragonflyBSD; <imre@vdsz.com>
2016-01-18 05:43:34 +00:00
Ian Lepore
5508dc2afe Make PPS ASSERT/CLEAR events match the RS-232 signal levels as per RFC 2783.
Previously the polarity was for TTL levels, which are the reverse of RS-232.

Also add handling of the UART_PPS_INVERT_PULSE option bit in the sysctl
value, the same as was recently added to uart(4), so that people using TTL
level connections can request a logical inverting of the signal.

Use the named constants from the new dev/uart/uart_ppstypes.h for the pps
capture modes and option bits.
2016-01-17 21:19:45 +00:00
Andrew Rybchenko
b60ff8405f sfxge: convert nvram erase method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4957
2016-01-17 05:12:37 +00:00
Andriy Voskoboinyk
8a1d6d278d urtwn: add ROM structure for RTL8188EU
- Add the structure with already known fields offsets
  (some of them were taken from this driver,
  some (channel_plan, rf_* fields) - from TP-LINK official driver)
- Fix a typo / dehardcode a constant in RTL8192C ROM structure.

Tested with RTL8188EU, STA mode

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4274
2016-01-17 00:52:21 +00:00
Justin Hibbits
cdf9344e50 e5500 HWPMC is identical to e500mc, so add support check for it. 2016-01-17 00:14:22 +00:00
Warner Losh
64535e84f6 Move ohci files to their proper place in the tree for atmel.
Fix when it is included (we don't have a at91rm9200 device).
From a similar patch in the PR, with tweaked names.

PR: 206229
2016-01-16 04:47:32 +00:00
Andrew Rybchenko
6de7c598a4 sfxge: check the RX DMA end padding configuration on Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4952
2016-01-15 15:20:26 +00:00
Andrew Rybchenko
0afdf29c97 sfxge: convert nvram read method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4951
2016-01-15 15:19:18 +00:00
Andrew Rybchenko
c15d6d2120 sfxge: rename Huntington MAC methods to EF10 and use for Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4950
2016-01-15 15:17:44 +00:00
Andrew Rybchenko
ee2812ad09 sfxge: rename common hunt PHY methods to ef10 and use for Medford
Leaving BIST methods for now as, though the Medford bootrom now has lots
of BIST support, production firmware doesn't appear to have been updated
yet.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4949
2016-01-15 15:12:30 +00:00
Hans Petter Selasky
ac3490fdef Use the recently added "make_dev_s()" function to solve old race setting the
si_drv1 field in "struct cdev" when creating new character devices.
2016-01-15 12:09:15 +00:00
Andrew Rybchenko
b936cc8d73 sfxge: cleanup: simplify ef10_get_datapath_caps
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4938
2016-01-15 06:30:46 +00:00
Andrew Rybchenko
5d846e8796 sfxge: convert nvram rw_start method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4937
2016-01-15 06:28:58 +00:00
Andrew Rybchenko
80af6f263c sfxge: Medford still needs fallback for no privilege mask
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4936
2016-01-15 06:27:51 +00:00
Andrew Rybchenko
739ebba619 sfxge: medford stores a single global copy of VPD
Not per PF copies as on Huntington.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4935
2016-01-15 06:26:37 +00:00
Andrew Rybchenko
a45a0da19c sfxge: support FATSOv2
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4934
2016-01-15 06:25:26 +00:00
Andrew Rybchenko
1935b20b5a sfxge: rework MCDI request completion
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4933
2016-01-15 06:23:04 +00:00
Andrew Rybchenko
177347ddfb sfxge: rename hunt_link_state_t to ef10_link_state_t
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4932
2016-01-15 06:21:39 +00:00
Conrad Meyer
6ca07079af ioat(4): Add support for 'fence' bit with DMA_FENCE flag
Some classes of IOAT hardware prefetch reads.  DMA operations that
depend on the result of prior DMA operations must use the DMA_FENCE flag
to prevent stale reads.

(E.g., I've hit this personally on Broadwell-EP.  The Broadwell-DE has a
different IOAT unit that is documented to not pipeline DMA operations.)

Sponsored by:	EMC / Isilon Storage Division
2016-01-15 01:34:43 +00:00
Andrew Rybchenko
0ed660ee94 sfxge: cleanup: quieten efx_mcdi_read_resonse_header error reporting
The "mcdi_err_arg" probe still reports results of failed MCDI
commands, unless the caller invoked efx_mcdi_execute_quiet().

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4919
2016-01-14 09:20:25 +00:00
Andrew Rybchenko
0c848230f7 sfxge: add accessors for license-related MCDI calls to common code
Add support for Huntington MCDI licensing interface to common code.
Ported from Linux net driver IOCTL functions with restructuring for
initial support for V3 licensing API.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4918
2016-01-14 09:19:28 +00:00
Andrew Rybchenko
dc5427fc70 sfxge: add table entries for License NVRAM partition
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4917
2016-01-14 09:14:40 +00:00
Andrew Rybchenko
410298b138 sfxge: cleanup: adjust efx_mcdi_get_port_modes() comment for clarity
Fix an explanatory comment which did not explain very well.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4916
2016-01-14 09:12:40 +00:00
Andrew Rybchenko
72cda83214 sfxge: fix common code VPD iterator and duplicate tag verification
Fix efx_vpd_hunk_next() which has -- since its inception -- failed to
correctly iterate over the tags and keywords contained in the VPD data.
Only the first tag or keyword would be returned and the next call with
*contp == 1 would walk to the end of the data and finish.

This was spotted when fixing up errors spotted by Prefast code analysis
(which neglected to set all of the out parameters in all successful cases)

Also fix efx_vpd_verify() on Siena and EF10 which (as a side effect of
correctly iterating over all the tags and keywords) was failing as it
detected that both the static VPD and dynamic VPD storage contained an
RV keyword in the VPD-R tag.  This is intentional as the static VPD and
dynamic VPD are stored separately (firmware merges their contents and
computes a new RV keyword checksum for the data readable from the VPD
capability in PCIe configuration space).

Submitted by:   Andrew Lee <alee at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4915
2016-01-14 09:11:20 +00:00
Andrew Rybchenko
ac23c34a9f sfxge: use correct register definitions for setting interrupt moderation on Medford
The only value which has changed is the number of rows
(ER_DZ_EVQ_TMR_REG_ROWS is 2048 vs 1024 for FR_BZ_TIMER_COMMAND_REGP0_ROWS)
but that isn't used, so this shouldn't change behaviour.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4913
2016-01-14 09:07:40 +00:00
Andrew Rybchenko
4ab4936911 sfxge: support FATSOv2 in common code
Sponsored by:   Solarflare Communications, Inc.
Reviewed by:    gnn
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4912
2016-01-14 09:05:51 +00:00
Andrew Rybchenko
0a91bc3ff4 sfxge: rx_prefix_pktlen methods do not require EFSYS_OPT_RX_SCALE
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4911
2016-01-14 09:03:02 +00:00
Andrew Rybchenko
56bd83b0c5 sfxge: convert nvram size method to use partition id
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4910
2016-01-14 09:01:53 +00:00
Andrew Rybchenko
fd7501bf79 sfxge: rework MCDI start request
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4909
2016-01-14 09:00:35 +00:00
Andrew Rybchenko
cfa023eb90 sfxge: add Medford NIC methods
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4908
2016-01-14 08:59:38 +00:00
Sepherosa Ziehau
dd7a7dd6af hyperv: set receive buffer size according to NVSP protocol version
If the NVSP protocol version is not greater than NVSP_PROTOCOL_VERSION_2,
then the recv buffer size is 15MB, otherwise the buffer size is 16MB.

Submitted by:		Hongjiang Zhang <honzhan microsoft com>
Reviewed by:		royger, Dexuan Cui <decui microsoft com>, adrian
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4814
2016-01-14 03:16:29 +00:00
Sepherosa Ziehau
1952924333 hyperv: add interrupt counters
Submitted by:		Howard Su <howard0su gmail com>
Reviewed by:		royger, Dexuan Cui <decui microsoft com>, adrian
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4693
2016-01-14 03:11:35 +00:00
Sepherosa Ziehau
99781cb353 hyperv: implement an event timer
Submitted by:		Howard Su <howard0su@gmail.com>
Reviewed by:		delphij, royger, adrian
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4676
2016-01-14 03:05:10 +00:00
Adrian Chadd
82104eda6a [gpiobus] handle the case of there being a single GPIO pin available.
PR:		kern/206035
Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
2016-01-14 02:58:28 +00:00
Sepherosa Ziehau
358d08b83b hyperv: remove unused vmbus definitions
We don't need them at all.

Submitted by:		Dexuan Cui <decui microsoft com>
Sponsored by:		Microsoft OSTC
Reviewed by:		royger, adrian, delphij
Approved by:		adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4595
2016-01-14 02:55:28 +00:00
Sepherosa Ziehau
69a53a7a3a hyperv: use x86 generic code to do the hypervisor detection
This is first step to move the generic part of HV code into kernel instead
of module, so that it is possible to use hypercall to implement some other
paravirtualization code in the kernel.

Submitted by:		Howard Su <howard0su@gmail.com>
Reviewed by:		royger, delphij, adrian
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D3072
2016-01-14 02:50:13 +00:00
Sepherosa Ziehau
5de888779e hyperv/hn: Unbreak LINT-NOIP
Reported by:	bz
Approved by:	adrain (mentor)
Sponsored by:	Microsoft OSTC
2016-01-14 02:32:50 +00:00
Marius Strobl
e12a9f251e Given that em(4), lem(4) and igb(4) hardware doesn't require the
alignment guarantees provided by m_defrag(9), use m_collapse(9)
instead for performance reasons.
While at it, sanitize the statistics softc members, i. e. retire
unused ones and add SYSCTL nodes missing for actually used ones.

Differential Revision:	https://reviews.freebsd.org/D4717
2016-01-13 21:47:27 +00:00
Jean-Sébastien Pédron
fe8e65ae3d drm: Revert the part of r288653 about M_WAITOK vs M_NOWAIT
Using M_NOWAIT could lead to transient failures with ioctls.

Suggested by:	kib
2016-01-13 20:35:02 +00:00
Jean-Sébastien Pédron
bd2ebb612d drm/i915: Further reduce the diff with Linux 3.8
There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.
2016-01-13 19:52:25 +00:00
Konstantin Belousov
7ea3f72efb Switch legacy pty clone handler to use make_dev_s(9). Add
MAKEDEV_CHECKNAME flag to the call, this is required to not panic on
race between the clone and destructing the closed master.

Reported by and discussed with:	bde
Tested by:	pho (as part of the larger patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-01-13 12:01:28 +00:00
Andrew Rybchenko
6e4d48127c sfxge: cleanup: fix return code types
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-13 08:09:28 +00:00
Andrew Rybchenko
e02305fc28 sfxge: cleanup: fix typo in unused EFX_QWORD_IS_SET64
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-13 07:55:47 +00:00
Andrew Rybchenko
86ec4b8565 sfxge: cleanup: prefast fixes in common code
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-13 07:46:21 +00:00
Andrew Rybchenko
47d4cf2347 sfxge: cleanup: simplify EFX header includes
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-13 07:25:51 +00:00
Andrew Rybchenko
51fd644178 sfxge: define FATSOv2 option descriptors
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-13 07:11:43 +00:00
Andrew Rybchenko
88cbf0f746 sfxge: add Medford firmware subtypes definitions
Pulled firmware_ids.h from firmwaresrc and applied genfwdef script.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4897
2016-01-13 06:47:47 +00:00
Andrew Rybchenko
4c28e9bcc2 sfxge: support MC_CMD_GET_CAPABILITIES_V2
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4896
2016-01-13 06:45:05 +00:00
Andrew Rybchenko
bce88e313d sfxge: simplify conversion of NVRAM types to/from partition ids
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4895
2016-01-13 06:44:05 +00:00
Andrew Rybchenko
0a68758097 sfxge: simplify MCDI request start
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4894
2016-01-13 06:42:51 +00:00
Andrew Rybchenko
426f453b52 sfxge: note VI_SHIFT reported in ALLOC_VIS response
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4892
2016-01-13 06:41:39 +00:00
Andrew Rybchenko
0badfd7281 sfxge: rework RX prefix handling in the common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4889
2016-01-13 06:40:00 +00:00
Andrew Rybchenko
1b02e3c0cf sfxge: remove unused common code EFSYS_OPT_RX_HDR_SPLIT
The EFSYS_OPT_RX_HDR_SPLIT optional feature in the common code
implemented the Lookahead Split feature of Windows. This split
received packets at a preconfigured byte offset, and delivered
the header and payload portions to separate receive queues.

Now the common code interface has no callers, so remove it.

Note that this should not be confused with the Header Data Split
feature of Windows, which splits packets at a header boundary.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4888
2016-01-13 06:37:45 +00:00
Andrew Rybchenko
a78d512838 sfxge: rename common hunt NIC methods to ef10
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4880
2016-01-13 06:34:51 +00:00
Ian Lepore
fdfbb3f5b1 Restore uart PPS signal capture polarity to its historical norm, and add an
option to invert the polarity in software. Also add an option to capture
very narrow pulses by using the hardware's MSR delta-bit capability of
latching line state changes.

This effectively reverts the mistake I made in r286595 which was based on
empirical measurements made on hardware using TTL-level signaling, in which
the logic levels are inverted from RS-232. Thus, this re-syncs the polarity
with the requirements of RFC 2783, which is writen in terms of RS-232
signaling.

Narrow-pulse mode uses the ability of most ns8250 and similar chips to
provide a delta indication in the modem status register. The hardware is
able to notice and latch the change when the pulse width is shorter than
interrupt latency, which results in the signal no longer being asserted by
time the interrupt service code runs. When running in this mode we get
notified only that "a pulse happened" so the driver synthesizes both an
ASSERT and a CLEAR event (with the same timestamp for each). When the pulse
width is about equal to the interrupt latency the driver may intermittantly
see both edges of the pulse. To prevent generating spurious events, the
driver implements a half-second lockout period after generating an event
before it will generate another.

Differential Revision:	https://reviews.freebsd.org/D4477
2016-01-12 18:42:00 +00:00
Andrew Rybchenko
16b3294e2f sfxge: regenerate MCDI header
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-12 16:21:34 +00:00
Andrew Rybchenko
1759d5d5e7 sfxge: remove obsolete lookahead split RXQ support
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4891
2016-01-12 15:35:00 +00:00
Andrew Rybchenko
219e008793 sfxge: pass context type and num_queues to efx_mcdi_rss_context_alloc
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4890
2016-01-12 15:33:48 +00:00
Andrew Rybchenko
8eea4a0acb sfxge: cleanup: use consistent types for NVRAM partitions
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4887
2016-01-12 15:31:20 +00:00
Andrew Rybchenko
0c24a07e20 sfxge: fix interrupt handling for Medford
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4886
2016-01-12 15:28:59 +00:00
Andrew Rybchenko
f5969609b9 sfxge: update NVRAM partition lookup for Medford
Prior to Medford, option ROM config was stored with one partition
per network port. Medford stores option ROM config in a single
partition (as an array of configurations, one per PF).

Update the EFXname /port to MCDI partition mapping for this.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4885
2016-01-12 15:28:10 +00:00
Andrew Rybchenko
3d385f4e51 sfxge: cleanup: improve consistency in efx_check.h
Make error messages consistent, and remove redundant checks.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4884
2016-01-12 15:27:11 +00:00
Andrew Rybchenko
74bb0ed8b9 sfxge: remove obsolete efx_mac_hash_set() from common code
This API has been replaced by efx_mac_multicast_list_set()
and has no callers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4883
2016-01-12 15:26:17 +00:00
Andrew Rybchenko
14d6f73e33 sfxge: rework MCDI header version handling
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4882
2016-01-12 15:25:03 +00:00
Andrew Rybchenko
1289fe72c4 sfxge: rename hunt filter methods, types etc. to ef10 and use for Medford
New filters types may be added, but the same machinery should be able to
handle them.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4881
2016-01-12 15:24:13 +00:00
Andrew Rybchenko
1fa702a261 sfxge: add definitions for compressed satellite images to common code headers
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4878
2016-01-12 15:21:52 +00:00
Andrew Rybchenko
8b286d1c57 sfxge: add new MCDI sensors to common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4877
2016-01-12 15:20:53 +00:00
Andrew Rybchenko
5a2680acd4 sfxge: remove unnecessary pulling out of soft bits from RX events
These bigs are changed on Medford.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4876
2016-01-12 15:20:03 +00:00
Andrew Rybchenko
dae248ee46 sfxge: remove obsolete common code PKTFILTER module
The pktfilter module has been obsolete for some time, as
it was replaced by newer features in filter module. With
the removal of the storport driver, this module has no
users and can be removed.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4875
2016-01-12 13:42:27 +00:00
Andrew Rybchenko
ead1c5dfe5 sfxge: rename hunt MCDI methods to ef10 and use for Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4874
2016-01-12 13:39:25 +00:00
Andrew Rybchenko
de9775ad34 sfxge: rename hunt nvram methods and use for Medford
Some new partitions have been added, but they shouldn't need to be
handled any differently.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4873
2016-01-12 13:37:58 +00:00
Andrew Rybchenko
5311abfa25 sfxge: rename Huntington VPD methods to ef10 and use for Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4872
2016-01-12 13:36:21 +00:00
Andrew Rybchenko
b627be989d sfxge: rename hunt RX methods to ef10 and use for Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4871
2016-01-12 13:34:55 +00:00
Andrew Rybchenko
cc62e811f9 sfxge: rename hunt TX methods to ef10 and use for Medford
Rename all except hunt_tx_qdesc_tso_create(), which creates a
fw-assisted TSO v1 descriptor which isn't supported on Medford.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4870
2016-01-12 13:33:16 +00:00
Andrew Rybchenko
ad8a32cb5d sfxge: rename hunt ev methods to ef10 and use for Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4869
2016-01-12 13:32:04 +00:00
Andrew Rybchenko
15f20ea67d sfxge: rename hunt interrupt methods to ef10 and use on Medford
All of these apply to both Huntington and Medford.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4868
2016-01-12 13:30:42 +00:00
Andrew Rybchenko
3c5bf8f1c2 sfxge: update SRAM methods to be no-ops on Medford as well
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4867
2016-01-12 13:29:05 +00:00
Andrew Rybchenko
b026a4006f sfxge: use NIC config in place of some Huntington specific PIO constants
This should allow these functions to work for Medford as well.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4866
2016-01-12 13:27:46 +00:00
Andrew Rybchenko
e7119ad9ae sfxge: change hunt specific fields of efx_nic_t to ef10
All these fields will be used in shared ef10 code, so put them in an
ef10 member of a per-architecture union, rather that in the per-chip
union.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4865
2016-01-12 13:26:04 +00:00
Andrew Rybchenko
435c201468 sfxge: update autogenerated monitors lists
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-12 09:52:38 +00:00
Andrew Rybchenko
5f5c71cc13 sfxge: add medford_impl.h, medford_nic.c, ef10_impl.h
Creating some files together to do the build system changes in one go.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4859
2016-01-12 08:32:53 +00:00
Andrew Rybchenko
b13ad4deb6 sfxge: add Medford sensor support
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4858
2016-01-12 06:37:42 +00:00
Andrew Rybchenko
19bc938f5a sfxge: use MCDIv2 on Medford
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4857
2016-01-12 06:34:45 +00:00
Andrew Rybchenko
34f6ea2980 sfxge: add Medford PCI IDs to common code
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4856
2016-01-12 06:32:56 +00:00
Andrew Rybchenko
8883918d66 sfxge: add sanity checking for EFX_OPT_MEDFORD build option to efx_check.h
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4854
2016-01-12 06:29:17 +00:00
Sepherosa Ziehau
4f8f2d4274 hyperv/hn: Removed unused netvsc_init()
Submitted by:		Dexuan Cui <decui microsoft com>
Reviewed by:		me, adrian, royger,
			Hongjiang Zhang <honzhan microsoft com>
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4594
2016-01-12 01:55:57 +00:00
Sepherosa Ziehau
c48d20d7c7 hyperv/hn: Avoid mbuf cluster allocation, if the packet is small.
This one mainly avoids mbuf cluster allocation for TCP ACKs during
TCP sending tests.  And it gives me ~200Mbps improvement (4.7Gbps
-> 4.9Gbps), when running iperf3 TCP sending test w/ 16 connections.

While I'm here, nuke the unnecessary zeroing out pkthdr.csum_flags.

Reviewed by:		adrain
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4853
2016-01-12 01:50:56 +00:00
Sepherosa Ziehau
da949700f2 hyperv/hn: Implement SIOC[SG]IFMEDIA support
Many applications and kernel modules (e.g. bridge) rely on the ifmedia
status report; give them what they want.

Submitted by:		Dexuan Cui <decui microsoft com>
Reviewed by:		Jun Su <junsu microsoftc com>, me, adrian
Modified by:		me (minor)
Original differential:	https://reviews.freebsd.org/D4611
Differential Revision:	https://reviews.freebsd.org/D4852
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
2016-01-12 01:41:34 +00:00
Sepherosa Ziehau
39863fbd98 hyperv/hn: Implement LRO
- Implement the LRO using tcp_lro APIs, and LRO is enabled by default.
- Add several stats sysctl nodes.
- Check IP/TCP length before sending the packet to tcp_lro_rx(), if host
  does not provide RX csum information (*); and add an option through
  sysctl to always trust host TCP segment csum checks (default is off).
- Add sysctl to control the LRO entry depth; it is disabled by default.
  It is used to avoid holding too much TCP segments in driver.  Limiting
  the LRO entry depth helps a lot in a one/two streams RX test.

This one 3x the RX performance on my local test (3Gbps -> 10Gbps), and
~2x the RX performance over a directly connected 40Ge network (5Gbps ->
9Gbps).

(*) It seems the host stops supplying csum information, once the network
load is high.  This still needs investigation...

Reviewed by:		Hongjiang Zhang <honzhan microsoft com>,
			Dexuan Cui <decui microsoft com>,
			Jun Su <junsu microsoft com>,
			delphij
Tested by:		me (local),
			Hongjiang Zhang <honzhan microsoft com>
			(directly connected 40Ge)
Approved by:		delphij (mentor), adrian (mentor, no objection)
With feedback from:	delphij, Hongjiang Zhang <honzhan microsoft com>
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4824
2016-01-12 01:30:51 +00:00
Andriy Voskoboinyk
1c6b43df0a wpi, iwn: implement ic_getradiocaps method
This will allow to restore channel list after switching interface
to more restrictive regdomain.

Tested with Intel 3945BG (wpi) only.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4863
2016-01-12 00:24:40 +00:00
Andriy Voskoboinyk
6420fb29aa rtwn: import r290022 (do not filter out control frames in the RX path)
Tested by:	kevlo
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4838
2016-01-12 00:12:18 +00:00
Colin Percival
cbb261aec7 Add two more assertions to catch busdma problems. Each segment provided
by busdma to the blkfront driver must be an integer number of sectors,
and must be aligned in memory on a "sector" boundary.

Having these assertions yesterday would have made finding the bug fixed
in r293698 somewhat easier.
2016-01-11 21:02:30 +00:00
Navdeep Parhar
5725f0e490 cxgbe: bind the ithreads that handle NIC rx to the correct CPU if the kernel
is built with option RSS.
2016-01-11 17:52:42 +00:00
Steven Hartland
481b36c66a Close iSCSI sessions on shutdown
Ensure that all iSCSI sessions are correctly terminated during shutdown.

* Enhances the changes done by r286226 (D3052).
* Add shutdown post sync event to run after filesystem shutdown
  (SHUTDOWN_PRI_FIRST) but before CAM shutdown (SHUTDOWN_PRI_DEFAULT).
* Changes iscsi_maintenance_thread to processes terminate in preference to
  reconnect.

Reviewed by:	trasz
MFC after:	2 weeks
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D4429
2016-01-11 10:24:30 +00:00
Andrew Rybchenko
b53f4a640f sfxge: add Medford build option disabled by default
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-11 09:15:25 +00:00
Marius Strobl
3deebd539b - Add support for Advantech PCI-1602 Rev. B1 and PCI-1603 cards. [1]
- Add a description of Advantech PCI-1602 Rev. A boards. [1]
- Properly set up REG_ACR also for PCI-1602 Rev. A based on what the
  Advantech-supplied Linux driver does.
- Additionally use the macros of <dev/ic/ns16550.h> to replace existing
  magic values and get rid of trivial comments.
- Fix the style of some comments.

PR:		205359 [1]
Submitted by:	Jan Mikkelsen (original patch) [1]
2016-01-10 18:11:23 +00:00
Andriy Voskoboinyk
950678b488 rtwn: fix sequence number assignment (part of r290630)
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4819
2016-01-09 21:45:21 +00:00
Nathan Whitehorn
bb0455d7dd Make graphical consoles work under PowerKVM. Without using hypercalls, it is
not possible to write the framebuffer before pmap is up. Solve this by
deferring initialization until that happens, like on PS3.

MFC after:	1 week
2016-01-09 21:28:56 +00:00
Gleb Smirnoff
2bab0c5535 New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and
up to now.

The new sendfile is the code that Netflix uses to send their multiple tens
of gigabits of data per second. The new implementation features asynchronous
I/O, when I/O operations are launched, but not awaited to be complete. An
explanation of why such behavior is beneficial compared to old one is
going to be too long for a commit message, so we will skip it here.

Additional features of new syscall are extra flags, which provide an
application more control over data sent. The SF_NOCACHE flag tells
kernel that data shouldn't be cached after it was sent. The SF_READAHEAD()
macro allows to specify readahead size in pages.

The new syscalls is a drop in replacement. No modifications are required
to applications. One can take nginx binary for stable/10 and run it
successfully on head. Although SF_NODISKIO lost its original sense, as now
sendfile doesn't block, and now means something completely different (tm),
using the new sendfile the old way is absolutely safe.

Celebrates:	Netflix global launch!
Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
Relnotes:	yes
2016-01-08 20:34:57 +00:00
Conrad Meyer
1502e36346 ioat(4): Add ioat_acquire_reserve() KPI
ioat_acquire_reserve() is an extended version of ioat_acquire().  It
allows users to reserve space in the channel for some number of
descriptors.  If this succeeds, it guarantees that at least submission
of N valid descriptors will succeed.

Sponsored by:	EMC / Isilon Storage Division
2016-01-07 23:02:15 +00:00
Jim Harris
042231951b ismt: fix ISMT_DESC_ADDR_RW macro
Submitted by:	Masanobu SAITOH <msaitoh@netbsd.org>
MFC after:	3 days
2016-01-07 21:16:44 +00:00
Jim Harris
9c6b5d40eb nvme: replace NVME_CEILING macro with howmany()
Suggested by:	rpokala
MFC after:	3 days
2016-01-07 20:35:26 +00:00
Jim Harris
50dea2da12 nvme: add hw.nvme.min_cpus_per_ioq tunable
Due to FreeBSD system-wide limits on number of MSI-X vectors
(https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199321),
it may be desirable to allocate fewer than the maximum number
of vectors for an NVMe device, in order to save vectors for
other devices (usually Ethernet) that can take better
advantage of them and may be probed after NVMe.

This tunable is expressed in terms of minimum number of CPUs
per I/O queue instead of max number of queues per controller,
to allow for a more even distribution of CPUs per queue.  This
avoids cases where some number of CPUs have a dedicated queue,
but other CPUs need to share queues.  Ideally the PR referenced
above will eventually be fixed and the mechanism implemented
here becomes obsolete anyways.

While here, fix a bug in the CPUs per I/O queue calculation to
properly account for the admin queue's MSI-X vector.

Reviewed by:	gallatin
MFC after:	3 days
Sponsored by:	Intel
2016-01-07 20:32:04 +00:00
Andriy Voskoboinyk
0046e1868f net80211 drivers: fix ieee80211_init_channels() usage
Fix out-of-bounds read (all) / write (11n capable) for drivers
that are using ieee80211_init_channels() to initialize channel list.

Tested with:
 * RTL8188EU, STA mode.
 * RTL8188CUS, STA mode.
 * WUSB54GC, HOSTAP mode.

Approved by:	adrian (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4818
2016-01-07 18:41:03 +00:00
Sean Bruno
9030be4bad Fix VF handling of VLANs.
This helps immensily with our ability to operate in the Amazon Cloud.

Discussed on Intel Networking Community call this morning.

Submitted by:	Jarrod Petz(petz@nisshoko.net)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4788
2016-01-07 18:34:56 +00:00
Sean Bruno
97f9586e97 Fixup SFP module insertion on the 82599 when insertion happens after
the system is booted and running.

Add PHY detection logic to ixgbe_handle_mod() and add locking to
ixgbe_handle_msf() as well.

PR:		150251
Submitted by:	aboyer@averesystems.com
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3188
2016-01-07 17:02:34 +00:00
Sean Bruno
676822acb5 Disable the reuse of checksum offload context descriptors in the case
of multiple queues in em(4).  Document errata in the code.

MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D3995
2016-01-07 16:48:47 +00:00
Sean Bruno
b834dcea9a Switch em(4) to the extended RX descriptor format. This matches the
e1000/e1000e split in linux.

Split rxbuffer and txbuffer apart to support the new RX descriptor format
structures. Move rxbuffer manipulation to em_setup_rxdesc() to unify the
new behavior changes.

Add a RSSKEYLEN macro for help in generating the RSSKEY data structures
in the card.

Change em_receive_checksum() to process the new rxdescriptor format
status bit.

MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D3447
2016-01-07 16:42:48 +00:00
Sean Bruno
8061e8bb1e Wow, um ... sorry about that. The commit log for this code should have
read that it was for EM_MULTIQUEUE.  Revert this and try again.
2016-01-07 16:24:18 +00:00
Sean Bruno
712b97a630 Switch em(4) to the extended RX descriptor format. This matches the
e1000/e1000e split in linux.

MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D3447
2016-01-07 16:20:55 +00:00
Jim Harris
2b647da7a0 nvme: do not revert o single I/O queue when per-CPU queues not possible
Previously nvme(4) would revert to a signle I/O queue if it could not
allocate enought interrupt vectors or NVMe submission/completion queues
to have one I/O queue per core.  This patch determines how to utilize a
smaller number of available interrupt vectors, and assigns (as closely
as possible) an equal number of cores to each associated I/O queue.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:18:32 +00:00
Jim Harris
d400f790b1 nvme: break out interrupt setup code into a separate function
MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:12:42 +00:00
Jim Harris
e5af5854ff nvme: do not pre-allocate MSI-X IRQ resources
The issue referenced here was resolved by other changes
in recent commits, so this code is no longer needed.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:11:31 +00:00
Jim Harris
c75ad8ce5a nvme: remove per_cpu_io_queues from struct nvme_controller
Instead just use num_io_queues to make this determination.

This prepares for some future changes enabling use of multiple
queues when we do not have enough queues or MSI-X vectors
for one queue per CPU.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:09:56 +00:00
Jim Harris
d85f84abb8 nvme: simplify some of the nested ifs in interrupt setup code
This prepares for some follow-up commits which do more work in
this area.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:08:04 +00:00
Jim Harris
58d0b8f3c3 nvd: submit bios directly when BIO_ORDERED not set or in flight
This significantly improves parallelism in the most common case.
The taskqueue is still used whenever BIO_ORDERED bios are in flight.

This patch is based heavily on a patch from gallatin@.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 16:06:23 +00:00
Jim Harris
47ef4244f5 nvd: break out submission logic into separate function
This enables a future patch using this same logic to submit
I/O directly bypassing the taskqueue.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 15:59:51 +00:00
Jim Harris
26ca317aef nvd: skip BIO_ORDERED logic when bio fails submission
This ensures the bio flags are not read after biodone().
The ordering will still be enforced, after the bio is
submitted successfully.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 15:58:44 +00:00
Jim Harris
8fe5c0d286 nvd: do not wait for previous bios before submitting ordered bio
Still wait until all in-flight bios (including the ordered bio)
complete before processing more bios from the queue.

MFC after:	3 days
Sponsored by:	Intel
2016-01-07 15:57:17 +00:00
Jim Harris
454f163b9f nvd: set DISKFLAG_DIRECT_COMPLETION
Submitted by:	gallatin
MFC after:	3 days
2016-01-07 15:55:41 +00:00
Alexander V. Chernikov
8a9f7532b0 Convert cxgb/cxgbe to the new routing API.
Discussed with:		np
2016-01-07 08:07:17 +00:00
Gleb Smirnoff
0c39d38d21 Historically we have two fields in tcpcb to describe sender MSS: t_maxopd,
and t_maxseg. This dualism emerged with T/TCP, but was not properly cleaned
up after T/TCP removal. After all permutations over the years the result is
that t_maxopd stores a minimum of peer offered MSS and MTU reduced by minimum
protocol header. And t_maxseg stores (t_maxopd - TCPOLEN_TSTAMP_APPA) if
timestamps are in action, or is equal to t_maxopd otherwise. That's a very
rough estimate of MSS reduced by options length. Throughout the code it
was used in places, where preciseness was not important, like cwnd or
ssthresh calculations.

With this change:

- t_maxopd goes away.
- t_maxseg now stores MSS not adjusted by options.
- new function tcp_maxseg() is provided, that calculates MSS reduced by
  options length. The functions gives a better estimate, since it takes
  into account SACK state as well.

Reviewed by:	jtl
Differential Revision:	https://reviews.freebsd.org/D3593
2016-01-07 00:14:42 +00:00
Conrad Meyer
bd81fe68ee ioat(4): Add ioat_get_max_io_size() KPI
Consumers need to know the permitted IO size to send maximally sized
chunks to the hardware.

Sponsored by:	EMC / Isilon Storage Division
2016-01-05 20:42:19 +00:00
Andriy Voskoboinyk
430384523d iwm: revert r293178
This optimization is not proper (and causes kernel panic),
since driver checks fw_status to optimize away parsing stage
if it was already done.

Reported by:	dchagin
2016-01-05 20:09:26 +00:00
Ulrich Spörlein
623534d683 Fix undefined behavior when using asmc_fan_getstring()
It was returning a pointer to stack-allocated memory, so make the
allocation at the caller instead.

Found by:	clang static analyzer
Coverity:	CID 1245774
Reviewed by:	ed, rpaulo
Review URL:	https://reviews.freebsd.org/D4740
2016-01-05 10:25:22 +00:00
Hans Petter Selasky
076daeda4f Fix for directly connected FULL or LOW speed USB devices.
Found by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	1 week
2016-01-05 09:18:43 +00:00
Navdeep Parhar
9f6b62e791 iw_cxgbe: Shut down the socket but do not close the fd in case of error.
The fd is closed later in this case.  This fixes a "SS_NOFDREF on enter"
panic.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	Steve Wise @ Open Grid Computing
2016-01-05 01:32:40 +00:00
Andriy Voskoboinyk
60e9dd4e56 urtwn: add bits for R92C_HWSEQ_CTRL and R92C_TXPAUSE registers
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4770
2016-01-04 21:16:49 +00:00
Andriy Voskoboinyk
55d352400f iwn: reduce code duplication in iwn_read_firmware()
- Separate 'firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); sc->fw_fp = NULL;'
into iwn_unload_firmware().
- Move error handling to the end of iwn_read_firmware().

No functional changes.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4768
2016-01-04 21:11:27 +00:00
Andriy Voskoboinyk
e8d24c2011 iwm: free firmware related resources after uploading it to the hardware
iwn(4) / wpi(4) works in the same way
(read_firmware() -> hw_init() -> firmware_put())

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4766
2016-01-04 21:07:08 +00:00
Andriy Voskoboinyk
1b3ae3ba63 iwm: store pointer for 'struct firmware' instead of
'size_t' and 'void *' pair.

Approved by:	adrian (mentor)
Obtained from:	DragonFlyBSD
Differential Revision:	https://reviews.freebsd.org/D4765
2016-01-04 21:03:01 +00:00
Andriy Voskoboinyk
dd693ac6da iwm: use m_collapse() to defragment a mbuf chain
- Simplify defragmentation code.
- Use proper number of dma segments for data.

Approved by:	adrian (mentor)
Obtained from:	DragonFlyBSD (mostly)
Differential Revision:	https://reviews.freebsd.org/D4754
2016-01-03 21:32:47 +00:00
Enji Cooper
1c66ead7d6 Fix ixl(4) compilation with PCI_IOV pre-r266974
stable/10 doesn't have the if_getdrvflags(9) KPI. Reference the field in the
structure directly if the __FreeBSD_version is < 1100022, so the driver can
be built with PCI_IOV support on stable/10, without backporting all of
r266974 (which requires additional changes due to projects/ifnet, etc)

Differential Revision: https://reviews.freebsd.org/D4759
Reviewed by: erj, sbruno
Sponsored by: EMC / Isilon Storage Division
2016-01-03 18:09:46 +00:00
Adrian Chadd
17f42e0d6b [ath] remove the inline version of the register access macros.
These are going to be much more efficient on low end embedded systems
but unfortunately they make it .. less convenient to implement correct
bus barriers and debugging.  They also didn't implement the register
serialisation workaround required for Owl (AR5416.)

So, just remove them for now.  Later on I'll just inline the routines
from ah_osdep.c.
2016-01-03 17:58:11 +00:00
Ian Lepore
3e0aa2f449 Eliminate code for walking through the early static env data. This code
is called from a device attach routine, and thus cannot be called before
the cutover from static to dynamic kernel env.
2016-01-03 14:46:19 +00:00
Andriy Voskoboinyk
92d95dfd76 iwm: convert to ieee80211_tx_complete()
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4755
2016-01-03 10:10:11 +00:00
Andriy Voskoboinyk
612d1816a8 iwm: reorganize if_iwmvar.h
- Change order of data in if_iwmvar.h
(like it is in other drivers: defines, data structures,
vap/node structures, softc struct and locks); use indentation.
- Fix IWM_LOCK(_sc) / IWM_UNLOCK(_sc) macro.
- Add IWM_LOCK_INIT / DESTROY(sc) + fix mtx_init() usage.
- Wrap iwm_node casts into IWM_NODE() macro.
- Drop some fields:
 * wt_hwqueue from Tx radiotap header;
 * macaddr[6] from iwm_vap;

Approved by:	adrian
Differential Revision:	https://reviews.freebsd.org/D4753
2016-01-03 10:06:10 +00:00
Nathan Whitehorn
9f4a7eae43 Make using the #address-cells property on the interrupt parent in device
tree parsing opt-out rather than opt-in. All FDT-based systems as well as
PowerPC systems with real Open Firmware use the CHRP-derived binding that
includes it, which makes SPARC the odd man out here. Making it opt-out
avoids astonishment on new platform bring up.
2016-01-02 19:28:35 +00:00
Adrian Chadd
fdee6e3bba ... and that would've never worked. Sorry!
(Note: everything I tested on locally has ATH_DEBUG / AH_DEBUG set.)
2016-01-02 18:32:20 +00:00
Adrian Chadd
ef91dbcec6 [ath] add explicit bus barriers.
The ath hal and driver code all assume the world is an x86 or the
bus layer does an explicit bus flush after each operation (eg netbsd.)

However, we don't do that.

So, to be "correct" on platforms like sparc64, mips and ppc (and maybe
ARM, I am not sure), just do explicit barriers after each operation.

Now, this does slow things down a tad on embedded platforms but I'd
rather things be "correct" versus "fast."  At some later point if someone
wishes it to be fast then we should add the barrier calls to the HAL and
driver.

Tested:

* carambola 2 (AR9331.)
2016-01-02 17:14:22 +00:00
Dag-Erling Smørgrav
23e6278ed9 Replace the cosine table with a sine table, which (due to the vagaries of
rounding) has better spread.  Implement fp16_sin() to go along with
fp16_cos().  In the rendering loop, switch from addition to subtraction
so the center of the pattern will be a trough rather than a peak.  This
is completely arbitrary, of course, but looks better to me.
2016-01-02 16:40:37 +00:00
Justin Hibbits
2afca09419 Accidentally dropped the 0 padding.
Pointed out by:	cmeyer
2016-01-01 17:56:52 +00:00
Justin Hibbits
38f004fbb0 Fix a couple printf formats.
This was found when working on 64-bit PowerPC book-e support.
2016-01-01 15:17:24 +00:00
Dag-Erling Smørgrav
a50b01d224 17 years and change after I wrote warp_saver, here's a simple plasma effect
(currently only three circular patterns) which requires quite a bit of
fixed-point arithmetic, including sqrt() and cos().  Happy New Year!
2016-01-01 04:04:40 +00:00
Adrian Chadd
bcaed14bd9 [rtwn] bring over initial rtwn driver.
This is a port from openbsd.  It's incomplete and unstable, but it's better
than nothing.  I have no plans to MFC this until it's complete and stable.

Submitted by:	kevlo
2015-12-31 22:32:36 +00:00
Kristof Provost
dd876af4de Add suppoort for the Sitecom LN-031
This is an AX88178 chip, which we already support so all we have to do is add
the USB product and vendor ID.
2015-12-31 18:12:35 +00:00
Alexander V. Chernikov
4fb3a8208c Implement interface link header precomputation API.
Add if_requestencap() interface method which is capable of calculating
  various link headers for given interface. Right now there is support
  for INET/INET6/ARP llheader calculation (IFENCAP_LL type request).
  Other types are planned to support more complex calculation
  (L2 multipath lagg nexthops, tunnel encap nexthops, etc..).

Reshape 'struct route' to be able to pass additional data (with is length)
  to prepend to mbuf.

These two changes permits routing code to pass pre-calculated nexthop data
  (like L2 header for route w/gateway) down to the stack eliminating the
  need for other lookups. It also brings us closer to more complex scenarios
  like transparently handling MPLS nexthops and tunnel interfaces.
  Last, but not least, it removes layering violation introduced by flowtable
  code (ro_lle) and simplifies handling of existing if_output consumers.

ARP/ND changes:
Make arp/ndp stack pre-calculate link header upon installing/updating lle
  record. Interface link address change are handled by re-calculating
  headers for all lles based on if_lladdr event. After these changes,
  arpresolve()/nd6_resolve() returns full pre-calculated header for
  supported interfaces thus simplifying if_output().
Move these lookups to separate ether_resolve_addr() function which ether
  returs error or fully-prepared link header. Add <arp|nd6_>resolve_addr()
  compat versions to return link addresses instead of pre-calculated data.

BPF changes:
Raw bpf writes occupied _two_ cases: AF_UNSPEC and pseudo_AF_HDRCMPLT.
Despite the naming, both of there have ther header "complete". The only
  difference is that interface source mac has to be filled by OS for
  AF_UNSPEC (controlled via BIOCGHDRCMPLT). This logic has to stay inside
  BPF and not pollute if_output() routines. Convert BPF to pass prepend data
  via new 'struct route' mechanism. Note that it does not change
  non-optimized if_output(): ro_prepend handling is purely optional.
Side note: hackish pseudo_AF_HDRCMPLT is supported for ethernet and FDDI.
  It is not needed for ethernet anymore. The only remaining FDDI user is
  dev/pdq mostly untouched since 2007. FDDI support was eliminated from
  OpenBSD in 2013 (sys/net/if_fddisubr.c rev 1.65).

Flowtable changes:
  Flowtable violates layering by saving (and not correctly managing)
  rtes/lles. Instead of passing lle pointer, pass pointer to pre-calculated
  header data from that lle.

Differential Revision:	https://reviews.freebsd.org/D4102
2015-12-31 05:03:27 +00:00
Hans Petter Selasky
f03f517b5e Add support for modifying coalescing parameters runtime.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-30 15:01:47 +00:00
Hans Petter Selasky
4fbd91a5af Allow I2C to read address 0x51 as well as address 0x50.
MFC after:	1 week
Submitted by:	Shahar Klein <shahark@mellanox.com>
Sponsored by:	Mellanox Technologies
2015-12-30 14:58:55 +00:00
Hans Petter Selasky
4f18ce8ae0 10G ER/LR should present itself as LR.
MFC after:	1 week
Submitted by:	Shahar Klein <shahark@mellanox.com>
Sponsored by:	Mellanox Technologies
2015-12-30 14:54:08 +00:00
Marius Strobl
430acc472f - Add entries for the more prominent members of the Digi International
Neo series, which are based on Exar PCI chips.
- Mark some unused parameters as such.
- Fix style

MFC after:	3 days
2015-12-29 17:07:28 +00:00
Hans Petter Selasky
f9e8f40d28 Update metadata for "tools/tools/bus_autoconf" after r292080. Use
BYTE_ORDER instead of _BYTE_ORDER due to 3rd party USB software for
now.
2015-12-29 11:53:13 +00:00
Xin LI
fcf8d36c46 hyperv: vmbus: run non-blocking message handlers in vmbus_msg_swintr()
We'll remove the per-channel control_work_queue because it can't properly
do serialization of message handling, e.g., when there are 2 NIC devices,
vmbus_channel_on_offer() -> hv_queue_work_item() has a race condition:
for an SMP VM, vmbus_channel_process_offer() can run concurrently on
different CPUs and if the second NIC's
vmbus_channel_process_offer() -> hv_vmbus_child_device_register() runs
first, the second NIC's name will be hn0 and the first NIC's name will
be hn1!

We can fix the race condition by removing the per-channel control_work_queue
and run all the message handlers in the global
hv_vmbus_g_connection.work_queue -- we'll do this in the next patch.

With the coming next patch, we have to run the non-blocking handlers
directly in the kernel thread vmbus_msg_swintr(), because the special
handling of sub-channel: when a sub-channel (e.g., of the storvsc driver)
is received and being handled in vmbus_channel_on_offer() running on the
global hv_vmbus_g_connection.work_queue, vmbus_channel_process_offer()
invokes channel->sc_creation_callback, i.e., storvsc_handle_sc_creation,
and the callback will invoke hv_vmbus_channel_open() -> hv_vmbus_post_message
and expect a further reply from the host, but the handling of the further
messag can't be done because the current message's handling hasn't finished
yet; as result, hv_vmbus_channel_open() -> sema_timedwait() will time out
and th device can't work.

Also renamed the handler type from hv_pfn_channel_msg_handler to
vmbus_msg_handler: the 'pfn' and 'channel' in the old name make no sense.

Submitted by:	Dexuan Cui <decui microsoft com>
Reviewed by:	royger
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4596
2015-12-29 08:19:43 +00:00
Xin LI
47f175b846 hyperv: vmbus: remove the per-channel control_work_queue
Now vmbus_channel_on_offer() -> vmbus_channel_process_offer() can
safely run on the global hv_vmbus_g_connection.work_queue now.

We remove the per-channel control_work_queue to achieve the proper
serialization of the message handling.

I removed the bogus TODO in vmbus_channel_on_offer(): a vmbus offer
can only come from the parent partition, i.e., the host.

PR:		kern/205156
Submitted by:	Dexuan Cui <decui microsoft com>
Reviewed by:	Howard Su <howard0su gmail com>, delphij
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4597
2015-12-29 07:54:55 +00:00
Marius Strobl
1714dcab20 - Add an entry for the SIIG Cyber 2SP1 PCIe adapter, which is based
on an Oxford Semiconductor OX16PCI954 but uses only two ports and
  a non-default clock rate.
- Fix style/whitespace

PR:		176407
MFC after:	3 days
2015-12-28 20:24:08 +00:00
Hans Petter Selasky
90cc1c7724 Add support for CQE zipping. CQE zipping reduces PCI overhead by
coalescing and zipping multiple CQEs into a single merged CQE. The
feature is enabled by default and can be disabled by a sysctl.

Implementing this feature mlx5_cqwq_pop() has been separated from
mlx5e_get_cqe().

MFC after:	1 week
Submitted by:	Mark Bloch <markb@mellanox.com>
Differential Revision:	https://reviews.freebsd.org/D4598
Sponsored by:	Mellanox Technologies
2015-12-28 18:50:18 +00:00
Hans Petter Selasky
ec0143b260 Add support for sysctl tunables to 10-stable and older. Pushed through
head first to simplify driver maintenance.

MFC after:	1 week
Submitted by:	Drew Gallatin <gallatin@freebsd.org>
Differential Revision:	https://reviews.freebsd.org/D4552
Sponsored by:	Mellanox Technologies
2015-12-28 18:36:00 +00:00
Hans Petter Selasky
ee41fc8f8c Make the eeprom dump function more readable and rename variables for
better clarity.

MFC after:	1 week
Submitted by:	Daria Genzel <dariaz@mellanox.com>
Differential Revision:	https://reviews.freebsd.org/D4551
Sponsored by:	Mellanox Technologies
2015-12-28 18:28:18 +00:00
Allan Jude
7a3f5d11fb Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c
cperciva's libmd implementation is 5-30% faster

The same was done for SHA256 previously in r263218

cperciva's implementation was lacking SHA-384 which I implemented, validated against OpenSSL and the NIST documentation

Extend sbin/md5 to create sha384(1)

Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with sha512{c.c,.h}

Reviewed by:	cperciva, des, delphij
Approved by:	secteam, bapt (mentor)
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3929
2015-12-27 17:33:59 +00:00
Alexander Motin
5d084976cb Allocate separate scratch space for scanner purposes.
This space does not require DMA syncing. It reduces lock scope of the DMA
scratch space.  It allows whole DMA scratch space to be used to I/O, so now
we can fetch up to ~1000 ports from SNS.

Due to the last fact, increase maximal number of ports from 256 to 1024.
2015-12-27 06:28:31 +00:00
Alexander Motin
14849e2c85 Split DMA buffers for request, response and ATIO queues. 2015-12-27 06:16:02 +00:00
Bjoern A. Zeeb
376760cc96 Add missing #ifdef INET after r292674 to allow NOIP and NOINET kernels
to build.
2015-12-26 17:27:48 +00:00
Adrian Chadd
e2db1d1f11 [mdio] Add MDIO support for "extended" registers as defined by IEEE 802.3 Clause 45.
IEEE 802.3 Clause 45 added backwards-compatible support for 2^16 PHY registers
through the addition of an additional device address frame.

Clause 45 addressing is used in 10Gbe PHYs, 802.3az EEE registers, etc. It may
make sense to provide a similar extension to the miibus interface, but I've
refrained from unilaterally doing so here.

Submitted by:	Landon Fuller <landon@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D4607
2015-12-26 17:22:02 +00:00
Alexander Motin
7d191fdb97 Use single DMA tag for scratch areas of all virtual ports. 2015-12-26 09:16:05 +00:00
Alexander Motin
9d8b002160 Make port logins asynchronous, following r292739 logic.
This is even more important since it involves more network operations and
more prone to delays and timeouts.
2015-12-26 06:13:01 +00:00
Navdeep Parhar
e3148e46b2 cxgbei: Hardware accelerated iSCSI target and initiator for TOE capable
cards supported by cxgbe(4).

On the host side this driver interfaces with the storage stack via the
ICL (iSCSI Common Layer) in the kernel.  On the wire the traffic is
standard iSCSI (SCSI over TCP as per RFC 3720/7143 etc.) that
interoperates with all other standards compliant implementations.  The
driver is layered on top of the TOE driver (t4_tom) and promotes
connections being handled by t4_tom to iSCSI ULP (Upper Layer Protocol)
mode.  Hardware assistance in this mode includes:

- Full TCP processing.
- iSCSI PDU identification and recovery within the TCP stream.
- Header and/or data digest insertion (tx) and verification (rx).
- Zero copy (both tx and rx).

Man page will follow in a separate commit in a couple of weeks.

Relnotes:	Yes
Sponsored by:	Chelsio Communications
2015-12-26 06:05:21 +00:00
Alexander Motin
66e979f15c Make virtual ports control asynchronous.
Before this change virtual ports control IOCBs were executed synchronously
via Execute IOCB mailbox command.  It required exclusive use of scratch
space of driver and mailbox registers of the hardware.  Because of that
shared resources use this code could not really sleep, having to spin for
completion, blocking any other operation.

This change introduces new asynchronous design, sending the IOCBs directly
on request queue and gracefully waiting for their return on response queue.
Returned IOCBs are identified with unified handle space from r292725.
2015-12-26 04:26:32 +00:00
Adrian Chadd
71e8eac4fd [mdio] migrate mdiobus out of etherswitch and into a top-level device of its own.
The mdio driver interface is generally useful for devices that require
MDIO without the full MII bus interface. This lifts the driver/interface
out of etherswitch(4), and adds a mdio(4) man page.

Submitted by:	Landon Fuller <landon@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D4606
2015-12-26 02:31:39 +00:00
Navdeep Parhar
9eb533d3b4 cxgbe(4): Updates to the base NIC driver and t4_tom to support the iSCSI
offload driver.  These changes come from projects/cxl_iscsi.
2015-12-26 00:26:02 +00:00
Kevin Lo
ddb1359877 Fix typo (s/harware/hardware/) 2015-12-25 14:51:36 +00:00
Alexander Motin
970ceb2fd5 Unify handles allocation for initiator and target IOCBs.
I am not sure why this was split long ago, but I see no reason for it.
At this point this unification just slightly reduces memory usage, but
as next step I plan to reuse shared handle space for other IOCB types.
2015-12-25 13:03:18 +00:00
Alexander Motin
a4f43c01c0 Clear virtual port's port database when disabling it.
Previously it was done only on full chip reinit, that caused old ports
resurrect in case of virtual port reenabling.
2015-12-25 03:44:29 +00:00