Commit graph

39555 commits

Author SHA1 Message Date
Ed Maste
f6a7ce86fc vt: fix double-click word selection for first/last word on line
Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line.  Similarly, when double-clicking on the last word
on a line we would select from the beginning of the word to the cursor
position rather than the end of the line.

This is because we searched backward or forward for a space character to
mark the beginning or end of a word.  Now, use the beginning or end of
the line if we do not find a space.

PR:		261553
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 692bb3f029)
(cherry picked from commit 521dbfd6b1)
2022-02-25 11:22:27 -05:00
Michal Krawczyk
c27f502ed8 ena: update ENA version to v2.5.0
Some of the changes in this release:
- IPv6 L4 checksum offload fixes.
- Optimization of the Tx req_id validation.
- Timer service adjustments.
- NUMA awareness for the kernel RSS mode.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 8a5b4859c7)
2022-02-24 13:53:44 +01:00
Dawid Gorecki
8875a5872c ena: do not call reset if device is unresponsive
If the device becomes unresponsive, the driver will not be able to
finish the reset process correctly. Timeout during version validation
indicates that the device is currently not responding. In that case
do not perform the reset and instead reschedule timer service. Because
of that the driver will continue trying to reset the device until it
succeeds or is detached.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit d10ec3ad77)
2022-02-24 13:53:44 +01:00
Dawid Gorecki
ed4368c216 ena: start timer service on attach
The timer service was started when the interface was brought up and it
was stopped when it was brought down. Since ena_up requires the device
to be responsive, triggering the reset would become impossible if the
device became unresponsive with the interface down.

Since most of the functions in timer service already perform the check
to see if the device is running, this only requires starting the callout
in attach and stopping it when bringing the interface up or down to
avoid race between different admin queue calls.

Since callout functions for timer service are always called with the
same arguments, replace callout_{init,reset,drain} calls with
ENA_TIMER_{INIT,RESET,DRAIN} macros.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 78554d0c70)
2022-02-24 13:53:44 +01:00
Artur Rojek
dbc92a6d9d ena: rework tx req_id validation logic
Since `ena_com_tx_comp_req_id_get` already checks for `req_id` validity,
the logic was exiting early, never giving `validate_tx_req_id` a chance
to trigger device reset.
Rewrite the logic so that device reset is called based on return value
of `ena_com_tx_comp_req_id_get` instead.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit b168d0c850)
2022-02-24 13:53:43 +01:00
Dawid Gorecki
eff45c1e66 ena: properly handle IPv6 L4 checksum offload
ena_tx_csum function did not check if IPv6 checksum offload was
requested it only checked checksum offloading flags for IPv4 packets.
Because of that, when encountering CSUM_IP6_* flags, the function simply
returned without actually setting checksum offloading in ena_ctx.
Check CUSM_IP6_* flags to enable IPv6 checksum offload.

Additionally, only IPv4 header was being parsed regardless of EtherType
field, because of that, value of L4 protocol read when actually trying
to send IPv6 packets was wrong. Use ip6_lasthdr function to get length
of all IPv6 headers and payload protocol.

Set the DF flag to 1 in order to allow the device to offload the IPv6
checksum calculation and achieve optimal performance.

Add CSUM6_OFFLOAD and CSUM_OFFLOAD definitions into ena_datapath.h.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 2bbef9d95d)
2022-02-24 13:53:43 +01:00
Marcin Wojtas
5922f5218f ena: merge ena-com v2.5.0 upgrade
Merge commit '2530eb1fa01bf28fbcfcdda58bd41e055dcb2e4a'

Adjust the driver to the upgraded ena-com part twofold:

First update is related to the driver's NUMA awareness.

Allocate I/O queue memory in NUMA domain local to the CPU bound to the
given queue, improving data access time. Since this can result in
performance hit for unaware users, this is done only when RSS
option is enabled, for other cases the driver relies on kernel to
allocate memory by itself.

