aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/axgbe
Commit message (Collapse)AuthorAgeFilesLines
* axgbe: Use the common RSS key without options RSSKevin Bowling8 days1-4/+6
| | | | | | | | | | | | Fetch the common key in the PCI iflib frontend regardless of options RSS and make the key API declaration available in both configurations. Retain the existing hash-field selection and queue-placement branches. The independent ARM frontend is unchanged. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59794
* axgbe: Propagate hardware and PHY initialization failuresKevin Bowling10 days1-16/+24
| | | | | | | | | | | Check hardware initialization instead of discarding its result, and preserve the original initialization error across cleanup. Report a failed init to iflib rather than publishing a running datapath. Return normalized FreeBSD errors from attach_post. Reuse the existing native reset cleanup on failure. MFC after: 2 weeks Sponsored by: BBOX.io
* iflib: Use the framework run-state accessor in driversKevin Bowling12 days1-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace direct IFF_DRV_RUNNING reads in igbv, ixgbe, ixv, iavf, ixl, ice, bnxt Ethernet, aq, enic and the axgbe PCI frontend with iflib_is_running(). Keep each existing mailbox-ready, fault-state, link-state and administrative-up condition: framework admission is not a substitute for device specific readiness. This covers interrupt admission, operational link publication, VF mailbox and VLAN replay, and live-configuration decisions. Remove ifnet temporaries used only to read the driver flags. Replace the em and igc debug dumps' RUNNING/OACTIVE text with one framework admission snapshot. OACTIVE does not mean that the interface or hardware is inactive. Label the result as software admission rather than link state or proof that DMA has stopped, and retain the queue head/tail dumps and separate RS diagnostics. Keep the filter register and requested interface flags in the axgbe PCI promiscuous-mode trace, but remove its unrelated legacy driver flags. Use the parent Ethernet PF context for the bnxt RDMA running check, retaining the link-state check and the existing IB_PORT_ACTIVE policy. Both current RDMA construction paths use the PF netdev, and Ethernet detach synchronously removes the RDMA auxiliary child before iflib frees that context. Declare the direct iflib module dependency. This does not transfer ownership of RDMA queues to iflib. Leave the independent, non-iflib axgbe ARM frontend unchanged. Reviewed by: iflib (gallatin) MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59601
* axgbe: Wire iflib power management methodsKevin Bowling2026-09-031-0/+3
| | | | | | | | | Register the standard iflib device methods for shutdown, suspend, and resume. This gives axgbe the framework managed reinitialization used by other iflib drivers after a power transition. MFC after: 2 weeks Sponsored by: BBOX.io
* axgbe: Align channel lifetime with queue allocationKevin Bowling2026-08-081-42/+37
| | | | | | | | | | | | | | | | DMA channels are allocated by attach_pre but released by queues_free. When iflib fails after attach_pre and before queue allocation, neither the old detach nor queues_free path releases them. Allocate channels with the TX queue state and make queues_free tolerate partially allocated rings. Use it to unwind allocation failures so TX rings are also released when RX allocation fails. An early detach can also precede PHY initialization and interrupt assignment. Skip absent PHY and channel state, and release the locks owned by attach_pre on both failure and detach. MFC after: 2 weeks
* chore: replace {0, 0} with {DEV,KOBJ}METHOD_ENDEnji Cooper2026-02-251-2/+2
| | | | | | | | | | | | | | 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
* iflib: report output drops and handle ENOBUFS properlyAndrew Gallatin2025-09-101-1/+2
| | | | | | | | | | | | | | | | | | | | - Fix an mbuf leak with iflib.simple_tx=1 when we run out of tx descs in iflib_encap(). It seems odd to free the mbuf in iflib_encap(), but that routine consumes mbufs for other reasons, and it seemed safest to free there rather than have the simple tx routine parse return values to determine what needed to be freed. - Increment counters for output drops when ENOBUFS is encountered and output errors when other transmit errors are encountered for both the simple and normal tx routines. - Performed driver changes so that iflib drivers now add the generic output drop and output error counters to their private counters in their ifdi_get_counter routines. Reviewed by: kbowling, markj Differential Revision: https://reviews.freebsd.org/D52369 Sponsored by: Netflix
* axgbe: Fix setting promisc modeZhenlei Huang2024-10-122-5/+7
| | | | | | | | | | | | | | | | | | | | Ethernet drivers should respect IFF_PROMISC rather than IFF_PPROMISC. The latter is for user-requested promisc mode, it implies the former but not vice versa. Some in-kernel components such as if_bridge(4) and bpf(4) will set promisc mode for interfaces on-demand. While here, update the debugging message to be not confusing. This was spotted while reviewing markj@ 's work D46524. Test from Franco shows that the interface seems to be unconditionally initialized to promisc mode regardless of this fix. That needs further investigation. Reviewed by: markj, Franco Fichtner <franco@opnsense.org> Tested by: Franco Fichtner <franco@opnsense.org> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46794
* axgbe: Stop checking for failures from taskqueue_create(M_WAITOK)Zhenlei Huang2024-09-031-7/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45853
* axgbe: Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang2024-09-031-2/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
* axgbe: use bit_foreachDoug Moore2024-08-122-70/+3
| | | | | | | | | bitstring.h includes a definition of bit_foreach, for iterating over the set bits of a bitstring. axgbe implements its own version of this for bitstrings. Drop it, and use the bitstring method. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D46037
* axgbe: Fix two typos in source code commentsGordon Bergling2024-07-211-2/+2
| | | | | | - s/specfied/specified/ MFC after: 3 days
* axgbe: drop unused functionDoug Moore2024-07-181-7/+0
| | | | | | | | A recent change dropped the only use of fls64() in axgbe, so drop its definition. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46030
* axgbe: use standard rounddown_pow_of_twoDoug Moore2024-07-181-18/+2
| | | | | | | | | Drop an implementation of __rounddown_pow_of_two, which triggers Coverity warnings, and use the libkern implementation of rounddown_pow_of_two instead. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46022
* axgbe: Remove a nonsensical use of kernel_sysctlbyname()Mark Johnston2024-07-141-12/+2
| | | | | | No functional change intended. MFC after: 1 week
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-5/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* axgbe: Various stability improvementsStephan de Wit2024-04-298-42/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hook in RSS glue. Default to "off" for the split header feature to ensure netmap compatibility. Change the PCS indirection register values based on hardware type (ported from Linux). Move tunable settings to sysctl_init() and set the defaults there. Ensure it's called at the right time by moving it back. Reset PHY RX data path when mailbox command times out (Ported from Linux). Check if VLAN HW tagging is enabled before assuming a VLAN tag is present in a descriptor. Disable the hardware filter since multicast traffic is dropped in promisc mode. Remove unnecessary return statement. Missing sfp_get_mux, causing a race between ports to read SFP(+) sideband signals. Validate and fix incorrectly initialized polarity/configuration registers. Remove unnecessary SFP reset. axgbe_isc_rxd_pkt_get has no error state, remove unnecessary big packet check. Enable RSF to prevent zero-length packets while in Netmap mode. DMA cache coherency update (ported from Linux). Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1103
* axgbe: Various link stability and module compatibilty improvementsStephan de Wit2024-02-025-91/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the phy_stop() routine to if_detach() to prevent link interruptions when configuring the interface. Accompanying this is a sanity check using phy_started, which was already there but remained unused. We do not move phy_start(), as the logic there is needed for any init routine, be it attach or start. Also bring in the linux PMA_PLL change which addresses the flapping of back-to-back fiber connections. Use miibus for SFP PHYs up to 1G copper. We retry in cases where the PHY is not directly reachable. Set the correct IFM_100_SGMII flag when the phy speed has been set to 100. We remove xgbe_phy_start_aneg() since it's handled by miibus. Add support for 100 and 1000 BASE-BX fiber modules Add support for 25G multirate DACs which are capable of 10G. While here, also fixup the LINK_ERR state. It was impossible to recover from this previously. [[ Note: light style fixes by imp, slight commit message adjustment, and a warning that I don't have the hardware to validate, but the changes do track the commit message and seem otherwise OK ]] Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/768
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-273-3/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* iflib drivers: Constify PCI ID LUTsMarius Strobl2023-08-171-1/+1
| | | | | | | | Since d49e83eac3baf16a22b1c5d42e8438b68b17e6f9, iflib(9) is ready for this change. While at it, make isc_driver_version strings (static) const where not apparently un-const on purpose, too. This reduces the size of the amd64 GENERIC by about 10 KiB.
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1614-28/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Finish mechanical conversion of axgbe(4) to IfAPI.Justin Hibbits2023-02-141-2/+2
| | | | Sponsored by: Juniper Networks, Inc.
* Convert iflib(4) and iflib-based drivers to the DrvAPIJustin Hibbits2022-12-216-40/+41
| | | | | | | | | | | | | | Summary: Convert iflib(4) and the following drivers: * axgbe * em * ice * ixl * vmxnet Sponsored by: Juniper Networks, Inc. Reviewed by: kbowling, #iflib Differential Revision: https://reviews.freebsd.org/D37768
* sys: Nuke double-semicolonsElliott Mitchell2022-11-021-1/+1
| | | | | | | | | A distinct number of double-semicolons have ended up in FreeBSD. Take a pass at getting rid of many of these harmless typos. Reviewed by: emaste, rrs Pull Request: https://github.com/freebsd/freebsd-src/pull/609 Differential Revision: https://reviews.freebsd.org/D31716
* axgbe: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-062-8/+3
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-061-1/+1
|
* if_axgbe: properly release resource in error caseTong Zhang2022-04-111-13/+52
| | | | | | | PR: 262899 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D34628
* axgbe: Remove unused variable in axgbe_msix_que.John Baldwin2022-04-061-2/+2
| | | | | | Keep the register read just in case though it seems possible it is not needed as the function later clears specific interrupts via a write to the same register.
* axgbe_setup_sysctl is a nop, remove it and the call to it.Warner Losh2022-02-281-14/+0
| | | | | | Should we need something like this in the future, we can add it back. Sponsored by: Netflix
* Fix to call callout_init with correct inputs from axp driverRajesh Kumar M A2021-07-131-1/+1
| | | | | | | | | | Approved by: vmaffione, gallatin Reviewed by: hselasky, vmaffione, gallatin Differential Revision: https://reviews.freebsd.org/D31104 MFC after: 1 week
* axgbe: Don't dereference NULL pointersWarner Losh2021-06-031-19/+19
| | | | | | | | | | if (sb == NULL) { ... sb->s_error } is going to be a bad time. Return ENOMEM when we cannot allocate an sbuf for the sysctl rather than dereferencing the NULL pointer just returned. Reviewed by: manu@, allanjude@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30373
* axgbe: fix some link related issuesVincenzo Maffione2021-01-233-6/+25
| | | | | | | | | | | | | | | | | By default, axgbe driver does a receiver reset after predefined number of retries for the link to come up. However, this receiver reset doesn't always suffice, due to an hardware issue. In that case, as a workaround, a complete phy reset is necessary. This patch introduces a sysctl that can be set to 1 to let the driver reset the phy completely, rather than just doing receiver reset. The workaround will be removed once the issue is fixed by means of firmware update. This patch also fixes the handling of the direct attach cables properly. Submitted by: rajesh1.kumar_amd.com Differential Revision: https://reviews.freebsd.org/D28266
* axgbe: driver changes for netmap supportVincenzo Maffione2021-01-165-65/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | AMD 10GbE hardware is designed to have two buffers per receive descriptor to support split header feature. For this purpose, the driver was designed to use 2 iflib freelists per receive queue. So, that buffers from 2 freelists are used to refill an entry in the receive descriptor. The current design holds good with regular data traffic. But, when netmap comes into play, the current design will not fit in. The current netmap interfaces and netmap implementation in iflib doesn't seem to accomodate the design of 2 freelists per receive queue. So, exercising Netmap capability with inbuilt tools like bridge, pkt-gen doesn't work with the 2 freelists driver design. So, the driver design is changed to accomodate the current netmap interfaces and netmap implementation in iflib by using single freelist per receive queue approach when Netmap capability is exercised without disturbing the current 2 freelists approach. The dev.ax.sph_enable tunable can be set to 0 to configure the single free list mode. Thanks to Stephan Dewt for his Initial set of code changes for the stated problem. Submitted by: rajesh1.kumar_amd.com Approved by: vmaffione MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D27797
* iflib: ensure that tx interrupts enabled and cleanupsMatt Macy2021-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doing a 'dd' over iscsi will reliably cause stalls. Tx cleaning _should_ reliably happen as data is sent. However, currently if the transmit queue fills it will wait until the iflib timer (hz/2) runs. This change causes the the tx taskq thread to be run if there are completed descriptors. While here: - make timer interrupt delay a sysctl - simplify txd_db_check handling - comment on INTR types Background on the change: Initially doorbell updates were minimized by only writing to the register on every fourth packet. If txq_drain would return without writing to the doorbell it scheduled a callout on the next tick to do the doorbell write to ensure that the write otherwise happened "soon". At that time a sysctl was added for users to avoid the potential added latency by simply writing to the doorbell register on every packet. This worked perfectly well for e1000 and ixgbe ... and appeared to work well on ixl. However, as it turned out there was a race to this approach that would lockup the ixl MAC. It was possible for a lower producer index to be written after a higher one. On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial response was to add a lock around doorbell writes - fixing the problem but adding an unacceptable amount of lock contention. The next iteration was to use transmit interrupts to drive delayed doorbell writes. If there were no packets in the queue all doorbell writes would be immediate as the queue started to fill up we could delay doorbell writes further and further. At the start of drain if we've cleaned any packets we know we've moved the state machine along and we write the doorbell (an obvious missing optimization was to skip that doorbell write if db_pending is zero). This change required that tx interrupts be scheduled periodically as opposed to just when the hardware txq was full. However, that just leads to our next problem. Initially dedicated msix vectors were used for both tx and rx. However, it was often possible to use up all available vectors before we set up all the queues we wanted. By having rx and tx share a vector for a given queue we could halve the number of vectors used by a given configuration. The problem here is that with this change only e1000 passed the necessary value to have the fast interrupt drive tx when appropriate. Reported by: mav@ Tested by: mav@ Reviewed by: gallatin@ MFC after: 1 month Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D27683
* [axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issueAdrian Chadd2020-12-033-6/+6
| | | | | | | | | | | | * uninitialised variable use * Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV() seems wrong and also causes a compiler warning. Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D26839 Notes: svn path=/head/; revision=368305
* axgbe: fix tinderbox buildMateusz Guzik2020-10-141-2/+0
| | | | Notes: svn path=/head/; revision=366692
* 10Gigabit Ethernet driver for AMD SoCEmmanuel Vadot2020-10-1117-2780/+14196
| | | | | | | | | | | | | | | | This patch has the driver for 10Gigabit Ethernet controller in AMD SoC. This driver is written compatible to the Iflib framework. The existing driver is for the old version of hardware. The submitted driver here is for the recent versions of the hardware where the Ethernet controller is PCI-E based. Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com> MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25793 Notes: svn path=/head/; revision=366628
* axgbe: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-4/+0
| | | | Notes: svn path=/head/; revision=365118
* Do pass removing some write-only variables from the kernel.Alexander Kabaev2017-12-252-10/+1
| | | | | | | | | | | | This reduces noise when kernel is compiled by newer GCC versions, such as one used by external toolchain ports. Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial) Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c) Differential Revision: https://reviews.freebsd.org/D10385 Notes: svn path=/head/; revision=327173
* Port the Linux AMX 10G network driver to FreeBSD as axgbe. It is unlikelyAndrew Turner2017-02-158-2701/+1332
| | | | | | | | | | | | | | | we will import a newer version of the Linux code so the linuxkpi was not used. This is still missing 10G support, and multicast has not been tested. Reviewed by: gnn Obtained from: ABT Systems Ltd Sponsored by: SoftIron Inc Differential Revision: https://reviews.freebsd.org/D8549 Notes: svn path=/head/; revision=313768
* Import the AMD 10G ethernet driver for the AMD Opteron A1100.Andrew Turner2017-02-156-0/+9480
This is from Linux git as of 5eb4dce3b3471ec9d1ea2945fa3d2bab4ac7e100 Obtained from: Linux Sponsored by: SoftIron Inc Notes: svn path=/head/; revision=313767