Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next V3 0/5] net/mlx5: Introduce mlx5_nodnic, a driver for DRAM-less NVIDIA Mellanox NIC functions
@ 2026-11-26 18:24 Tariq Toukan
  2026-11-26 18:24 ` [PATCH net-next V3 1/5] net/mlx5: nodnic: Introduce the mlx5_nodnic driver Tariq Toukan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tariq Toukan @ 2026-11-26 18:24 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni
  Cc: Carolina Jubran, Gal Pressman, open list, Shahar Shitrit,
	Tariq Toukan, Simon Horman

Hi,

This series by Shahar introduces mlx5_nodnic, a Linux driver for the
NODNIC (No-DRAM NIC) hardware interface present in Mellanox/NVIDIA
ConnectX-family ASICs since 2015.

NODNIC is a first-class hardware capability.
It defines a lightweight NIC function intended for contexts where local
DRAM is unavailable or too costly: embedded controllers, management
planes, pre-boot environments, or any resource-constrained instantiation
of a ConnectX NIC. The hardware sends and receives ordinary Ethernet
frames via SQs, RQs and CQs. There is no encapsulation, no private
protocol, and no FW interposition: packets are forwarded as standard
Ethernet between whatever peers are connected to the function. The
interface is documented in the HW spec and has been in production in
non-Linux OS drivers for over a decade.

Where it is used today:
- Embedded management controllers on ConnectX-class ASICs that need a
  network path to the host without consuming a data-path PF.
- Resource-constrained SoC integrations (no local DRAM) where a
  minimal-footprint driver is required.
- Pre-boot / early-OS environments (PXE, iSCSI boot) that need a NIC
  without a full mlx5e stack.
- BF4 management PFs (one concrete deployment): on BlueField-4 the
  firmware exposes a NODNIC PF on the host side and a peer PF on the ARM
  side, using standard vport forwarding to connect them. This provides
  in-band Ethernet connectivity between the host and the DPU OS - SSH,
  PXE, and any standard networking application work over it without any
  special handling.

Design notes:
- The driver is separate from mlx5e rather than a mode within it.
  NODNIC uses PCI Vendor Specific Capability (VSC) for command
  operations - reads and writes over PCI config space - instead of the
  DMA-based command interface used by mlx5_core. This is what makes
  NODNIC usable in environments without reliable DMA access, and it
  makes the two command paths fundamentally incompatible. Folding this
  into mlx5e would mean carrying a second command transport and a second
  resource model through code that is already dense.
- A single SQ, RQ and shared CQ are exposed per function, with two MSI-X
  vectors: the data vector fires on CQEs and drives both TX and RX
  completions, and the event vector notifies on port state changes.
  This is the hardware's model, not a driver simplification.
- The driver exposes a plain netdev with no private uAPI, no ioctls and
  no vendor-specific configuration surface. Everything is driven through
  standard netdev and ethtool interfaces.
- The code lives under drivers/net/ethernet/mellanox/mlx5/nodnic/ and
  shares no paths with mlx5e, keeping the footprint small and the blast
  radius of changes contained.

for Sashiko:
- Where possible we keep the design close to mlx5 (checksum, VSC API, RX
  refill and else).
- We don't implement suspend/resume flows at the moment.
- We don't implement SW timestamps at the moment.
- RX modes aren't needed and the driver doesn't implement
  ndo_set_rx_mode.
- For sizes and values reported by the device, we trust it to provide
  reasonable values.
- This series only wires the basic netdev stats (packets, bytes, and TX
  drops).

Regards,
Tariq

V3:
Address the Sashiko AI review comments:
- Convert PCIBIOS error codes returned by the config space accessors to
  errno.
- Preserve the FW-reported CQ log_size when programming the CQ address.
- Compute the UAR offset in 64 bits.
- Enable NAPI only after the RQ is set up, fixing the open error unwind.
- Disable the port when open fails. If the port cannot be disabled,
  clear bus mastering before freeing DMA memory.
- Use netif_txq_maybe_stop()/netif_txq_completed_wake() for TX flow
  control.
- NAPI poll: handle budget == 0, return budget when the TX limit is hit,
  and update the CQ doorbell record on every poll.
- Rate-limit the error CQE prints.
- Use u64_stats_t for the counters, and read the TX byte count before
  releasing the WQE slot. Also count error TX CQEs in the stats.
- Restore the trailing newline in the Makefile.
- Check pci_save_state() return value.
- Change 1 << log_uar_page_size to 1U <<.
- Add NET_IP_ALIGN to the RX headroom, so the IP header is 4-byte
  aligned.
- Restore bus mastering in mlx5_nodnic_enable_port(), just before
  setting dma_en.
- Return send slots to xmit (sq->cc update and queue wake) only after
  the CQ consumer index has been written to the device at the end of
  each poll.
- Count received packets and bytes before the skb allocation, so packets
  dropped on allocation failure are still included.
- Restore PCI state even if FLR failed.
- Remove the redundant CQ consumer index write from the arm function to
  prevent overwriting a newer value after NAPI ownership is released.
- Disable NAPI before stopping the TX queue to prevent completions from
  waking it again, then quiesce the port after TX submissions have
  stopped. Reorder activation to mirror the deactivation sequence in
  reverse.
- Fail queues opening if the device in fatal state.
- In health polling, check first if the PCI channel is offline.

> +	if (err) {
> +		mlx5_nodnic_core_err(dev,
> +				     "pcie_flr failed with error code %d\n",
> +				     err);
> +		return err;
> +	}
> +	pci_restore_state(dev->pdev);
Could mlx5_nodnic_dev_init() in
drivers/net/ethernet/mellanox/mlx5/nodnic/main.c restore saved PCI state
on a reset error as well?

[SS] A device that fails to come out of FLR is treated as failed and probe aborts,
so there is nothing to restore it for.

Would it be appropriate to hold pci_cfg_access_lock() across the
save/reset/restore transaction in mlx5_nodnic_dev_init(), in
drivers/net/ethernet/mellanox/mlx5/nodnic/main.c?

[SS] pci_save_state() does not require the caller to hold pci_cfg_access_lock().

> +	dseg->byte_count = cpu_to_be32(skb->len & 0x7FFFFFFF);
> +	dseg->lkey = cpu_to_be32(sq->ring.lkey);
> +	dma_addr = dma_map_single(sq->device, skb->data, skb->len,
> +				  DMA_TO_DEVICE);
Could mlx5_nodnic_tx_build_wqe_ds(), in
drivers/net/ethernet/mellanox/mlx5/nodnic/tx.c, handle or reject nonlinear
skbs before mapping the total length as one contiguous buffer?
Pktgen with a positive fragment count and start_xmit mode constructs a
fragmented payload and calls netdev_start_xmit() directly. This bypasses
the ordinary feature-validation linearization despite scatter-gather
offload not being advertised.
Pktgen allocates full-packet linear capacity, so the demonstrated
regression is not necessarily an out-of-allocation read. Instead, the
device reads the unfilled linear payload region rather than the fragments,
sending incorrect bytes and potentially uninitialized allocation contents.
Could this path linearize the packet or map its fragments separately?

[SS] The driver doesn't advertise NETIF_F_SG, so the stack linearizes skbs
before they reach ndo_start_xmit. Only pktgen's start_xmit mode with frags
set can hand us a fragmented skb, which bypasses that validation. That is
a root-only test configuration, so we don't handle this case.

> +	fatal_error = mlx5_nodnic_health_check_fatal_sensors(dev);
> +
> +	if (fatal_error && !health->fatal_error) {
> +		mlx5_nodnic_core_err(dev, "fatal error detected: %s (%u)\n",
> +				     mlx5_nodnic_fatal_error_str(fatal_error),
> +				     fatal_error);
> +		priv->health.fatal_error = fatal_error;
> +		dev->state = NODNIC_DEVICE_STATE_INTERNAL_ERROR;
> +		mlx5_nodnic_print_health_info(dev);
> +		return;
> +	}
Can this fatal transition in mlx5_nodnic_poll_health(), in
drivers/net/ethernet/mellanox/mlx5/nodnic/health.c, also exclude subsequent
interface activation?
If polling detects a fatal condition while the registered interface is
down, an administrative interface-up request still reaches
mlx5_nodnic_open() -> mlx5_nodnic_open_locked() in
drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c. Neither function checks
the fatal health state before mapping the UAR and programming the queues.
mlx5_nodnic_activate_queues() in the same file can then restore bus
mastering and enable the port if the hardware operations succeed. The
VSC offline check does not reject firmware reset requests, NIC
disablement, or NIC software reset based on the recorded health state.
The open path holds priv->state_lock, but the timer does not participate
in that serialization. Could the fatal transition be coordinated with
open through process-context work and an activation guard, so this
regression cannot permit hardware programming after fatal detection?

[SS] Health monitoring here only detects and prints. Fatal-error handling is planned for a follow-up.

What establishes completion of device DMA before cleanup releases the
buffers after this fallback? pci_clear_master() neither reports PCI
configuration-access failure nor explicitly waits for outstanding
transactions, yet cleanup proceeds unconditionally.

[SS] fallback is best effort.

How will netpoll reclaim TX descriptors when an RX CQE is ahead of the
send completions? Every zero-budget poll stops at the same RX CQE.
During panic netconsole output, ordinary NAPI cannot be relied on to
clear it. Once the SQ fills, diagnostic packets remain unsent; netpoll's
bounded retries only defer them to a worker. This needs a TX progress
mechanism that does not perform RX processing with a zero budget.

[SS] RX and TX share a single CQ and the ring is consumed in order,
so a zero-budget poll cannot reach TX CQEs behind an RX CQE without doing RX work

V2:
https://lore.kernel.org/all/20261008171821.660739-1-tariqt@nvidia.com/
- Fix sparse warnings in the VSC accessors: use __be32 for the
  big-endian accessors and drop the redundant le32 conversions, which
  were also wrong on big-endian hosts (Simon Horman).
- Cover letter: drop the devlink mention (Simon Horman).
- Replace the open-coded bitfield macros in the VSC code with
  GENMASK/BIT and FIELD_GET/u32_replace_bits, and turn the config space
  accessor macros into functions.
- Fix line wrapping reported by checkpatch --strict.
- Add a MAINTAINERS entry for the driver.
- Kconfig: select PAGE_POOL, fixing the build when it is not otherwise
  enabled.
- Drop inline from a function in a .c file.

V1:
https://lore.kernel.org/all/20260930125708.144767-1-tariqt@nvidia.com/

Shahar Shitrit (5):
  net/mlx5: nodnic: Introduce the mlx5_nodnic driver
  net/mlx5: nodnic: Implement data path
  net/mlx5: nodnic: Add TX/RX statistics
  net/mlx5: nodnic: Add ethtool driver info
  net/mlx5: nodnic: Add health monitoring

 MAINTAINERS                                   |    9 +
 drivers/net/ethernet/mellanox/Kconfig         |    1 +
 drivers/net/ethernet/mellanox/Makefile        |    1 +
 .../net/ethernet/mellanox/mlx5/nodnic/Kconfig |   19 +
 .../ethernet/mellanox/mlx5/nodnic/Makefile    |    8 +
 .../net/ethernet/mellanox/mlx5/nodnic/en.c    |  286 ++++
 .../net/ethernet/mellanox/mlx5/nodnic/en.h    |  162 +++
 .../ethernet/mellanox/mlx5/nodnic/en_cfg.c    | 1152 +++++++++++++++++
 .../ethernet/mellanox/mlx5/nodnic/health.c    |  315 +++++
 .../net/ethernet/mellanox/mlx5/nodnic/main.c  |  866 +++++++++++++
 .../ethernet/mellanox/mlx5/nodnic/nodnic.h    |  105 ++
 .../mellanox/mlx5/nodnic/nodnic_ifc.h         |  318 +++++
 .../mellanox/mlx5/nodnic/nodnic_pci_vsc.c     |  347 +++++
 .../mellanox/mlx5/nodnic/nodnic_pci_vsc.h     |   45 +
 .../net/ethernet/mellanox/mlx5/nodnic/rx.c    |  174 +++
 .../net/ethernet/mellanox/mlx5/nodnic/rx.h    |   25 +
 .../net/ethernet/mellanox/mlx5/nodnic/tx.c    |  237 ++++
 .../net/ethernet/mellanox/mlx5/nodnic/tx.h    |   61 +
 18 files changed, 4131 insertions(+)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/Kconfig
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/Makefile
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/health.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/main.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_ifc.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_pci_vsc.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_pci_vsc.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/rx.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/rx.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/tx.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/tx.h

base-commit: 05b5019b01fb9443b09ae4ed34af1135a80a84c8
--
2.44.0

Issue: 4971712
Change-Id: Ic857b4c8532a35fbadbfe6056a97c6d711829e6a
Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Shahar Shitrit (5):
  net/mlx5: nodnic: Introduce the mlx5_nodnic driver
  net/mlx5: nodnic: Implement data path
  net/mlx5: nodnic: Add TX/RX statistics
  net/mlx5: nodnic: Add ethtool driver info
  net/mlx5: nodnic: Add health monitoring

 MAINTAINERS                                   |    9 +
 drivers/net/ethernet/mellanox/Kconfig         |    1 +
 drivers/net/ethernet/mellanox/Makefile        |    1 +
 .../net/ethernet/mellanox/mlx5/nodnic/Kconfig |   19 +
 .../ethernet/mellanox/mlx5/nodnic/Makefile    |    8 +
 .../net/ethernet/mellanox/mlx5/nodnic/en.c    |  295 +++++
 .../net/ethernet/mellanox/mlx5/nodnic/en.h    |  168 +++
 .../ethernet/mellanox/mlx5/nodnic/en_cfg.c    | 1158 +++++++++++++++++
 .../ethernet/mellanox/mlx5/nodnic/health.c    |  303 +++++
 .../net/ethernet/mellanox/mlx5/nodnic/main.c  |  869 +++++++++++++
 .../ethernet/mellanox/mlx5/nodnic/nodnic.h    |  130 ++
 .../mellanox/mlx5/nodnic/nodnic_ifc.h         |  317 +++++
 .../mellanox/mlx5/nodnic/nodnic_pci_vsc.c     |  347 +++++
 .../mellanox/mlx5/nodnic/nodnic_pci_vsc.h     |   45 +
 .../net/ethernet/mellanox/mlx5/nodnic/rx.c    |  174 +++
 .../net/ethernet/mellanox/mlx5/nodnic/rx.h    |   25 +
 .../net/ethernet/mellanox/mlx5/nodnic/tx.c    |  265 ++++
 .../net/ethernet/mellanox/mlx5/nodnic/tx.h    |   65 +
 18 files changed, 4199 insertions(+)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/Kconfig
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/Makefile
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/health.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/main.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_ifc.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_pci_vsc.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic_pci_vsc.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/rx.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/rx.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/tx.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/nodnic/tx.h


base-commit: 612848d37e68b858e15815175f1c5e609e09d719
-- 
2.44.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-26 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 18:24 [PATCH net-next V3 0/5] net/mlx5: Introduce mlx5_nodnic, a driver for DRAM-less NVIDIA Mellanox NIC functions Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 1/5] net/mlx5: nodnic: Introduce the mlx5_nodnic driver Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 2/5] net/mlx5: nodnic: Implement data path Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 3/5] net/mlx5: nodnic: Add TX/RX statistics Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 4/5] net/mlx5: nodnic: Add ethtool driver info Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 5/5] net/mlx5: nodnic: Add health monitoring Tariq Toukan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox