Commit graph

38882 commits

Author SHA1 Message Date
Mark Johnston
5346c8bc54 Suppress D_NEEDGIANT warnings for some drivers
During boot we warn that the kbd and openfirm drivers are Giant-locked
and may be deleted.  Generally, the warning helps signal that certain
old drivers are not being maintained and are subject to removal, but
this doesn't really apply to certain drivers which are harder to
detangle from Giant.

Add a flag, D_GIANTOK, that devices can specify to suppress the
misleading warning.  Use it in the kbd and openfirm drivers.

Reviewed by:	imp, jhb
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fbeb4ccac9)
2021-06-14 16:25:14 -04:00
Radosław Chmielarz
67b7e2de4f iwn: adjust EEPROM read timeout for Intel 4965AGN M2
Reading EEPROM from Intel 4965AGN M2 takes 60 us which was causing panic
on system startup.

PR:		255465
Reviewed by:	markj

(cherry picked from commit 03d4b58fee)
2021-06-14 16:25:14 -04:00
Vladimir Kondratyev
a4a738ba75 ums(4): Do not stop USB xfers on FIFO close when evdev is still active
This fixes lose of evdev events after moused has been killed.

While here use bitwise operations for UMS_EVDEV_OPENED flag.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30342

(cherry picked from commit 05ab03a317)
2021-06-14 00:59:18 +03:00
Vladimir Kondratyev
927742783f ums(4): Start USB xfers on opening of evdev node unconditionally.
This fixes inability to start USB xfers in a case when FIFO has been
already open()-ed but no read() or poll() calls has been issued yet.

MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30343

(cherry picked from commit 47791339f0)
2021-06-14 00:58:44 +03:00
Vladimir Kondratyev
a303f4b1c1 usbhid(4): Add second set of USB transfers to work in polled mode.
The second set of USB transfer is requested by hkbd(4) and
should improve HID keyboard handling in kdb and panic contexts.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30486

(cherry picked from commit 9aa0e5af75)
2021-06-14 00:57:37 +03:00
Vladimir Kondratyev
4458105f06 usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len()
Which happens when USB transfer setup is failed.

PR:		254974
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30485

(cherry picked from commit e889a462d8)
2021-06-14 00:57:31 +03:00
Konstantin Belousov
a3a907abbf hyperv: register intr handler as usermode-mapped if loaded as module
(cherry picked from commit fe7d7ac408)
2021-06-12 19:58:02 +03:00
Dmitry Chagin
923cd7e05a rtwn_usb(4): Add a USB ID for the TP-Link Archer T2U v3.
PR:		256203
Submitted by:	Steve Kargl sgk at troutmask.apl.washington.edu

(cherry picked from commit 434c46c006)
2021-06-10 09:14:22 +03:00
Dmitry Chagin
195f47fdb6 run(4): add support for DLINK DWA-130 rev F1 wireless adaptor.
PR:		256092
Submitted by:	Francois Briere <purplefiasco at gmail.com>

(cherry picked from commit 8746bc9187)
2021-06-06 14:23:43 +03:00
Jessica Clarke
36da5710d3 aic7xxx: Fix re-building firmware with -fno-common
The generated C output for aicasm_scan.l defines yylineno already, so
references to it from other files should use an extern declaration.

The STAILQ_HEAD use in aicasm_symbol.h also provided an identifier,
causing it to both define the struct type and define a variable of that
struct type, causing any C file including the header to define the same
variable. This variable is not used (and confusingly clashes with a
field name just below) and was likely caused by confusion when switching
between defining fields using similar type macros and defining the type
itself.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30525

(cherry picked from commit 5e912f5fec)
2021-06-04 01:28:15 +01:00
Edward Tomasz Napierala
92f49c769b smartpqi: clear CCBs allocated on the stack
Differential Revision:		https://reviews.freebsd.org/D30299

(cherry picked from commit e20e60be50)
2021-06-03 07:53:12 -06:00
PAPANI SRIKANTH
1569aab1cb Newly added features and bug fixes in latest Microchip SmartPQI driver
It includes:

