[PATCH net-next 00/14] net: enetc: refactor NTMP table handling and add generic helpers

wei.fang at oss.nxp.com wei.fang at oss.nxp.com
Thu Dec 3 23:13:56 PST 2026


From: Wei Fang <wei.fang at nxp.com>

This series refactors the NTMP infrastructure to improve maintainability
and future-proof the driver.

1. Introduce a public enum ntmp_tbl_id and an indexed tbl_ver array,
   removing per-table version fields and redundant arguments.
2. Add generic ntmp_add_entry_by_id() and ntmp_update_entry_by_id()
   helpers that encapsulate common add/update boilerplate.
3. Provide ntmp_add_entry_by_key() for tables that allocate IDs in
   hardware, reducing duplicated logic across IPFT, FDBT and VFT.
4. Implement ntmp_query_entry_by_id() as a unified query path,
   eliminating per-table query duplication.
5. Convert specific table update functions (ECT, FDBT, ETT, BPT) to use
   the generic update helper.
6. Decouple logical configuration structs from hardware wire format for
   MAFT, IPFT, FDBT, VFT, ETT and BPT tables. New version-agnostic
   *_entry_data structs use native CPU types; wire structures are moved
   to ntmp_private.h and accessed via ntmp_tbl_ops callbacks.
7. Add kernel-doc for ntmp_delete_entry_by_id() to keep documentation
   consistent.
8. Register table specific ops in ntmp_table_ops() and expose helper
   getters (ntmp_get_*_ops()).
9. Update callers throughout the driver to work with the logical config
   structs and generic helpers, simplifying code paths and reducing
   boilerplate.

These changes make NTMP table code easier to extend for future hardware
revisions, improve code reuse, and provide clearer documentation.

Wei Fang (14):
  net: enetc: use an ID-indexed array to track NTMP table versions
  net: enetc: decouple MAFT logical config from hardware wire format
  net: enetc: decouple IPFT logical config from hardware wire format
  net: enetc: decouple FDBT logical config from hardware wire format
  net: enetc: decouple VFT logical config from hardware wire format
  net: enetc: decouple ETT logical config from hardware wire format
  net: enetc: decouple BPT logical config from hardware wire format
  net: enetc: add generic ntmp_add_entry_by_id() helper
  net: enetc: simplify callers of ntmp_query_entry_by_id()
  net: enetc: add kernel-doc for ntmp_delete_entry_by_id()
  net: enetc: add a generic helper to update an NTMP entry by entry ID
  net: enetc: convert ntmp_ect_update_entry() to the generic update
    helper
  net: enetc: add a generic helper to add an NTMP entry by key
  net: enetc: convert the RSST to the generic NTMP entry helpers

 drivers/net/dsa/netc/netc_main.c              |  231 ++-
 drivers/net/dsa/netc/netc_ptp.c               |   28 +-
 drivers/net/dsa/netc/netc_switch.h            |    9 +-
 .../ethernet/freescale/enetc/enetc4_debugfs.c |   10 +-
 .../net/ethernet/freescale/enetc/enetc4_pf.c  |   19 +-
 drivers/net/ethernet/freescale/enetc/ntmp.c   | 1247 ++++++++++-------
 .../ethernet/freescale/enetc/ntmp_private.h   |  149 +-
 include/linux/fsl/ntmp.h                      |  219 ++-
 8 files changed, 1129 insertions(+), 783 deletions(-)

-- 
2.34.1




More information about the linux-arm-kernel mailing list