Commit graph

38789 commits

Author SHA1 Message Date
Vincenzo Maffione
89a4cc5c8a netmap: don't use linux type struct device *
Such type cannot be used in code that is in common between
FreeBSD and Linux. Use the FreeBSD type instead.

MFC after:	3 days
Reported by:	markj
Differential Revision:	https://reviews.freebsd.org/D29677

(cherry picked from commit 70275a6735)
2021-04-19 14:17:08 -04:00
Mark Johnston
1d553a9e3a qlnxr: Properly initialize the Linux device structure
The driver needs to provide a LinuxKPI device structure to register
itself with the IB subsystem.  It was erroneously using a copy of its
FreeBSD device structure for this purpose.

Use linux_pci_attach_device() instead, following the example of the
Chelsio iwarp driver.  Also ensure that we don't leak the faked device
during detach.

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29595

(cherry picked from commit 56cbd386fb)
2021-04-19 09:02:06 -04:00
Mark Johnston
07f3c3b500 cxgb: Use device_t in preference to struct device *
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9771af4942)
2021-04-19 09:02:04 -04:00
Mark Johnston
dba90f9e26 al_eth: Use device_t in preference to struct device *
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d8b1601d54)
2021-04-19 09:02:01 -04:00
Dmitry Chagin
02816ecfb9 Partially revert r248770.
Under geom(4) nvme_ns_bio_process() is on the path where sleep
is prohibited as g_io_shedule_down() calls THREAD_NO_SLEEPNG()
before geom->start().

Reviewed By:		imp
Differential Revision:	https://reviews.freebsd.org/D29539

(cherry picked from commit a78109d5db)
2021-04-16 11:33:32 +03:00
Alexander Motin
3bec9180c9 Add IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers.
MFC after:	1 week

(cherry picked from commit 5a8d32b53b)
2021-04-13 21:02:58 -04:00
Mark Johnston
507c464748 qat: Make prototypes consistent with the implementation
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 843d16436d)
2021-04-12 08:22:42 -04:00
Vladimir Kondratyev
99bc385243 hid: add opt_hid.h to modules that use HID_DEBUG
Submitted by:	Greg V <greg_AT_unrelenting_DOT_technology>
Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D28995

(cherry picked from commit 6241b57131)
2021-04-12 00:48:51 +03:00
Vladimir Kondratyev
09d2a7a67b ig4: Add PCI IDs for Intel Gemini Lake I2C controller.
Submitted by:	Dmitry Luhtionov
MFC after:	2 weeks

(cherry picked from commit bbacb7ce72)
2021-04-12 00:48:08 +03:00
Alex Richardson
30626f9ad5 sys/dev/md: Drop unncessary __GLOBL(mfs_root)
LLVM12 complains if you change the symbol binding:
error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm]
error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm]

(cherry picked from commit 69e18c9b7b)
2021-04-10 14:01:05 +01:00
Alexander Motin
88fe518973 Move time math out of disabled interrupts sections.
We don't need the result before next sleep time, so no reason to
additionally increase interrupt latency.

While there, remove extra PM ticks to microseconds conversion, making
C2/C3 sleep times look 4 times smaller than really.  The conversion
is already done by AcpiGetTimerDuration().  Now I see reported sleep
times up to 0.5s, just as expected for planned 2 wakeups per second.

MFC after:	1 month

(cherry picked from commit 2cee045b4d)
2021-04-06 20:33:59 -04:00
Alexander Motin
e6e4f79a6c Do not read timer extra time when MWAIT is used.
When we enter C2+ state via memory read, it may take chipset some
time to stop CPU.  Extra register read covers that time.  But MWAIT
makes CPU stop immediately, so we don't need to waste time after
wakeup with interrupts still disabled, increasing latency.

On my system it reduces ping localhost latency, waking up all CPUs
once a second, from 277us to 242us.

MFC after:	1 month

(cherry picked from commit 075e4807df)
2021-04-06 20:31:10 -04:00
Alexander Motin
9c27e7141b Change mwait_bm_avoidance use to match Linux.
Even though the information is very limited, it seems the intent of
this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3,
not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was
never needed, and which register not really doing anything for years.
It wasted lots of CPU time on congested global ACPI hardware lock
when many CPU cores were trying to enter/exit deep C-states same time.

On idle 80-core system it pushed ping localhost latency up to 20ms,
since badport_bandlim() via counter_ratecheck() wakes up all CPUs
same time once a second just to synchronously reset the counters.
Now enabling C-states increases the latency from 0.1 to just 0.25ms.

Discussed with:	kib
MFC after:	1 month

(cherry picked from commit 455219675d)
2021-04-06 20:30:23 -04:00
Ka Ho Ng
2e107638ea virtio_pci_legacy: Allow memory space for configuration
For guests running under some kind of VMMs, configuration structure is
available in memory space but not I/O space.

