Commit graph

39322 commits

Author SHA1 Message Date
Andriy Gapon
f1d2f22b34 pca954x: driver for PCA954x / TCA954x I2C switches
At the moment only PCA9548A is supported and has been tested.

(cherry picked from commit c0525ab1d1)
2021-11-24 16:19:09 +02:00
John Baldwin
d8feb950a6 Move the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.
These macros are not backend-specific but reference a
backend-independent field in struct icl_conn.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32858

(cherry picked from commit e900338c09)
2021-11-23 15:11:53 -08:00
John Baldwin
412a8b92d9 Further refine the ExpDataSN checks for SCSI Response PDUs.
According to 11.4.8 in RFC 7143, ExpDataSN MUST be 0 if the response
code is not Command Completed, but we were requiring it to always be
the count of DataIn PDUs regardless of the response code.

In addition, at least one target (OCI Oracle iSCSI block device)
returns an ExpDataSN of 0 when returning a valid completion with an
error status (Check Condition) in response to a SCSI Inquiry.  As a
workaround for this target, only warn without resetting the connection
for a 0 ExpDataSN for responses with a non-zero error status.

PR:		259152
Reported by:	dch
Reviewed by:	dch, mav, emaste
Fixes:		4f0f5bf995 iscsi: Validate DataSN values in Data-In PDUs in the initiator.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32650

(cherry picked from commit cdbc4a074b)
2021-11-23 15:11:44 -08:00
John Baldwin
9811763b41 iscsi: Validate DataSN values in Data-In PDUs in the initiator.
As is done in the target, require that DataSN values are consecutive
and in-order.  If an out of order Data-In PDU is received, force a
session reconnect.  In addition, when a SCSI Response PDU is received,
verify that the ExpDataSN field matches the count of Data-In PDUs
received for this command.  If not, force a session reconnect.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31594

(cherry picked from commit 4f0f5bf995)
2021-11-23 15:11:44 -08:00
John Baldwin
ff590791ff cxgbe: Only run ktls_tick when NIC TLS is enabled.
Previously the body of ktls_tick was a nop when NIC TLS was disabled,
but the callout was still scheduled consuming power on otherwise-idle
systems with Chelsio T6 adapters.  Now the callout only runs while NIC
TLS is enabled on at least one interface of an adapter.

Reported by:	mav
Reviewed by:	np, mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32491

(cherry picked from commit ef3f98ae47)
2021-11-23 15:11:43 -08:00
Mark Johnston
200d473202 hyperv: Register the MSR-based timecounter during SI_SUB_HYPERVISOR
This reverts commit 9ef7df022a ("hyperv: Register hyperv_timecounter
later during boot") and adds a comment explaining why the timecounter
needs to be registered as early as it is.

PR:		259878
Fixes:	9ef7df022a ("hyperv: Register hyperv_timecounter later during boot")
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ed6a9452be)
2021-11-22 08:45:34 -05:00
Andriy Gapon
ee82e15cd9 pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C
(cherry picked from commit 6354154ef5)
2021-11-21 11:59:34 +02:00
Warner Losh
706f4f705b vt: fix git mismerge
I made a mistaking in merging the final commits for the devctl changes. This
adds the 'hushed' variable and has the correct dates for the manuals.

Pointy hat to: imp

(cherry picked from commit 80f21bb039)
2021-11-18 22:10:07 -07:00
Warner Losh
a82d7aeb3f vt: Add devctl message for bells
Generate VT events when the bell beeps. When coupled with disabling the
bell,this allows custom bells to be rung when we'd otherwise beep.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D32656