1)Newly added TMF feature.
2)Added newly Huawei & Inspur PCI ID's
3)Fixed smartpqi driver hangs in Z-Pool while running on FreeBSD12.1
4)Fixed flooding dmesg in kernel while the controller is offline during in ioctls.
5)Avoided unnecessary host memory allocation for rcb sg buffers.
6)Fixed race conditions while accessing internal rcb structure.
7)Fixed where Logical volumes exposing two different names to the OS it's due to the system memory is overwritten with DMA stale data.
8)Fixed dynamically unloading a smartpqi driver.
9)Added device_shutdown callback instead of deprecated shutdown_final kernel event in smartpqi driver.
10)Fixed where Os is crashed during physical drive hot removal during heavy IO.
11)Fixed OS crash during controller lockup/offline during heavy IO.
12)Fixed coverity issues in smartpqi driver
13)Fixed system crash while creating and deleting logical volume in a continuous loop.
14)Fixed where the volume size is not exposing to OS when it expands.
15)Added HC3 pci id's.

Reviewed by:		Scott Benesh (microsemi), Murthy Bhat (microsemi), imp
Differential Revision:	https://reviews.freebsd.org/D30182

(cherry picked from commit 9fac68fc38)
2021-06-03 07:53:06 -06:00
Mark Johnston
7a67b893e8 cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on
PR:		255863
MFC after:	1 week

(cherry picked from commit 16f8f89c5c)
2021-06-02 09:34:07 -04:00
Mark Johnston
b22150dadd oce: Fix handling of m_pullup() errors in oce_tso_setup()
m_pullup() frees the input mbuf chain upon a failure.  Set *mpp to NULL
in this case to ensure that the caller does not free the chain again.

PR:		255864
Submitted by:	Lv Yunlong <lylgood@foxmail.com> (original version)
MFC after:	1 week

(cherry picked from commit 71776d6719)
2021-06-02 09:33:16 -04:00
Mark Johnston
78b147467e acpi: Add missing error handling to acpi_pci_link_route_irqs()
Otherwise the resouce buffer may have been freed when
AcpiSetCurrentResources() is called, leading to a use-after-free.

PR:		255862
Submitted by:	Lv Yunlong <lylgood@foxmail.com> (original version)
MFC after:	1 week

(cherry picked from commit 4cf3327528)
2021-06-02 09:32:37 -04:00
Hans Petter Selasky
ad9d0df7c6 Propagate down USB explore error codes, so that failures to enumerate USB HUBs
behind USB HUBs are detected and the USB reset counter logic will kick in
preventing enumeration of continuously failing ports.

Submitted by:	phk@
Tested by:	bz@
PR:		237666
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit e5ff940a81)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
ae9aba942b Update usb_timings_sysctl_handler() to accept any value for timings between
0 milliseconds and 2 seconds inclusivly. Some style fixes while at it.

The USB specification has minimum values and maximum values,
and not only minimum values.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 00e501d720)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
5bbf7afe30 Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which
says it should be max 10 milliseconds.

This may fix some USB enumeration issues:
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_IOERROR, ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,

Found by:	Zhichao1.Li@dell.com
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 70ffaaa69c)
2021-06-02 13:25:19 +02:00
Hans Petter Selasky
9f98b3ea74 Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by
detaching the ifnet before the miibus.

PR:		252608
Suggested by:	jhb@
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4eac63af23)
2021-06-02 13:25:19 +02:00
Dmitry Chagin
9394c3fcdb run(4): add support for ASUS USB-N14 wireless adaptor.
PR:		255759
Submitted by:	john.lmurdoch at gmail.com

(cherry picked from commit d6fd321ef6)
2021-06-01 13:01:53 +03:00
Konstantin Belousov
2e170ce65b Add support for Gemini Lake LPSS UARTs.
PR:	256101

(cherry picked from commit eaf00819bc)
2021-05-30 03:44:45 +03:00
Kevin Bowling
756d096417 ixgbe: Improve device name strings
This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts.

Approved by:	erj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29876

(cherry picked from commit fdbcd35a75)
2021-05-27 22:53:23 -07:00
Kevin Bowling
1fb96c59b4 e1000: Rework em_msi_link interrupt filter
* Fix 82574 Link Status Changes, carrying the OTHER mask bit around as
  needed.
* Move igb-class LSC re-arming out of FAST back into the handler.
* Clarify spurious/other interrupt re-arms in FAST.

In MSI-X mode, 82574 and igb-class devices use an interrupt filter to
handle Link Status Changes. We want to do LSC re-arms in the handler
to take advantage of autoclear (EIAC) single shot behavior.

