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

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Nov 13 20:36:47 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

**Warning: valid all-vports configuration is now rejected**

```c
+	if (non_requested_count == 0) {
+		DP_VERBOSE(p_hwfn, ECORE_MSG_LINK,
+			   "The number of vports is equal to the number of requests\n");
+		return ECORE_INVAL;
+	}
```

The commit message says `non_requested_count` is zero exactly when `req_count == num_vports`. That is the case where every vport, including the one being configured now, has an explicit min rate.

That is a legitimate configuration, not an error. There are simply no non-requested vports left to share `total_left_rate`. With this patch, setting a min rate on the last unconfigured vport always fails with `ECORE_INVAL`, so the division by zero becomes a functional regression.

The failure is also logged only at `DP_VERBOSE`, so users will not see why the request was refused.

Suggested fix: skip the left-rate computation and its 1% validation when there are no non-requested vports, rather than failing:

```c
	/* Data left for non requested vports */
	total_left_rate = min_pf_rate - total_req_min_rate;
	if (non_requested_count != 0) {
		left_rate_per_vp = total_left_rate / non_requested_count;
		/* existing "< 1% of min bw" validation */
	}
```

Make sure any later use of `left_rate_per_vp` is either guarded the same way or harmless when no vport consumes it.

**Info: comment restates the code**

The comment `/* Validate non_requested_count is non-zero */` repeats what the `if` already says. Either drop it or explain why the case matters, for example "all vports have explicit WFQ requests".

Review-Result: WARNING


More information about the test-report mailing list