(cherry picked from commit 4ac3d08a96)
2021-11-18 21:52:22 -07:00
Warner Losh
534fb4b8ae vt(4): Connect to teken's TP_SETBELLPD
Add the glue needed to listen to TP_SETBELLPD which teken uses to
inform its client drivers about the results of parsing
\e[=<pitch>;<duration>B. It converts these to a Hz value for the
tone/pitch of the bell and a duration in ms. There's some loss of
precision because <pitch> in the escape seuquence is defined to be
(1193182 / pitch) Hz and <duration> is in 10ms units. Also note that
kbdcontrol also parses 'off' but then doesn't send the proper escape
sequence, leading me to wonder if that's another bug since teken
appears to parse that sequence properly and I've added code here to
treat that as the same as quiet or disabled.

In general, Hz from 100 to 2000 is good. Outside that range is possible,
but even at 100Hz the square wave is starting to sound bad and above
2000Hz the speaker may not respond.

Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D32620

(cherry picked from commit 2533eca1c2)
2021-11-18 21:52:22 -07:00
Warner Losh
87586bff11 sysbeep: Adjust interface to take a duration as a sbt
Change the 'period' argument to 'duration' and change its type to
sbintime_t so we can more easily express different durations.

Reviewed by:	tsoome, glebius
Differential Revision:	https://reviews.freebsd.org/D32619

(cherry picked from commit 072d5b98c4)
2021-11-18 21:52:22 -07:00
Bjoern A. Zeeb
54aa95f082 mii: update URL for OUIs
Update the URL for OUIs as the old one is 404 not even 301 anymore.

(cherry picked from commit 8e902c1d21)
2021-11-19 00:01:27 +00:00
Dmitry Salychev
151d59e386 Parse named nodes from IORT ACPI on arm64
Add the ability to map named components from IORT to their
SMMU or ITS node in order to setup interrupts.
It is now possible to find a node by its name (substring) and
resource ID similar to PCI nodes.
This is needed by work on a driver for NXP's Second Generation
Data Path Acceleration Architecture (DPAA2).

Reviewed by:	andrew

(cherry picked from commit d178b1f878)
2021-11-19 00:01:27 +00:00
Bjoern A. Zeeb
378083e188 mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()
netdev_priv() is a LinuxKPI function which was used with the old ifnet
linux/netdevice.h implementation which was not adaptable to modern
Linux drviers unless rewriting them for ifnet in first place which
defeats the purpose.
Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv()
returning the ifnet softc to avoid conflicting symbol names
with different implementations in the future.

(cherry picked from commit 9d593d5a76)
2021-11-19 00:01:26 +00:00
Bjoern A. Zeeb
6acb9d5f95 net80211/drivers: improve ieee80211_rx_stats for band
While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9a6695532b)
2021-11-19 00:01:25 +00:00
Hans Petter Selasky
7d95b0f328 snd_uaudio(4): Fix string index computations for iFeature.
This allows the iFeature strings to be properly read by the snd_uaudio(4) driver,
when parsing the audio feature unit descriptors.

Submitted by:	Zhichao1.Li@dell.com
Sponsored by:	NVIDIA Networking

(cherry picked from commit 11f09b17fe)
2021-11-16 09:09:09 +01:00
Mark Johnston
ab9866cc79 pci: Implement pci_bar_enabled() for SR-IOV VFs
In a VF's configuration space, "memory space enable" is hard-wired to 0,
so the existing implementation always returns false.  We need to read
the SR-IOV control register from the PF device to get the value of the
MSE bit.

Fix pci_bar_enabled() to read this register instead for VFs.  I don't
see any way to access the PF's config space without a backpointer in the
pci device ivars, so I added one.

This fixes a regression where bhyve(8) fails to map the MSI-X table
after commit 7fa2335347 ("bhyve: Map the MSI-X table unconditionally
for passthrough") when a VF is passed through, since with that commit we
use PCIOCBARMMAP to map the table and that ioctl always fails for VFs
without this change.  As a bonus, pciconf(8) now correctly reports the
enablement of BARs for VFs.

Reported and tested by:	Raúl Muñoz <raul.munoz@custos.es>
Reviewed by:	rstone, jhb
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1f960e646b)
2021-11-15 13:11:52 -05:00
Mitchell Horne
5c2e6d9610 hwpmc: initialize arm64 counter/interrupt state
Performance counters and overflow interrupts are assumed to be disabled
by default, but this is not guaranteed. Ensure we disable both during
per-cpu initialization, before enabling the PMU. Otherwise, some systems
(such as the Ampere eMAG) would experience an interrupt storm upon
loading the hwpmc module.

