From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 400B98E83 for ; Thu, 14 Jan 2016 09:37:39 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 14 Jan 2016 00:37:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,293,1449561600"; d="scan'208";a="633238547" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by FMSMGA003.fm.intel.com with ESMTP; 14 Jan 2016 00:37:36 -0800 Date: Thu, 14 Jan 2016 16:38:55 +0800 From: Yuanhan Liu To: "Xie, Huawei" Message-ID: <20160114083855.GP19531@yliu-dev.sh.intel.com> References: <1449719650-3482-1-git-send-email-yuanhan.liu@linux.intel.com> <1452581944-24838-1-git-send-email-yuanhan.liu@linux.intel.com> <1452581944-24838-8-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v2 7/7] virtio: add 1.0 support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2016 08:37:39 -0000 Sigh... I have just send out v3 ... On Thu, Jan 14, 2016 at 07:50:00AM +0000, Xie, Huawei wrote: > On 1/12/2016 2:58 PM, Yuanhan Liu wrote: > > +static inline void > > +modern_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi) > > +{ > > + modern_write32((uint32_t)val, lo); > > + modern_write32(val >> 32, hi); > > +} > > + > > This is normal mmio read/write operation. ioread8/16/32/64 or just > readxx is more meaningful name here. I just want to make them looks like modern device related, which they are. > > +static void > [SNIP] > > + > > +static void > > +modern_write_dev_config(struct virtio_hw *hw, uint64_t offset, > > + void *src, int length) > > define src as const okay. > > [snip] > > > > +static inline void * > > +get_cfg_addr(struct rte_pci_device *dev, struct virtio_pci_cap *cap) > > No explicit inline for non performance critical functions. okay. > > > +{ > > + uint8_t bar = cap->bar; > > + uint32_t length = cap->length; > > + uint32_t offset = cap->offset; > > + uint8_t *base; > > + > > + if (unlikely(bar > 5)) { > Don't use constant value number whenever possible I normally will not bother to define a macro for used once number, espeically for some well known ones. Say, I won't define #define UINT8_MAX_VALUE 0xff > > No likely/unlikely for non performance critical functions makes sense. > > + if (rte_eal_pci_map_device(dev) < 0) { > > + PMD_INIT_LOG(DEBUG, "failed to map pci device!"); > > s /DEBUG/ERR/ It's not an error; it's expected, say, when no UIO is bond. --yliu