From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16F1742F95; Wed, 2 Aug 2023 03:41:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5147410DC; Wed, 2 Aug 2023 03:41:38 +0200 (CEST) Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by mails.dpdk.org (Postfix) with ESMTP id 4570A40DDB for ; Wed, 2 Aug 2023 03:41:36 +0200 (CEST) X-QQ-mid: bizesmtp67t1690940490t5q977lo Received: from LAPTOP96V0OHHN ( [183.81.182.182]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 02 Aug 2023 09:41:28 +0800 (CST) X-QQ-SSF: 00400000000000C0E000000B0000000 X-QQ-FEAT: 9cCuz3CpuKEvJinB6PN3m1jlwTzRBzxIuyxj4//p9kDfis92fDnRcf3496yEV vDHTpyr3XlNLslxhN/m17X1W6ajMlqKIOPvB5pvA48295kxxfsyDerkA8olPSggrMGUSXrR g3+V6+XXgVyVPvz8hWwR5G+IZ6ezMpOyzTDMFQt/LZwEJbk0sTDlSfhdn+bQc0tsGz7Cspc uGPOOyPcZ8jTuvDFbhuM3RH5vwj9upnTHjByKcSFWVzYNkKf7684+O4ik0tq46AUnqKocsQ hkaqp2HKYG7ueQXmzfOqO4/7ycyXJhOOesuRRdg5Nu8nON2QEsJ3nLkbbRXxeDlE7MdZdrR TWWDZTlEZMYVh+9lBp1ExnJs977B9i/MEyoJvDa X-QQ-GoodBg: 2 X-BIZMAIL-ID: 10527178754904836906 From: "11" To: "'Stephen Hemminger'" Cc: References: <20230801072207.836932-1-caowenbo@mucse.com> <20230801082555.36dd9f80@hermes.local> In-Reply-To: <20230801082555.36dd9f80@hermes.local> Subject: RE: [[PATCH v1] 4/8] net/rnp: add mbx basic api feature Date: Wed, 2 Aug 2023 09:41:29 +0800 Message-ID: <2FACEF30971C9899+004b01d9c4e2$76751d60$635f5820$@mucse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQNFmPdr9woahERbVKSOetj//h0S+gFsqtU1rPMsFMA= Content-Language: zh-cn X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:mucse.com:qybglogicsvrgz:qybglogicsvrgz5a-0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 =20 Sent: 2023=C4=EA8=D4=C21=C8=D5 23:26 To: Wenbo Cao 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 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.