Commit Graph

277880 Commits

Author SHA1 Message Date
Gleb Smirnoff
c00605751e tcp: remove a dead code leftover from T/TCP,
that doesn't have any value today.
2022-08-29 19:30:12 -07:00
Gleb Smirnoff
8fc8063849 divert: merge div_output() into div_send()
No functional change intended.
2022-08-29 19:15:01 -07:00
Gleb Smirnoff
244e1aeaec domains: merge domain_init() into domain_add()
domain_init() called at SI_SUB_PROTO_DOMAIN/SI_ORDER_SECOND is always
called right after domain_add(), that had been called at SI_ORDER_FIRST.
Note that protocols aren't initialized yet at this point, since they are
usually scheduled to initialize at SI_ORDER_THIRD.

After this merge it becomes clear that DOMF_SUPPORTED / DOMF_INITED
can be garbage collected as they are set & checked in the same function.

For initialization of the domain system itself it is now clear that
domaininit() can be garbage collected and static initializer is enough.
2022-08-29 19:15:01 -07:00
Gleb Smirnoff
e18c5816ea domains: use queue(9) SLIST for linked list of domains 2022-08-29 19:15:01 -07:00
Gleb Smirnoff
d7574c7432 domains: init pr_domain in pr_init() 2022-08-29 19:15:01 -07:00
Gleb Smirnoff
c414347bc5 mbufs: isolate max_linkhdr and max_protohdr handling in the mbuf code
o Statically initialize max_linkhdr to default value without relying
  on domain(9) code doing that.
o Statically initialize max_protohdr to a sane value, without relying
  on TCP being always compiled in.
o Retire max_datalen. Set, but not used.
o Don't make the domain(9) system responsible in validating these
  values and updating max_hdr.  Instead provide KPI max_linkhdr_grow()
  and max_protohdr_grow().
o Call max_linkhdr_grow() from IEEE802.11 and max_protohdr_grow() from
  TCP.  Those are the only protocols today that may want to grow.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D36376
2022-08-29 19:14:25 -07:00
John Baldwin
bb31aee26b bhyve virtio-scsi: Avoid out of bounds accesses to guest requests.
- Ignore I/O requests with insufficiently sized input or output
  buffers (those not containing compete request headers).

- Ignore control requests with improperly sized buffers.

- While here, explicitly zero the output header of an I/O request to
  avoid leaking malloc garbage from the host if the header is not
  fully populated.

PR:		264521
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	mav, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36271
2022-08-29 15:37:27 -07:00
John Baldwin
62806a7f31 bhyve virtio-scsi: Tidy warning and debug prints.
Use a consistent prefix ("virtio-scsi: ") similar to the e1000 device
model.

Reviewed by:	mav, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36270
2022-08-29 15:37:15 -07:00
John Baldwin
7afe342dcb bhyve e1000: Sanitize transmit ring indices.
When preparing to transmit pending packets, ensure that the head (TDH)
and tail (TDT) indices are in bounds.  Note that validating values
when they are written is not sufficient along as the transmit length
(TDLEN) could be changed turning a value that was valid when written
into an out of bounds value.

While here, add further restrictions to the head register (TDH).  The
manual states that writing to this value while transmit is enabled can
cause unexpected behavior and that it should only be written after a
reset.  As such, ignore attempts to write while transmit is active,
and also ignore writes of non-zero values.  Later e1000 chipsets have
this register as read-only.

Also ignore any attempts to transmit packets if the transmit ring's
size is zero.

PR:		264567
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36269
2022-08-29 15:36:57 -07:00
Alexander V. Chernikov
177f04d57f routing: constantify @rc in rib_decompose_notification().
Clarify the @rc immutability by explicitly marking @rc const.

MFC after:	2 weeks
2022-08-29 18:12:24 +00:00
Mark Johnston
32faf071bd devstat: Remove DTrace io probes lacking a BIO reference
The io:::start and end probes trace individual I/O requests.

