Commit Graph

33901 Commits

Author SHA1 Message Date
Ian Lepore
bf9c1267f3 Check the clock-halted flag every time the clock is read, not just once
at startup.  The flag stays set until the clock is loaded with good time,
so we need to keep saying the time is invalid until that happens.
2017-07-31 15:24:40 +00:00
Ian Lepore
ccf32b9887 Add a detach() method. 2017-07-31 14:58:01 +00:00
Ian Lepore
cf24e991a6 Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so
that transfers will be done with proper ownership of the bus. No
behavioral changes.  Also add a detach() method.
2017-07-31 14:57:02 +00:00
Hans Petter Selasky
3f38293d29 Remove some dead statistics related code and a structure field from the
mlx4en driver which is used by its Linux counterpart, but not under
FreeBSD.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 12:09:24 +00:00
Hans Petter Selasky
f40410e868 Make sure on-stack buffer is properly aligned.
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 12:03:45 +00:00
Hans Petter Selasky
b0259ad374 Fix broken usage of the mlx4_read_clock() function:
- return value has too small width
 - cycle_t is unsigned and cannot be less than zero

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 09:15:15 +00:00
Ian Lepore
4c0c8a36da Remove now-unused variable. 2017-07-31 03:19:16 +00:00
Ian Lepore
02d094ff04 Use the new clock_schedule() to arrange for clock_settime() to be called
at the right time to keep the RTC hardware time in sync, instead of using
pause_sbt() to sleep until the right time.
2017-07-31 01:36:51 +00:00
Scott Long
b618318ae3 Don't re-parse PCI IDs in order to set card-specific flags, use
the flags field in the PCIID table.
2017-07-31 00:05:49 +00:00
Andriy Voskoboinyk
9dba612805 rtwn_usb: add support for fragmented Rx.
Since device can pass multiple frames in a single payload temporary
Rx buffer was big enough to hold all of them; now the driver can
concatenate a single frame from multiple payloads.

The Rx buffer size may be configured via tunable (dev.rtwn.%d.rx_buf_size).

Tested with:
 - rtl8188cus, rtl8188eu and rtl8821au (STA mode).
 - (by kevlo) rtl8192cu and rtl8188eu.

PR:		218527
Reviewed by:	kevlo
Differential Revision:	https://reviews.freebsd.org/D11705
2017-07-30 23:35:21 +00:00
Scott Long
055e2653d4 Change from using underbar function names to normal function names for
the informational print functions.  Collapse the debug API a bit to be
more generic and not require as much code duplication.  While here, fix
a bug in MPS that was already fixed in MPR.
2017-07-30 22:34:24 +00:00
Andriy Voskoboinyk
a08e9300f3 zyd: code cleanup + drop unneeded cast.
No functional change intended.
2017-07-30 22:17:08 +00:00
Andriy Voskoboinyk
ff97f477b9 rtwn: drop unnecessary / wrong conversion.
The 'chan' field occupies only one byte.
2017-07-30 21:50:45 +00:00
Ian Lepore
2e639013ed Fix AM/PM mode handling. The bits to mask off in the hours register changes
between 12/24 hour mode.  Also fix conversion between 12 and 24 hour mode.
It's not as easy as adding/subtracting 12, because the clock doesn't roll
over 11->0, it rolls over 12->1; 0 isn't a valid hour in AM/PM mode.
2017-07-30 19:58:31 +00:00
Ian Lepore
d0462804d4 Bugfixes and enhancements...
Don't enable the oscillator when it is found to be stopped at init time,
just let the first setting of valid time start it.  But still report a dead
battery if it's stopped at init time.

Don't force the chip into 24hr mode, just cope with whatever mode it is
already in.

Align the RTC clock to top of second when setting it.
2017-07-30 18:46:38 +00:00
Hans Petter Selasky
bd9175e1aa Properly range check length of parsed information elements in RSU driver.
Found by:		Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-07-30 16:45:28 +00:00
Ian Lepore
723a81dec6 Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so
that transfers will be done with proper ownership of the bus. No
behavioral changes.
2017-07-30 16:17:06 +00:00
Alexander Motin
26567f6924 Attach ichwd(4) only to ISA bus of the LPC bridge.
Resource allocation for parent device does not look good by itself, but
attempt to allocate them for unrelated device just does not end up good.
On Asus X99-E WS/USB3.1 system reporting ISA bridge via both PCI and ACPI
this reported to cause kernel panic on shutdown due to messed resources:
https://bugs.freenas.org/issues/25237.

