DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio: fix Virtio-PCI ops assignment
@ 2021-02-01 15:16 Maxime Coquelin
  2021-02-01 16:32 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2021-02-01 15:16 UTC (permalink / raw)
  To: dev, yinan.wang, chenbo.xia, amorenoz, david.marchand, weix.ling,
	yux.jiang
  Cc: Maxime Coquelin

VIRTIO_OPS() macro relies on the port ID stored in the
virtio_hw struct. Issue is that it is used before being
assigned at init time. It results in all devices setting
ops on port ID 0, causing crash later when calling ops
for port IDs other than 0.

This patch ensure port ID assignment is done before being
used.

Bugzilla ID: 631
Fixes: 512e27eeb743 ("net/virtio: move PCI specific dev init to PCI ethdev init")

Reported-by: Wei Ling <weix.ling@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_pci_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 1b818c4565..547cb8ffa0 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -76,6 +76,9 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	int ret;
 
+	/* Required to assign Virtio ops */
+	hw->port_id = eth_dev->data->port_id;
+
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
 		if (ret) {
-- 
2.29.2


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

end of thread, other threads:[~2021-02-01 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 15:16 [dpdk-dev] [PATCH] net/virtio: fix Virtio-PCI ops assignment Maxime Coquelin
2021-02-01 16:32 ` David Marchand
2021-02-01 16:53   ` Maxime Coquelin

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).