aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* sys: Extract __bitcount* from sys/types.h to new sys/bitcount.hJessica Clarke1 min.2-62/+108
| | | | | | | | | | | | | | | | | This will allow the code to be reused by the cross-build sys/types.h wrapper in order to provide the APIs for greater compatibility. This also provides a path towards eventually removing the definitions from sys/types.h altogether if so desired by gradually migrating users to including sys/bitcount.h explicitly, but that is not the primary goal here. Note that the copyright header is a direct copu of sys/types.h's given that's where this code comes from. This could be replaced in future with a more specific one restricted to just the code in question, depending on what the copyright for that code is. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D36132
* ip6_input: explicitly include <sys/eventhandler.h>Gleb Smirnoff4 hours1-0/+1
| | | | | | | On most architectures/kernels it was included implicitly, but powerpc MPC85XX got broken. Fixes: 81a34d374ed6e5a7b14f24583bc8e3abfdc66306
* virtio_mmio: Improve V1 spec conformanceBryan Venteicher6 hours1-9/+78
| | | | | | | | | | Implement the virtio_bus_finalize_features method so the FEATURES_OK status bit is set. Implement the virtio_bus_config_generation method to ensure larger than 4-byte reads are consistent. Reviewed by: cperciva MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36150
* arm64 pmap: Convert PC_IS_FREE into an inline function.John Baldwin7 hours1-10/+11
| | | | | | | | | | | This permits inlining the comparisons even in the 16K page case. Note that since PC_FREEN is -1, values can be compared efficiently without having to fetch words of pc_freemask from memory via the 'cmn <reg>, #0x1' instruction. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36218
* arm64 pmap: Simplify logic around pv_chunk sizes.John Baldwin7 hours2-19/+14
| | | | | | | | | | | | | | | | - Define PC_FREEL and _NPCM in terms of _NPCPV rather than via magic numbers. - Remove assertions about _NPC* values from pmap.c. This is less relevant now that PC_FREEL and _NPCM are derived from _NPCPV. - Add a helper inline function pc_is_full() which uses a loop to check if pc_map is all zeroes. Use this to replace three places that check for a full mask assuming there are only 3 entries in pc_map. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36217
* protosw: refactor protosw and domain static declaration and loadGleb Smirnoff7 hours44-1465/+1042
| | | | | | | | | | | | | | | | | | | o Assert that every protosw has pr_attach. Now this structure is only for socket protocols declarations and nothing else. o Merge struct pr_usrreqs into struct protosw. This was suggested in 1996 by wollman@ (see 7b187005d18ef), and later reiterated in 2006 by rwatson@ (see 6fbb9cf860dcd). o Make struct domain hold a variable sized array of protosw pointers. For most protocols these pointers are initialized statically. Those domains that may have loadable protocols have spacers. IPv4 and IPv6 have 8 spacers each (andre@ dff3237ee54ea). o For inetsw and inet6sw leave a comment noting that many protosw entries very likely are dead code. o Refactor pf_proto_[un]register() into protosw_[un]register(). o Isolate pr_*_notsupp() methods into uipc_domain.c Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36232
* protosw: retire PRU_ flags and their char namesGleb Smirnoff7 hours6-56/+43
| | | | | | | For many years only TCP debugging used them, but relatively recently TCP DTrace probes also start to use them. Move their declarations into tcp_debug.h, but start including tcp_debug.h unconditionally, so that compilation with DTrace and without TCPDEBUG is possible.
* unix: use private enum as argument for unp_connect2()Gleb Smirnoff7 hours1-2/+3
| | | | | instead of using historic PRU_ flags that are now not used by anything rather than TCP debugging.
* ip_reass: separate ipreass_init() into global and VIMAGE partsGleb Smirnoff7 hours2-11/+18
| | | | Should have been done in 89128ff3e42.
* tcp: move tcp_drain() verbatim before tcp_init()Gleb Smirnoff7 hours1-52/+50
|
* protosw: retire pr_drain and use EVENTHANDLER(9) directlyGleb Smirnoff7 hours18-109/+55
| | | | | | | | | | | | | | | The method was called for two different conditions: 1) the VM layer is low on pages or 2) one of UMA zones of mbuf allocator exhausted. This change 2) into a new event handler, but all affected network subsystems modified to subscribe to both, so this change shall not bring functional changes under different low memory situations. There were three subsystems still using pr_drain: TCP, SCTP and frag6. The latter had its protosw entry for the only reason to register its pr_drain method. Reviewed by: tuexen, melifaro Differential revision: https://reviews.freebsd.org/D36164
* protosw: retire pr_slowtimo and pr_fasttimoGleb Smirnoff7 hours4-91/+0
| | | | | | | | | They were useful many years ago, when the callwheel was not efficient, and the kernel tried to have as little callout entries scheduled as possible. Reviewed by: tuexen, melifaro Differential revision: https://reviews.freebsd.org/D36163
* frag6: use callout(9) directly instead of pr_slowtimoGleb Smirnoff7 hours3-5/+17
| | | | | Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36162
* mld6: use callout(9) directly instead of pr_slowtimo, pr_fasttimoGleb Smirnoff7 hours6-38/+32
| | | | | | | | While here remove recursive network epoch entry in mld_fasttimo_vnet(), as this function is already in epoch. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36161
* igmp: use callout(9) directly instead of pr_slowtimo, pr_fasttimoGleb Smirnoff7 hours3-18/+34
| | | | | Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36160
* tcp: use callout(9) directly instead of pr_slowtimoGleb Smirnoff7 hours4-8/+21
| | | | | | | | | Modern TCP stacks uses multiple callouts per tcpcb, and a global callout is ancient artifact. However it is still used to garbage collect compressed timewait entries. Reviewed by: melifaro, tuexen Differential revision: https://reviews.freebsd.org/D36159
* ip_reass: use callout(9) directly instead of pr_slowtimoGleb Smirnoff7 hours4-45/+42
| | | | | Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36236
* protosw: separate pr_input and pr_ctlinput out of protoswGleb Smirnoff7 hours26-334/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The protosw KPI historically has implemented two quite orthogonal things: protocols that implement a certain kind of socket, and protocols that are IPv4/IPv6 protocol. These two things do not make one-to-one correspondence. The pr_input and pr_ctlinput methods were utilized only in IP protocols. This strange duality required IP protocols that doesn't have a socket to declare protosw, e.g. carp(4). On the other hand developers of socket protocols thought that they need to define pr_input/pr_ctlinput always, which lead to strange dead code, e.g. div_input() or sdp_ctlinput(). With this change pr_input and pr_ctlinput as part of protosw disappear and IPv4/IPv6 get their private single level protocol switch table ip_protox[] and ip6_protox[] respectively, pointing at array of ipproto_input_t functions. The pr_ctlinput that was used for control input coming from the network (ICMP, ICMPv6) is now represented by ip_ctlprotox[] and ip6_ctlprotox[]. ipproto_register() becomes the only official way to register in the table. Those protocols that were always static and unlikely anybody is interested in making them loadable, are now registered by ip_init(), ip6_init(). An IP protocol that considers itself unloadable shall register itself within its own private SYSINIT(). Reviewed by: tuexen, melifaro Differential revision: https://reviews.freebsd.org/D36157
* Revert "vm: use atomic fetchadd in vm_page_sunbusy"Mateusz Guzik9 hours1-6/+20
| | | | | | | | | | | This reverts commit f6ffed44a8eb5d1ab89a18e60fb056aab2105be7. fetchadd will fail the waiters flag, which can cause other code to wait when it should not with nothing clear it Revert until I sort this out. Reported by: markj
* iwlwifi: add FreeBSD specific debuggingBjoern A. Zeeb10 hours2-0/+18
| | | | | | | | | | | | | "Invalid TXQ id" and "Queue <n> is stuck <x> <y>" are two errors seen more commonly by FreeBSD users. Try to gather some extra data the "easy way" adding more error logging for these situations in the hope to find a clue or at least do more targetd debugging in the future. Note that for one of the errors the Linux Intel driver has a TODO to print register data. If that will show up in future versions of the driver this may also help. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* ipsec: isolate knowledge about protocols that are last headerGleb Smirnoff10 hours6-35/+58
| | | | | | | Retire PR_LASTHDR protosw flag. Reviewed by: ae Differential revision: https://reviews.freebsd.org/D36155
* ipfw: make it possible to specify MTU for "unreach needfrag" actionGleb Smirnoff10 hours2-4/+18
| | | | | Reviewed by: ae, pauamma Differential revision: https://reviews.freebsd.org/D36140
* ixgbe: fix software vlan handlingKristof Provost11 hours1-1/+20
| | | | | | | | | | | | | | | | | | If hardware vlan tagging is disabled (after a vlan has been added) we receive double-tagged packets, even if the packet on the wire only has a single VLAN tag. That looks like this: 17:29:30.370787 00:51:82:11:22:02 > 90:ec:77:1f:8a:5f, ethertype 802.1Q (0x8100), length 64: vlan 0, p 0, ethertype 802.1Q, vlan 1001, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.101.0.12 is-at 00:51:82:11:22:02, length 42 This happens because the ixgbe driver does not clear the vlan flags in the hardware (such as IXGBE_RXDCTL_VME) if IFCAP_VLAN_HWTAGGING is cleared. Add code to do so, which fixes this issue. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36139
* pipe: try to skip locking the pipe if a non-blocking fd is usedMateusz Guzik11 hours1-0/+20
| | | | | Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D36082
* mac: cheaper check for mac_pipe_check_readMateusz Guzik11 hours3-2/+20
| | | | | Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D36082
* pipe: change pipemapping cnt/pos to u_intMateusz Guzik11 hours1-2/+2
| | | | | | This matches the case using regular buffers and avoids an ifdef later. Suggested by: markj
* vm: use atomic fetchadd in vm_page_sunbusyMateusz Guzik15 hours1-20/+6
| | | | | | | | This also fixes a bug where not-last unbusy failed to post a release fence. Reviewed by: markj (previous version), kib (previous version) Differential Revision: https://reviews.freebsd.org/D36084
* Disallow invalid PT_GNU_STACKEd Maste30 hours1-1/+8
| | | | | | | | | | Stack must be at least readable and writable. PR: 242570 Reviewed by: kib, markj MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35867
* udp: call UDP methods from UDP over IPv6 directlyGleb Smirnoff30 hours2-29/+17
| | | | | | | | | Both UDP and UDP Lite use same methods on sockets. Both UDP over IPv4 and over IPv6 use same methods. Don't pretend that methods can switch and remove this unneeded complexity. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36154
* buf.h: Fix declaration of unmapped_bufSebastian Huber30 hours1-1/+2
| | | | | | | | | | | For architectures with a small-data area, the __read_mostly section must present at the object declaration. (emaste note: This does not appear to have an affect within FreeBSD, but may be needed by downstream projects that handle __read_mostly / __section(".data.read_mostly") differently.) Pull Request: https://github.com/freebsd/freebsd-src/pull/608
* sdp: garbage collect sdp_ctlinputGleb Smirnoff30 hours1-34/+0
| | | | | | | | | | | | | | | The pr_ctlinput method was a feature of IPv4/IPv6 with exception of pfctlinput(), which broadcasted a call to pr_ctlinput on all protocols ever registered statically or with pf_proto_register(). Now that this broadcast call is gone, the only protocols that get their pr_ctlinput ever called are those that have registered itselves with ipproto_register() or ip6proto_register(). It is entirely possible that code deleted now was dead code from very beginning. Just a copy-paste from TCP. Reviewed by: rstone Differential revision: https://reviews.freebsd.org/D36208
* Disable promotion on pcpu memory on arm64Andrew Turner35 hours4-37/+80
| | | | | | | | | | | | We need to be careful to not promote or demote the memory containing the per-CPU structures as the exception handlers will dereference it so any time it's invalid may cause recursive exceptions. Add a new pmap function to set a flag in the pte marking memory that cannot be promoted or demoted and use it to mark pcpu memory. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35434
* Add support for RockChip RK356X to DWC3 driver.Søren Schmidt37 hours3-6/+10
| | | | | | | | For RK356x platform, we can set bit 26 of DWC3_GUCTL1 register for usb 2.0 device. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D36211
* vfs: plug a dead store in kern_linkat_vpMateusz Guzik39 hours1-1/+1
| | | | Reported by: clang --analyze
* vfs: plug dead store in vn_io_fault1Mateusz Guzik39 hours1-1/+0
| | | | Reported by: clang --analyze
* TPM: do not set device description if probe failsKonrad Sewiłło-Jopek41 hours1-1/+1
| | | | | | | | | device_set_desc should be called only if driver probes successfully. Approved by: mw(mentor) Reviewed by: mw, kd MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35998
* cxgbe(4): Add a knob to request that clocks be gated on suspend.Navdeep Parhar42 hours1-0/+10
| | | | | MFC after: 3 months Sponsored by: Chelsio Communications
* cxgbe(4): Decode and display some more bits in the PL interrupt handler.Navdeep Parhar42 hours1-1/+19
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* cxgbe(4): Update firmwares to 1.27.0.0.Navdeep Parhar42 hours8-12/+12
| | | | | | | | | | | | | | | | | | | | | | Changes since 1.26.6.0 are listed here. This list comes from the Release Notes for "Chelsio Unified Wire 3.17.0.0 for Linux" dated 2022-07-29. Fixes ----- BASE: - Enabled all MA parity interrupt bits. - Use config file value to override number of rx channel. nrxch=1 was not handled in the firmware. - Replaced read only registers with new registers EDC_H_BIST_USER_WDATA0, EDC_H_BIST_USER_WDATA1 and EDC_H_BIST_CMD_LEN to dump the uP memory parity error status registers. - 10G simplex module support enabled. Obtained from: Chelsio Communications MFC after: 1 month Sponsored by: Chelsio Communications
* Add RockChip rk809/rk817 pmic support to existingSøren Schmidt42 hours6-8/+738
| | | | | | | RockChip pmic drivers. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D36149
* routing: G/C rt_exportinfo declarationMateusz Guzik2 days1-2/+0
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* Adjust function definition in riscv's db_trace.c to avoid clang 15 warningDimitry Andric2 days1-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/riscv/riscv/db_trace.c:56:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] db_md_list_watchpoints() ^ void This is because db_md_list_watchpoints() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust function definitions in mp_cpudep.c.c to avoid clang 15 warningsDimitry Andric2 days1-2/+2
| | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/powerpc/booke/mp_cpudep.c:54:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] cpudep_ap_bootstrap() ^ void sys/powerpc/booke/mp_cpudep.c:97:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] cpudep_ap_setup() ^ void This is because cpudep_ap_bootstrap() and cpudep_ap_setup() are declared with (void) argument lists, but defined with empty argument lists. Make the definitions match the declarations. MFC after: 3 days
* Adjust function definition in moea64_native.c to avoid clang 15 warningDimitry Andric2 days1-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/moea64_native.c:306:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_install_native() ^ void This is because moea64_install_native() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Fix unused variable warning in mmu_radix.cDimitry Andric2 days1-1/+8
| | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/mmu_radix.c:5409:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable] int allfree, field, freed, idx; ^ The 'freed' variable is only used when PV_STATS is defined. Ensure it is only declared and set in that case. MFC after: 3 days
* Adjust function definitions in mmu_radix.c to avoid clang 15 warningsDimitry Andric2 days1-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/powerpc/aim/mmu_radix.c:786:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_tlbie_all() ^ void sys/powerpc/aim/mmu_radix.c:3615:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_init() ^ void sys/powerpc/aim/mmu_radix.c:6081:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_scan_init() ^ void This is because mmu_radix_tlbie_all(), mmu_radix_init(), and mmu_radix_scan_init() are declared with (void) argument lists, but defined with empty argument lists. Make the definitions match the declarations. MFC after: 3 days
* Adjust function definitions in mmu_oea64.c to avoid clang 15 warningsDimitry Andric2 days1-2/+2
| | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/powerpc/aim/mmu_oea64.c:1947:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_init() ^ void sys/powerpc/aim/mmu_oea64.c:3257:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_scan_init() ^ void This is because moea64_init() and moea64_scan_init() are declared with (void) argument lists, but defined with empty argument lists. Make the definitions match the declarations. MFC after: 3 days
* Adjust function definition in aim_machdep.c to avoid clang 15 warningDimitry Andric2 days1-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/aim_machdep.c:750:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mpc745x_sleep() ^ void This is because mpc745x_sleep() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Fix unused variable warnings in tcp_hpts.cDimitry Andric2 days1-4/+0
| | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/netinet/tcp_hpts.c:1114:10: error: variable 'paced_cnt' set but not used [-Werror,-Wunused-but-set-variable] int32_t paced_cnt = 0; ^ sys/netinet/tcp_hpts.c:1112:11: error: variable 'total_slots_processed' set but not used [-Werror,-Wunused-but-set-variable] uint64_t total_slots_processed = 0; ^ The 'paced_cnt' variable was in tcp_hpts.c when it was first added, and the 'total_slots_processed' variable was added in d7955cc0ffdf9, but both appear to have been debugging aids that have never been used, so remove them. MFC after: 3 days
* Adjust function definition in tcp_hpts.c to avoid clang 15 warningDimitry Andric2 days1-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/netinet/tcp_hpts.c:1594:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] tcp_choose_hpts_to_run() ^ void This is because tcp_choose_hpts_to_run() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days