Commit Graph

142507 Commits

Author SHA1 Message Date
John Baldwin
834533b9c5 mlx5: Remove unused variables.
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D34827
2022-04-08 17:25:13 -07:00
John Baldwin
6d018c93ea mlx4: Remove unused variables.
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D34826
2022-04-08 17:25:13 -07:00
John Baldwin
516243545e mlx4: Remove a variable only used in commented-out code.
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D34825
2022-04-08 17:25:13 -07:00
Bjoern A. Zeeb
978f25e840 LinuxKPI: 802.11: add ieee80211_beacon_get_tim(), ieee80211_sn_sub()
Add a dummy implementation for ieee80211_beacon_get_tim().
Add the implementation for ieee80211_sn_sub().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-04-08 21:05:06 +00:00
Rick Macklem
21de450aa1 nfscl: Add support for a NFSv4 AppendWrite RPC
For IO_APPEND VOP_WRITE()s, the code first does a
Getattr RPC to acquire the file's size, before it
can do the Write RPC.

Although NFS does not have an append write operation,
an NFSv4 compound can use a Verify operation to check
that the client's notion of the file's size is
correct, followed by the Write operation.

This patch modifies nfscl_wcc_data() to optionally
acquire the file's size, for use with an AppendWrite.
Although the "stuff" arguments are always NULL
(these were used for the Mac OSX port and should be
cleared out someday), make the argument to
nfscl_wcc_data() explicitly NULL for clarity.

This patch does not cause any semantics change until
the AppendWrite is added in a future commit.
2022-04-08 13:59:05 -07:00
Gordon Bergling
4d6883cbe2 tcp_bbr(4): Fix a typo in a sysctl description and a comment
- s/postive/positive/

MFC after:	5 days
2022-04-08 21:08:18 +02:00
John Baldwin
6a33ecdc2f Fix a typo in previous commit.
Reported by:	npn
Pointy hat to:	jhb
Fixes:		572edd3dae vmm: Re-quiet set but unused warnings.
2022-04-08 12:01:33 -07:00
Bjoern A. Zeeb
97f2e93a66 LinuxKPI: add ALIGN_DOWN()
Add ALIGN_DOWN as rounddown2() along ALIGN() which is implemented as
roundup2().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	manu, hselasky (now with less ())
Differential Revision: https://reviews.freebsd.org/D34844
2022-04-08 18:27:49 +00:00
Chuck Silvers
3dc5f8e19d ffs: wait for trims earlier during unmount to avoid panic
All softdep processing is supposed to be completed by
softdep_flushfiles() and no more deps are supposed to be created after
that, but if a pending trim completes after softdep_flushfiles() and
before softdep_unmount() then the blkfree that is performed by
ffs_blkfree_trim_task() will create a dep when none should exist, and
if softdep_unmount() is called before that dep is freed then the
kernel will panic.  Prevent this by waiting for trims to complete
earlier in the unmount process, in ffs_flushfiles(), so that any deps
will be freed and any modified CG buffers will be flushed by the final
fsync of the devvp in ffs_flushfiles() as intended.

Reviewed by:	mckusick, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34806
2022-04-08 10:19:40 -07:00
Mark Johnston
aa597d4049 i386: Fix the nodevice apic build
PR:		263124
Fixes:		62d09b46ad ("x86: Defer LAPIC calibration until after timecounters are available")
Reviewed by:	kib, jhb, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34830
2022-04-08 11:47:52 -04:00
Mark Johnston
990a6d18b0 net: Fix memory leaks in lltable_calc_llheader() error paths
Also convert raw epoch_call() calls to lltable_free_entry() calls, no
functional change intended.  There's no need to asynchronously free the
LLEs in that case to begin with, but we might as well use the lltable
interfaces consistently.

Noticed by code inspection; I believe lltable_calc_llheader() failures
do not generally happen in practice.

Reviewed by:	bz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34832
2022-04-08 11:47:25 -04:00
Mark Johnston
dd91d84486 net: Fix LLE lock leaks
Historically, lltable_try_set_entry_addr() would release the LLE lock
upon failure.  After some refactoring, it no longer does so, but
consumers were not adjusted accordingly.

Also fix a leak that can occur if lltable_calc_llheader() fails in the
ARP code, but I suspect that such a failure can only occur due to a code
bug.

Reviewed by:	bz, melifaro
Reported by:	pho
Fixes:		0b79b007eb ("[lltable] Restructure nd6 code.")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34831
2022-04-08 11:46:19 -04:00
Bjoern A. Zeeb
3443476ca9 rtw88: downgrade rtw8822c firmware to 9.9.10
Firmware version 9.9.11 added support for hw_scan and is reportedly
causing more problems than 9.9.10 does.  Until we get a chance to
test this out downgrade the firmware in order to help people testing
more.

Sponsored by:	The FreeBSD Foundation
PR:		248235
MFC after:	2 days
X-MFC:		just to get the reminder with the original commit
X-MFC with:	73d4ebea35
2022-04-08 11:14:54 +00:00
Bjoern A. Zeeb
170acccf1e LinuxKPI: 802.11: further fix RSSI calculations
60970a328e did one half of the job
of making rssi relative to nf and numbers for radiotap were fine.
net80211 internally works with .5 dBm units thus we need to apply a
* 2 to the value we pass in to c_rssi;  leave a comment explaining.

Note: it is only ifconfig in user space which re-adjust it for printing
or contrib/wpa for calculations.  Other applications getting values
from kernel also have to apply the maths.