MFC after:	1 week
2017-07-30 15:19:07 +00:00
Scott Long
252b2b4f4f Split the interrupt setup code into two parts: allocation and configuration.
Do the allocation before requesting the IOCFacts message.  This triggers
    the LSI firmware to recognize the multiqueue should be enabled if available.
    Multiqueue isn't used by the driver yet, but this also fixes a problem with
    the cached IOCFacts not matching latter checks, leading to potential problems
    with error recovery.

    As a side-effect, fetch the driver tunables as early as possible.

Reviewed by:	slm
Obtained from:	Netflix
Differential Revision:	D9243
2017-07-30 06:53:58 +00:00
Ian Lepore
e25f1cf5be Fix building this driver on non-FDT platforms. 2017-07-30 00:00:30 +00:00
Ian Lepore
207fe81ea8 Replace the pcf8563 i2c RTC driver with a new nxprtc driver which handles
all the chips in the NXP PCA212x and PCA/PCF85xx series.  In addition to
supporting more chips, this driver uses the countdown timer on the chips as
a fractional seconds counter, giving it a resolution of about 15 milliseconds.
2017-07-29 23:45:57 +00:00
Ian Lepore
d35f6548e6 Add inline functions to convert between sbintime_t and decimal time units.
Use them in some existing code that is vulnerable to roundoff errors.

The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into
writing code such as long_timeout_ns*SBT_1NS to generate the argument for a
sleep call.  The actual value of 1ns in sbt units is ~4.3, leading to a
large roundoff error giving a shorter sleep than expected when multiplying
by the trucated value of 4 in SBT_1NS.  (The evil honeypot aspect becomes
clear after you waste a whole day figuring out why your sleeps return early.)
2017-07-29 17:00:23 +00:00
Kristof Provost
83699dfd09 vtnet: Support jumbo frames without TSO/GSO
Currently in Virtio driver without TSO/GSO features enabled, the max scatter
gather segments for the TX path can be 4, which limits the support for 9K JUMBO
frames. 9K JUMBO frames results in more than 4 scatter gather segments and
virtio driver fails to send the frame down to host OS. With TSO/GSO feature
enabled max scatter gather segments can be 64, then 9K JUMBO frames are fine,
this is making virtio driver to support JUMBO frames only with TSO/GSO.

Increasing the VTNET_MIN_TX_SEGS which is the case for non TSO/GSO to 32 to
support upto 64K JUMBO frames to Host.

Submitted by:	Lohith Bellad <lohithbsd@gmail.com>
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8803
2017-07-29 09:22:48 +00:00
Navdeep Parhar
f8d0488ec6 cxgbe/iw_cxgbe: Log the end point's history and flags to the trace
buffer just before it's freed.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-07-28 22:28:45 +00:00
Jung-uk Kim
5f9b24fa43 Merge ACPICA 20170728. 2017-07-28 22:23:29 +00:00
Mark Johnston
1e16346226 Fix style bugs in ksyms.c.
No functional change intended.

MFC after:	3 days
2017-07-28 03:18:18 +00:00
Mark Johnston
7c86ae1a00 Restrict permissions on /dev/ksyms to 0400.
The ksyms(4) device was added specifically for use by lockstat(1), which
as a DTrace consumer must run as root.

Discussed with:	emaste
MFC after:	3 days
2017-07-28 03:14:31 +00:00
Sean Bruno
b7e0bde0af Drop IXL RX lock during TCP_LRO, fixes LOR mahem while holding the RX
queue lock when the uppoer stack is called inside TCP_LRO

Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Reviewed by:	erj
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D11724
2017-07-27 23:01:07 +00:00
Sean Bruno
9bc7588cb6 Deprecate unused int isc_max_txqsets and int isc_max_rxqsets as they
were redundant and not being used to set anything up.

Submitted by:	Matt Macy <mmacy@mattmacy.io>
Reported by:	Jeb Cramer <cramerj@intel.com>
Sponsored by:	Limelight Networks
2017-07-27 21:21:43 +00:00
Kenneth D. Merry
fefd924a01 Remove duplicate assignments from r321622.
Submitted by:	mav
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-27 15:51:56 +00:00
Kenneth D. Merry
a0acb3512c Fix probing FC targets with hard addressing turned on.
This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.

