Commit Graph

38676 Commits

Author SHA1 Message Date
Lutz Donnerhacke
fa6662b368 ixl: Permit 802.1ad frames to pass though the chip
This patch is a quick hack to change the internal Ethertype used
within the chip.  All frames with this type are dropped silently.
This patch allows you to overwrite the factory default 0x88a8, which
is used by IEEE 802.1ad VLAN stacking.

Reviewed by:	kp, philip, brueffer
Approved by:	kp (mentor)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24179
2021-01-19 16:01:09 +01:00
Andriy Gapon
2c98edd6d6 htu21: driver for HTU21D I2C temperature and humidity sensor
MFC after:	2 weeks
Relnotes:	perhaps
2021-01-19 15:08:51 +02:00
Bryan Venteicher
e6cc42f181 virtio: Handle possible failure of virtio_finalize_features()
Try to standardize how drivers negotiate feature and the
function names

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27930
2021-01-19 04:55:26 +00:00
Bryan Venteicher
2bfab35774 if_vtnet: Add counter for received host LRO
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27928
2021-01-19 04:55:26 +00:00
Bryan Venteicher
475a60aec7 if_vtnet: Misc Tx path cleanup
- Add and fix a few error path counters
  - Improve sysctl descriptions
  - Use flags consistently to determine IPv4 vs IPv6

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27926
2021-01-19 04:55:26 +00:00
Bryan Venteicher
6b53aeed91 if_vtnet: Set lro_nsegs for host LRO packets
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27933
2021-01-19 04:55:25 +00:00
Bryan Venteicher
74cd316a09 if_vtnet: Resort softc fields
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27925
2021-01-19 04:55:25 +00:00
Bryan Venteicher
33b5433fd7 if_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27923
2021-01-19 04:55:25 +00:00
Bryan Venteicher
4f18e23f84 if_vtnet: Schedule Rx task if pending items when enabling interrupt
Prior to V1, the driver would enable interrupts and then notify the
host that DRIVER_OK. Since for V1, DRIVER_OK needs to be set before
notifying the virtqueues, there may be items in the queues waiting
to be processed by the time interrupts are enabled.

This fixes a bug where the Rx queue would appear stuck, only being
usable after an interface down/up cycle.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27922
2021-01-19 04:55:25 +00:00
Bryan Venteicher
c3187190c7 if_vtnet: Disable F_MTU feature if MTU is invalid
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27931
2021-01-19 04:55:25 +00:00
Bryan Venteicher
bd8809df20 if_vtnet: Limit allocations of unused virtqueues
For multiqueue, we may use fewer than the provided maximum number of
queues. Try to limit allocations of the unused queues: no interrupts,
no indirect descriptors, and no taskqueues.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27921
2021-01-19 04:55:25 +00:00
Bryan Venteicher
b470419ea5 if_vtnet: Rework 4be723f63 max multiqueue pairs check
Verify the max_virtqueue_pairs is within the range allowed by
the spec.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27920
2021-01-19 04:55:25 +00:00
Bryan Venteicher
42343a6316 if_vtnet: Add support for software LRO
This useful when running on hosts that support checksum offloading
but not the GUEST_TSO (LRO) feature. Or potentially, some GRO-like
support when doing forwarding.

Only enable SW LRO when the host LRO is not available since both
tends to be harmful, and difficult to enable/disable selectively
with only a single IFCAP_LRO flag.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27919
2021-01-19 04:55:25 +00:00
Bryan Venteicher
177761e4c4 if_vtnet: Set the interface max TSO values
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27917
2021-01-19 04:55:25 +00:00
Bryan Venteicher
e36a6b1b1f if_vtnet: Add support for CTRL_GUEST_OFFLOADS feature
This allows the Rx checksum and LRO to be modified without a full
reinit of the device.

Remove IFCAP_RXCSUM_IPV6 from the interface capabilities since in
VirtIO Rx checksums are just enabled or disabled for all protocols.

Properly update IFCAP_LRO if LRO is becomes disabled when Rx
checksums are disabled.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27916
2021-01-19 04:55:25 +00:00
Bryan Venteicher
dc9029d863 if_vtnet: Move ioctl handlers into separate functions
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27914 https://reviews.freebsd.org/D27915
2021-01-19 04:55:25 +00:00
Bryan Venteicher
44559b26af if_vtnet: Cleanup the reinit process
In modern VirtIO, the virtqueues cannot be notified before setting
DRIVER_OK status.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27932
2021-01-19 04:55:25 +00:00
Bryan Venteicher
32e0493c92 if_vtnet: Cleanup the interface setup methods
Defer the ether_ifattach until the interface capabilities
are configured

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27913
2021-01-19 04:55:25 +00:00
Bryan Venteicher
2520cd3821 if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27912
2021-01-19 04:55:24 +00:00
Bryan Venteicher
baa5234fbe if_vtnet: Move the Tx interrupt threshold into the Txq structure
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27911
2021-01-19 04:55:24 +00:00
Bryan Venteicher
05041794d0 if_vtnet: Defer updating generated MAC address until attached
This improves spec compliance because the driver is not suppose
to notify the device prior to setting the DRIVER_OK status, which
could happen with the VIRTIO_NET_F_CTRL_MAC_ADDR.

