|WARNING| net/qede/base: fix division by zero

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Nov 13 21:08:39 CET 2026


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

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-13

**drivers/net/qede/base/ecore_dev.c**

**Warning: the new check rejects a valid configuration instead of avoiding the division**

```
+	if (non_requested_count == 0) {
...
+		return ECORE_INVAL;
```

- **Problem:** `non_requested_count == 0` means every vport now has an explicit minimum rate, including the one being configured. That is a legitimate WFQ setup, not an error. With this check, configuring the last remaining vport always fails with `ECORE_INVAL`.
- **Why it matters:** the patch replaces a crash with a functional regression. Users can no longer give every vport an explicit minimum rate.
- **Fix:** when no vports are left without a request, there is nothing to share out, so skip the leftover-rate distribution rather than returning an error. For example:

  ```c
  if (non_requested_count != 0) {
  	total_left_rate = min_pf_rate - total_req_min_rate;
  	left_rate_per_vp = total_left_rate / non_requested_count;
  	/* existing per-vp validation */
  }
  ```

  Any later code that depends on `left_rate_per_vp` should be adjusted to match.

**Info: comment restates the code**

```
+	/* Validate non_requested_count is non-zero */
```

This comment says exactly what the next line does and can be removed.

Review-Result: WARNING


More information about the test-report mailing list