This makes the driver attach, but the device is still not usable.
Reported by: Lukasz Wencki <[email protected]>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
The error message noting that the file should not be included said
"bsd.conf.mk" before this change. Now it correctly says "bsd.confs.mk".
MFC after: 3 days
These are Single-Pair Ethernet types (SPE) from 802.3cg. smsc sets the
link flag only if mii_media_active is one of a known set of media types.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60745
For a software built on top of bhyve(8) and/or managing bhyve(8),
it is very convenient to know what specific features the given binary supports.
Currently, bhyve(8) provides some of this information, and it could be
retrieved by parsing `bhyve -h`, `bhyve -s help`, `bhyve -l help`.
Sometimes it is not enough, for example, the recently added
"oemstrings" feature cannot be fully probed using these commands.
Over time, some workarounds were suggested. Specifically:
- Mapping features to __FreeBSD_version. I see at least two issues with
that:
* __FreeBSD_version does not directly map to bhyve(8) features,
so this is simply not accurate.
* bhyve(8) might be updated separately from the system, which
is not so uncommon, especially for development purposes.
Then such a probing will be inaccurate.
- Manual pages parsing. I see more disadvantages with that:
* Manual pages are meant to be read by a human. Extracting
information from it by a machine is not the most convenient thing.
Especially understanding side notes like: "Note, feature 'foo'
is arm64-only!".
* Manual pages might be inaccurate, they might miss options.
* bhyve(8) could be used in an environment where manual pages
are not installed.
This commit attempts to close this gap by introducing the "bhyve -o
help" command which prints all the supported configuration variables.
In my opinion, it is, in combination with the other commands mentioned
above, sufficient to retrieve most of the capabilities of the given
bhyve(8) binary.
The current implementation defines a simple configuration schema for
common and machdep code and prints out a list of supported configuration
variables for the current architecture.
The next step as I see it would be extending set_config*() functions
to validate the user provided values against the schema, so users get
notified early on incorrect or misspelled configuration variables.
It would also be nice to allow users to only validate their
configuration, think of 'nginx configtest / -t'.
Reviewed by: chuck (previous revision), bnovkov
MFC after: 1 month
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58419
The database stores bytes, not characters. Remove the historical
note about 7-bit storage. Also document that -i ignores case only
for ASCII letters.
Reviewed by: ziaee
MFC after: 3 days
Linux returns EFAULT when the range to be remapped is not mapped at all,
and ENOMEM only when it is mapped but cannot be grown in place. Callers
depend on that distinction: musl's pthread_getattr_np() measures the
main thread stack by growing a one page mapping and retries while errno
is ENOMEM. Returning ENOMEM for every growth request makes that loop
spin forever.
PR: 299835
MFC after: 1 week
This metric seems unreliable and I have observed it occasionally report
1 (successful entry to S0i3) when the time_last_in_s0i3 metric was 0 on
Phoenix, which does not make sense.
So just rely on time_last_in_s0i3 instead.
Sponsored by: The FreeBSD Foundation
After reset the driver enables three LED outputs by writing 1s to
the appropriate GPIO/LED configuration bits in the LED & GPIO
configuration register LED_GPIO_CFG.
The LED Select (LED_SEL) bit in LED_GPIO_CFG chooses between two LED
modes:
0: Speed, Link+Activity, Full Duplex
1: Speed, Link, Activity
If an EEPROM is present LED_SEL is initialized from bit 1 in the
EEPROM's configuration flags value. If no EEPROM is present this bit
defaults to zero.
Previously we wrote to all bits in the register, clearing LED_SEL. A
device with LED_SEL set by the EEPROM would thus not have correct LEDs.
Now we read the current value of LED_GPIO_CFG and just set the three
LED configuration bits, as Linux does in commit 52a2f0608366 ("net: usb:
smsc95xx: fix changing LED_SEL bit value updated from EEPROM").
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60828
SMSC_HW_CFG_PSEL indicates that an external PHY is present. Skip the
internal PHY initialization when set and store the ID of the detected
PHY.
Reviewed by: br
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60744
The driver only allowed writes to the expected phy (i.e., sc->sc_phyno),
and reads were never filtered. sc_phyno is already passed to
mii_attach() as phyloc, so nothing tries to issue MDIO writes to other
addresses and the check is not required.
Remove the check in advance of supporting external PHYs at arbitrary
addresses.
Tested on Microchip's EVB-LAN9500A-LC LAN9500A evaluation board.
Sponsored by: The FreeBSD Foundation
Sponsored by: Microchip (Hardware)
Differential Revision: https://reviews.freebsd.org/D60743
iflib_parse_header() pulls every IPv4 packet up to the end of the TCP or
UDP header, including fragments at a non-zero offset, which carry no L4
header at all. A trailing fragment shorter than that header (1-7 bytes
of UDP, 1-19 bytes of TCP) makes m_pullup() fail and the frame is freed
without a trace in the interface counters.
Only parse the L4 header on the first fragment. TSO never produces
fragments, so assert that.
With a 1500-byte MTU every UDP datagram of 1473-1479 bytes is lost
behind a forwarding host whose ingress NIC sets receive checksum flags,
or on any VLAN with hardware tagging. SIP over UDP is a common victim.
Reported by: Alex Roberts
Reviewed by: gallatin
Fixes: c224b2ce7d ("iflib: don't pullup UDP payloads to the TCP header size")
See also: https://redmine.pfsense.org/issues/17196
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Driver provides an interface for tools operating on adapters'
Non-Volatile Memory using SIOC(G|S)DRVSPEC ioctls. It allows
tools to issue Admin Queue commands to the firmware, which
may return an error code encoded as a negative integer.
The driver passed this negative integer as the return value
of the ioctl handler. This was causing issues because the FreeBSD
kernel reserves negative error codes in system calls for special
purposes such as restarting the handler or detecting incorrect
behavior in VFS operations. Simple remapping of negative values
to positive integers caused currently available tools to misbehave
and could break the NVM update process. Introduce a new API version,
which allows new versions of tools to detect the fixed driver.
Temporarily keep the old API, but issue a warning that tools need
to be updated.
Also refactor the code to use centralized cleanup and move the
debug message from the firmware earlier to make sure it is not masked
by an error from copyout.
Signed-off-by: Krzysztof Galazka <[email protected]>
Tested by: Mateusz Moga <[email protected]>
MFC after: 2 weeks
Assisted by: Copilot GPT 5.4
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D57942
A typical caching proxy problem is port allocation to backends. We
usually have a few of them, with thousands connections to each. Upon
creation of a new connection we need to find a new unique local port for
the peer:port. This is achieved by linear search in in_pcb_lport_dest().
The closer we get to the port exhaustion the more expensive this loop is.
It needs to be executed tens thousands of times to find a port or fail.
Address the problem by adding advisory negative cache that is lazily
allocated upon first conflict. Once the cache is in action we skip trying
those ports that are already marked in the cache. During the search we
may encounter a cache allocated by other lookup. In this case the caches
are merged into one. The expectation is that under a stable heavy load we
are going to stabilize at a very low number of allocated caches, ideally
one per peer:port. The cache is a bitset of IPPORT_MAX, which makes it 8k.
Unfortunately metadata pushes allocation size to 16k UMA bucket. However,
the expectation is that we are going to have a very few allocated, thus
current decision is to not create a separate UMA zone.
Differential Revision: https://reviews.freebsd.org/D58290
External retpoline thunks for amd64 and i386 were added in commit
74d971fe15 ("x86: Add external retpoline thunk"). Use them when
WITH_KERNEL_RETPOLINE is set.
There should not be any material performance impact -- the call sites
are identical, and this just replaces (on amd64) compiler-generated
__llvm_retpoline_r11 functions in each object with our
__x86_indirect_thunk_r11.
After this change we could implement boot-time patching, replacing
__x86_indirect_thunk_r11 with just jmp %r11 when retpoline is not
required.
Note on i386: An i386 build WITH_KERNEL_RETPOLINE was successful, but
has not been extensively tested. Clang may use registers other than
just eax on i386 and so in the future additional thunks beyond the one
added in 74d971fe15 could be required for i386. Patches are welcome
if this is important to you.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Add a simplebus-based pseudo-bus that matches the "reserved-memory"
node in the device tree. Update the SCMI shared memory driver so that
it can attach either as a child of mmio_sram or directly under
simplebus (via the new reserved-memory bus). Make the mmio_sram memory
resource shareable so both attachment methods can coexist when required.
MFC after: 1 week
Reviewed by: manu
makeobjops.awk only accepts an uppercase DEFAULT before a default kobj
method. This commit fixes a typo introduced in 949804c819 so non-PCI
drivers actually use nvme_is_storage_device_default instead of
kobj_error_method. Note that even though kobj_error_method returns
ENXIO (6), it does not get implicitly cast to a bool due to the function
pointer casting in the nvme_if.h generated by makeobjops. Instead the
codegen for the NVME_IS_STORAGE_DEVICE callsite shows that only the
lowest bit is being checked as if it were always a bool. Without this
any nvme driver that doesn't implement is_storage_device is not treated
as a storage device.
Reviewed by: imp, kevans
Differential Revision: https://reviews.freebsd.org/D60112
Scope restriction by loopback interface was not specified in
the draft-stewart-tsvwg-sctp-ipv4 draft and having global address
on loopback interface is common.
Therefore, allow to skip loopback interface type check in sctp.
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D60938
SSL_use_RSAPrivateKey_file() was deprecated in OpenSSL 3.0. Use the
more generic SSL_use_PrivateKey_file() instead.
Sponsored by: Klara, Inc.
Sponsored by: Qualys, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D60899
tcp_autosndbuf() asserts that the buffer is locked, but it should assert
this about the send buffer, not the receive buffer.
Fixes: 7146ad04f1 ("tcp: refactor tcp_autosndbuf() and associated sysctls")
Reviewed by: tuexen
Sponsored by: Rubicon Communications, LLC ("Netgate")
Restructure the description of -s flag:
1. what the option does
2. why it is useful (deterministic order, streaming output)
3. how its results can differ from `find | sort'
Reviewed by: ziaee
MFC after: 3 days
The state expiration may lead to freeing rules, which requires this lock.
Since the lock is sleepable, move the expiry routine from callout context
to a taskqueue. This also should have a positive effect of not running
expensive function as a callout.
Fixes: e3caa360d5
Reviewed by: pouria
Differential Revision: https://reviews.freebsd.org/D60869
Rename tcp_sndbuf_autoscale() to tcp_autosndbuf(). This matches
complementary tcp_autorcvbuf() that was factored out as a separate
function a few months before tcp_sndbuf_autoscale() was. Move the large
comment to the header of the function. Use unsigned types for all sizing
sysctls and variables and use bool for the switching sysctl. Add a
comment above net.inet.tcp.sendbuf_auto_lowat (default to off) providing a
reference to its origins. Add DTrace probe tcp::send-autoresize,
complementary to the existing tcp::receive-autoresize.
Rack has its own function, just enable the DTrace probe there.
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D60732
Run the entire function under the socket buffer lock. Make it responsible
to set the new limit or clear SB_AUTOSIZE in case of a failure. Use
unsigned type for newsize, that matches both the sb_hiwat type and min()
argument types. Make byte counter in the tcpcb unsigned, too. Make the
sizing tunables unsigned, and make the switching tunable a boolean. Don't
execute Dtrace probe in case of a failure. Simplify the Dtrace probe to
report only relevant information, the previous probe looked more like a
leftover from a debugging session.
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D60731
Partitions are trivially aligned to sector boundaries, so asking e.g.
for a partition to be aligned to a 64-byte boundary is pointless but
harmless. Treat it as such, with a warning (in case the request was
a mistake, e.g. requesting 1-byte instead of 1M-byte alignment) rather
than as an error.
Reviewed by: markj
Suggested by: markj
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60819
If VM_PARTALIGN is set, pass %${VM_PARTALIGN} to mkimg in the
specification of swap, config, root, and ESP partitions. (Boot
partitions are not aligned, both because they're small and in
case firmware makes assumptions about their locations.)
Reviewed by: lwhsu, imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60454
This adds a "%align" field to partition specifications, resulting in
the start of a partition being shifted to the next aligned position.
When both :offset and %align are used, a relative offset is treated as
a minimum value, while an unaligned absolute offset is an error.
Reviewed by: imp (earlier version)
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60450
When handling PART_KIND_FILE, the "error" variable is set to reflect
any errors in parsing the specified offset; but that value is then
overwritten by the return value of image_copyin.
Error out immediately instead. Note that it is not necessary to change
the code in PART_KIND_SIZE which parses the size, since in that case we
do not overwrite the value in "error".
Fixes: 8f3c71c85e ("mkimg: Add support for offset if the source is an image")
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60422
drm-kmod sets CONFIG_PM (unclear if for other parts) but LinuxKPI
has no understanding of a dev->power implementation for pm_runtime.h.
The return values based on !CONFIG_PM thus cause problems to drm-kmod.
Return the previous values under CONFIG_PM but leave the TODO logging
as the actual implementation is missing and return values may not be
universally correct (beyond the known drm-kmod use cases).
The following functions having a return value but none sepcific for
CONFIG_PM as (based on drm-kmod master):
pm_runtime_resume only caller ignores the return value
pm_runtime_set_active two callers ignore the return value
pm_runtime_put_autosuspend all callers seem to ignore the return value
pm_runtime_autosuspend 2/3 callers ignore the return value;
3rd is #ifdef __linux__
pm_runtime_suspended 3/4 callers ... do check the return value
but the logic expects the false, which also
matches the previous value.
Fixes: 863fe7ae51 ("LinuxKPI: re-implement pm_runtime.h")
Reported by: markj
MFC after: 3 days
Tested by: markj, Oleg V. Nauman (oleg.nauman gmail.com)
Differential Revision: https://reviews.freebsd.org/D60878
The cleanup tested cherr[0] when closing cherr[1]. The parent also closed
chin[0]/chout[1]/cherr[1] after pdfork() without clearing them, so the out:
cleanup path closed them again. Clear each fd after closing and test the right
one.
Reviewed by: des, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60924
Some guest operating systems (at least 9front) will leave device I/O
space decoding enabled while probing BAR sizes. In this case, a
sufficiently large 32-bit BAR can overlap with the HPET MMIO region
fixed at 0xfed00000. This results in an assertion failure in
modify_bar_registration(), even though the collision is transient, i.e.,
the guest will promptly map the BAR elsewhere.
Tolerate such overlaps. Keep track of a BAR's registration state and
make sure that modify_bar_registration() doesn't try to unregister an
I/O space if registration failed.
This fixes a problem where a 32MB framebuffer ends up overlapping with
the HPET MMIO region, causing some guests to crash with an assertion
failure when probing BARs during boot.
PR: 290098
Reviewed by: bnovkov
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60748
inetd_setproctitle() formats se_service (the service name taken verbatim
from inetd.conf) and the peer address into an 80-byte buffer with
sprintf(). A long service name can overflow it. Bound both calls with
snprintf().
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60879