Also remove the unimplemented wait-start and wait-done probes.

PR:		266098
MFC after:	1 week
2022-08-29 13:22:36 -04:00
Mark Johnston
09a2fce092 makefs tests: Do not run ZFS tests in parallel
makefs-created pools always have the same GUID and thus cannot be
imported simultaneously.

Reported by:	olivier
2022-08-29 12:54:25 -04:00
Mark Johnston
a3b6b3ac4d makefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined 2022-08-29 12:50:51 -04:00
Mark Johnston
575ca2c265 makefs: Remove some redundant initializations
No functional change intended.
2022-08-29 12:50:51 -04:00
Alexander V. Chernikov
7b3440fc30 Revert "routing: install prefix and loopback routes using new nhop-based KPI."
Temporarily revert the commit to unblock testing.

This reverts commit a1b59379db.
2022-08-29 16:20:42 +00:00
Doug Moore
5d91386826 rb_tree: avoid extra reads in rebalancing
In RB_INSERT_COLOR and RB_REMOVE_COLOR, avoid reading a parent pointer
from memory, and then reading the left-color bit from memory, and then
reading the right-color bit from memory, since they're all in the same
field. The compiler can't infer that only the first read is really
necessary, so write the code in a way so that it doesn't have to.

Drop RB_RED_LEFT and RB_RED_RIGHT macros that reach into memory to get
those bits.  Drop RB_COLOR, the only thing left using RB_RED_LEFT and
RB_RED_RIGHT after the other changes, and go straight to DIAGNOSTIC
code in subr_stats to implement RB_COLOR for its single, dubious use
there.

Reviewed by:	alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36353
2022-08-29 11:11:31 -05:00
Alexander V. Chernikov
578a99c939 routing: improve multiline debug
Add IF_DEBUG_LEVEL() macro to ensure all debug output preparation
 is run only if the current debug level is sufficient. Consistently
 use it within routing subsystem.

MFC after:	2 weeks
2022-08-29 15:14:49 +00:00
Alexander V. Chernikov
fe05d1dd0f routing: extend nhop(9) kpi
* add nhop_get_unlinked() used to prepare referenced but not
 linked nexthop, that can later be used as a clone source.
* add nhop_check_gateway() to check for allowed address family
  combinations between the rib family and neighbor family (useful
  for 4o6 or direct routes)
* add nhop_set_upper_family() to allow copying IPv6 nexthops to
 IPv4 rib.
* add rt_get_rnd() wrapper, returning both nexthop/group and its
 weight attached to the rtentry.
* Add CHT_SLIST_FOREACH_SAFE(), allowing to delete items during
  iteration.

MFC after:	2 weeks
2022-08-29 14:46:03 +00:00
Alexander V. Chernikov
c24a8f19c5 routing: fix rib_add_route_px()
Fix panic in newly-added rib_add_route_px() by removin unlocked
 prefix lookup.

MFC after:	2 weeks
2022-08-29 12:57:47 +00:00
Alexander V. Chernikov
db4ca19002 routing: add ability to store opaque indentifiers in nhops/nhgs
This is a pre-requisite for the direct nexthop/nexhop group operations
 via netlink.

MFC after:	2 weeks
2022-08-29 12:20:28 +00:00
Alexander V. Chernikov
6d4f6e4c70 routing: make rib_add_redirect() use new nhop-based KPI
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36169
2022-08-29 10:23:26 +00:00
Alexander V. Chernikov
835a611e68 routing: make IPv6 defrouter code use new nhop-based KPI.
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36168
2022-08-29 10:08:47 +00:00
Alexander V. Chernikov
d8b2693414 routing: add rib_add_default_route() wrapper
Multiple consumers in the kernel space want to install IPv4 or IPv6
 default route. Provide convenient wrapper to simplify the code
 inside the customers.

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D36167
2022-08-29 10:08:24 +00:00
Alexander V. Chernikov
a1b59379db routing: install prefix and loopback routes using new nhop-based KPI.
Construct the desired hexthops directly instead of using the
 "translation" layer in form of filling rt_addrinfo data.
