LinuxKPI: pass attrs in more places in dma-mapping.h
Various macros (dma_map_sg_attrs, dma_unmap_sg_attrs,
dma_map_single_attrs, and dma_unmap_single_attrs) currently supress
passing on the attrs argument. Their implementation (even though at
times still marked the argument __unused; we remove that) have long
gained support for handling the argument.
With ofed fixed (5edf24aac1d09), pass the argument through so that
other drivers using these functions may hopefully work just a bit
better as well.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D55391
LinuxKPI: 802.11: improve prep_tx_info
Over time struct ieee80211_prep_tx_info has grown further fields.
One which is becoming mandatory is the subtype (of the mgmt frame).
iwlwifi(mld) has a WARN for it if it does not match, so we now have
to set this for proper operation. In addition we are tyring to improve
the situation of setting/unsetting (prepare_tx/complete_tx) in various
states and cleanup the use of other fields but link_id which we now
leave as a marker for the future everywhere.
The general problem we are facing is that our hook surface in this case
is the state machine but likely would have to be tx/rx mgmt frames but
we would alos have to driver the TX queues from there which is tricky.
The long-term answer is to change net80211.
Further the hardware flag DEAUTH_NEED_MGD_TX_PREP is dead and was
removed again in favour of leting drivers deal with it. iwlwifi(mvm)
likely being the only driver which ever used this.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
LinuxKPI: 802.11: move linuxkpi_ieee80211_handle_wake_tx_queue()
No functional changes. Just moved the function within the file.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
acpi_spmc: fix revision check reading name as integer
In acpi_spmc_get_constraints_spec(), the revision of the device
constraint detail package was mistakenly read from
constraint_obj->Package.Elements[0], which is the device name
(a string), instead of from the detail sub-package's first element.
Move the initialisation of 'detail' before the revision check and
read the revision from detail->Package.Elements[0] as the comment
already states
Approved by: obiwac
Differential Revision: https://reviews.freebsd.org/D55639
Sponsored by: Netflix
libutil: avoid an out-of-bounds read in trimdomain(3)
memchr(3) will happily believe we've passed in a valid object, but
hostsize could easily exceed the bounds of fullhost. Clamp it down to
the string size to be safe and avoid UB. This plugs a potential
overread noted in the compat shim that was just added.
Reviewed by: des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54623
libutil: take a size_t in trimdomain()
INT_MAX is already larger than a reasonable hostname might be, but
size_t makes some of this easier to reason about as we do arithmetic
with it. This would maybe not be worth it if we had to bump the
soversion because of it, but libutil does symbol versioning now so we
can provide a compat shim.
While we're here, fix some inconsistencies in argument names in the
manpage.
Reviewed by: des
Obtained from: https://github.com/apple-oss-distributions/libutil
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54622
diff3: Add SPDX-License-Identifier tag
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55462
LinuxKPI: avoid -Werror=unused-value in sort() from BUILD_BUG_ON_ZERO()
The BUILD_BUG_ON_ZERO() macro returns an (int)0 if it does not fail
at build time. LinuxKPI sort() has it as a guard for an unsupported
argument but ignores the return value.
This leads to gcc complaining:
/usr/src/sys/compat/linuxkpi/common/include/linux/build_bug.h:60:33: error: statement with no effect [-Werror=unused-value]
60 | #define BUILD_BUG_ON_ZERO(x) ((int)sizeof(struct { int:-((x) != 0); }))
| ^
/usr/src/sys/compat/linuxkpi/common/include/linux/sort.h:37:9: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
37 | BUILD_BUG_ON_ZERO(swap); \
| ^~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/dev/rtw89/core.c:2575:9: note: in expansion of macro 'sort'
2575 | sort(drift, RTW89_BCN_TRACK_STAT_NR, sizeof(*drift), cmp_u16, NULL);
Change to BUILD_BUG_ON() for the statement version.
[6 lines not shown]
nda: Assume all cases in ndaasync can sleep
The error recovery is nicer if we can wait for the tiny memory we need
to send the messages when the physpath changes. Since we've moved the
async handler into a sleepable context, we can wait for the allocation
to complete since async events are rare enough and it's not an
indefinite wait.
Also add a comment about the scope of AC_ADVINFO_CHANGED for nvme
drives. We could use it for broadcasting INDENTIFY changes in nvme
drives. However, the underlying mechanisms in NVMe don't really allow
for that (they are more fine-grained). So for namespace changes, for
example, we'll send AC_GETDEV_CHANGED instead of a AC_ADVINFO_CHANGED.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55523
nvme_sim: Fix a cut and paste error
Fix the error message in nvme_sim_ns_removed that was cut and pasted
from nvme_sim_ns_changed to reflect its new home. No functional change.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55522
nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change
When the sector size changes, we assume it's new media. When the
mediasize changes, we'll just resize the disk (we get called for both
events). When neither have changed, don't call either.
Some NVMe drives (but not all) post a async event on page 4 with the
sector size changes via a FORMAT command. We'll notice the new media
right away, rather than the next device open. As a practical effect,
this just means that certain geom operations will see it sooner. Since
most drive interaction goes through open, that will catch those drives
that do not post this event well enough.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55521
nda: Rescan the drive on open
SCSI and ATA drives rescan the drive on opens to catch changes to the
disk. We do it here to so we catch if a drive has been FORMATed or
SANITIZEd with different parameters. We don't use xpt_rescan() since we
don't want to interfere with boot or keep all busses locked (this rescan
won't change the bus, so we don't need the CAM topo lock).
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55520
nda: Move ndasetgeom
Move ndasetgeom up in the file. We'll need it here for future
commits. Also, preserve the UNMAPPED_BIO flag since we can't observe
enough data from this routine to set it directly.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55519
nvme xpt: convert restart to a bool.
restart is a boolean. While I'm here, convert to a bool.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55518