DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: fix wrong features returned for legacy virtio
@ 2016-03-10  7:01 Yuanhan Liu
  2016-03-10  7:19 ` Tan, Jianfeng
  2016-03-10  7:43 ` David Marchand
  0 siblings, 2 replies; 8+ messages in thread
From: Yuanhan Liu @ 2016-03-10  7:01 UTC (permalink / raw)
  To: dev

Declare dst as type uint32_t instead of uint64_t, otherwise, we will get
a random upper 32 bit feature bits, as the following io port read reads
lower 32 bit only. It could lead a feature bits that include VIRTIO_F_VERSION_1
(the 32th bit) for legacy virtio, which is obviously wrong.

Fixes: b8f04520ad71 ("virtio: use PCI ioport API")

Cc: David Marchand <david.marchand@6wind.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 98fc370..c007959 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,
 static uint64_t
 legacy_get_features(struct virtio_hw *hw)
 {
-	uint64_t dst;
+	uint32_t dst;
 
 	rte_eal_pci_ioport_read(&hw->io, &dst, 4, VIRTIO_PCI_HOST_FEATURES);
 	return dst;
-- 
1.9.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-03-14 22:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10  7:01 [dpdk-dev] [PATCH] virtio: fix wrong features returned for legacy virtio Yuanhan Liu
2016-03-10  7:19 ` Tan, Jianfeng
2016-03-10  7:43 ` David Marchand
2016-03-10  7:50   ` Yuanhan Liu
2016-03-14 10:48     ` Bruce Richardson
2016-03-14 12:44       ` Yuanhan Liu
2016-03-14 13:54         ` Bruce Richardson
2016-03-14 22:21   ` 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).