Re: [PATCH v4 0/8] net/nfb: rework to real multiport

Stephen Hemminger
2026-01-23T01:01:25Z

On Thu, 22 Jan 2026 08:27:11 +0100
spinler@cesnet.cz wrote:

> From: Martin Spinler <spinler@cesnet.cz>
>
> This series implements real multiport for better user experience.
>
> The existing driver creates one ethdev/port for one PCI device.
> As the CESNET-NDK based cards aren't capable to represent each
> Ethernet port by own PCI device, new driver implementation
> processes real port configuration from firmware/card and switches
> from rte_eth_dev_pci_generic_probe to multiple rte_eth_dev_create calls.
>
> ---
> v4:
> * Cleaned usage of sprintf
> * Updated commit message for doc cleanup

Second AI opinion:
=== Patch Review: bundle-1675-nfb-multiport.mbox (via Grok) ===
### Review of DPDK Patch Series 'bundle-1675-nfb-multiport.mbox'

Below is a detailed review of the patch series against the DPDK coding standards and contribution guidelines as outlined in `AGENTS.md`. The feedback is organized by severity level: **Error**, **Warning**, and **Info**.

---

### **Errors (Must Fix)**

1. **Commit Message Body Missing for All Patches (All 8 Patches)**
- **Issue**: The commit messages for all patches lack a detailed body describing the issue being fixed or the feature being added. According to the guidelines, the commit body must provide context for reviewers, describe the changes, and should not start with "It". Currently, the body only contains the `Signed-off-by` line after a brief one-liner in some cases.
- **Location**: All patches (1/8 to 8/8).
- **Action**: Add a detailed commit message body for each patch explaining the purpose, context, and impact of the changes. Ensure the body is wrapped at 75 characters.

2. **Missing Release Notes for Significant Driver Changes (Patches 2/8, 3/8, 4/8, 5/8)**
- **Issue**: Patches introducing significant driver changes (multi-port support, VDEV support, port argument, MAC initialization per device) do not update the release notes adequately except for patch 8/8. The guidelines require release notes for API changes, new drivers, or significant subsystem updates to be updated in the current release notes file.
- **Location**: Patches 2/8, 3/8, 4/8, 5/8.
- **Action**: Ensure that significant changes are documented in the release notes file for the current release. Patch 8/8 updates `release_26_03.rst`, which is good, but earlier patches should also reference or contribute to this update if they are part of the same series.

3. **Missing Tests for New Features (Patches 2/8, 3/8, 4/8, 7/8)**
- **Issue**: New features such as multi-port support, VDEV probing, port selection argument, and firmware version reporting do not mention accompanying tests in the `app/test` directory or hooks in `app/testpmd`. The guidelines mandate that new APIs and significant features must have corresponding tests and `testpmd` hooks.
- **Location**: Patches 2/8, 3/8, 4/8, 7/8.
- **Action**: Add unit tests in the `app/test` directory using the `TEST_ASSERT` macros and `unit_test_suite_runner` infrastructure. Ensure `testpmd` hooks are implemented for new features like port selection and firmware version reporting.

---

### **Warnings (Should Fix)**

1. **Documentation Gaps and Mismatches (Patches 2/8, 3/8, 4/8, 7/8)**
- **Issue**: While patch 8/8 updates the documentation, earlier patches introducing new features (multi-port, VDEV, port argument, firmware version) do not update documentation atomically. The guidelines require that code and documentation updates be in the same patch. Additionally, ensure that PMD features match the `doc/guides/nics/features/` matrix.
- **Location**: Patches 2/8, 3/8, 4/8, 7/8.
- **Action**: Move relevant documentation updates into the respective patches introducing the features. Verify that `doc/guides/nics/features/nfb.ini` reflects all new features (e.g., multi-port support, VDEV) as introduced. Ensure device operations are documented per `features.rst` mappings.

2. **New APIs Not Marked as `__rte_experimental` (Patches 2/8, 3/8, 4/8, 7/8)**
- **Issue**: New functions such as `nfb_eth_common_probe`, `nfb_eth_common_remove`, `nfb_eth_fw_version_get`, and others introduced in the patches are not marked as `__rte_experimental` in header files. The guidelines require new APIs to be marked as experimental.
- **Location**: `drivers/net/nfb/nfb.h` and related patches (2/8, 3/8, 4/8, 7/8).
- **Action**: Mark new public APIs as `__rte_experimental` in header files, ensuring the tag is alone on the line preceding the return type.

3. **Inappropriate Use of `rte_calloc` and `rte_zmalloc` (All Patches)**
- **Issue**: The patches use `rte_calloc` and `rte_zmalloc` for allocations that do not necessarily require hugepage memory (e.g., `priv->queue_map_rx` in patch 1/8, `internals` in patch 2/8). The guidelines state that `rte_malloc` should only be used for DMA-accessible memory or shared memory between processes.
- **Location**: Multiple locations across patches (e.g., `drivers/net/nfb/nfb_ethdev.c` in patch 1/8, line 579; patch 2/8, line 542).
- **Action**: Replace `rte_calloc` and `rte_zmalloc` with standard `calloc` or `malloc` for control path allocations unless hugepage memory is explicitly required for DMA or multi-process sharing.