Reviewed by:	br
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32854

(cherry picked from commit b826cc3caf)
2021-11-15 11:13:50 -04:00
Andriy Gapon
7785ea3373 gpioled: allow the driver to be disabled via fdt
(cherry picked from commit 832503063e)
2021-11-13 11:12:36 +02:00
Andriy Gapon
8f57430de1 driver for MAX44009 I2C illuminance sensor
(cherry picked from commit ff6fe29835)
2021-11-13 11:12:05 +02:00
Andriy Gapon
d6f71e09a7 pcf8591: driver for adc/dac with i2c interface
(cherry picked from commit a60b304697)
2021-11-13 11:10:44 +02:00
Andriy Gapon
737ed8b99f htu21: allow configuration via hints on FDT-based systems
On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit a75159eabc)
2021-11-13 11:04:29 +02:00
Andriy Gapon
c9882d7600 htu21: don't needlessly bother hardware when measurements are not needed
sysctl(8) first queries a sysctl to get a size of its value even if the
sysctl is of a fixed size, e.g. it has an integer type.
Only after that sysctl(8) queries an actual value of the sysctl.

Previosuly the driver would needlessly read a sensor in the first step.

(cherry picked from commit 43b031a371)
2021-11-13 10:59:33 +02:00
Alexander Motin
1e5dc6aa18 Add some of Intel Alder Lake device IDs.
MFC after:	1 week

(cherry picked from commit dc238358f9)
2021-11-12 23:02:46 -05:00
Peter Grehan
37bfb1c965 igc: Use hardware routine for PHY reset
Summary:
The previously used software reset routine wasn't sufficient
to reset the PHY if the	bootloader hadn't left the device in
an initialized state. This was seen with the onboard igc port
on an 11th-gen Intel NUC.

The software reset isn't used in the Linux driver so all related
code has been removed.

Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card,
and an 11th-gen Intel NUC.

Reported by:	woodsb02
Tested by:	woodsb02 (NUC)
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 561cd74b17)
2021-11-13 06:45:41 +10:00
Peter Grehan
a4c22552b8 igc: correctly update RCTL when changing multicast filters.
Fix clearing of bits in RCTL for the non-bpf/non-allmulti case.
Update RCTL after modifying the multicast filter registers as per
the Linux driver.

This fixes LACP on igc interfaces, where incoming LACP multicasti
control packets were being dropped.

Obtained from:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5a3eb6207a)
2021-11-13 06:44:21 +10:00
Gordon Bergling
8be6c438c8 e1000: Fix a typo in a source code comment
- s/overwritting/overwriting/

(cherry picked from commit e9c7c6f5a0)
2021-11-11 17:27:31 +01:00
Gordon Bergling
113c2e8977 usb_audio: Fix a typo in a source code comment
- s/maxium/maximum/

(cherry picked from commit 3d6ed119e3)
2021-11-11 17:26:19 +01:00
Mark Johnston
5df48c0fa5 vmci: Avoid relying on macro expansion to provide correct syntax
No functional change intended.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c75c1d2df9)
2021-11-07 14:39:38 -05:00
Gordon Bergling
16f3658c7d ocs_fs: Fix two typos in source code comments
- s/maxium/maximum/
- s/maxiumum/maximum/

(cherry picked from commit 7b56cb0462)
2021-11-06 08:52:09 +01:00
Gordon Bergling
0a5b6cde28 ixgbe(4): Fix a few typos in source code comments
- s/Manageblility/Managebility/
- s/alows/allows/

Obtained from:	NetBSD

(cherry picked from commit 8da5034954)
2021-11-06 08:50:23 +01:00
Mark Johnston
f86bda068c Convert consumers to vm_page_alloc_noobj_contig()
Remove now-unneeded page zeroing.  No functional change intended.

