Re: [PATCH net-next V3 2/5] net/mlx5: nodnic: Implement data path

From: Shahar Shitrit

Date: Sun Nov 29 2026 - 09:45:04 EST




On 27/11/2026 21:03, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 5 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 2 · Low: 3
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] With budget == 0 (netpoll), mlx5_nodnic_napi_poll()
> (drivers/net/ethernet/mellanox/mlx5/nodnic/en.c) runs `if…
> - [Medium] Error CQEs (OPCODE_CQ_SEND_ERR 0xD / OPCODE_CQ_RECV_ERR 0xE)
> are treated as single-WQE failures.
> - [Low] The commit message describes only the TX/RX descriptor paths,
> NAPI and checksum offload.
> - [Low] In mlx5_nodnic_check_features()
> (drivers/net/ethernet/mellanox/mlx5/nodnic/en.c), the comment…
> - [Low] mlx5_nodnic_activate_queues() (en_cfg.c) calls
> napi_enable_locked(&cq->napi), then mlx5_nodnic_arm_cq(cq) from…
>
> --
>
> net/mlx5: nodnic: Implement data path
>
> This commit implements the TX and RX data paths for mlx5_nodnic. It adds
> WQE posting with a BlueFlame doorbell, page pool backed RX, and a NAPI
> poll on a shared CQ that dispatches both TX and RX completions. It also
> wires up ndo_start_xmit and ndo_features_check and enables checksum
> offload.
>
>> Implement NAPI polling and CQE dispatch for TX and RX completions,
>> including RX WQE reposting and CQ re-arming.
>> Wire up ndo_start_xmit and ndo_features_check, and enable TX/RX
>> checksum offload support.
>
> [Severity: Low]
> This isn't a bug, but the commit message leaves out some port lifecycle
> changes. This is the first patch that calls mlx5_nodnic_enable_port() and
> mlx5_nodnic_disable_port(), from ndo_open/ndo_stop. In the parent commit
> they were defined but never called.
>
> The patch also makes three related changes:
>
> - mlx5_nodnic_disable_port() now returns int instead of void.
> - A new mlx5_nodnic_quiesce_port() calls pci_clear_master() on the whole
> function when the VSC port disable fails.
> - mlx5_nodnic_enable_port() is relied on to restore bus mastering on the
> next open.
>
> Could the commit message describe these port enable/disable and bus
> mastering changes?
>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
>> new file mode 100644
>> index 0000000000000..6400e100bcb10
>> --- /dev/null
>> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
>
> [ ... ]
>
>> +static void mlx5_nodnic_handle_err_cqe(struct mlx5_nodnic_cq *cq,
>> + struct mlx5_cqe64 *cqe64,
>> + int napi_budget)
>> +{
>
> [ ... ]
>
>> + if (opcode == OPCODE_CQ_SEND_ERR) {
>> + struct mlx5_nodnic_sq *sq = &priv->sq;
>> + u16 sq_pi = mlx5_nodnic_sq_get_pi(sq, wqe_counter);
>> +
>> + mlx5_nodnic_complete_send_wqe(sq, &sq->wqe_info[sq_pi],
>> + napi_budget);
>> + } else {
>> + struct mlx5_nodnic_rq *rq = &priv->rq;
>> + u16 ci = wqe_counter & (rq->ring.num_entries - 1);
>> +
>> + mlx5_nodnic_release_rx_wqe(rq, ci);
>> + }
>> +}
>
> [Severity: Medium]
> If the device moves the SQ or RQ into an error state after a completion
> error, does anything recover it?
>
> mlx5_nodnic_handle_err_cqe() prints the CQE and then completes or
> releases only the one slot. It records no queue error state and
> schedules no recovery. The syndrome table includes WR_FLUSH_ERR. Under
> mlx5 semantics that syndrome only appears once a queue is already in
> the error state and flushing.
>
> On the TX side, mlx5_nodnic_complete_send_wqe() credits flush
> completions as if they were successful sends. The txq keeps waking and
> xmit keeps posting into the errored SQ while the carrier stays up.
>
> If the SQ stops completing instead, the txq stays stopped forever.
> mlx5_nodnic_netdev_ops has no ndo_tx_timeout, so the watchdog never
> fires.
>
> On the RX side, mlx5_nodnic_napi_poll() refills every freed slot on
> each poll, with no queue health check:
>
> if (!mlx5_nodnic_rq_post_wqes(priv))
> return budget;
>
> Wouldn't each reposted WQE come straight back as a RECV_ERR CQE that
> counts toward rx_work_done? That would keep NAPI and the IRQ busy
> without ever receiving a packet, until a manual ifdown/ifup.
>
> mlx5e recovers from MLX5_CQE_REQ_ERR by moving the SQ through
> ERR->RST->RDY. The health monitoring patch later in this series only
> polls firmware health.
>
> Is the nodnic firmware guaranteed not to put the queue into an error
> state here, or does this need a recovery path?
We don't implement error recovery in this series. On an error CQE the
driver only logs it and releases the slot.
>
> [ ... ]
>
>> +int mlx5_nodnic_napi_poll(struct napi_struct *napi, int budget)
>> +{
>
> [ ... ]
>
>> + while (true) {
>> + cqe = mlx5_nodnic_cq_get_cqe(cq);
>> + if (!cqe)
>> + break;
>> +
>> + /* RX and TX share the CQ. With budget == 0 (netpoll) only TX
>> + * completions may be processed, leave RX CQEs in place.
>> + */
>> + if (unlikely(!budget) && mlx5_nodnic_cqe_is_rx(cqe))
>> + break;
>
> [Severity: Medium]
> With budget == 0, can an RX CQE at the head of the shared CQ block every
> TX completion behind it?
>
> The CQ is consumed strictly in order, so this break leaves cq->cc on the
> RX CQE. The send CQEs after it are never reached,
> mlx5_nodnic_sq_publish_cc() has nothing to publish, and sq->cc does not
> advance.
>
> During a panic with netconsole, NAPI and softirq can't run. Any inbound
> frame that lands at the head, such as a broadcast ARP, stops TX reclaim
> permanently. The failure would go like this:
>
> - BQL or the SQ ring fills.
> - mlx5_nodnic_xmit() sees no room.
> - __netpoll_send_skb() retries netpoll_poll_dev() until it gives up.
> - The skb is queued on npinfo->txq for a workqueue that won't run.
>
> Wouldn't the rest of the panic output be lost?
>
> bnxt handles budget 0 on its shared completion ring by discarding RX
> completions with bnxt_force_rx_discard(), so it can reach the TX
> completions behind them. Would something similar work here?

SQ and RQ use a shared CQ by design, consumed in order, so a
head-of-line RX CQE can delay TX completions under netpoll. Known
limitation for now.
>
> [ ... ]
>
>> +netdev_features_t
>> +mlx5_nodnic_check_features(struct sk_buff *skb, struct net_device *netdev,
>> + netdev_features_t features)
>> +{
>> + features = vlan_features_check(skb, features);
>> +
>> + /* Validate if the tunneled packet is being offloaded by HW */
>> + if (skb->encapsulation && (features & NETIF_F_CSUM_MASK))
>> + return features & ~NETIF_F_CSUM_MASK;
>
> [Severity: Low]
> This isn't a bug, but this comment appears to be copied from
> mlx5e_features_check(). There it is followed by a call to
> mlx5e_tunnel_features_check().
>
> Here nothing is validated. Checksum offload is cleared for every
> encapsulated skb. That behaviour is correct, since
> mlx5_nodnic_tx_build_wqe_eseg() only sets outer L3/L4 checksum flags.
>
> Could the comment say that tunnel checksum offload isn't supported?
Will fix the comment.
>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
>> index 79cd2527966c4..243c720b73b63 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/en_cfg.c
>
> [ ... ]
>
>> +static int mlx5_nodnic_activate_queues(struct mlx5_nodnic_core_dev *dev)
>> +{
>
> [ ... ]
>
>> + mlx5_nodnic_activate_sq(dev);
>> +
>> + napi_enable_locked(&cq->napi);
>> + mlx5_nodnic_arm_cq(cq);
>> + napi_schedule(&cq->napi);
>
> [Severity: Low]
> Is the mlx5_nodnic_arm_cq() call here needed?
>
> Once napi_enable_locked() has run, a busy-poll socket still holding the
> napi_id from a previous session can run mlx5_nodnic_napi_poll() on
> another CPU. That poll updates cq->cc and may call mlx5_nodnic_arm_cq()
> itself after napi_complete_done().
>
> Meanwhile this process-context arm reads cq->cc and cq->arm_sn. It then
> writes cq->dbr.db[1] and the CQ doorbell, and nothing serializes the
> two arms. mlx5_nodnic_cq_irq_handler() also increments cq->arm_sn.
>
> include/linux/mlx5/doorbell.h notes that mlx5_write64() is not atomic on
> 32-bit and needs external locking.
>
> The practical effect looks limited to a stale arm or a spurious
> interrupt. napi_schedule() follows right away, and the poll re-arms when
> it completes. Could this arm be dropped, or moved before
> napi_enable_locked()?
>