4. **Driver Global Variables Without Unique Prefixes (All Patches)**
- **Issue**: Global variables and structures (e.g., `nfb_eth_dev_list` in patch 2/8) do not use a unique driver-specific prefix (e.g., `nfb_`). The guidelines require unique prefixes for global symbols to avoid clashes during static linking.
- **Location**: `drivers/net/nfb/nfb_ethdev.c` (patch 2/8, line 29).
- **Action**: Add a driver-specific prefix (e.g., `nfb_`) to global variables and structures to prevent namespace collisions.

5. **Missing `Cc: stable@dpdk.org` for Potential Backports (Patches 1/8, 6/8)**
- **Issue**: Patches that could be candidates for stable backports (e.g., queue mapping preparation in 1/8, PCI ID updates in 6/8) do not include `Cc: stable@dpdk.org` as required by the guidelines.
- **Location**: Commit messages of patches 1/8 and 6/8.
- **Action**: Add `Cc: stable@dpdk.org` to commit messages for patches that fix issues or add compatibility and are suitable for backporting.

6. **Use of `snprintf` Return Value Without Proper Check (Patches 2/8, 3/8, 4/8)**
- **Issue**: The return value of `snprintf` is checked for overflow in some cases but not consistently handled for errors (e.g., negative return values). The guidelines encourage explicit error handling.
- **Location**: `drivers/net/nfb/nfb_ethdev.c` (patch 2/8, line 781); `drivers/net/nfb/nfb_vdev.c` (patch 3/8, line 67).
- **Action**: Ensure `snprintf` return values are checked for both overflow and error conditions (< 0).

---

### **Info (Consider)**

1. **Minor Style Preferences for Commit Messages (All Patches)**
- **Issue**: While the subject lines are generally within 60 characters and follow the correct prefix (`net/nfb:`), some could be more descriptive (e.g., patch 6/8: "add compatible cards to driver PCI ID table" could specify key cards like "add FB2CGHH and COMBO-400G1 to PCI ID table").
- **Location**: Commit messages of all patches.
- **Action**: Consider refining subject lines for clarity and specificity while maintaining the length limit and imperative mood.

2. **Optimization Suggestion for Queue Mapping Initialization (Patch 1/8)**
- **Issue**: The initialization of `queue_map_rx` and `queue_map_tx` uses a simple 1:1 mapping loop. This could potentially be optimized using `memcpy` if the mapping is always linear in the default case.
- **Location**: `drivers/net/nfb/nfb_ethdev.c` (patch 1/8, lines 587-590).
- **Action**: Consider using `memcpy` or a similar approach for initializing large arrays if performance is a concern in this path (though this is a control path, so impact may be negligible).

3. **Alternative Approach for Port Selection Logic (Patch 4/8)**
- **Issue**: The port selection logic using a bitmask (`port_mask`) is functional but could potentially be simplified by using a dynamic array or list for selected ports if the number of ports grows significantly in future hardware.
- **Location**: `drivers/net/nfb/nfb_ethdev.c` (patch 4/8, lines 694-718).
- **Action**: Consider if a more flexible data structure (e.g., a dynamic array) would be better for future scalability, though the current bitmask approach is acceptable for the current scope.

4. **Code Duplication in MAC Initialization (Patch 5/8)**
- **Issue**: The `nfb_nc_rxmac_init` and `nfb_nc_txmac_init` functions have similar logic for iterating over interfaces and initializing MACs. This could be refactored into a common helper function to reduce duplication.
- **Location**: `drivers/net/nfb/nfb_ethdev.c` (patch 5/8, lines 54-75 and 79-100).
- **Action**: Consider refactoring the common logic into a helper function to improve maintainability.

---

### **Summary of Compliance with Guidelines**

- **Commit Message Format**: Non-compliant due to missing detailed bodies (Error). Subject lines are mostly compliant with minor improvements suggested (Info).
- **License/Copyright Compliance**: Compliant. All new files (e.g., `nfb_vdev.c` in patch 3/8) include proper SPDX identifiers and copyright notices.
- **C Coding Style Issues**: Mostly compliant with minor issues around `rte_malloc` usage and global variable naming (Warnings).
- **API and Documentation Requirements**: Non-compliant due to missing `__rte_experimental` tags, incomplete documentation updates in individual patches, and missing tests (Errors and Warnings).
- **Other Guideline Violations**: Missing release notes updates in relevant patches and potential backport tags (Errors and Warnings).

---

### **Action Plan for Contributors**

1. **Immediate Fixes (Errors)**:
- Add detailed commit message bodies to all patches.
- Ensure release notes are updated atomically with feature patches or reference the final documentation patch (8/8) explicitly.
- Add tests and `testpmd` hooks for new features.

2. **High-Priority Improvements (Warnings)**:
- Update documentation in the same patch as code changes.
- Mark new APIs as `__rte_experimental`.
- Replace inappropriate `rte_malloc`/`rte_calloc` usage with standard `malloc`/`calloc`.
- Add driver-specific prefixes to global variables.
- Add `Cc: stable@dpdk.org` where applicable.

3. **Optional Enhancements (Info)**:
- Refine commit message subject lines for clarity.
- Consider optimization and refactoring suggestions for maintainability and scalability.

Please address the **Errors** and **Warnings** before resubmission to ensure compliance with DPDK guidelines. If you have any questions or need further clarification on specific issues, feel free to ask.