From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f49.google.com (mail-qg0-f49.google.com [209.85.192.49]) by dpdk.org (Postfix) with ESMTP id 9B8D0959 for ; Mon, 14 Jul 2014 23:17:03 +0200 (CEST) Received: by mail-qg0-f49.google.com with SMTP id 63so3940342qgz.8 for ; Mon, 14 Jul 2014 14:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=By3sqae6XIKzwM+xrucHVVIRk2vquo/QdgJy0R2zfZ8=; b=dAp3Qc0UWv5uAjB571EfEF67feMOxK6QRYpUNmQiUo3ibWEjDbBC1fHCYC5axGzNTf CaAbGRVBRfYMuPvGMtOOfrh7NAJ2GDL8GMepiwLEZ7tl9NB7BuDjslxPMeDOzKihg10i A57awnQlB2qaI+zQ/jOJidUloMPXs57mE+Uc2b0ZfCiE+tLF+ZYcQOTDrJ0NbyAXQYWr 8+WLf+J142AjpzUvnEYEfSHUdLnPpEJCm7pssQxlCTHAKfIPR7X75SUA14n0O3hv1Z+u v1LBesrRFmyHK/TI5SY+X7Xu4lLv/MSNm1nN9M8PWnNSW9CSQI4cptgKRkR2rujCMgk1 4FTQ== MIME-Version: 1.0 X-Received: by 10.224.13.139 with SMTP id c11mr25933229qaa.77.1405372666554; Mon, 14 Jul 2014 14:17:46 -0700 (PDT) Received: by 10.96.64.161 with HTTP; Mon, 14 Jul 2014 14:17:46 -0700 (PDT) Date: Mon, 14 Jul 2014 14:17:46 -0700 Message-ID: From: Vijayakumar Muthuvel Manickam To: "dev@dpdk.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] virtio: Fix 32bit pmd for 64bit kernel 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, 14 Jul 2014 21:17:04 -0000 *virtio_net_hdr_mem* member within *virtqueue* structure stores a physical address and is defined as void ptr. When 32bit pmd is used with 64bit kernel this leads to truncation of 64bit physical address and pkt i/o does not work. Changed *virtio_net_hdr_mem* to *phys_addr_t* type and removed the typecasts Signed-off-by: Vijayakumar Muthuvel Manickam --- lib/librte_pmd_virtio/virtio_ethdev.c | 6 +++--- lib/librte_pmd_virtio/virtqueue.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index d4730f9..764a769 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -331,7 +331,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem: 0x%"PRIx64"\n", (uint64_t)mz->phys_addr); PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64"\n", (uint64_t)mz->addr); vq->virtio_net_hdr_mz = NULL; - vq->virtio_net_hdr_mem = (void *)NULL; + vq->virtio_net_hdr_mem = 0; if (queue_type == VTNET_TQ) { /* @@ -347,7 +347,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } vq->virtio_net_hdr_mem = - (void *)(uintptr_t)vq->virtio_net_hdr_mz->phys_addr; + vq->virtio_net_hdr_mz->phys_addr; memset(vq->virtio_net_hdr_mz->addr, 0, vq_size * sizeof(struct virtio_net_hdr)); } else if (queue_type == VTNET_CQ) { @@ -361,7 +361,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } vq->virtio_net_hdr_mem = - (void *)(uintptr_t)vq->virtio_net_hdr_mz->phys_addr; + vq->virtio_net_hdr_mz->phys_addr; memset(vq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE); } diff --git a/lib/librte_pmd_virtio/virtqueue.h b/lib/librte_pmd_virtio/virtqueue.h index a63723d..8d1fc14 100644 --- a/lib/librte_pmd_virtio/virtqueue.h +++ b/lib/librte_pmd_virtio/virtqueue.h @@ -152,7 +152,7 @@ struct virtqueue { */ uint16_t vq_used_cons_idx; uint16_t vq_avail_idx; - void *virtio_net_hdr_mem; /**< hdr for each xmit packet */ + phys_addr_t virtio_net_hdr_mem; /**< hdr for each xmit packet */ struct vq_desc_extra { void *cookie; @@ -354,7 +354,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie) dxp->ndescs = needed; start_dp = txvq->vq_ring.desc; - start_dp[idx].addr = (uint64_t)(uintptr_t)txvq->virtio_net_hdr_mem + idx * sizeof(struct virtio_net_hdr); + start_dp[idx].addr = txvq->virtio_net_hdr_mem + idx * sizeof(struct virtio_net_hdr); start_dp[idx].len = sizeof(struct virtio_net_hdr); start_dp[idx].flags = VRING_DESC_F_NEXT; idx = start_dp[idx].next; -- 1.7.1