Information about first CPU bound is saved in adapter structure, so
the binding persists after bringing the interface down and up again.

If there are more buckets than interface queues, the driver will try to
bind different interfaces to different CPUs using round-robin algorithm
(but it will not bind queues to CPUs which do not have any RSS buckets
associated with them). This is done to better utilize hardware
resources by spreading the load.

Add (read-only) per-queue sysctls in order to provide the following
information:
- queueN.domain: NUMA domain associated with the queue
- queueN.cpu:    CPU affinity of the queue

The second change is for the CSUM_OFFLOAD constant, as ENA platform
file has removed its definition. To align to that change, it has been
added to the ena_datapath.h file.

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit eb4c4f4a2e)
2022-02-24 13:53:43 +01:00
Hans Petter Selasky
b7ea0ff6a2 mlx5e: Make TLS tag zones unmanaged
These zones are cache zones used to allocate TLS offload contexts from
firmware.  Releasing items from the cache is a sleepable operation due
to the need to await a response from the firmware command freeing the
tag, so items cannot be reclaimed from the zone in non-sleepable
contexts.  Since the cache size is limited by firmware limits, avoid
this by setting UMA_ZONE_UNMANAGED to avoid reclamation by uma_timeout()
and the low memory handler.

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

(cherry picked from commit 235ed6a486)
2022-02-24 10:59:38 +01:00
Hans Petter Selasky
adcd93a416 mlx5en: Use a UMA cache zone for managing TLS send tags
Instead of allocating directly from a normal zone. This way
import and release are guaranteed to process all allocated and then
deallocated items. Also, the release occurs in a sleepable context when
caller of uma_zfree() or uma_zdestroy() can sleep itself.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 0f7b6e11c0)
2022-02-24 10:59:19 +01:00
Hans Petter Selasky
353c1239fb mlx5en: Fix TLS worker thread race.
Create a dedicated free state, in case the taskqueue worker is still pending,
to avoid re-activation of a freed send tag.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 015f22f5d0)
2022-02-24 10:59:14 +01:00
Hans Petter Selasky
7b3bc182d0 mlx5en: Improve RX- and TX- TLS refcounting.
Use the send tag refcounting mechanism to refcount the RX- and TX- TLS
send tags. Then it is no longer needed to wait for refcounts to reach
zero when destroying RX- and TX- TLS send tags as a result of pending
data or WQE commands.

This also ensures that when TX-TLS and rate limiting is used at the same
time, the underlying SQ is not prematurely destroyed.

Sponsored by:	NVIDIA Networking

(cherry picked from commit ebdb700649)
2022-02-24 10:59:07 +01:00
Hans Petter Selasky
bafce48d55 mlx5en: Add missing refcount decrement on link-down.
Sponsored by:	NVIDIA Networking

(cherry picked from commit d2a788a522)
2022-02-24 10:59:01 +01:00
Hans Petter Selasky
4b5dd427cb mlx5en: Improve CQE error debugging.
Sponsored by:	NVIDIA Networking

(cherry picked from commit bc531a1faa)
2022-02-24 10:58:54 +01:00
Hans Petter Selasky
15c4f94534 Add more USB host controller PCI ID's.
Submitted by:	Gary Jennejohn <gljennjohn@gmail.com>
Sponsored by:	NVIDIA Networking

(cherry picked from commit e85af89fa7)
2022-02-24 10:58:44 +01:00
Hans Petter Selasky
ce60a1fe6a xhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF
(cherry picked from commit 4b4cce02ac)
2022-02-24 10:58:39 +01:00
Hans Petter Selasky
ed5fb5ccdb usb(4): Belatedly add a PCI device ID for AMD Bolton chipset
(cherry picked from commit 379797d4b4)
2022-02-24 10:58:32 +01:00
Hans Petter Selasky
d9addaa0ba Add new USB host controller PCI ID's.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by:	NVIDIA Networking