In collaboration with:	J.R. Oldroyd (fbsd opal.com)
Sponsored by:		The FreeBSD Foundation
MFC after:		3 days
2022-04-08 11:06:58 +00:00
John Baldwin
0c348b97eb zfs: Disable -Wunused-but-set-variable for a few files in zstd.
FSE_createCTable raises the warning because we stub out malloc() to
NULL in the kernel, so the passed in size is unused.

ZSTD_seqDecompressedSize has a variable whose value is only used in
assertions.

NB: These files are missing corresponding entries in sys/conf/files.
2022-04-07 17:01:29 -07:00
John Baldwin
0768536d19 vmci: Remove unused variables. 2022-04-07 17:01:29 -07:00
John Baldwin
a7d876f701 vmm amdvi: Move ctrl under #ifdef AMDVI_DEBUG_CMD. 2022-04-07 17:01:29 -07:00
John Baldwin
572edd3dae vmm: Re-quiet set but unused warnings.
__diagused is no longer used for KTR, so instead use #ifdef KTR or
expand KTR-only variables into their values in traces.
2022-04-07 17:01:29 -07:00
John Baldwin
197b9a2ef0 atp: Remove unused variable. 2022-04-07 17:01:29 -07:00
John Baldwin
7295403595 if_urtw: Remove unused variables. 2022-04-07 17:01:29 -07:00
John Baldwin
d62a6ff38b if_upgt: Remove unused variables. 2022-04-07 17:01:29 -07:00
John Baldwin
08ff11e524 tpm: Remove unused variables.
All of the legacy config stuff in tpm seems broken.  Nothing ever sets
tpm_enabled to a non-zero value and the legacy bits expect tpm_enabled
to be set to the base IO port address (I think).
2022-04-07 17:01:29 -07:00
John Baldwin
2d9ae66d02 splash_pcx: Remove unused variables. 2022-04-07 17:01:29 -07:00
John Baldwin
bdfc2fc0c4 pcm mss: Quiet unused variable warnings.
- Remove dummy variable for a register read.  Keep the register
  read despite the dubious comment.

- Move all references to set_res under #if 0.
2022-04-07 17:01:29 -07:00
John Baldwin
eda611e45e pcm via82c686: Remove unused variables. 2022-04-07 17:01:29 -07:00
John Baldwin
11fd7ec044 pcm hdspe: Remove unused variable. 2022-04-07 17:01:29 -07:00
John Baldwin
92e7c96648 pcm envy24: Remove some dead code and associated unused variables.
The dead code was commented out in the initial import and hasn't
changed since.
2022-04-07 17:01:29 -07:00
John Baldwin
0025422091 pcm emu10k1: Remove dead code in channel_setblocksize callbacks. 2022-04-07 17:01:29 -07:00
John Baldwin
3e4aa9c629 pcm atiixp: Remove dead variable.
The Linux driver clears ATI_REG_CMD_AC_RESET and sets
ATI_REG_CMD_POWERDOWN, so writing the calculated value that sets both
would seem to be wrong.  This could be updated to match Linux's
behavior, but instead I've just left it as-is.
2022-04-07 17:01:28 -07:00
John Baldwin
771e4a8613 smbfs: Remove unused variable. 2022-04-07 17:01:28 -07:00
John Baldwin
9fe2867ce4 smbfs_rename: Move all references to flags under #ifdef notnow. 2022-04-07 17:01:28 -07:00
John Baldwin
3797f43e91 sgx: Remove unused variable. 2022-04-07 17:01:28 -07:00
John Baldwin
74f1cd7bd6 sfxge: Remove unused variables. 2022-04-07 17:01:28 -07:00
John Baldwin
50e3b6aa48 rtwn: Restore RF_ENV control type after initializing RF.
Both rwlwifi in Linux and rtwn in OpenBSD restore this register,
and the existing code was saving the value and not using it.

Reported by:	-Wunused-but-set-variable
Reviewed by:	imp
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D34838
2022-04-07 17:01:28 -07:00
John Baldwin
6d0a82ffc7 krping: Remove unused variable. 2022-04-07 17:01:28 -07:00
John Baldwin
5bf982c162 qlxge: Remove unused variables. 2022-04-07 17:01:28 -07:00
John Baldwin
9fa72d33d9 qlxgbe: Remove unused variables. 2022-04-07 17:01:28 -07:00
John Baldwin
10e3e53dd4 qlxgbe: Use select_value_count variable. 2022-04-07 17:01:28 -07:00
John Baldwin
ec86afafbb qlxgb: Remove unused variables. 2022-04-07 17:01:28 -07:00
John Baldwin
c9bbf99be0 qlnx: Disable unused by set warnings for ecore_ll2.c.
The OSAL_SPIN_LOCK_IRQSAVE macros take a flags argument that is unused
on FreeBSD (but used on other platforms).
2022-04-07 17:01:28 -07:00
John Baldwin
eb147f78a4 qlnx: Mark variables only used in debug traces as unused. 2022-04-07 17:01:28 -07:00
John Baldwin
ee07d71213 qlnx: Return error from qlnxr_mod_load if it fails.
Fix qlnx_rdma_register_if return ENXIO rather than -1 on error and
propagate that error to the caller in qlnxr_mod_load.
2022-04-07 17:01:27 -07:00
John Baldwin
885db9301e qlnx: Comment out remaining references to tx_data_bd. 2022-04-07 17:01:27 -07:00
John Baldwin
3415775dfa qlnx: Move all references to total_rx_count under #ifdef QLNX_SOFT_LRO. 2022-04-07 17:01:27 -07:00
John Baldwin
91aa93eb67 qlnx: Remove unused variables. 2022-04-07 17:01:27 -07:00
John Baldwin
c0ca75b0db otus: Return computed error value instead of ENXIO from otus_raw_xmit. 2022-04-07 17:01:27 -07:00
John Baldwin
afda855350 ocs: Remove unused variable. 2022-04-07 17:01:27 -07:00
John Baldwin
19c099a866 oce: Remove unused variables. 2022-04-07 17:01:27 -07:00
John Baldwin
395975eaed nvdimm: Remove unused variable. 2022-04-07 17:01:27 -07:00
John Baldwin
f44692ce0c ng_tag: Move totlen fully under #ifdef NG_TAG_DEBUG. 2022-04-07 17:01:27 -07:00
John Baldwin
8373c80503 ng_ppp: Remove unused variable. 2022-04-07 17:01:27 -07:00
John Baldwin
ad490a5aeb ng_netflow: Remove unused variable. 2022-04-07 17:01:27 -07:00
John Baldwin
a11819ca1f ng_lmi: Move all of highest_dlci under #if 0. 2022-04-07 17:01:27 -07:00
John Baldwin
497c2cf4f8 ng_ksocket: Remove unused variable. 2022-04-07 17:01:27 -07:00
John Baldwin
9f566782e0 ng_bt: Remove an unused variable.
Leave a comment describing the field in the packet it represented.
2022-04-07 17:01:26 -07:00
John Baldwin
3f0871d7fc ngatm: Expand #if 0 to cover all lines involving mlen. 2022-04-07 17:01:26 -07:00
John Baldwin
b08a56ad46 mxgbe: Remove a dummy variable used to force a register read.
Keep the register read by casting the result of the pointer indirect
to void.
2022-04-07 17:01:26 -07:00
John Baldwin
71a2364fa2 mthca: Mark a variable used only in debug traces as unused. 2022-04-07 17:01:26 -07:00
Alfredo Dal'Ava Junior
0b1b30d664 nfs: do not panic on bootpc_init when no interfaces are found
Replaces panic with a warning message to allow kernel continue
when no bootp eligible network interfaces are found.

