Hi Stephen,

Our driver architecture is designed to support multiple chip variants, each with distinct hardware-software interactions, which contributes to its relative complexity.
To ensure broad compatibility and modularity, the architecture is organized into the following layers:
1. Dev Layer (Device Layer)
2. Dispatch Layer
3. Resource Layer
4. Channel Layer
5. HW Layer (Hardware Layer)

Each chip variant has its own init and remove functions for these layers.
As you correctly pointed out, there are many indirection tables involved. 
This patch series implements the tables for one chip, and subsequent patches will add support for more chip variants.

Thank you.




------------------------------------------------------------------
发件人:Stephen Hemminger <stephen@networkplumber.org>
发送时间:2025年8月28日(周四) 00:27
收件人:Dimon<dimon.zhao@nebula-matrix.com>
抄 送:dev<dev@dpdk.org>; Thomas Monjalon<thomas@monjalon.net>; Kyo Liu<kyo.liu@nebula-matrix.com>; Leon<leon.yu@nebula-matrix.com>; Sam<sam.chen@nebula-matrix.com>
主 题:Re: [PATCH v6 01/17] net/nbl: add doc and minimum nbl build framework

This code looks like it was part of something bigger (and/or written
by a object oriented programmer).

Lots of indirection tables and most never have multiple implementations.
Function indirection is slower and risks SPECTRE type attacks.

> +struct nbl_product_core_ops {
> + int (*hw_init)(void *p);
> + void (*hw_remove)(void *p);
> + int (*res_init)(void *p, struct rte_eth_dev *eth_dev);
> + void (*res_remove)(void *p);
> + int (*chan_init)(void *p);
> + void (*chan_remove)(void *p);
> +};




> +struct nbl_product_dev_ops {
> + int (*dev_init)(void *adapter);
> + void (*dev_uninit)(void *adapter);
> + int (*dev_start)(void *adapter);
> + void (*dev_stop)(void *adapter);
> +};
> +
> +struct nbl_product_dispatch_ops {
> + int (*dispatch_init)(void *mgt);
> + int (*dispatch_uninit)(void *mgt);
> +};



> +struct nbl_product_dev_external_ops {
> + int (*external_pf_ops_get)(struct rte_eth_dev *dev, void *arg);
> + int (*external_rep_ops_get)(struct rte_eth_dev *dev, void *arg);
> + int (*external_bond_ops_get)(struct rte_eth_dev *dev, void *arg);
> +};

These are defined but never used.


> +#endif

本邮件所含信息及其任何附件为保密信息且可能属于专有信息。任何非指定接收人均无权访问本邮件。如果您不是该邮件的指定接收人,那么任何对本邮件内容进行披露,复制或使用的行为均是禁止的。如果您不是该邮件的指定接收人,请您立即通过邮件通知 compliance@nebula-matrix.com并立即删除您错误接受的邮件。
The information in this message and any attachments is confidential and may be privileged.  Access to this email by anyone other than the intended recipient is not authorized.  If you are not the intended recipient, disclosure, copying or use of the contents of this email is prohibited.  If you are not the intended recipient, please notify  compliance@nebula-matrix.com immediately by email, and please destroy the email you received in error.