* [dpdk-dev] [PATCH] virtio: Fix 32bit pmd for 64bit kernel
@ 2014-07-14 21:17 Vijayakumar Muthuvel Manickam
2014-07-15 22:23 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Vijayakumar Muthuvel Manickam @ 2014-07-14 21:17 UTC (permalink / raw)
To: dev
*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 <mmvijay at gmail.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] virtio: Fix 32bit pmd for 64bit kernel
2014-07-14 21:17 [dpdk-dev] [PATCH] virtio: Fix 32bit pmd for 64bit kernel Vijayakumar Muthuvel Manickam
@ 2014-07-15 22:23 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-07-15 22:23 UTC (permalink / raw)
To: Vijayakumar Muthuvel Manickam; +Cc: dev
Hi,
2014-07-14 14:17, Vijayakumar Muthuvel Manickam:
> *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
Thanks for providing this patch. You were discussing this issue and it helps
to have a patch to apply.
Unfortunately, the patch seems corrupted.
Please use:
1) git format-patch
2) checkpatch.pl from kernel.org
3) git send-email
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-15 22:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 21:17 [dpdk-dev] [PATCH] virtio: Fix 32bit pmd for 64bit kernel Vijayakumar Muthuvel Manickam
2014-07-15 22:23 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).