This avoids having to build a custom kernel when using a local root
file system on targets like powerpcspe that expects bootp/NFS by
default.

Reviewed by:	rmacklem
MFC after:	2 weeks
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D34567
2022-04-07 19:33:26 -03:00
Bjoern A. Zeeb
9df5f29caf LinuxKPI: skbuff: handle dev_alloc_skb() correctly
dev_alloc_skb() comapred to alloc_skb() reserves some headroom
at the beginning of the skb which is used by drivers.
Split the code for the two cases and reserve NET_SKB_PAD space,
which should at least be 32 octets.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-04-07 20:55:53 +00:00
Bjoern A. Zeeb
7354782698 net80211: improve error handling from ieee80211_parse_beacon()
Following up on fb8c87b4f3, which was
supposed to go into all supported branches, increase ieee80211_scanparams
status field from 8bit to 32bit (enum size) and add a dedicated error
code for Mesh ID.

Sponsored by:	The FreeBSD Foundation
2022-04-07 20:50:39 +00:00
John Baldwin
ebb16d5e93 mlx5: Pass the correct data pointer to the add_dst_cb instead of NULL.
Reported by:	-Wunused-but-set-variable
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D34812
2022-04-07 10:46:48 -07:00
John Baldwin
3cebca152b bnhd: Write out updated resource dependencies from the table.
The driver parsed the table to update the relevant resource map
registers, but failed to write the new register value after computing
it.

Reported by:	-Wunused-but-set-variable
Reviewed by:	landonf, imp
Differential Revision:	https://reviews.freebsd.org/D34814
2022-04-07 10:46:19 -07:00
Michael Tuexen
d7224a53b3 sctp: remove a mutex not used anymore
MFC after:	3 days
2022-04-07 17:54:57 +02:00
Michael Tuexen
3c3d77bdff sctp: use variable names in a consistent way
No functional change intended.

MFC after:	3 days
2022-04-07 17:51:31 +02:00
Mitchell Horne
8a0339e679 riscv: eliminate physmap global
Since physical memory management is now handled by subr_physmem.c, the
need to keep this global array has diminished. It is not referenced
outside of early boot-time, and is populated by physmem_avail() in
pmap_bootstrap(). Just allocate the array on the stack for the duration
of its lifetime.

The check against physmap[0] in initriscv() can be dropped altogether,
as there is no consequence for excluding a memory range twice.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34778
2022-04-07 12:26:59 -03:00
Kristof Provost
be461cdfb3 pf syncookies: fix memory leak
We forgot to free the nvlist (and packed nvlist) on success.
While here start using the ERROUT macro to clean up error handling, and
to add SDTs for better debugging.

Reported by:	Coverity
CID:		1473150
2022-04-07 14:51:52 +02:00
Kristof Provost
0bd468ea3f pf: fix memory leak
The nvlist is allocated in pf_keth_rule_to_nveth_rule(). There's no need
to allocate one in the calling function. Especially not as we overwrite
the pointer to the new nvlist with the one allocated by
pf_keth_rule_to_nveth_rule(), leaking memory.

Reported by:	Coverity
CID:		1476128
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-07 14:51:52 +02:00
Andrew Turner
41e6d2091c Enable subr_physmem_test on supported architectures
Only build where it's supported.

While here add support for amd64 to help with testing.

Sponsored by:	The FreeBSD Foundation
2022-04-07 14:31:51 +01:00
Tom Jones
1241e8e7ae siftr: expose t_flags2 in siftr output
Replace the old snd_bwnd field which was kept for compatibility with the
t_flags2 field from the tcpcb. This exposes in siftr logs interesting
things such as ECN, PLPMTUD, Accurate ECN and if first bytes are
complete.

