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 2AE3E42FBD; Thu, 3 Aug 2023 04:26:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD991406BA; Thu, 3 Aug 2023 04:26:05 +0200 (CEST) Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by mails.dpdk.org (Postfix) with ESMTP id 8CD1B406B8 for ; Thu, 3 Aug 2023 04:26:03 +0200 (CEST) X-QQ-mid: bizesmtp64t1691029547tyridcui Received: from LAPTOP96V0OHHN ( [183.81.182.182]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 03 Aug 2023 10:25:46 +0800 (CST) X-QQ-SSF: 00400000000000D0F000000A0000000 X-QQ-FEAT: hs0LnwPRb2quaXLSxsoW4FYfxxRvKj7nZvtN6U1coyi9gddQ1lUPjxF7ZTLaJ b/Gly6MkY67AB19HjnPVvpsBjww6uoZsG+z2kD8qyIMJDgbIeFHiwZUxK8gksb1EFnyTKaR xPFTS+QXWgoj7p4gvoj2Z00KrCWA+CUCiSt2ESOsz68XrOqhibkJhxkNPoktXWEu38T1BCB bXcfNcjvZ6i1rVe/A5SbsHQpU8mm6J3X3BhfnP6ArQjU2RJ9euW7gRxFWo0VgPr7t0n2ece s+PoMOJfha8ISheeUc5jZFgvaQfk9F9qrIAIrSRSgRPd6nvKOVSfGcbnSh3ElzMQvBAViea TRgGc4hIC81es9h8fKvRcCaz6uVXOcGdTdtkNJL8A7d84QLfC+YD8MBeLd2VxVmDQeZ+Hpp X-QQ-GoodBg: 2 X-BIZMAIL-ID: 8161131561352689680 From: "11" To: "'Stephen Hemminger'" Cc: , , References: <20230802081106.2340406-1-caowenbo@mucse.com> <20230802081106.2340406-5-caowenbo@mucse.com> <20230802091154.201e7107@hermes.local> In-Reply-To: <20230802091154.201e7107@hermes.local> Subject: RE: [PATCH v2 4/8] net/rnp: add mbx basic api feature Date: Thu, 3 Aug 2023 10:25:46 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHlFHEU5qaXLLOEBoQYNo08TPBbuwGztN4SAn2J4Gqvn6OccA== 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 Hello, Stephen Fort this struct is used for communicate with firmware or Pf communicate with vf. It is used for sync the communicative event. It isn't used for performance sampling. For u32(uint32_t) is because of the hardware register is 32bit = read/write. So this counter size is enouth. >+struct rnp_mbx_stats { >... >+} Regards Wenbo -----Original Message----- From: Stephen Hemminger =20 Sent: 2023=C4=EA8=D4=C23=C8=D5 0:12 To: Wenbo Cao Cc: dev@dpdk.org; ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru Subject: Re: [PATCH v2 4/8] net/rnp: add mbx basic api feature On Wed, 2 Aug 2023 08:11:02 +0000 Wenbo Cao wrote: > +struct rnp_mbx_stats { > + u32 msgs_tx; > + u32 msgs_rx; > + > + u32 acks; > + u32 reqs; > + u32 rsts; > +}; Easy to cause wraparound of 32 bits in these stats. Why use u32 and not uint32_t or uint64_t. > +struct rnp_mbx_info { > + struct rnp_mbx_api ops; > + uint32_t usec_delay; /* retry interval delay time */ > + uint32_t timeout; /* retry ops timeout limit */ > + uint16_t size; /* data buffer size*/ > + uint16_t vf_num; /* Virtual Function num */ > + uint16_t pf_num; /* Physical Function num */ > + uint16_t sriov_st; /* Sriov state */ > + bool irq_enabled; > + union { > + struct { > + unsigned short pf_req; > + unsigned short pf_ack; > + }; > + struct { > + unsigned short cpu_req; > + unsigned short cpu_ack; > + }; > + }; > + unsigned short vf_req[64]; > + unsigned short vf_ack[64]; > + > + struct rnp_mbx_stats stats; > + > + rte_atomic16_t state; > +} __rte_cache_aligned; You may want to reorder this data structure to reduce cache misses. The last element is almost certainly on another cache line. Also, if you want faster statistics should consider per core, per queue = or per VF.