mgb: support for PCI11414.
Add support for Microchip PCI11414 Gigabit Ethernet Controller.
The PCI11414 is used on the CHERI VITA 57.1 PCIe Extension Board.
- Add PCI11414 device ID
- Add support for SGMII mode. Read the programmed strap configuration
and enable SGMII operation when configured. Bypass the MII interface
in SGMII mode.
- Increase the DMA descriptor ring size.
Reviewed by: emaste
Sponsored by: EPSRC ("UKRI3001: CHERI Research Centre")
Differential Revision: https://reviews.freebsd.org/D60539
linuxulator: Accept 0 as signal in rt_sigqueueinfo
Linux allows 0 as a signal for rt_sigqueueinfo(2) the same as it does
for kill(2). This is used to check for process existence and
permissions.
Allow this value through as a special case in linux_rt_siqgueueinfo the
same way as was done for linux_kill.
Before this change, lio_listio(3) would fail with EINVAL under
Linuxulator. Now it is functional.
MFC after: 1 week
Reviewed by: kevans
Approved by: kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D60574
lib/libifconfig: Fix pointer-sign warnings
Fix all pointer-sign warnings generated when compiling libifconfig.
A couple more snuck in while the previous batch of fixes was landing.
Fixes: 963f1a5455c9 ("ifconfig: add CMIS support for 400GbE optics")
Reviewed by: kevans
Approved by: kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D60573
if_rge: add debugnet/netdump support
Implement the debugnet KPI in rge(4) by mirroring the re(4) pattern.
Tested with a RTL8125 2.5GbE NIC.
Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D60135
pf: Do not corrupt neighbour advertisements when translating
When an ICMPv6 query or reply matches a translated state,
pf_test_state_icmp() copies the state's virtual id into icmp6_id. Only
echo messages have an identifier there. For all other types the
virtual id is 0 and those two bytes hold something else; in a neighbour
advertisement they hold the R, S and O flags. The checksum was not
updated either, so icmp6_input() dropped the advertisement as a bad
checksum.
Unicast NUD probes to a link-local neighbour, such as the default
router, are sent from the link-local address. With a nat rule that
matches it (e.g. "from any"), every advertisement answering a probe was
dropped: NUD failed, the neighbour cache entry was deleted, and traffic
to the neighbour stalled until it was resolved again.
Only rewrite the id of echo messages, as the ICMPv6 error path already
does, and update the checksum, as the IPv4 path does.
[8 lines not shown]
auditdistd: Use fixed-length protocol names
All communication between auditdistd senders and receivers and
internally between auditdistd and its worker children passes through the
same pair of send / receive functions. The receive function uses
recv(2) with the MSG_WAITALL flag, which in theory means we should never
get a short read. However, when handing off a socket to a worker child,
we also pass a variable-length string identifying the type of socket
we're passing, and reading this string relies on a short read. This
used to work because the arrival of the descriptor would interrupt the
recv(2) call, but this bug was fixed when the AF_UNIX code was rewritten
a while ago and auditdistd has been broken ever since.
Fixing the length of the protocol name to four characters including the
terminating null solves the short-read bug by never requiring a short
read (nothing else in auditdistd requires one).
PR: 296107
MFC after: 1 week
[2 lines not shown]
pf: Free a table entry that cannot be routed
pfr_insert_kentry() returned the error of pfr_route_kentry() and
leaked the entry it had created; pfr_insert_kentries() stopped at the
first entry it could not route and leaked it and the rest of the work
queue, which no caller frees. Destroy an entry that cannot be routed
and go on with the next.
Reviewed by: kp
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60532
arm64: Relax memory barriers around DMA operations
Before and after DMA operations we need memory barriers to ensure
stores on the CPU are observed by the device, and stores by the device
are observed by the CPU.
Previously we used a "dsb sy" instruction, however this is too strong
and can lead to slower performance.
Drew Gallatin found and tested the issue with cache-coherent devices,
reducing the barriers to dmb instructions in the outer-shareable
domain. After discussing the issue with the Arm Linux DMA maintainer I
concluded it was safe for non-coherent devices as the only dsb
instructions we need are after cache operations and these already exist.
Replace the dsb before DMA with a "dmb oshst" when cache-coherent, or
the existing dsb after invalidating the cache when not coherent. This
ensures earlier stores have completed before we signal the device.
[7 lines not shown]
arm64/vmm: Treat Rt=31 as xzr in reg & instr emul
For certain instructions like msr, mrs, ldr & str, Rt=31 means the
operand is the Zero register (XZR) as opposed to the SP, even though the
two share the encoding of 31 on AArch64.
This is currently ignored in register and instruction emulation, so
emulated guest operations like "msr <reg>, xzr" will set the value of
<reg> to the current value of the SP instead of to 0.
Skip set and get operations when Rt=31 to correct the behaviour.
Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by: andrew
Sponsored by: Arm Ltd
Pull Request: https://github.com/freebsd/freebsd-src/pull/2454
__FreeBSD_version: Bump for changing pkthdr layout
Changing the layout of the pkthdr requires external drivers
to be rebuilt, lest they access the wrong fields.
Sponored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60691
mbuf: move leaf_rcv union farther back in the pkthdr
When the leaf_rcv union was introduced to support ktls RX offload in
4d88d81c3166 it was put at the front of the pkthhdr, and pushed the
more commonly accessed csum_flags and rsstype into the next cacheline.
Given that csum_flags is accessed on every pkt sent and every pkt freed,
but the leaf_rcv fields are only used for ktls rx offload, it makes more
sense to have csum_flags in a cacheline that is already likely to be hot.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D60691
Sponsored by: Netflix
pf: Parse the GETSTATES state id as 64 bits
The GETSTATES dump sends PF_ST_ID as a u64, but the request parser
reads it as a u32 and rejects an id taken from the dump with EINVAL.
Nothing in base sends PF_ST_ID. Parse and document it as a u64.
Reviewed by: kp
Fixes: 2cef62886dc7 ("pf: convert state retrieval to netlink")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60543
libpfctl: Return max_win and mss of state peers
The kernel sends PF_STP_MAX_WIN and PF_STP_MSS for both peers of a
state, but struct pfctl_state_peer has no fields for them and libpfctl
dropped them. Add the fields and parse the attributes.
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60544
if_bnxt: fix powerpc build of the MPC ring code
powerpc has no 16-bit acquire/release atomics, so the
atomic_load_acq_16() and atomic_store_rel_16() calls on the MPC TX
ring indices fail to build there. Make the producer and consumer
indices 32 bits wide and use the 32-bit primitives.
Reviewed by: gallatin, chandrakanth.patil_broadcom.com
Sponsored by: Broadcom Inc
MFC after: 1 week
Fixes: 088a42c0ff76 ("if_bnxt: add MPC (Mid-Path Channel) ring infrastructure")
Differential Revision: https://reviews.freebsd.org/D60698
pf: Set the reassembly flags under the rules lock
DIOCSETREASS stored V_pf_status.reass twice with no lock, first the
flags it was given and then, if reassembly was not among them, zero.
pf_normalize_ip() and pf_normalize_ip6() read the flags with the rules
lock held for reading, so a packet could see the intermediate value.
Compute the flags first and store them once, with the rules lock held
for writing, as DIOCSETDEBUG and DIOCSETHOSTID do.
Reviewed by: kp
Fixes: 39282ef356db ("pf: backport OpenBSD syntax of "scrub" option for "match" and "pass" rules")
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60531
pf: first-match-wins for nat rules, even in anchors
Ensure we stop evaluating nat rules if we find a match in a nat-anchor.
PR: 299320
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
tests/netinet6: Turn off stable addresses in ndp_prefix_len_mismatch
ndp_prefix_len_mismatch exercises the fallback in in6_ifadd() for an
interface whose link-local address does not have the advertised prefix
length (9e792f7ef729). Since a2eb0894b79b made stable addresses
(RFC 7217) the default, in6_ifadd() takes the interface identifier from
in6_get_stableifid() and never looks at the link-local address, so the
case passes without reaching the fallback. Turn stable addresses off
on the interface.
Sponsored by: Rubicon Communications, LLC ("Netgate")
hwpmc: Add support for AMD-only IRPERF in hwpmc PERF class
The IRPERF MSR counter (0xc00000e9) exposes an instructions-retired count
when read. Its support is advertised through CPUID leaf 0x80000008 EBX bit 1.
If this bit is set, the CPU supports the IRPERF MSR. For it to be used
by the system, bit 30 of the HWCR MSR (0xC0010015) needs to be enabled.
This patch checks for availability of the feature and enables the bit. If
the feature is available, the hwpmc PERF class detects its presence and
registers a third PERF MSR counter that allows hwpmc users to measure
instructions retired using IRPERF. This is AMD-only, as Intel does not
support IRPERF.
Due to erratum #1054 affecting AMD Zen 1 before model 30h, IRPERF is only
enabled for AMD Zen 1 model 30h onwards and later microarchitectures. This
commit also implements a validation step to make sure the IRPERF counter
is actually incrementing; otherwise, the feature is not enabled. This
guarantees it is working as expected before being made available to the
system and users.
[20 lines not shown]
pfil: Avoid potential mbuf tag leak
In '398254f9999e mbuf: simplify m_free' we removed tag processing
on m_free() of M_NOFREE mbufs. It is possible that a packet filter
could attach a tag to this stack mbuf and call m_free()
on it, meaning that 398254f9999e may have introduced a tag leak.
However,if a tag is attached without anyone calling m_free(), then
this leak was pre-existing.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D60686
Fixes: 398254f9999e
Sponsored by: Netflix