82574 uses 'Other' in ICR and IMS for LSC interrupt types when in MSI-X
mode, so we need to set and re-arm the 'Other' bit during attach and
after ICR reads in the FAST handler if not an LSC or after handling on
LSC due to autoclearing.

This work was primarily done to address the referenced PR, but inspired
some clarification and improvement for igb-class devices once the
intentions of previous bug fix attempts became clearer.

PR:		211219
Reported by:	Alexey <aserp3@gmail.com>
Tested by:	kbowling (I210 lagg), markj (I210)
Approved by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29943

(cherry picked from commit eea55de7b1)
2021-05-27 22:50:07 -07:00
Kevin Bowling
e09d1b7ec4 e1000: Improve device name strings
This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts (this driver covers over 20 years
of silicon)

Reviewed by:	erj
Approved by:	markj
Sponsored by:	Pink Floyd - Any Colour You Like (in kind)
Differential Revision:	https://reviews.freebsd.org/D29872

(cherry picked from commit 0f6bea61ed)
2021-05-27 22:45:36 -07:00
Kevin Bowling
938b01476a e1000: Correct promisc multicast filter handling
There are a number of issues in the e1000 multicast filter handling
that have been present for a long time. Take the updated approach from
ixgbe(4) which does not have the issues.

The issues are outlined in the PR, in particular this solves crossing
over and under the hardware's filter limit, not programming the
hardware filter when we are above its limit, disabling SBP (show bad
packets) when the tunable is enabled and exiting promiscuous mode, and
an off-by-one error in the em_copy_maddr function.

PR:		140647
Reported by:	jtl
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29789

(cherry picked from commit 4b38eed76d)
2021-05-27 22:30:03 -07:00
Kevin Bowling
1567ceeb09 ixgbe: Clean up unneeded set in ixgbe_if_multi_set
We don't need to set the bits here since the if/else if/else statements
fully cover setting these bit pairs.

Reported by:	markj
Reviewed by:	markj, erj
Approved by:	#intel_networking
MFC aftter:	1 week
Differential Revision:	https://reviews.freebsd.org/D29827

(cherry picked from commit deecaa1445)
2021-05-27 22:27:44 -07:00
Philippe Michaud-Boudreault
bdbb0f0565 hda: correct comment about Asus laptop digital mics
Reported in review D30333

MFC after:	1 week

(cherry picked from commit 5d698386fb)
2021-05-26 20:47:14 -04:00
Konstantin Belousov
00ecc35900 alc(4): add support for Mikrotik 10/25G NIC
PR:	256000

(cherry picked from commit 77b637338a)
2021-05-26 14:30:36 +03:00
Alexander Motin
22d8055aa2 mpr/mps(4): Make device mapping some more robust.
Allow new enclosure to replace previously existing one if there is
no completely unused table entry, same as it is done for devices.

If we can not process DPM due to corruption -- wipe it and restart
from scratch.  Otherwise I don't see a way to recover persistence if
something go wrong and there is no BIOS to recover it for us.

Together this solves a problem that appeared when 9300-8i firmware
update to 16.00.10.00 somehow switched its mapping mode from Device
Persistence to Enclosure/Slot without wiping the DPM table.  It made
HBA completely unusable, since overflowed and conflicting mapping
table was unable to map any of enclosures and so devices.

Also while there make some enclosure mapping errors more informative.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.

(cherry picked from commit b99419aee4)
2021-05-24 10:43:39 -04:00
Andriy Gapon
4a7dcb174c storvsc: fix auto-sense reporting
I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb
even though SRB_STATUS_AUTOSENSE_VALID was not set in the status.
The actual sense data remained all zeros.
The problem seems to be that create_storvsc_request() always sets
hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0
is not enough to determine if any auto-sense data is actually available.

Sponsored by:	CyberSecure

(cherry picked from commit 8afecefd57)
2021-05-21 13:32:13 +03:00
Andriy Gapon
d7d4592ada PCI hot-plug: use dedicated taskqueue for device attach / detach
Attaching and detaching devices can be heavy-weight and detaching can
sleep waiting for events.  For that reason using the system-wide
single-threaded taskqueue_thread is not really appropriate.
There is even a possibility for a deadlock if taskqueue_thread is used
for detaching.