Reviewed by:	rscheff (transport), chengc_netapp.com,  debdrup (manpages)
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
X-NetApp-PR:    #73
Differential Revision:	https://reviews.freebsd.org/D34672
2022-04-07 10:17:09 +01:00
John Baldwin
8af2421956 lio: Quiet set but unused warnings.
- Remove unused variables.

- Mark a value only used in debug traces as unused.

- Remove variables only used for device register reads with
  side-effects with void casts on the read.
2022-04-06 16:45:29 -07:00
John Baldwin
6454d0c8cb libalias: Remove unused variables. 2022-04-06 16:45:29 -07:00
John Baldwin
3f6d3f0285 alias_nbt: Move debug-only variable under #ifdef LIBALIAS_DEBUG. 2022-04-06 16:45:29 -07:00
John Baldwin
89293939de kgssapi krb5: Remove unused variables. 2022-04-06 16:45:29 -07:00
John Baldwin
c1710eaf32 ix: Mark variables only used in debug traces as unused. 2022-04-06 16:45:29 -07:00
John Baldwin
bf73b06771 ip6_mroute: Mark a variable only used in a debug trace as unused. 2022-04-06 16:45:29 -07:00
John Baldwin
db3603ff09 ibcore: Disable set but unused warnings. 2022-04-06 16:45:29 -07:00
John Baldwin
4dab99b936 ena: Remove unused variable. 2022-04-06 16:45:28 -07:00
John Baldwin
551feba18c sc vga: Remove unused variables.
Cast the return value of intentional dummy reads to void.
2022-04-06 16:45:28 -07:00
John Baldwin
c0a1391aa6 ixl: Remove unused variables. 2022-04-06 16:45:28 -07:00
John Baldwin
ee28ad11b7 iavf: Quite set but not used warnings.
Move declaration of dev in iavf_if_attach_post under #ifdef IXL_DEBUG.

Remove unused ifp in iavf_stop.
2022-04-06 16:45:28 -07:00
John Baldwin
46adc7fad3 axgbe: Remove unused variable in axgbe_msix_que.
Keep the register read just in case though it seems possible it is not
needed as the function later clears specific interrupts via a write to
the same register.
2022-04-06 16:45:28 -07:00
John Baldwin
354ef278e9 powernow(4): Fix unused variable warnings by using the variables. 2022-04-06 16:45:28 -07:00
John Baldwin
d68cc5a839 isci: Disable set but unused warnings. 2022-04-06 16:45:28 -07:00
John Baldwin
bbfec32d15 isci: Propagate error from bus_dma_tag_create.
Return error from isci_controller_allocate_memory if bus_dma_tag_create
fails instead of ignoring the error.
2022-04-06 16:45:28 -07:00
John Baldwin
b024faffa0 hyperv storvsc: Remove unused variables. 2022-04-06 16:45:28 -07:00
John Baldwin
583df2db5c bxe: Quiet set but not used warnings.
Comment out other references to more_tx since the only use is commented out.

Remove unused is_parity variable.
2022-04-06 16:45:28 -07:00
John Baldwin
9b0eb55048 psm: Remove write-only variables. 2022-04-06 16:45:28 -07:00
John Baldwin
6301649e0e mlx5: Remove write-only variables. 2022-04-06 16:45:28 -07:00
John Baldwin
8b6ccfb6c7 multicast code: Quiet unused warnings for variables used for KTR traces.
For nallow and nblock, move the variables under #ifdef KTR.

For return values from functions logged in KTR traces, mark the
variables as __unused rather than having to #ifdef the assignment of
the function return value.
2022-04-06 16:45:28 -07:00
John Baldwin
f7236dd068 change_mpath_route: Remove write-only nh variable.
While here, cleanup the style of the function prologue by moving an
assignment out of the middle of two variable declaration blocks.
2022-04-06 16:45:28 -07:00
John Baldwin
371c917b0b unlink_nhgrp: Remove write-only variable.
Possibly one could assert that ret should always be 0 here (that is,
that there was always an index found in the bitmask).  That should be
true since a bitmask index is allocated before the nhgrp is inserted
in the ctl->gr_head list in link_nhgrp.
2022-04-06 16:45:27 -07:00
John Baldwin
7650d4b67e xen netback: Remove write-only variables. 2022-04-06 16:45:27 -07:00
John Baldwin
92ca0e81b8 pvscsi_adapter_reset: Mark val as unused.
This variable is unsed in a debug trace conditional on a private
debugging macro (so not eligible for __diagused).
2022-04-06 16:45:27 -07:00
John Baldwin
8c3923ae2f uhci: Remove write-only variable. 2022-04-06 16:45:27 -07:00
John Baldwin
4afc92cd6e ac97_initmixer: Remove write-only variables. 2022-04-06 16:45:27 -07:00
John Baldwin
546629073d cmi: Mark rsp as unused.
If the DEB macro is manually enabled to enable tracing then this
variable is used.  This doesn't use __diagused since it is dependent
on a non-standard debugging macro.
2022-04-06 16:45:27 -07:00
John Baldwin
30cac8e3bb ppc: Fix set but not used warnings on !i386.
Move fetch of SYS_RES_IOPORT resource and associated variables under
existing #ifdef __i386__.
2022-04-06 16:45:27 -07:00
John Baldwin
d31850654e iwn: Remove write-only extra variable.
extra is used in a commented-out expression to compute
scan_service_time.  Use #if 0 instead of a comment for the disabled
scan_service_time expression and move the unused computation of extra
under the same #if.
2022-04-06 16:45:27 -07:00
John Baldwin
99f65e9198 iwi: Remove write-only status variable.
Skip over unused field from asresp frame header.
2022-04-06 16:45:27 -07:00
John Baldwin
89abc0fbbd x86 bounce_bus_dma_tag_destroy: Silence set but unused warning. 2022-04-06 16:45:27 -07:00
Alan Somers
3227325366 fusefs: fix two bugs regarding VOP_RECLAIM of the root inode
* We never send FUSE_LOOKUP for the root inode, since its inode number
  is hard-coded to 1.  Therefore, we should not send FUSE_FORGET for it,
  lest the server see its lookup count fall below 0.