(cherry picked from commit 42cf33dd1a)
2022-02-24 10:58:16 +01:00
Vladimir Kondratyev
77ec8dd61c iichid(4): Perform acknowledgement of I2C device interrupt after RESET command
in sampling mode to workaround firmware bug.

This fixes reboot or poweroff on frame.work laptops after first touch.

(cherry picked from commit c508b0818b)
2022-02-24 04:05:33 +03:00
Aleksandr Fedorov
009a56b2e4 if_vtnet(4): Restore the ability to set promisc mode.
PR:	254343, 255054
Reviewed by:	vmaffione (mentor), donner
Approved by:	vmaffione (mentor), donner
MFC after:	2 weeks
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D30639

(cherry picked from commit fc035df8af)
2022-02-23 14:08:24 +03:00
Aleksandr Fedorov
f40063d329 md(4): Add dummy support of the BIO_FLUSH command for malloc and swap
backend.

PR:	260200
Reported by:	editor@callfortesting.org
Reviewed by:	vmaffione (mentor), markj
Approved by:	vmaffione (mentor), markj
Differential Revision:	https://reviews.freebsd.org/D34260

(cherry picked from commit cb28dfb27d)
2022-02-23 13:57:44 +03:00
Henri Hennebert
3e5cd5dfd4 rtsx: Add RTS5260 support and replace bootverbose with sysctl.
Tested by:	mav
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D34246

(cherry picked from commit 577130e56e)
2022-02-22 19:39:53 -05:00
Henri Hennebert
785a5b8d91 rtsx: Update driver version number to 2.1c
Differential Revision:	https://reviews.freebsd.org/D32154

(cherry picked from commit ad494d3b2d)
2022-02-22 19:39:53 -05:00
Henri Hennebert
23566767c3 rtsx: Do not display pci_read_config() errors during rtsx_init()
Differential Revision:	https://reviews.freebsd.org/D32154

(cherry picked from commit 1e800a5934)
2022-02-22 19:39:53 -05:00
Henri Hennebert
a1b4c74dad rtsx: Add CTLFLAG_STATS flag for read and write counters
Differential Revision:	https://reviews.freebsd.org/D32154

(cherry picked from commit ec1f122b56)
2022-02-22 19:39:36 -05:00
Henri Hennebert
4efab785f6 rtsx: Prefer __FreeBSD_version over __FreeBSD__
No functional change.

Differential Revision:	https://reviews.freebsd.org/D32154

(cherry picked from commit 7e5933b333)
2022-02-22 19:39:29 -05:00
Henri Hennebert
545def055b rtsx: Convert driver to use the mmc_sim interface
A lot more generic cam related things were done in mmc_sim so this
simplifies the driver a lot.

Differential Revision:	https://reviews.freebsd.org/D32154
Reviewed by:		imp

(cherry picked from commit 8e9740b62e)
2022-02-22 19:39:19 -05:00
Michael Tuexen
257cd2f8c3 if_oce: fix epoch handling
Thanks to gallatin@ for suggesting the patch.

PR:			260330
Reported by:		Vincent Milum Jr.
Reviewed by:		gallatin, glebius
Tested by:		Vincent Milum Jr.
Differential Revision:	https://reviews.freebsd.org/D33395

(cherry picked from commit e363f832cf)
2022-02-23 00:52:15 +01:00
Andrew Turner
24a205e328 Fix undefined behaviour in the USB controllers
The USB controller drivers assume they can cast a NULL pointer to a
struct and find the address of a member. KUBSan complains about this so
replace with the __offsetof and __containerof macros that use either a
builtin function where available, or the same NULL pointer on older
compilers without the builtin.

Reviewers: hselasky

Subscribers: imp

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

(cherry picked from commit a3cea15680)
2022-02-22 16:23:07 +00:00
Dimitry Andric
be8e341777 bwi: Fix clang 14 warning about possible unaligned access
On architectures with strict alignment requirements (e.g. arm), clang 14
warns about a packed struct which encloses a non-packed union:

In file included from sys/dev/bwi/bwimac.c:79:
sys/dev/bwi/if_bwivar.h:308:7: error: field iv_val within 'struct bwi_fw_iv' is less aligned than 'union (unnamed union at sys/dev/bwi/if_bwivar.h:305:2)' and is usually due to 'struct bwi_fw_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
	}			iv_val;
				^

It appears to help if you also add __packed to the inner union (i.e.
iv_val). No change to the layout is intended.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34196

(cherry picked from commit 09d0a0fbe8)
2022-02-16 21:24:53 +01:00
Alexander Motin
2dfb21cdd4 snd_hda: Add some ATI HDMI codec IDs.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week

(cherry picked from commit 98d59d2e0d)
2022-02-15 19:46:12 -05:00
Stefan Grundmann
5fed793a50 vt: fix splash_cpu logos use of vd_drawrect
In the (extremely unlikely) case of vd->vd_height ==
vt_logo_sprite_height the vd_drawrect code would write outside of
frame-buffer memory.

MFC after:	1 week
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D34220

(cherry picked from commit 06296f77c5)
2022-02-15 19:39:34 -05:00
Ram Kishore Vegesna
2748f68db9 ocs_fc: Fix a possible Null pointer dereference
Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()

PR: 261453
Reported by: lwhsu

MFC after: 3 days

(cherry picked from commit 7bf31432fd)
2022-02-14 12:42:55 +05:30
Andrew Turner
9ddf1ab1b9 Fix the spelling of '*/' in the vnic driver
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c007408c24)
2022-02-13 20:09:34 +01:00
Alexander Motin
376fd49ae3 APEI: Make sure event data fit into the buffer.
There seem to be systems returning some garbage here.  I still don't
know why, but at least I hope this check fix indefinite printf loop.

MFC after:	2 weeks

(cherry picked from commit 3b248a2113)
2022-02-13 13:26:55 -05:00
Ed Maste
a60685ffbc vnic: add TODO list
- non-promisc mode
- multicast filter support

Also drop ARM64TODO comments; this is an issue with this specific
driver, not a general arm64 issue.

PR:		223575
PR:		223573

(cherry picked from commit 941650aae9)
(cherry picked from commit 29e9b487c1)
2022-02-12 14:09:52 -05:00
Kyle Evans
371633ece3 Annotate geom_md with MODULE_VERSION
This was missed in 74d6c131cb where other geom modules were annotated
with MODULE_VERSION.  Again, the problem is the same: we can't detect
that geom_md is loaded into the kernel without it.

This was noticed in release builds on the cluster; mdconfig attempts to
load geom_md because it can't detect it in the kernel, but the cluster
config includes md(4) and does not build the kmod.  This problem would
have been masked on hosts with the kmod built, as the kmod attempts to
register the g_md module and fails.  With this commit, mdconfig would
not even try to load it again.

(cherry picked from commit b9c92d631c)
2022-02-12 10:46:45 -06:00
Hans Petter Selasky
16635c7b21 mlx5en: Make sure the NIC IP addresses are written to firmware on link up.
Fixes e059c120b4 .

PR:		261746
Sponsored by:	NVIDIA Networking

(cherry picked from commit 04f407a3e5)
2022-02-11 11:15:00 +01:00
Hans Petter Selasky
a8727a0b32 rtwn(4): Add new USB ID.
Submitted by:	Wensi <supdrewin@outlook.com>
PR:		261098
Sponsored by:	NVIDIA Networking

(cherry picked from commit 75d20a5e38)
2022-02-10 16:11:07 +01:00
Hans Petter Selasky
3752e6771b uchcom(4): Add new USB ID.
Submitted by:	darius@dons.net.au
PR:		260783
Sponsored by:	NVIDIA Networking

