static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
static int virtio_dev_configure(struct rte_eth_dev *dev);
static int virtio_dev_start(struct rte_eth_dev *dev);
-static void virtio_dev_stop(struct rte_eth_dev *dev);
+static int virtio_dev_stop(struct rte_eth_dev *dev);
static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
static int virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
txr = hdr_mz->addr;
memset(txr, 0, vq_size * sizeof(*txr));
for (i = 0; i < vq_size; i++) {
- struct vring_desc *start_dp = txr[i].tx_indir;
-
/* first indirect descriptor is always the tx header */
if (!vtpci_packed_queue(hw)) {
+ struct vring_desc *start_dp = txr[i].tx_indir;
vring_desc_init_split(start_dp,
RTE_DIM(txr[i].tx_indir));
start_dp->addr = txvq->virtio_net_hdr_mem
tx_hdr);
start_dp->len = hw->vtnet_hdr_size;
start_dp->flags = VRING_DESC_F_NEXT;
+ } else {
+ struct vring_packed_desc *start_dp =
+ txr[i].tx_packed_indir;
+ vring_desc_init_indirect_packed(start_dp,
+ RTE_DIM(txr[i].tx_packed_indir));
+ start_dp->addr = txvq->virtio_net_hdr_mem
+ + i * sizeof(*txr)
+ + offsetof(struct virtio_tx_region,
+ tx_hdr);
+ start_dp->len = hw->vtnet_hdr_size;
}
}
}
struct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;
PMD_INIT_LOG(DEBUG, "virtio_dev_close");
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
if (!hw->opened)
return 0;
return 0;
}
-#define SPEED_UNKNOWN 0xffffffff
#define DUPLEX_UNKNOWN 0xff
/* reset device and renegotiate features if needed */
static int
else
eth_dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
+
/* Setting up rx_header size for the device */
if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) ||
vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||
hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2],
hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);
- if (hw->speed == SPEED_UNKNOWN) {
+ if (hw->speed == ETH_SPEED_NUM_UNKNOWN) {
if (vtpci_with_feature(hw, VIRTIO_NET_F_SPEED_DUPLEX)) {
config = &local_config;
vtpci_read_dev_config(hw,
hw->duplex = config->duplex;
}
}
- if (hw->speed == SPEED_UNKNOWN)
- hw->speed = ETH_SPEED_NUM_10G;
if (hw->duplex == DUPLEX_UNKNOWN)
hw->duplex = ETH_LINK_FULL_DUPLEX;
PMD_INIT_LOG(DEBUG, "link speed = %d, duplex = %d",
eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
{
struct virtio_hw *hw = eth_dev->data->dev_private;
- uint32_t speed = SPEED_UNKNOWN;
+ uint32_t speed = ETH_SPEED_NUM_UNKNOWN;
int vectorized = 0;
int ret;
if (ret < 0)
return ret;
hw->speed = speed;
- /*
- * Pass the information to the rte_eth_dev_close() that it should also
- * release the private port resources.
- */
- eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
/* Allocate memory for storing MAC addresses */
eth_dev->data->mac_addrs = rte_zmalloc("virtio",
static int
eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
{
+ int ret;
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
return 0;
- virtio_dev_stop(eth_dev);
+ ret = virtio_dev_stop(eth_dev);
virtio_dev_close(eth_dev);
- eth_dev->dev_ops = NULL;
- eth_dev->tx_pkt_burst = NULL;
- eth_dev->rx_pkt_burst = NULL;
-
PMD_INIT_LOG(DEBUG, "dev_uninit completed");
- return 0;
+ return ret;
}
return ETH_LINK_SPEED_56G;
case ETH_SPEED_NUM_100G:
return ETH_LINK_SPEED_100G;
+ case ETH_SPEED_NUM_200G:
+ return ETH_LINK_SPEED_200G;
default:
return 0;
}
}
if (hw->use_vec_rx) {
-#if defined RTE_ARCH_ARM64 || defined RTE_ARCH_ARM
+#if defined RTE_ARCH_ARM
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {
PMD_DRV_LOG(INFO,
"disabled split ring vectorized path for requirement not met");
/*
* Stop device: disable interrupt and mark link down
*/
-static void
+static int
virtio_dev_stop(struct rte_eth_dev *dev)
{
struct virtio_hw *hw = dev->data->dev_private;
struct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;
PMD_INIT_LOG(DEBUG, "stop");
+ dev->data->dev_started = 0;
rte_spinlock_lock(&hw->state_lock);
if (!hw->started)
rte_eth_linkstatus_set(dev, &link);
out_unlock:
rte_spinlock_unlock(&hw->state_lock);
+
+ return 0;
}
static int
if (!hw->started) {
link.link_status = ETH_LINK_DOWN;
+ link.link_speed = ETH_SPEED_NUM_NONE;
} else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
PMD_INIT_LOG(DEBUG, "Get link status from hw");
vtpci_read_dev_config(hw,
&status, sizeof(status));
if ((status & VIRTIO_NET_S_LINK_UP) == 0) {
link.link_status = ETH_LINK_DOWN;
+ link.link_speed = ETH_SPEED_NUM_NONE;
PMD_INIT_LOG(DEBUG, "Port %d is down",
dev->data->port_id);
} else {