From: "11" <caowenbo@mucse.com>
To: "'Stephen Hemminger'" <stephen@networkplumber.org>
Cc: <dev@dpdk.org>
Subject: RE: [[PATCH v1] 4/8] net/rnp: add mbx basic api feature
Date: Wed, 2 Aug 2023 09:41:29 +0800 [thread overview]
Message-ID: <2FACEF30971C9899+004b01d9c4e2$76751d60$635f5820$@mucse.com> (raw)
In-Reply-To: <20230801082555.36dd9f80@hermes.local>
Hi Stephen,
Thanks for your comment, as your advice that I need to define the virtual
function pointers
As the below type ?
const struct rnp_mbx_api {
..
}
If It will protect the virtual function address ,won't be remove by mistake?
Regards Wenbo
-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: 2023年8月1日 23:26
To: Wenbo Cao <caowenbo@mucse.com>
Cc: dev@dpdk.org
Subject: Re: [[PATCH v1] 4/8] net/rnp: add mbx basic api feature
On Tue, 1 Aug 2023 07:22:07 +0000
Wenbo Cao <caowenbo@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.
next prev parent reply other threads:[~2023-08-02 1:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 7:22 Wenbo Cao
2023-08-01 15:25 ` Stephen Hemminger
2023-08-02 1:41 ` 11 [this message]
2023-08-02 2:27 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2023-08-01 6:43 [[PATCH v1] 0/8] *** SUBJECT HERE *** Wenbo Cao
2023-08-01 6:43 ` [[PATCH v1] 4/8] net/rnp: add mbx basic api feature Wenbo Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='2FACEF30971C9899+004b01d9c4e2$76751d60$635f5820$@mucse.com' \
--to=caowenbo@mucse.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).