[PATCH v18 00/13] net/sxe: added Linkdata sxe ethernet driver

Stephen Hemminger stephen at networkplumber.org
Tue Mar 3 16:42:10 CET 2026


On Tue,  3 Mar 2026 17:10:44 +0800
liujie5 at linkdatatechnology.com wrote:

> From: Jie Liu <liujie5 at linkdatatechnology.com>
> 
> This patch set implements core functionality for the SXE PMD,
> including basic driver framework, data path setup, and advanced
> offload features (VLAN, RSS, DCB, PTP etc.).
> 
> v18:
>  - Addressed AI comments

Thanks for the revision.  I still see some things which AI found
that are worth addressing.  Rather than bore you with the long
version here is the summary. Ask if you want more detail.


---

**Errors (must fix):**

1. **Bitwise vs logical AND** — `sxe_hw.c`, `sxe_hw_uc_addr_pool_disable()`: `if (!hi & !low)` should be `if (!hi && !low)`. Numerically equivalent here but wrong operator.

2. **Off-by-one bounds check** — `sxe_hw.c`, `sxe_hw_uc_addr_pool_enable()`: uses `rar_idx > SXE_UC_ENTRY_NUM_MAX` but `sxe_hw_uc_addr_add()` correctly uses `>=`. One of them is wrong.

3. **Data race on global `sxe_trace_id`** — `sxe_common.c`: `sxe_trace_id++` is called from `sxe_driver_cmd_trans()` before the HDC spinlock is acquired. Multiple threads can race on this non-atomic increment.

4. **`#define false 0` / `#define true 1`** — `sxe_compat_platform.h`: conflicts with `<stdbool.h>` which is included elsewhere. UB per C99 §7.1.3. Remove these and use `<stdbool.h>`.

5. **Spinlock held 2.5+ seconds** — `sxe_pmd_hdc.c`, `sxe_hdc_cmd_process()`: `rte_spinlock_t` (busy-wait) held across 250 retries × 10ms. Other lcores burn CPU spinning. Use a sleeping lock or release between retries.

6. **Wrong length in multi-packet HDC response** — `sxe_pmd_hdc.c`, `hdc_resp_process()`: passes total `resp_len` to `hdc_resp_data_rcv()` for every packet instead of `resp_len - offset`. The last-dword partial-copy (`out_len % 4`) logic is wrong for packets after the first.

7. **MAINTAINERS name/email mismatch** — Lists "Jie Li <lijie at ...>" but all patches are from "Jie Liu <liujie5 at ...>". Different person and different address.

8. **Double hardware reset in `sxe_dev_close()`** — Calls `sxe_hw_reset()` directly, then calls `sxe_dev_stop()` which calls `sxe_hw_reset()` again. Second reset may fail since HDC channel state was already altered.

---

**Warnings (should fix):**

1. **`set_bit`/`clear_bit`/`test_and_clear_bit` are not atomic** — `sxe_compat_platform.h`: plain read-modify-write on `int *`. If used from multiple threads, these are racy.

2. **Non-const lookup tables in hot path** — `sxe_rx.h`: `error_to_pkt_flags_map`, `ip_rss_types_map` should be `static const`.

3. **Dead code in `sxe_dev_configure()`** — Unused variables `adapter`, `irq` and unreachable `l_end` label.

4. **Misleading macro name** — `SXE_USEC_PER_MS` is 1000000 (nanoseconds per millisecond). Should be `SXE_NSEC_PER_MS`.

5. **`strlcpy` off-by-one** — `sxe_hw_base_init()`: `strlcpy(adapter->name, ..., sizeof(adapter->name) - 1)` wastes one byte. `strlcpy` already null-terminates; pass `sizeof(adapter->name)`.

6. **`sxe_fw_version_get`** — `resp.fw_version` from HDC `memcpy` may not be null-terminated. `snprintf` will read past the field.

7. **HDC channel lifecycle not multi-device safe** — `sxe_hdc_channel_init()` initializes a single global spinlock. `sxe_remove()` calls `sxe_hdc_channel_uninit()` — if two SXE devices are probed, removing the first destroys the channel while the second still uses it.

8. **Feature matrix overclaims** — `sxe.ini` marks Traffic Manager, Inline Crypto, MACsec, Rate Limitation as Y/P, but none of the 13 patches implement these features.

9. **`#ifdef __KERNEL__` dead code** — `base/sxe_hw.c`, `base/sxevf_hw.c` contain thousands of lines of Linux kernel code paths. Strip before submission to DPDK.

10. **`sxe_vf_rss_rxq_num_validate` return value check is inverted** — `sxe_queue.c`: `if ((rx_q_num <= ...) && sxe_vf_rss_rxq_num_validate(dev, rx_q_num))` — the validate function returns 0 on success and negative on error, but the `if` treats a truthy (error) return as the success path for entering the error log. The condition logic needs review.


More information about the dev mailing list