[[PATCH v1] 4/8] net/rnp: add mbx basic api feature

Stephen Hemminger stephen at networkplumber.org
Tue Aug 1 17:25:55 CEST 2023


On Tue,  1 Aug 2023 07:22:07 +0000
Wenbo Cao <caowenbo at mucse.com> wrote:

> +struct rnp_mbx_api {
> +	void (*init_mbx)(struct rnp_hw *hw);
> +	int32_t (*read)(struct rnp_hw *hw,
> +			uint32_t *msg,
> +			uint16_t size,
> +			enum MBX_ID);
> +	int32_t (*write)(struct rnp_hw *hw,
> +			uint32_t *msg,
> +			uint16_t size,
> +			enum MBX_ID);
> +	int32_t (*read_posted)(struct rte_eth_dev *dev,
> +			uint32_t *msg,
> +			uint16_t size,
> +			enum MBX_ID);
> +	int32_t (*write_posted)(struct rte_eth_dev *dev,
> +			uint32_t *msg,
> +			uint16_t size,
> +			enum MBX_ID);
> +	int32_t (*check_for_msg)(struct rnp_hw *hw, enum MBX_ID);
> +	int32_t (*check_for_ack)(struct rnp_hw *hw, enum MBX_ID);
> +	int32_t (*check_for_rst)(struct rnp_hw *hw, enum MBX_ID);
> +	int32_t (*configure)(struct rnp_hw *hw, int nr_vec, bool enable);
> +};

Since this data structure only has virtual function pointers;
many types of bugs can be avoided if it can be made const.
If it const, then compiler can put the initialized table in r/o text section.



More information about the dev mailing list