Thread (196 messages) 196 messages, 20 authors, 2016-06-24

Re: [PATCH 4/4] virtio/vdev: add a new vdev named eth_cvio

From: Tan, Jianfeng <hidden>
Date: 2016-01-12 08:39:38

Hi Fedin,

On 1/12/2016 3:45 PM, Pavel Fedin wrote:
  Hello!

  See inline
quoted
...
  	}

+	struct rte_mbuf *m = NULL;
+	if (dev->dev_type == RTE_ETH_DEV_PCI)
+		vq->offset = (uintptr_t)&m->buf_addr;
+#ifdef RTE_VIRTIO_VDEV
+	else {
+		vq->offset = (uintptr_t)&m->buf_physaddr;
  Not sure, but shouldn't these be swapped? Originally, for PCI devices, we used buf_physaddr.
Oops, seems that you are right. I'm trying to figure out why I can rx/tx 
pkts using the wrong version.
quoted
  #define VIRTIO_READ_REG_1(hw, reg) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	inb((VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_read(hw, reg)
+	:virtio_ioport_read(hw, reg))
  #define VIRTIO_WRITE_REG_1(hw, reg, value) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	outb_p((unsigned char)(value), (VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_write(hw, reg, value)
+	:virtio_ioport_write(hw, reg, value))

  #define VIRTIO_READ_REG_2(hw, reg) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	inw((VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_read(hw, reg)
+	:virtio_ioport_read(hw, reg))
  #define VIRTIO_WRITE_REG_2(hw, reg, value) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	outw_p((unsigned short)(value), (VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_write(hw, reg, value)
+	:virtio_ioport_write(hw, reg, value))

  #define VIRTIO_READ_REG_4(hw, reg) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	inl((VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_read(hw, reg)
+	:virtio_ioport_read(hw, reg))
  #define VIRTIO_WRITE_REG_4(hw, reg, value) \
-	(hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
+	((hw->io_base != VIRTIO_VDEV_IO_BASE) ? \
  	outl_p((unsigned int)(value), (VIRTIO_PCI_REG_ADDR((hw), (reg)))) \
-	:virtio_ioport_write(hw, reg, value)
+	:virtio_ioport_write(hw, reg, value))
  These bracket fixups should be squashed into #3
I'll rewrite this into function pointers according to Yuanhan's patch 
for virtio 1.0.

Thanks,
Jianfeng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help