The intent of that change was to keep loop IDs persistent across
chip reinits.

The problem is that the change turned on the PREVLOOP /
PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
Qlogic chip to not participate in the loop if it can't get the
requested loop address.  It also turned off soft addressing on 2400
(4Gb) and newer controllers.

The isp(4) driver defaults to loop address 0, and the tape drives
I have tested default to loop address 0 if hard addressing is turned
on.  So when hard loop addressing is turned on on the drive, the isp(4)
driver just refuses to participate in the loop.

The solution is to largely revert that change.  I left some elements
in place that are related to virtual ports, since they were new.

This does work with IBM tape drives with hard and soft addressing
turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.

sys/dev/isp.c:
	Largely revert FreeBSD SVN change 289937.  I left the
	ispmbox.h changes in place.

	Don't use the PREV_ADDRESS bit on initialization.  It tells
	the chip to not participate if it can't get the requested
	loop ID.

	Do use soft addressing on 2400 and newer chips.

	Use hard addressing when the user has requested a specific
	initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)

	Leave some of the virtual port options from that change in
	place, but don't turn on the PREV_ADDRESS bit.

Reviewed by:	mav
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-27 15:33:57 +00:00
Ed Maste
059178b639 uart: add AX99100 chipset support
PR:		215837
Submitted by:	joe@thrallingpenguin.com
MFC after:	2 weeks
2017-07-27 02:53:18 +00:00
Luiz Otavio O Souza
0e779c2f7b Fix the port vlan support in e6000 based switches.
Reduce the use of local copies of switch register data.

The switch now works with the upstream dsa node (i.e. the upstream DTS).

Tested on:	ClearFog Pro (88E6176), SG-3100 (88E6141)
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-07-27 02:38:53 +00:00
Marius Strobl
7fcf47802a - Check the slot type capability, set SDHCI_SLOT_{EMBEDDED,NON_REMOVABLE}
for embedded slots. Fail in the sdhci(4) initialization for slot type
  shared, which is completely unsupported by this driver at the moment. [1]
  For Intel eMMC controllers, taking the embedded slot type into account
  obsoltes setting SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE so remove these quirk
  entries.
- Hide the 1.8 V VDD capability when the slot is detected as non-embedded,
  as the SDHCI specification explicitly states that 1.8 V VDD is applicable
  to embedded slots only. [2]
- Define some easy bits of the SDHCI specification v4.20. [3]
- Don't leak bus_dma(9) resources in failure paths of sdhci_init_slot().

Obtained from:	DragonFlyBSD 65704a46 [1], 7ba10b88 [2], 0df14648 [3]
2017-07-26 22:04:23 +00:00
Marius Strobl
7a777659ff Correctly use the size of a pointer rather than that of a pointer to a
pointer.

Reported by:	Coverity
CID:		1378432
2017-07-26 21:59:37 +00:00
Ian Lepore
34199ee049 Add support for tracking nested calls to iicbus_request/release_bus().
Usually it is sufficient to use iicbus_transfer_excl(), or one of the
higher-level convenience functions that use it, to reserve the bus for the
duration of each register access.  Occasionally it is important that a
series of accesses or read-modify-write operations must be done without any
other intervening access to the device, to prevent corrupting state.

Without support for nested request/release, slave device drivers would have
to stop using high-level convenience functions and resort to working with
arrays of iic_msg structs just for a few operations (often involving
one-time device setup or infrequent configuration changes).

The changes here appear large from a glance at the diff, but in fact they're
nearly trivial, and the large diff is because of changes in indentation and
the re-wrapping of comments caused by that.  One notable change is that
iicbus_release_bus() now ignores the IICBUS_CALLBACK(IIC_RELEASE_BUS) return
value.  The old error handling left the bus in a kind of limbo state where
it was still owned at the iicbus layer, but drivers rarely check the return
of the release call, and it's unclear what they would do to recover from an
error return anyway.  No existing low-level drivers return any kind of error
from IIC_RELEASE_BUS except one EINVAL for "you don't own the bus", to which
the right response is probably to carry on with the process of releasing the
reference to the bus anyway.
2017-07-26 21:06:26 +00:00
Ian Lepore
7ec74c580d Add a pair of convenience routines for doing simple "register" read/writes
on i2c devices, where the "register" can be any length.

