|WARNING| net/vhost: fix SW checksum when zero
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sat Oct 17 19:32:25 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/171583
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-17
# DPDK Patch Review
## ERRORS
None.
## WARNINGS
### Boolean expression ordering (2 occurrences)
**Line 349 (Tx path):**
```c
if (unlikely(csum == 0) && (mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP)
```
**Line 392 (Rx path):**
```c
if (unlikely(csum == 0) && (ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP)
```
The `unlikely()` wrapper applies only to the first condition (`csum == 0`), but both conditions together determine the unlikely outcome. The packet type check is more selective than the zero-checksum check, so it would be more efficient to test it first, and more correct to apply `unlikely()` to the combined condition.
**Suggested fix:**
```c
if (unlikely((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP && csum == 0))
```
And similarly for line 392:
```c
if (unlikely((ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP && csum == 0))
```
This places the more selective test first (eliminating non-UDP packets immediately) and applies `unlikely()` to the entire compound condition (UDP packets with computed checksum of zero are rare).
---
## INFO
None.
---
Review-Result: WARNING
More information about the test-report
mailing list