From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 7/7] virtio: add 1.0 support Date: Thu, 14 Jan 2016 16:38:55 +0800 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 Cc: "dev@dpdk.org" , "Michael S. Tsirkin" To: "Xie, Huawei" 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) Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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