In fact, there is an easy to reproduce deadlock involving nvme, pass
and a sudden removal of an NVMe device.
A pass peripheral would not release a reference on an nvme sim until
pass_shutdown_kqueue() is executed via taskqueue_thread.  But the
taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free()
because of the outstanding reference.

Sponsored by:	CyberSecure
Reviewed by:	mav, imp

(cherry picked from commit 12588ce02d)
2021-05-21 13:28:06 +03:00
Kevin Bowling
a7e6edc7d7 e1000: fix em_mac_min and 82547 packet buffer
The boundary differentiating "lem" vs "em" class devices was wrong
after the iflib conversion of lem(4).

The Packet Buffer size for 82547 class chips was not set correctly
after the iflib conversion of lem(4).

These changes restore functionality on an 82547 for the submitter.

PR:		236119
Reported by:	Jeff Gibbons <jgibbons@protogate.com>
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29766

(cherry picked from commit bb1b375fa7)
2021-05-18 00:45:49 -07:00
Kevin Bowling
135a6b5652 e1000: disable hw.em.sbp debug setting
This is a debugging tunable that shouldn't have retained this setting
after the initial iflib conversion of the driver

PR:		248934
Reported by:	Franco Fichtner <franco@opnsense.org>
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29768

(cherry picked from commit 548d8a131d)
2021-05-18 00:42:59 -07:00
Mark Johnston
1e066db6cd Add missing sockaddr length and family validation to various protocols
Several protocol methods take a sockaddr as input.  In some cases the
sockaddr lengths were not being validated, or were validated after some
out-of-bounds accesses could occur.  Add requisite checking to various
protocol entry points, and convert some existing checks to assertions
where appropriate.

Reported by:	syzkaller+KASAN
Reviewed by:	tuexen, melifaro
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29519

(cherry picked from commit f161d294b9)
2021-05-17 13:43:07 -04:00
Sai Rajesh Tallamraju
c9361f2fb0 ixgbe: Restore AIM support
AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon IFLIB
migration, AIM feature got lost. Re-introducing AIM back into IFLIB
based IXGBE driver.

One caveat is that in BSD11 driver, a queue comprises both Rx and Tx
ring. Starting from BSD12, Rx and Tx have their own queues and rings.
Also, IRQ is now only configured for Rx side. So, when AIM is
re-enabled, we should now consider only Rx stats for configuring EITR
register in contrast to BSD11 where Rx and Tx stats were considered to
manipulate EITR register.

Reviewed by:	gallatin, markj
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D27344

(cherry picked from commit 64881da478)
2021-05-16 22:21:10 -04:00
Navdeep Parhar
1f9df724eb cxgbe(4): Use ifaddr_event_ext instead of ifaddr_event for CLIP management.
The _ext event notification includes the address being added/removed and
that gives the driver an easy way to ignore non-IPv6 addresses.  Remove
'tom' from the handler's name while here, it was moved out of t4_tom a
long time ago.

Sponsored by:	Chelsio Communications

(cherry picked from commit f4ba035bca)
2021-05-15 20:45:59 -07:00
Navdeep Parhar
8f7d958766 cxgbe(4): Do not panic when tx is called with invalid checksum requests.
There is no need to panic in if_transmit if the checksums requested are
inconsistent with the frame being transmitted.  This typically indicates
that the kernel and driver were built with different INET/INET6 options,
or there is some other kernel bug.  The driver should just throw away
the requests that it doesn't understand and move on.

Sponsored by:	Chelsio Communications

(cherry picked from commit b9820bca18)
2021-05-15 20:44:46 -07:00
Navdeep Parhar
1c0a5613ac cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.
Sponsored by:	Chelsio Communications

(cherry picked from commit 50f5d13eeb)
2021-05-15 20:37:37 -07:00
Navdeep Parhar
294591a4b7 cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
It can be called to (re)apply the settings in the driver softc to the
hardware.

Sponsored by:	Chelsio Communications

(cherry picked from commit 5f00292fe3)
2021-05-15 20:36:13 -07:00
Navdeep Parhar
7d984fe000 cxgbe(4): Add flag to reliably stop the driver from accessing hw stats.
There are two kinds of routines in the driver that read statistics from
the hardware: the cxgbe_* variants read the per-port MPS/MAC registers
and the vi_* variants read the per-VI registers.  They can be called
from the 1Hz callout or if_get_counter.  All stats collection now takes
place under the callout lock and there is a new flag to indicate that
these routines should not access any hardware register.