Reported by:	Yuan Rui <number201724@me.com>
Reviewed by:	rpokala, bryanv, jhb
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D28818

(cherry picked from commit cf5d111240)
2021-04-03 14:09:50 +08:00
Ka Ho Ng
98740ead97 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap
The MSI-X resource shouldn't be assumed to be always on BAR1.
The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to
be BAR1 either.

Reported by:	Yuan Rui <number201724@me.com>
Reviewed by:	bryanv, jhb
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D28817

(cherry picked from commit faf9a4e914)
2021-04-03 14:09:31 +08:00
Neel Chauhan
ea96dcc6e2 ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D27859
MFC after:		2 weeks

(cherry picked from commit a94d15af26)
2021-04-02 10:22:46 -07:00
Hans Petter Selasky
484bc45f54 MFC 31070b5bc7:
Set default alternate setting when USB audio devices are not in use,
to activate power save features.

Differential Revision:	https://reviews.freebsd.org/D28032
Suggested by:	Shichun_Ma@Dell.com
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 31070b5bc7)
2021-04-01 11:13:10 +02:00
Mark Johnston
381ba4357c Fix several dev_clone callbacks to avoid out-of-bounds reads
Use strncmp() instead of bcmp(), so that we don't have to find the
minimum of the string lengths before comparing.

Reviewed by:	kib
Reported by:	KASAN
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29463

(cherry picked from commit 3428b6c050)
2021-03-31 09:15:58 -04:00
John Baldwin
325427f71d xnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl().
ifmedia_ioctl() doesn't handle these requests, and this matches what
xn does.

Sponsored by:	DARPA

(cherry picked from commit 71ba16a0a0)
2021-03-29 15:36:36 -07:00
John Baldwin
1a325aa204 Remove unused wrappers around kproc_create() and kproc_exit().
Sponsored by:	Netflix

(cherry picked from commit 645b15e558)
2021-03-29 11:10:43 -07:00
Wei Hu
2fbdbfaa0c Hyper-V: hn: Initialize the internal field of per packet info on tx path
The RSC support feature introduced a bit field "rm_internal" in
struct rndis_pktinfo with total size unchanged.

The guest does not use this field in the tx path. However we need to
initialize it to zero in case older hosts which are not aware of this
field.

Fixes:		a491581f ("Hyper-V: hn: Enable vSwitch RSC support")
MFC after:	2 weeks
Sponsored by:	Microsoft

(cherry picked from commit 805dbff6c3)
2021-03-29 03:21:30 -07:00
Wei Hu
cdc59163ff Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver
Receive Segment Coalescing (RSC) in the vSwitch is a feature available in
Windows Server 2019 hosts and later. It reduces the per packet processing
overhead by coalescing multiple TCP segments when possible. This happens
mostly when TCP traffics are among different guests on same host.
This patch adds netvsc driver support for this feature.

The patch also updates NVS version to 6.1 as needed for RSC
enablement.

MFC after:	2 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D29075

(cherry picked from commit a491581f3f)
2021-03-29 03:20:03 -07:00
Wei Hu
a86be0da9a Hyper-V: hn: Store host hash value in flowid
When rx packet contains hash value sent from host, store it in
the mbuf's flowid field so when the same mbuf is on the tx path,
the hash value can be used by the host to determine the outgoing
network queue.

MFC after:	2 weeks
Sponsored by:	Microsoft

(cherry picked from commit 80f39bd95f)
2021-03-29 03:18:20 -07:00
Ed Maste
a66e75d9e2 mn: report that this driver is removed in 14, not 13 2021-03-24 22:35:38 -04:00
Hans Petter Selasky
ff2e2bca31 MFC 1acf24a044:
Implement pci_get_relaxed_ordering_enabled() helper function.

Discussed with:	kib@
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 1acf24a044)
2021-03-24 08:54:52 +01:00
Alexander Motin
ed407c92e4 nvme: Replace potentially long DELAY() with pause().
In some cases like broken hardware nvme(4) may wait minutes for
controller response before timeout.  Doing so in a tight spin loop
made whole system unresponsive.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29309
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 4fbbe52365)
2021-03-23 21:26:00 -04:00
Vincenzo Maffione
3e4127f8f2 netmap: fix issues in nm_os_extmem_create()
- Call vm_object_reference() before vm_map_lookup_done().
- Use vm_mmap_to_errno() to convert vm_map_* return values to errno.
- Fix memory leak of e->obj.

Reported by:	markj
Reviewed by:	markj
MFC after:	1 week

(cherry picked from commit ee7ffaa2e6)
2021-03-23 21:17:23 +00:00
Michal Vanco
395e612b7b pchtherm: fix a wrong bit and a wrong register use
Probably just copy-paste errors that slipped in.

