|SUCCESS| crypto/ipsec_mb: fix cipher and auth length calculation
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Mon Nov 23 12:16:22 CET 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/173109
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-23
No correctness defects found in the changed lines. Two optional suggestions:
**Info**
1. **The cipher/auth bit-length classification is now duplicated, larger, in two places.**
It appears in both `aesni_mb_digest_appended_in_src()` and `post_process_mb_job()`, each wrapped in the same `#if IMB_VERSION(3, 0, 0) <= IMB_VERSION_NUM` block, for example:
```
+ || job->cipher_mode == IMB_CIPHER_SNOW5G_NEA4
```
This patch exists because one list fell out of sync with the supported algorithms, so the duplication has already caused a bug once.
Consider factoring the checks into two small static helpers, so future algorithm additions touch one place:
```c
static inline bool
aesni_mb_cipher_len_in_bits(const IMB_JOB *job)
{
switch (job->cipher_mode) {
case IMB_CIPHER_ZUC_EEA3:
case IMB_CIPHER_SNOW3G_UEA2:
case IMB_CIPHER_KASUMI_UEA1:
#if IMB_VERSION(3, 0, 0) <= IMB_VERSION_NUM
case IMB_CIPHER_SNOW5G_NEA4:
case IMB_CIPHER_AES_NEA5:
case IMB_CIPHER_ZUC_NEA6:
#endif
return true;
default:
return false;
}
}
```
A matching `aesni_mb_auth_len_in_bits()` would cover the auth list. A `switch` with `#if`-guarded `case` labels also avoids the dangling-operator problem.
2. **The new conditions use leading `||` operators and space-aligned closing parentheses.**
Examples are `|| job->cipher_mode == ...` and ` ) {`. The rest of the file places operators at the end of the line. The helper or `switch` approach above would also remove this inconsistency.
Review-Result: CLEAN
More information about the test-report
mailing list