* During VOP_RECLAIM, if we are reclaiming the root inode, we must clear
  the file system's vroot pointer.  Otherwise it will be left pointing
  at a reclaimed vnode, which will cause future VOP_LOOKUP operations to
  fail.  Previously we only cleared that pointer during VFS_UMOUNT.  I
  don't know of any real-world way to trigger this bug.

MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D34753
2022-04-06 16:16:52 -06:00
Kirk McKusick
4710aa248b Avoid dereferencing a possibly null pointer.
Reported by: Coverity
CID:         1475868
2022-04-06 14:25:55 -07:00
Navdeep Parhar
c5a7885c80 cxgbe(4): Display the number of free PM pages and p-structs in meminfo.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-04-06 13:15:26 -07:00
Navdeep Parhar
f88b31885c cxgbe(4): meminfo should get the TLS region's limits from the hardware.
meminfo is meant for debugging and it should read hardware configuration
directly when possible instead of relying on values queried from the
firmware.  Rename the region to "TLSKey region" to match other drivers
while here.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-04-06 13:15:25 -07:00
Navdeep Parhar
9983e5cce6 cxgbe(4): Fix the sorting order of the regions listed in meminfo.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-04-06 13:15:25 -07:00
Kristof Provost
bef7104571 pf: use ERROUT_IOCTL()
Use ERROUT_IOCTL() rather than hand-rolling the macro. This adds DTrace
SDTs in the error path, making debugging ioctl errors easier.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-06 16:51:31 +02:00
Gordon Bergling
f64919bbd9 ng_btsocket(4): Fix a typo in an error message
- s/mulitplexor/multiplexor/

MFC after:	5 days
2022-04-06 18:27:29 +02:00
Dmitry Chagin
0938d04a2c linux(4): Fix a typo in itimerspec conversion routine.
MFC after:	3 days
2022-04-06 17:40:00 +03:00
Andrew Turner
d8bff5b67c Handle non-page aligned/sized memory in physmem
In some configurations the firmware may pass memory regions that are
not page sized or aligned, e.g. when using 16k pages on arm64. If this
is the case we will calculate many small regions because the alignment
is applied before being inserted. As we round the start up and end down
this will leave a 1 page hole between what should have been a single
region.

Fix by keeping the original alignment until we are just about to insert
the region into the avail array.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34694
2022-04-06 14:13:29 +01:00
Andrew Turner
8c99dfed54 Port subr_physmem to userspace and add tests
These give us some confidience we haven't broken anything in early
boot code that may be running before the console.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34691
2022-04-06 14:13:05 +01:00
Andrew Turner
3532bcd282 Fix a coherent bus check in the arm64 busdma
In the arm64 busdma we have an internal flag to signal when a tag is
for a cache-coherent device. In this case we don't need to adjust the
size and alignment of allocated buffers to be within a cache line.

The cache line adjustment was incorrectly using the coherent flag
passed in to bus_dma_tag_create and not the internal flag. Fix it to
use the latter to reduce the memory usage slightly.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34763
2022-04-06 14:11:12 +01:00
Andrew Turner
bcd763b642 Move the arm64 DMAP creation to C
To simplify the creation of the direct map (DMAP) region on arm64 move
it from the pre-C code into pmap. This simplifies the DMAP creation
as we can use the notmal index macros, and should reduce the number
of pages needed to hold the level 1 tables to just those needed.

Reviewed by:	alc, dch
Tested by:	dch, kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34568
2022-04-06 14:09:49 +01:00
Warner Losh
28ea3785d9 neta: remove write only variable
Sponsored by:		Netflix
2022-04-05 21:42:06 -06:00
Warner Losh
37466424b2 mxge: Remove write only variables, mark ifp __unused
Sponsored by:		Netflix
2022-04-05 21:42:06 -06:00
Warner Losh
7e5c042cce msk: Remove write only variables, but leave hardware reads in place
Sponsored by:		Netflix
2022-04-05 21:42:06 -06:00
Warner Losh
85ecba9b20 mwl: Remove write only variables, but leave hardware reads in place
Sponsored by:		Netflix
2022-04-05 21:42:06 -06:00
Warner Losh
fba6f8efb6 malo: Remove write only variables, but leave hardware reads in place
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
d483782ecf intpm: Remove write only variables, tag slvcnt unused since it's used for debugging
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
8707108f33 ipmi: Remove write only variables used to read form hardware
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
1545c66789 hwpmc_arm64: remove write only variables and the computations they do
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
20669405d2 flexspi: In flex_spi_task remove dev, it's write only
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
094b2a2379 ena: Remove write only variables
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
5f5986656c cas: Mark work3 as unused: we apparently need to read it from hardware, but ignore its value
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
2f3b67560a zstd: Supress set but unused warnings for zstd_compress_superblock.c
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Warner Losh
4c30b9ecd4 fix integer overflow bugs in *stosbt
68f57679d6 Fixed another class of integer overflows, but introduced a
boundary condition for 2-4s in ns conversion, 2-~4000s in us conversions
and 2-~4,000,000s in ms conversions. This was because we bogusly used
SBT_1S for the notion of 1 second, instead of the appropriate power of
10. To fix, just use the appropriate power of 10, which avoids these
overflows.

This caused some sleeps in ZFS to be on the order of an hour.