Reviewed by:	alc, hselasky, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 84c3922243)
2021-11-03 13:41:40 -04:00
Mark Johnston
66cb1858f4 Convert vm_page_alloc() callers to use vm_page_alloc_noobj().
Remove page zeroing code from consumers and stop specifying
VM_ALLOC_NOOBJ.  In a few places, also convert an allocation loop to
simply use VM_ALLOC_WAITOK.

Similarly, convert vm_page_alloc_domain() callers.

Note that callers are now responsible for assigning the pindex.

Reviewed by:	alc, hselasky, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4667e09e6)
2021-11-03 13:39:36 -04:00
Hans Petter Selasky
f8b998c730 usb(4): Fix for use after free in combination with EVDEV_SUPPORT.
When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by:	pho@
Sponsored by:	NVIDIA Networking

(cherry picked from commit aad0c65d6b)
2021-11-02 09:37:25 +01:00
Mark Johnston
7e85d20eb8 hwpmc: Disable KASAN in pmc_save_kernel_callchain()
As in commit 831850d8b0, this routine can trigger false positives, so
exclude it from instrumentation.

Reported by:	pho
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5d243d41b1)
2021-11-01 10:06:47 -04:00
Mark Johnston
a2ca269b38 hyperv: Register hyperv_timecounter later during boot
Previously the MSR-based timecounter was registered during
SI_SUB_HYPERVISOR, i.e., very early during boot, and before SI_SUB_LOCK.
After commit 621fd9dcb2 this triggers a panic since the timecounter
list lock is not yet initialized.

The hyperv timecounter does not need to be registered so early, so defer
that to SI_SUB_DRIVERS, at the same time the hyperv TSC timecounter is
registered.

Reported by:	whu
Approved by:	whu
Fixes:		621fd9dcb2 ("timecounter: Lock the timecounter list")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9ef7df022a)
2021-11-01 08:56:16 -04:00
Gordon Bergling
499506ac09 bxe(4): Fix a few common typos in source code comments
- s/controled/controlled/
- s/allignment/alignment/

(cherry picked from commit 80abcfbdfe)
2021-10-30 09:49:09 +02:00
John Baldwin
5767c8ca4c cxgbei: Only convert "plain" TCP connections to ISCSI.
Reject attempts to convert a connection using a different ULP
mode: (e.g. DDP or TLS) to ISCSI.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit f63ddf465f)
2021-10-29 16:37:11 -07:00
John Baldwin
ed2a5ae6aa cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff.
This permits unindenting almost half of the function.

Sponsored by:	Chelsio Communications

(cherry picked from commit b7caa81576)
2021-10-29 16:36:10 -07:00
John Baldwin
56bc3b1a95 cxgbei: Disable ISO for -SO cards without external memory.
Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 9b1bb0aee6)
2021-10-29 16:35:15 -07:00
John Baldwin
075c8d9db3 cxgbei: Handle errors in PDUs.
When a PDU with an error (bad padding, header digest, or data digest)
is received, log the error via ICL_WARN() and then reset the
connection via the ic_error callback.

While here, add per-rxq counters for errors.

Sponsored by:	Chelsio Communications

(cherry picked from commit 4d4cf62e29)
2021-10-29 16:34:01 -07:00
John Baldwin
a75428c375 cxgbei: Add sysctls to report the maximum data segment lengths.
These sysctls report the maximum data segment lengths supported by an
adapter.  These are the values advertised to the remote end during the
login phase.

Sponsored by:	Chelsio Communications

(cherry picked from commit d39e65b5bd)
2021-10-29 16:33:14 -07:00
John Baldwin
d724218a74 cxgbei: Limit T5 transmit data segments to 15k.
This avoids exceeding a limit in the firmware when using ISO with
jumbo frames.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 64f09f2346)
2021-10-29 16:32:24 -07:00
John Baldwin
51983604da iscsi: Teach the iSCSI stack about "large" received PDUs.
When using iSCSI PDU offload (cxgbei) on T6 adapters, a burst of
received PDUs can be reported via a single message to the driver.

