|WARNING| net/vhost: support queue info query

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Jul 1 08:47:01 CEST 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/166441

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-07-01

# DPDK Patch Review

## Summary
This patch adds queue info query callbacks (`rxq_info_get` and `txq_info_get`) to the vhost PMD to report the negotiated vring size as the descriptor count. The implementation has one correctness issue and one process issue.

---

## Errors

### NULL Pointer Dereference
**File:** `drivers/net/vhost/rte_eth_vhost.c`  
**Functions:** `eth_rxq_info_get()` and `eth_txq_info_get()`

```c
struct vhost_queue *vq = dev->data->rx_queues[rx_queue_id];

qinfo->nb_desc = 0;

if (vq == NULL || vq->vid < 0)
    return;
```

The code accesses `dev->data->rx_queues[rx_queue_id]` before checking whether `dev->data` is NULL. If `dev->data` is NULL, this dereferences a NULL pointer.

**Fix:** Check `dev->data` before accessing its members:

```c
static void
eth_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
		 struct rte_eth_rxq_info *qinfo)
{
	struct rte_vhost_vring vring;
	struct vhost_queue *vq;

	qinfo->nb_desc = 0;

	if (dev->data == NULL)
		return;

	vq = dev->data->rx_queues[rx_queue_id];
	if (vq == NULL || vq->vid < 0)
		return;

	if (rte_vhost_get_vhost_vring(vq->vid, vq->virtqueue_id, &vring) < 0)
		return;

	qinfo->nb_desc = vring.size;
}
```

Apply the same fix to `eth_txq_info_get()`.

---

### Missing Release Notes
**File:** `doc/guides/rel_notes/release_*.rst` (not present in patch)

This patch adds new device operations (`rxq_info_get` and `txq_info_get`) to the vhost PMD, which is a user-visible enhancement. The release notes should document this change under the vhost PMD section.

**Fix:** Add an entry to the current release notes file (e.g., `doc/guides/rel_notes/release_26_07.rst` assuming a 26.07 release):

```rst
* **Updated vhost PMD.**

  * Added support for ``rxq_info_get`` and ``txq_info_get`` device operations
    to report negotiated vring descriptor counts.
```

---

## Warnings

### Missing Feature Matrix Update
**File:** `doc/guides/nics/features/vhost.ini` (not present in patch)

The vhost PMD now supports queue info query operations. This should be reflected in the features matrix.

**Fix:** Verify the feature matrix includes these capabilities. If `Queue status` or a similar feature applies, ensure it is marked as supported for vhost.

---

## Style and Code Quality (No Issues Found)

The following were verified and are correct:
- Variable declarations follow DPDK style (declare at block start or point of use)
- Error path handling sets `qinfo->nb_desc = 0` before all early returns
- No forbidden tokens present
- No use of deprecated API
- Boolean comparisons are explicit (`vq == NULL`, `vq->vid < 0`, `rte_vhost_get_vhost_vring(...) < 0`)
- Function formatting follows DPDK style (return type on own line, opening brace on own line)
- Include order not modified (no changes to includes)

---

## Final Assessment

The patch correctly implements the queue info query feature but has:
1. **One Error:** NULL pointer dereference risk on `dev->data`
2. **One Warning (process):** Missing release notes entry

After fixing the NULL check and adding the release notes, this patch will be compliant with DPDK guidelines.


More information about the test-report mailing list