MFC:			1 day
PR:			263073
Sponsored by:		Netflix
Reviewed by:		asomers
Differential Revision:	https://reviews.freebsd.org/D34790
2022-04-05 21:36:59 -06:00
Bjoern A. Zeeb
fb8c87b4f3 net80211: validate Mesh ID length in ieee80211_parse_beacon
Reported by:	m00nbsd working with Trend Micro Zero Day Initiative
2022-04-05 22:58:28 +00:00
Robert Wing
e8e691983b suppress set but not used warnings for kernel builds
Use -Wno-unused-but-set-variable for kernel builds with clang13.

To turn this warning back on, set the following in src.conf:
    WITH_SET_BUT_NOTUSED_KERNEL_WARNINGS=

Reviewed by:	mjg, imp
Differential Revision:	https://reviews.freebsd.org/D34784
2022-04-05 13:34:34 -08:00
Warner Losh
56cc89585d bcm5874: Add opt_usb.h for module dependency
Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Warner Losh
a66a3994aa cc: Add opt_kern_tls.h to all congestion modules
All congestion controll modules need opt_kern_tls.h, make sure it's
listed everywhere.

Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Warner Losh
b111430e54 mii: Add opt_platform.h to all miibus drivers
miivar.h includes opt_platform.h. Make sure all the drivers that use the
miibus_if.h interface file have opt_platform.h as well. While some of
these may not, strictly speaking, need it, it's easier to include it
universally for miibus.

Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Warner Losh
ff8d9d9c56 config.mk: Add opt_platform.h support
opt_platform.h is now included from miivar.h, so add support for
generating it in the standalone build case.

Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Warner Losh
5035b5f5b0 bwi: Mark write-only variable as __unused
We read TX_STATUS1 to acknowledge a TX interrupt. We don't use this
value for anything, so mark it as unused. We may be able to eliminate
this read, but since this hardware is poorly documented and difficult to
test, I'm leaving the read in place.

Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Warner Losh
6e5056a903 bwi: Remove write-only variable
bbp_atten is write-only: we don't use it later in
bwi_rf_calc_nrssi_slope_11b. However, we may also be able to eliminate
the read of this value from the device. However, The documationation for
this hardware is thing and I can't test this card so I've left the read
of this register in case it's required.

Sponsored by:		Netflix
2022-04-05 13:52:54 -06:00
Warner Losh
cbf7b9e6ee bce: Mark a few debugging variables as unused.
Sponsored by:		Netflix
2022-04-05 13:52:54 -06:00
Mitchell Horne
eb9d205fa6 livedump: add event handler hooks
Add three hooks to the livedump process: before, after, and for each
block of dumped data. This allows, for example, quiescing the system
before the dump begins or protecting data of interest to ensure its
consistency in the final output.

Reviewed by:	markj, kib (previous version)
Reviewed by:	debdrup (manpages)
Reviewed by:	Pau Amma <pauamma@gundo.com> (manpages)
MFC after:	3 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34067
2022-04-05 15:35:05 -03:00
Mitchell Horne
c9114f9f86 Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a
file-backed vnode.

Unlike existing disk or network dumpers, the vnode dumper should not be
invoked during a system panic, and therefore is not added to the global
dumper_configs list. Instead, the vnode dumper is constructed ad-hoc
when a live dump is requested using the new ioctl on /dev/mem. This is
similar in spirit to a kgdb session against the live system via
/dev/mem.

As described briefly in the mem(4) man page, live dumps are not
guaranteed to result in a usuable output file, but offer some debugging
value where forcefully panicing a system to dump its memory is not
desirable/feasible.

A future change to savecore(8) will add an option to save a live dump.

Reviewed by:	markj, Pau Amma <pauamma@gundo.com> (manpages)
Discussed with:	kib
MFC after:	3 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D33813
2022-04-05 15:35:05 -03:00
Mitchell Horne
59c27ea18c Split out dumper allocation from list insertion
Add a new function, dumper_create(), to allocate a dumper.
dumper_insert() will call this function and retains the existing
behaviour.

This is desirable for performing live dumps of the system. Here, there
is a need to allocate and configure a dumper structure that is invoked
outside of the typical debugger context. Therefore, it should be
excluded from the list of panic-time dumpers.

free_single_dumper() is made public and renamed to dumper_destroy().

Reviewed by:	kib, markj
MFC after:	1 week
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34068
2022-04-05 15:35:05 -03:00
Warner Losh
393b7606f9 Unbreak the build: Also define NFSV42_OLDNPROCS here.
If nfsproto.h is included before nfsport.h, then NFSV42_OLDNPROCS would
be undefined when it is used in struct nfsstatsov1.

Sponsored by:		Netflix
2022-04-05 11:54:20 -06:00
Rick Macklem
330aa8acde nfscl: Add support for a NFSv4 AppendWrite RPC
For IO_APPEND VOP_WRITE()s, the code first does a
Getattr RPC to acquire the file's size, before it
can do the Write RPC.

Although NFS does not have an append write operation,
an NFSv4 compound can use a Verify operation to check
that the client's notion of the file's size is
correct before doing the Write operation.

This patch prepares the NFSv4 client for such an
RPC, which will be added in a future commit.

This patch does not cause any semantics change.
2022-04-05 08:11:37 -07:00
Chandrakanth Patil
79c4c4be96 mrsas: if controller reset is in progress, refrain from firing DCMDs to
firmware in shutdown

If controller reset is in progress, at same time if system shutdown is
issued then corresponding shutdown function in driver will be invoked
where driver is waiting 15 seconds to complete the controller reset.

If the reset is not complteted within that time frame driver will go
ahead and fire cache flush and shutdown DCMDs which will end up
accessing the the queues which are not initialized due to undergoing
reset leads to FMU error in firmware.

