NULL
};
-static struct ether_addr base_eth_addr = {
+static struct rte_ether_addr base_eth_addr = {
.addr_bytes = {
0x56 /* V */,
0x48 /* H */,
#define VHOST_NB_XSTATS_TXPORT (sizeof(vhost_txport_stat_strings) / \
sizeof(vhost_txport_stat_strings[0]))
-static void
+static int
vhost_dev_xstats_reset(struct rte_eth_dev *dev)
{
struct vhost_queue *vq = NULL;
continue;
memset(&vq->stats, 0, sizeof(vq->stats));
}
+
+ return 0;
}
static int
vhost_count_multicast_broadcast(struct vhost_queue *vq,
struct rte_mbuf *mbuf)
{
- struct ether_addr *ea = NULL;
+ struct rte_ether_addr *ea = NULL;
struct vhost_stats *pstats = &vq->stats;
- ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *);
- if (is_multicast_ether_addr(ea)) {
- if (is_broadcast_ether_addr(ea))
+ ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *);
+ if (rte_is_multicast_ether_addr(ea)) {
+ if (rte_is_broadcast_ether_addr(ea))
pstats->xstats[VHOST_BROADCAST_PKT]++;
else
pstats->xstats[VHOST_MULTICAST_PKT]++;
for (i = 0; i < dev->data->nb_tx_queues; i++)
rte_free(dev->data->tx_queues[i]);
- rte_free(dev->data->mac_addrs);
free(internal->dev_name);
free(internal->iface_name);
rte_free(internal);
dev->data->dev_private = NULL;
+
+ rte_free(vring_states[dev->data->port_id]);
+ vring_states[dev->data->port_id] = NULL;
}
static int
return 0;
}
-static void
+static int
eth_dev_info(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
internal = dev->data->dev_private;
if (internal == NULL) {
VHOST_LOG(ERR, "Invalid device specified\n");
- return;
+ return -ENODEV;
}
dev_info->max_mac_addrs = 1;
dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |
DEV_TX_OFFLOAD_VLAN_INSERT;
dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;
+
+ return 0;
}
static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned i;
- unsigned long rx_total = 0, tx_total = 0, tx_missed_total = 0;
+ unsigned long rx_total = 0, tx_total = 0;
unsigned long rx_total_bytes = 0, tx_total_bytes = 0;
struct vhost_queue *vq;
continue;
vq = dev->data->tx_queues[i];
stats->q_opackets[i] = vq->stats.pkts;
- tx_missed_total += vq->stats.missed_pkts;
tx_total += stats->q_opackets[i];
stats->q_obytes[i] = vq->stats.bytes;
stats->ipackets = rx_total;
stats->opackets = tx_total;
- stats->oerrors = tx_missed_total;
stats->ibytes = rx_total_bytes;
stats->obytes = tx_total_bytes;
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
struct vhost_queue *vq;
vq->stats.bytes = 0;
vq->stats.missed_pkts = 0;
}
+
+ return 0;
}
static void
.rx_queue_intr_disable = eth_rxq_intr_disable,
};
-static struct rte_vdev_driver pmd_vhost_drv;
-
static int
eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
int16_t queues, const unsigned int numa_node, uint64_t flags)
struct rte_eth_dev_data *data;
struct pmd_internal *internal = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct ether_addr *eth_addr = NULL;
+ struct rte_ether_addr *eth_addr = NULL;
struct rte_vhost_vring_state *vring_state = NULL;
struct internal_list *list = NULL;
internal->max_queues = queues;
internal->vid = -1;
data->dev_link = pmd_link;
- data->dev_flags = RTE_ETH_DEV_INTR_LSC;
+ data->dev_flags = RTE_ETH_DEV_INTR_LSC | RTE_ETH_DEV_CLOSE_REMOVE;
eth_dev->dev_ops = &ops;
/* find an ethdev entry */
eth_dev = rte_eth_dev_allocated(name);
if (eth_dev == NULL)
- return -ENODEV;
+ return 0;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return rte_eth_dev_release_port(eth_dev);
eth_dev_close(eth_dev);
- rte_free(vring_states[eth_dev->data->port_id]);
- vring_states[eth_dev->data->port_id] = NULL;
-
rte_eth_dev_release_port(eth_dev);
return 0;