aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/dpaa2
Commit message (Collapse)AuthorAgeFilesLines
* dpaa2: allow tapping of tx packets in dpniBjoern A. Zeeb2024-10-161-0/+2
| | | | | | | | | | Packet capturing on dpni is only half-working given the BPF_MTAP call in the TX path is missing. Add it to see packets in both directions. Reviewed by: dsl Differential Revision: https://reviews.freebsd.org/D47103 (cherry picked from commit e69e172d40585cfbcfdb28433cec523ca4867cf1)
* dpaa2: fix MRU for dpni (and software vlans along)Bjoern A. Zeeb2024-10-161-4/+7
| | | | | | | | | | | | | | | | | | | | 0480dccd3f34 tried to fix the MTU for software VLANs given dpni announces IFCAP_VLAN_MTU. Unfortunately the initial MRU during setup is reduced from the maximum supported by the HW to our maximum ethernet RX frame length so only after further mtu toggles the solution there would work. Set the maximum RX frame size (without CRC) to jumbo length + vlan encap len by default given we also announce IFCAP_JUMBO_MTU. While here improve the manual (ioctl) MTU setting by checking if IFCAP_VLAN_MTU is currently enabled and only then add the extra bytes. Fixes: 0480dccd3f347da0dbccf5917633435d5ce6cb86 Reviewed by: dsl Differential Revision: https://reviews.freebsd.org/D47066 (cherry picked from commit fa3dfeff95a5bafcf13accaed5164bfc4e028d9a)
* dpaa2: Stop checking for failures from malloc/taskqueue_create(M_WAITOK)Zhenlei Huang2024-09-303-24/+0
| | | | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45853 (cherry picked from commit 36ef39831fe0e89f0b1672340a44c4ac1183158e)
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-07-121-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 (cherry picked from commit aa3860851b9f6a6002d135b1cac7736e0995eedc)
* dpaa2: make software VLANs usable on dpniBjoern A. Zeeb2023-11-301-1/+1
| | | | | | | | | | | | | | dpni announces IFCAP_VLAN_MTU but internally does not increase the maximum frame length. Createing a vlan interface on top of a dpni interface will result in full-sized frames not passing. Extend the maximum frame length by ETHER_VLAN_ENCAP_LEN to allow at least for one layer of (software) vlans for now GH-Issue: https://github.com/mcusim/freebsd-src/issues/22 Reviewed by: dsl Differential Revision: https://reviews.freebsd.org/D42645 (cherry picked from commit 0480dccd3f347da0dbccf5917633435d5ce6cb86)
* dpaa2: defer link_state updates until we are upBjoern A. Zeeb2023-11-301-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | dpaa2_ni_media_change() was called in early setup stages, before we were fully setup. That lead to internal driver state being all synched and fine but hardware state was lost/never setup corrently. Introduce dpaa2_ni_media_change_locked() so we can avoid reccursive locking and call "dpaa2_ni_media_change()" instead of mii_mediachg() as the latter does not setup our state there either. In order for this all to work, call if_setdrvflagbits() just before rather than after the above. Also remove an unecessary direct call to dpaa2_ni_miibus_statchg() which mii_mediachg() will trigger anyway. This all fixes a problem [1] that one had to lose the link (either unplugging/replugging the cable or using ifconfig media none; ifconfig media auto) to re-trigger the all updates and get the full state programmed when hardware expected. GH-Issue: https://github.com/mcusim/freebsd-src/issues/21 [1] Reviewed by: dsl, dch Differential Revision: https://reviews.freebsd.org/D42643 (cherry picked from commit 964b3408fa872178aacf58f2d84dc43564ec0aa7)
* dpaa2: fdt improve detection for dpmac/physBjoern A. Zeeb2023-11-301-2/+0
| | | | | | | | | | | 'pcs-handles' are not mandatory in the device tree here so do not enforce them. This allows us to find dpmac entries needed for phys on the WHLE-LS1 as well. Reviewed by: jceel, dsl Differential Revision: https://reviews.freebsd.org/D42644 (cherry picked from commit 6c46ebb05dccdcee18f64dc122e6685c05180217)
* dpaa2: Clean up channels in separate tasksDmitry Salychev2023-08-2015-1238/+1820
| | | | | | | | | | | | | | | | | | Each channel gets its own DMA resources, cleanup and "bufferpool" tasks, and a separate cleanup taskqueue to isolate channels operation as much as possible to avoid various kernel panics under heavy network load. As a side-effect of this work, dpaa2_buf structure is simplified and all of the functions to re-seed those buffers are gathered now in dpaa2_buf.h and .c files; functions to work with channels are extracted into dpaa2_channel.h and .c files as well. Reported by: dch Reviewed by: bz Approved by: bz (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41296
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1614-28/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* dpaa2: Simplify addresses translation with PHYS_TO_DMAPDmitry Salychev2023-05-114-158/+113
| | | | | | | Approved by: bz (mentor) Reviewed by: bz (mentor), mhorne Differential Revision: https://reviews.freebsd.org/D39946 MFC after: 3 weeks
* dpaa2: Replace boolean_t with bool.John Baldwin2023-05-042-2/+2
| | | | | | | This was already using true/false rather than TRUE/FALSE. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D39924
* dpaa2: add console support for FDT based systemsBjoern A. Zeeb2023-04-201-0/+581
| | | | | | | | | | | | | | | Add DPAA2 console support for MC and AIOP (latter untested) for FDT systems. ACPI systems are prepared but need some proper bus function in order to get the address from MC (and likely a file splitup then). This will come at a later stage once other ACPI/FDT bus parts are cleared up. The work was originally done in July 2022 and finally switched to bus_space[1] lately to be ready for main. Suggested by: andrew [1] Reviewed by: dsl MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38592
* dpaa2: Avoid dpaa2_cmd race conditionsDmitry Salychev2023-04-1913-668/+1224
| | | | | | | | | | | | struct dpaa2_cmd is no longer malloc'ed, but can be allocated on stack and initialized with DPAA2_CMD_INIT() on demand. Drivers stopped caching their DPAA2 command objects (and associated tokens) in the software contexts in order to avoid using them concurrently. Reviewed by: bz Approved by: bz (mentor) MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D39509
* dpaa2_mc.c: unbreak by adding <sys/lock.h>Joerg Wunsch2023-03-081-0/+1
| | | | | | | | When compiling current on arm64, it breaks since LA_UNLOCKED is undefined. This was in turn caused by the mutex code aliasing it as MA_NOTOWNED. Add <sys/lock.h> so the macro is defined.
* dpaa2: Mechanically convert to IfAPIJustin Hibbits2023-03-081-52/+51
| | | | | | Reviewed By: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38959
* Make sure error is defined in dpaa2Andrew Turner2022-10-271-1/+1
| | | | | | | The error variable is used in both the ACPI and FDT paths. Declare it unconditionally. Sponsored by: The FreeBSD Foundation
* dpaa2: cleanup some include filesBjoern A. Zeeb2022-10-241-1/+0
| | | | | | | | | | 2782ed8f6cd3d7f59219a783bc7fa7bbfb1fe26f fixed the standalone module build. REmove the now duplicate includes for opt_acpi.h and opt_platform.h. Als remove the if_mdio.h again in both the Makefile and the implementation file as it is not (currently) used. X-MFC with: ba7319e9091b4f6ef15a9c4be3d3d076f3047f72 MFC after: 70 days
* dpaa2: fix build without WITNESSGleb Smirnoff2022-10-181-0/+1
| | | | | Using mutex(9) requires including <sys/lock.h> per manual page. With WITNESS the header was cryptically included via dpaa_ni.h -> mbuf.h.
* dpaa2: fix build without FDTGleb Smirnoff2022-10-181-1/+3
|
* Add initial DPAA2 supportDmitry Salychev2022-10-1429-0/+17536
DPAA2 is a hardware-level networking architecture found in some NXP SoCs which contain hardware blocks including Management Complex (MC, a command interface to manipulate DPAA2 objects), Wire Rate I/O processor (WRIOP, packets distribution, queuing, drop decisions), Queues and Buffers Manager (QBMan, Rx/Tx queues control, Rx buffer pools) and the others. The Management Complex runs NXP-supplied firmware which provides DPAA2 objects as an abstraction layer over those blocks to simplify an access to the underlying hardware. Each DPAA2 object has its own driver (to perform an initialization at least) and will be visible as a separate device in the device tree. Two new drivers (dpaa2_mc and dpaa2_rc) act like firmware buses in order to form a hierarchy of the DPAA2 devices: acpiX (or simplebusX) dpaa2_mcX dpaa2_rcX dpaa2_mcp0 ... dpaa2_mcpN dpaa2_bpX dpaa2_macX dpaa2_io0 ... dpaa2_ioM dpaa2_niX dpaa2_mc is suppossed to be a root of the hierarchy, comes in ACPI and FDT flavours and implements helper interfaces to allocate and assign bus resources, MSI and "managed" DPAA2 devices (NXP treats some of the objects as resources for the other DPAA2 objects to let them function properly). Almost all of the DPAA2 objects are assigned to the resource containers (dpaa2_rc) to implement isolation. The initial implementation focuses on the DPAA2 network interface to be operational. It is the most complex object in terms of dependencies which uses I/O objects to transmit/receive packets. Approved by: bz (mentor) Tested by: manu, bz MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D36638