public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: mamcgove@microsoft.com
Cc: dev@dpdk.org
Subject: Re: [PATCH v3 1/1] examples/mp_server: warn on promisc enable failure
Date: Tue, 13 Jan 2026 22:13:37 -0800	[thread overview]
Message-ID: <20260113221337.5cbb0d92@phoenix.local> (raw)
In-Reply-To: <d7e617594063d3675636125ec9413ac4cbdc7e51.1758045692.git.mamcgove@microsoft.com>

On Tue, 16 Sep 2025 11:51:14 -0700
mamcgove@microsoft.com wrote:

> From: Matthew G McGovern <mamcgove@microsoft.com>
> 
> Problem: Some devices do not allow promiscuous mode.
> 
> Testpmd handles this by warning and ignoring failures from
> rte_eth_promiscuous_enable.
> 
> Changes: make mp example apps warn if promiscuous mode cannot be
> enabled, rather than failing.
> 
> Signed-off-by: Matthew G McGovern <mamcgove@microsoft.com>
> 
> ---

AI review spotted a bug in this. Note, examples don't have to use RTE_LOG().
Only do so if other code in the example does.

## DPDK Patch Review: examples/mp_server: warn on promisc enable failure

### Summary

This patch changes promiscuous mode enable failure handling in two multi-process example applications from a fatal error to a warning, aligning behavior with testpmd. While the intent is good, there's a **critical bug** in the implementation.

---

### Critical Bug (Error - Must Fix)

**Wrong argument in fprintf format string** - Both changes print `retval` (the error code) where the port number should be:

```c
fprintf(stderr,
    "Error during enabling promiscuous mode for port %u: %s - ignore\n",
    retval, rte_strerror(-retval));
//  ^^^^^^ BUG: should be port_num (init.c) or port (main.c)
```

The `%u` format specifier expects the port number, but receives the negative error code. This will print nonsensical port numbers (e.g., "port 4294967287" for `-ENOTSUP`).

**Fix:**
```c
// In init.c:
fprintf(stderr,
    "Error during enabling promiscuous mode for port %u: %s - ignore\n",
    port_num, rte_strerror(-retval));

// In main.c:
fprintf(stderr,
    "Error during enabling promiscuous mode for port %u: %s - ignore\n",
    port, rte_strerror(-retval));
```

---

### Commit Message Review

| Check | Status | Notes |
|-------|--------|-------|
| Subject ≤60 chars | ✓ | 49 characters |
| Lowercase after colon | ✓ | |
| Imperative mood | ✓ | "warn" is imperative |
| No trailing period | ✓ | |
| Body wrapped at 75 chars | ✓ | |
| Body doesn't start with "It" | ✓ | |
| Signed-off-by present | ✓ | |

**Warning: Subject prefix mismatch** - The subject says `examples/mp_server:` but the patch also modifies `examples/multi_process/symmetric_mp/main.c`. Consider using `examples/multi_process:` to accurately reflect the scope of changes.

---

### Code Style Review

| Check | Status |
|-------|--------|
| Line length ≤100 chars | ✓ |
| No trailing whitespace | ✓ |
| Consistent with surrounding code | ✓ |

---

### Design Considerations (Info)

1. **Consistency with testpmd**: The approach matches how testpmd handles this, which is good for consistency across DPDK examples.

2. **Using fprintf vs RTE_LOG**: Example code commonly uses `fprintf(stderr, ...)` rather than `RTE_LOG()`, so this is acceptable style for examples.

3. **Message wording**: The "- ignore" suffix is slightly awkward. Consider: `"...port %u: %s (continuing anyway)\n"` or simply `"Warning: ..."`

---

### Verdict

**Changes Requested** - The patch has the right intent but contains a significant bug that would produce incorrect/confusing output. After fixing the format string arguments, this should be straightforward to accept.

      reply	other threads:[~2026-01-14  6:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 18:37 [PATCH] examples/symmetric_mp: log/ignore promiscuous fail mamcgove
2025-07-09 14:29 ` Thomas Monjalon
2025-09-03 15:09   ` [EXTERNAL] " Matthew McGovern (LINUX)
2025-09-03 15:24     ` Thomas Monjalon
2025-09-16 17:44 ` [PATCH 0/2] " mamcgove
2025-09-16 17:44   ` [PATCH 1/2] examples/symmetric-mp: ignore promisc enable failure mamcgove
2025-09-16 17:44   ` [PATCH 2/2] examples/mp_server: warn on " mamcgove
     [not found] ` <cover.1758045692.git.mamcgove@microsoft.com>
2025-09-16 18:51   ` [PATCH v3 1/1] " mamcgove
2026-01-14  6:13     ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260113221337.5cbb0d92@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=mamcgove@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox