From patchwork Thu Jan 28 09:33:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 10174 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 75288C428; Thu, 28 Jan 2016 10:34:08 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id BA987C3B4 for ; Thu, 28 Jan 2016 10:34:04 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id cy9so20544072pac.0 for ; Thu, 28 Jan 2016 01:34:04 -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 :in-reply-to:references; bh=+rFS09/Sjm1+X95c4AbitgI6WXt8oQD4ZzMyRrHJph0=; b=jTOk4wwuNxg5BvwYZwgc/liTbVs73JVbH2eCf++rb5VQAT0am8o+6LWbkNmA539YNG rxIWrfuU+uwO0pT9R06eLLIwqwGlL5jTexp0Q7IaVEyGGd81sf30GcDByKIzjIJR7kCp mvXyZktjCHt16KmO8RY5gUTK97jbYPeYh0vkmKZ4HLdoq/K7q4BJxHucNdJUvfeSA6VD RvkAtscyb2J0cWGpq2pJCVAsocYKQMbi/FcQleBtWPECEZTPvuVdW6xMp4UeQetjWlMi Ua6DyYHIemj3zz2ZxaPGNSAdPHLO4d4h4VXdCclSYCZHzFU0JcuggOqVcfhhAHVvhZwo NYqw== 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:in-reply-to:references; bh=+rFS09/Sjm1+X95c4AbitgI6WXt8oQD4ZzMyRrHJph0=; b=JAd+02E6Wa+nShpDZu7hXvjBMzII41HwWhQd3m3LKPrUf0mJyJZOcBJLiONRxEdPak JoNvtl5FfoBGV9MGrvD9ZDn3Z+yWQJC2HszwIgTSbOtrvFOfEDPhTzxWBFmxubHKSxhg R5PYsI7hYliGwa6RVKOt8wsM4JM5G9Qs1xKd7JOwDHcis4xDPFJnyMOtCdP/7+2N5I0B Nt1LmuMZla8Zl8t/AzNs55gywQ4/7we3iiwiCpxvhFeb0RtkbZoPeJLDm1+IxxeJjdAp ssqZyACk86+1vk2pLICArHzjXCYRyU+TCIeMn/z6ychzNsG8I0fq921BLQediCL5ES+d K6OQ== X-Gm-Message-State: AG10YOSido1FIZSfntUgMc1VUtYbiQiv1rvImln6LD/0f/XIW+ymUDV3LhLYXQTdlS85bg== X-Received: by 10.66.156.134 with SMTP id we6mr3064857pab.92.1453973644170; Thu, 28 Jan 2016 01:34:04 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id o75sm14823582pfi.17.2016.01.28.01.34.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 01:34:03 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 28 Jan 2016 18:33:30 +0900 Message-Id: <1453973612-8599-2-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453973612-8599-1-git-send-email-mukawa@igel.co.jp> References: <1453973612-8599-1-git-send-email-mukawa@igel.co.jp> In-Reply-To: <1453108389-21006-2-git-send-email-mukawa@igel.co.jp> References: <1453108389-21006-2-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v2 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index e16104e..1fca39f 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -477,7 +477,7 @@ io_read8(uint8_t *addr) } static inline void -io_write8(uint8_t val, uint8_t *addr) +io_write8(uint8_t *addr, uint8_t val) { *(volatile uint8_t *)addr = val; } @@ -489,7 +489,7 @@ io_read16(uint16_t *addr) } static inline void -io_write16(uint16_t val, uint16_t *addr) +io_write16(uint16_t *addr, uint16_t val) { *(volatile uint16_t *)addr = val; } @@ -501,16 +501,16 @@ io_read32(uint32_t *addr) } static inline void -io_write32(uint32_t val, uint32_t *addr) +io_write32(uint32_t *addr, uint32_t val) { *(volatile uint32_t *)addr = val; } 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 @@ -540,7 +540,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 @@ -548,10 +548,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; @@ -560,13 +560,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 @@ -578,7 +578,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 @@ -597,14 +597,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); } @@ -620,20 +620,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); @@ -646,22 +646,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 = {