DPDK patches and discussions
 help / color / mirror / Atom feed
From: "11" <caowenbo@mucse.com>
To: "'Stephen Hemminger'" <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <andrew.rybchenko@oktetlabs.ru>, <ferruh.yigit@amd.com>
Subject: RE: [PATCH v2 4/8] net/rnp: add mbx basic api feature
Date: Thu, 3 Aug 2023 10:25:46 +0800	[thread overview]
Message-ID: <E87E4AB684C2FF4E+00fd01d9c5b1$d0458300$70d08900$@mucse.com> (raw)
In-Reply-To: <20230802091154.201e7107@hermes.local>

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 <stephen@networkplumber.org> 
Sent: 2023年8月3日 0:12
To: Wenbo Cao <caowenbo@mucse.com>
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 <caowenbo@mucse.com> 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.





  reply	other threads:[~2023-08-03  2:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  8:10 [PATCH v2 0/8] *** Add Support New Pmd Driver *** Wenbo Cao
2023-08-02  8:10 ` [PATCH v2 1/8] net/rnp: add skeleton Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 2/8] net/rnp: add ethdev probe and remove Wenbo Cao
2023-08-02 16:06   ` Stephen Hemminger
2023-08-03  2:00     ` 11
2023-08-02  8:11 ` [PATCH v2 3/8] net/rnp: add device init and uninit Wenbo Cao
2023-08-02 16:08   ` Stephen Hemminger
2023-08-03  2:33     ` 11
2023-08-02  8:11 ` [PATCH v2 4/8] net/rnp: add mbx basic api feature Wenbo Cao
2023-08-02 16:11   ` Stephen Hemminger
2023-08-03  2:25     ` 11 [this message]
2023-08-02  8:11 ` [PATCH v2 5/8] net/rnp add reset code for Chip Init process Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 6/8] net/rnp add port info resource init Wenbo Cao
2023-08-02  8:11 ` [PATCH v2 7/8] net/rnp add devargs runtime parsing functions Wenbo Cao
2023-08-02 16:15   ` Stephen Hemminger
2023-08-02  8:11 ` [PATCH v2 8/8] net/rnp handle device interrupts 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='E87E4AB684C2FF4E+00fd01d9c5b1$d0458300$70d08900$@mucse.com' \
    --to=caowenbo@mucse.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --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).