net/virtio: fix PCI ops assignment
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Mon, 1 Feb 2021 20:31:38 +0000 (21:31 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 2 Feb 2021 23:48:11 +0000 (00:48 +0100)
commitb93c3530c1fbcb8929dd0ceed1dfea0f7d470973
tree7740d23668cf4afbfb9ea131a2c5d3863def09c7
parent0ea5be8d250408b0b6c6ae2105aabc5b73978f3e
net/virtio: fix PCI ops assignment

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 ensures port ID assignment is done at early
primary process probe time, before it is 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>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Tested-by: Wei Ling <weix.ling@intel.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_pci_ethdev.c