Simplify V_rt_add_addr_allfibs handling by using recently-added
 rib_copy_route() to propagate the routes to the non-primary address
 fibs.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D36166
2022-08-29 10:07:58 +00:00
Kirk McKusick
827622937e Correct calculation of inode location in getnextino cache.
Fix for 345bfec.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:47:17 -07:00
Wei Hu
9e772f203f mana: Fix a couple i386 build errors
Fix a couple i386 build errors

Fixes:	b685df314f
Sponsored by:	Microsoft
2022-08-29 06:35:02 +00:00
Kirk McKusick
9dee5da745 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Further updates based on ways Peter Holm found to corrupt UFS
superblocks in ways that could cause kernel hangs or crashes.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:14:35 -07:00
Kirk McKusick
2e4da012d5 Correct calculation of inode location in getnextino cache.
Fix for 345bfec.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-28 23:09:29 -07:00
Wei Hu
b685df314f mana: some code refactoring and export apis for future RDMA driver
- Record the physical address for doorbell page region
  For supporting RDMA device with multiple user contexts with their
  individual doorbell pages, record the start address of doorbell page
  region for use by the RDMA driver to allocate user context doorbell IDs.

- Handle vport sharing between devices
  For outgoing packets, the PF requires the VF to configure the vport with
  corresponding protection domain and doorbell ID for the kernel or user
  context. The vport can't be shared between different contexts.

  Implement the logic to exclusively take over the vport by either the
  Ethernet device or RDMA device.

- Add functions for allocating doorbell page from GDMA
  The RDMA device needs to allocate doorbell pages for each user context.
  Implement those functions and expose them for use by the RDMA driver.

- Export Work Queue functions for use by RDMA driver
  RDMA device may need to create Ethernet device queues for use by Queue
  Pair type RAW. This allows a user-mode context accesses Ethernet hardware
  queues. Export the supporting functions for use by the RDMA driver.

- Define max values for SGL entries
  The number of maximum SGl entries should be computed from the maximum
  WQE size for the intended queue type and the corresponding OOB data
  size. This guarantees the hardware queue can successfully queue requests
  up to the queue depth exposed to the upper layer.

- Define and process GDMA response code GDMA_STATUS_MORE_ENTRIES
   When doing memory registration, the PF may respond with
   GDMA_STATUS_MORE_ENTRIES to indicate a follow request is needed. This is
   not an error and should be processed as expected.

- Define data structures for protection domain and memory registration
  The MANA hardware support protection domain and memory registration for use
  in RDMA environment. Add those definitions and expose them for use by the
  RDMA driver.

MFC after:	2 weeks
Sponsored by:	Microsoft
2022-08-29 05:24:21 +00:00
Rick Macklem
117cea02a4 nfscl: Fix setup of Sequence when all slots marked bad
Commit 40ada74ee1 modified the NFSv4.1/4.2 client so
that it would issue a DestroySession to the server when
all session slots are marked bad.  Once this is done,
the Sequence operation should get a NFSERR_BADSESSION
reply from the server.

Without this patch, the code was setting ND_HASSLOTID
when, in fact, there was no slot marked in use by
nfsv4_sequencelookup().  This would result in the
code freeing a slot not in use.  The effect of this
was minimal, since the session was already destroyed.

This patch fixes the code so that it does not set
ND_HASSLOTID for this case.

MFC after:	2 weeks
2022-08-28 14:36:45 -07:00
Rick Macklem
0685c73cfe nfscl: Add a console message for session recovery
The NFSv4.1/4.2 client does recovery when it receives a
NFSERR_BADSESSION reply from the server.  If the server has
not rebooted, this is often caused by multiple clients using
the same /etc/hostid and, as such, not being recognized as
different clients by the server.

