rpctls_impl.c: Use a direct cast to uintptr_t instead of __DECONST
This fixes the build on CHERI architectures where the compiler warns
about a direct cast between uint64_t and const void * inside of
__DECONST. However, GCC would also complain about this on 32-bit
kernels due to uint64_t not being the same size as a pointer. Also,
a direct cast to uintptr_t to right-size the cookie value is more
direct than using __DECONST given that there is no "const" pointer
involved in the expression.
Reviewed by: brooks, glebius
Obtained from: CheriBSD
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D54797
sound: Replace MIN() with min()
We use min() in most places.
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit eccd366b0a8ba7d902fcf0b1bec447926a75c36c)
sctp: improve compilation as module
When compiling SCTP as a module, don't compile sctp_crc32.c into
the module. This avoids code and variable duplication since
sctp_crc32.c is compiled into the kernel. In particular, the variable
system_base_info is not duplicated. This fixes the handling of the
statistic counters sctps_sendhwcrc and sctps_sendswcrc when using
sctp_delayed_cksum.
(cherry picked from commit 68a449f09e2a38def9df822d42f91ecd2f27b0e2)
dwc: add receive checksum offload for IPv6
This patch adds support for receive checksum offload for TCP/IPv6
and UDP/IPv6. Since receive checksum offload can't be configured
separately for IPv4 and IPv6, IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6
can't be changed independently.
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D54756
(cherry picked from commit 5d8777f3a7aee04eabbc9f3cf12138f9b56e3ebc)
bge: disable TXCSUM if UDP transmit checksum offloading is disabled
The bge interface is special with respect to transmit checksumi
offloading. In the default settings, an bge interface announces TXCSUM
capabilities, but only supports TCP/IPv4 and not UDP/IPv4 due to
limitations of some of the NICs. This results in problems when the bge
interface becomes a member of a bridge. Since currently only the
TXCSUM capabilities are synced when a member is added to a bridge and
not the protocol specific capabilities, this can result in a situation
where UDP packets are sent out using a bge interface without having a
correct checksum.
To mitigate this problem, initially don't announce TXCSUM capabilities,
when UDP transmit checksum is disabled. It is still possible to enable
TXCSUM capabilities via ifconfig.
PR: 291420
Reviewed by: Timo Voelker
Differential Revision: https://reviews.freebsd.org/D54486
(cherry picked from commit bbd30927b1af44226c8de0512912a7fedfce2824)
ipv6: account for jumbo payload option
If a jumbo payload option is added, the length of the mbuf chain is
increased by 8 but the actual hop-by-hop extension header with the
jumbo playload option is only inserted in the packet if there are
other options. Therefore, adjust optlen to reflect the actual size
of IPv6 extension headers including the hop-by-hop extension header
containing the jumbo payload option.
Reported by: syzbot+73fe316271df473230eb at syzkaller.appspotmail.com
Reviewed by: markj, Timo Voelker
Differential Revision: https://reviews.freebsd.org/D54394
(cherry picked from commit 1f5b1de1fdf2924066c1851ed6c73f36fe20b438)
dwc: improve IPv4 transmit checksum offloading
This patch provides two improvements for TCP/IPv4 and UDP/IPv4
transmit checksum offloading:
(1) Use *CIC_SEG instead of *CIC_FULL, since FreeBSD always provides
a pseudo header checksum.
(2) Don't make transmit IPv4 header checksum offloading a prerequisite
for TCP/IPv4 or UDP/IPv4 transmit checksum offloading.
This is the root cause of PR 291696, since right now the epair
interface does not support transmit IPv4 header checksum offloading,
but TCP/IPv4 and UDP/IPv4 transmit checksum offloading.
PR: 291696
Reviewed by: Timo Voelker
Tested by: Marek Benc
Differential Revision: https://reviews.freebsd.org/D54395
(cherry picked from commit f8ddf74175c8013268e65b18750e247306fa088a)
linuxkpi: Take const root in read-only radix tree functions
This is a preparation step for a future addition to this file. This is
also closer to what Linux does.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
(cherry picked from commit cf39b51d36d82214ebdfd03055d321ddd2d85274)
(cherry picked from commit c5445540995fd37c390ad371a2e95d300ee83988)
tcp: fix checksum calculation bug
The new function in_delayed_cksum_o() was introduced to compute
the checksum in the case the mbuf chain does not start with the
IP header. The offset of the IP header is specified by the
parameter iph_offset.
If iph_offset was positive, the function computed an incorrect
checksum.
Reviewed by: sobomax, tuexen
Fixes: 5feb38e37847 ("netinet: provide "at offset" variant of the in_delayed_cksum() API")
Differential Revision: https://reviews.freebsd.org/D54269
(cherry picked from commit c8b3b605ae854ead6c8804e0400d80cb8fa73fdf)
vtnet: improve consistency
Use sbuf_new_for_sysctl() instead of sbuf_new_auto() when exposing
the flags via sysctl.
(cherry picked from commit 8da838ac31692e381adfc63d83ea49f2adabbf23)
vtnet: expose features via sysctl tree
Right now the 64-bit flags field needs to be casted to a 32-bit field,
because clang warns if more than 32-bits are used.
Once clang is fixed, this restriction will be removed and more bits
will be added.
Reviewed by: markj, Timo Völker
Differential Revision: https://reviews.freebsd.org/D54288
(cherry picked from commit 634d9c0d111b630c3d63a1cf25d15c32a37afab8)
printf.9: Support more than 32 bits in %b
This will be usable after clang has been extended to accept length
modifiers for %b when compiling kernel code.
But we need FreeBSD to support it first...
Reviewed by: markj, Timo Völker
Differential Revision: https://reviews.freebsd.org/D54286
(cherry picked from commit d2cb9cab8457b2a84898f0ac86f7b45e907f872c)
vtnet: expose flags via sysctl tree
Provide the flags used for a vtnet interface via the sysctl tree.
This is mostly used for debugging purposes.
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D54283
(cherry picked from commit e3a0571ad74d8429a95fcae9efc1d91cc109a337)
vtnet: define flags in a consistent way
This allows adding flags in the upper 32 bits in a consistent way.
No functional change intended.
(cherry picked from commit e0c6c4ecfc755b78ac9135033053d2f15c62bf04)
powerpc/mpc85xx: Fix PCI attach error cleanup
If an error occurs during attach after ofw_pcib_init() runs, the device
is torn down, leaving the rmans embedded in the softc attached to the
rman list, thus corrupting the rman list. Fix this by undoing
everything that was done by this point.
MFC after: 1 week
powerpc/mpc85xx: Set pc_hwref to the primary thread ID
On multithreaded cores (e6500) the CPU ID in the device tree (reg[0]) is
the primary core, which may not match the cpuid, until Book-E threading
is added.