Sponsored by:	Chelsio Communications

(cherry picked from commit b47b28e5b2)
2021-05-15 20:34:01 -07:00
Navdeep Parhar
8b8b659f39 cxgbe(4): RSS hash for VXLAN traffic is computed from the inner frame.
Sponsored by:	Chelsio Communications

(cherry picked from commit d107ee06f3)
2021-05-15 20:28:50 -07:00
Navdeep Parhar
b7259437d5 cxgbe(4): Fix minor nit in the display of MPS TCAM entries.
(cherry picked from commit dc77e79296)
2021-05-15 20:26:58 -07:00
Navdeep Parhar
9b107d9ef4 cxgbe(4): make the logging helpers a little more robust.
Sponsored by:	Chelsio Communications

(cherry picked from commit 8f1bc78ef7)
2021-05-15 20:26:22 -07:00
Navdeep Parhar
81ec0d0546 cxgbe/tom: Fix potential leak in t4_aiotx_process_job.
The mbuf allocated could be a chain and must be freed with m_freem.

Reviewed by:	jhb@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29579

(cherry picked from commit bf5057691b)
2021-05-15 20:24:06 -07:00
Navdeep Parhar
e0897d6669 cxgbe(4): Always use the per-VI callout to read interface stats.
There is no change in the source of the stats (t4_get_port_stats or
t4_get_vi_stats) but the per-port callout is gone.

Sponsored by:	Chelsio Communications
Reviewed by:	jhb@
Differential Revision:	https://reviews.freebsd.org/D29527

(cherry picked from commit 516fe911a6)
2021-05-15 20:21:58 -07:00
Navdeep Parhar
248bc9784a cxgbe/t4_tom: restore socket's protosw before entering TIME_WAIT.
This fixes a panic due to stale so->so_proto if t4_tom is unloaded and
one or more connections that were previously offloaded are still around
in TIME_WAIT state.

Reviewed by:	jhb@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29503

(cherry picked from commit 5394893269)
2021-05-15 20:18:42 -07:00
Navdeep Parhar
95a3005326 cxgbe(4): Allow a T6 adapter to switch between TOE and NIC TLS mode.
The hw.cxgbe.kern_tls tunable was used for this in the past and if it
was set then all T6 adapters would be configured for NIC TLS operation
and could not be reconfigured for TOE without a reload.  With this
change ifconfig can be used to manipulate toe and txtls caps like any
other caps.  hw.cxgbe.kern_tls continues to work as usual but its
effects are not permanent any more.

* Enable nic_ktls_ofld in the default configuration file and use the
  firmware instead of direct register manipulation to apply/rollback
  NIC TLS configuration.  This allows the driver to switch the hardware
  between TOE and NIC TLS mode in a safe manner.  Note that the
  configuration is adapter-wide and not per-port.

* Remove the kern_tls config file as it works with 100G T6 cards only
  and leads to firmware crashes with 25G cards.  The configurations
  included with the driver (with the exception of the FPGA configs) are
  supposed to work with all adapters.

Reported by:	Veeresh U.K. at Chelsio
Sponsored by:	Chelsio Communications
Reviewed by:	jhb@
Differential Revision: https://reviews.freebsd.org/D29291

(cherry picked from commit 15f3355567)
2021-05-15 20:12:11 -07:00
Navdeep Parhar
139c8bd6f3 cxgbe(4): create a separate helper routine to write the global RSS key.
While here, make sure only the PF driver attempts to program the global
RSS key (with options RSS).  The VF driver doesn't have access to those
device registers.

Sponsored by:	Chelsio Communications

(cherry picked from commit 3cc6f777be)
2021-05-15 20:10:57 -07:00
Navdeep Parhar
d9eb1e0c90 cxgbe(4): make it safe to call setup_memwin repeatedly.
A repeat call will recreate the memory windows in the hardware and move
them to their last-known positions without repeating any of the software
initialization.

Sponsored by:	Chelsio Communications

(cherry picked from commit a1d803c162)
2021-05-15 20:08:51 -07:00
Navdeep Parhar
564d1f6aef cxgbe(4): use standard sysctl routines to deal with 16b values.
These routines to handle 8b and 16b types were added in r289773 5+ years
ago.

Sponsored by:	Chelsio Communications

(cherry picked from commit 473f6163e3)
2021-05-15 20:06:35 -07:00