This trivial patch adds a console message to suggest that
client's /etc/hostid's need to be checked for uniqueness.

MFC after:	2 weeks
2022-08-28 14:24:39 -07:00
Poul-Henning Kamp
31937f7e84 USB id of yet another Lenovo USB-C ethernet dongle. 2022-08-28 17:21:38 +00:00
Michael Tuexen
c624b9a549 tcp: fix stats counter for SYN_RCVD state when TCP-FO is used
Reviewed by:		glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36384
2022-08-28 18:45:59 +02:00
Eugene Grosbein
160a2f2cdd rc.conf(5): add <service>_umask to run the service using this value
None of tools working with login classes change umask(1)
and we had no ways to specify non-default umask for a service
not touching its startup script. This change makes in possible.

Some file-sharing services that create new files may benefit from it.

Differential:	https://reviews.freebsd.org/D36309
MFC-after:	3 days
2022-08-28 12:48:58 +07:00
Doug Moore
5886089ecf rb_tree: fine-tune RB_REMOVE
Improve RB_REMOVE by reading the fields of the removed node only once,
and by not writing to the removed node.

Reviewed by:	kib
Discussed with:	markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36288
2022-08-28 00:43:49 -05:00
Rick Macklem
b875d4f5dd nfsd: Update console message for no session found
The NFSv4.1/4.2 server generates a console message that indicates
that there is no session. I was until recently perplexed w.r.t. how
this could occur. It turns out that the common cause is multiple NFS
clients with the same /etc/hostid.

The host uuid is used by the FreeBSD NFSv4.1/4.2 client as a unique
identifier for the client. If multiple clients use the same host uuid,
this indicates to the NFSv4.1/4.2 server that they are the same client
and confusion occurs.

This trivial patch modifies the console message to suggest that the
client's /etc/hostid needs to be checked for uniqueness.

Reviewed by:	asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36377
2022-08-27 18:31:20 -07:00
Rick Macklem
fb29f81758 nfscl: Fix handling of nd_slotid while handling NFSERR_BADSESSION
When the NFSv4.1/4.2 client is handling a server error
of NFSERR_BADSESSION, it retries RPCs with a new session.
Without this patch, the nd_slotid was not being updated
for the new session.

This would result in a bogus console message like
"Wrong session srvslot=X slot=Y" and then it would
free the incorrect slot, often generating a
"freeing free slot!!" console message as well.

This patch fixes the problem.

Note that FreeBSD NFSv4.1/4.2 servers only
generate a NFSERR_BADSESSION error after a reboot
or after a client does a DestroySession operation.

PR:	260011
MFC after:	1 week
2022-08-27 16:03:18 -07:00
Rick Macklem
f2dfe60776 Revert "nfscl: Fix handling of nd_slotid while handling NFSERR_BADSESSION"
Revert this commit, since I now have a better fix to commit.

This reverts commit 8e59ec29e4.
2022-08-27 15:58:23 -07:00
Kristof Provost
6ab80e7275 pf: do not block new Ethernet rules for in-progress transactions
Make Ethernet rule addition behave just like L3 rules, in that we now
allow ongoing transaction to be interrupted, rather than rejecting a new
one.

The result of that is that we can no longer end up in a state where a
transaction failed, but was not rolled back, blocking us from setting
new rules.

It's safe to assume there's no pending epoch callback for cleanup here,
because we've explicitly called it before hitting pf_begin_eth().

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-08-27 22:25:01 +02:00
Mateusz Guzik
2c1ac3d4d4 nat64: fix whitespace damage in callout calls
No functional changes.
2022-08-27 19:06:41 +00:00
Bjoern A. Zeeb
caaa79c3f8 LinuxKPI 802.11: change type of bssid in struct ieee80211_bss_conf
Enabling other driver code found that the bssid in
struct ieee80211_bss_conf is not an array but expected to be
a const pointer (const, != NULL checks).
Adjust accordingly in the header and in the LinuxKPI compat code.
There initialization now needs to be a static array always present
as we need a value before we will have a BSS (node in scan_to_auth)
as the mac80211 driver (*handlers) are expecting the pointer to be
not NULL (copying without checks).
This is a pre-req to enable d3 (CONFIG_PM[_SLEEP]) in the future.