(cherry picked from commit 34bedcee3c)
2022-02-10 16:11:01 +01:00
Hans Petter Selasky
08a56bb43c rtwn(4): Add new USB ID.
Submitted by:	arved@
PR:		260952
Sponsored by:	NVIDIA Networking

(cherry picked from commit 2891a28052)
2022-02-10 16:10:57 +01:00
Hans Petter Selasky
966c36c1b6 usb(4): Ignore port resume failures.
If port resume fails, likely the USB device is detached. Ignore such errors,
because else the USB stack might try forever trying to resume the device,
before it will proceed detaching it.

Sponsored by:	NVIDIA Networking

(cherry picked from commit a88e1a04df)
2022-02-10 16:10:53 +01:00
Mark Johnston
45711ee38a filemon: Reject FILEMON_SET_FD commands when the fd is a kqueue
When FILEMON_SET_FD is used, the filemon handle effectively wraps the
passed file.  In particular, the handle may be inherited by a child
process, or transferred over a unix domain socket, so we must verify
that the backing file permits this.

Reported by:	syzbot+36e6be9e02735fe66ca8@syzkaller.appspotmail.com
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b84ed4e7f6)
2022-02-10 08:46:24 -05:00
Ed Maste
51f69c0d53 mgb: remove set but not used variables
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c0aa5f6a32)
2022-02-09 16:22:20 -05:00
Ed Maste
ad3e327247 ce: remove long-obsolete FreeBSD version compatibility
Mechanical change via unifdef.

(cherry picked from commit f9839a42ee)
(cherry picked from commit f48c35fa1e)
2022-02-09 12:39:41 -05:00
Ed Maste
559fb03f96 rsu: add KASSERT to document maximum mbuf size in rsu_tx_start
PR:		254479
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 453d8a7ee2)
2022-02-09 12:28:42 -05:00
Ed Maste
43f704843b hwpmc: drop 0x before %p printf format string
%p already includes the 0x.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2075d00fab)
2022-02-08 15:00:55 -05:00
Ed Maste
94e6d14488 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9feff969a0)
2022-02-08 15:00:55 -05:00
Hans Petter Selasky
7e5b40d818 mlx5core: Set driver version into firmware.
If the driver_version capability bit is enabled, send the driver
version to firmware after the init HCA command, for display purposes.

Example of driver version: "FreeBSD,mlx5_core,14.0.0,3.x-xxx"

Linux commits:
012e50e109fd27ff989492ad74c50ca7ab21e6a1

Sponsored by:	NVIDIA Networking

(cherry picked from commit e6d7ac1d03)
2022-02-08 16:08:54 +01:00
Hans Petter Selasky
5ddb1a584d mlx5en: Implement one RQT object per channel.
These objects will eventually be used to switch TLS RX traffic.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 8e332232a5)
2022-02-08 16:08:54 +01:00
Hans Petter Selasky
823bcb3a13 mlx5: Add raw ethernet local loopback support.
Currently, unicast/multicast loopback raw ethernet (non-RDMA) packets
are sent back to the vport.  A unicast loopback packet is the packet
with destination MAC address the same as the source MAC address.  For
multicast, the destination MAC address is in the vport's multicast
filter list.

Moreover, the local loopback is not needed if there is one or none
user space context.

After this patch, the raw ethernet unicast and multicast local
loopback are disabled by default. When there is more than one user
space context, the local loopback is enabled.

Note that when local loopback is disabled, raw ethernet packets are
not looped back to the vport and are forwarded to the next routing
level (eswitch, or multihost switch, or out to the wire depending on
the configuration).

Linux commits:
c85023e153e3824661d07307138fdeff41f6d86a
8978cc921fc7fad3f4d6f91f1da01352aeeeff25

Sponsored by:	NVIDIA Networking

(cherry picked from commit ea00d7e8ca)
2022-02-08 16:08:54 +01:00