Skip to content

Commit

Permalink
net/virtio: fix link state interrupt vector setting
Browse files Browse the repository at this point in the history
[ upstream commit efc3f842b3dd69c4e65dbdf6cdaccde8c759b5d9 ]

Setting the vector for link state interrupts should be
done before the device initialization is completed.

Fixes: ee85024 ("net/virtio: complete init stage at the right place")

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
wenwumax authored and bluca committed Nov 8, 2023
1 parent 3c0ce46 commit 1945571
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/virtio/virtio_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,14 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
}
}

if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
/* Enable vector (0) for Link State Interrupt */
if (VTPCI_OPS(hw)->set_config_irq(hw, 0) ==
VIRTIO_MSI_NO_VECTOR) {
PMD_DRV_LOG(ERR, "failed to set config vector");
return -EBUSY;
}

vtpci_reinit_complete(hw);

if (pci_dev)
Expand Down Expand Up @@ -2408,14 +2416,6 @@ virtio_dev_configure(struct rte_eth_dev *dev)
hw->has_tx_offload = tx_offload_enabled(hw);
hw->has_rx_offload = rx_offload_enabled(hw);

if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
/* Enable vector (0) for Link State Interrupt */
if (VTPCI_OPS(hw)->set_config_irq(hw, 0) ==
VIRTIO_MSI_NO_VECTOR) {
PMD_DRV_LOG(ERR, "failed to set config vector");
return -EBUSY;
}

if (vtpci_packed_queue(hw)) {
#if defined(RTE_ARCH_X86_64) && defined(CC_AVX512_SUPPORT)
if ((hw->use_vec_rx || hw->use_vec_tx) &&
Expand Down

0 comments on commit 1945571

Please sign in to comment.