Tested by:	Tomoaki AOKI (junchoon dec.sakura.ne.jp)
Tested by:	Berislav Purgar (bpurgar gmail.com)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-08-27 14:54:02 +00:00
Gordon Bergling
ce99e4fa44 bhnd(4): Correct a typo in a source code comment
- s/in he/in the/

MFC after:	3 days
2022-08-27 12:10:00 +02:00
Hans Petter Selasky
4e2d8cd3e2 usb(4): Quirk for non-compliant USB devices.
Some non-compliant USB devices do not implement the
clear endpoint halt feature. Silently ignore such
failures, when they at least responded correctly
passing up a valid STALL PID packet.

Tested by:	Doug Ambrisko <ambrisko@ambrisko.com>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-08-27 08:52:28 +02:00
Warner Losh
7ed3228323 stand: Document that boot0 uses BIOS
And thus has a limited range of supported baud rates. Also add that
setting BOOT_BOOT0_COMCONSOLE_SPEED=0 will leave it unchanged which
sometimes can give you 115200 if the BIOS initialized things outside of
the normal BIOS baud rates (which many x86 enbedded-targetted boards
do).

Sponsored by:		Netflix
Reviewed by:		emaste, manu (earlier versions)
Suggestions by:		jhb
Differential Revision:	https://reviews.freebsd.org/D36300
2022-08-26 22:17:56 -06:00
Warner Losh
df065f699f stand: More sensible defaults when ConOut is missing
When ConOut is missing, we used to default to serial. Except we did it
in the worst way possible by just setting the howto bits and not
updating the console setting, which lead to weird behavior where we'd
get some things on the video port, others on serial.

Instead, set console to "efi,comconsole" for this case. Also set
RB_MULTIPLE always (so we get dual consoles from the kernel) and or in
RB_SERIAL when we can't find GOPs that suggest the precense of a video
console. This will put output in the most places and have a sensible
default for 'primary' console.

Sponsored by:		Netflix
Reviewed by:		emaste, manu
Differential Revision:	https://reviews.freebsd.org/D36299
2022-08-26 22:17:56 -06:00
Brooks Davis
a28f833532 libprocstat: forward declare struct kinfo_proc
This allows libprocstat.h to be included without sys/user.h as
documented in the manpage.
2022-08-26 23:20:32 +01:00
Hans Petter Selasky
0b01a13b8a u3g(4): Add more USB IDs.
Submitted by:	malavon <benny.goemans@gmail.com>
MFC after:	1 week
PR:		263700
Sponsored by:	NVIDIA Networking
2022-08-26 22:02:35 +02:00
John Baldwin
e3885a7893 soo_stat: Ensure error is always initialized.
In kernels without MAC, error is not set for sockets whose protocol
layer does not implement the pr_sense hook.

Reported by:	Jenkins (powerpc kernel builds)
Fixes:		7c04ca1fad sockets: for stat(2) on a socket don't report hiwat as block size
2022-08-26 11:17:55 -07:00
Warner Losh
74704a26bc efi: Create a define for memory descriptor version
For true EFI platforms, the EFI BIOS will return version 1 (since no
other version is defined as of this commit). However, for environments
that wish to create an EFI memory mapping table that aren't actually
EFI, we need to know this. Add EFI_MEMORY_DESCRIPTOR_VERSION for this
constant.

Sponsored by:		Netflix
2022-08-26 11:40:42 -06:00
Gleb Smirnoff
837b7203f0 domains: use struct domain as argument 2022-08-26 10:35:35 -07:00