[dpdk-dev] [PATCH v2 7/7] virtio: add 1.0 support

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Jan 14 09:38:55 CET 2016


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


More information about the dev mailing list