summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mucse
AgeCommit message (Collapse)Author
6 daysnet: rnpgbe: Accept link-down events without speed magicDong Yibo
The interface can continue reporting carrier up after the link goes down because the driver ignores the firmware's link-down notification. Firmware reports link-down events with a zero port_magic and no valid speed or duplex information. The driver requires ST_VALID_MAGIC for every link event and returns before updating the cached link state when this check fails. It also writes an invalid driver snapshot to firmware instead of acknowledging the link-down state. Validate the speed magic only for link-up events. This allows link-down events to update the cached state, propagate carrier loss, and update the snapshot exported to firmware. Keep the checks for invalid link-up magic and unsupported speeds. Fixes: 92a671d510a8 ("net: rnpgbe: Add link status handling support") Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/C2DFBBF04F1DCFD2+20261026075445.920572-1-dong100@mucse.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-10-19net: rnpgbe: Add link status handling supportDong Yibo
Add link status handling for the RNPGBE driver. Introduce link state data structures for speed, duplex and link state, and process firmware link events delivered over the mailbox, since firmware controls the link and phylink is not used. Add a service task to handle pending events and manage carrier status with netif_carrier_on()/netif_carrier_off(). Notify firmware when the interface is brought up and after the data path is quiesced during teardown, and fail interface open if the firmware port-up or link-report setup fails. Validate firmware link events before updating the cached link state. Enable the GMAC receiver in receive-all mode after the chip-level receive filter has been configured, and document the driver-to-firmware link-state snapshot and reset semantics. Configure firmware after reset to enable autonegotiation. Advertise 10/100Mb/s half- and full-duplex modes and 1000 Mb/s full-duplex mode. Fail probe if firmware does not acknowledge the link setup command. Signed-off-by: Dong Yibo <dong100@mucse.com> Link: https://patch.msgid.link/C41AE78496D9DC2B+20261013023109.63764-1-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-19net: rnpgbe: Add receive mode supportDong Yibo
Add chip-level receive filtering and the ndo_set_rx_mode_async callback. Program the primary and additional unicast addresses into the available RAR entries, and use the 4096-bit multicast hash table for multicast addresses. Advertise RAR-based secondary unicast filtering to the networking core, so it does not force promiscuous mode for a non-empty secondary unicast list. Fall back to accepting all unicast addresses if the RAR table is exhausted, and handle IFF_PROMISC and IFF_ALLMULTI through the chip-level filter control register. Signed-off-by: Dong Yibo <dong100@mucse.com> Link: https://patch.msgid.link/2E0F918C876CD84D+20261013023058.63715-1-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-19net: rnpgbe: Add basic RX data path supportDong Yibo
Add basic RX DMA data path for the RNPGBE driver. Introduce the RX descriptor structure (union rnpgbe_rx_desc) with the hardware write-back format, and manage RX buffers with page_pool using a single page per descriptor without page splitting. Implement the NAPI poll callback, RX ring setup and teardown, and packet assembly from page buffers, along with RX statistics. Keep a 16-descriptor gap in the fixed 512-entry RX ring so at most 496 descriptors are posted to hardware. Retry failed page allocations with one timer per q_vector that schedules NAPI and is cancelled before RX cleanup and q_vector teardown. An RX DMA quiesce timeout is a terminal AXI fault: keep DMA disabled, release existing mappings safely, and reject subsequent opens. Recovery requires a chip-level reset and driver rebind. Signed-off-by: Dong Yibo <dong100@mucse.com> Link: https://patch.msgid.link/FA6FE70B8DB5E7FB+20261013023048.63685-1-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-19net: rnpgbe: Add basic TX packet transmission supportDong Yibo
Add the basic TX path for the RNPGBE driver. Introduce the TX descriptor structure and buffer management, the rnpgbe_xmit_frame_ring() transmit function, TX ring allocation and teardown, and TX completion handling in rnpgbe_clean_tx_irq(). Track TX packet and byte statistics, and report dropped and tx_dropped counts through ndo_get_stats64(). Keep carrier state off during registration. The link-status patch later in this series enables carrier after firmware reports a valid link. Configure streaming and coherent DMA masks for the hardware's 56-bit DMA addressing capability. Add cycles_per_us to struct mucse_hw to scale the TX interrupt timer, and enable NETIF_F_HIGHDMA when the DMA mask allows it. A TX DMA idle timeout is terminal for the current driver instance. The hardware stops PCIe DMA requests, allowing cleanup to release DMA resources. Recovery requires a chip-level reset and driver rebind. Signed-off-by: Dong Yibo <dong100@mucse.com> Link: https://patch.msgid.link/70FB65125730E856+20261013023036.63653-1-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-19net: rnpgbe: Add interrupt handlingDong Yibo
Add interrupt setup and teardown for the RNPGBE driver. Require at least two MSI-X vectors. Reserve vector 0 for the mailbox and assign the remaining vectors to the data path. Set up mailbox workqueue plumbing for asynchronous firmware events. Mailbox transactions run in process context, allowing mailbox lock acquisition to use sleepable polling. Notify firmware of driver powerdown from both remove and shutdown through a shared helper. Signed-off-by: Dong Yibo <dong100@mucse.com> Link: https://patch.msgid.link/A4AA29A72BA34A26+20261013023025.63622-1-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-07-07net: rnpgbe: fix mailbox endianness and remove pointer castsDong Yibo
The rnpgbe mailbox exchanges data through 32-bit MMIO registers in little-endian wire format. The original code had two problems: 1. FW structs (with __le16/__le32 fields) were cast to (u32 *) before reaching the mailbox transport, hiding the endian annotations from sparse. 2. No cpu_to_le32()/le32_to_cpu() conversion was done between CPU-endian MMIO values and the little-endian payload, causing data corruption on big-endian systems. Fix by adding the missing byte-order conversions in the transport layer and introducing union wrappers (mbx_fw_cmd_req_u, mbx_fw_cmd_reply_u) that overlay each FW struct with a __le32 dwords[] array. Callers fill named fields using cpu_to_le16/32(), then pass dwords[] to the transport, which now takes explicit __le32 * instead of u32 *. This eliminates all pointer casts on the mailbox data path and lets sparse verify the conversions. Fixes: 4543534c3ef5 ("net: rnpgbe: Add basic mbx ops support") Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20260701032208.1843156-2-dong100@mucse.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-12net: Consistently define pci_device_ids using named initializersUwe Kleine-König (The Capable Hub)
... and PCI device helpers. The various struct pci_device_id arrays were initialized mostly by one the PCI_DEVICE macros and then list expressions. The latter isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse. Also use PCI_DEVICE* helper macros to assign .vendor, .device, .subvendor and .subdevice where appropriate and skip explicit assignments of 0 (which the compiler takes care of). The secret plan is to make struct pci_device_id::driver_data an anonymous union (similar to https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@baylibre.com/) and that requires named initializers. But it's also a nice cleanup on its own. This change doesn't introduce changes to the compiled pci_device_id arrays. Tested on x86 and arm64. Reviewed-by: Jijie Shao <shaojijie@huawei.com> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Acked-by: Jacob Keller <jacob.e.keller@intel.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Forwarded: id:76da4f44d48bdde84580963862bf9616bee5c9e9.1778149923.git.u.kleine-koenig@baylibre.com (v2) Reviewed-by: Michael Grzeschik <mgr@kernel.org> Link: https://patch.msgid.link/20260511090023.1634387-6-u.kleine-koenig@baylibre.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-04net: rnpgbe: Add register_netdevDong Yibo
Complete the network device (netdev) registration flow for Mucse Gbe Ethernet chips, including: 1. Hardware state initialization: - Send powerup notification to firmware (via echo_fw_status) - Sync with firmware - Reset hardware 2. MAC address handling: - Retrieve permanent MAC from firmware (via mucse_mbx_get_macaddr) - Fallback to random valid MAC (eth_random_addr) if not valid mac from Fw Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20251101013849.120565-6-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-04net: rnpgbe: Add basic mbx_fw supportDong Yibo
Add fundamental firmware (FW) communication operations via PF-FW mailbox, including: - FW sync (via HW info query with retries) - HW reset (post FW command to reset hardware) - MAC address retrieval (request FW for port-specific MAC) - Power management (powerup/powerdown notification to FW) Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20251101013849.120565-5-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-04net: rnpgbe: Add basic mbx ops supportDong Yibo
Add fundamental mailbox (MBX) communication operations between PF (Physical Function) and firmware for n500/n210 chips Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20251101013849.120565-4-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-04net: rnpgbe: Add n500/n210 chip support with BAR2 mappingDong Yibo
Add hardware initialization foundation for MUCSE 1Gbe controller, including: 1. Map PCI BAR2 as hardware register base; 2. Bind PCI device to driver private data (struct mucse) and initialize hardware context (struct mucse_hw); 3. Reserve board-specific init framework via rnpgbe_init_hw. Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: MD Danish Anwar <danishanwar@ti.com> Link: https://patch.msgid.link/20251101013849.120565-3-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-04net: rnpgbe: Add build support for rnpgbeDong Yibo
Add build options and doc for mucse. Initialize pci device access for MUCSE devices. Signed-off-by: Dong Yibo <dong100@mucse.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: MD Danish Anwar <danishanwar@ti.com> Link: https://patch.msgid.link/20251101013849.120565-2-dong100@mucse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>