The VIRTIO_NET_F_MAC feature should always be negotiated so would
be a rare situation.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27910
2021-01-19 04:55:24 +00:00
Bryan Venteicher
25dbc30ef5 if_vtnet: Remove at attach PROMISC handling
This may have been required in an early, early, early version of the
specification but I cannot find any reference to it, and a promiscuous
default seems very odd so remove this code.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27909
2021-01-19 04:55:24 +00:00
Bryan Venteicher
6a73339365 if_vtnet: Support VIRTIO_NET_F_SPEED_DUPLEX
This features lets the guest driver know the speed and duplex of
the "link". Instead of trying to support many media types based
on the possible/likely speeds/duplexes, only use the speed to
set the interface baudrate.

Cleanup ifmedia code to match other drivers.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27908
2021-01-19 04:55:24 +00:00
Bryan Venteicher
aabdf5b6e8 if_vtnet: Support VIRTIO_NET_F_MTU
This feature lets the guest driver know the maximum MTU size
supported by the host device. If set, use this to limit the
acceptable MTUs, and improve how the receive mbuf cluster size
then is selected.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27907
2021-01-19 04:55:24 +00:00
Bryan Venteicher
fa7ca1e332 if_vtnet: Rx path cleanup
- Fix the NEEDS_CSUM and DATA_VALID checksum flags. The NEEDS_CSUM
    checksum is incomplete (partial) so offer a fallback for the driver
    to calculate the checksum. Simplify DATA_VALID because we know
    the host has validated the checksum.

  - Default 4K mbuf clusters for mergeable buffers. May need to
    scale this down to 2K clusters in certain configurations such
    many queue pairs, big queues (like 4096 in GCP), and low memory.

  - Use the MTU when calculated the receive mbuf cluster size
    when not doing TSO/LRO. This will need more adjustment once
    the MTU feature is supported.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27906
2021-01-19 04:55:24 +00:00
Bryan Venteicher
149ab110dd virtio_blk: Use DISKFLAG_WRITE_PROTECT for RO disks
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27905
2021-01-19 04:55:24 +00:00
Bryan Venteicher
5e22081177 if_vtnet: Add initial modern (V1) support
Very basic support to get packets flowing on modern QEMU but still
several conformance issues remain that will be addressed in later
commits.

First of many passes at cleaning up various accumulated cruft

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27904
2021-01-19 04:55:24 +00:00
Bryan Venteicher
15be49535d virtio_scsi: Add modern (V1) support
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27903
2021-01-19 04:55:24 +00:00
Bryan Venteicher
d7f979bed0 virtio_blk: Add modern (V1) support
Rework the header file changes from 2cc8a52 to use our
canonical upstream, Linux.

geom_disk already checks DISKFLAG_CANDELETE for BIO_DELETE
so remove an unnecessary check.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27902
2021-01-19 04:55:24 +00:00
Bryan Venteicher
edf7c8ddce virtio_console: Add modern (V1) support
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27901
2021-01-19 04:55:24 +00:00
Bryan Venteicher
f7f9c266e4 virtio_balloon: Add modern (V1) support
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27900
2021-01-19 04:55:23 +00:00
Bryan Venteicher
d2536a25cc virtio_random: Add modern (V1) support
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27899
2021-01-19 04:55:23 +00:00
Bryan Venteicher
703f17d60f virtio_pci: Add sysctl to show current features
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27898
2021-01-19 04:55:23 +00:00
Bryan Venteicher
fbe0c4f4c7 virtio: Add modern (v1) virtqueue support
This only supports the legacy virtqueue format that is now called
"Split Virtqueues". Support for the new "Packed Virtqueues" described
in v1.1 is left for a later date.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27857
2021-01-19 04:55:23 +00:00
Bryan Venteicher
9da9560c4d virtio: Add VirtIO PCI modern (V1) support
Use the existing legacy PCI driver as the basis for shared code
between the legacy and modern PCI drivers. The existing virtio_pci
kernel module will contain both the legacy and modern drivers.

Changes to the virtqueue and each device driver (network, block, etc)
for V1 support come in later commits.

Update the MMIO driver to reflect the VirtIO bus method changes, but
the modern compliance can be improved on later.

Note that the modern PCI driver requires bus_map_resource() to be
implemented, which is not the case on all archs.

The hw.virtio.pci.transitional tunable default value is zero so
transitional devices will continue to be driven via the legacy
driver.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27856
2021-01-19 04:55:23 +00:00
Bryan Venteicher
1cd1ed3f5d Revert: virtio: Support non-legacy network device and queue
And subsequent fix 576b099a.