(cherry picked from commit 5084dde5f0)

PR:		253915
Reported by:	Michal Vanco <michal.vanco@gmail.com>
2021-03-23 13:01:20 +02:00
John Baldwin
6a1dbc8ba9 iscsi: Mark iSCSI CAM sims as non-pollable.
Previously, iscsi_poll() just panicked.  This meant if you got a panic
on a box when using the iSCSI initiator, the attempt to shutdown would
trigger a nested panic and never write out a core.  Now, CCB's sent to
iSCSI devices (such as the sychronize-cache request in dashutdown())
just fail with a timeout during a panic shutdown.

Sponsored by:	Chelsio

(cherry picked from commit 47769bc557)
2021-03-22 13:37:46 -07:00
Mark Johnston
46f44865e3 iflib: Make if_shared_ctx_t a pointer to const
This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by:	gallatin, erj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29102

(cherry picked from commit ffe3def903)
2021-03-22 11:42:18 -04:00
Leandro Lupori
3aa6cc000f ofwfb: fix boot on LE
Some framebuffer properties obtained from the device tree were not being
properly converted to host endian.
Replace OF_getprop calls by OF_getencprop where needed to fix this.

This fixes boot on PowerPC64 LE, when using ofwfb as the system console.

Reviewed by:    bdragon
Sponsored by:   Eldorado Research Institute (eldorado.org.br)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27475

(cherry picked from commit 043577b721)
2021-03-22 10:48:46 -03:00
Michael Tuexen
6064ea8172 vtnet: fix TSO for TCP/IPv6
The decision whether a TCP packet is sent over IPv4 or IPv6 was
based on ethertype, which works correctly. In D27926 the criteria
was changed to checking if the CSUM_IP_TSO flag is set in the
csum-flags and then considering it to be TCP/IPv4.
However, the TCP stack sets the flag to CSUM_TSO for IPv4 and IPv6,
where CSUM_TSO is defined as CSUM_IP_TSO|CSUM_IP6_TSO.
Therefore TCP/IPv6 packets gets mis-classified as TCP/IPv4,
which breaks TSO for TCP/IPv6.
This patch bases the check again on the ethertype.
This fix is instantly MFCed.

Approved by:		re(gjb)
PR:			254366
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D29331

