diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 6b87429..0aeffb7 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -478,7 +478,7 @@ io_read##nr_bits(type *addr)			\
 
 #define IO_WRITE_DEF(nr_bits, type)		\
 static inline void				\
-io_write##nr_bits(type val, type *addr)		\
+io_write##nr_bits(type *addr, type val)		\
 {						\
 	*(volatile type *)addr = val;		\
 }
@@ -493,10 +493,10 @@ IO_READ_DEF (32, uint32_t)
 IO_WRITE_DEF(32, uint32_t)
 
 static inline void
-io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi)
+io_write64_twopart(uint32_t *lo, uint32_t *hi, uint64_t val)
 {
-	io_write32(val & ((1ULL << 32) - 1), lo);
-	io_write32(val >> 32,		     hi);
+	io_write32(lo, val & ((1ULL << 32) - 1));
+	io_write32(hi, val >> 32);
 }
 
 static void
@@ -526,7 +526,7 @@ modern_write_dev_config(struct virtio_hw *hw, size_t offset,
 	const uint8_t *p = src;
 
 	for (i = 0;  i < length; i++)
-		io_write8(*p++, (uint8_t *)hw->dev_cfg + offset + i);
+		io_write8((uint8_t *)hw->dev_cfg + offset + i, *p++);
 }
 
 static uint64_t
@@ -534,10 +534,10 @@ modern_get_features(struct virtio_hw *hw)
 {
 	uint32_t features_lo, features_hi;
 
-	io_write32(0, &hw->common_cfg->device_feature_select);
+	io_write32(&hw->common_cfg->device_feature_select, 0);
 	features_lo = io_read32(&hw->common_cfg->device_feature);
 
-	io_write32(1, &hw->common_cfg->device_feature_select);
+	io_write32(&hw->common_cfg->device_feature_select, 1);
 	features_hi = io_read32(&hw->common_cfg->device_feature);
 
 	return ((uint64_t)features_hi << 32) | features_lo;
@@ -546,13 +546,13 @@ modern_get_features(struct virtio_hw *hw)
 static void
 modern_set_features(struct virtio_hw *hw, uint64_t features)
 {
-	io_write32(0, &hw->common_cfg->guest_feature_select);
-	io_write32(features & ((1ULL << 32) - 1),
-		&hw->common_cfg->guest_feature);
+	io_write32(&hw->common_cfg->guest_feature_select, 0);
+	io_write32(&hw->common_cfg->guest_feature,
+		   features & ((1ULL << 32) - 1));
 
-	io_write32(1, &hw->common_cfg->guest_feature_select);
-	io_write32(features >> 32,
-		&hw->common_cfg->guest_feature);
+	io_write32(&hw->common_cfg->guest_feature_select, 1);
+	io_write32(&hw->common_cfg->guest_feature,
+		   features >> 32);
 }
 
 static uint8_t
@@ -564,7 +564,7 @@ modern_get_status(struct virtio_hw *hw)
 static void
 modern_set_status(struct virtio_hw *hw, uint8_t status)
 {
-	io_write8(status, &hw->common_cfg->device_status);
+	io_write8(&hw->common_cfg->device_status, status);
 }
 
 static void
@@ -583,14 +583,14 @@ modern_get_isr(struct virtio_hw *hw)
 static uint16_t
 modern_set_config_irq(struct virtio_hw *hw, uint16_t vec)
 {
-	io_write16(vec, &hw->common_cfg->msix_config);
+	io_write16(&hw->common_cfg->msix_config, vec);
 	return io_read16(&hw->common_cfg->msix_config);
 }
 
 static uint16_t
 modern_get_queue_num(struct virtio_hw *hw, uint16_t queue_id)
 {
-	io_write16(queue_id, &hw->common_cfg->queue_select);
+	io_write16(&hw->common_cfg->queue_select, queue_id);
 	return io_read16(&hw->common_cfg->queue_size);
 }
 
@@ -606,20 +606,20 @@ modern_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 							 ring[vq->vq_nentries]),
 				   VIRTIO_PCI_VRING_ALIGN);
 
-	io_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
+	io_write16(&hw->common_cfg->queue_select, vq->vq_queue_index);
 
-	io_write64_twopart(desc_addr, &hw->common_cfg->queue_desc_lo,
-				      &hw->common_cfg->queue_desc_hi);
-	io_write64_twopart(avail_addr, &hw->common_cfg->queue_avail_lo,
-				       &hw->common_cfg->queue_avail_hi);
-	io_write64_twopart(used_addr, &hw->common_cfg->queue_used_lo,
-				      &hw->common_cfg->queue_used_hi);
+	io_write64_twopart(&hw->common_cfg->queue_desc_lo,
+			   &hw->common_cfg->queue_desc_hi, desc_addr);
+	io_write64_twopart(&hw->common_cfg->queue_avail_lo,
+			   &hw->common_cfg->queue_avail_hi, avail_addr);
+	io_write64_twopart(&hw->common_cfg->queue_used_lo,
+			   &hw->common_cfg->queue_used_hi, used_addr);
 
 	notify_off = io_read16(&hw->common_cfg->queue_notify_off);
 	vq->notify_addr = (void *)((uint8_t *)hw->notify_base +
 				notify_off * hw->notify_off_multiplier);
 
-	io_write16(1, &hw->common_cfg->queue_enable);
+	io_write16(&hw->common_cfg->queue_enable, 1);
 
 	PMD_INIT_LOG(DEBUG, "queue %u addresses:", vq->vq_queue_index);
 	PMD_INIT_LOG(DEBUG, "\t desc_addr: %"PRIx64, desc_addr);
@@ -632,22 +632,22 @@ modern_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 static void
 modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq)
 {
-	io_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
+	io_write16(&hw->common_cfg->queue_select, vq->vq_queue_index);
 
-	io_write64_twopart(0, &hw->common_cfg->queue_desc_lo,
-				  &hw->common_cfg->queue_desc_hi);
-	io_write64_twopart(0, &hw->common_cfg->queue_avail_lo,
-				  &hw->common_cfg->queue_avail_hi);
-	io_write64_twopart(0, &hw->common_cfg->queue_used_lo,
-				  &hw->common_cfg->queue_used_hi);
+	io_write64_twopart(&hw->common_cfg->queue_desc_lo,
+			   &hw->common_cfg->queue_desc_hi, 0);
+	io_write64_twopart(&hw->common_cfg->queue_avail_lo,
+			   &hw->common_cfg->queue_avail_hi, 0);
+	io_write64_twopart(&hw->common_cfg->queue_used_lo,
+			   &hw->common_cfg->queue_used_hi, 0);
 
-	io_write16(0, &hw->common_cfg->queue_enable);
+	io_write16(&hw->common_cfg->queue_enable, 0);
 }
 
 static void
 modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq)
 {
-	io_write16(1, vq->notify_addr);
+	io_write16(vq->notify_addr, 1);
 }
 
 static const struct virtio_pci_ops modern_ops = {