By adding the mergable header to the vtnet_rx_header structure, the size
was increased by 2 bytes, breaking the alignment of this structure as
described the in preceding comments.

Furthermore, the mergable header does not belong the structure. With the
mergable feature, the header is placed in line with the data, so there is
no need for a separate segment, and misleading to follow the mergable
header with any padding.

The V1 header is effectively identical to mergable header, and the driver
has long supported the mergable feature. Revert this so the later changes
that add V1 support can show how V1 is derived from the existing mergable
buffers support, and to facilitate a later MFC.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27855
2021-01-19 04:55:23 +00:00
Mark Johnston
a45d905616 ppbus: Fix the direction of the PPISEPPA ioctl
PR:		252711
Submitted by:	Eugene <merfi@nearly.ru>
2021-01-18 19:44:42 -05:00
Mark Johnston
5bdb8b273a safexcel: Maintain per-session context records
The context record contains key material precomputed by the driver at
session creation time.  Rather than storing various components of the
context record in each session, go a bit further and store the full
context record image so that safexcel_process() can simply copy the
image into each request submitted to the hardware.  This simplifies the
data path and eliminates a bunch of unnecessary conditional logic that
was getting executed for each request.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-18 17:07:56 -05:00
Mark Johnston
1a6ffed5d7 safexcel: Simplify request allocation
Rather than preallocating a set of requests and moving them between
queues during state transitions, maintain a shadow of the command
descriptor ring to track the driver context of each request.  This is
simpler and requires less synchronization between safexcel_process() and
the ring interrupt handler.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-18 17:07:56 -05:00
Mark Johnston
b7e27af36b safexcel: Handle command/result descriptor exhaustion gracefully
Rather than returning a hard error in this case, return ERESTART so that
upper layers get a chance to retry the request (or drop it, depending on
the desired policy).

This case is hard to hit due to the somewhat low bound on queued
requests, but that will no longer be true after an upcoming change.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-18 17:07:56 -05:00
Mark Johnston
0371c3faaa safexcel: Add counters for some resource exhaustion conditions
This is useful when analyzing performance problems.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-18 17:07:55 -05:00
Mark Johnston
e934d455ba safexcel: Dispatch requests to the current CPU's ring
This gives better performance in some tests than the previous policy of
statically binding each session to a ring.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-18 17:07:55 -05:00
Marius Strobl
daad26e5fc openpromio(4): remove obsolete pseudo device driver
It's unused since 58aa35d429 and r357455
respectively and should have gone along with these.
2021-01-16 23:53:13 +01:00
Marius Strobl
d65427ad58 sym(4): Remove remainder of SYM_SETUP_LP_PROBE_MAP support
Missed in 221ac8f4cd and r339575
respectively.
2021-01-16 23:53:12 +01:00
Vincenzo Maffione
2968dde3de axgbe: driver changes for netmap support
AMD 10GbE hardware is designed to have two buffers per receive descriptor to
support split header feature. For this purpose, the driver was designed to use
2 iflib freelists per receive queue. So, that buffers from 2 freelists are used
to refill an entry in the receive descriptor. The current design holds good
with regular data traffic.

But, when netmap comes into play, the current design will not fit in. The
current netmap interfaces and netmap implementation in iflib doesn't seem
to accomodate the design of 2 freelists per receive queue. So, exercising
Netmap capability with inbuilt tools like bridge, pkt-gen doesn't work with
the 2 freelists driver design.

So, the driver design is changed to accomodate the current netmap interfaces
and netmap implementation in iflib by using single freelist per receive queue
approach when Netmap capability is exercised without disturbing the current
2 freelists approach.
The dev.ax.sph_enable tunable can be set to 0 to configure the single
free list mode.

Thanks to Stephan Dewt for his Initial set of code changes for the stated
problem.

Submitted by:	rajesh1.kumar_amd.com
Approved by:	vmaffione
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D27797
2021-01-16 08:29:33 +00:00
Emmanuel Vadot
955b980bdf gpiokeys: Use the new device-tree vendor include 2021-01-15 20:07:24 +01:00
Alexander Motin
510cc42126 Unify Intel CODEC naming.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2021-01-15 09:56:15 -05:00
Alexander Motin
006e2b2b82 Add Intel Gemini Lake AHCI ID.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2021-01-15 09:53:35 -05:00
Warner Losh
d1949353e5 uart: Improve console specification parsing
Print warning when we can't parse a console specification (this may
not appear on the console, but will appear in dmesg).

Also, accept key:value and key=value. There's no reason not to
and it makes this more forgiving of mistakes.

Reviewed by: rpokala@
Differential Revision: https://reviews.freebsd.org/D28168
2021-01-14 17:47:04 -07:00
Vladimir Kondratyev
b360682ac9 hid: Add missing input enter/exit epoch pairs.
This was affecting unloading keyboard driver and kdb-related code.
2021-01-14 23:04:47 +03:00