(cherry picked from commit d4697a6b56)
2021-03-18 21:33:32 +01:00
Vincenzo Maffione
120a4bd4e9 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET
The netmap_ioctl() function has a reference counting bug in case of
NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`,
the function does not decrease the refcount of "nmd", which is
increased by netmap_mem_find(), causing a refcount leak.

Reported by:	Xiyu Yang <sherllyyang00@gmail.com>
Submitted by:	Carl Smith <carl.smith@alliedtelesis.co.nz>
MFC after: 3 days
PR:	254311

(cherry picked from commit 0ab5902e8a)
2021-03-18 16:40:23 +00:00
Scott Long
b65d2c31b1 base: remove if_wg(4) and associated utilities, manpage
After length decisions, we've decided that the if_wg(4) driver and
   related work is not yet ready to live in the tree.  This driver has
   larger security implications than many, and thus will be held to
   more scrutiny than other drivers.

Requested by: secteam
Approved by: re
2021-03-18 07:07:56 +00:00
Mark Johnston
10e8aac9bb ath_hal: Stop printing messages during boot
ath_hal is compiled into the kernel by default and so always prints a
message to dmesg even when the system has no ath hardware.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0e72eb4602)
2021-03-15 11:39:08 -04:00
Mark Johnston
d18a65a535 wg: Style
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d8cebef50e)
2021-03-15 11:38:15 -04:00
Mitchell Horne
17d301f7b5 ns8250: don't drop IER_TXRDY on bus_grab/ungrab
It has been observed that some systems are often unable to resume from
ddb after entering with debug.kdb.enter=1. Checking the status further
shows the terminal is blocked waiting in tty_drain(), but it never makes
progress in clearing the output queue, because sc->sc_txbusy is high.

I noticed that when entering polling mode for the debugger, IER_TXRDY is
set in the failure case. Since this bit is never tracked by the softc,
it will not be restored by ns8250_bus_ungrab(). This creates a race in
which a TX interrupt can be lost, creating the hang described above.
Ensuring that this bit is restored is enough to prevent this, and resume
from ddb as expected.

The solution is to track this bit in the sc->ier field, for the same
lifetime that TX interrupts are enabled.

PR:		223917, 240122
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7e7f7beee7)
2021-03-15 11:22:17 -03:00
Alexander Motin
aae8e02dfc Move ic_check_send_space clear to the actual check.
It closes tiny race when the flag could be set between being cleared
and the space is checked, that would create us some more work.  The
flag setting is protected by both locks, so we can clear it in either
place, but in between both locks are dropped.

MFC after:	1 week

(cherry picked from commit afc3e54eee)
2021-03-14 22:36:21 -04:00
Alexander Motin
8b0101da80 Restore condition removed in df3747c660.
I think it allowed to avoid some TX thread wakeups while the socket
buffer is full.  But add there another options if ic_check_send_space
is set, which means socket just reported that new space appeared, so
it may have sense to pull more data from ic_to_send for better TX
coalescing.

MFC after:	1 week

(cherry picked from commit aff9b9ee89)
2021-03-14 22:36:13 -04:00
Alexander Motin
2f77e2810a Replace STAILQ_SWAP() with simpler STAILQ_CONCAT().
Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only
because STAILQ_SWAP() fixed corrupted stqh_last.

MFC after:	1 week

(cherry picked from commit df3747c660)
2021-03-14 22:36:04 -04:00
Alexander Motin
fb419e0ffb Fix initiator panic after 6895f89fe5.
There are sessions without socket that are not disconnecting yet.

MFC after:	3 weeks

(cherry picked from commit 06e9c71099)
2021-03-14 22:35:47 -04:00
Alexander Motin
6b409a8b32 Optimize TX coalescing by keeping pointer to last mbuf.
Before m_cat() each time traversed through all the coalesced chain.

MFC after:	1 week

(cherry picked from commit b85a67f54a)
2021-03-14 22:35:37 -04:00
Alexander Motin
31d41a6a9b Coalesce socket reads in software iSCSI.
Instead of 2-4 socket reads per PDU this can do as low as one read
per megabyte, dramatically reducing TCP overhead and lock contention.

With this on iSCSI target I can write more than 4GB/s through a
single connection.

MFC after:	1 month

(cherry picked from commit 6895f89fe5)
2021-03-14 22:34:28 -04:00
Alexander Motin
a4bea2f2a6 Refactor CTL datamove KPI.
- Make frontends call unified CTL core method ctl_datamove_done()
to report move completion.  It allows to reduce code duplication
in differerent backends by accounting DMA time in common code.
 - Add to ctl_datamove_done() and be_move_done() callback samethr
argument, reporting whether the callback is called in the same
context as ctl_datamove().  It allows for some cases like iSCSI
write with immediate data or camsim frontend write save one context
switch, since we know that the context is sleepable.
 - Remove data_move_done() methods from struct ctl_backend_driver,
unused since forever.

MFC after:	 1 month

(cherry picked from commit 2c7dc6bae9)
2021-03-14 22:34:08 -04:00
Mark Johnston
2b0aa5833c netmap: Stop printing a line to the dmesg in netmap_init()
netmap is compiled into the kernel by default so initialization was
always reported, and netmap uses a formatting convention not used in the
rest of the kernel.

Reviewed by:	vmaffione
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29099

(cherry picked from commit fef8450971)
2021-03-12 12:20:59 -05:00
Mark Johnston
47495bf648 wg: Avoid leaking mbufs when the input handshake queue is full
Reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29011

(cherry picked from commit a11009dccb)
2021-03-11 10:53:12 -05:00
Eric Joyner
1da549169d ice(4): Update to version 0.28.1-k
This updates the driver to align with the version included in
the "Intel Ethernet Adapter Complete Driver Pack", version 25.6.

There are no major functional changes; this mostly contains
bug fixes and changes to prepare for new features. This version
of the driver uses the previously committed ice_ddp package
1.3.19.0.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D28640

(cherry picked from commit d08b8680e1)
2021-03-09 14:35:54 -08:00
Alfredo Dal'Ava Junior
c80a1c1072 mpr: big-endian support
This fixes mpr driver on big-endian devices.
Tested on powerpc64 and powerpc64le targets using a SAS9300-8i card
(LSISAS3008 pci vendor=0x1000 device=0x0097)

Submitted by:	Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by:	luporl, alfredo, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by email)
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25785

(cherry picked from commit 71900a794d)
2021-03-09 21:09:24 -03:00
Jessica Clarke
e3394851b5 if_vtbe: Add missing includes to fix build
PR:		254137
Reported by:	Mina Galić <me@igalic.co>
Fixes:		f8bc74e2f4 ("tap: add support for virtio-net offloads")

(cherry picked from commit f2f8405cf6)
2021-03-08 21:04:40 +00:00
Xin LI
e298c1c3c2 arcmsr(4): Fixed no action of hot plugging device on type_F adapter.
Many thanks to Areca for continuing to support FreeBSD.

Submitted by:	黃清隆 <ching2048 areca com tw>
MFC after:	3 days

(cherry picked from commit 5842073a9b)
2021-03-05 17:46:04 -08:00