Both of the aforementioned macros have been present in FreeBSD
for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for
`DEVMETHOD_END`.
Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END`
and `KOBJMETHOD_END` as appropriate. This helps ensure that
future adaptations to drivers following patterns documented
in driver(9) can be made more easily/without issue.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55414
MFC notes:
All conflicts were dropped as they didn't apply to code in branch.
Conflicts:
sys/dev/flash/w25n.c
sys/dev/nvd/nvd.c
sys/dev/nvme/nvme_sim.c
sys/dev/sound/pci/hdsp-pcm.c
sys/dev/sound/pci/hdsp.c
sys/dev/ufshci/ufshci_pci.c
(cherry picked from commit 0fc6c3f731a2cca3120798806c330a3081c9424b)
Focus on the MRQE field of the MRQC register, which is 4 bits wide,
and we use these 3 types of values.
- IXGBE_MRQC_RSSEN 0x1 (non VF mode)
- IXGBE_MRQC_VMDQRSS32EN 0xA (less than 33 VFs)
- IXGBE_MRQC_VMDQRSS64EN 0xB (less than 65 VFs)
If we always take a bitwise OR with IXGBE_MRQC_RSSEN,
IXGBE_MRQC_VMDQRSS32EN will never be chosen.
Select these 3 types of values for the proper case.
Signed-off-by: Yuichiro NAITO <naito.yuichiro@gmail.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/2132
(cherry picked from commit 938c076b9b0bc458a3877b52535527d37199fc09)
This corresponds to Linux f74dc880098b4a29f76d756b888fb31d81ad9a0c
That commit does not provide any public background detail, but it's been
in use for over 5 years and corresponds to previous chip bugs w.r.t.
automatic generation of PAUSE frames.
Reviewed by: kgalazka
Differential Revision: https://reviews.freebsd.org/D54555
(cherry picked from commit 2bdec2ee73be7dbafce9982b0dc5c273918a5443)
Use sbuf_new_for_sysctl() instead of sbuf_new_auto() when exposing
the flags via sysctl.
(cherry picked from commit 8da838ac31692e381adfc63d83ea49f2adabbf23)
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)
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)
This allows adding flags in the upper 32 bits in a consistent way.
No functional change intended.
(cherry picked from commit e0c6c4ecfc755b78ac9135033053d2f15c62bf04)
In the ice_if_promisc_set function, the driver currently disables the
IFF_ALLMULTI flag, thereby preventing the activation of multicast mode.
To address this issue, implement appropriate handling to ensure the
flag is managed correctly.
Signed-off-by: Yogesh Bhosale <yogesh.bhosale@intel.com>
Tested by: Gowthamkumar K S <gowtham.kumar.ks@intel.com>
Differential Revision: https://reviews.freebsd.org/D54186
(cherry picked from commit 98bdf63f6e94be42a1787de73608de15bcb3419a)
The variable reg_rctl stores the value read from reg E1000_RCTL. It
may contain bits E1000_RCTL_VFE and E1000_RCTL_CFIEN which control
VLAN hardware filter feature. The promiscuous mode implies all tagged
or untagged packets should be accepted, so the VLAN hardware filter
feature should be disabled when enabling the promiscuous mode.
Calling em_if_vlan_filter_disable() did the task, but later writing
the value of reg_rctl back to the reg E1000_RCTL may restore the
feature.
Move the calling of em_if_vlan_filter_disable() after writing the reg
to fix that.
PR: 292759
Reviewed by: kbowling
Tested by: vova@zote.me
Fixes: 2796f7cab1 e1000: Fix up HW vlan ops
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54973
(cherry picked from commit e63ee5fedb8dab51f1bd6d24cc650b68d9663db5)
(cherry picked from commit 8880678b7a47ccfdcc14d3e7cad7f137862dccea)
We've gotten a report of this breaking a fixed no autoneg setup.
Since no link is worse than what this intends to fix (negotiating full
duplex at forced speed), revert for the undeway 15.0 release cycle
until this can be further reviewed.
PR: 288827
Differential Revision: https://reviews.freebsd.org/D47336
This reverts commit 645c45e297.
(cherry picked from commit 3ff0231c87f360afa4521e635b46f6c711dc4ee3)
Enabled qat driver support for 402xx device with
ID 0x4944/0x4945. This is an additional device supported
under the existing qat_4xxx driver. Firmwares specific to
the 402xx device are added.
Signed-off-by: Hareshx Sankar Raj <hareshx.sankar.raj@intel.com>
Relnotes: yes
Sponsored by: Intel Corporation
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D52488
(cherry picked from commit 7fbd362c091b2b384d14c3ed5af9234bb2eff9c2)
It is not clear how commit ded037e65e52 could reasonably change BAR
indices, and doing so broke at least the C3000 driver. Revert that part
of the change.
Reported by: kp
Reviewed by: kp, Haresh Sankar Raj <hareshx.sankar.raj@intel.com>
MFC after: 3 days
Fixes: ded037e65e52 ("qat: driver updates to improve code and fix bugs")
Differential Revision: https://reviews.freebsd.org/D51664
(cherry picked from commit 4a8e62a1209f7d7529817c4c27b91fb97750b7b2)
API files are updated to have SPDX identifier and remove
longer form of license to ensure consistency with the
license format across all files.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 2542189532b3025577fa4e782904494f3587008b)
Error handling in qat driver code has been refactored.
Mutex lock handling has also been added during driver
attach and detach. Also pci_disable_busmaster() is called in
adf_detach() to ensure proper cleanup during device detachment.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit ae1dc27639c88038d150660c4096753e210aec42)
Bug fixes and improvements are done for the qat code base
to improve code quality.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit ded037e65e5239671b1292ec987a2e0894b217b5)
Currently code from sal_instances.c and sal_crypto.c
for getting cy instances or number of instances is duplicated.
This commit replaces cpaCyGetXXXInstances implementation with
Lac_GetCyXXXInstancesByType invocation.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit e745eee59c821c1d8ae7f5b25dfbdf0049b4787c)
Access to crucial QAT driver internals, such as
firmware counters and transport debug via
sysctl, has been limited to privileged users only.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 8aa51e6d7de0a828020de64560d1385e15955a1c)
Moved handling of debugfs entries to a separate file.
In addition, it will allow to consolidate the addition of
debugfs entries to a single location in the code.
This implementation adds infrastructure to create (and remove)
debugfs entries at two different stages.
- Done when a device is probed, allows to keep debugfs entries
persistent between a transition in device state (up to down or
vice versa).
- Done after the initialization phase, allows to have debugfs
entries that are accessible only when the device is up.
In addition, moved the creation of debugfs entries for configuration
of the newly created function adf_dbgfs_init() and replace symbolic
permissions with octal permissions when creating the debugfs files.
Added sysctl oids storage for proper cleanup on device down.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit c38bafee7e182fbcdc3c346b2785ed258230cb06)
Some capabilities were not properly fused out based on
the hardware slices. Hence updated the function accordingly.
Both PF and VF are changed.
This change also streamlines capability handling for SYM service:
- Lack of UCS slice does not mean that CIPHER capabilities are not
available.
- SYM capabilities should be considered disabled only if both
AUTH and CIPHER capabilities are not present.
- AUTH capability shouldn't disable CIPHER.
SMX slice mask for qat_4xxx is also corrected to check for
both SM3 and SM4 support.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 4da5c15e5c84738903fd306b54b18a0aaf166d5f)
Multiple typos are corrected across the source code.
Formatting corrections are done to improve code quality
and maintainability. Some files which did not have proper
Copyright license are updated.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 25f09d4a9c358c5452435d299e00c1a1bdafff87)
Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot()
using pci_find_bsf() instead of pci_find_dbsf() (no domain).
This is needed for a wireless driver.
Unfortunately the name [pci_get_slot()] collides with the native PCI
function. Add a guard around it and disable the use when the native
version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the
latter gets fixed we can probably also fix work around it in the former;
further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved).
Sponsored by: The FreeBSD Foundation (initially)
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D52065
(cherry picked from commit 4179e6b78297369f0cf0eae1076e01e5151c5cbe)
(cherry picked from commit 62c3b77d1d1084dc46663eed52e288307b5c7e64)
With Linux 6.16 from_timer() got renamed to timer_container_of(); add
the LINUXKPI_VERSION check with a default to the current version.
Update all in-tree consumers (apart from wireless drivers managed
otherwise).
Sponsored by: The FreeBSD Foundation (initially)
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D52073
(cherry picked from commit 81cb7c4c8e7bc4951c77fe64a63a847ed6abee38)
(cherry picked from commit 352be5b48ba8b3ec1e3e5dd0dbee4da8d1fa78b0)
Remove the unused function ixgbe_is_media_cage_present that
generates a compiler warning.
Signed-off-by: Yogesh Bhosale yogesh.bhosale@intel.com
Reported by: markj
Differential Revision: https://reviews.freebsd.org/D52467
(cherry picked from commit 275f7d72ff6a71bbe46b4282a88f0ea9a24be22a)
This is useful when dev.netmap.port_numa_affinity is set to 1. When
interfaces attach, they get a memory allocator that is copied from
nm_mem. Parameters in nm_mem can be set using sysctls, but this happens
after their values are copied.
To work around this, we can make it possible to set these memory
parameters as tunables.
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54178
(cherry picked from commit c694122f3cfb7d52b882fa79086d49f45a2c7fd2)
We bump the object reference count prior to mapping it into the kernel
map, at which point the vm_map_entry owns the reference. Then, if
vm_map_wire() fails, vm_map_remove() will release the reference, so we
should avoid decrementing it in the error path.
Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53066
(cherry picked from commit dfc1041c08ba32f24b8050b4d635a0bbbfd9b767)
Reporter noted packet loss with 82583. NVM is down level. The
errata docs mention disabling this, which should be the firmware
default, so I am not sure why we were enabling this bit. Linux and
OpenBSD have the same issue, while NetBSD got it right.
Reported by: Codin <codin@nagi.ftp.sh>
Tested by: Codin <codin@nagi.ftp.sh>
(cherry picked from commit 2ead091715dee327b3e00bc9840e1a95827b8e82)
The reporter contacted me with packet loss and throughput fluctuations
on a low power machine (Intel J1900) that got worse with the recent AIM
algorithm in FreeBSD 14.2+.
32K RX PBA matches Linux default. Add a conditional path since we don't
otherwise do a fixup for jumbo frames to retain space for two frames in
Tx.
With this change and an additional errata change, the throughput meets
line rate for the reporter.
Reported by: Codin <codin@nagi.ftp.sh>
Tested by: Codin <codin@nagi.ftp.sh>
(cherry picked from commit aa30bab9a92e1be230b9708bff9f33aae7d384e5)
It was found that in some circumstances when launching
non-waiting create qhash cqp operation the refcount on
the cqp_request may be not properly decremented leading to a memory
leak.
Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Reviewed by: anzhu_netapp.com
Tested by: mateusz.moga_intel.com
Approved by: kbowling (mentor)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D53732
(cherry picked from commit 7b6644e160ed63b633e7c68a3cacf2c71d216cd5)
This is part 2 of the support for the new Intel Ethernet E610 family of devices.
Intel E610 Ethernet Controller devices feature a debug dump capability
that allows you to capture runtime register values directly from the
hardware, with assistance from the firmware. These registers are
organized into clusters based on their function, enabling targeted
debugging. This information is consolidated into a single dump file,
facilitating the debugging of complex issues encountered in the field.
The debug dump provides a snapshot of the device's current hardware
configuration, including switch tables, transmit scheduler tables, and
other relevant data. It captures the state of specified clusters and
serves as a stateless snapshot of the entire device.
This update introduces ioctl and sysctl support for the debug dump feature.
Signed-off-by: Yogesh Bhosale yogesh.bhosale@intel.com
Co-developed-by: Krzysztof Galazka krzysztof.galazka@intel.com
Approved by: kbowling (mentor), erj (mentor)
Tested by: gowtham.kumar.ks_intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50934
(cherry picked from commit 2170400142b99c0eb604403b74ebd88c05dd7ed4)
Virtual Functions are considered untrusted and have no control
over VLAN filtering configuration in HW. To allow using
VLANs on VF intreface driver has to assume that VLAN HW Filtering
is always enabled and pass requests for adding or removing VLAN
tags to Physical Function driver using Mailbox API.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Approved by: kbowling (mentor)
Reviewed by: erj (previous version)
Tested by: gowtham.kumar.ks_intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D53245
(cherry picked from commit 1839526b7315cae62efbd2d1493e6243439effcb)
Virtual Functions have access to a limited number of registers,
and their bus space size is lower. Use KASSERT to detect out-of-bounds
access and eliminate them to avoid kernel panics in production
environment.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: jmg
Tested by: mateusz.moga_intel.com
Approved by: kbowling (mentor), erj (mentor)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D52976
(cherry picked from commit 2c02e6ca7154593d214b62578f67d9fe7db23d70)
Add device IDs and branding strings for E835 adapters.
This is a follow up for E830 adapters with Security Protocol
and Data Model (SPDM) support and RDMA support available
on 100 and 200Gbps links.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Approved by: kbowling (mentor), erj (mentor)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D52782
(cherry picked from commit b202176dc76d862f886778439b96dd1243d8b999)
This is part 1 of the support for the new Intel Ethernet E610 family of devices.
Introduce new PCI device IDs:
• 57AE: Intel(R) E610 (Backplane)
• 57AF: Intel(R) E610 (SFP)
• 57B0: Intel(R) E610 (10 GbE)
• 57B1: Intel(R) E610 (2.5 GbE)
• 57B2: Intel(R) E610 (SGMII)
Key updates for E610 family:
• Firmware manages Link and PHY
• Implement new CSR-based Admin Command Interface (ACI) for SW-FW interaction
• Tested exclusively for x64 operating systems on E610-XT2/XT4 (10G) and E610-IT4 (2.5G)
• Enable link speeds above 1G: 2.5G, 5G and 10G
• NVM Recovery Mode and Rollback support
Signed-off-by: Yogesh Bhosale yogesh.bhosale@intel.com
Co-developed-by: Krzysztof Galazka krzysztof.galazka@intel.com
Approved by: kbowling (mentor), erj (mentor)
Tested by: gowtham.kumar.ks_intel.com
Sponsored by: Intel Corporation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D50067
(cherry picked from commit dea5f973d0c8d29a79b433283d0a2de8f4615957)
This change reapplies the improvements from commit 89e7335 and adds
additional fixes and code optimizations on top of it.
The ixl driver supports up to 128 multicast filters in hardware. When this
limit is exceeded, the driver should enable multicast promiscuous mode.
When the count drops below 128, it should disable promiscuous mode and
restore individual filters.
The driver previously had problems that could corrupt multicast filters list.
The main issue was that ixl_dis_multi_promisc() would attempt to disable
promiscuous mode without checking if it was actually enabled, potentially
corrupting existing filters. There was also no state tracking across driver
functions, leading to redundant operations.
This change adds an IXL_FLAGS_MC_PROMISC flag to track the multicast
promiscuous mode state. The flag is set when enabling promiscuous mode and
cleared when disabling it. Early return checks prevent redundant operations
when the mode is already in the desired state, avoiding filter corruption
and unnecessary hardware calls.
Signed-off-by: Yogesh Bhosale yogesh.bhosale@intel.com
PR: 283820
Approved by: kbowling (mentor)
Tested by: gowtham.kumar.ks_intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D52549
(cherry picked from commit 46a8a1f08f88c278e60ebb6daa7a551eb641c67b)
According to section 5.1.6.2.1 of version 1.3 of the virtio
specification, the driver MUST NOT set VIRTIO_NET_HDR_F_DATA_VALID in
the flags. So don't do that.
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D53650
(cherry picked from commit 836b3cd9d7910aff5225e9e58189067ca03fae30)
Transmit segment offloading depends on transmit checksum offloading.
Enforce that constraint. This also fixes a bug, since if_hwassist bits
are from the CSUM_ space, not from the IFCAP_ space.
PR: 290773
Reviewed by: Timo Völker
Tested by: lg@efficientip.com
Differential Revision: https://reviews.freebsd.org/D53629
(cherry picked from commit 4c50ac68166caf7e08c5a9984d63fa91490fa50d)
- Change vm_page_reclaim_contig[_domain] to return an errno instead
of a boolean. 0 indicates a successful reclaim, ENOMEM indicates
lack of available memory to reclaim, with any other error (currently
only ERANGE) indicating that reclamation is impossible for the
specified address range. Change all callers to only follow
up with vm_page_wait* in the ENOMEM case.
- Introduce vm_domainset_iter_ignore(), which marks the specified
domain as unavailable for further use by the iterator. Use this
function to ignore domains that can't possibly satisfy a physical
allocation request. Since WAITOK allocations run the iterators
repeatedly, this avoids the possibility of infinitely spinning
in domain iteration if no available domain can satisfy the
allocation request.
PR: 274252
Reported by: kevans
Tested by: kevans
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42706
(cherry picked from commit 2619c5ccfe1f7889f0241916bd17d06340142b05)
MFCed as a prerequisite for further MFC of VM domainset changes. Based
on analysis, it would not hurt, and I have been using it in productions
for months now.
Resolved the trivial conflict due to commit 718d1928f874 ("LinuxKPI:
make linux_alloc_pages() honor __GFP_NORETRY") having been MFCed before
this one.
The type of variable promisc and allmulti was changed from int to bool
by commit [1].
[1] 7dce56596f Convert to if_foreach_llmaddr() KPI
MFC after: 3 days
(cherry picked from commit 80dfed11fc1c61ce9168db01dee263447619e859)
Keep the hwassist flags for transmit checksum offload and transmit
segment offload in sync with the enabled capabilities.
Reported by: Timo Völker
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D52765
(cherry picked from commit f2575d56c8c9a8acad4a61a3586546dff4febce1)
Hardware TCP LRO results in problems in settings with IP forwarding
being enabled. In case of nodes without IP forwarding, using
software LRO is also beneficial in general, since it can provide better
information about what was received on the wire.
Therefore, disable hardware TCP LRO by default.
By tuning the loader tunable, this can be changed.
PR: 263229
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D52684
(cherry picked from commit 6e4b811009d63f33c59d51f28fd4a030ca90843e)
Enable the handling of the IFCAP_RXCSUM_IPV6 handling by handling
IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 as a pair. Also make clear, that
software and hardware LRO require receive checksum offload.
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D52682
(cherry picked from commit eaf619fddcb21859311b895a0836da3171a01531)
When ALTQ is enabled, this driver does "hardware" accounting and soft
accounting at the same time. Prefer the "hardware" one to make the logic
simpler.
Reviewed by: zlei
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44817
(cherry picked from commit 2a346c8993cbb92a321a7c25bd9ac4dcaae352d1)
While here, advertise the IFCAP_HWSTATS capability to avoid the net
stack from double counting it.
Co-authored-by: zlei
Reviewed by: zlei
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44816
(cherry picked from commit a14d561e58529c9686a2efc47f4828ad82026e63)
When transmitting a packet over the vtnet interface, map the
csum flags CSUM_DATA_VALID | CSUM_PSEUDO_HDR to the virtio
flag VIRTIO_NET_HDR_F_DATA_VALID.
When receiving a packet over the virtio network channel, translate
the virtio flag VIRTIO_NET_HDR_F_NEEDS_CSUM not to CSUM_DATA_VALID |
CSUM_PSEUDO_HDR, but to CSUM_TCP, CSUM_TCP_IPV6, CSUM_UDP, or
CSUM_UDP_IPV6.
The second change fixes a series of issue related to checksum
offloading for if_vtnet.
While there, improve the stats counters to allow a detailed view
on what is going on in relation to checksum offloading.
PR: 165059
Reviewed by: tuexen, manpages
Differential Revision: https://reviews.freebsd.org/D51686
(cherry picked from commit 3008f30d2c2cabdd7e17f7fb922139da8681ffbd)