Previously the driver passed these multi-PDU bursts up to the iSCSI
stack up as a single "large" PDU by rewriting the buffer offset, data
segment length, and DataSN fields in the iSCSI header.  The DataSN
field in particular was rewritten so that each of the "large" PDUs
used consecutively increasing values.  While this worked, the forged
DataSN values did not match the ExpDataSN value in the subsequent SCSI
Response PDU.  The initiator does not currently verify this value, but
the forged DataSN values prevent adding a check.

To avoid this, allow a logical iSCSI PDU (struct icl_pdu) to describe
a burst of PDUs via a new 'ip_additional_pdus' field.  Normally this
field is set to zero when 'struct icl_pdu' represents a single PDU.
If logical PDU represents a burst of on-the-wire PDUs, then 'ip_npdus'
contains the count of additional on-the-wire PDUs.  The header of this
"large" PDU is still modified, but the DataSN field now contains the
DataSN value of the first on-the-wire PDU in the burst.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31577

(cherry picked from commit c261b6ea4e)
2021-10-29 16:30:51 -07:00
John Baldwin
0967aa717d cxgbei: Restrict received PDUs to 4 DDP pages in length.
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31576

(cherry picked from commit d75b0870e5)
2021-10-29 16:30:43 -07:00
John Baldwin
da92c273d5 cxgbei: Only round PDU data segment lengths down by 512 on T5.
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31575

(cherry picked from commit f28715fdc1)
2021-10-29 16:29:49 -07:00
John Baldwin
5dfe6f23d3 cxgbei: Restructure how PDU limits are managed.
- Compute data segment limits in read_pdu_limits() rather than PDU
  length limits.

- Add back connection-specific PDU overhead lengths to compute PDU
  length limits in icl_cxgbei_conn_handoff().

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31574

(cherry picked from commit cbc186360c)
2021-10-29 16:29:08 -07:00
John Baldwin
37c5daa855 cxgbei: Wait for the final CPL to be received in icl_cxgbei_conn_close.
A socket in the FIN_WAIT_1 state is marked disconnected by
do_close_con_rpl() even though there might still receive data pending.
This is because the socket at that point has set SBS_CANTRCVMORE which
causes the protocol layer to discard any data received before the FIN.
However, icl_cxgbei_conn_close needs to wait until all the data has
been discarded.  Replace the wait for SS_ISDISCONNECTED with instead
waiting for final_cpl_received() to be called.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 2eb0e53a6b)
2021-10-29 16:27:31 -07:00
John Baldwin
132894ca4b cxgbei: Support for ISO (iSCSI segmentation offload).
ISO can be disabled before establishing a connection by setting
dev.tNnex.N.toe.iso to 0.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31223

(cherry picked from commit 5b27e4b27c)
2021-10-29 16:27:10 -07:00
John Baldwin
e508e93f36 iSCSI: Add support for segmentation offload for hardware offloads.
Similar to TSO, iSCSI segmentation offload permits the upper layers to
submit a "large" virtual PDU which is split up into multiple segments
(PDUs) on the wire.  Similar to how the TCP/IP headers are used as
templates for TSO, the BHS at the start of a large PDU is used as a
template to construct the specific BHS at the start of each PDU.  In
particular, the DataSN is incremented for each subsequent PDU, and the
'F' flag is only set on the last PDU.

struct icl_conn has a new 'ic_hw_isomax' field which defaults to 0,
but can be set to the largest virtual PDU a backend supports.  If this
value is non-zero, the iSCSI target and initiator use this size
instead of 'ic_max_send_data_segment_length' to determine the maximum
size for SCSI Data-In and SCSI Data-Out PDUs.  Note that since PDUs
can be constructed from multiple buffers before being dispatched, the
target and initiator must wait for the PDU to be fully constructed
before determining the number of DataSN values were consumed (and thus
updating the per-transfer DataSN value used for the start of the next
PDU).

The target generates large PDUs for SCSI Data-In PDUs in
cfiscsi_datamove_in().  The initiator generates large PDUs for SCSI
Data-Out PDUs generated in response to an R2T.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31222

(cherry picked from commit f0594f52f6)
2021-10-29 16:20:35 -07:00