Fix:
In shutdown function, if controller reset is not finished within 15
seconds than driver will return to the OS without firing any DCMDs.

Reviewed by: imp
PR: 261375
2022-04-05 08:38:15 -06:00
Chandrakanth Patil
241bb95552 mrsas: remove additional MPT command allocation for R1 FP command
There is an additional MPT command allocation for R1 fp command which
will lead to MPT command unavailablity in case of rigorous R1 FP IOs.

Remove additional MPT command allocation for R1 FP.

Reviewed by: imp
PR: 261377
2022-04-05 08:38:14 -06:00
Michael Tuexen
ccdfd621d0 tcp cc: don't recurse on non recursive mutex
This issue was found by syzkaller.

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D34743
2022-04-05 13:52:36 +02:00
Warner Losh
132b00f906 linuxkpi: move io_mapping_create_wc to .c
Move io_mapping_create_wc to .c because it encodes the size of struct
io_mapping so we move this from the client module to the linuxkpi
module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34776
2022-04-04 23:06:37 -06:00
Warner Losh
2bf3361d56 linuxkpi: Move lkpi_pcim_iomap_devres_find to .c file
lkpi_pcim_iomap_devres_find encodes the size of struct pcim_iomap_devres
in the code, so move from .h to .c to move from client driver to
linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34775
2022-04-04 23:06:29 -06:00
Warner Losh
36b5c44002 linuxkpi: Move pci_alloc_irq_vectors to .c file
pci_alloc_irq_vectors encodes the size of struct msix_entry
into its code. Move from .h to .c to move this knowledge from
client modules to linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34774
2022-04-04 23:06:21 -06:00
Warner Losh
1cdb25340f linuxkpi: Move pci_request_region and _lkpi_pci_iomap into .c
Both pci_request_region and _lkpi_pci_iomap encode the size of struct
pci_mmio_region into their code. Move from .h to .c files to move that
knowledge from the client drivers into the linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34773
2022-04-04 23:06:14 -06:00
Warner Losh
3ea682e21e linuxkpi: Move lkpi_pci_devres_get_alloc into .c file
lkpi_pci_devres_get_alloc encodes the struct pci_devres into its
code. Move from .h file to .c file to move this knowledge into linuxkpi
module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34772
2022-04-04 23:06:06 -06:00
Warner Losh
aca0bcbca3 linuxkpi: Move cdev_alloc into .c file
Move cdev_alloc into linux_compat.c since it encodes the size of struct
linux_cdev into the client modules otherwise.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34771
2022-04-04 23:05:59 -06:00
Warner Losh
58e6719ca0 linuxkpi: Remove write only variable from lkpi_iicbb_reset
Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34770
2022-04-04 23:05:52 -06:00
Warner Losh
1341ac9f9c linuxkpi: Move class_create to .c file
class_create encodes the size of struct class into the generated
code. Move from .h file to .c file to move this knowledge from the
client modules that call this into the linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34769
2022-04-04 23:05:43 -06:00
Warner Losh
702b687503 linuxkpi: Move device_create_groups_vargs to linux_compat.c
device_create_groups_vargs encodes the size of struct device. Move
definition from .h to .c to move this size into the linuxkpi module
rather than encoding it in all client driver modules.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34768
2022-04-04 23:05:36 -06:00
Warner Losh
36929b5584 linuxkpi: move kobject_create to .c file
kobject_create knows the size of struct kobject. Move it to
linux_compat.c so this knowledge is confined to the loadable module and
not the clients.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34767
2022-04-04 23:05:26 -06:00
Warner Losh
6e671ec1e6 svc_vc_rendezvous_stat: eliminiate write only variable stat
Sponsored by:		Netflix
2022-04-04 22:31:04 -06:00
Warner Losh
77bc5890ad clnt_vc_destroy: eliminiate write only variable stat
Sponsored by:		Netflix
2022-04-04 22:31:02 -06:00
Warner Losh
5c2aad7e89 krpc_call: eliminiate write only variable nam
Sponsored by:		Netflix
2022-04-04 22:31:00 -06:00
Warner Losh
b64a484592 bootpc_decode_reply: eliminiate write only variable ip
Sponsored by:		Netflix
2022-04-04 22:30:59 -06:00
Warner Losh
d6f6985494 smb_smb_treedisconnect: eliminate write only variable mbp
Sponsored by:		Netflix
2022-04-04 22:30:57 -06:00
Warner Losh
65ee334d11 smb_iod_main: eliminate write only variable error
Sponsored by:		Netflix
2022-04-04 22:30:54 -06:00
Warner Losh
c7761ca93e pim6_input: eliminate write only variable rc
Sponsored by:		Netflix
2022-04-04 22:30:52 -06:00
Warner Losh
e606e5d157 sysctl_dumpentry: move error to inner scope
Sponsored by:		Netflix
2022-04-04 22:30:50 -06:00
Warner Losh
5de5b5a34d route_ctl: eliminate write only variables ifa and nh
Sponsored by:		Netflix
2022-04-04 22:30:48 -06:00
Warner Losh
7f9c3339a4 get_nhop: eliminate write only variable gateway
Sponsored by:		Netflix
2022-04-04 22:30:47 -06:00
Warner Losh
c972f2c065 xl_attach: eliminate write only variable unit
Sponsored by:		Netflix
2022-04-04 22:30:45 -06:00
Warner Losh
76e9675663 vtpci_legacy_register_msix: eliminate write only variable dev
Sponsored by:		Netflix
2022-04-04 22:30:42 -06:00
Warner Losh
7a1bef40f1 ustorage_fs_verify: eliminate write only variables file_offset and file_offset
Sponsored by:		Netflix
2022-04-04 22:30:40 -06:00
Warner Losh
f7097359c8 mgue: eliminate write only variables ret, err and error
Sponsored by:		Netflix
2022-04-04 22:30:38 -06:00
Warner Losh
11110685fc cp2112iic_intr_write_callback: eliminate write only variable psc
Sponsored by:		Netflix
2022-04-04 22:30:36 -06:00
Warner Losh
53c1f1fc60 wsp_intr_callback: eliminate write only variable h
Sponsored by:		Netflix
2022-04-04 22:30:33 -06:00
Warner Losh
12312f7583 uss820dci: eliminate unused variables sc, ep_no
Sponsored by:		Netflix
2022-04-04 22:30:31 -06:00
Warner Losh
6ccdcae1b9 uhci_xfer_setup: eliminate write only variable sc
Sponsored by:		Netflix
2022-04-04 22:30:29 -06:00
Warner Losh
ab59cd6a0b musb: eliminate write only variable sc
Sponsored by:		Netflix
2022-04-04 22:30:26 -06:00
Warner Losh
e73b02f66b atmegadci: eliminate unused variables sc, ep_no
Sponsored by:		Netflix
2022-04-04 22:30:23 -06:00
Warner Losh
ad1b7fd714 hdspe_dmapsetmap: eliminate write only variable sc
Sponsored by:		Netflix
2022-04-04 22:30:22 -06:00
Warner Losh
c8fe3923d8 quicc_bus_setsig: eliminate write only variable bas
Sponsored by:		Netflix
2022-04-04 22:30:20 -06:00
Warner Losh
557627dda9 hdaa_eld_dump: eliminate write only variable len
Sponsored by:		Netflix
2022-04-04 22:30:17 -06:00
Warner Losh
8717135d37 emu10kx: eliminate write only variables val, r and move i to loop
Sponsored by:		Netflix
2022-04-04 22:30:13 -06:00
Warner Losh
451f54707a emu10kx-pci: eliminate write only variable r
Sponsored by:		Netflix
2022-04-04 22:30:11 -06:00
Warner Losh
7387abd342 emu_midi_probe: eliminate write only variable r
Sponsored by:		Netflix
2022-04-04 22:30:09 -06:00
Warner Losh
33985865b2 pcmcsa_attach: eliminate write only variable unit
Sponsored by:		Netflix
2022-04-04 22:30:07 -06:00
Warner Losh
3e423419cf midicsa_attach: eliminate write only variable func
Sponsored by:		Netflix
2022-04-04 22:30:06 -06:00
Warner Losh
0c64fe0068 cs4281: eliminate write only variable codecno
Sponsored by:		Netflix
2022-04-04 22:30:04 -06:00
Warner Losh
635a4068d2 sb_probe: eliminate write only variable r
Sponsored by:		Netflix
2022-04-04 22:30:02 -06:00
Warner Losh
668986eae9 sb16_probe: eliminate write only variable r
Sponsored by:		Netflix
2022-04-04 22:30:01 -06:00
Warner Losh
3a7365acc8 ess_probe: eliminate write only variable r
Sponsored by:		Netflix
2022-04-04 22:29:59 -06:00
Warner Losh
c9439e23ce sis_attach: Move waittime definition into for loop
Sponsored by:		Netflix
2022-04-04 22:29:57 -06:00
Warner Losh
94885fbd04 ppc_detect_fifo: eliminate write only variable cc
Sponsored by:		Netflix
2022-04-04 22:29:55 -06:00
Warner Losh
de80fb0ace ppi_probe: eliminate unused variable ppi
Sponsored by:		Netflix
2022-04-04 22:29:53 -06:00
Warner Losh
09b966ee7c Mark cfg as __unused to avoid ifdef soup
Sponsored by:		Netflix
2022-04-04 22:29:51 -06:00
Warner Losh
273676a44c mxge_rss_ethp_z8e_fw_modevent: eliminate write only variable parent
Sponsored by:		Netflix
2022-04-04 22:29:49 -06:00
Warner Losh
5f136a4c01 mxge_rss_eth_z8e_fw_modevent: eliminate write only variable parent
Sponsored by:		Netflix
2022-04-04 22:29:47 -06:00
Warner Losh
886bc93da8 mxge_ethp_z8e_fw_modevent: eliminate write only variable parent
Sponsored by:		Netflix
2022-04-04 22:29:45 -06:00
Warner Losh
498276b4b4 mxge_eth_z8e_fw_modevent: eliminate write only variable parent
Sponsored by:		Netflix
2022-04-04 22:29:43 -06:00
Warner Losh
f8967810f5 mge: eliminate write only variables ifp, sc and error
Sponsored by:		Netflix
2022-04-04 22:29:41 -06:00
Warner Losh
2d4ae2ed36 tmp461_signed_extend32 is unused, remove it
Sponsored by:		Netflix
2022-04-04 22:29:39 -06:00
Warner Losh
875145ffd4 rx8803_settime: remove write only variable bus
Sponsored by:		Netflix
2022-04-04 22:29:38 -06:00
Warner Losh
22127c7c1b tca6416: remove write only sc
Sponsored by:		Netflix
2022-04-04 22:29:36 -06:00
Warner Losh
8a46fc9a9b armv7_allocate_pmc: remove write only variable pac
Sponsored by:		Netflix
2022-04-04 22:29:34 -06:00
Warner Losh
6ca6b8ea52 pmc_save_user_callchain: eliminate write only td variable
Sponsored by:		Netflix
2022-04-04 22:29:33 -06:00
Warner Losh
92ec9782ac hpen_battery_strenght_cb: eliminate write only data variable
Sponsored by:		Netflix
2022-04-04 22:29:31 -06:00