PMD_INIT_LOG(DEBUG, "virtio_dev_close");
+ if (!hw->opened)
+ return;
+ hw->opened = false;
+
/* reset the NIC */
if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
VTPCI_OPS(hw)->set_config_irq(hw, VIRTIO_MSI_NO_VECTOR);
DEV_RX_OFFLOAD_VLAN_STRIP))
hw->use_simple_rx = 0;
+ hw->opened = true;
+
return 0;
}
}
set_rxtx_funcs(dev);
- hw->started = 1;
+ hw->started = true;
/* Initialize Link state */
virtio_dev_link_update(dev, 0);
PMD_INIT_LOG(DEBUG, "stop");
rte_spinlock_lock(&hw->state_lock);
+ if (!hw->started)
+ goto out_unlock;
+ hw->started = false;
+
if (intr_conf->lsc || intr_conf->rxq) {
virtio_intr_disable(dev);
}
}
- hw->started = 0;
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(dev, &link);
+out_unlock:
rte_spinlock_unlock(&hw->state_lock);
}
link.link_speed = ETH_SPEED_NUM_10G;
link.link_autoneg = ETH_LINK_FIXED;
- if (hw->started == 0) {
+ if (!hw->started) {
link.link_status = ETH_LINK_DOWN;
} else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
PMD_INIT_LOG(DEBUG, "Get link status from hw");
uint64_t req_guest_features;
uint64_t guest_features;
uint32_t max_queue_pairs;
- uint16_t started;
+ bool started;
uint16_t max_mtu;
uint16_t vtnet_hdr_size;
uint8_t vlan_strip;
*/
rte_spinlock_t state_lock;
struct rte_mbuf **inject_pkts;
+ bool opened;
struct virtqueue **vqs;
};