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 A6F5B42FB8; Wed, 2 Aug 2023 18:11:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EC9943251; Wed, 2 Aug 2023 18:11:58 +0200 (CEST) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mails.dpdk.org (Postfix) with ESMTP id 952E642D0C for ; Wed, 2 Aug 2023 18:11:57 +0200 (CEST) Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-267fabc8465so4112017a91.1 for ; Wed, 02 Aug 2023 09:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1690992717; x=1691597517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zS8CHUaZhSuLsFKt7mL1A6Wdq21X6bZAlWbO6Gi4LwE=; b=hDtJFYivdsDCbtV/9+qgRU1aZjzF5Uc31N1gsR3trVXBt/IIqrgVX5XwyD9JY7jCpw en3IKMTz0JoRGcdD5Gq0kNCca6uk3fAAQexsbjax+vE3ghYYwbN7ke6svBiNe4BNCOLb yfwmZOVI5n0cRS7NTjQFaTMeq+pg23S9fpX6SA6pJAVfaT9ryPtf4SbfRHx1tSOyf3r8 I6VUjCv7e+JRgFNHnninNayQ+C1PbwFAeABXHJ7k6Hji6m8YQuWVGkIPuhky88T4Egvw o0FHcvqBpc/Gg+U1MRCwUIhkehVG6LUuimV6W+8w9/9OkJIbA9VZCD55/Lft4kjYq+mk /FDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690992717; x=1691597517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zS8CHUaZhSuLsFKt7mL1A6Wdq21X6bZAlWbO6Gi4LwE=; b=gcHITtlT7VRr6Vb+bltvU4Mkmp51cldYV89i9jtB5gyzNCSWFDHajlusA+P4YmxaqE MHXPZY9hqdLEa+ZJP+WOiHk7zJCtc1rIUKDCnWnAnsegTjCKD3b/qVQl8Vb9BWgjGmTZ h4wKeyC1J5Upyp2Zn2GmC6wlH9RCfhVPsXqpO3UARt5+rfcXonShGsBT+G/MD7EKcsQI klbT2iyU9j7/0RNAC+fLxkq1gE233bdl1rFixAWzYmacjpy9YdCVsPmKZPgWRYynP6u5 OZrWcmgrqT4huFz8qqFVOCQodIA+KtNaeDSWnsix6iFoTR4u4wIx8z2Vk2G3w4JadwTu RZYw== X-Gm-Message-State: ABy/qLahf3qfW3C8kU2tt/ngKBiFCtM648YsKJjOh4lb4EBTr45Rxf+y Eo90gMXzcvd5lj5xdCpiaUOkyg== X-Google-Smtp-Source: APBJJlFfbm1vVydnP34alGb9Sha6/v52HEMTufI6afejkEsrM6mvWYotv2CAZCKLSuCR3EWDzv/xzg== X-Received: by 2002:a17:90b:2318:b0:268:160d:937e with SMTP id mt24-20020a17090b231800b00268160d937emr13244060pjb.27.1690992716811; Wed, 02 Aug 2023 09:11:56 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id y1-20020a17090a538100b00256799877ffsm1374738pjh.47.2023.08.02.09.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 09:11:56 -0700 (PDT) Date: Wed, 2 Aug 2023 09:11:54 -0700 From: Stephen Hemminger 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 Message-ID: <20230802091154.201e7107@hermes.local> In-Reply-To: <20230802081106.2340406-5-caowenbo@mucse.com> References: <20230802081106.2340406-1-caowenbo@mucse.com> <20230802081106.2340406-5-caowenbo@mucse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 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.