From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 2B4035A63 for ; Mon, 18 Jan 2016 10:13:28 +0100 (CET) Received: by mail-pa0-f51.google.com with SMTP id uo6so416876796pac.1 for ; Mon, 18 Jan 2016 01:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PsT7XeDRuunlM6VZLuTvKQIyvniUzL/IXQAtIrBtVik=; b=ZtWUcpYT1OLQH/ELUt76vPRbM9BV8cdR6DsaQLycBQJ9464XLjblHyjPrfJW5ngUh2 ZQpk1YovxWWC554EoFlaoWlpNDV9NjPsP9WocVjBG82cEvv+A3+2Nmx0O1lx9BZMksXV 0jBjegALUWZqUuMFjFiRvwbLp+KeFG6zAAzFY0LPg94PEHrTZ5VlEFsgwW/lvlo5M6f1 MWXp1Ie0k7dDCSf+litjlyZG/FfGKFi8/DNFALb9Ru0vKs+0/McU+t77S4lF9cdoIWec eUhHqWi7EiM3JJF4GB7fIz9jzi2EOHEq2DGyAJPeBjkISeRo8PJ561rOlXGxOWK73D1+ 8JlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PsT7XeDRuunlM6VZLuTvKQIyvniUzL/IXQAtIrBtVik=; b=C7aeEUEjkKRQxAudb7oXMrlqvbXp+BtOAm9XYgU1YgRA7j8SQ3X9+WhnU3qa9rlWKy XZL9o1ZSa+tCGmkNnYJHlTBMzKzVpRd6KR82f+5DkpqXkLxc37tWz1/Q+CxEYhMiX/mV tSh4WQc2FNC4nl1gNbAjj0Zgf5CLPsmMw6PcVHg2WoesG9fpaU7mKJbCtbHnN+5yTXeZ h/YcRmQfH3Qe6y250Q6s8ggMKnclN0mCsuUIxlHcQL6qHR559jtJc+L5LDH4j+NjA+Kc CCQFope5yRgFTY86a3sJSde46kA9sUQ0dLC8V3tkxMvJ2jcGLPfkvkg6yOzEv2OSP3zc dfXQ== X-Gm-Message-State: AG10YOSyNm6t3iHkXgJsjZCY96qizljO1JEY7OXaQMsvOz87AJvvOohzNGgpffWdPgdQuw== X-Received: by 10.66.253.170 with SMTP id ab10mr23195323pad.125.1453108407553; Mon, 18 Jan 2016 01:13:27 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id g10sm32278308pfd.49.2016.01.18.01.13.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jan 2016 01:13:26 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Mon, 18 Jan 2016 18:13:07 +0900 Message-Id: <1453108389-21006-2-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453108389-21006-1-git-send-email-mukawa@igel.co.jp> References: <1453108389-21006-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH 1/3] virtio: Change the parameter order of io_write8/16/32() 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: Mon, 18 Jan 2016 09:13:28 -0000 The patch change the parameter order of below functions. - io_write8() - io_write16() - io_write32() This changig are needed to add a new layer to abstract accessing method. Signed-off-by: Tetsuya Mukawa --- drivers/net/virtio/virtio_pci.c | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index a9f179f..f1a6ee9 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 MODERN_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 @@ MODERN_READ_DEF (32, uint32_t) MODERN_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((uint32_t)val, lo); - io_write32(val >> 32, hi); + io_write32(lo, (uint32_t)val); + io_write32(hi, val >> 32); } static void @@ -526,7 +526,7 @@ modern_write_dev_config(struct virtio_hw *hw, uint64_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 = { -- 2.1.4