This is defined as a no-op even when INVARIANTS is defined. I admit I
don't know how to implement that in FreeBSD and didn't search
thoroughly.
Reviewed by: bz
Approved by: bz
Differential Revision: https://reviews.freebsd.org/D37911
This defines `ENODEV` used in this header. This fixes a build failure in
the DRM drivers.
Reviewed by: bz
Approved by: bz
Differential Revision: https://reviews.freebsd.org/D37909
Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS().
For the moment this duplicates some parts (as can be seen in the earlier
review I tried to simplify bits but given our implementation this
was easier in the end).
While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only).
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D37527
For the moment and the currently only consumer (mt76) add a simplified
version of the page_frag_cache. We will only accept fragement sizes up
to 1 PAGE_SIZE (KASSERT) and we will always return a full page.
Should we add more consumers or small (or large) objects would become a
problem we can always add a more elaborate version.
Discussed with: markj
Reviewed by: markj (,hselasky commented as well)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37595
Migrate the two functions from the header into the implementation file
in order to have access to more facilities and not to run into possible
allocation/locking/... problems in the future.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks
on lengths (minimal length or skb data length vs. header length).
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Using the previous changes implement cfg80211_get_ies_channel_number()
either based on DSPARMS (or for the future HTINFO).
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Implement cfg80211_find_elem(), ieee80211_bss_get_elem(),
ieee80211_bss_get_ie(), and cfg80211_find_vendor_ie() with the last
one having a short cut always also checking oui_type in the pattern.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Implement cfg80211_{get,put}_bss currently doing malloc/free bits,
so hopefully the drivers get the calls right.
cfg80211_get_bss() sets up a lookup structure which may also take a
result (first hit wins) and calls ieee80211_scan_iterate() comparing
the various values in the iterator funcion. Some of the checks are
partially pointless (as it seems the drivers are not interested in
these parts [ANY] but we keep them for documentation purposes should
futher values arise in the future).
We currently only iterate over the first VAP which will do for now.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
When initializing the sta set the per-band supported legacy rates
as some drivers take the information from there.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
in seqcount_mutex_t case with removal of extraneous mutex lock/unlock
calls and addition of missing critical section.
While here strip one inline wrap layer to reduce code size.
Fixes startup lockup of i915kms after update to drm-kmod v5.12
Reviewed by: hselasky, bz
MFC after: 1week
Differential Revision: https://reviews.freebsd.org/D37699
This unbreak drm-kmod build.
the const is part of Linux API
Unfortunately drm-kmod uses hand-rolled refcount* calls on a kref
object. For now go the easy route of keeping it operational by casting
stuff internally.
The general goal here is to make FreeBSD refcount API use an opaque
type, hence the ongoing removal of hand-rolled accesses.
Reported by: emaste
dma_map_sgtable internally uses the dma_map_sg_attrs helper. The problem is
that dma_map_sg_attrs returns the number of entries mapped, whereas
dma_map_sgtable returns nonzero on failure. This leads to dma_map_sgtable
returning non-zero-but-positive values which tricks other areas of the stack
into thinking nents is a valid pointer.
This checks if nents is valid and returns zero if so, updating the nents field
in sgt. This fixes PRIME render offload with nvidia-drm.
Fixes: 9202c95f47 ("linuxkpi: Add dma_{un,}map_sgtable")
In Linux, this limits the accepted value to -1, 0 and 1.
In FreeBSD, this remains a signed integer with no specific constraints.
This change is a requirement to update our DRM drivers to Linux 5.12.
Differential Revision: https://reviews.freebsd.org/D37364
To achieve that, the header uses the C11 type generic selection keyboard
_Generic() because the macros are supposed to work with seqcount_t
and seqcount_mutex_t.
Differential Revision: https://reviews.freebsd.org/D36965
- add comments for enum values constantly looked up, and another one to
a net80211 equivalent (should possibly re-define those in the future?)
- add another nl80211_sta_info flag
- add enum environment_cap used in cfg80211.h in the future.
MFC after: 3 days
- skb_reset_tail_pointer(): we do not do offsets so do a plain reset
- skb_add_rx_frag(): adjust data_len to keep track of the frag
- based on that implement skb_is_nonlinear() and skb_linearize()
- implement build_skb() and adjust linuxkpi_kfree_skb() and ddb macro.
Sponsored by: The FreeBSD Foundation (partially)
MFC after: 3 days
In preparation for future updates remove the budget argument from the
netif_napi_add() in drivers and update LinuxKPI to reflect that it is
gone and only set it internally. This required changes to the currently
committed wireless drivers based on LinuxKPI (iwlwifi, rtw88, rtw89).
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
While we do not currently use ethtool, add the definitions to avoid
other longer-term maintenance problems with drivers.
Also migrate ETH_GSTRING_LEN into here from if_ether.h as it seems this
is where it belongs.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37214
Add debugfs_create_u8() based on other already present implementations.
Add a read-only implementation for debugfs_create_blob().
Both are needed for iwlwifi debugfs support.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
OKed by: jfree (earlier version)
Differential Revision: https://reviews.freebsd.org/D37090
This is needed for debugfs implementations in drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
OKed by: jfree
Differential Revision: https://reviews.freebsd.org/D37092
Add more MSI related constansts defined to our native defines and
pci_is_enabled(). All are needed for another wireless driver.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37225
Add a memset_startat() macro which sets a pattern from a struct member
to the end of the struct. Needed by a wireless driver.
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37389
On Linux, the `kmalloc()` family of functions returns a special value if
the size of the allocation is zero. This macro verifies if the pointer
is NULL (the allocation failed) or the size is 0 (the allocation was not
performed AFAIU). This special value can be passed to `kfree()`.
On FreeBSD, our `malloc(9)` functions don't return a special value for
0-size allocations. Therefore we can simply compare the result against
NULL.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37367
They are not really used in this header. However they are included in
Linux and at least the DRM drivers unfortunately rely on this namespace
pollution.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37365
This is used by `i915_gem.c` in the i915 DRM driver to get access to
`wbinvd_on_all_cpus()`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36970
I took the implementation from OpenBSD, commit
d55ef580b1748517027c3eabdb715316ca5b1442.
The only difference is the addition of `dma_buf_map_is_equal()`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36963
It simply includes the same header in FreeBSD (which is located
elsewhere).
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36960
In FreeBSD, this is a wrapper on top of `realloc()`.
V2: Check if `n * size` would overflow and return `NULL` if that's the
case. Suggested by hselasky@ and emaste@.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36959
In Linux, this affects how the value is formatted. In FreeBSD, this
remains an unsigned integer.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36958