aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
...
* LinuxKPI: 802.11: bring in some HT codeBjoern A. Zeeb2024-02-195-34/+550
| | | | | | | | | | | | | | | | | | | | Fix defines and structures to use proper types. Bring in basic ni->sta synchronization, some channel width handling, and overload the net80211 functions so that we can talk to driver/firmware to setup parameters. We will likely not need one or two of those but it is good for tracing currently. Cover HT and bits of VHT code in LinuxKPI behind apropriate #ifdef which are currently not enabled (like LKPI_80211_HW_CRYPTO) until confirmed to work. Last, IEEE80211_AMPDU_RX_START made some firmware unhappy. This will allow others to work on it and test as well. Sponsored by: The FreeBSD Foundation (cherry picked from commit 9fb914634eff85b3b36bcbf39c1faf2967b0aa9e)
* LinuxKPI: reduce impact of large MAXCPUBjoern A. Zeeb2024-02-192-9/+99
| | | | | | | | | | | | | | | | | | | Start scaling arrays dynamically instead of using MAXCPU, resulting in extra allocations on startup but reducing the overall memory footprint. For the static single CPU mask we provide two versions to further save memory depending on a low or high CPU count system. The threshold to switch is currently at 128 CPUs on 64bit platforms. More detailed comments on the implementations can be found in the code. If I am not wrong on a MAXCPU=65536 system the memory footprint should roughly go down from 512M to 1.5M for the static single CPU mask. Submitted by: olce (most of this final version) Sponsored by: The FreeBSD Foundation PR: 274316 Differential Revision: https://reviews.freebsd.org/D42345 (cherry picked from commit 488e8a7faca51a71987fbf00cd36cfcd19269db7)
* LinuxKPI: implement memset_after()Bjoern A. Zeeb2024-02-191-0/+8
| | | | | | | | | memset_after() is needed by iwlwifi d3.c. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D43644 (cherry picked from commit 2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96)
* LinuxKPI: sort dev_<loglevel>() functionsBjoern A. Zeeb2024-02-191-8/+10
| | | | | | | | | | | | Sort the dev_<loglevel> functions by loglevel order, add the dev_alert() version and an indentation change. No functional changes. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D43719 (cherry picked from commit 70617458676eb0b0076aa19657d21f2a9f3b704a)
* regenKonstantin Belousov2024-02-114-1/+52
|
* kcmp(2): implement for linuxkpi cdevsKonstantin Belousov2024-02-111-0/+14
| | | | (cherry picked from commit 41fb6dc3d4df632ffacf91b5631a718442d129d5)
* Add kcmp(2) kernel bitsKonstantin Belousov2024-02-111-0/+8
| | | | (cherry picked from commit d8decc9ae31af7ffc77276c89639fb13eb1020cc)
* linuxkpi: correct zone item size for linux_mm_zoneKonstantin Belousov2024-01-221-1/+1
| | | | (cherry picked from commit 4958df5dabce62ef4e9e96b0d1bf62f3a6cce689)
* sys: Use mbufq_empty instead of comparing mbufq_len against 0John Baldwin2024-01-181-1/+1
| | | | | | | | Reviewed by: bz, emaste Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43338 (cherry picked from commit 8cb9b68f5821e45c63ee08d8ee3029ca523ac174)
* linprocfs: Avoid using a sysctl to get the CPU model stringMark Johnston2024-01-111-10/+1
| | | | | | | | | | | | | This will fail if the reading process is in capability mode. Just copy the string directly. PR: 276043 Reviewed by: emaste, imp, kib Reported and tested by: Ricardo Branco <rbranco@suse.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43281 (cherry picked from commit d74a742704eb81f0c6f4aa83e4cb0de26a81c400)
* linuxkpi: Handle direct-mapped addresses in linux_free_kmem()Mark Johnston2024-01-091-3/+19
| | | | | | | | | | | | | | | | | | | | See the analysis in PR 271333. It is possible for driver code to allocate a page, store its address as returned by page_address(), then call free_page() on that address. On most systems that'll result in the LinuxKPI calling kmem_free() with a direct-mapped address, which is not legal. Fix the problem by making linux_free_kmem() check the address to see whether it's direct-mapped or not, and handling it appropriately. PR: 271333, 274515 Reviewed by: hselasky, bz Tested by: trasz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40028 (cherry picked from commit 6223d0b67af923f53d962a9bf594dc37004dffe8)
* sendfile: Explicitly ignore errors from copyout()Mark Johnston2024-01-021-1/+1
| | | | | | | | | | | | | There is a documented bug in sendfile.2 which notes that sendfile(2) does not raise an error if it fails to copy out the number of bytes written. Explicitly ignore the error from copyout() calls in preparation for annotating copyout() with __result_use_check. Reviewed by: glebius, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43129 (cherry picked from commit d0adc2f283ad5db6b568ca533a056c9f635551cd)
* freebsd32: Report errors when copying out oldlenp in __sysctlMark Johnston2024-01-021-3/+3
| | | | | | | | | | This matches the native implementation's behaviour. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43101 (cherry picked from commit 81eb7baa69e983fe159d254a4ed47d9c00396801)
* freebsd32: Fix error handling for suword32() callsMark Johnston2023-12-282-5/+5
| | | | | | | | suword32() returns -1 upon an error, not an errno value. MFC after: 1 week (cherry picked from commit bd1654ce92569bbfbe513749db08cdd781b3a036)
* linuxkpi: dma_get_cache_alignment(): Fix off-by-one resultOlivier Certner2023-12-211-1/+1
| | | | | | | | | | | | | | | Substituting 'uma_align_cache' by the appropriately named accessor uma_get_cache_align_mask() made apparent that dma_get_cache_alignment() was off by one, since it was defined to be the mask derived from the alignment value. Reviewed by: markj, bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42264 (cherry picked from commit 2c7dd66d09a1b92a4698232996cded6e5315b3bd) Approved by: markj (mentor)
* uma: Hide 'uma_align_cache'; Create/rename accessorsOlivier Certner2023-12-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Create the uma_get_cache_align_mask() accessor and put it in a separate private header so as to minimize namespace pollution in header/source files that need only this function and not the whole 'uma.h' header. Make sure the accessors have '_mask' as a suffix, so that callers are aware that the real alignment is the power of two that is the mask plus one. Rename the stem to something more explicit. Rename uma_set_cache_align_mask()'s single parameter to 'mask'. Hide 'uma_align_cache' to ensure that it cannot be set in any other way then by a call to uma_set_cache_align_mask(), which will perform sanity checks in a further commit. While here, rename it to 'uma_cache_align_mask'. This is also in preparation for some further changes, such as improving the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and changing the type of the 'uma_cache_align_mask' variable. Reviewed by: markj, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42258 (cherry picked from commit dc8f7692fd1de628814f4eaf4a233dccf4c92199) Approved by: markj (mentor)
* sysvipc: Fix 32-bit compat on !i386Brooks Davis2023-12-141-16/+16
| | | | | | | | | | | | | | The various time fields are time_t's which are only 32-bit on i386. Fixing the old versions is probably of little use, but it's more correct and in theory there could be powerpc binaries from 6.x. PR: 240035 Fixes: fbb273bc05bef Properly support for FreeBSD 4 32bit System V shared memory. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42870 (cherry picked from commit 957f014dc076a7f74ed0c8c8699e6f39b55785e7)
* net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vhtBjoern A. Zeeb2023-11-291-3/+3
| | | | | | | | | | | | Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo into struct ieee80211_vht_cap ic_vht_cap. While the structure layout changes no other functional changes intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 562adbe1d354377a260e66eedb6072b720a606dc)
* LinuxKPI: 802.11: zero-pad debug flagsBjoern A. Zeeb2023-11-291-12/+12
| | | | | | | | | | | Write the debug flags as full 32bit hex numbers to have a better view on them. No functional changes. Sponsored by: The FreeBSD Foundation (cherry picked from commit 8895b47638ea4d7a13fba97afe8cd9faacfdda83)
* LinuxKPI: 802.11: deal with scan_ie_lenBjoern A. Zeeb2023-11-291-6/+16
| | | | | | | | | | | | We only need to reserve the extra space for DSSS if NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES is set, so add the conditional. Also add checks in case scan_ie_len will grow beyond the maximum. Given this is currently unlikely, leave the cleanup for later as some other restructuring should be done first. Sponsored by: The FreeBSD Foundation (cherry picked from commit 78ca45df310563ca46448a124674e0542aab2e31)
* LinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argumentBjoern A. Zeeb2023-11-291-2/+2
| | | | | | | | | | | | | | | Fix the last argument passed to ieee80211_add_channel_cbw() in lkpi_ic_getradiocaps() for both 2Ghz and 5Ghz bands. We passed in the unmodified version rather than the adjusted version based on the per-band channel information possibly leaving ieee80211_channel_flags enabled which should not be. So far this should not have made a difference given we did not enable HT or VHT. Sponsored by: The FreeBSD Foundation (cherry picked from commit 5856761fd5f675c3871a82effdbf714a1d1bcc5e)
* LinuxKPI: 802.11: error on state transition failureBjoern A. Zeeb2023-11-291-2/+1
| | | | | | | | | | | | The state transition failures we were seeing in the early days are solved. If we now experience one stop processing before passing over to net80211 (sta_newstate()) and before updating iv_state on the vap. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42423 (cherry picked from commit 45c27ad5241f5491234afd0b47d13b8005fdb4de)
* LinuxKPI: 802.11: add unconditional error reportingBjoern A. Zeeb2023-11-291-20/+64
| | | | | | | | | | | | | | | | Multiple reports have shown missed state transitions in net80211 without major cause obvious (or with a txq warning in iwlwifi). In order to better track down potential problems add unconditional ic_printf calls to any case in the lkpi state machine compat code which would let us return with an error in the hope that it helps us to catch the actual problems. Also remove the debug conditions from ieee80211_{beacon,connection}_loss which can also cause state transitions to have the ic_printf all the time there too. Sponsored by: The FreeBSD Foundation (cherry picked from commit 018d93ece16bd33077021383940d0da5121f0691)
* LinuxKPI: 802.11: hide txq debugging behind checksBjoern A. Zeeb2023-11-291-2/+8
| | | | | | | | | Two txq debug messages were left unconditionally. Hide them behind ifdef/if() condition checks for selective debugging only. Sponsored by: The FreeBSD Foundation (cherry picked from commit 0d2cb6a6ecde3b271ede59d77801cb43a8804688)
* LinuxKPI: 802.11: fix re-creation of VAPBjoern A. Zeeb2023-11-291-0/+3
| | | | | | | | | | | | | | | After dbf7691999abe (as indicated in that commit message) EEXISTS errors may be seen. From current investigation that is due to the single-VAP support in LinuxKPI 802.11 and the related calls to mo_start() and mo_stop() and them being disabled in ic_parent() currently. Calling mo_stop() in lkpi_ic_vap_delete() seems to fix the problem and new VAPs (wlan interfaces) can be created again after being destroyed. Fixes: dbf7691999abe ("improve lkpi_ic_vap_delete()") Sponsored by: The FreeBSD Foundation (cherry picked from commit 6c38c6b1b917957d420902213f318bf0153214f2)
* LinuxKPI: 802.11: improve lkpi_ic_vap_delete()Bjoern A. Zeeb2023-11-291-1/+5
| | | | | | | | | | | | | | | | Changing the order of cleanup in lkpi_ic_vap_delete() will avoid firmware crashes or a direct panic as observed as ieee80211_vap_detach() will do most cleanup for us and get us into the correct state. The solution is not fully developed yet and one may not be able to create a new vap (lkpi_ic_vap_create may fail with error 17) afterwards. It is supposed to be a step towards more stability for now. Sponsored by: The FreeBSD Foundation PR: 269842 (cherry picked from commit dbf7691999abe501e0ebc0fe4d8d9e97718d3890)
* LinuxKPI: 802.11: fix problem removing staBjoern A. Zeeb2023-11-291-19/+18
| | | | | | | | | | | | | | | | | | | | | | | Move the call to lkpi_disassoc() before the state change to IEEE80211_STA_NOTEXIST which will remove the sta (from firmware). Based on a comment it seems that originally we had to do it the other way round. iwlwifi(4) has a check and will silently not remove the sta from the firmware when vif->cfg.assoc is still set (see iwl_mvm_sta_del()). This leads to the LinuxKPI 802.11 code thinking the sta is gone as downward state changes by the mac80211 op (*sta_state)() may not fail. Once we try to assoc with a newly added station later, iwlwifi firmware will run into an assert having two ap_sta set on the same vif. We can observe that problem in iwlwifi(4) having __le32 sta_id = 1 instead of sta_id = 0 in iwl_mvm_sta_cfg_cmd{} on the HCMD. This should fix one of the most seen problems with iwlwifi(4), e.g., when running service netif restart wlan0 or service wpa_supplicant restart wlan0. Sponsored by: The FreeBSD Foundation (cherry picked from commit 16e688b2a403a3dbc05de3b9f8a3132838613790)
* LinuxKPI: 802.11: fill regulatory_hint() with some lifeBjoern A. Zeeb2023-11-292-2/+28
| | | | | | | | | | | Start implementing regulatory_hint() using a .c file based allocation helper function so we could change structures in the future with better chances to keep compatibility. This sets wiphy->regd needed by various LinuxKPI based WiFi drivers. Sponsored by: The FreeBSD Foundation (cherry picked from commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a)
* LiunxKPI: 802.11: move ieee80211_chanctx_conf into lkpi private structBjoern A. Zeeb2023-11-293-6/+57
| | | | | | | | | | | | Factor out ieee80211_chanctx_conf into struct lkpi_chanctx in order to keep local state as well. In first instance that is added_to_drv only. For now we stay single-chanctx only but this paves the path to make it a list. Use the new information to implement ieee80211_iter_chan_contexts_atomic(). Sponsored by: The FreeBSD Foundation (cherry picked from commit c5e257985085bd987b1dddffd0455c2230df2d1d)
* LinuxKPI: 802.11: avoid symbol clash on UP to AC mappingBjoern A. Zeeb2023-11-291-3/+4
| | | | | | | | | | | | tid_to_mac80211_ac is an exported symbol in and likely based on iwlwifi, which leads to a symbol clash in NetBSD. Rename our local LinuxKPI copy to a better name and add a comment where to find a copy of the mapping table. Sponsored by: The FreeBSD Foundation Reported by: Phil Nelson (phil netbsd org) (cherry picked from commit fb3c249ed93c834d70f8361215bc40a9e9004d3b)
* LinuxKPI: 802.11: setup a default link[0] and adjust related needsBjoern A. Zeeb2023-11-291-22/+41
| | | | | | | | | | | | | | | | Setup more link_conf/deflink fields for vif/sta as are needed to allow us to work with the KPI bits in a non-MLO configuration. In lkpi_sta_scan_to_auth() set the bss_conf values before calling into the driver for chanctx setup/updates as certain values (e.g., beacon_int) need to be set before; we still call the MO function for the updates after to keep the expected workflow. Deal with the (to be dealt with otherwise later) net80211 ni swaps and update the addresses on the deflink as well as otherwise firmware will hit asserts or things will not work (e.g. indicating the peer is us). Sponsored by: The FreeBSD Foundation (cherry picked from commit 6ffb7bd469b26f2ff6cc62cedca6ffe884076196)
* LinuxKPI: 802.11: inialize tx queue paramsBjoern A. Zeeb2023-11-291-1/+20
| | | | | | | | | | | | | When adding a VAP (vif) initialize its tx queue parameters calling mo_conf_tx(). I could not spot net80211 providing some of the values needed before having a node so currrently we use hard-coded values with a comment with a reference on how to properly calculate the values in the future (e.g., in case of 11b or other cases). Sponsored by: The FreeBSD Foundation (cherry picked from commit a6042e17c8999c4965bd4d762c4564b322f1ae7b)
* LinuxKPI: 802.11: change ic_parent() to not call mo_stop()/mo_start()Bjoern A. Zeeb2023-11-291-0/+8
| | | | | | | | | | | | | | Driven by net80211 we may call mac80211 ops stop() and start() mostly when toggling a first VAP. While this is FreeBSD behaviour the firmware based LinuxKPI drivers seem to possibly clear state in the case of stop() triggering further errors down the line. We call mo_start() when starting the VAP and mo_stop() when destroying it now only. In the future (e.g., in multi-VAP setups) we may need to re-address some of this so keep the code under #ifdef. Sponsored by: The FreeBSD Foundation (cherry picked from commit 8d58a0578635dc7dd1025ab08b0479f2b383e1a4)
* LinuxKPI: 802.11: adjust code to new structure layoutBjoern A. Zeeb2023-11-292-29/+24
| | | | | | | | | | | With past commits new structures were added. Now switch over some bss_conf fields into vif->cfg where they got moved to and remove the old fields. This allows drivers to find the expected values in the now expected places and work better. Sponsored by: The FreeBSD Foundation (cherry picked from commit 616e13301bcf274b007f84ef99ea857a55bef46d)
* LinuxKPI: 802.11: mac80211 ops: distinguish between {bss,link}_info_changedBjoern A. Zeeb2023-11-291-3/+6
| | | | | | | | | | | | With MLO and multi-link setups if avail we want to call link_info_changed whereas for legacy drivers we still need to call bss_info_changed. While we currently do not (yet) support multi-link configurations we still need to drive the correct commands to satisfy firmware requirements. Sponsored by: The FreeBSD Foundation (cherry picked from commit 727f88f2617acaff4ada0f3dda6ca23c6679310d)
* LinuxKPI: 802.11: pass non-0/NULL arguments to MO functionsBjoern A. Zeeb2023-11-293-17/+21
| | | | | | | | | | | | | | | | In [1] we updated the KPI for various mac80211 ops functions to deal with MLD code. Newer iwlwifi driver and firmware supports these functions so we need to pass non-dummy (0, NULL) arguments to them. Start extending the internel MO functions by these arguments and pass down values from LinuxKPI 802.11 code. It is assumed that further work will be needed to have all the right fields available to at least work in the lgeacy way of a single link. Sponsored by: The FreeBSD Foundation Improves: 549198b1ab95 (update mac80211 KPI) [1] (cherry picked from commit 6854154638a2c04ab59da43aedbe2c0ee8ef71a5)
* LinuxKPI: 802.11: prepare for iwlwifi driver updatesBjoern A. Zeeb2023-11-291-15/+1
| | | | | | | | | Unconditionally enable the changes for newer drivers, as needed by iwlwifi (and others). Sponsored by: The FreeBSD Foundation (cherry picked from commit 3e1f5cc9a81a6065ddc371eea5755b4e207d72f8)
* LinuxKPI: 802.11: fix counting the number of supbandsBjoern A. Zeeb2023-11-291-2/+5
| | | | | | | | | | | | | | While the main purpose was to assign an(y) early chandef with the loop, later additions made use of it to also count supbands as well as to initialise max_rates. Due to the main goal we can exit the loop early and not properly count and initialise supbands and max_rates. Move the terminating condition into the loop and make it a continue rather than ending the loop. Sponsored by: The FreeBSD Foundation (cherry picked from commit f454a4a10dc027474a85269cb4a3f50bbbf90528)
* LinuxKPI: 802.11: make sure bssid for scans (probe_req) is setBjoern A. Zeeb2023-11-291-0/+1
| | | | | | | | | | | | | In b0f73768220e9 we added bssid[] to struct cfg80211_scan_request likely while working on mt76 and did not need it (yet) back then. iwlwifi started to use the field in Linux f1fec51cda70f (April 2023). Without it set firmware crashes when trying to send probe requests ((empty) SSID also given to hw_scan). For now always set the field to the wildcard BSSID. Sponsored by: The FreeBSD Foundation (cherry picked from commit e1e90be05017c335862c938fd9d577e56f02af30)
* LinuxKPI: skbuff: remove assumption about mac_headerBjoern A. Zeeb2023-11-291-2/+1
| | | | | | | | | It seems the mac_header can be set to offset 0 for frames received. Remove the warning splattering messages to the console for each packet. Sponsored by: The FreeBSD Foundation (cherry picked from commit f0e59b6903c881859d7f4eaf269b2336b774c7bc)
* iwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()Bjoern A. Zeeb2023-11-291-11/+2
| | | | | | | | | | | | | Update ieee80211_request_smps() to the new number of arguments in LinuxKPI (which was already prepared) and update the one call in the older iwlwifi driver version. This will allow iwlwifi as-is now and rtw88 to compile in case someone else wants to work on the latter in parallel to predominant efforts on the former. Sponsored by: The FreeBSD Foundation (cherry picked from commit 815b7436a7c6302365b6514194d27d41cb736227)
* LinuxKPI: 802.11: update compat code for updated driversBjoern A. Zeeb2023-11-296-45/+509
| | | | | | | | | | | | | | | Adjust and add structs, fields, functions to make more modern versions of LinuxKPI based wireless drivers (based on wireless-testing ( wt-2023-06-09, wt-2023-07-24, and later)) compile. Some of these changes can only be applied once all drivers get updated to not break the old versions currently in the tree. Mark those changes with __FOR_LATER_DRV_UPDATE for now and flip the switch at a later point. Sponsored by: The FreeBSD Foundation (cherry picked from commit adff403fe7a870c5b7a2d7e003d445c3b409bc0c)
* LinuxKPI: skbuff: add skb_cow_head()Bjoern A. Zeeb2023-11-291-0/+8
| | | | | | | | Add dummy implementation of skb_cow_head(). Sponsored by: The FreeBSD Foundation (cherry picked from commit e039b38d4652b6a68567f8d632c3dfa4f15c40f6)
* linuxkpi: Fix __sg_alloc_table_from_pages loopAustin Shafer2023-11-291-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 3e0856b63fe0e375a0951e05c2ef98bb2ebd9421 updated __sg_alloc_table_from_pages to use the same API as linux, but modified the loop condition when going over the pages in a sg list. Part of the change included moving the sg_next call out of the for loop and into the body, which causes an off by one error when traversing the list. Since sg_next is called before the loop body it will skip the first element and read one past the last element. This caused panics when running PRIME with nvidia-drm as the off-by-one issue causes a NULL dereference. (cherry picked from commit 3f686532c9b4fd603d4ad2d3392232cff24188f4) Commit 3f686532c9b4 tried to fix an issue with not properly starting at the first page in the sg list to prevent a panic. This worked but with the side effect of incrementing "s" during the final iteration causing it to be NULL since the list had ended. In cases non-DEBUG kernels this causes a panic with drm-5.15, since "s" is NULL when we later pass it to sg_mark_end(). This change decouples the iteration sg from the return value so that it is never incremented past the final page in the chain. (cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)
* LinuxKPI: skbuff: fix tracingBjoern A. Zeeb2023-11-291-2/+1
| | | | | | | | | Fix arguments to a trace line and remove another trace line until we actually will have the skb to trace along with a future implementation. Sponsored by: The FreeBSD Foundation (cherry picked from commit 149c457de14a06a40e0419d7a4249b1a3b01ae7a)
* LinuxKPI: implement mul_u64_u64_div_u64()Bjoern A. Zeeb2023-11-291-0/+49
| | | | | | | | | | | | | | | | | | | | | | Implement mul_u64_u64_div_u64() for an updated iwlwifi driver (though we do not yet use it there; it is used for in-kernel ptp on wifi). Sponsored by: The FreeBSD Foundation (cherry picked from commit b80ea452375f52a3ab7d82a9aef10da0d89985d9) Unbalanced parentheses broke the build; re-balance. Fixes: b80ea452375f ("LinuxKPI: implement mul_u64_u64_div_u64()") (cherry picked from commit dabbbebcb0f5ced163454cd08b78e551b4a365b5) linuxkpi math: fix kassert in math64.h Include <sys/systm.h> in math64.h, so that KASSERT and bool are defined, to allow compilation to succeed after b80ea452375f52a3ab7d82a9aef10da0d89985d9 and dabbbebcb0f5... (cherry picked from commit b6a61d6836d90ff2756d804eb981a02b0828f496)
* LinuxKPI: add page pool skeletonBjoern A. Zeeb2023-11-291-0/+119
| | | | | | | | | Add the page pool skeleton based on a wireless driver. We have to sort out some struct page problems first before we can start implementing this but that should happen independent of all other changes. (cherry picked from commit 517e0978db1ff92d9f2b86fe735aba24bca72038)
* LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_pageBjoern A. Zeeb2023-11-291-2/+2
| | | | | | | | | | | | | Rather than using the FreeBSD internal calls vtophys() and PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for this called virt_to_page(). This reduces the amount of compat code to maintain and will allow further work on struct [vm_]page. This should be a NOP. Sponsored by: The FreeBSD Foundation (cherry picked from commit dcb0c54968db10d3c7619f16c4bcfa9284d50ea2)
* LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYSBjoern A. Zeeb2023-11-294-6/+6
| | | | | | | | | | | | Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys() allowing us to work on a struct page in the future using the one single public Linux KPI interface to map to a native FreeBSD vm_page. This should be a NOP. Sponsored by: The FreeBSD Foundation (cherry picked from commit d1ea07642c47e26effec58f53b7369bf5f797252)
* LinuxKPI: reduce usage of struct vm_page and vm_page_tBjoern A. Zeeb2023-11-297-25/+25
| | | | | | | | | | | | | We currently define (Linux) page to (FreeBSD) vm_page. Cleanup some of the direct struct vm_page and vm_page_t declarations and usages in the Linux KPI and make them 'struct page' or 'struct page *' to prepare for more upcoming work. This should be a NOP. Sponsored by: The FreeBSD Foundation (cherry picked from commit 9e9c682ff3a1aec20a7e5f5b1dd88ceaec7c3950)