Many (perhaps most) common i2c devices are organized as a collection of
(usually 1-byte-wide) registers, and are accessed by first writing a 1-byte
register index/offset number, then by reading or writing the data.
Generally there is an auto-increment feature so the when multiple bytes
are read or written, multiple contiguous registers are accessed.

Most existing slave device drivers allocate an array of iic_msg structures,
fill in all the transfer info, and invoke iicbus_transfer().  These new
functions commonize all that and reduce register access to a simple call
with a few arguments.
2017-07-26 20:40:24 +00:00
Navdeep Parhar
c45b18681f cxgbe(4): Some updates to the common code.
- Updated register ranges.
- Helper routines for access to TP registers.
- Updated routine to read flash parameters.

Obtained from:	Chelsio Communications
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-26 20:20:58 +00:00
Adrian Chadd
40fea7fd71 [iwm] Sync rs (rate-selection) API definitions from Linux iwlwifi.
* While there clean up alignments and line wrapping in existing
  definitions for rs API in if_iwmreg.h

Obtained from:	dragonflybsd.git 085e37a042bdb17081e495e46919359ce43aa118
2017-07-26 05:52:37 +00:00
Adrian Chadd
f55c604bdf [iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c.
Obtained from:	dragonflybsd.git 8a5dd7783e407856754093f5b1c9c757c64534b7
2017-07-26 05:51:31 +00:00
Adrian Chadd
1ecccab8fe [iwm] Sync statistics API definitions with Linux iwlwifi.
Obtained from:	dragonflybsd.git 75895a53a9c1ba60d75be9b4bf6e49a37f91a7cf
2017-07-26 05:40:52 +00:00
Adrian Chadd
7a3e63e7b3 [iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4).
* iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible
  memory leak, compared to using just mbufq_drain().

* Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be
  handled in the caller.

Obtained from:	dragonflybsd.git 339d45fda40072e0aca5ece639173204716f11fe
2017-07-26 05:29:08 +00:00
Adrian Chadd
2aa3dbb059 [iwm] if_iwm - Use chan list from ieee80211_scan_state for scan, not ic_channels.
* Limiting the channel list with "ifconfig wlan0 chanlist ..." now will
  actually set the list of channels scanned by iwm.

Tested:

* Intel 7260, STA mode, setting chanlist to 1-14 and 36-254, and indeed it does what
  it should!
2017-07-26 05:26:01 +00:00
Scott Long
6c85e33ee8 Quiet a message that sounds far more dire than it really is. 2017-07-26 01:48:13 +00:00
Marius Strobl
21794534db Improve the clarity of a comment added in r321385 by not referring to
volatile SDHCI specification lingo.
2017-07-25 20:36:44 +00:00
Sean Bruno
5a1813ecc1 bnxt: Implement interrupt coalescing options using sysctl.
Submitted by:	 bhargava.marreddy@broadcom.com
Differential Revision:	https://reviews.freebsd.org/D11702
2017-07-25 15:33:34 +00:00
Sean Bruno
e0ef5a7306 Drop ixgbe RX lock during TCP_LRO processing. This eliminates a "storm"
of LOR detection and a bit of lock release/acquire collision when using LRO.

Submitted by:   Kevin Bowling <kevin.bowling@kev009.com>
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D11712
2017-07-25 14:38:30 +00:00
Navdeep Parhar
dcbe705600 cxgbe(4): Display some more TOE parameters related to retransmission
and keepalive in the sysctl MIB.  Provide tunables to change some of
these parameters.  These are supposed to be setup by the firmware so
these tunables are for experimentation only.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-24 19:17:13 +00:00
Sepherosa Ziehau
40905afa0f hyperv/hn: Ignore LINK_SPEED_CHANGE status.
This status will be reported if the backend NIC is wireless; it's not
useful.  Due to the high frequency of the reporting, this could be
pretty annoying; ignore it.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11651
2017-07-24 04:00:43 +00:00
Sepherosa Ziehau
499c3e1739 hyperv/hn: Export VF list and VF-HN mapping
The VF-HN map will be used later on to implement "transparent VF".

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11618
2017-07-24 03:52:32 +00:00